You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(178) |
Feb
(169) |
Mar
(286) |
Apr
(117) |
May
(98) |
Jun
(68) |
Jul
(63) |
Aug
(121) |
Sep
(88) |
Oct
(124) |
Nov
(2) |
Dec
(111) |
2007 |
Jan
(224) |
Feb
(69) |
Mar
(10) |
Apr
(72) |
May
(7) |
Jun
(21) |
Jul
(33) |
Aug
(35) |
Sep
(12) |
Oct
(22) |
Nov
(5) |
Dec
(6) |
2008 |
Jan
(2) |
Feb
(10) |
Mar
(39) |
Apr
(58) |
May
(34) |
Jun
(9) |
Jul
(27) |
Aug
(10) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
From: Vance K. <va...@us...> - 2006-05-02 02:26:24
|
User: vancek Date: 06/05/01 19:26:23 Modified: andromda-ejb3/src/site site.xml Log: added DAO item Revision Changes Path 1.10 +1 -0 cartridges/andromda-ejb3/src/site/site.xml Index: site.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/site.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- site.xml 17 Apr 2006 02:04:16 -0000 1.9 +++ site.xml 2 May 2006 02:26:23 -0000 1.10 @@ -18,6 +18,7 @@ <menu name="How-to"> <item name="Introduction" href="howto.html"/> <item name="Entity" href="howto1.html"/> + <item name="Data Access Objects" href="howto19.html"/> <item name="Relationships" href="howto2.html"/> <item name="Service Beans" href="howto3.html"/> <item name="Composite Primary Key" href="howto4.html"/> |
From: Vance K. <va...@us...> - 2006-05-02 02:26:13
|
User: vancek Date: 06/05/01 19:26:02 Modified: andromda-ejb3/src/site/xdoc howto1.xml Log: revised to include DAO components. changed file view listings Revision Changes Path 1.6 +96 -43 cartridges/andromda-ejb3/src/site/xdoc/howto1.xml Index: howto1.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/xdoc/howto1.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- howto1.xml 17 Mar 2006 14:39:37 -0000 1.5 +++ howto1.xml 2 May 2006 02:26:02 -0000 1.6 @@ -36,20 +36,33 @@ <a href="../starting.html#My_first_AndroMDA_project">how to setup your first AndroMDA project</a>). </p> <p class="highlight"> - Please note that until the EJB3 cartridge is included in the AndroMDAPP project, you - will not be able to generate your project structure using that generator. + Please note that the EJB3 cartridge is now included in the AndroMDAPP project which meanss you + can generate your project structure using that generator. </p> <p> If everything went well, all code related to this class will have been generated into - the <code>/core/entity/target/src</code> project subdirectory, no manual implementation will need + the <code>core/target/src</code> project subdirectory, no manual implementation will need to be added at this point. </p> <p> The EJB3 cartridge changes the conventional entity creation hierarchy. Instead of generating - an entity base class with an entity implementation class, you now have an entity embeddable super - class with an entity class that inherits from this embeddable super class. This is the case - for simple non-inheriting hierarchies, however once you introduce inheritance, this changes. - To find out more about inheritance, go to the <a href="howto9.html">inheritance</a> section. + an entity base class with an entity implementation class, there are 2 ways the EJB3 cartridge + can generate your entity POJOs. + <ul> + <li> + In most cases, your entities will only model classifier scoped finder methods. If there + are no classifier scoped operations, then the cartridge auto generates (and will regenerate) + your entity components for you. The entity components include the entity POJO and + the DAO components associated with the entity. + </li> + <li> + The alternative is to have an embeddable/mapped superclass with an entity class that inherits + from this mapped superclass. This is the case where the entity models instance + scoped operations and are involved in non-inheriting hierarchies. + However once you introduce inheritance, this changes. To find out more about inheritance, + go to the <a href="howto9.html">inheritance</a> section. + </li> + </ul> </p> <p> <ul> @@ -60,8 +73,11 @@ </p> <p> <ul> - <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/a/CarEmbeddable.java.txt"><code>CarEmbeddable.java</code></a></li> - <li class="impl"><a class="changed" href="src/org/andromda/test/howto1/a/Car.java.txt"><code>Car.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/a/Car.java"><code>Car.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/a/CarDao.java"><code>CarDao.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/a/CarDaoBase.java"><code>CarDaoBase.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/a/CarDaoImpl.java"><code>CarDaoImpl.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/a/CarDaoException.java"><code>CarDaoException.java</code></a></li> </ul> </p> <p> @@ -79,20 +95,27 @@ <subsection name="Entity Operations"> <p> You may also model operations on an entity, this will generate them as methods in the resulting - Java subclass. Operations can be classifier scoped (<code>static</code> in Java) where they will - be underlined in UML diagrams as shown below. + components. Operations can be classifier scoped (<code>static</code> in Java) where they will + be underlined in UML diagrams as shown below. You may also define instance scoped operations + if you require. </p> <p class="highlight"> - Operations will not be defined in the embeddable superclass. They will be defined in the - inheriting subclass. This has consequences when dealing with a multi-tier inheritance - hierarchy. Refer to the <a href="howto9.html">inheritance</a> howto for further information. - This also implis that operations are only added to the implementation class on the first + In general, operations will not be defined in the mapped superclass. + They will be defined in the inheriting subclass. This has consequences when dealing with a + multi-tier inheritance hierarchy. + Refer to the <a href="howto9.html">inheritance</a> howto for further information. + This also implies that operations are only added to the implementation class on the first run of AndroMDA. Operations defined in the UML model must be manually added to the implementation class afterwards. This shouldn't cause any issues as the developer would have to define the operation implementation anyway to correspond to the abstract definition in - the embeddable superclass. The primary purpose for this strategy is to avoid having to + the mapped superclass. The primary purpose for this strategy is to avoid having to annotate the entity operation with <code>@javax.persistence.Transient</code> annotation - in both the embeddable superclass and the inheriting implementation class. + in both the mapped superclass and the inheriting implementation class. + </p> + <p class="highlight"> + Classifier scoped operations marked as query operations, known as finder methods, + modelled on entity are not rendered in the entity components, but instead added to the + DAO components. </p> <p> <img src="images/org/andromda/test/1/b/uml.gif"/> @@ -106,15 +129,27 @@ </p> <p> <ul> - <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/b/CarEmbeddable.java.txt"><code>CarEmbeddable.java</code></a></li> - <li class="impl"><a href="src/org/andromda/test/howto1/b/Car.java.txt"><code>Car.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/b/CarEmbeddable.java"><code>CarEmbeddable.java</code></a></li> + <li class="impl"><a class="changed" href="src/org/andromda/test/howto1/b/Car.java"><code>Car.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/b/CarDao.java"><code>CarDao.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/b/CarDaoBase.java"><code>CarDaoBase.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/b/CarDaoImpl.java"><code>CarDaoImpl.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/ab/CarDaoException.java"><code>CarDaoException.java</code></a></li> </ul> </p> <p> - Entity operations can also be Query operations. This is discussed further in the - <a href="howto6.html">Query Howto</a>. However, in general entities should NOT contain + Entity operations modelled as Query operations are discussed further in the + <a href="howto6.html">Query Howto</a>. In general entities should NOT contain any business logic. The EJB3 cartridge, like other persistence modeling cartridges, - uses the session facade pattern to contain business logic in session bean operations. + uses the session facade pattern to contain business logic in session bean operations while + typical CRUD persistence operations are provided throught the DAO layer. + </p> + <p> + The above example entity models <code>allCarsAreRented()</code> as classifier scoped and + <code>isRented()</code> as instance scoped. Both will be added to the entity implementation + subclass <code>Car</code>. The bulk of the entity detail, including much of the metadata exists + within the <code>CarEmbeddable</code> class. In such cases where non-query operations exists + for an entity, the implementation class is generated once only and will not be overridden. </p> </subsection> <a name="Entity_Relation_Table"/> @@ -138,8 +173,11 @@ </p> <p> <ul> - <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/c/CarEmbeddable.java.txt"><code>CarEmbeddable.java</code></a></li> - <li class="impl"><a class="changed" href="src/org/andromda/test/howto1/c/Car.java.txt"><code>Car.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/c/Car.java"><code>Car.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/c/CarDao.java"><code>CarDao.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/c/CarDaoBase.java"><code>CarDaoBase.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/c/CarDaoImpl.java"><code>CarDaoImpl.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/c/CarDaoException.java"><code>CarDaoException.java</code></a></li> </ul> </p> </subsection> @@ -162,8 +200,11 @@ </p> <p> <ul> - <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/d/CarEmbeddable.java.txt"><code>CarEmbeddable.java</code></a></li> - <li class="impl"><a href="src/org/andromda/test/howto1/d/Car.java.txt"><code>Car.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/d/Car.java"><code>Car.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/d/CarDao.java"><code>CarDao.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/d/CarDaoBase.java"><code>CarDaoBase.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/d/CarDaoImpl.java"><code>CarDaoImpl.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/d/CarDaoException.java"><code>CarDaoException.java</code></a></li> </ul> </p> <p> @@ -222,9 +263,9 @@ <subsection name="Insertable Attribute"> <p> To include the mapped column in the SQL insert statement, you set the <code>insertable</code> - property on the <code>@Column</code> annotation which is done by modelling the + property on the <code>@javax.persistence.Column</code> annotation which is done by modelling the <code>@andromda.persistence.column.insert</code> on the attribute. By default, this is set to - true, so it only needs to be specified if you want the column to be initialised using the + <code>true</code>, so it only needs to be specified if you want the column to be initialised using the database default value. </p> </subsection> @@ -232,9 +273,9 @@ <subsection name="Updatable Attribute"> <p> To include the mapped column in the SQL update statement, you set the <code>updatable</code> - property on the <code>@Column</code> annotation which is done by modelling the + property on the <code>@javax.persistence.Column</code> annotation which is done by modelling the <code>@andromda.persistence.column.update</code> on the attribute. By default, this is set to - true, so it only needs to be specified if you want the column to be updated using by the + <code>true</code>, so it only needs to be specified if you want the column to be updated using by the database automatically. </p> </subsection> @@ -279,8 +320,11 @@ </p> <p> <ul> - <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/e/CarEmbeddable.java.txt"><code>CarEmbeddable.java</code></a></li> - <li class="impl"><a href="src/org/andromda/test/howto1/e/Car.java.txt"><code>Car.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/e/Car.java"><code>Car.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/e/CarDao.java"><code>CarDao.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/e/CarDaoBase.java"><code>CarDaoBase.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/e/CarDaoImpl.java"><code>CarDaoImpl.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/e/CarDaoException.java"><code>CarDaoException.java</code></a></li> </ul> </p> <p> @@ -308,8 +352,11 @@ </p> <p> <ul> - <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/f/CarEmbeddable.java.txt"><code>CarEmbeddable.java</code></a></li> - <li class="impl"><a href="src/org/andromda/test/howto1/f/Car.java.txt"><code>Car.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/f/Car.java"><code>Car.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/f/CarDao.java"><code>CarDao.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/f/CarDaoBase.java"><code>CarDaoBase.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/f/CarDaoImpl.java"><code>CarDaoImpl.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/f/CarDaoException.java"><code>CarDaoException.java</code></a></li> </ul> </p> </subsection> @@ -330,7 +377,7 @@ <subsection name="LOB BLOB/CLOB Attributes"> <p> An attribute can be specified as either a BLOB or CLOB field. This is modelled by setting - the attribute type to <code>datatype::Clob</code> or <code>datatype::Blob</code>. This will add + the attribute type to <code>datatype::Blob</code> or <code>datatype::Clob</code>. This will add the <code>@javax.persistence.Lob</code> annotation to the entity attribute. The EJB3 cartridge will assign a default Java type based on the Java mappings specified in AndroMDA. For a Blob, the default is <code>byte[]</code>. For a Clob, the default is <code>String</code>. @@ -371,13 +418,16 @@ </p> <p> <ul> - <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/g/CarEmbeddable.java.txt"><code>CarEmbeddable.java</code></a></li> - <li class="impl"><a href="src/org/andromda/test/howto1/g/Car.java.txt"><code>Car.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/g/Car.java"><code>Car.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/g/CarDao.java"><code>CarDao.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/g/CarDaoBase.java"><code>CarDaoBase.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/g/CarDaoImpl.java"><code>CarDaoImpl.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/g/CarDaoException.java"><code>CarDaoException.java</code></a></li> </ul> </p> <p> This example models the attribute named <code>type</code> as a CLOB where the corresponding - column in the table will be of type String and the cartridge will set the fetch type for the + column in the table will be of type <code>String</code> and the cartridge will set the fetch type for the attribute to <b>eagerly</b> fetch. The attribute <code>information</code> is defined as a LOB, but it's of type <code>char[]</code>. </p> @@ -400,8 +450,11 @@ </p> <p> <ul> - <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/h/CarEmbeddable.java.txt"><code>CarEmbeddable.java</code></a></li> - <li class="impl"><a href="src/org/andromda/test/howto1/h/Car.java.txt"><code>Car.java</code></a></li> + <li class="gen"><a class="changed" href="src/org/andromda/test/howto1/g/Car.java"><code>Car.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/g/CarDao.java"><code>CarDao.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/g/CarDaoBase.java"><code>CarDaoBase.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/g/CarDaoImpl.java"><code>CarDaoImpl.java</code></a></li> + <li class="gen"><a href="src/org/andromda/test/howto1/g/CarDaoException.java"><code>CarDaoException.java</code></a></li> </ul> </p> <p> @@ -428,15 +481,15 @@ <p> In some cases, setting up lifecycle event callbacks for the entity beans can be quite useful. The EJB3 cartridge provides the facility to define these callback methods - in the listener class. This class if NOT generate by default. To find out more information, + in the listener class. This class is NOT generated by default. To find out more information, click on <a href="howto14.html">Listener Callback</a>. </p> </subsection> </section> <section name="Next"> <p> - In the next section we'll learn about entity relationships, click - <a href="howto2.html">here</a> to continue. + Next we will learn about the DAO components generated for the entities, click + <a href="howto19.html">here</a> to continue. </p> </section> </body> |
From: Vance K. <va...@us...> - 2006-05-02 02:24:44
|
User: vancek Date: 06/05/01 19:24:43 Modified: andromda-ejb3/src/site/xdoc howto.xml Log: added DAO content Revision Changes Path 1.13 +9 -0 cartridges/andromda-ejb3/src/site/xdoc/howto.xml Index: howto.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/xdoc/howto.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -r1.12 -r1.13 --- howto.xml 17 Apr 2006 14:52:52 -0000 1.12 +++ howto.xml 2 May 2006 02:24:43 -0000 1.13 @@ -45,6 +45,15 @@ </ul> </li> <li> + <a href="howto19.html">Data Access Objects</a> + <ul> + <li><a href="howto19.html#Queries">Queries</a></li> + <li><a href="howto19.html#View_Interface">View_Interface</a></li> + <li><a href="howto19.html#Transactions">Transactions</a></li> + <li><a href="howto19.html#Security">Security</a></li> + </ul> + </li> + <li> <a href="howto2.html">Relationships</a> <ul> <li><a href="howto2.html#Cascading">Cascading</a></li> |
From: Vance K. <va...@us...> - 2006-05-02 02:01:21
|
User: vancek Date: 06/05/01 19:01:19 Modified: andromda-ejb3/src/main/uml EJB3MetafacadeModel.xml.zip Log: added roleAllowed, securityRealm and securityEnabled properties to EJB3EntityFacade. added nonRunAsRoles association to Role metafacade. Revision Changes Path 1.35 +206 -184 cartridges/andromda-ejb3/src/main/uml/EJB3MetafacadeModel.xml.zip <<Binary file>> |
From: Vance K. <va...@us...> - 2006-05-02 01:59:50
|
User: vancek Date: 06/05/01 18:59:49 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3EntityFacadeLogicImpl.java Log: implemented handleIsSecurityEnabled, handleGetRolesAllowed, handleGetSecurityRealm and handleGetNonRunAsRoles for DAO components Revision Changes Path 1.22 +93 -0 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3EntityFacadeLogicImpl.java Index: EJB3EntityFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3EntityFacadeLogicImpl.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -r1.21 -r1.22 --- EJB3EntityFacadeLogicImpl.java 30 Apr 2006 01:57:24 -0000 1.21 +++ EJB3EntityFacadeLogicImpl.java 2 May 2006 01:59:49 -0000 1.22 @@ -5,6 +5,7 @@ import java.util.Collection; import java.util.Collections; import java.util.Iterator; +import java.util.LinkedHashSet; import org.andromda.cartridges.ejb3.EJB3Globals; import org.andromda.cartridges.ejb3.EJB3Profile; @@ -23,6 +24,7 @@ import org.andromda.metafacades.uml.GeneralizableElementFacade; import org.andromda.metafacades.uml.MetafacadeUtils; import org.andromda.metafacades.uml.OperationFacade; +import org.andromda.metafacades.uml.Role; import org.andromda.metafacades.uml.TypeMappings; import org.andromda.metafacades.uml.UMLMetafacadeProperties; import org.andromda.metafacades.uml.UMLProfile; @@ -30,6 +32,7 @@ import org.apache.commons.collections.Closure; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.Predicate; +import org.apache.commons.collections.Transformer; import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang.ObjectUtils; import org.apache.commons.lang.StringUtils; @@ -1491,4 +1494,94 @@ } return list.toString(); } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogic#handleIsSecurityEnabled() + */ + protected boolean handleIsSecurityEnabled() + { + return StringUtils.isNotBlank(this.getSecurityRealm()); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogic#handleGetRolesAllowed() + */ + protected String handleGetRolesAllowed() + { + StringBuffer rolesAllowed = null; + String separator = ""; + + for (final Iterator iter = this.getNonRunAsRoles().iterator(); iter.hasNext(); ) + { + if (rolesAllowed == null) + { + rolesAllowed = new StringBuffer(); + } + rolesAllowed.append(separator); + Role role = (Role)iter.next(); + rolesAllowed.append('"'); + rolesAllowed.append(role.getName()); + rolesAllowed.append('"'); + separator = ", "; + } + return rolesAllowed != null ? rolesAllowed.toString() : null; + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogic#handleGetSecurityRealm() + */ + protected String handleGetSecurityRealm() + { + String securityRealm = (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_EJB_SECURITY_REALM); + if (StringUtils.isBlank(securityRealm)) + { + securityRealm = StringUtils.trimToEmpty( + ObjectUtils.toString(this.getConfiguredProperty(EJB3Globals.SECURITY_REALM))); + } + return securityRealm; + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogic#handleGetNonRunAsRoles() + */ + protected Collection handleGetNonRunAsRoles() + { + Collection roles = this.getTargetDependencies(); + CollectionUtils.filter( + roles, + new Predicate() + { + public boolean evaluate(final Object object) + { + DependencyFacade dependency = (DependencyFacade)object; + return dependency != null + && dependency.getSourceElement() != null + && dependency.getSourceElement() instanceof Role + && !dependency.hasStereotype(EJB3Profile.STEREOTYPE_SECURITY_RUNAS); + } + }); + CollectionUtils.transform( + roles, + new Transformer() + { + public Object transform(final Object object) + { + return ((DependencyFacade)object).getSourceElement(); + } + }); + final Collection allRoles = new LinkedHashSet(roles); + // add all roles which are generalizations of this one + CollectionUtils.forAllDo( + roles, + new Closure() + { + public void execute(final Object object) + { + allRoles.addAll(((Role)object).getAllSpecializations()); + } + }); + return allRoles; + } + + } \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-05-02 01:57:49
|
User: vancek Date: 06/05/01 18:57:47 Modified: andromda-ejb3/src/main/resources/templates/ejb3 DaoBase.vsl Log: if security settings are enabled either specify allowed roles or permit all roles at the class level Revision Changes Path 1.4 +7 -0 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/DaoBase.vsl Index: DaoBase.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/DaoBase.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- DaoBase.vsl 30 Apr 2006 01:47:44 -0000 1.3 +++ DaoBase.vsl 2 May 2006 01:57:47 -0000 1.4 @@ -31,6 +31,13 @@ */ @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.REQUIRED) @javax.ejb.Local({${entity.fullyQualifiedDaoName}.class}) +#if ($entity.securityEnabled) +#**##if ($stringUtils.isBlank(${entity.rolesAllowed})) +...@ja...rmitAll +#**##else +...@ja...lesAllowed({${entity.rolesAllowed}}) +#**##end +#end public abstract class $entity.daoBaseName #if ($daoInheritance) extends $entity.generalization.fullyQualifiedDaoImplementationName |
From: Vance K. <va...@us...> - 2006-05-01 07:04:19
|
User: vancek Date: 06/05/01 00:04:07 Removed: andromda-ejb3/src/main/resources/templates/ejb3 EntityImpl.vsl Log: removed EntityImpl template |
From: Vance K. <va...@us...> - 2006-05-01 07:01:24
|
User: vancek Date: 06/05/01 00:01:22 Removed: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: remove SessionBean template - using SessionBeanBase |
From: Vance K. <va...@us...> - 2006-04-30 02:06:28
|
User: vancek Date: 06/04/29 19:06:26 Modified: andromda-ejb3/src/main/uml EJB3MetafacadeModel.xml.zip Log: added implementationCall, implementationName and implementationSignature properties to EJB3OperationFacade. added instanceAttributeNameList and instanceAttributeTypeList methods to EJB3EntityFacade. Revision Changes Path 1.34 +180 -195 cartridges/andromda-ejb3/src/main/uml/EJB3MetafacadeModel.xml.zip <<Binary file>> |
From: Vance K. <va...@us...> - 2006-04-30 01:58:55
|
User: vancek Date: 06/04/29 18:58:53 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3OperationFacadeLogicImpl.java Log: implemented handleGetImplementationCall, handleGetImplementationName and handleGetImplementationSignature for DAO impl component Revision Changes Path 1.5 +42 -0 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3OperationFacadeLogicImpl.java Index: EJB3OperationFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3OperationFacadeLogicImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- EJB3OperationFacadeLogicImpl.java 5 Mar 2006 06:00:43 -0000 1.4 +++ EJB3OperationFacadeLogicImpl.java 30 Apr 2006 01:58:53 -0000 1.5 @@ -1,5 +1,7 @@ package org.andromda.cartridges.ejb3.metafacades; +import java.text.MessageFormat; + import org.andromda.cartridges.ejb3.EJB3Globals; import org.andromda.cartridges.ejb3.EJB3Profile; import org.apache.commons.lang.ObjectUtils; @@ -112,4 +114,44 @@ this.isPreUpdate(); } + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3OperationFacadeLogic#handleGetImplementationName() + */ + protected String handleGetImplementationName() + { + return this.getImplementationOperationName(StringUtils.capitalize(this.getName())); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3OperationFacadeLogic#handleGetImplementationCall() + */ + protected String handleGetImplementationCall() + { + return this.getImplementationOperationName(StringUtils.capitalize(this.getCall())); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3OperationFacadeLogic#handleGetImplementationSignature() + */ + protected String handleGetImplementationSignature() + { + return this.getImplementationOperationName(StringUtils.capitalize(this.getSignature())); + } + + /** + * Retrieves the implementationOperatName by replacing the <code>replacement</code> in the {@link + * EJB3Globals#IMPLEMENTATION_OPERATION_NAME_PATTERN} + * + * @param replacement the replacement string for the pattern. + * @return the operation name + */ + private String getImplementationOperationName(String replacement) + { + String implementationNamePattern = + (String)this.getConfiguredProperty(EJB3Globals.IMPLEMENTATION_OPERATION_NAME_PATTERN); + + return MessageFormat.format( + implementationNamePattern, + new Object[] {StringUtils.trimToEmpty(replacement)}); + } } \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-04-30 01:57:25
|
User: vancek Date: 06/04/29 18:57:24 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3EntityFacadeLogicImpl.java Log: implemented handleGetInstanceAttributeNameList and handleGetInstanceAttributeTypeList methods used in DAO components create methods that include entity instance properties Revision Changes Path 1.21 +102 -1 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3EntityFacadeLogicImpl.java Index: EJB3EntityFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3EntityFacadeLogicImpl.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -r1.20 -r1.21 --- EJB3EntityFacadeLogicImpl.java 27 Apr 2006 06:52:44 -0000 1.20 +++ EJB3EntityFacadeLogicImpl.java 30 Apr 2006 01:57:24 -0000 1.21 @@ -12,9 +12,11 @@ import org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade; import org.andromda.cartridges.ejb3.metafacades.EJB3OperationFacade; import org.andromda.core.common.ExceptionRecorder; +import org.andromda.metafacades.uml.AssociationEndFacade; import org.andromda.metafacades.uml.AttributeFacade; import org.andromda.metafacades.uml.ClassifierFacade; import org.andromda.metafacades.uml.DependencyFacade; +import org.andromda.metafacades.uml.EntityAssociationEnd; import org.andromda.metafacades.uml.EntityAttribute; import org.andromda.metafacades.uml.EnumerationFacade; import org.andromda.metafacades.uml.FilteredCollection; @@ -25,6 +27,7 @@ import org.andromda.metafacades.uml.UMLMetafacadeProperties; import org.andromda.metafacades.uml.UMLProfile; import org.andromda.metafacades.uml.ValueObject; +import org.apache.commons.collections.Closure; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.Predicate; import org.apache.commons.lang.BooleanUtils; @@ -1306,7 +1309,8 @@ if (targetElement instanceof ClassifierFacade) { ClassifierFacade element = (ClassifierFacade)targetElement; - valid = element.isDataType() || element instanceof ValueObject || element instanceof EnumerationFacade; + valid = element.isDataType() || element instanceof ValueObject || + element instanceof EnumerationFacade; } return valid; } @@ -1390,4 +1394,101 @@ } }; } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogic# + * handleGetInstanceAttributeNameList(boolean, boolean) + */ + protected String handleGetInstanceAttributeNameList(boolean follow, boolean withIdentifiers) + { + return this.getNameList(this.getInstanceAttributes(follow, withIdentifiers)); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogic# + * handleGetInstanceAttributeTypeList(boolean, boolean) + */ + protected String handleGetInstanceAttributeTypeList(boolean follow, boolean withIdentifiers) + { + return this.getTypeList(this.getInstanceAttributes(follow, withIdentifiers)); + } + + /** + * Constructs a comma seperated list of attribute type names from the passed in collection of + * <code>attributes</code>. + * + * @param attributes the attributes to construct the list from. + * @return the comma seperated list of attribute types. + */ + private String getTypeList(final Collection attributes) + { + final StringBuffer list = new StringBuffer(); + final String comma = ", "; + CollectionUtils.forAllDo( + attributes, + new Closure() + { + public void execute(final Object object) + { + if (object instanceof AttributeFacade) + { + final AttributeFacade attribute = (AttributeFacade)object; + if (attribute.getType() != null) + { + list.append(attribute.getType().getFullyQualifiedName()); + list.append(comma); + } + } + if (object instanceof AssociationEndFacade) + { + final AssociationEndFacade associationEnd = (AssociationEndFacade)object; + if (associationEnd.getType() != null) + { + list.append(associationEnd.getType().getFullyQualifiedName()); + list.append(comma); + } + } + } + }); + if (list.toString().endsWith(comma)) + { + list.delete(list.lastIndexOf(comma), list.length()); + } + return list.toString(); + } + + /** + * Constructs a comma seperated list of attribute names from the passed in collection of <code>attributes</code>. + * + * @param properties the properties to construct the list from. + * @return the comma seperated list of attribute names. + */ + private String getNameList(final Collection properties) + { + final StringBuffer list = new StringBuffer(); + final String comma = ", "; + CollectionUtils.forAllDo( + properties, + new Closure() + { + public void execute(Object object) + { + if (object instanceof EntityAttribute) + { + list.append(((AttributeFacade)object).getName()); + list.append(comma); + } + if (object instanceof EntityAssociationEnd) + { + list.append(((AssociationEndFacade)object).getName()); + list.append(comma); + } + } + }); + if (list.toString().endsWith(comma)) + { + list.delete(list.lastIndexOf(comma), list.length()); + } + return list.toString(); + } } \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-04-30 01:54:48
|
User: vancek Date: 06/04/29 18:54:47 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3SessionOperationFacadeLogicImpl.java andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3 EJB3Globals.java Log: refactored SERVICE_IMPLEMENTATION_OPERATION_NAME_PATTERN constant from EJB3SessionOperationFacadeLogicImpl & extract to EJB3Globals as IMPLEMENATION_OPERATION_NAME_PATTERN used by session and entity (DAO) operations Revision Changes Path 1.11 +2 -8 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionOperationFacadeLogicImpl.java Index: EJB3SessionOperationFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionOperationFacadeLogicImpl.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -r1.10 -r1.11 --- EJB3SessionOperationFacadeLogicImpl.java 9 Mar 2006 04:46:26 -0000 1.10 +++ EJB3SessionOperationFacadeLogicImpl.java 30 Apr 2006 01:54:47 -0000 1.11 @@ -29,12 +29,6 @@ public class EJB3SessionOperationFacadeLogicImpl extends EJB3SessionOperationFacadeLogic { - /** - * The property used to specify the implementation operation name pattern - * on service beans. - */ - public static final String SERVICE_IMPLEMENTATION_OPERATION_NAME_PATTERN = - "serviceImplementationOperationNamePattern"; public EJB3SessionOperationFacadeLogicImpl (Object metaObject, String context) { @@ -308,7 +302,7 @@ /** * Retrieves the implementationOperatName by replacing the <code>replacement</code> in the {@link - * SERVICE_IMPLEMENTATION_OPERATION_NAME_PATTERN} + * EJB3Globals#IMPLEMENTATION_OPERATION_NAME_PATTERN} * * @param replacement the replacement string for the pattern. * @return the operation name @@ -316,7 +310,7 @@ private String getImplementationOperationName(String replacement) { String implementationNamePattern = - (String)this.getConfiguredProperty(SERVICE_IMPLEMENTATION_OPERATION_NAME_PATTERN); + (String)this.getConfiguredProperty(EJB3Globals.IMPLEMENTATION_OPERATION_NAME_PATTERN); return MessageFormat.format( implementationNamePattern, 1.10 +7 -0 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3Globals.java Index: EJB3Globals.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/EJB3Globals.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- EJB3Globals.java 24 Apr 2006 02:44:59 -0000 1.9 +++ EJB3Globals.java 30 Apr 2006 01:54:47 -0000 1.10 @@ -234,4 +234,11 @@ * Entity Manager. */ public static final String PERSISTENCE_CONTEXT_UNIT_NAME = "persistenceContextUnitName"; + + /** + * The property used to specify the implementation operation name pattern + * on service and entity beans. + */ + public static final String IMPLEMENTATION_OPERATION_NAME_PATTERN = + "implementationOperationNamePattern"; } |
From: Vance K. <va...@us...> - 2006-04-30 01:52:10
|
User: vancek Date: 06/04/29 18:52:09 Modified: andromda-ejb3/src/main/resources/META-INF/andromda namespace.xml Log: renamed serviceImplementationOperationNamePattern property to implementationOperationNamePattern Revision Changes Path 1.22 +2 -1 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/namespace.xml Index: namespace.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/namespace.xml,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -r1.21 -r1.22 --- namespace.xml 24 Apr 2006 02:42:51 -0000 1.21 +++ namespace.xml 30 Apr 2006 01:52:09 -0000 1.22 @@ -442,10 +442,11 @@ bean base class name. </documentation> </property> - <property name="serviceImplementationOperationNamePattern"> + <property name="implementationOperationNamePattern"> <default>handle{0}</default> <documentation> The pattern used to the create the implementation operation name + for both session and entity bean operations. (i.e. the operations that actually perform the handling of the logic), where <em>{0}</em> represents the operation name. </documentation> |
From: Vance K. <va...@us...> - 2006-04-30 01:51:13
|
User: vancek Date: 06/04/29 18:51:11 Modified: andromda-ejb3/src/main/resources/META-INF/andromda metafacades.xml Log: renamed property serviceImplementationOperationNamePattern to implementationOperationNamePattern usable by session and entity operation facades Revision Changes Path 1.23 +4 -3 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/metafacades.xml Index: metafacades.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/metafacades.xml,v retrieving revision 1.22 retrieving revision 1.23 diff -u -w -r1.22 -r1.23 --- metafacades.xml 24 Apr 2006 02:41:19 -0000 1.22 +++ metafacades.xml 30 Apr 2006 01:51:11 -0000 1.23 @@ -90,13 +90,13 @@ <mapping> <stereotype>WEBSERVICE_OPERATION</stereotype> </mapping> - <property reference="serviceImplementationOperationNamePattern"/> + <property reference="implementationOperationNamePattern"/> </metafacade> <metafacade class="org.andromda.cartridges.ejb3.metafacades.EJB3WebServiceOperationFacadeLogicImpl"> <mapping> <property name="owner.eJB3WebServiceFacadeMetaType"/> </mapping> - <property reference="serviceImplementationOperationNamePattern"/> + <property reference="implementationOperationNamePattern"/> </metafacade> <!-- Entity Metafacades --> @@ -106,6 +106,7 @@ org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade </context> </mapping> + <property reference="implementationOperationNamePattern"/> </metafacade> <metafacade class="org.andromda.cartridges.ejb3.metafacades.EJB3FinderMethodFacadeLogicImpl" contextRoot="true"> <mapping> @@ -179,7 +180,7 @@ <mapping> <property name="owner.eJB3SessionFacadeMetaType"/> </mapping> - <property reference="serviceImplementationOperationNamePattern"/> + <property reference="implementationOperationNamePattern"/> </metafacade> <metafacade class="org.andromda.cartridges.ejb3.metafacades.EJB3SessionAttributeFacadeLogicImpl"> <mapping> |
From: Vance K. <va...@us...> - 2006-04-30 01:49:04
|
User: vancek Date: 06/04/29 18:48:59 Modified: andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: add new line after constant declarations Revision Changes Path 1.27 +1 -0 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.26 retrieving revision 1.27 diff -u -w -r1.26 -r1.27 --- EntityEmbeddable.vsl 27 Apr 2006 06:47:01 -0000 1.26 +++ EntityEmbeddable.vsl 30 Apr 2006 01:48:59 -0000 1.27 @@ -130,6 +130,7 @@ #**##foreach ($constant in $constants) @javax.persistence.Transient public static final $constant.type.fullyQualifiedName $constant.name = $constant.defaultValue; + #**##end #end ## |
From: Vance K. <va...@us...> - 2006-04-30 01:48:17
|
User: vancek Date: 06/04/29 18:48:17 Modified: andromda-ejb3/src/main/resources/templates/ejb3 DaoImpl.vsl Log: fix comment Revision Changes Path 1.2 +2 -2 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/DaoImpl.vsl Index: DaoImpl.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/DaoImpl.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- DaoImpl.vsl 24 Apr 2006 02:21:43 -0000 1.1 +++ DaoImpl.vsl 30 Apr 2006 01:48:17 -0000 1.2 @@ -25,7 +25,7 @@ #foreach ($operation in $entity.daoBusinessOperations) #**##set ($returnType = $operation.returnType) #**##set ($returnObject = "returnValue") -#**##set ($signature = $operation.implementationSignature) +#**##set ($signature = "$operation.implementationSignature") /** * @see ${entity.fullyQualifiedDaoName}#${operation.getSignature(false)} */ @@ -34,7 +34,7 @@ throws $operation.exceptionList #**##end { - // ${toDoTag} implement $operation.visibility $returnType.fullyQualifiedName $signature + // TODO implement $operation.visibility $returnType.fullyQualifiedName $signature #**##if ($operation.returnTypePresent) return $operation.returnType.javaNullString; #**##else |
From: Vance K. <va...@us...> - 2006-04-30 01:47:47
|
User: vancek Date: 06/04/29 18:47:44 Modified: andromda-ejb3/src/main/resources/templates/ejb3 DaoBase.vsl DaoLocal.vsl Log: fix create methods that include dao properties to limit to instance properties only Revision Changes Path 1.3 +6 -6 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/DaoBase.vsl Index: DaoBase.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/DaoBase.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- DaoBase.vsl 26 Apr 2006 15:10:51 -0000 1.2 +++ DaoBase.vsl 30 Apr 2006 01:47:44 -0000 1.3 @@ -222,28 +222,28 @@ } #**##if ($enableDaoPropertiesCreateMethod.equalsIgnoreCase('true')) -#* *##set ($attributes = $entity.getAttributes(true, $entity.usingAssignedIdentifier)) +#* *##set ($attributes = $entity.getInstanceAttributes(true, $entity.usingAssignedIdentifier)) #* *##if (!$attributes.empty) /** - * @see ${rootDaoType}#create(${entity.getAttributeTypeList(true, false)}) + * @see ${rootDaoType}#create(${entity.getInstanceAttributeTypeList(true, false)}) */ public $rootEntityType create( #* *##foreach($attribute in $attributes) - $attribute.type.fullyQualifiedName $attribute.name#if($velocityCount != $attributes.size()),#else) + #if ($stringUtils.isNotBlank($attribute.lobType))${attribute.lobType}#else${attribute.type.fullyQualifiedName}#end $attribute.name#if($velocityCount != $attributes.size()),#else) throws ${entity.fullyQualifiedDaoDefaultExceptionName}#end #* *##end { - return ($rootEntityType)this.create($entity.daoNoTransformationConstantName, ${entity.getAttributeNameList(true, $entity.usingAssignedIdentifier)}); + return ($rootEntityType)this.create($entity.daoNoTransformationConstantName, ${entity.getInstanceAttributeNameList(true, $entity.usingAssignedIdentifier)}); } /** - * @see ${rootDaoType}#create(int, ${entity.getAttributeTypeList(true, false)}) + * @see ${rootDaoType}#create(int, ${entity.getInstanceAttributeTypeList(true, false)}) */ public Object create( final int transform, #* *##foreach($attribute in $attributes) - $attribute.type.fullyQualifiedName $attribute.name#if($velocityCount != $attributes.size()),#else) + #if ($stringUtils.isNotBlank($attribute.lobType))${attribute.lobType}#else${attribute.type.fullyQualifiedName}#end $attribute.name#if($velocityCount != $attributes.size()),#else) throws ${entity.fullyQualifiedDaoDefaultExceptionName}#end #* *##end 1.2 +4 -4 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/DaoLocal.vsl Index: DaoLocal.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/DaoLocal.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- DaoLocal.vsl 24 Apr 2006 02:21:43 -0000 1.1 +++ DaoLocal.vsl 30 Apr 2006 01:47:44 -0000 1.2 @@ -196,7 +196,7 @@ throws ${entity.fullyQualifiedDaoDefaultExceptionName}; #**##if ($enableDaoPropertiesCreateMethod.equalsIgnoreCase('true')) -#* *##set ($attributes = $entity.getAttributes(true, $entity.usingAssignedIdentifier)) +#* *##set ($attributes = $entity.getInstanceAttributes(true, $entity.usingAssignedIdentifier)) #* *##if (!$attributes.empty) /** * <p> @@ -207,14 +207,14 @@ */ public $rootEntityType create( #* *##foreach($attribute in $attributes) - $attribute.type.fullyQualifiedName $attribute.name#if($velocityCount != $attributes.size()),#else) + #if ($stringUtils.isNotBlank($attribute.lobType))${attribute.lobType}#else${attribute.type.fullyQualifiedName}#end $attribute.name#if($velocityCount != $attributes.size()),#else) throws ${entity.fullyQualifiedDaoDefaultExceptionName};#end #* *##end /** * <p> - * Does the same thing as {@link #create($entity.getAttributeTypeList(true,false))} with an + * Does the same thing as {@link #create($entity.getInstanceAttributeTypeList(true,false))} with an * additional flag called <code>transform</code>. If this flag is set to <code>$entity.daoNoTransformationConstantName</code> then * the returned entity will <strong>NOT</strong> be transformed. If this flag is any of the other constants * defined here then the result <strong>WILL BE</strong> passed through an operation which can optionally @@ -227,7 +227,7 @@ public Object create( int transform, #* *##foreach($attribute in $attributes) - $attribute.type.fullyQualifiedName $attribute.name#if($velocityCount != $attributes.size()),#else) + #if ($stringUtils.isNotBlank($attribute.lobType))${attribute.lobType}#else${attribute.type.fullyQualifiedName}#end $attribute.name#if($velocityCount != $attributes.size()),#else) throws ${entity.fullyQualifiedDaoDefaultExceptionName};#end #* *##end |
From: Chris M. <cm...@us...> - 2006-04-28 16:07:31
|
User: cmicali Date: 06/04/28 09:07:25 Modified: etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn AssemblyInfo.cs VS80AddIn.cs etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Dialogs AboutOptionsPage.cs AboutOptionsPage.designer.cs Added: etc/andromda-dotnet/AndroMDA.VS80AddIn AndroMDA VS2005 Add-In License.rtf AndroMDA VS2005 Add-In Readme.rtf etc/andromda-dotnet/AndroMDA.VS80AddIn/Installer AndroMDA VS2005 Add-In Setup.exe AndroMDA VS2005 Add-In Setup.nsi ReplaceInFile.nsh Removed: etc/andromda-dotnet/AndroMDA.VS80AddIn Readme.doc Log: - Added NSIS based installer - Added andromda.org license Revision Changes Path 1.5 +1 -1 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/AssemblyInfo.cs Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/AssemblyInfo.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- AssemblyInfo.cs 28 Apr 2006 04:40:37 -0000 1.4 +++ AssemblyInfo.cs 28 Apr 2006 16:07:24 -0000 1.5 @@ -34,7 +34,7 @@ // You can specify all the value or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.2.0")] +[assembly: AssemblyVersion(AndroMDA.VS80AddIn.VS80AddIn.ADD_IN_VERSION)] // // In order to sign your assembly you must specify a key to use. Refer to the 1.3 +2 -0 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/VS80AddIn.cs Index: VS80AddIn.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/VS80AddIn.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- VS80AddIn.cs 28 Apr 2006 04:40:37 -0000 1.2 +++ VS80AddIn.cs 28 Apr 2006 16:07:24 -0000 1.3 @@ -20,6 +20,8 @@ public class VS80AddIn { + public const string ADD_IN_VERSION = "1.0.2"; + #region Constants private static string TOOL_BAR_NAME = "AndroMDA"; 1.2 +1 -0 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Dialogs/AboutOptionsPage.cs Index: AboutOptionsPage.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Dialogs/AboutOptionsPage.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- AboutOptionsPage.cs 18 Apr 2006 16:14:44 -0000 1.1 +++ AboutOptionsPage.cs 28 Apr 2006 16:07:24 -0000 1.2 @@ -49,6 +49,7 @@ { InitializeComponent(); //linkLabel1.Links.Add(0, linkLabel1.Text.Length); + lblVersion.Text = VS80AddIn.ADD_IN_VERSION; } #region IDTToolsOptionsPage Members 1.3 +213 -213 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Dialogs/AboutOptionsPage.designer.cs Index: AboutOptionsPage.designer.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Dialogs/AboutOptionsPage.designer.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- AboutOptionsPage.designer.cs 18 Apr 2006 17:18:51 -0000 1.2 +++ AboutOptionsPage.designer.cs 28 Apr 2006 16:07:24 -0000 1.3 @@ -44,7 +44,7 @@ this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.label8 = new System.Windows.Forms.Label(); + this.lblVersion = new System.Windows.Forms.Label(); this.groupBox2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); @@ -210,24 +210,24 @@ this.pictureBox1.TabIndex = 4; this.pictureBox1.TabStop = false; // - // label8 + // lblVersion // - this.label8.BackColor = System.Drawing.Color.Black; - this.label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label8.ForeColor = System.Drawing.Color.LightGray; - this.label8.Location = new System.Drawing.Point(319, 56); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(73, 13); - this.label8.TabIndex = 0; - this.label8.Text = "v1.0"; - this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.lblVersion.BackColor = System.Drawing.Color.Black; + this.lblVersion.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblVersion.ForeColor = System.Drawing.Color.LightGray; + this.lblVersion.Location = new System.Drawing.Point(319, 56); + this.lblVersion.Name = "lblVersion"; + this.lblVersion.Size = new System.Drawing.Size(73, 13); + this.lblVersion.TabIndex = 0; + this.lblVersion.Text = "version"; + this.lblVersion.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // // AboutOptionsPage // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.label2); - this.Controls.Add(this.label8); + this.Controls.Add(this.lblVersion); this.Controls.Add(this.label1); this.Controls.Add(this.linkLabel2); this.Controls.Add(this.pictureBox1); @@ -260,6 +260,6 @@ private System.Windows.Forms.Label label6; private System.Windows.Forms.Label lblLastGenerated; private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label lblVersion; } } No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision No revision 1.1 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/Installer/ReplaceInFile.nsh Index: ReplaceInFile.nsh =================================================================== ; StrReplace ; Replaces all ocurrences of a given needle within a haystack with another string ; Written by dandaman32 Var STR_REPLACE_VAR_0 Var STR_REPLACE_VAR_1 Var STR_REPLACE_VAR_2 Var STR_REPLACE_VAR_3 Var STR_REPLACE_VAR_4 Var STR_REPLACE_VAR_5 Var STR_REPLACE_VAR_6 Var STR_REPLACE_VAR_7 Var STR_REPLACE_VAR_8 Function StrReplace Exch $STR_REPLACE_VAR_2 Exch 1 Exch $STR_REPLACE_VAR_1 Exch 2 Exch $STR_REPLACE_VAR_0 StrCpy $STR_REPLACE_VAR_3 -1 StrLen $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_1 StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0 loop: IntOp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_3 + 1 StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_4 $STR_REPLACE_VAR_3 StrCmp $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_1 found StrCmp $STR_REPLACE_VAR_3 $STR_REPLACE_VAR_6 done Goto loop found: StrCpy $STR_REPLACE_VAR_5 $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_3 IntOp $STR_REPLACE_VAR_8 $STR_REPLACE_VAR_3 + $STR_REPLACE_VAR_4 StrCpy $STR_REPLACE_VAR_7 $STR_REPLACE_VAR_0 "" $STR_REPLACE_VAR_8 StrCpy $STR_REPLACE_VAR_0 $STR_REPLACE_VAR_5$STR_REPLACE_VAR_2$STR_REPLACE_VAR_7 StrLen $STR_REPLACE_VAR_6 $STR_REPLACE_VAR_0 Goto loop done: Pop $STR_REPLACE_VAR_1 ; Prevent "invalid opcode" errors and keep the Pop $STR_REPLACE_VAR_1 ; stack as it was before the function was called Exch $STR_REPLACE_VAR_0 FunctionEnd !macro _strReplaceConstructor OUT NEEDLE NEEDLE2 HAYSTACK Push "${NEEDLE}" Push "${NEEDLE2}" Push "${HAYSTACK}" Call StrReplace Pop "${OUT}" !macroend !define StrReplace '!insertmacro "_strReplaceConstructor"' !macro ReplaceInFile SOURCE_FILE SEARCH_TEXT REPLACEMENT Push "${SOURCE_FILE}" Push "${SEARCH_TEXT}" Push "${REPLACEMENT}" Call RIF !macroend Function RIF ClearErrors ; want to be a newborn Exch $0 ; REPLACEMENT Exch Exch $1 ; SEARCH_TEXT Exch 2 Exch $2 ; SOURCE_FILE Push $R0 ; SOURCE_FILE file handle Push $R1 ; temporary file handle Push $R2 ; unique temporary file name Push $R3 ; a line to sar/save Push $R4 ; shift puffer IfFileExists $2 +1 RIF_error ; knock-knock FileOpen $R0 $2 "r" ; open the door GetTempFileName $R2 ; who's new? FileOpen $R1 $R2 "w" ; the escape, please! RIF_loop: ; round'n'round we go FileRead $R0 $R3 ; read one line IfErrors RIF_leaveloop ; enough is enough RIF_sar: ; sar - search and replace Push "$R3" ; (hair)stack Push "$1" ; needle Push "$0" ; blood Call StrReplace ; do the bartwalk StrCpy $R4 "$R3" ; remember previous state Pop $R3 ; gimme s.th. back in return! StrCmp "$R3" "$R4" +1 RIF_sar ; loop, might change again! FileWrite $R1 "$R3" ; save the newbie Goto RIF_loop ; gimme more RIF_leaveloop: ; over'n'out, Sir! FileClose $R1 ; S'rry, Ma'am - clos'n now FileClose $R0 ; me 2 Delete "$2.old" ; go away, Sire Rename "$2" "$2.old" ; step aside, Ma'am Rename "$R2" "$2" ; hi, baby! ClearErrors ; now i AM a newborn Goto RIF_out ; out'n'away RIF_error: ; ups - s.th. went wrong... SetErrors ; ...so cry, boy! RIF_out: ; your wardrobe? Pop $R4 Pop $R3 Pop $R2 Pop $R1 Pop $R0 Pop $2 Pop $0 Pop $1 FunctionEnd |
From: Chris M. <cm...@us...> - 2006-04-28 14:34:39
|
User: cmicali Date: 06/04/28 07:34:37 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/Installer - New directory |
From: Chris M. <cm...@us...> - 2006-04-28 04:41:19
|
User: cmicali Date: 06/04/27 21:41:17 Added: etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Commands ReloadMDAConfigCommand.cs Log: Initial import Revision Changes Path 1.1 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Commands/ReloadMDAConfigCommand.cs Index: ReloadMDAConfigCommand.cs =================================================================== // AndroMDA Visual Studio 2005 Add-In // (c)2006 Sapient Corporation #region Using statements using System; using System.Collections.Generic; using System.Text; using EnvDTE; #endregion namespace AndroMDA.VS80AddIn { public class ReloadMDAConfigCommand : AddInCommandBase { public ReloadMDAConfigCommand() { Init("ReloadMDAConfig", "Reload MDA Config", "Reload MDA Config", 1020, AddInCommandBase.AddInCommandType.MDADisabled); } public override void Exec(vsCommandExecOption executeOption, ref object varIn, ref object varOut) { m_solutionManager.OnSolutionOpened(); } } } |
From: Chris M. <cm...@us...> - 2006-04-28 04:40:41
|
User: cmicali Date: 06/04/27 21:40:37 Modified: etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn AndroMDA.VS80AddIn.csproj AssemblyInfo.cs MDASolutionManager.cs MavenProxy.cs VS80AddIn.cs etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Commands AddInCommandBase.cs etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Utils AddInUtils.cs etc/andromda-dotnet/AndroMDA.VS80AddIn Readme.doc Added: etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn AddIn.ico etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Utils AsyncOperation.cs VSExternalToolEventArgs.cs VSExternalToolProxy.cs Log: - Added better error handling when projects are not available on solution load - Added better error reporting when the common or core projects can not be found - Added a Reload MDA Config button that is displayed if the solution has MDA configuration files but the add-in could not be loaded for some reason - Fixed serious crash when the Stop button is pressed to stop maven - Rewrote maven proxy code to better handle the Stop button and properly close the running process - Improved error messages that can occur when running maven - Removed message boxes that appeared when errors occurred while running maven (messages are redirected to the output window) Revision Changes Path 1.4 +11 -2 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn.csproj Index: AndroMDA.VS80AddIn.csproj =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn.csproj,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- AndroMDA.VS80AddIn.csproj 19 Apr 2006 23:30:52 -0000 1.3 +++ AndroMDA.VS80AddIn.csproj 28 Apr 2006 04:40:37 -0000 1.4 @@ -11,15 +11,17 @@ <NoStandardLibraries>false</NoStandardLibraries> <AssemblyName>AndroMDA.VS80AddIn</AssemblyName> <RootNamespace>AndroMDA.VS80AddIn</RootNamespace> + <ApplicationIcon>AddIn.ico</ApplicationIcon> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <Optimize>false</Optimize> - <OutputPath>bin\Debug\</OutputPath> + <OutputPath>C:\Documents and Settings\cmical\My Documents\Visual Studio 2005\AddIns\</OutputPath> <EnableUnmanagedDebugging>false</EnableUnmanagedDebugging> <DefineConstants>DEBUG;TRACE</DefineConstants> <WarningLevel>4</WarningLevel> <IncrementalBuild>false</IncrementalBuild> + <TreatWarningsAsErrors>false</TreatWarningsAsErrors> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugSymbols>false</DebugSymbols> @@ -46,6 +48,7 @@ </Compile> <Compile Include="Commands\AboutCommand.cs" /> <Compile Include="Commands\AddInCommandBase.cs" /> + <Compile Include="Commands\ReloadMDAConfigCommand.cs" /> <Compile Include="Commands\OpenModelCommand.cs" /> <Compile Include="Commands\ResyncCommand.cs" /> <Compile Include="Commands\RunMavenCommand.cs" /> @@ -97,7 +100,6 @@ <DependentUpon>MDASolutionWizard.cs</DependentUpon> </Compile> <Compile Include="MavenProxy.cs" /> - <Compile Include="MavenProxyEventArgs.cs" /> <Compile Include="MDAProject.cs" /> <Compile Include="MDASolutionManager.cs" /> <Compile Include="MDASolutionProcessor.cs" /> @@ -140,8 +142,11 @@ <Compile Include="SharpZipLib\Zip\ZipNameTransform.cs" /> <Compile Include="SharpZipLib\Zip\ZipOutputStream.cs" /> <Compile Include="Utils\AddInUtils.cs" /> + <Compile Include="Utils\AsyncOperation.cs" /> <Compile Include="Utils\FileUtils.cs" /> + <Compile Include="Utils\VSExternalToolEventArgs.cs" /> <Compile Include="Utils\ValidationUtils.cs" /> + <Compile Include="Utils\VSExternalToolProxy.cs" /> <Compile Include="Utils\VSSolutionUtils.cs" /> <Compile Include="VS80AddIn.cs" /> <Compile Include="Wizard\Header.cs"> @@ -260,6 +265,7 @@ <Content Include="AndroMDA.VS80AddIn.AddIn"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> + <Content Include="AddIn.ico" /> <None Include="Resources\maven.xml" /> <None Include="Resources\project.properties" /> <None Include="Resources\project.xml" /> @@ -284,6 +290,9 @@ <None Include="Resources\Lib\NHibernate.dll" /> <None Include="Resources\Lib\NHibernate.Nullables2.dll" /> </ItemGroup> + <ItemGroup> + <Folder Include="MavenProxy\" /> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" /> <PropertyGroup> <PreBuildEvent> 1.4 +1 -1 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/AssemblyInfo.cs Index: AssemblyInfo.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/AssemblyInfo.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- AssemblyInfo.cs 19 Apr 2006 23:31:29 -0000 1.3 +++ AssemblyInfo.cs 28 Apr 2006 04:40:37 -0000 1.4 @@ -34,7 +34,7 @@ // You can specify all the value or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.0.1.0")] +[assembly: AssemblyVersion("1.0.2.0")] // // In order to sign your assembly you must specify a key to use. Refer to the 1.2 +81 -70 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/MDASolutionManager.cs Index: MDASolutionManager.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/MDASolutionManager.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- MDASolutionManager.cs 18 Apr 2006 16:14:43 -0000 1.1 +++ MDASolutionManager.cs 28 Apr 2006 04:40:37 -0000 1.2 @@ -14,6 +14,7 @@ using System.Resources; using System.Reflection; using System.Globalization; +using System.ComponentModel; #endregion @@ -27,6 +28,7 @@ #region Member variables private bool m_solutionIsUsingMDA = false; + private bool m_enabled = false; private DTE m_applicationObject = null; private ConfigFile m_projectProperties = new ConfigFile(); @@ -40,7 +42,8 @@ private bool m_restartBuild = false; private Mutex m_restartBuildMutex = new Mutex(false); - private MavenProxy m_mavenProxy = null; + //private MavenProxy m_mavenProxy = null; + private VSExternalToolProxy m_mavenProxy = null; private int m_progress; @@ -50,7 +53,7 @@ public bool IsMavenRunning { - get { return m_mavenProxy.IsMavenRunning; } + get { return m_mavenProxy.IsRunning; } } public bool RestartBuild @@ -76,7 +79,12 @@ public bool IsEnabled { - get { return m_solutionIsUsingMDA && m_applicationObject.Solution.IsOpen; } + get { return m_enabled && m_applicationObject.Solution.IsOpen; } + } + + public bool IsSolutionUsingMDA + { + get { return m_solutionIsUsingMDA; } } public DateTime? MavenLastRunDateTime @@ -145,12 +153,14 @@ { m_applicationObject = applicationObject; m_addInSettings = addInSettings; - m_mavenProxy = new MavenProxy(applicationObject, m_addInSettings); + m_mavenProxy = new MavenProxy(m_applicationObject, m_addInSettings); + m_mavenProxy.Completed += new EventHandler(m_mavenProxy_Completed); } public void OnSolutionOpened() { - m_solutionIsUsingMDA = IsSolutionUsingMDA(m_applicationObject.Solution); + m_solutionIsUsingMDA = MDAConfigFilesExist(m_applicationObject.Solution); + m_enabled = false; if (m_solutionIsUsingMDA) { try @@ -176,6 +186,8 @@ // Iterate through the projects and search for the core and common directories foreach (Project p in m_applicationObject.Solution.Projects) { + try + { // Get the project's directory string projectPath = FileUtils.GetPathFromFilename(p.FileName); @@ -197,27 +209,35 @@ m_commonProject = new MDAProject(p, FileUtils.GetFilename(projectPath), projectPath, generatedPath, string.Empty); } } + catch (NotImplementedException) + { + // Swallow this exception (it means the project was not loaded for some reason) + } + } // Show an error message if either the core or common projects could not be found if (m_coreProject == null || m_commonProject == null) { - string errorMessage = "The "; + string errorMessage = "The open solution appears to be using AndroMDA, but the "; if (m_coreProject == null) { errorMessage += "core "; if (m_commonProject == null) { errorMessage += "and "; } } - if (m_coreProject == null) { errorMessage += "common "; } - errorMessage += "project could not be found."; + if (m_commonProject == null) { errorMessage += "common "; } + errorMessage += "project"; + if (m_commonProject == null && m_coreProject == null) errorMessage += "s"; + errorMessage += " could not be found.\nThe AndroMDA add-in is being disabled. Please reload the solution or click Reload MDA Config."; throw new Exception(errorMessage); } m_solutionSettings = new ConfigFile(solutionPath + "\\mda\\vsmdaaddin.properties"); m_applicationObject.StatusBar.Highlight(false); m_applicationObject.StatusBar.Text = "AndroMDA: Configuration loaded."; + m_enabled = true; } catch (Exception e) { - m_solutionIsUsingMDA = false; - AddInUtils.ShowError(e.Message); + m_enabled = false; + AddInUtils.ShowWarning(e.Message); } } } @@ -263,23 +283,21 @@ public void StopMaven() { - if (m_mavenProxy.IsMavenRunning) - { - m_mavenProxy.StopMaven(); + m_mavenProxy.Stop(); MavenLastRunDateTime = null; } - } public void RunMaven() { if (IsEnabled) { + if (m_mavenProxy.OutputWindow == null) + { OutputWindowPane owp = GetOutputWindowPane("AndroMDA"); m_mavenProxy.OutputWindow = m_applicationObject.Windows.Item(EnvDTE.Constants.vsWindowKindOutput); m_mavenProxy.OutputWindowPane = owp; - m_mavenProxy.SolutionPath = VSSolutionUtils.GetSolutionPath(m_applicationObject.Solution); - m_mavenProxy.OnMavenComplete += new MavenProxy.MavenCompleteDelegate(proxy_OnMavenComplete); - m_mavenProxy.RunMaven(); + } + m_mavenProxy.Start(); } else { @@ -287,14 +305,14 @@ } } - private void proxy_OnMavenComplete(MavenProxyEventArgs e) + void m_mavenProxy_Completed(object sender, EventArgs e) { + VSExternalToolEventArgs args = e as VSExternalToolEventArgs; bool restartBuild = m_restartBuild; - m_restartBuild = false; - switch (e.ExitStatus) - { - case MavenProxy.ExitStatus.Success: + RestartBuild = false; + switch (args.ExitStatus) { + case VSExternalToolProxy.ToolExitStatus.Success: MavenLastRunDateTime = DateTime.Now; m_applicationObject.StatusBar.Text = "AndroMDA: Generation successful."; m_applicationObject.StatusBar.Highlight(false); @@ -303,15 +321,9 @@ { m_applicationObject.ExecuteCommand("Build.BuildSolution", string.Empty); } - } break; - case MavenProxy.ExitStatus.ModelValidationFailed: - m_applicationObject.StatusBar.Text = "AndroMDA: Code generation canceled because the model validation failed."; - m_applicationObject.StatusBar.Highlight(true); - break; - case MavenProxy.ExitStatus.UnknownError: - m_applicationObject.StatusBar.Text = "AndroMDA: An error occured while running running maven."; - m_applicationObject.StatusBar.Highlight(true); + case VSExternalToolProxy.ToolExitStatus.Error: + m_applicationObject.StatusBar.Text = "AndroMDA: Generation failed"; break; } } @@ -445,7 +457,6 @@ return -1; } UpdateResyncProgressBar(projectName + "/" + item.Name); - // Get the UI nodes so we can collapse the projects UIHierarchy solutionExplorer = (UIHierarchy)m_applicationObject.Windows.Item(Constants.vsext_wk_SProjectWindow).Object; UIHierarchyItem uiCommonProject = null; @@ -625,7 +636,7 @@ return d1 > d2; } - private static bool IsSolutionUsingMDA(Solution currentSolution) + private static bool MDAConfigFilesExist(Solution currentSolution) { return System.IO.File.Exists(GetProjectPropertiesPath(currentSolution)); } 1.2 +180 -273 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/MavenProxy.cs Index: MavenProxy.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/MavenProxy.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- MavenProxy.cs 18 Apr 2006 16:14:43 -0000 1.1 +++ MavenProxy.cs 28 Apr 2006 04:40:37 -0000 1.2 @@ -5,7 +5,7 @@ #region Using statements using System; -using System.Collections.Generic; +using System.Collections; using System.Text; using System.Threading; using System.ComponentModel; @@ -21,279 +21,186 @@ namespace AndroMDA.VS80AddIn { - public class MavenProxy + public class MavenProxyKnownException : Exception { + public MavenProxyKnownException(string message) + : base(message) { } + public MavenProxyKnownException(string message, Exception innerException) + : base(message, innerException) { } + } - public enum ExitStatus { Success, ModelValidationFailed, UnknownError }; - - #region Delegates - - public delegate void MavenCompleteDelegate(MavenProxyEventArgs e); - - #endregion - - #region Member variables - - public event MavenCompleteDelegate OnMavenComplete; + public class MavenProxy : VSExternalToolProxy + { - private DTE m_applicationObject = null; - private System.Diagnostics.Process m_process = null; - private OutputWindowPane m_outputWindowPane = null; - private Window m_outputWindow = null; - private string m_solutionPath = string.Empty; - private System.Threading.Thread m_thread = null; - private Mutex m_processMutex = new Mutex(false); private AddInSettings m_addInSettings = null; - private string m_mavenExecutable = string.Empty; - private string m_commandLine = string.Empty; - private bool m_mavenRunning = false; - private MavenProxyEventArgs m_eventArgs; - - #endregion + private string m_mavenOptions; - #region Properties - - public bool IsMavenRunning - { - get + public MavenProxy(EnvDTE.DTE applicationObject, AddInSettings addInSettings) + : base(applicationObject) { - if (m_process == null) return false; - return m_mavenRunning; - /* - try - { - return !m_process.HasExited; - } - catch - { - return false; - } - */ - } - } + Initialize(applicationObject, addInSettings); - public System.Threading.Thread Thread - { - get { return m_thread; } } - public string SolutionPath + public MavenProxy(ISynchronizeInvoke target, EnvDTE.DTE applicationObject, AddInSettings addInSettings) : base(target, applicationObject) { - get { return m_solutionPath; } - set { m_solutionPath = value; } + Initialize(applicationObject, addInSettings); } - public Window OutputWindow + private void Initialize(EnvDTE.DTE applicationObject, AddInSettings addInSettings) { - get { return m_outputWindow; } - set { m_outputWindow = value; } + m_addInSettings = addInSettings; + this.Failed += new ThreadExceptionEventHandler(m_mavenProxy_Failed); + this.Cancelled += new EventHandler(m_mavenProxy_Cancelled); + this.ProcessStdOut += new ProcessTextDelegate(MavenProxy_ProcessOutput); + this.ProcessStdErr += new ProcessTextDelegate(MavenProxy_ProcessOutput); } - public OutputWindowPane OutputWindowPane + void m_mavenProxy_Cancelled(object sender, EventArgs e) { - get { return m_outputWindowPane; } - set { m_outputWindowPane = value; } + this.OutputWindowPane.OutputString("\n"); + this.OutputWindowPane.OutputString("Generation cancelled\n"); + ApplicationObject.StatusBar.Text = "AndroMDA: Generation cancelled"; } - public System.Diagnostics.Process Process - { - get { return m_process; } - set + void m_mavenProxy_Failed(object sender, ThreadExceptionEventArgs e) { - lock (this) + if (e.Exception is MavenProxyKnownException) { - // m_processMutex.WaitOne(); - m_process = value; - // m_processMutex.ReleaseMutex(); - } - } + this.OutputWindowPane.OutputString(e.Exception.Message); } - - #endregion - - public MavenProxy(DTE applicationObject, AddInSettings addInSettings) + else { - m_applicationObject = applicationObject; - m_addInSettings = addInSettings; + this.OutputWindowPane.OutputString("Error: An unhandled error occurred while attempting to run maven\n"); + this.OutputWindowPane.OutputString("Error: Exception details: " + e.Exception.Message + "\n"); + } + ApplicationObject.StatusBar.Text = "AndroMDA: Generation failed"; + ApplicationObject.StatusBar.Highlight(true); } - public void RunMaven() + void MavenProxy_ProcessOutput(ref string text, ref bool cancelOutput) { - m_mavenExecutable = m_addInSettings.MavenExecutablePath; - if (System.IO.File.Exists(m_mavenExecutable)) + if (text.Length > 0) { - ThreadStart startInfo = new System.Threading.ThreadStart(this.RunMavenThread); - m_thread = new System.Threading.Thread(startInfo); - if (m_addInSettings.MavenUseCustomCommandLine) + // Filter out the full java strack trace from any errors that occur when maven runs + if (text.Trim()[0] == '\t' || text.Contains(".java:") || text.Contains("(Native Method)")) { - m_commandLine = m_addInSettings.MavenCustomCommandLine; + cancelOutput = true; } else { - m_commandLine = "mda"; - if (m_addInSettings.MavenCleanFirst) + if (text.Contains("'jar:file:")) { - m_commandLine = "clean " + m_commandLine; ; + // Get rid of the jar: prefix from URLs so we don't scare the .NET people + text = text.Replace("'jar:file:", "'file:"); } - if (m_addInSettings.MavenUseOfflineMode) - { - m_commandLine = "-o " + m_commandLine; ; } } - m_outputWindow.Activate(); - m_outputWindowPane.Clear(); - m_outputWindowPane.OutputString("Launching 'maven " + m_commandLine + "'...\n\n"); - m_outputWindowPane.Activate(); - m_thread.Start(); - } - else - { - AddInUtils.ShowError("The maven executable could not be found. Please ensure the path is correct in the AndroMDA Add-In options page (Tools | Options | AndroMDA Add-In)"); - } } - public void StopMaven() + public override void BeforeStart() { - StopMaven(true); - } + ApplicationObject.StatusBar.Text = "AndroMDA: Generation started..."; + + this.OutputWindow.Activate(); + this.OutputWindowPane.Clear(); + this.OutputWindowPane.Activate(); + + this.ExecutablePath = m_addInSettings.MavenExecutablePath; - public void StopMaven(bool isCancel) + if (m_addInSettings.MavenUseCustomCommandLine) { - if (this.Process != null) + m_mavenOptions = m_addInSettings.MavenCustomCommandLine; + } + else { - m_thread.Abort(); - if (isCancel) + m_mavenOptions = "mda"; + if (m_addInSettings.MavenCleanFirst) { - m_outputWindowPane.OutputString("Generation canceled"); + m_mavenOptions = "clean " + m_mavenOptions; } - this.Process = null; - m_thread = null; - lock (this) { m_mavenRunning = false; } + if (m_addInSettings.MavenUseOfflineMode) + { + m_mavenOptions = "-o " + m_mavenOptions; } } - private void ReadStdOutput() - { - RedirectStream(m_process.StandardOutput); - } + this.OutputWindowPane.OutputString("Launching 'maven " + m_mavenOptions + "'...\n\n"); - private void ReadStdErr() - { - RedirectStream(m_process.StandardError); - } + string java_home = System.Environment.GetEnvironmentVariable("JAVA_HOME"); + string maven_home = System.Environment.GetEnvironmentVariable("MAVEN_HOME"); + string maven_home_local = System.Environment.GetEnvironmentVariable("MAVEN_HOME_LOCAL"); + string maven_java_exe = java_home + "\\bin\\java.exe"; + string maven_classpath = maven_home + "\\lib\\forehead-1.0-beta-5.jar"; + string maven_forehead_conf = maven_home + "\\bin\\forehead.conf"; + string maven_main_class = "com.werken.forehead.Forehead"; + string maven_endorsed = java_home + "\\lib\\endorsed;" + maven_home + "\\lib\\endorsed"; + string maven_opts = System.Environment.GetEnvironmentVariable("MAVEN_OPTS"); + string maven_cmd_line_args = m_mavenOptions; - private void RedirectStream(System.IO.StreamReader sr) - { - string str; - while ( - m_mavenRunning && - (str = sr.ReadLine()) != null - ) - { - if (sr == m_process.StandardError && m_eventArgs.OuputOccuredOnStdErr == false) + if (java_home == null || java_home == string.Empty) { - lock (this) { m_eventArgs.OuputOccuredOnStdErr = true; } + throw new MavenProxyKnownException("Error: Maven cannot run because the JAVA_HOME environment variable is not set.\nError: Please check your java installation."); } - if (str.ToLower().Contains("model validation failed")) - { - lock (this) { m_eventArgs.ExitStatus = ExitStatus.ModelValidationFailed; } - } -// if (str.Length > 0 && str[0] == '\t') - // Remove stack trace lines - if (str.Length > 0 && (str.Trim()[0] == '\t' || str.Contains(".java:") || str.Contains("(Native Method)"))) + if (maven_home == null || maven_home == string.Empty) { - //m_outputWindowPane.OutputString("(erase)"); + throw new MavenProxyKnownException("Error: Maven cannot run because the MAVEN_HOME environment variable is not set.\nError: Please check that maven 1.x has been correctly installed."); } - else + + if (!System.IO.File.Exists(maven_classpath) || !System.IO.File.Exists(maven_forehead_conf)) { - m_outputWindowPane.OutputString(str + "\n"); - } - System.Threading.Thread.Sleep(0); - } + throw new MavenProxyKnownException("Error: Although the MAVEN_HOME variable was set, maven could not be found.\nError: Please check that maven 1.x has been correctly installed."); } - private void RunMavenThread() + if (maven_opts == null || maven_opts == string.Empty) { + maven_opts = "-Xmx256m"; + } - // Set up process info. - System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(); - psi.FileName = m_mavenExecutable; - psi.Arguments = m_commandLine; - psi.WorkingDirectory = m_solutionPath; - psi.CreateNoWindow = true; - psi.UseShellExecute = false; - psi.RedirectStandardOutput = true; - psi.RedirectStandardError = true; - - // Create the process. - this.Process = new System.Diagnostics.Process(); - - // Associate process info with the process. - m_process.StartInfo = psi; - - System.Threading.Thread stdOutThread = null; - System.Threading.Thread stdErrThread = null; - ThreadStart tstart = null; - tstart = new ThreadStart(ReadStdOutput); - stdOutThread = new System.Threading.Thread(tstart); - tstart = new ThreadStart(ReadStdErr); - stdErrThread = new System.Threading.Thread(tstart); + this.ExecutablePath = maven_java_exe; + this.CommandLine = "-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl " + + "-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl " + + "\"-Dmaven.home=" + maven_home + "\" "; - try + if (maven_home_local != null && maven_home_local != string.Empty) { - // Run the process. - lock (this) { m_mavenRunning = true; } - m_eventArgs = new MavenProxyEventArgs(); - lock (this) { m_eventArgs.OuputOccuredOnStdErr = false; } - bool fStarted = m_process.Start(); + this.CommandLine += "\"-Dmaven.home.local=" + maven_home_local + "\" "; + } - m_applicationObject.MainWindow.SetFocus(); + this.CommandLine = this.CommandLine + + "\"-Dtools.jar=" + java_home + "\\lib\\tools.jar\" " + + "\"-Dforehead.conf.file=" + maven_forehead_conf + "\" " + + "-Djava.endorsed.dirs=\"" + maven_endorsed + "\" " + + maven_opts + " " + + "-classpath \"" + maven_classpath + "\" \"" + maven_main_class + "\" "; - stdOutThread.Start(); - stdErrThread.Start(); + this.CommandLine += maven_cmd_line_args; - // Loop until the process has completed - while (!this.Process.HasExited) - { - System.Threading.Thread.Sleep(500); + base.BeforeStart(); } - m_eventArgs.ExitCode = m_process.ExitCode; - if (m_process.ExitCode == 0 && m_eventArgs.OuputOccuredOnStdErr == false) + + protected override void DoWork() { - lock (this) { m_eventArgs.ExitStatus = ExitStatus.Success; } - } - lock (this) { m_mavenRunning = false; } - } - catch (System.Threading.ThreadAbortException) + this.WorkingDirectory = VSSolutionUtils.GetSolutionPath(this.ApplicationObject.Solution); + ApplicationObject.StatusBar.Text = "AndroMDA: Generation Progress"; + try { - lock (this) { m_mavenRunning = false; } - this.Process = null; + base.DoWork(); } - catch (Exception e) + catch (System.ComponentModel.Win32Exception we) { - if (e.Message != "Thread was being aborted.") + if (we.Message == "The system cannot find the file specified") { - m_outputWindowPane.OutputString("error: An unhandled error occurred while attempting to run maven\n"); - m_outputWindowPane.OutputString("error: Exception details: " + e.Message + "\n"); + throw new MavenProxyKnownException("Error: The java executable could not be found to run maven.\nError: Please check your java installation and ensure that the JAVA_HOME variable is set correctly\n"); } - this.Process = null; -// CommandBars c = (CommandBars)m_applicationObject.CommandBars; - lock (this) { m_mavenRunning = false; } + else { throw; } } - // Fire the processing complete event - if (OnMavenComplete != null) - { - if (OnMavenComplete.Target is System.Windows.Forms.Control) + VSExternalToolEventArgs args = this.EventArguments as VSExternalToolEventArgs; + if (args.ExitCode != 0) { - System.Windows.Forms.Control target = OnMavenComplete.Target as System.Windows.Forms.Control; - target.BeginInvoke(OnMavenComplete, new Object[] { m_eventArgs }); - } - else - { - OnMavenComplete(m_eventArgs); - } + args.ExitStatus = ToolExitStatus.Error; } } 1.2 +14 -19 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/VS80AddIn.cs Index: VS80AddIn.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/VS80AddIn.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- VS80AddIn.cs 18 Apr 2006 16:14:43 -0000 1.1 +++ VS80AddIn.cs 28 Apr 2006 04:40:37 -0000 1.2 @@ -75,18 +75,19 @@ m_commands.Clear(); // Add commands to the add-in + m_commands.Add(new ReloadMDAConfigCommand()); m_commands.Add(new RunSolutionWizardCommand()); m_commands.Add(new RunMavenCommand()); m_commands.Add(new ResyncCommand()); m_commands.Add(new StopCommand()); m_commands.Add(new OpenModelCommand()); m_commands.Add(new AboutCommand()); - // Set the context for each command foreach (AddInCommandBase cmd in m_commands) { cmd.SetContext(m_applicationObject, m_addInInstance, m_solutionManager, m_addInSettings); } + } /// <summary> @@ -118,20 +119,14 @@ string command_line = m_applicationObject.CommandLineArguments.ToLower(); foreach (string sw in new string[] { "/build", "/rebuild", "/clean", "/deploy" }) { if (command_line.IndexOf(sw) != -1) return; } - try - { m_addInSettings = new AddInSettings(m_applicationObject); m_solutionManager = new MDASolutionManager(m_applicationObject, m_addInSettings); BindEvents(); CreateCommands(); RegisterCommands(); RegisterToolbar(); - } - finally - { m_connected = true; } - } catch (Exception e) { AddInUtils.ShowError("An exception occured while trying to instantiate the add-in: " + e.ToString()); 1.1 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/AddIn.ico <<Binary file>> 1.2 +17 -3 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Commands/AddInCommandBase.cs Index: AddInCommandBase.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Commands/AddInCommandBase.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- AddInCommandBase.cs 18 Apr 2006 16:14:44 -0000 1.1 +++ AddInCommandBase.cs 28 Apr 2006 04:40:37 -0000 1.2 @@ -20,7 +20,7 @@ #region Enumerations - public enum AddInCommandType { AlwaysEnabled, NoMDAAlwaysEnabled, MDAAlwaysEnabled, MDAEnabledWhileMavenNotRunning, MDAEnabledWhileMavenRunning } + public enum AddInCommandType { AlwaysEnabled, NoMDAAlwaysEnabled, MDADisabled, MDAAlwaysEnabled, MDAEnabledWhileMavenNotRunning, MDAEnabledWhileMavenRunning } #endregion @@ -57,6 +57,11 @@ get { return m_name; } } + public CommandBarControl CommandBarControl + { + get { return m_commandBarButton; } + } + #endregion public AddInCommandBase() @@ -144,9 +149,18 @@ case AddInCommandType.AlwaysEnabled: status = (vsCommandStatus)vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; break; - + case AddInCommandType.MDADisabled: + if (!m_solutionManager.IsEnabled && m_solutionManager.IsSolutionUsingMDA && m_application.Solution.IsOpen) + { + status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; + } + else + { + status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusInvisible; + } + break; case AddInCommandType.NoMDAAlwaysEnabled: - if (!m_solutionManager.IsEnabled && m_application.Solution.IsOpen) + if (!m_solutionManager.IsEnabled && !m_solutionManager.IsSolutionUsingMDA && m_application.Solution.IsOpen) { status = vsCommandStatus.vsCommandStatusSupported | vsCommandStatus.vsCommandStatusEnabled; } 1.2 +5 -0 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Utils/AddInUtils.cs Index: AddInUtils.cs =================================================================== RCS file: /cvsroot/andromdaplugins/plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Utils/AddInUtils.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- AddInUtils.cs 18 Apr 2006 16:14:47 -0000 1.1 +++ AddInUtils.cs 28 Apr 2006 04:40:37 -0000 1.2 @@ -20,5 +20,10 @@ System.Windows.Forms.MessageBox.Show(errorMessage, "AndroMDA Add-In Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } + public static void ShowWarning(string errorMessage) + { + System.Windows.Forms.MessageBox.Show(errorMessage, "AndroMDA Add-In", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); + } + } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Utils/AsyncOperation.cs Index: AsyncOperation.cs =================================================================== // AndroMDA Visual Studio 2005 Add-In // (c)2006 Sapient Corporation // AsyncOperation.cs - A base class for cancellable operations // (C) 2001-2002 I D Griffiths // // This base class is designed to be used by lengthy operations that wish to // support cancellation. #region Using statements using System; using System.Windows.Forms; using System.Threading; using System.ComponentModel; #endregion namespace AndroMDA.VS80AddIn { /// <summary> /// Exception thrown by AsyncUtils.AsyncOperation.Start when an /// operation is already in progress. /// </summary> public class AlreadyRunningException : System.ApplicationException { public AlreadyRunningException() : base("Asynchronous operation already running") { } } public abstract class AsyncOperation { /// <summary> /// Initialises an AsyncOperation with an association to the /// supplied ISynchronizeInvoke. All events raised from this /// object will be delivered via this target. (This might be a /// Control object, so events would be delivered to that Control's /// UI thread.) /// </summary> /// <param name="target">An object implementing the /// ISynchronizeInvoke interface. All events will be delivered /// through this target, ensuring that they are delivered to the /// correct thread.</param> public AsyncOperation() { isiTarget = null; isRunning = false; eventArguments = EventArgs.Empty; } public AsyncOperation(ISynchronizeInvoke target) { isiTarget = target; isRunning = false; eventArguments = EventArgs.Empty; } public abstract void BeforeStart(); /// <summary> /// Launch the operation on a worker thread. This method will /// return immediately, and the operation will start asynchronously /// on a worker thread. /// </summary> public void Start() { lock (this) { if (isRunning) { throw new AlreadyRunningException(); } // Set this flag here, not inside InternalStart, to avoid // race condition when Start called twice in quick // succession. isRunning = true; try { BeforeStart(); ThreadStart ts = new ThreadStart(InternalStart); workerThread = new Thread(ts); } catch (Exception e) { FailOperation(e); return; } } workerThread.Start(); //new MethodInvoker(InternalStart).BeginInvoke(null, null); } Thread workerThread; /// <summary> /// Attempt to cancel the current operation. This returns /// immediately to the caller. No guarantee is made as to /// whether the operation will be successfully cancelled. All /// that can be known is that at some point, one of the /// three events Completed, Cancelled, or Failed will be raised /// at some point. /// </summary> public void Cancel() { lock (this) { cancelledFlag = true; } } /// <summary> /// Attempt to cancel the current operation and block until either /// the cancellation succeeds or the operation completes. /// </summary> /// <returns>true if the operation was successfully cancelled /// or it failed, false if it ran to completion.</returns> public bool CancelAndWait() { lock (this) { // Set the cancelled flag cancelledFlag = true; // Now sit and wait either for the operation to // complete or the cancellation to be acknowledged. // (Wake up and check every second - shouldn't be // necessary, but it guarantees we won't deadlock // if for some reason the Pulse gets lost - means // we don't have to worry so much about bizarre // race conditions.) while (!IsDone) { Monitor.Wait(this, 1000); } } return !HasCompleted; } /// <summary> /// Blocks until the operation has either run to completion, or has /// been successfully cancelled, or has failed with an internal /// exception. /// </summary> /// <returns>true if the operation completed, false if it was /// cancelled before completion or failed with an internal /// exception.</returns> public bool WaitUntilDone() { lock (this) { // Wait for either completion or cancellation. As with // CancelAndWait, we don't sleep forever - to reduce the // chances of deadlock in obscure race conditions, we wake // up every second to check we didn't miss a Pulse. while (!IsDone) { Monitor.Wait(this, 1000); } } return HasCompleted; } /// <summary> /// Returns false if the operation is still in progress, or true if /// it has either completed successfully, been cancelled /// successfully, or failed with an internal exception. /// </summary> public bool IsDone { get { lock (this) { return completeFlag || cancelAcknowledgedFlag || failedFlag; } } } /// <summary> /// This event will be fired if the operation runs to completion /// without being cancelled. This event will be raised through the /// ISynchronizeTarget supplied at construction time. Note that /// this event may still be received after a cancellation request /// has been issued. (This would happen if the operation completed /// at about the same time that cancellation was requested.) But /// the event is not raised if the operation is cancelled /// successfully. /// </summary> public event EventHandler Completed; /// <summary> /// This event will be fired when the operation is successfully /// stoped through cancellation. This event will be raised through /// the ISynchronizeTarget supplied at construction time. /// </summary> public event EventHandler Cancelled; /// <summary> /// This event will be fired if the operation throws an exception. /// This event will be raised through the ISynchronizeTarget /// supplied at construction time. /// </summary> public event System.Threading.ThreadExceptionEventHandler Failed; /// <summary> /// The ISynchronizeTarget supplied during construction - this can /// be used by deriving classes which wish to add their own events. /// </summary> protected ISynchronizeInvoke Target { get { return isiTarget; } } private ISynchronizeInvoke isiTarget; /// <summary> /// To be overridden by the deriving class - this is where the work /// will be done. The base class calls this method on a worker /// thread when the Start method is called. /// </summary> protected abstract void DoWork(); /// <summary> /// Flag indicating whether the request has been cancelled. Long- /// running operations should check this flag regularly if they can /// and cancel their operations as soon as they notice that it has /// been set. /// </summary> protected bool CancelRequested { get { lock (this) { return cancelledFlag; } } } private bool cancelledFlag; /// <summary> /// Flag indicating whether the request has run through to /// completion. This will be false if the request has been /// successfully cancelled, or if it failed. /// </summary> protected bool HasCompleted { get { lock (this) { return completeFlag; } } } private bool completeFlag; /// <summary> /// This is called by the operation when it wants to indicate that /// it saw the cancellation request and honoured it. /// </summary> protected void AcknowledgeCancel() { lock (this) { cancelAcknowledgedFlag = true; isRunning = false; /* if (workerThread.IsAlive) { workerThread.Abort(); } */ // Pulse the event in case the main thread is blocked // waiting for us to finish (e.g. in CancelAndWait or // WaitUntilDone). Monitor.Pulse(this); // Using async invocation to avoid a potential deadlock // - using Invoke would involve a cross-thread call // whilst we still held the object lock. If the event // handler on the UI thread tries to access this object // it will block because we have the lock, but using // async invocation here means that once we've fired // the event, we'll run on and release the object lock, // unblocking the UI thread. FireAsync(Cancelled, this, EventArguments); } } private bool cancelAcknowledgedFlag; // Set to true if the operation fails with an exception. private bool failedFlag; // Set to true if the operation is running private bool isRunning; public bool IsRunning { get { return isRunning; } } protected EventArgs EventArguments { get { lock (this) { return eventArguments; } } set { lock (this) { eventArguments = value; } } } private EventArgs eventArguments; // This method is called on a worker thread (via asynchronous // delegate invocation). This is where we call the operation (as // defined in the deriving class's DoWork method). private void InternalStart() { // Reset our state - we might be run more than once. cancelledFlag = false; completeFlag = false; cancelAcknowledgedFlag = false; failedFlag = false; // isRunning is set during Start to avoid a race condition try { DoWork(); } catch (ThreadAbortException) { } catch (Exception e) { // Raise the Failed event. We're in a catch handler, so we // had better try not to throw another exception. try { FailOperation(e); } catch (Exception) { } /* // The documentation recommends not catching // SystemExceptions, so having notified the caller we // rethrow if it was one of them. if (e is SystemException) { throw; } */ } lock (this) { // If the operation wasn't cancelled (or if the UI thread // tried to cancel it, but the method ran to completion // anyway before noticing the cancellation) and it // didn't fail with an exception, then we complete the // operation - if the UI thread was blocked waiting for // cancellation to complete it will be unblocked, and // the Completion event will be raised. if (!cancelAcknowledgedFlag && !failedFlag) { CompleteOperation(); } } } // This is called when the operation runs to completion. // (This is private because it is called automatically // by this base class when the deriving class's DoWork // method exits without having cancelled private void CompleteOperation() { lock (this) { completeFlag = true; isRunning = false; Monitor.Pulse(this); // See comments in AcknowledgeCancel re use of // Async. FireAsync(Completed, this, EventArguments); } } private void FailOperation(Exception e) { lock (this) { failedFlag = true; isRunning = false; Monitor.Pulse(this); FireAsync(Failed, this, new ThreadExceptionEventArgs(e)); } } // Utility function for firing an event through the target. // It uses C#'s variable length parameter list support // to build the parameter list. // This functions presumes that the caller holds the object lock. // (This is because the event list is typically modified on the UI // thread, but events are usually raised on the worker thread.) protected void FireAsync(Delegate dlg, params object[] pList) { if (dlg != null) { if (Target is Control) Target.BeginInvoke(dlg, pList); else dlg.Method.Invoke(dlg.Target, pList); } } } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Utils/VSExternalToolEventArgs.cs Index: VSExternalToolEventArgs.cs =================================================================== // AndroMDA Visual Studio 2005 Add-In // (c)2006 Sapient Corporation #region Using statements using System; using System.Collections.Generic; using System.Text; #endregion namespace AndroMDA.VS80AddIn { public class VSExternalToolEventArgs : EventArgs { private VSExternalToolProxy.ToolExitStatus m_exitStatus; private string m_errorMessage; private int m_exitCode; public VSExternalToolProxy.ToolExitStatus ExitStatus { get { return m_exitStatus; } set { m_exitStatus = value; } } public int ExitCode { get { return m_exitCode; } set { m_exitCode = value; } } public string ErrorMessage { get { return m_errorMessage; } set { m_errorMessage = value; } } public VSExternalToolEventArgs() { m_exitStatus = VSExternalToolProxy.ToolExitStatus.DidNotExit; m_exitCode = 0; m_errorMessage = string.Empty; } public VSExternalToolEventArgs(VSExternalToolProxy.ToolExitStatus exitStatus, int exitCode, string errorMessage) { m_exitStatus = exitStatus; m_exitCode = exitCode; m_errorMessage = errorMessage; } } } 1.1 plugins/etc/andromda-dotnet/AndroMDA.VS80AddIn/AndroMDA.VS80AddIn/Utils/VSExternalToolProxy.cs Index: VSExternalToolProxy.cs =================================================================== // AndroMDA Visual Studio 2005 Add-In // (c)2006 Sapient Corporation #region Using statements using System; using System.Collections; using System.Collections.Specialized; using System.Text; using System.Threading; using System.ComponentModel; using System.Diagnostics; using System.Windows.Forms; using System.Runtime.InteropServices; #endregion namespace AndroMDA.VS80AddIn { public class VSExternalToolProxy : AsyncOperation { public delegate void ProcessTextDelegate(ref string text, ref bool cancelOutput); public event ProcessTextDelegate ProcessStdOut; public event ProcessTextDelegate ProcessStdErr; public enum ToolExitStatus { DidNotExit, Cancelled, Error, Success }; private string m_executablePath = string.Empty; private string m_workingDirectory = string.Empty; private string m_commandLine = string.Empty; private EnvDTE.DTE m_applicationObject = null; private EnvDTE.OutputWindowPane m_outputWindowPane = null; private EnvDTE.Window m_outputWindow = null; private NameValueCollection m_environmentVariables = new NameValueCollection(); public ArrayList m_outputLines; public string m_output = string.Empty; public string Output { get { if (m_output == string.Empty) { lock (m_outputLines.SyncRoot) { foreach (string s in m_outputLines) { m_output += s; } } } return m_output; } } public ArrayList OutputLines { get { return ArrayList.Synchronized(m_outputLines); } } public NameValueCollection EnvironmentVariables { get { return m_environmentVariables; } set { m_environmentVariables = value; } } public EnvDTE.DTE ApplicationObject { get { return m_applicationObject; } } public EnvDTE.Window OutputWindow { get { return m_outputWindow; } set { m_outputWindow = value; } } public EnvDTE.OutputWindowPane OutputWindowPane { get { return m_outputWindowPane; } set { m_outputWindowPane = value; } } public string CommandLine { get { return m_commandLine; } set { m_commandLine = value; } } public string WorkingDirectory { get { return m_workingDirectory; } set { m_workingDirectory = value; } } public string ExecutablePath { get { return m_executablePath; } set { m_executablePath = value; } } public VSExternalToolProxy(EnvDTE.DTE applicationObject) : base() { m_applicationObject = applicationObject; } public VSExternalToolProxy(ISynchronizeInvoke target, EnvDTE.DTE applicationObject) : base(target) { m_applicationObject = applicationObject; } public override void BeforeStart() { m_psi = new System.Diagnostics.ProcessStartInfo(); foreach (string key in m_environmentVariables.Keys) { m_psi.EnvironmentVariables.Add(key, m_environmentVariables[key]); } m_output = string.Empty; m_outputLines = new ArrayList(); } public void Stop() { if (this.IsRunning) { this.CancelAndWait(); } } private void RedirectStream(object parameters) { object[] paramlist = parameters as object[]; System.IO.StreamReader sr = paramlist[0] as System.IO.StreamReader; bool isStdErr = (bool)paramlist[1] ; if (sr == null) { return; } string str; bool cancelOutput; while (this.IsRunning && !CancelRequested && (str = sr.ReadLine()) != null) { cancelOutput = false; if (isStdErr) { ProcessStdErr(ref str, ref cancelOutput); } else { ProcessStdOut(ref str, ref cancelOutput); } /* if (str.ToLower().Contains("model validation failed")) { lock (this) { m_eventArgs.ExitStatus = ExitStatus.ModelValidationFailed; } } */ if (!cancelOutput) { this.OutputLines.Add(str); m_outputWindowPane.OutputString(str + "\n"); } System.Threading.Thread.Sleep(0); } } System.Diagnostics.ProcessStartInfo m_psi = null; protected override void DoWork() { Process toolProcess = new Process(); // Set up process info. System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(); m_psi.FileName = m_executablePath; m_psi.Arguments = m_commandLine; m_psi.WorkingDirectory = m_workingDirectory; m_psi.CreateNoWindow = true; m_psi.UseShellExecute = false; m_psi.RedirectStandardOutput = true; m_psi.RedirectStandardError = true; // Associate process info with the process. toolProcess.StartInfo = m_psi; VSExternalToolEventArgs eventArguments = new VSExternalToolEventArgs(); this.EventArguments = eventArguments; if (CancelRequested) { eventArguments.ExitStatus = ToolExitStatus.Cancelled; AcknowledgeCancel(); return; } if (!toolProcess.Start()) { throw new Exception("External tool failed to start"); } try { Thread stdoutThread = new Thread(new ParameterizedThreadStart(RedirectStream)); Thread stderrThread = new Thread(new ParameterizedThreadStart(RedirectStream)); m_applicationObject.MainWindow.SetFocus(); stdoutThread.Start(new object[] { toolProcess.StandardOutput, false }); stderrThread.Start(new object[] { toolProcess.StandardError, true }); // Loop until the process has completed while (!toolProcess.WaitForExit(250) && !CancelRequested) { } if (!CancelRequested) { ev... [truncated message content] |
From: Vance K. <va...@us...> - 2006-04-27 06:54:17
|
User: vancek Date: 06/04/26 23:54:08 Modified: andromda-ejb3/src/main/uml EJB3MetafacadeModel.xml.zip Log: added getInstanceAttributes with args follow and withIdentifiers to EJB3EntityFacade. Revision Changes Path 1.33 +199 -192 cartridges/andromda-ejb3/src/main/uml/EJB3MetafacadeModel.xml.zip <<Binary file>> |
From: Vance K. <va...@us...> - 2006-04-27 06:52:47
|
User: vancek Date: 06/04/26 23:52:44 Modified: andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3EntityFacadeLogicImpl.java Log: fixed formatting. handleIsRequiresSpecializationMapping should not check for root entity. handleIsEntityImplementationRequired should not check for entity being a mapped superclass. implemented handleGetInstanceAttributes method with args follow and withIdentifiers. Revision Changes Path 1.20 +34 -18 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3EntityFacadeLogicImpl.java Index: EJB3EntityFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3EntityFacadeLogicImpl.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -r1.19 -r1.20 --- EJB3EntityFacadeLogicImpl.java 26 Apr 2006 15:21:59 -0000 1.19 +++ EJB3EntityFacadeLogicImpl.java 27 Apr 2006 06:52:44 -0000 1.20 @@ -332,7 +332,9 @@ protected java.util.Collection handleGetValueDependencies() { Collection dependencies = super.getSourceDependencies(); - CollectionUtils.filter(dependencies, new Predicate() + CollectionUtils.filter( + dependencies, + new Predicate() { public boolean evaluate(Object object) { @@ -866,10 +868,8 @@ */ protected boolean handleIsRequiresSpecializationMapping() { - return this.isRoot() - && (this.isInheritanceSingleTable() - || this.isInheritanceTablePerClass() || this.isInheritanceJoined()) - && (!this.getSpecializations().isEmpty()); + return (this.isInheritanceSingleTable() || this.isInheritanceTablePerClass() || this.isInheritanceJoined()) + && !this.getSpecializations().isEmpty(); } /** @@ -1372,6 +1372,22 @@ */ protected boolean handleIsEntityImplementationRequired() { - return !this.getBusinessOperations().isEmpty() || this.isEmbeddableSuperclass(); + return !this.getBusinessOperations().isEmpty(); + } + + /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacadeLogic#handleGetInstanceAttributes(boolean, boolean) + */ + protected Collection handleGetInstanceAttributes( + boolean follow, + boolean withIdentifiers) + { + return new FilteredCollection(this.getAttributes(follow, withIdentifiers)) + { + public boolean evaluate(Object object) + { + return !((AttributeFacade)object).isStatic(); + } + }; } } \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-04-27 06:48:29
|
User: vancek Date: 06/04/26 23:48:28 Modified: andromda-ejb3/src/main/resources/META-INF/andromda cartridge.xml Log: do not generate the DAO related classes if entity is modelled as a mapped superclass Revision Changes Path 1.24 +11 -3 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.23 retrieving revision 1.24 diff -u -w -r1.23 -r1.24 --- cartridge.xml 26 Apr 2006 15:19:54 -0000 1.23 +++ cartridge.xml 27 Apr 2006 06:48:28 -0000 1.24 @@ -273,7 +273,9 @@ overwrite="true"> <modelElements variable="entity"> <modelElement> - <type name="org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade"/> + <type name="org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade"> + <property name="embeddableSuperclass">false</property> + </type> </modelElement> </modelElements> </template> @@ -285,7 +287,9 @@ overwrite="true"> <modelElements variable="entity"> <modelElement> - <type name="org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade"/> + <type name="org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade"> + <property name="embeddableSuperclass">false</property> + </type> </modelElement> </modelElements> </template> @@ -299,6 +303,7 @@ <modelElement> <type name="org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade"> <property name="daoImplementationRequired">false</property> + <property name="embeddableSuperclass">false</property> </type> </modelElement> </modelElements> @@ -313,6 +318,7 @@ <modelElement> <type name="org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade"> <property name="daoImplementationRequired"/> + <property name="embeddableSuperclass">false</property> </type> </modelElement> </modelElements> @@ -325,7 +331,9 @@ overwrite="true"> <modelElements variable="entity"> <modelElement> - <type name="org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade"/> + <type name="org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade"> + <property name="embeddableSuperclass">false</property> + </type> </modelElement> </modelElements> </template> |
From: Vance K. <va...@us...> - 2006-04-27 06:47:05
|
User: vancek Date: 06/04/26 23:47:01 Modified: andromda-ejb3/src/main/resources/templates/ejb3 EntityEmbeddable.vsl Log: entityImplementationRequired only checks for availability of business operations. in some circumstances, to determine if an implementation is required, we need to check if the entity is defined as a mapped superclass. if parent class is a mapped superclass, then include named queries from it. fixed fully qualified mapped superclass name if inheriting from mapped superclass. if entity is a mapped superclass then don't add auto generated identifier. Revision Changes Path 1.26 +33 -16 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.25 retrieving revision 1.26 diff -u -w -r1.25 -r1.26 --- EntityEmbeddable.vsl 26 Apr 2006 15:16:51 -0000 1.25 +++ EntityEmbeddable.vsl 27 Apr 2006 06:47:01 -0000 1.26 @@ -14,7 +14,7 @@ ## 2. an abstract class ## ## -#if ($entity.entityImplementationRequired) +#if ($entity.entityImplementationRequired || $entity.embeddableSuperclass) #**##set ($generatedFile = "${stringUtils.replace($entity.fullyQualifiedEntityEmbeddableName,'.','/')}.java") #else #**##set ($generatedFile = "${stringUtils.replace($entity.fullyQualifiedEntityName,'.','/')}.java") @@ -22,10 +22,10 @@ #set ($identifier = $entity.identifiers.iterator().next()) /** - * Autogenerated POJO EJB#if ($entity.entityImplementationRequired) mapped super#end class for ${entity.entityName} containing the + * Autogenerated POJO EJB#if ($entity.entityImplementationRequired || $entity.embeddableSuperclass) mapped super#end class for ${entity.entityName} containing the * bulk of the entity implementation. * - * This is#if ($entity.entityImplementationRequired) a mapped super class and#end autogenerated by AndroMDA using the EJB3 + * This is#if ($entity.entityImplementationRequired || $entity.embeddableSuperclass) a mapped super class and#end autogenerated by AndroMDA using the EJB3 * cartridge. * * DO NOT MODIFY this class. @@ -37,7 +37,7 @@ ## Only set the Entity annotation if it is explicity defined as an embeddable super class ## or business operations exist(implementation is required). ## -#if ($entity.entityImplementationRequired) +#if ($entity.entityImplementationRequired || $entity.embeddableSuperclass) @javax.persistence.MappedSuperclass #else @javax.persistence.Entity @@ -49,7 +49,7 @@ ## If a class is manually specified as an embeddable superclass, add ## the Table annotation to the subclass, not to the base superclass. ## -#**##if (!$entity.entityImplementationRequired && (($entity.requiresSpecializationMapping && !$entity.embeddableSuperclass) || ($entity.requiresGeneralizationMapping && ($entity.embeddableSuperclassGeneralizationExists || $entity.inheritanceTablePerClass || $entity.inheritanceJoined)))) +#**##if (!$entity.entityImplementationRequired && ($entity.requiresSpecializationMapping || ($entity.requiresGeneralizationMapping && ($entity.embeddableSuperclassGeneralizationExists || $entity.inheritanceTablePerClass || $entity.inheritanceJoined)))) @javax.persistence.Table(name = "${entity.tableName}") #**##end #**##if ($entity.listenerEnabled) @@ -59,7 +59,7 @@ ## Only include the inheritance related annotations for inheritance mapping ## that doesn't involve embeddable superclass hierarchy. ## -#**##if ($entity.requiresSpecializationMapping && !$entity.embeddableSuperclass) +#**##if ($entity.requiresSpecializationMapping) @javax.persistence.Inheritance(strategy = javax.persistence.InheritanceType.${entity.inheritanceStrategy}) ## ## Discriminator components only apply to single table mapping strategy @@ -79,7 +79,14 @@ #**##if ($entity.cacheEnabled) @org.hibernate.annotations.Cache(usage = org.hibernate.annotations.CacheConcurrencyStrategy.${entity.cacheType}) #**##end +## +## If super class is a mapped superclass, then include named queries from it +## +#**##if ($entity.embeddableSuperclassGeneralizationExists) +#* *##set ($finders = $entity.getQueryOperations(true)) +#**##else #**##set ($finders = $entity.getQueryOperations(false)) +#**##end #**##if (!$finders.empty) @javax.persistence.NamedQueries ({ @@ -99,10 +106,14 @@ #* *##end #**##end #end -public#if ($entity.entityImplementationRequired) abstract class ${entity.entityEmbeddableName}#else class ${entity.entityName}#end +public#if ($entity.entityImplementationRequired || $entity.embeddableSuperclass) abstract class ${entity.entityEmbeddableName}#else class ${entity.entityName}#end -#if($entity.generalization) +#if($entity.requiresGeneralizationMapping) +#**##if($entity.embeddableSuperclassGeneralizationExists) + extends ${entity.generalization.fullyQualifiedEntityEmbeddableName} +#**##else extends ${entity.generalization.fullyQualifiedName} +#**##end #end implements java.io.Serializable #if (!$entity.interfaceAbstractions.empty) @@ -122,9 +133,15 @@ #**##end #end ## -## Only declase instance attributes that are NOT inherited +## Only declase instance attributes that are NOT inherited. +## If a mapped superclass then don't generate auto identifier - but include +## normal defined identifier if one is defined. ## -#set ($attributes = $entity.instanceAttributes) +#if ($entity.embeddableSuperclass && $entity.dynamicIdentifiersPresent) +#**##set ($attributes = $entity.getInstanceAttributes(false, false)) +#else +#**##set ($attributes = $entity.instanceAttributes) +#end #if (!$attributes.empty) // ----------- Attribute Definitions ------------ @@ -194,7 +211,7 @@ /** * Default empty constructor */ - public #if ($entity.entityImplementationRequired)${entity.entityEmbeddableName}#else${entity.entityName}#end() + public #if ($entity.entityImplementationRequired || $entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end() { // default null constructor } @@ -213,7 +230,7 @@ * @param $attribute.name Value for the ${attribute.name} property #**##end */ - public #if ($entity.entityImplementationRequired)${entity.entityEmbeddableName}#else${entity.entityName}#end($entity.getAttributesAsList($allAttributes, true, true, false)) + public #if ($entity.entityImplementationRequired || $entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end($entity.getAttributesAsList($allAttributes, true, true, false)) { #**##if(!$inheritedAttributes.empty) super($entity.getAttributesAsList($inheritedAttributes, false, true, false)); @@ -237,7 +254,7 @@ * @param $relation.otherEnd.name Value for the ${relation.otherEnd.name} relation role #* *##end */ - public #if ($entity.entityImplementationRequired)${entity.entityEmbeddableName}#else${entity.entityName}#end($entity.getAttributesAsList($allAttributes, true, true, false)#if(!$allAttributes.empty), #end#foreach ($relation in $relations)${relation.otherEnd.getterSetterTypeName} $relation.otherEnd.name#if($velocityCount != $relations.size()), #end#end) + public #if ($entity.entityImplementationRequired || $entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end($entity.getAttributesAsList($allAttributes, true, true, false)#if(!$allAttributes.empty), #end#foreach ($relation in $relations)${relation.otherEnd.getterSetterTypeName} $relation.otherEnd.name#if($velocityCount != $relations.size()), #end#end) { #* *##foreach ($attribute in $transform.filterUpdatableAttributes($instanceAttributes, $entity.compositePrimaryKeyPresent)) ${attribute.setterName}(${attribute.name}); @@ -260,7 +277,7 @@ * @param $attribute Value for the $attribute property #**##end */ - public #if ($entity.entityImplementationRequired)${entity.entityEmbeddableName}#else${entity.entityName}#end(${operation.typedArgumentList}) + public #if ($entity.entityImplementationRequired || $entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end(${operation.typedArgumentList}) { #**##foreach($attribute in $opArguments) this.${attribute} = $attribute; @@ -274,7 +291,7 @@ * * @param pk Composite primary key */ - public #if ($entity.entityImplementationRequired)${entity.entityEmbeddableName}#else${entity.entityName}#end(${entity.fullyQualifiedEntityCompositePrimaryKeyName} pk) + public #if ($entity.entityImplementationRequired || $entity.embeddableSuperclass)${entity.entityEmbeddableName}#else${entity.entityName}#end(${entity.fullyQualifiedEntityCompositePrimaryKeyName} pk) { this.pk = pk; } |