User: vancek
Date: 06/10/04 19:12:20
Modified: andromda-hibernate/src/templates/hibernate3 Tag: V3_x_HEAD
hibernate.hbm.xml.vm
uml-2.0/persistence/src/main/uml Tag: V3_x_HEAD
andromda-profile-persistence.xml.zip
andromda-hibernate/src/java/org/andromda/cartridges/hibernate/metafacades
Tag: V3_x_HEAD
HibernateEntityAttributeLogicImpl.java
uml/common/src/uml Tag: V3_x_HEAD
andromda-metafacades-uml.xml.zip
uml/uml2/src/main/resources/META-INF/andromda Tag: V3_x_HEAD
metafacades.xml
andromda-hibernate/src/META-INF/andromda Tag: V3_x_HEAD
metafacades.xml cartridge.xml
uml/uml2/src/main/java/org/andromda/metafacades/uml2 Tag:
V3_x_HEAD AttributeFacadeLogicImpl.java
EnumerationFacadeLogicImpl.java
uml/emf/uml2/src/main/java/org/andromda/metafacades/emf/uml2
Tag: V3_x_HEAD EnumerationFacadeLogicImpl.java
AttributeFacadeLogicImpl.java
uml/common/src/META-INF/andromda Tag: V3_x_HEAD
namespace.ent profile.xml
uml/uml14/src/java/org/andromda/metafacades/uml14 Tag:
V3_x_HEAD EnumerationFacadeLogicImpl.java
AttributeFacadeLogicImpl.java
andromda-java/src/META-INF/andromda Tag: V3_x_HEAD
cartridge.xml
uml/uml14/src/META-INF/andromda Tag: V3_x_HEAD
metafacades.xml
uml-1.4/persistence/src/main/uml Tag: V3_x_HEAD
andromda-profile-persistence.xml.zip
uml/emf/uml2/src/main/resources/META-INF/andromda Tag:
V3_x_HEAD metafacades.xml
andromda-hibernate/src/uml Tag: V3_x_HEAD
HibernateMetafacadeModel.xml.zip
uml/common/src/java/org/andromda/metafacades/uml Tag:
V3_x_HEAD UMLProfile.java
UMLMetafacadeProperties.java
Added: andromda-hibernate/src/templates/hibernate3/usertypes Tag:
V3_x_HEAD HibernateEnumType.vsl
andromda-java/src/templates/java Tag: V3_x_HEAD
TypeSafeEnumeration.vsl
Log:
JIRA UMLMETA-78 - Member variable & parameters support for enums in uml metafacades.
Add HibernateEntityAttribute.fullyQualifiedHibernateType to HibernateMetafacadeModel.xml.zip.
Add AttributeFacade.enumerationMember, AttributeFacade.enumerationLiteralParamers, AttributeFacade.enumerationLiteralParamersExist to andromda-metafacades-uml.zml.zip.
Add EnumerationFacade.memberVariables, EnumerationFacade.typeSafe to andromda-metafacades-uml.xml.zip.
Implemented methods in AttributeFacadeLogicImpl.java and EnumerationFacadeLogicImpl.java for emf-uml2, uml2 and uml1.4.
New typeSafeEnumsEnabled namespace property.
New HibernateEnumType.vsl.
New TypeSafeEnumeration.vsl for hibernate cartridge.
Add @andromda.persistence.enumeration.member.variable and @andromda.persistence.enumeration.literal.parameters to andromda-profile-persistence.xml.zip for uml2 and uml1.4 (emf-uml2 still to go).
Revision Changes Path
No revision
No revision
1.10.4.20 +15 -0 cartridges/andromda-hibernate/src/templates/hibernate3/hibernate.hbm.xml.vm
Index: hibernate.hbm.xml.vm
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/templates/hibernate3/hibernate.hbm.xml.vm,v
retrieving revision 1.10.4.19
retrieving revision 1.10.4.20
diff -u -w -r1.10.4.19 -r1.10.4.20
--- hibernate.hbm.xml.vm 26 Aug 2006 17:48:04 -0000 1.10.4.19
+++ hibernate.hbm.xml.vm 5 Oct 2006 02:12:15 -0000 1.10.4.20
@@ -16,6 +16,7 @@
#renderPropertiesAndAssociations3($attribute.type $sqlPrefix "$indent ")
${indent}</component>
#else
+#if ($typeSafeEnumsEnabled == false)
${indent}<property name="$attribute.name" type="$fullyQualifiedPropertyType"#if($attribute.formula || $attribute.lazy) lazy="true"#end#if(!$attribute.insertEnabled) insert="false"#end#if(!$attribute.updateEnabled) update="false"#end#if ($attribute.xmlTagName) node="$attribute.xmlTagName"#end>
#if($attribute.formula)
${indent} <formula>$attribute.formula</formula>
@@ -23,6 +24,20 @@
${indent} <column name="$attribute.concatColumnName($paramSqlPrefix, $attribute.columnName)" not-null="$attribute.required" unique="$attribute.unique"#if($attribute.uniqueGroup) unique-key="$attribute.uniqueGroup"#end sql-type="$attribute.sqlType"#if($attribute.columnIndex) index="$attribute.columnIndex"#end/>
#end
${indent}</property>
+#else
+${indent}<property name="$attribute.name" #if($attribute.formula || $attribute.lazy) lazy="true"#end#if(!$attribute.insertEnabled) insert="false"#end#if(!$attribute.updateEnabled) update="false"#end#if ($attribute.xmlTagName) node="$attribute.xmlTagName"#end>
+#if($attribute.formula)
+${indent} <formula>$attribute.formula</formula>
+#else
+${indent} <column name="$attribute.concatColumnName($paramSqlPrefix, $attribute.columnName)" not-null="$attribute.required" unique="$attribute.unique"#if($attribute.uniqueGroup) unique-key="$attribute.uniqueGroup"#end sql-type="$attribute.sqlType"#if($attribute.columnIndex) index="$attribute.columnIndex"#end/>
+${indent} <type name="${attribute.fullyQualifiedHibernateType}">
+#if ($attribute.type.enumeration)
+ <param name="enumClassName">${attribute.type.fullyQualifiedName}</param>
+#end
+${indent} </type>
+#end
+${indent}</property>
+#end
#end
#end
#end
No revision
No revision
1.1.2.3 +148 -168 profiles/uml-2.0/persistence/src/main/uml/Attic/andromda-profile-persistence.xml.zip
<<Binary file>>
No revision
No revision
1.15.4.4 +34 -0 cartridges/andromda-hibernate/src/java/org/andromda/cartridges/hibernate/metafacades/HibernateEntityAttributeLogicImpl.java
Index: HibernateEntityAttributeLogicImpl.java
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/java/org/andromda/cartridges/hibernate/metafacades/HibernateEntityAttributeLogicImpl.java,v
retrieving revision 1.15.4.3
retrieving revision 1.15.4.4
diff -u -w -r1.15.4.3 -r1.15.4.4
--- HibernateEntityAttributeLogicImpl.java 21 Jun 2006 14:07:59 -0000 1.15.4.3
+++ HibernateEntityAttributeLogicImpl.java 5 Oct 2006 02:12:15 -0000 1.15.4.4
@@ -5,6 +5,7 @@
import org.andromda.metafacades.uml.ClassifierFacade;
import org.andromda.metafacades.uml.EntityMetafacadeUtils;
import org.andromda.metafacades.uml.NameMasker;
+import org.andromda.metafacades.uml.TypeMappings;
import org.andromda.metafacades.uml.UMLMetafacadeProperties;
import org.apache.commons.lang.StringUtils;
@@ -181,4 +182,37 @@
return (StringUtils.isBlank(tagName)) ? null : tagName;
}
+ protected String handleGetFullyQualifiedHibernateType() {
+ final String fullyQualifiedName;
+
+ if (this.getType().isEnumeration())
+ {
+ fullyQualifiedName = "org.andromda.persistence.hibernate.usertypes.HibernateEnumType";
+ }
+ else
+ {
+ final String hibernateTypeMappingsUri = (String)this.getConfiguredProperty("hibernateTypeMappingsUri");
+ final TypeMappings mappings = TypeMappings.getInstance(hibernateTypeMappingsUri);
+
+ if (mappings == null)
+ {
+ fullyQualifiedName = this.getType().getFullyQualifiedName();
+ }
+ else
+ {
+ final String fullyQualifiedModelName = this.getType().getFullyQualifiedName(true);
+ if (mappings.getMappings().containsFrom(fullyQualifiedModelName))
+ {
+ fullyQualifiedName = mappings.getTo(fullyQualifiedModelName);
+ }
+ else
+ {
+ fullyQualifiedName = this.getType().getFullyQualifiedName();
+ }
+ }
+ }
+
+ return fullyQualifiedName;
+ }
+
}
\ No newline at end of file
No revision
No revision
1.1.2.32 +394 -374 metafacades/uml/common/src/uml/andromda-metafacades-uml.xml.zip
<<Binary file>>
No revision
No revision
1.1.2.5 +2 -0 metafacades/uml/uml2/src/main/resources/META-INF/andromda/Attic/metafacades.xml
Index: metafacades.xml
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/uml2/src/main/resources/META-INF/andromda/Attic/metafacades.xml,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -u -w -r1.1.2.4 -r1.1.2.5
--- metafacades.xml 19 Sep 2006 16:14:02 -0000 1.1.2.4
+++ metafacades.xml 5 Oct 2006 02:12:16 -0000 1.1.2.5
@@ -40,12 +40,14 @@
<metafacade class="org.andromda.metafacades.uml2.EnumerationFacadeLogicImpl">
<mapping class="org.eclipse.uml2.impl.EnumerationImpl"/>
<property reference="enumerationNameMask"/>
+ <property reference="typeSafeEnumsEnabled"/>
</metafacade>
<metafacade class="org.andromda.metafacades.uml2.EnumerationFacadeLogicImpl">
<mapping class="org.eclipse.uml2.impl.ClassImpl">
<stereotype>ENUMERATION</stereotype>
</mapping>
<property reference="enumerationNameMask"/>
+ <property reference="typeSafeEnumsEnabled"/>
</metafacade>
<metafacade class="org.andromda.metafacades.uml2.AssociationClassFacadeLogicImpl">
<mapping class="org.eclipse.uml2.impl.AssociationClassImpl"/>
No revision
No revision
1.3.2.12 +1 -0 cartridges/andromda-hibernate/src/META-INF/andromda/metafacades.xml
Index: metafacades.xml
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/META-INF/andromda/metafacades.xml,v
retrieving revision 1.3.2.11
retrieving revision 1.3.2.12
diff -u -w -r1.3.2.11 -r1.3.2.12
--- metafacades.xml 26 Aug 2006 03:50:50 -0000 1.3.2.11
+++ metafacades.xml 5 Oct 2006 02:12:16 -0000 1.3.2.12
@@ -107,6 +107,7 @@
<mapping>
<context>org.andromda.cartridges.hibernate.metafacades.HibernateEntity</context>
</mapping>
+ <property reference="hibernateTypeMappingsUri"/>
</metafacade>
<metafacade class="org.andromda.cartridges.hibernate.metafacades.HibernateEmbeddedValueLogicImpl" contextRoot="true">
<mapping>
1.5.4.12 +37 -1 cartridges/andromda-hibernate/src/META-INF/andromda/cartridge.xml
Index: cartridge.xml
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-hibernate/src/META-INF/andromda/cartridge.xml,v
retrieving revision 1.5.4.11
retrieving revision 1.5.4.12
diff -u -w -r1.5.4.11 -r1.5.4.12
--- cartridge.xml 29 Aug 2006 14:03:22 -0000 1.5.4.11
+++ cartridge.xml 5 Oct 2006 02:12:17 -0000 1.5.4.12
@@ -62,10 +62,12 @@
<!-- This property is only relevant for Hibernate 3 -->
<property reference="hibernateQueryFactory"/>
<property reference="toDoTag"/>
+ <property reference="typeSafeEnumsEnabled"/>
<!-- cartridge-property merge-point-->
<condition name="mapSubclassesInSeparateFile">$hibernateUtils.mapSubclassesInSeparateFile</condition>
+ <condition name="typeSafeEnumsEnabled">$typeSafeEnumsEnabled.equalsIgnoreCase("true")</condition>
<!-- condition merge-point-->
<!-- cartridge-resource merge-point -->
@@ -187,11 +189,45 @@
<modelElement>
<type name="org.andromda.metafacades.uml.EnumerationFacade">
<property name="version">3</property>
+ <property name="typeSafe">false</property>
</type>
</modelElement>
</modelElements>
</template>
+ <template
+ path="templates/hibernate3/hibernate.cfg.xml.vsl"
+ outputPattern="hibernate.cfg.xml"
+ outlet="configuration"
+ overwrite="true"
+ outputToSingleFile="true"
+ outputOnEmptyElements="false">
+ <modelElements variable="entities">
+ <modelElement>
+ <type name="org.andromda.cartridges.hibernate.metafacades.HibernateEntity">
+ <property name="requiresMapping"/>
+ <property name="version">3</property>
+ </type>
+ </modelElement>
+ </modelElements>
+ </template>
+
+ <template
+ path="templates/hibernate3/usertypes/HibernateEnumType.vsl"
+ outputPattern="$generatedFile"
+ outlet="user-types"
+ overwrite="true"
+ outputToSingleFile="true"
+ outputOnEmptyElements="false">
+ <modelElements variable="enumeration">
+ <modelElement>
+ <type name="org.andromda.metafacades.uml.EnumerationFacade">
+ <property name="version">3</property>
+ <property name="typeSafe">true</property>
+ </type>
+ </modelElement>
+ </modelElements>
+ </template>
<!-- common templates -->
<template
No revision
No revision
1.1.2.4 +27 -0 metafacades/uml/uml2/src/main/java/org/andromda/metafacades/uml2/Attic/AttributeFacadeLogicImpl.java
Index: AttributeFacadeLogicImpl.java
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/uml2/src/main/java/org/andromda/metafacades/uml2/Attic/AttributeFacadeLogicImpl.java,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -w -r1.1.2.3 -r1.1.2.4
--- AttributeFacadeLogicImpl.java 26 Apr 2006 00:47:31 -0000 1.1.2.3
+++ AttributeFacadeLogicImpl.java 5 Oct 2006 02:12:17 -0000 1.1.2.4
@@ -115,6 +115,33 @@
}
/**
+ * @see org.andromda.metafacades.uml.AttributeFacade#handleIsEnumerationMember()
+ */
+ protected boolean handleIsEnumerationMember()
+ {
+ // TODO: put your implementation here.
+ return false;
+ }
+
+ /**
+ * @see org.andromda.metafacades.uml.AttributeFacade#handleGetEnumerationLiteralParameters()
+ */
+ protected String handleGetEnumerationLiteralParameters()
+ {
+ // TODO: put your implementation here.
+ return null;
+ }
+
+ /**
+ * @see org.andromda.metafacades.uml.AttributeFacade#handleIsEnumerationLiteralParametersExist()
+ */
+ protected boolean handleIsEnumerationLiteralParametersExist()
+ {
+ // TODO: put your implementation here.
+ return false;
+ }
+
+ /**
* @see org.andromda.metafacades.uml.AttributeFacade#getGetterSetterTypeName()
*/
protected java.lang.String handleGetGetterSetterTypeName()
1.1.2.2 +21 -1 metafacades/uml/uml2/src/main/java/org/andromda/metafacades/uml2/Attic/EnumerationFacadeLogicImpl.java
Index: EnumerationFacadeLogicImpl.java
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/uml2/src/main/java/org/andromda/metafacades/uml2/Attic/EnumerationFacadeLogicImpl.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -w -r1.1.2.1 -r1.1.2.2
--- EnumerationFacadeLogicImpl.java 6 Jan 2006 06:12:04 -0000 1.1.2.1
+++ EnumerationFacadeLogicImpl.java 5 Oct 2006 02:12:17 -0000 1.1.2.2
@@ -1,5 +1,8 @@
package org.andromda.metafacades.uml2;
+import org.andromda.metafacades.uml.UMLMetafacadeProperties;
+import org.apache.commons.lang.BooleanUtils;
+
/**
* MetafacadeLogic implementation for org.andromda.metafacades.uml.EnumerationFacade.
@@ -43,6 +46,15 @@
}
/**
+ * @see org.andromda.metafacades.uml.EnumerationFacade#getMemberVariables()
+ */
+ protected java.util.Collection handleGetMemberVariables()
+ {
+ // TODO: add your implementation here!
+ return null;
+ }
+
+ /**
* @see org.andromda.metafacades.uml.EnumerationFacade#getLiteralType()
*/
protected java.lang.Object handleGetLiteralType()
@@ -51,4 +63,12 @@
return null;
}
+ /**
+ * @see org.andromda.metafacades.uml.EnumerationFacade#isTypeSafe()
+ */
+ protected boolean handleIsTypeSafe()
+ {
+ return BooleanUtils.toBoolean(
+ String.valueOf(this.getConfiguredProperty(UMLMetafacadeProperties.TYPE_SAFE_ENUMS_ENABLED)));
+ }
}
\ No newline at end of file
No revision
No revision
1.2.2.5 +63 -2 metafacades/uml/emf/uml2/src/main/java/org/andromda/metafacades/emf/uml2/EnumerationFacadeLogicImpl.java
Index: EnumerationFacadeLogicImpl.java
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/emf/uml2/src/main/java/org/andromda/metafacades/emf/uml2/EnumerationFacadeLogicImpl.java,v
retrieving revision 1.2.2.4
retrieving revision 1.2.2.5
diff -u -w -r1.2.2.4 -r1.2.2.5
--- EnumerationFacadeLogicImpl.java 25 Jul 2006 21:24:26 -0000 1.2.2.4
+++ EnumerationFacadeLogicImpl.java 5 Oct 2006 02:12:17 -0000 1.2.2.5
@@ -7,6 +7,8 @@
import org.andromda.metafacades.uml.NameMasker;
import org.andromda.metafacades.uml.UMLMetafacadeProperties;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.eclipse.uml2.Enumeration;
import org.eclipse.uml2.NamedElement;
@@ -49,9 +51,59 @@
*/
protected java.util.Collection handleGetLiterals()
{
- return this.metaObject instanceof Enumeration
+ // To Check: could be sufficient to return the collection of literals only
+ // without filtering
+ Collection literals = (this.metaObject instanceof Enumeration
? ((Enumeration)this.metaObject).getOwnedLiterals()
- : CollectionUtils.collect(this.getAttributes(), UmlUtilities.ELEMENT_TRANSFORMER);
+ : CollectionUtils.collect(this.getAttributes(), UmlUtilities.ELEMENT_TRANSFORMER));
+
+ CollectionUtils.filter(
+ literals,
+ new Predicate()
+ {
+ public boolean evaluate(Object object)
+ {
+ boolean isLiteral = true;
+ final AttributeFacade attribute = (AttributeFacade)object;
+ if (attribute.isEnumerationMember())
+ {
+ isLiteral = false;
+ }
+ return isLiteral;
+ }
+ }
+ );
+ return literals;
+ }
+
+ /**
+ * @see org.andromda.metafacades.uml.EnumerationFacade#getMemberVariables()
+ */
+ protected Collection handleGetMemberVariables()
+ {
+ // To Check: could be sufficient to return the collection of attributes only
+ // without filtering
+ Collection variables = (this.metaObject instanceof Enumeration
+ ? ((Enumeration)this.metaObject).getOwnedLiterals()
+ : CollectionUtils.collect(this.getAttributes(), UmlUtilities.ELEMENT_TRANSFORMER));
+
+ CollectionUtils.filter(
+ variables,
+ new Predicate()
+ {
+ public boolean evaluate(Object object)
+ {
+ boolean isMember = false;
+ final AttributeFacade attribute = (AttributeFacade)object;
+ if (attribute.isEnumerationMember())
+ {
+ isMember = true;
+ }
+ return isMember;
+ }
+ }
+ );
+ return variables;
}
/**
@@ -71,6 +123,15 @@
}
/**
+ * @see org.andromda.metafacades.uml.EnumerationFacade#isTypeSafe()
+ */
+ protected boolean handleIsTypeSafe()
+ {
+ return BooleanUtils.toBoolean(
+ String.valueOf(this.getConfiguredProperty(UMLMetafacadeProperties.TYPE_SAFE_ENUMS_ENABLED)));
+ }
+
+ /**
* @see org.andromda.metafacades.uml.EnumerationFacade#getFromOperationName()
*/
protected String handleGetFromOperationName()
1.1.2.11 +36 -0 metafacades/uml/emf/uml2/src/main/java/org/andromda/metafacades/emf/uml2/AttributeFacadeLogicImpl.java
Index: AttributeFacadeLogicImpl.java
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/emf/uml2/src/main/java/org/andromda/metafacades/emf/uml2/AttributeFacadeLogicImpl.java,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -u -w -r1.1.2.10 -r1.1.2.11
--- AttributeFacadeLogicImpl.java 10 Sep 2006 20:01:28 -0000 1.1.2.10
+++ AttributeFacadeLogicImpl.java 5 Oct 2006 02:12:17 -0000 1.1.2.11
@@ -133,6 +133,42 @@
}
/**
+ * @see org.andromda.metafacades.uml.AttributeFacade#handleIsEnumerationMember()
+ */
+ protected boolean handleIsEnumerationMember()
+ {
+ boolean isMemberVariable = false;
+ final String isMemberVariableAsString = (String)this.findTaggedValue(
+ UMLProfile.TAGGEDVALUE_PERSISTENCE_ENUMERATION_MEMBER_VARIABLE);
+ if (StringUtils.isNotEmpty(isMemberVariableAsString) && BooleanUtils.toBoolean(isMemberVariableAsString))
+ {
+ isMemberVariable = true;
+ }
+ return isMemberVariable;
+ }
+
+ /**
+ * @see org.andromda.metafacades.uml.AttributeFacade#handleGetEnumerationLiteralParameters()
+ */
+ protected String handleGetEnumerationLiteralParameters()
+ {
+ return (String)this.findTaggedValue(UMLProfile.TAGGEDVALUE_PERSISTENCE_ENUMERATION_LITERAL_PARAMETERS);
+ }
+
+ /**
+ * @see org.andromda.metafacades.uml.AttributeFacade#handleIsEnumerationLiteralParametersExist()
+ */
+ protected boolean handleIsEnumerationLiteralParametersExist()
+ {
+ boolean parametersExist = false;
+ if (StringUtils.isNotBlank(this.getEnumerationLiteralParameters()))
+ {
+ parametersExist = true;
+ }
+ return parametersExist;
+ }
+
+ /**
* @see org.andromda.metafacades.uml.AttributeFacade#getGetterSetterTypeName()
*/
protected java.lang.String handleGetGetterSetterTypeName()
No revision
No revision
1.1.2.1 +121 -0 cartridges/andromda-hibernate/src/templates/hibernate3/usertypes/Attic/HibernateEnumType.vsl
No revision
No revision
1.1.2.10 +9 -0 metafacades/uml/common/src/META-INF/andromda/namespace.ent
Index: namespace.ent
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/common/src/META-INF/andromda/namespace.ent,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -w -r1.1.2.9 -r1.1.2.10
--- namespace.ent 25 Jul 2006 21:24:25 -0000 1.1.2.9
+++ namespace.ent 5 Oct 2006 02:12:17 -0000 1.1.2.10
@@ -345,5 +345,14 @@
the default Eclipse task tag.
</documentation>
</property>
+ <property name="typeSafeEnumsEnabled">
+ <default>false</default>
+ <documentation>
+ Indicates whether enumerations must be generated using a Java 5 type-safe enum or a
+ traditional enumeration-pattern class. Note that there are 2 prerequisites for this
+ property to work correctly: you must use a Java 5 compiler and you must use Hibernate 3
+ for Object-relational mapping.
+ </documentation>
+ </property>
</propertyGroup>
</properties>
\ No newline at end of file
1.13.4.8 +31 -0 metafacades/uml/common/src/META-INF/andromda/profile.xml
Index: profile.xml
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/common/src/META-INF/andromda/profile.xml,v
retrieving revision 1.13.4.7
retrieving revision 1.13.4.8
diff -u -w -r1.13.4.7 -r1.13.4.8
--- profile.xml 26 Aug 2006 17:48:13 -0000 1.13.4.7
+++ profile.xml 5 Oct 2006 02:12:17 -0000 1.13.4.8
@@ -227,6 +227,37 @@
</documentation>
<value>@andromda.persistence.immutable</value>
</element>
+ <element name="PERSISTENCE_ENUMERATION_MEMBER_VARIABLE">
+ <documentation>
+ Specifies whether the enumeration attribue is
+ defined as a member variable rather than a literal.
+ This should only be set if the attribute is NOT a
+ literal.
+ </documentation>
+ <value>
+ @andromda.persistence.enumeration.member.variable
+ </value>
+ <appliedOnElement>
+ Enumeration Attribute
+ </appliedOnElement>
+ <allowedValues>
+ <value>true</value>
+ <value>false</value>
+ </allowedValues>
+ </element>
+ <element name="PERSISTENCE_ENUMERATION_LITERAL_PARAMETERS">
+ <documentation>
+ Specifies the enumeration literal parameters which are
+ passed to the appropriate constructor when created.
+ The parameters are comma separated.
+ </documentation>
+ <value>
+ @andromda.persistence.enumeration.literal.parameters
+ </value>
+ <appliedOnElement>
+ Enumeration Literal
+ </appliedOnElement>
+ </element>
<element name="PRESENTATION_CONTROLLER_USECASE">
<documentation>
The value should correspond to the use-case holding the activity graph
No revision
No revision
1.13.6.1 +56 -2 metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/EnumerationFacadeLogicImpl.java
Index: EnumerationFacadeLogicImpl.java
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/EnumerationFacadeLogicImpl.java,v
retrieving revision 1.13
retrieving revision 1.13.6.1
diff -u -w -r1.13 -r1.13.6.1
--- EnumerationFacadeLogicImpl.java 21 Jun 2005 17:59:16 -0000 1.13
+++ EnumerationFacadeLogicImpl.java 5 Oct 2006 02:12:18 -0000 1.13.6.1
@@ -4,6 +4,9 @@
import org.andromda.metafacades.uml.ClassifierFacade;
import org.andromda.metafacades.uml.NameMasker;
import org.andromda.metafacades.uml.UMLMetafacadeProperties;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.Predicate;
+import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import java.util.Collection;
@@ -39,7 +42,49 @@
*/
protected java.util.Collection handleGetLiterals()
{
- return this.getAttributes();
+ Collection literals = this.getAttributes();
+ CollectionUtils.filter(
+ literals,
+ new Predicate()
+ {
+ public boolean evaluate(Object object)
+ {
+ boolean isLiteral = true;
+ final AttributeFacade attribute = (AttributeFacade)object;
+ if (attribute.isEnumerationMember())
+ {
+ isLiteral = false;
+ }
+ return isLiteral;
+ }
+ }
+ );
+ return literals;
+ }
+
+ /**
+ * @see org.andromda.metafacades.uml.EnumerationFacade#getMemberVariables()
+ */
+ protected java.util.Collection handleGetMemberVariables()
+ {
+ Collection variables = super.getAttributes();
+ CollectionUtils.filter(
+ variables,
+ new Predicate()
+ {
+ public boolean evaluate(Object object)
+ {
+ boolean isMember = false;
+ final AttributeFacade attribute = (AttributeFacade)object;
+ if (attribute.isEnumerationMember())
+ {
+ isMember = true;
+ }
+ return isMember;
+ }
+ }
+ );
+ return variables;
}
/**
@@ -59,6 +104,15 @@
}
/**
+ * @see org.andromda.metafacades.uml.EnumerationFacade#isTypeSafe()
+ */
+ protected boolean handleIsTypeSafe()
+ {
+ return BooleanUtils.toBoolean(
+ String.valueOf(this.getConfiguredProperty(UMLMetafacadeProperties.TYPE_SAFE_ENUMS_ENABLED)));
+ }
+
+ /**
* @see org.andromda.metafacades.uml.EnumerationFacade#getFromOperationName()
*/
protected String handleGetFromOperationName()
1.52.4.9 +51 -6 metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/AttributeFacadeLogicImpl.java
Index: AttributeFacadeLogicImpl.java
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/uml14/src/java/org/andromda/metafacades/uml14/AttributeFacadeLogicImpl.java,v
retrieving revision 1.52.4.8
retrieving revision 1.52.4.9
diff -u -w -r1.52.4.8 -r1.52.4.9
--- AttributeFacadeLogicImpl.java 22 Jun 2006 12:57:08 -0000 1.52.4.8
+++ AttributeFacadeLogicImpl.java 5 Oct 2006 02:12:18 -0000 1.52.4.9
@@ -260,6 +260,42 @@
}
/**
+ * @see org.andromda.metafacades.uml.AttributeFacade#handleIsEnumerationMember()
+ */
+ protected boolean handleIsEnumerationMember()
+ {
+ boolean isMemberVariable = false;
+ final String isMemberVariableAsString = (String)this.findTaggedValue(
+ UMLProfile.TAGGEDVALUE_PERSISTENCE_ENUMERATION_MEMBER_VARIABLE);
+ if (StringUtils.isNotEmpty(isMemberVariableAsString) && BooleanUtils.toBoolean(isMemberVariableAsString))
+ {
+ isMemberVariable = true;
+ }
+ return isMemberVariable;
+ }
+
+ /**
+ * @see org.andromda.metafacades.uml.AttributeFacade#handleGetEnumerationLiteralParameters()
+ */
+ protected String handleGetEnumerationLiteralParameters()
+ {
+ return (String)this.findTaggedValue(UMLProfile.TAGGEDVALUE_PERSISTENCE_ENUMERATION_LITERAL_PARAMETERS);
+ }
+
+ /**
+ * @see org.andromda.metafacades.uml.AttributeFacade#handleIsEnumerationLiteralParametersExist()
+ */
+ protected boolean handleIsEnumerationLiteralParametersExist()
+ {
+ boolean parametersExist = false;
+ if (StringUtils.isNotBlank(this.getEnumerationLiteralParameters()))
+ {
+ parametersExist = true;
+ }
+ return parametersExist;
+ }
+
+ /**
* @see org.andromda.metafacades.uml.AttributeFacade#isDefaultValuePresent()
*/
public boolean handleIsDefaultValuePresent()
@@ -274,12 +310,21 @@
*/
protected String handleGetName()
{
+ String name = null;
+ if (this.isEnumerationMember())
+ {
+ name = super.handleGetName();
+ }
+ else
+ {
final String mask = String.valueOf(this.getConfiguredProperty(
this.getOwner() instanceof EnumerationFacade
? UMLMetafacadeProperties.ENUMERATION_LITERAL_NAME_MASK
: UMLMetafacadeProperties.CLASSIFIER_PROPERTY_NAME_MASK ));
- return NameMasker.mask(super.handleGetName(), mask);
+ name = NameMasker.mask(super.handleGetName(), mask);
+ }
+ return name;
}
/**
No revision
No revision
1.4.6.6 +17 -1 cartridges/andromda-java/src/META-INF/andromda/cartridge.xml
Index: cartridge.xml
===================================================================
RCS file: /cvsroot/andromda/cartridges/andromda-java/src/META-INF/andromda/cartridge.xml,v
retrieving revision 1.4.6.5
retrieving revision 1.4.6.6
diff -u -w -r1.4.6.5 -r1.4.6.6
--- cartridge.xml 16 Mar 2006 20:00:44 -0000 1.4.6.5
+++ cartridge.xml 5 Oct 2006 02:12:18 -0000 1.4.6.6
@@ -80,7 +80,23 @@
overwrite="true">
<modelElements variable="enumeration">
<modelElement>
- <type name="org.andromda.metafacades.uml.EnumerationFacade"/>
+ <type name="org.andromda.metafacades.uml.EnumerationFacade">
+ <property name="typeSafe">false</property>
+ </type>
+ </modelElement>
+ </modelElements>
+ </template>
+
+ <template
+ path="templates/java/TypeSafeEnumeration.vsl"
+ outputPattern="{0}/{1}.java"
+ outlet="enumerations"
+ overwrite="true">
+ <modelElements variable="enumeration">
+ <modelElement>
+ <type name="org.andromda.metafacades.uml.EnumerationFacade">
+ <property name="typeSafe"/>
+ </type>
</modelElement>
</modelElements>
</template>
No revision
No revision
1.12.4.16 +1 -0 metafacades/uml/uml14/src/META-INF/andromda/metafacades.xml
Index: metafacades.xml
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/uml14/src/META-INF/andromda/metafacades.xml,v
retrieving revision 1.12.4.15
retrieving revision 1.12.4.16
diff -u -w -r1.12.4.15 -r1.12.4.16
--- metafacades.xml 19 Sep 2006 16:14:00 -0000 1.12.4.15
+++ metafacades.xml 5 Oct 2006 02:12:18 -0000 1.12.4.16
@@ -40,6 +40,7 @@
<stereotype>ENUMERATION</stereotype>
</mapping>
<property reference="enumerationNameMask"/>
+ <property reference="typeSafeEnumsEnabled"/>
</metafacade>
<metafacade class="org.andromda.metafacades.uml14.AssociationClassFacadeLogicImpl">
<mapping class="org.omg.uml.foundation.core.AssociationClass$Impl"/>
No revision
No revision
1.1.4.14 +115 -109 profiles/uml-1.4/persistence/src/main/uml/andromda-profile-persistence.xml.zip
<<Binary file>>
No revision
No revision
1.3.2.12 +2 -0 metafacades/uml/emf/uml2/src/main/resources/META-INF/andromda/metafacades.xml
Index: metafacades.xml
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/emf/uml2/src/main/resources/META-INF/andromda/metafacades.xml,v
retrieving revision 1.3.2.11
retrieving revision 1.3.2.12
diff -u -w -r1.3.2.11 -r1.3.2.12
--- metafacades.xml 16 Aug 2006 16:29:43 -0000 1.3.2.11
+++ metafacades.xml 5 Oct 2006 02:12:18 -0000 1.3.2.12
@@ -43,12 +43,14 @@
<metafacade class="org.andromda.metafacades.emf.uml2.EnumerationFacadeLogicImpl">
<mapping class="org.eclipse.uml2.impl.EnumerationImpl"/>
<property reference="enumerationNameMask"/>
+ <property reference="typeSafeEnumsEnabled"/>
</metafacade>
<metafacade class="org.andromda.metafacades.emf.uml2.EnumerationFacadeLogicImpl">
<mapping class="org.eclipse.uml2.impl.ClassImpl">
<stereotype>ENUMERATION</stereotype>
</mapping>
<property reference="enumerationNameMask"/>
+ <property reference="typeSafeEnumsEnabled"/>
</metafacade>
<metafacade class="org.andromda.metafacades.emf.uml2.AssociationClassFacadeLogicImpl">
<mapping class="org.eclipse.uml2.impl.AssociationClassImpl"/>
No revision
No revision
1.83.2.13 +1034 -1079cartridges/andromda-hibernate/src/uml/HibernateMetafacadeModel.xml.zip
<<Binary file>>
No revision
No revision
1.61.4.6 +12 -0 metafacades/uml/common/src/java/org/andromda/metafacades/uml/UMLProfile.java
Index: UMLProfile.java
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/common/src/java/org/andromda/metafacades/uml/UMLProfile.java,v
retrieving revision 1.61.4.5
retrieving revision 1.61.4.6
diff -u -w -r1.61.4.5 -r1.61.4.6
--- UMLProfile.java 26 Aug 2006 17:48:13 -0000 1.61.4.5
+++ UMLProfile.java 5 Oct 2006 02:12:19 -0000 1.61.4.6
@@ -205,6 +205,18 @@
"PERSISTENCE_FOREIGN_KEY_CONSTRAINT_NAME");
/**
+ * Used to assign an enumeration attribute as a member variable rather than a literal.
+ */
+ public static final String TAGGEDVALUE_PERSISTENCE_ENUMERATION_MEMBER_VARIABLE = profile.get(
+ "PERSISTENCE_ENUMERATION_MEMBER_VARIABLE");
+
+ /**
+ * Used on an enumeration literal to define the enumeration literal parameters.
+ */
+ public static final String TAGGEDVALUE_PERSISTENCE_ENUMERATION_LITERAL_PARAMETERS = profile.get(
+ "PERSISTENCE_ENUMERATION_LITERAL_PARAMETERS");
+
+ /**
* Used to assign the controller to the activity (when it can not be assigned explicity).
*/
public static final String TAGGEDVALUE_PRESENTATION_CONTROLLER_USECASE = profile.get("PRESENTATION_CONTROLLER_USECASE");
1.24.6.6 +6 -0 metafacades/uml/common/src/java/org/andromda/metafacades/uml/UMLMetafacadeProperties.java
Index: UMLMetafacadeProperties.java
===================================================================
RCS file: /cvsroot/andromda/metafacades/uml/common/src/java/org/andromda/metafacades/uml/UMLMetafacadeProperties.java,v
retrieving revision 1.24.6.5
retrieving revision 1.24.6.6
diff -u -w -r1.24.6.5 -r1.24.6.6
--- UMLMetafacadeProperties.java 25 Jul 2006 21:24:25 -0000 1.24.6.5
+++ UMLMetafacadeProperties.java 5 Oct 2006 02:12:19 -0000 1.24.6.6
@@ -224,4 +224,10 @@
*/
public static final String MANAGEABLE_ID_DISPLAY_STRATEGY = "manageableIdDisplayStrategy";
+ /**
+ * Indicates whether enumerations must be generated using a Java 5 type-safe enum or a
+ * traditional enumeration-pattern class.
+ */
+ public static final String TYPE_SAFE_ENUMS_ENABLED = "typeSafeEnumsEnabled";
+
}
\ No newline at end of file
No revision
No revision
1.1.2.1 +100 -0 cartridges/andromda-java/src/templates/java/Attic/TypeSafeEnumeration.vsl
|