From: <car...@us...> - 2005-04-30 21:01:44
|
User: carloslcuenca Date: 05/04/30 14:01:32 Modified: andromda-hibernate/src/java/org/andromda/cartridges/hibernate/metafacades HibernateGlobals.java HibernateEntityLogicImpl.java andromda-hibernate/src/META-INF andromda-cartridge.xml andromda-metafacades.xml andromda-profile.xml andromda-hibernate/src/templates/hibernate hibernate.hbm.xml.vsl HibernateEntity.vsl andromda-hibernate/src/uml HibernateMetafacadeModel.xml.zip andromda-hibernate/src/test/expected cartridge-output.zip andromda-hibernate/src/java/org/andromda/cartridges/hibernate HibernateProfile.java andromda-hibernate/src/test/uml HibernateCartridgeTestModel.xml.zip Log: allow hibernate version attribute per entity, also added test. Fix HIB-88 Revision Changes Path 1.15 +5 -0 cartridges/andromda-hibernate/src/java/org/andromda/cartridges/hibernate/metafacades/HibernateGlobals.java Index: HibernateGlobals.java =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/java/org/andromda/cartridges/hibernate/metafacades/HibernateGlobals.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -r1.14 -r1.15 --- HibernateGlobals.java 26 Apr 2005 21:45:26 -0000 1.14 +++ HibernateGlobals.java 30 Apr 2005 21:01:14 -0000 1.15 @@ -101,4 +101,9 @@ * The property which stores the pattern defining the embedded value implementation name. */ static final String EMBEDDED_VALUE_IMPLEMENTATION_NAME_PATTERN = "embeddedValueImplementationNamePattern"; + + /** + * The property which defines a default value for hibernate entities versioning. + */ + static final String HIBERNATE_VERSION = "versionProperty"; } \ No newline at end of file 1.52 +14 -0 cartridges/andromda-hibernate/src/java/org/andromda/cartridges/hibernate/metafacades/HibernateEntityLogicImpl.java Index: HibernateEntityLogicImpl.java =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/java/org/andromda/cartridges/hibernate/metafacades/HibernateEntityLogicImpl.java,v retrieving revision 1.51 retrieving revision 1.52 diff -u -w -r1.51 -r1.52 --- HibernateEntityLogicImpl.java 26 Apr 2005 21:45:26 -0000 1.51 +++ HibernateEntityLogicImpl.java 30 Apr 2005 21:01:15 -0000 1.52 @@ -591,4 +591,18 @@ return this.isHibernateInheritanceInterface() || (this.isHibernateInheritanceConcrete() && this.isAbstract()); } + /** + * @see org.andromda.cartridges.hibernate.metafacades.HibernateEntity#isHibernateVersion() + */ + protected boolean handleIsHibernateVersion() + { + String version = (String)this.findTaggedValue( + HibernateProfile.TAGGEDVALUE_HIBERNATE_VERSION); + if (version == null) + { + version = (String)this.getConfiguredProperty(HibernateGlobals.HIBERNATE_VERSION); + } + return Boolean.valueOf(version).booleanValue(); + } + } \ No newline at end of file 1.69 +1 -1 cartridges/andromda-hibernate/src/META-INF/andromda-cartridge.xml Index: andromda-cartridge.xml =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/META-INF/andromda-cartridge.xml,v retrieving revision 1.68 retrieving revision 1.69 diff -u -w -r1.68 -r1.69 --- andromda-cartridge.xml 28 Apr 2005 14:07:16 -0000 1.68 +++ andromda-cartridge.xml 30 Apr 2005 21:01:15 -0000 1.69 @@ -16,7 +16,7 @@ <!-- the name to give the service locator class --> <property reference="serviceLocatorName" default="ServiceLocator"/> <property reference="sequenceIdentifierSuffix" default="_SEQ"/> - <property reference="versionProperty" default=""/> + <property reference="versionPropertyName" default="version"/> <property reference="driver" default=""/> <property reference="username" default=""/> <property reference="password" default=""/> 1.51 +1 -0 cartridges/andromda-hibernate/src/META-INF/andromda-metafacades.xml Index: andromda-metafacades.xml =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/META-INF/andromda-metafacades.xml,v retrieving revision 1.50 retrieving revision 1.51 diff -u -w -r1.50 -r1.51 --- andromda-metafacades.xml 26 Apr 2005 21:48:02 -0000 1.50 +++ andromda-metafacades.xml 30 Apr 2005 21:01:20 -0000 1.51 @@ -24,6 +24,7 @@ <property reference="hibernateAssociationSortType" default="unsorted"/> <property reference="enumerationNamePattern" default="{0}Enum"/> <property reference="hibernateQueryUseSpecializedSetters" default="false"/> + <property reference="versionProperty" default="false"/> <metafacade class="org.andromda.cartridges.hibernate.metafacades.HibernateEntityLogicImpl" contextRoot="true"> <mapping class="org.omg.uml.foundation.core.UmlClass$Impl"> <stereotype>ENTITY</stereotype> 1.16 +4 -0 cartridges/andromda-hibernate/src/META-INF/andromda-profile.xml Index: andromda-profile.xml =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/META-INF/andromda-profile.xml,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -r1.15 -r1.16 --- andromda-profile.xml 26 Apr 2005 21:48:02 -0000 1.15 +++ andromda-profile.xml 30 Apr 2005 21:01:20 -0000 1.16 @@ -96,4 +96,8 @@ <from>HIBERNATE_ASSOCIATION_INDEX_COLUMN</from> <to>@andromda.hibernate.collection.index</to> </mapping> + <mapping> + <from>HIBERNATE_VERSION</from> + <to>@andromda.hibernate.version</to> + </mapping> </mappings> \ No newline at end of file 1.23 +2 -2 cartridges/andromda-hibernate/src/templates/hibernate/hibernate.hbm.xml.vsl Index: hibernate.hbm.xml.vsl =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/templates/hibernate/hibernate.hbm.xml.vsl,v retrieving revision 1.22 retrieving revision 1.23 diff -u -w -r1.22 -r1.23 --- hibernate.hbm.xml.vsl 26 Apr 2005 21:45:27 -0000 1.22 +++ hibernate.hbm.xml.vsl 30 Apr 2005 21:01:20 -0000 1.23 @@ -26,8 +26,8 @@ #if (!$entity.specializations.empty && $entity.hibernateInheritanceClass) <discriminator column="$entity.hibernateDiscriminatorColumn" type="$entity.hibernateDiscriminatorType"/> #end -#if ($stringUtils.isNotBlank($versionProperty)) - <version name="$versionProperty" type="int" column="$versionProperty"/> +#if ($entity.hibernateVersion && $stringUtils.isNotBlank($versionPropertyName)) + <version name="$versionPropertyName" type="int" column="$versionPropertyName"/> #end ## If super inheritance is 'interface', render super properties etc #foreach ($generalization in $entity.allGeneralizations) 1.55 +7 -7 cartridges/andromda-hibernate/src/templates/hibernate/HibernateEntity.vsl Index: HibernateEntity.vsl =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/templates/hibernate/HibernateEntity.vsl,v retrieving revision 1.54 retrieving revision 1.55 diff -u -w -r1.54 -r1.55 --- HibernateEntity.vsl 26 Apr 2005 21:45:27 -0000 1.54 +++ HibernateEntity.vsl 30 Apr 2005 21:01:20 -0000 1.55 @@ -22,21 +22,21 @@ */ private static final long serialVersionUID = ${entity.serialVersionUID}L; -#if ($stringUtils.isNotBlank($versionProperty)) -#set ($versionPropertyCapitalized = $stringUtils.capitalize($versionProperty)) +#if ($entity.hibernateVersion && $stringUtils.isNotBlank($versionPropertyName)) +#set ($versionPropertyNameCapitalized = $stringUtils.capitalize($versionPropertyName)) /** * Version property managed by Hibernate. */ - private int $versionProperty; + private int $versionPropertyName; - public int get$versionPropertyCapitalized() + public int get$versionPropertyNameCapitalized() { - return this.$versionProperty; + return this.$versionPropertyName; } - private void set$versionPropertyCapitalized (int $versionProperty) + private void set$versionPropertyNameCapitalized (int $versionPropertyName) { - this.$versionProperty = $versionProperty; + this.$versionPropertyName = $versionPropertyName; } #end 1.62 +68 -83 cartridges/andromda-hibernate/src/uml/HibernateMetafacadeModel.xml.zip <<Binary file>> 1.124 +27 -31 cartridges/andromda-hibernate/src/test/expected/cartridge-output.zip <<Binary file>> 1.31 +6 -0 cartridges/andromda-hibernate/src/java/org/andromda/cartridges/hibernate/HibernateProfile.java Index: HibernateProfile.java =================================================================== RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/java/org/andromda/cartridges/hibernate/HibernateProfile.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -w -r1.30 -r1.31 --- HibernateProfile.java 26 Apr 2005 21:45:54 -0000 1.30 +++ HibernateProfile.java 30 Apr 2005 21:01:31 -0000 1.31 @@ -150,4 +150,10 @@ */ public static final String TAGGEDVALUE_HIBERNATE_ASSOCIATION_INDEX_COLUMN = profile.get( "HIBERNATE_ASSOCIATION_INDEX_COLUMN"); + + /** + * Defines the tagged value for hibernate version on entities + */ + public static final String TAGGEDVALUE_HIBERNATE_VERSION = profile.get( + "HIBERNATE_VERSION"); } \ No newline at end of file 1.48 +169 -172 cartridges/andromda-hibernate/src/test/uml/HibernateCartridgeTestModel.xml.zip <<Binary file>> |