Topia-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
April 2014
- 7 participants
- 73 discussions
r3084 - trunk/topia-templates/src/main/java/org/nuiton/topia/templates
by tchemit@users.nuiton.org 26 Apr '14
by tchemit@users.nuiton.org 26 Apr '14
26 Apr '14
Author: tchemit
Date: 2014-04-26 21:17:33 +0200 (Sat, 26 Apr 2014)
New Revision: 3084
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3084
Log:
refs #2079 (add some first tag values default values) + reformat tag values
Modified:
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java 2014-04-26 18:57:31 UTC (rev 3083)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java 2014-04-26 19:17:33 UTC (rev 3084)
@@ -25,6 +25,7 @@
*/
import org.nuiton.eugene.EugeneTagValues;
+import org.nuiton.eugene.metas.TagValueDefinition;
import org.nuiton.eugene.metas.matcher.PrefixTagNameMatchTagValueMatcher;
import org.nuiton.eugene.models.object.ObjectModel;
import org.nuiton.eugene.models.object.ObjectModelAttribute;
@@ -34,8 +35,6 @@
import org.nuiton.topia.persistence.TopiaDaoSupplier;
import org.nuiton.topia.persistence.TopiaEntityContextable;
-import org.nuiton.eugene.metas.TagValueDefinition;
-
/**
* All extra tag values usable in topia generators.
*
@@ -52,7 +51,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModelClassifier.class},
- documentation = "")
+ documentation = "TODO")
String TAG_PERSISTENCE_TYPE = "persistenceType";
/**
@@ -62,7 +61,7 @@
*
* @since 2.5.3
*/
- @TagValueDefinition(target = {ObjectModelClassifier.class}, documentation = "")
+ @TagValueDefinition(target = {ObjectModelClassifier.class}, documentation = "TODO")
String TAG_CONTEXTABLE = "contextable";
/**
@@ -73,7 +72,7 @@
* @see TopiaGeneratorUtil#getReverseDbName(ObjectModelAttribute)
*/
@TagValueDefinition(target = {ObjectModelElement.class},
- documentation = "Sets the database name of an element of the model (a table or a column)")
+ documentation = "Sets the database name of an element of the model (a table or a column)")
String TAG_DB_NAME = "dbName";
/**
@@ -84,7 +83,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModel.class, ObjectModelClassifier.class, ObjectModelAttribute.class},
- documentation = "Sets the database schema name")
+ documentation = "Sets the database schema name")
String TAG_SCHEMA_NAME = "dbSchema";
/**
@@ -94,7 +93,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModelAttribute.class},
- documentation = "Sets the length of an attribute in database")
+ documentation = "Sets the length of an attribute in database")
String TAG_LENGTH = "length";
/**
@@ -104,7 +103,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModelAttribute.class},
- documentation = "Sets an annotation of an attribute")
+ documentation = "Sets an annotation of an attribute")
String TAG_ANNOTATION = "annotation";
/**
@@ -114,7 +113,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModelAttribute.class},
- documentation = "Sets the access type of an attribute (Hibernate mapping)")
+ documentation = "Sets the access type of an attribute (Hibernate mapping)")
String TAG_ACCESS = "access";
/**
@@ -125,7 +124,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModelAttribute.class},
- documentation = "Sets an attribute as part of a natural id (Hibernate Mapping)")
+ documentation = "Sets an attribute as part of a natural id (Hibernate Mapping)")
String TAG_NATURAL_ID = "naturalId";
/**
@@ -136,7 +135,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModelClassifier.class},
- documentation = "Sets if natural id of a entity is mutable (hibernate mapping)")
+ documentation = "Sets if natural id of a entity is mutable (hibernate mapping)")
String TAG_NATURAL_ID_MUTABLE = "naturalIdMutable";
/**
@@ -150,7 +149,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModelAttribute.class},
- documentation = "Sets which part of a N-N relation is master (inverse=true) and slave (inverse=false) (must be put on each side on a such relation) (Hibernate mapping)")
+ documentation = "Sets which part of a N-N relation is master (inverse=true) and slave (inverse=false) (must be put on each side on a such relation) (Hibernate mapping)")
String TAG_INVERSE = "inverse";
/**
@@ -160,7 +159,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModelAttribute.class},
- documentation = "Sets if an association should be lazy (Hibernate mapping)")
+ documentation = "Sets if an association should be lazy (Hibernate mapping)")
String TAG_LAZY = "lazy";
/**
@@ -170,7 +169,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModelAttribute.class},
- documentation = "Sets the fetch caracteristic of an attribute (Hibernate mapping)")
+ documentation = "Sets the fetch caracteristic of an attribute (Hibernate mapping)")
String TAG_FETCH = "fetch";
/**
@@ -180,7 +179,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModelAttribute.class},
- documentation = "Sets the order by propertie of an multiple association (Hibernate mapping)")
+ documentation = "Sets the order by propertie of an multiple association (Hibernate mapping)")
String TAG_ORDER_BY = "orderBy";
/**
@@ -190,7 +189,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModelAttribute.class},
- documentation = "Sets if an attribute must be not null (Hibernate mapping)")
+ documentation = "Sets if an attribute must be not null (Hibernate mapping)")
String TAG_NOT_NULL = "notNull";
/**
@@ -198,11 +197,12 @@
* énumération : l'ajout de la tagValue indique qu'il faut utiliser le
* {@code name} de l'énumération et non l'ordinal pour stocker la valeur en
* base
- * @see TopiaGeneratorUtil#hasUseEnumerationNameTagValue(ObjectModelClassifier,ObjectModelAttribute,ObjectModel)
+ *
+ * @see TopiaGeneratorUtil#hasUseEnumerationNameTagValue(ObjectModelClassifier, ObjectModelAttribute, ObjectModel)
* @since 3.0
*/
@TagValueDefinition(target = {ObjectModel.class, ObjectModelClassifier.class, ObjectModelAttribute.class},
- documentation = "'true' if the value of this attribute of type Enumeration should be stored with its name (instead of using ordinal)")
+ documentation = "'true' if the value of this attribute of type Enumeration should be stored with its name (instead of using ordinal)")
String TAG_USE_ENUMERATION_NAME = "useEnumerationName";
/**
@@ -217,7 +217,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModel.class, ObjectModelClassifier.class},
- documentation = "Configure the proxy interface on something else than the default implementation (null to use our default implementation, none to let hibernate deal it) (Hibernate mapping)")
+ documentation = "Configure the proxy interface on something else than the default implementation (null to use our default implementation, none to let hibernate deal it) (Hibernate mapping)")
String TAG_PROXY_INTERFACE = "hibernateProxyInterface";
/**
@@ -232,7 +232,7 @@
* @since 3.0
*/
@TagValueDefinition(target = {ObjectModel.class, ObjectModelClassifier.class},
- documentation = "Configure the proxy interface on something else than the default implementation (null to use our default implementation, none to let hibernate deal it) (Hibernate mapping)")
+ documentation = "Configure the proxy interface on something else than the default implementation (null to use our default implementation, none to let hibernate deal it) (Hibernate mapping)")
String TAG_INHERITANCE_STRATEGY = "inheritanceStrategy";
/**
@@ -243,7 +243,8 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModel.class, ObjectModelClassifier.class},
- documentation = "To not generate the toString method on entities")
+ defaultValue = "true",
+ documentation = "To not generate the toString method on entities")
String TAG_NOT_GENERATE_TO_STRING = "notGenerateToString";
/**
@@ -254,7 +255,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModel.class, ObjectModelClassifier.class},
- documentation = "To sort attribute while generation")
+ documentation = "To sort attribute while generation")
String TAG_SORT_ATTRIBUTE = "sortAttribute";
/**
@@ -265,7 +266,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModel.class},
- documentation = "To generate EntityOperation on generated DAOHelper")
+ documentation = "To generate EntityOperation on generated DAOHelper")
String TAG_GENERATE_OPERATOR_FOR_DAO_HELPER = "generateOperatorForDAOHelper";
/**
@@ -278,7 +279,7 @@
*/
@Deprecated
@TagValueDefinition(target = {ObjectModelAttribute.class},
- documentation = "Sets the hibernate type of an attribute (Hibernate mapping)")
+ documentation = "Sets the hibernate type of an attribute (Hibernate mapping)")
String TAG_TYPE = "type";
/**
@@ -288,7 +289,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModelAttribute.class},
- documentation = "Sets the sql type of an attribute (Hibernate mapping)")
+ documentation = "Sets the sql type of an attribute (Hibernate mapping)")
String TAG_SQL_TYPE = "sqlType";
/**
@@ -302,7 +303,7 @@
* @since 2.5
*/
@TagValueDefinition(target = {ObjectModel.class},
- documentation = "Sets the fully qualified name of the DAO implementation to use in generated DAO (default is DAOImpl (base on TopiaQuery))")
+ documentation = "Sets the fully qualified name of the DAO implementation to use in generated DAO (default is DAOImpl (base on TopiaQuery))")
String TAG_DAO_IMPLEMENTATION = "daoImplementation";
/**
@@ -312,7 +313,8 @@
* @since 2.6.5
*/
@TagValueDefinition(target = {ObjectModel.class, ObjectModelAttribute.class},
- documentation = "Specifies if an nm-multiplicity attribute (or all nm-multiplicity attributes of a given model) needs an index in db (Hibernate mapping)")
+ defaultValue = "true",
+ documentation = "Specifies if an nm-multiplicity attribute (or all nm-multiplicity attributes of a given model) needs an index in db (Hibernate mapping)")
String TAG_INDEX_FOREIGN_KEYS = "indexForeignKeys";
/**
@@ -323,9 +325,11 @@
* @see EntityDTOTransformer
* @see TopiaGeneratorUtil#shouldGenerateDTOTopiaIdTagValue(ObjectModelClassifier, ObjectModel)
* @since 2.6.7
+ * @deprecated since 3.0, will be removed at the same time that {@link EntityDTOTransformer}.
*/
+ @Deprecated
@TagValueDefinition(target = {ObjectModel.class, ObjectModelClassifier.class},
- documentation = "Add a \"id\" property with its getter/setter on a DTO.")
+ documentation = "Add a \"id\" property with its getter/setter on a DTO.")
String TAG_GENERATE_TOPIA_ID_IN_DTO = "generateDTOTopiaId";
@@ -341,7 +345,7 @@
* @since 3.0
*/
@TagValueDefinition(target = {ObjectModel.class},
- documentation = "Change the super class to use when generating PersistenceContext.")
+ documentation = "Change the super class to use when generating PersistenceContext.")
String TAG_PERSISTENCE_CONTEXT_SUPER_CLASS = "persistenceContextSuperClass";
/**
@@ -356,7 +360,7 @@
* @since 3.0
*/
@TagValueDefinition(target = {ObjectModel.class},
- documentation = "Change the super class to use when generating ApplicationContext.")
+ documentation = "Change the super class to use when generating ApplicationContext.")
String TAG_APPLICATION_CONTEXT_SUPER_CLASS = "applicationContextSuperClass";
/**
@@ -369,7 +373,7 @@
* @since 3.0
*/
@TagValueDefinition(target = {ObjectModelClassifier.class, ObjectModel.class},
- documentation = "Change the super class to use when generating dao.")
+ documentation = "Change the super class to use when generating dao.")
String TAG_DAO_SUPER_CLASS = "daoSuperClass";
/**
@@ -382,24 +386,24 @@
* @since 3.0
*/
@TagValueDefinition(target = {ObjectModelClassifier.class, ObjectModel.class},
- documentation = "Change the super class to use when generating Entity.")
+ documentation = "Change the super class to use when generating Entity.")
String TAG_ENTITY_SUPER_CLASS = "entitySuperClass";
/**
* Tag to change the type of an attribute in a hibernate mapping.
- *
+ * <p/>
* This is a special tagValue that is dynamic.
- *
+ * <p/>
* For example to change the type {@code String} into hibernate mapping type {@code text}, add this:
* <pre>
* model.tagValue.hibernateAttributeType.String=text
* </pre>
- *
+ * <p/>
* Before 3.0, you could do the same thing using:
* <pre>
* model.tagValue.String=text
* </pre>
- *
+ * <p/>
* The new way permits us to validate the usage of the tagValue, old way can't.
*
* @see TopiaGeneratorUtil#getHibernateAttributeType(ObjectModelAttribute, ObjectModelClassifier, ObjectModel)
@@ -407,7 +411,7 @@
*/
@TagValueDefinition(target = {ObjectModelAttribute.class, ObjectModelClassifier.class, ObjectModel.class},
documentation = "Change the super class to use when generating Entity.",
- validatorClass = PrefixTagNameMatchTagValueMatcher.class)
+ matcherClass = PrefixTagNameMatchTagValueMatcher.class)
String TAG_HIBERNATE_ATTRIBUTE_TYPE = "hibernateAttributeType";
}
1
0
r3083 - trunk/topia-templates/src/main/java/org/nuiton/topia/templates
by tchemit@users.nuiton.org 26 Apr '14
by tchemit@users.nuiton.org 26 Apr '14
26 Apr '14
Author: tchemit
Date: 2014-04-26 20:57:31 +0200 (Sat, 26 Apr 2014)
New Revision: 3083
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3083
Log:
refs-80 #3177
Modified:
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaModelPropertiesProvider.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaModelPropertiesProvider.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaModelPropertiesProvider.java 2014-04-26 17:39:39 UTC (rev 3082)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaModelPropertiesProvider.java 2014-04-26 18:57:31 UTC (rev 3083)
@@ -12,7 +12,7 @@
public class TopiaModelPropertiesProvider extends ModelPropertiesProvider {
@Override
- public void init() throws IllegalAccessException {
+ public void initStores() throws IllegalAccessException {
scanStereotypeClass(TopiaStereoTypes.class);
scanTagValueClass(TopiaTagValues.class);
}
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java 2014-04-26 17:39:39 UTC (rev 3082)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java 2014-04-26 18:57:31 UTC (rev 3083)
@@ -25,6 +25,7 @@
*/
import org.nuiton.eugene.EugeneTagValues;
+import org.nuiton.eugene.metas.matcher.PrefixTagNameMatchTagValueMatcher;
import org.nuiton.eugene.models.object.ObjectModel;
import org.nuiton.eugene.models.object.ObjectModelAttribute;
import org.nuiton.eugene.models.object.ObjectModelClass;
@@ -405,7 +406,8 @@
* @since 3.0
*/
@TagValueDefinition(target = {ObjectModelAttribute.class, ObjectModelClassifier.class, ObjectModel.class},
- documentation = "Change the super class to use when generating Entity.")
+ documentation = "Change the super class to use when generating Entity.",
+ validatorClass = PrefixTagNameMatchTagValueMatcher.class)
String TAG_HIBERNATE_ATTRIBUTE_TYPE = "hibernateAttributeType";
}
1
0
r3082 - in trunk: . topia-templates/src/main/java/org/nuiton/topia/templates topia-templates/src/main/resources/META-INF/services topia-templates/src/test/java/org/nuiton/topia/templates
by tchemit@users.nuiton.org 26 Apr '14
by tchemit@users.nuiton.org 26 Apr '14
26 Apr '14
Author: tchemit
Date: 2014-04-26 19:39:39 +0200 (Sat, 26 Apr 2014)
New Revision: 3082
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3082
Log:
fixes 3177: Use eugene 2.9 new Stereotype and TagValue API
fixes #3178: Improve tagValue to change hibernate mapping type for attributes
Added:
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaModelPropertiesProvider.java
trunk/topia-templates/src/main/resources/META-INF/services/org.nuiton.eugene.metas.ModelPropertiesProvider
Removed:
trunk/topia-templates/src/main/resources/META-INF/services/org.nuiton.eugene.ModelPropertiesUtil$ModelPropertiesProvider
Modified:
trunk/pom.xml
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/BinderHelperTransformer.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/DAOHelperTransformer.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/DTOTransformer.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityDTOTransformer.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityDaoTransformer.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityHibernateMappingGenerator.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityTransformer.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaGeneratorUtil.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaStereoTypes.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java
trunk/topia-templates/src/test/java/org/nuiton/topia/templates/TopiaModelPropertiesProviderTest.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-04-25 13:31:15 UTC (rev 3081)
+++ trunk/pom.xml 2014-04-26 17:39:39 UTC (rev 3082)
@@ -237,7 +237,7 @@
<relativizeDecorationLinks>false</relativizeDecorationLinks>
<!-- libs version -->
- <eugeneVersion>2.8</eugeneVersion>
+ <eugeneVersion>2.9-SNAPSHOT</eugeneVersion>
<nuitonUtilsVersion>3.0-rc-2</nuitonUtilsVersion>
<nuitonCsvVersion>3.0-rc-1</nuitonCsvVersion>
<nuitonDecoratorVersion>3.0-alpha-3</nuitonDecoratorVersion>
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/BinderHelperTransformer.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/BinderHelperTransformer.java 2014-04-25 13:31:15 UTC (rev 3081)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/BinderHelperTransformer.java 2014-04-26 17:39:39 UTC (rev 3082)
@@ -71,7 +71,7 @@
return;
}
- String packageName = getOutputProperties().getProperty(PROP_DEFAULT_PACKAGE);
+ String packageName = getDefaultPackageName();
String modelName = model.getName();
String binderHelperClazzName = modelName + "BinderHelper";
String daoHelperClazzName = modelName + "DAOHelper";
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/DAOHelperTransformer.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/DAOHelperTransformer.java 2014-04-25 13:31:15 UTC (rev 3081)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/DAOHelperTransformer.java 2014-04-26 17:39:39 UTC (rev 3082)
@@ -68,8 +68,7 @@
@Override
public void transformFromModel(ObjectModel model) {
- String packageName =
- getOutputProperties().getProperty(PROP_DEFAULT_PACKAGE);
+ String packageName = getDefaultPackageName();
String modelName = model.getName();
String daoHelperClazzName = modelName + "DAOHelper";
String entityEnumName = modelName + "EntityEnum";
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/DTOTransformer.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/DTOTransformer.java 2014-04-25 13:31:15 UTC (rev 3081)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/DTOTransformer.java 2014-04-26 17:39:39 UTC (rev 3082)
@@ -31,6 +31,7 @@
import org.nuiton.eugene.GeneratorUtil;
import org.nuiton.eugene.java.JavaGeneratorUtil;
import org.nuiton.eugene.java.ObjectModelTransformerToJava;
+import org.nuiton.eugene.metas.TagValues;
import org.nuiton.eugene.models.object.*;
import java.beans.PropertyChangeListener;
@@ -96,7 +97,8 @@
protected void addAttributes(ObjectModelClass result, ObjectModelClass clazz) {
- String svUID = TopiaGeneratorUtil.findTagValue("dto-serialVersionUID", clazz, model);
+// String svUID = TopiaGeneratorUtil.findTagValue("dto-serialVersionUID", clazz, model);
+ String svUID = TagValues.findTagValue("dto-serialVersionUID", clazz, model);
if (StringUtils.isNotEmpty(svUID)) {
addAttribute(result, "serialVersionUID", long.class, svUID, ObjectModelJavaModifier.FINAL, ObjectModelJavaModifier.PUBLIC, ObjectModelJavaModifier.STATIC);
}
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityDTOTransformer.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityDTOTransformer.java 2014-04-25 13:31:15 UTC (rev 3081)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityDTOTransformer.java 2014-04-26 17:39:39 UTC (rev 3082)
@@ -28,6 +28,7 @@
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.nuiton.eugene.GeneratorUtil;
import org.nuiton.eugene.java.ObjectModelTransformerToJava;
+import org.nuiton.eugene.metas.TagValues;
import org.nuiton.eugene.models.object.ObjectModelAssociationClass;
import org.nuiton.eugene.models.object.ObjectModelAttribute;
import org.nuiton.eugene.models.object.ObjectModelClass;
@@ -97,7 +98,8 @@
protected void addAttributes(ObjectModelClass result, ObjectModelClass clazz) {
- String svUID = TopiaGeneratorUtil.findTagValue("dto-serialVersionUID", clazz, model);
+// String svUID = TopiaGeneratorUtil.findTagValue("dto-serialVersionUID", clazz, model);
+ String svUID = TagValues.findTagValue("dto-serialVersionUID", clazz, model);
if (svUID != null) {
addAttribute(result, "serialVersionUID", "long", svUID, ObjectModelJavaModifier.FINAL, ObjectModelJavaModifier.PUBLIC, ObjectModelJavaModifier.STATIC);
}
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityDaoTransformer.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityDaoTransformer.java 2014-04-25 13:31:15 UTC (rev 3081)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityDaoTransformer.java 2014-04-26 17:39:39 UTC (rev 3082)
@@ -108,8 +108,7 @@
entityEnumName = modelName + "EntityEnum";
- String packageName =
- getOutputProperties().getProperty(PROP_DEFAULT_PACKAGE);
+ String packageName = getDefaultPackageName();
entityEnumPackage = packageName + "." + entityEnumName;
@@ -489,8 +488,7 @@
StringBuilder body = new StringBuilder();
String modelName = StringUtils.capitalize(model.getName());
- String providerFQN = getOutputProperties().getProperty(
- PROP_DEFAULT_PACKAGE) + '.' + modelName +
+ String providerFQN = getDefaultPackageName() + '.' + modelName +
"DAOHelper.getImplementationClass";
body.append(""
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityHibernateMappingGenerator.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityHibernateMappingGenerator.java 2014-04-25 13:31:15 UTC (rev 3081)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityHibernateMappingGenerator.java 2014-04-26 17:39:39 UTC (rev 3082)
@@ -283,9 +283,9 @@
if (!TopiaGeneratorUtil.isNMultiplicity(attr)) {
if (attr.getClassifier() != null && TopiaGeneratorUtil.isEntity(attr.getClassifier())) {
if (TopiaGeneratorUtil.isNMultiplicity(attr.getReverseMaxMultiplicity()) && !attr.hasAssociationClass()) {
- generateHibernateManyToOne(output, attr, prefix);
+ generateHibernateManyToOne(output, clazz,attr, prefix);
} else {
- generateHibernateOneToOne(output, attr, prefix);
+ generateHibernateOneToOne(output, clazz,attr, prefix);
}
} else {
generateHibernateProperty(output, clazz, attr, prefix);
@@ -293,9 +293,9 @@
} else {
if (attr.getClassifier() != null && TopiaGeneratorUtil.isEntity(attr.getClassifier())) {
if (TopiaGeneratorUtil.isNMultiplicity(attr.getReverseMaxMultiplicity()) && !attr.hasAssociationClass()) {
- generateHibernateManyToMany(output, attr, prefix);
+ generateHibernateManyToMany(output, clazz,attr, prefix);
} else {
- generateHibernateOneToMany(output, attr, prefix);
+ generateHibernateOneToMany(output, clazz,attr, prefix);
}
} else {
generateHibernateMany(output, clazz, attr, prefix);
@@ -319,7 +319,7 @@
// String notNull = " " + generateFromTagValue(HIBERNATE_ATTRIBUTE_NOT_NULL, TopiaGeneratorUtil.getNotNullTagValue(attr));
String notNull = " " + generateFromTagValue(HIBERNATE_ATTRIBUTE_NOT_NULL, "true"); // AThimel 14/03/2014 I think both assoc class participants must always be not-null
String attrName = getName(attr, true);
- String attrType = getType(attr, true);
+ String attrType = getType(clazz, attr, true);
String lazy = generateFromTagValue(HIBERNATE_ATTRIBUTE_LAZY, TopiaGeneratorUtil.getLazyTagValue(attr));
String attrColumn = TopiaGeneratorUtil.getDbName(attr);
/*{<%=prefix%> <many-to-one name="<%=attrName%>" class="<%=attrType%>" <%=lazy%>column="<%=attrColumn%>" node="<%=attrName%>/@topiaId" <%=notNull%>/>
@@ -355,44 +355,74 @@
return result;
}
- protected String getType(ObjectModelAttribute attr) {
- return getType(attr, false);
+ protected String getType(ObjectModelClass clazz, ObjectModelAttribute attr) {
+ return getType(clazz, attr, false);
}
- protected String getType(ObjectModelAttribute attr, boolean isAssoc) {
+ protected String getType(ObjectModelClass clazz, ObjectModelAttribute attr, boolean isAssoc) {
+ if (attr.hasAssociationClass() && !isAssoc) {
+ String type = attr.getAssociationClass().getQualifiedName();
+ return TopiaGeneratorUtil.getDOType(type, model);
+ }
+
String type = attr.getType();
- String attrType = TopiaGeneratorUtil.getTypeTagValue(attr);
+ String attrType = TopiaGeneratorUtil.getHibernateAttributeType(attr, clazz, model);
if (StringUtils.isNotEmpty(attrType)) {
-
// tag value detected of the attribute
type = attrType;
} else {
- String modelType = model.getTagValue(type);
- if (StringUtils.isNotEmpty(modelType)) {
+ // old code
+ attrType = TopiaGeneratorUtil.getTypeTagValue(attr);
+ if (StringUtils.isNotEmpty(attrType)) {
- // tag value detected of the model
+ // tag value detected of the attribute
+ if (log.isWarnEnabled()) {
+ String deprecatedTagName = clazz.getQualifiedName() + ".attribute." +
+ attr.getName() + ".tagValue." + TopiaTagValues.TAG_HIBERNATE_ATTRIBUTE_TYPE +
+ "." + type;
+ String tagName = clazz.getQualifiedName() + ".attribute." +
+ attr.getName() + ".tagValue." + TopiaTagValues.TAG_HIBERNATE_ATTRIBUTE_TYPE +
+ "." + type;
+ log.warn("---------");
+ log.warn("You are using a deprecated tagValue (" + deprecatedTagName + "), replace it by");
+ log.warn(tagName + "=" + attrType);
+ }
+ type = attrType;
+ } else {
- //TODO tchemit 20100507 Explain What todes it do ? Dont understand the story of columnNamesMap
- int bracketIndex = modelType.indexOf('(');
- if (bracketIndex != -1) {
- type = modelType.substring(0, bracketIndex);
- int bracketEndIndex = modelType.indexOf(')', bracketIndex + 1);
- String colmunList;
- if (bracketEndIndex != -1) {
- colmunList = modelType.substring(bracketIndex + 1, bracketEndIndex);
+ String modelType = model.getTagValue(type);
+ if (StringUtils.isNotEmpty(modelType)) {
+
+ // tag value detected of the model
+ String deprecatedTagName = "model.tagValue." + type;
+ String tagName = "model.tagValue." + TopiaTagValues.TAG_HIBERNATE_ATTRIBUTE_TYPE +
+ "." + type;
+ log.warn("---------");
+ log.warn("You are using a deprecated tagValue ("+deprecatedTagName+"), replace it by");
+ log.warn(tagName + "=" + modelType);
+ //TODO tchemit 20100507 Explain What todes it do ? Dont understand the story of columnNamesMap
+ int bracketIndex = modelType.indexOf('(');
+ if (bracketIndex != -1) {
+ type = modelType.substring(0, bracketIndex);
+ int bracketEndIndex = modelType.indexOf(')', bracketIndex + 1);
+ String colmunList;
+ if (bracketEndIndex != -1) {
+ colmunList = modelType.substring(bracketIndex + 1, bracketEndIndex);
+ } else {
+ colmunList = modelType.substring(bracketIndex);
+ }
+ columnNamesMap.put(type, colmunList.split(","));
} else {
- colmunList = modelType.substring(bracketIndex);
+ type = modelType;
}
- columnNamesMap.put(type, colmunList.split(","));
- } else {
- type = modelType;
}
}
}
- if (attr.hasAssociationClass() && !isAssoc) {
- type = attr.getAssociationClass().getQualifiedName();
- }
+
+// if (attr.hasAssociationClass() && !isAssoc) {
+// type = attr.getAssociationClass().getQualifiedName();
+// }
return TopiaGeneratorUtil.getDOType(type, model);
}
@@ -400,7 +430,7 @@
ObjectModelClass clazz,
ObjectModelAttribute attr,
String prefix) throws IOException {
- String attrType = getType(attr);
+ String attrType = getType(clazz, attr);
String accessField = "field";
String tagValue = TopiaGeneratorUtil.getAccessTagValue(attr);
@@ -556,6 +586,7 @@
}
protected void generateHibernateOneToOne(Writer output,
+ ObjectModelClass clazz,
ObjectModelAttribute attr,
String prefix) throws IOException {
// boolean accessField = hasUnidirectionalRelationOnAbstractType(attr.getReverseAttribute(), model);
@@ -566,11 +597,12 @@
// but if it is one-to-zero-or-one unique contraints is violated
// with null values
boolean unique = TopiaGeneratorUtil.isOneMultiplicity(attr);
- generateHibernateManyToOne(output, attr, unique, prefix);
+ generateHibernateManyToOne(output, clazz, attr, unique, prefix);
}
protected void generateHibernateOneToMany(Writer output,
+ ObjectModelClass clazz,
ObjectModelAttribute attr,
String prefix) throws IOException {
boolean needsIndex = JavaGeneratorUtil.isOrdered(attr);
@@ -578,7 +610,7 @@
isInverse |= hasUnidirectionalRelationOnAbstractType(attr, model);
String attrName = getName(attr); // ???
- String attrType = getType(attr);
+ String attrType = getType(clazz, attr);
String reverseAttrDBName = TopiaGeneratorUtil.getReverseDbName(attr);
String orderBy = generateFromTagValue(HIBERNATE_ATTRIBUTE_ORDER_BY, TopiaGeneratorUtil.getOrderByTagValue(attr));
@@ -644,7 +676,7 @@
String prefix) throws IOException {
boolean needsIndex = JavaGeneratorUtil.isOrdered(attr);
String attrName = getName(attr);
- String attrType = getType(attr);
+ String attrType = getType(clazz, attr);
String collType = TopiaGeneratorUtil.getNMultiplicityHibernateType(attr);
String lazy = generateFromTagValue(HIBERNATE_ATTRIBUTE_LAZY, TopiaGeneratorUtil.getLazyTagValue(attr));
String attrColumn = TopiaGeneratorUtil.getDbName(attr);
@@ -685,17 +717,19 @@
}
protected void generateHibernateManyToOne(Writer output,
+ ObjectModelClass clazz,
ObjectModelAttribute attr,
String prefix) throws IOException {
- generateHibernateManyToOne(output, attr, false, prefix);
+ generateHibernateManyToOne(output, clazz, attr, false, prefix);
}
protected void generateHibernateManyToOne(Writer output,
+ ObjectModelClass clazz,
ObjectModelAttribute attr,
boolean isUnique,
String prefix) throws IOException {
String attrName = getName(attr);
- String attrType = getType(attr);
+ String attrType = getType(clazz, attr);
String attrColumn = TopiaGeneratorUtil.getDbName(attr);
/*{<%=prefix%> <many-to-one name="<%=attrName%>" class="<%=attrType%>" column="<%=attrColumn%>" }*/
if (attr.isComposite() || attr.hasAssociationClass()) {
@@ -722,6 +756,7 @@
}
protected void generateHibernateManyToMany(Writer output,
+ ObjectModelClass clazz,
ObjectModelAttribute attr,
String prefix) throws IOException {
// On ne met le inverse="true" uniquement pour un seul coté de la relation.
@@ -751,7 +786,7 @@
cascade = " cascade=\"delete,delete-orphan\"";
}
- String attrType = getType(attr);
+ String attrType = getType(clazz, attr);
String attrName = getName(attr);
String attrColumn = TopiaGeneratorUtil.getDbName(attr);
String lazy = generateFromTagValue(HIBERNATE_ATTRIBUTE_LAZY, TopiaGeneratorUtil.getLazyTagValue(attr), "true");
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityTransformer.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityTransformer.java 2014-04-25 13:31:15 UTC (rev 3081)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityTransformer.java 2014-04-26 17:39:39 UTC (rev 3082)
@@ -31,6 +31,7 @@
import org.nuiton.eugene.EugeneTagValues;
import org.nuiton.eugene.java.JavaGeneratorUtil;
import org.nuiton.eugene.java.ObjectModelTransformerToJava;
+import org.nuiton.eugene.metas.TagValues;
import org.nuiton.eugene.models.object.ObjectModelAssociationClass;
import org.nuiton.eugene.models.object.ObjectModelAttribute;
import org.nuiton.eugene.models.object.ObjectModelClass;
@@ -210,10 +211,8 @@
ObjectModelClass ouput) {
// serialVersionUID
- String svUID = TopiaGeneratorUtil.findTagValue(TopiaGeneratorUtil.SERIAL_VERSION_UID,
- input,
- model
- );
+// String svUID = TopiaGeneratorUtil.findTagValue(TopiaGeneratorUtil.SERIAL_VERSION_UID, input, model);
+ String svUID = TagValues.findTagValue(TopiaGeneratorUtil.SERIAL_VERSION_UID, input, model);
if (svUID == null) {
// use a default one
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaGeneratorUtil.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaGeneratorUtil.java 2014-04-25 13:31:15 UTC (rev 3081)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaGeneratorUtil.java 2014-04-26 17:39:39 UTC (rev 3082)
@@ -31,9 +31,9 @@
import org.apache.commons.logging.LogFactory;
import org.nuiton.eugene.AbstractGenerator;
import org.nuiton.eugene.GeneratorUtil;
-import org.nuiton.eugene.ModelPropertiesUtil;
import org.nuiton.eugene.java.JavaGeneratorUtil;
import org.nuiton.eugene.java.ObjectModelTransformerToJava;
+import org.nuiton.eugene.metas.TagValues;
import org.nuiton.eugene.models.object.ObjectModel;
import org.nuiton.eugene.models.object.ObjectModelAssociationClass;
import org.nuiton.eugene.models.object.ObjectModelAttribute;
@@ -101,22 +101,6 @@
public static final String DEFAULT_INHERITANCE_STRATEGY = "union-subclass";
/**
- * The Eugene provider of tag values and stereotypes.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @plexus.component role="org.nuiton.eugene.ModelPropertiesUtil$ModelPropertiesProvider" role-hint="topia"
- * @since 2.3
- */
- public static class TopiaModelPropertiesProvider extends ModelPropertiesUtil.ModelPropertiesProvider {
-
- @Override
- public void init() throws IllegalAccessException {
- scanStereotypeClass(TopiaStereoTypes.class);
- scanTagValueClass(TopiaTagValues.class);
- }
- }
-
- /**
* Renvoie le package par défaut pour le générateur donné
*
* @param generator le générateur donné
@@ -1238,7 +1222,8 @@
* @since 2.5
*/
public static String getPersistenceTypeTagValue(ObjectModelClassifier classifier) {
- String value = findTagValue(TopiaTagValues.TAG_PERSISTENCE_TYPE, classifier, null);
+// String value = findTagValue(TopiaTagValues.TAG_PERSISTENCE_TYPE, classifier, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_PERSISTENCE_TYPE, classifier);
return value;
}
@@ -1252,7 +1237,8 @@
* @since 3.0
*/
public static String getInheritanceStrategyTagValue(ObjectModelClassifier classifier) {
- String value = findTagValue(TopiaTagValues.TAG_INHERITANCE_STRATEGY, classifier, null);
+// String value = findTagValue(TopiaTagValues.TAG_INHERITANCE_STRATEGY, classifier, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_INHERITANCE_STRATEGY, classifier);
if (value == null) {
value = DEFAULT_INHERITANCE_STRATEGY;
}
@@ -1269,7 +1255,8 @@
* @since 2.5
*/
public static String getDbNameTagValue(ObjectModelElement element) {
- String value = findTagValue(TopiaTagValues.TAG_DB_NAME, element, null);
+// String value = findTagValue(TopiaTagValues.TAG_DB_NAME, element, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_DB_NAME, element);
return value;
}
@@ -1284,7 +1271,8 @@
* @since 2.5
*/
public static String getDbSchemaNameTagValue(ObjectModelClassifier classifier, ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_SCHEMA_NAME, classifier, model);
+// String value = findTagValue(TopiaTagValues.TAG_SCHEMA_NAME, classifier, model);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_SCHEMA_NAME, classifier, model);
return value;
}
@@ -1299,7 +1287,8 @@
* @since 2.5
*/
public static String getDbSchemaNameTagValue(ObjectModelAttribute attribute, ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_SCHEMA_NAME, attribute, model);
+// String value = findTagValue(TopiaTagValues.TAG_SCHEMA_NAME, attribute, model);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_SCHEMA_NAME, attribute, model);
return value;
}
@@ -1313,7 +1302,8 @@
* @since 2.5
*/
public static String getLengthTagValue(ObjectModelAttribute attribute) {
- String value = findTagValue(TopiaTagValues.TAG_LENGTH, attribute, null);
+// String value = findTagValue(TopiaTagValues.TAG_LENGTH, attribute, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_LENGTH, attribute);
return value;
}
@@ -1327,7 +1317,8 @@
* @since 2.5
*/
public static String getAnnotationTagValue(ObjectModelAttribute attribute) {
- String value = findTagValue(TopiaTagValues.TAG_ANNOTATION, attribute, null);
+// String value = findTagValue(TopiaTagValues.TAG_ANNOTATION, attribute, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_ANNOTATION, attribute);
return value;
}
@@ -1341,7 +1332,8 @@
* @since 2.5
*/
public static String getAccessTagValue(ObjectModelAttribute attribute) {
- String value = findTagValue(TopiaTagValues.TAG_ACCESS, attribute, null);
+// String value = findTagValue(TopiaTagValues.TAG_ACCESS, attribute, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_ACCESS, attribute);
return value;
}
@@ -1355,7 +1347,8 @@
* @since 2.5
*/
public static String getNaturalIdTagValue(ObjectModelAttribute attribute) {
- String value = findTagValue(TopiaTagValues.TAG_NATURAL_ID, attribute, null);
+// String value = findTagValue(TopiaTagValues.TAG_NATURAL_ID, attribute, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_NATURAL_ID, attribute);
return value;
}
@@ -1369,7 +1362,8 @@
* @since 2.5
*/
public static String getNaturalIdMutableTagValue(ObjectModelClassifier classifier) {
- String value = findTagValue(TopiaTagValues.TAG_NATURAL_ID_MUTABLE, classifier, null);
+// String value = findTagValue(TopiaTagValues.TAG_NATURAL_ID_MUTABLE, classifier, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_NATURAL_ID_MUTABLE, classifier);
return value;
}
@@ -1383,7 +1377,8 @@
* @since 2.5
*/
public static String getInverseTagValue(ObjectModelAttribute attribute) {
- String value = findTagValue(TopiaTagValues.TAG_INVERSE, attribute, null);
+// String value = findTagValue(TopiaTagValues.TAG_INVERSE, attribute, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_INVERSE, attribute);
return value;
}
@@ -1397,7 +1392,8 @@
* @since 2.5
*/
public static String getLazyTagValue(ObjectModelAttribute attribute) {
- String value = findTagValue(TopiaTagValues.TAG_LAZY, attribute, null);
+// String value = findTagValue(TopiaTagValues.TAG_LAZY, attribute, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_LAZY, attribute);
return value;
}
@@ -1411,7 +1407,8 @@
* @since 2.5
*/
public static String getFetchTagValue(ObjectModelAttribute attribute) {
- String value = findTagValue(TopiaTagValues.TAG_FETCH, attribute, null);
+// String value = findTagValue(TopiaTagValues.TAG_FETCH, attribute, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_FETCH, attribute);
return value;
}
@@ -1425,7 +1422,8 @@
* @since 2.5
*/
public static String getOrderByTagValue(ObjectModelAttribute attribute) {
- String value = findTagValue(TopiaTagValues.TAG_ORDER_BY, attribute, null);
+// String value = findTagValue(TopiaTagValues.TAG_ORDER_BY, attribute, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_ORDER_BY, attribute);
return value;
}
@@ -1439,7 +1437,8 @@
* @since 2.5
*/
public static String getNotNullTagValue(ObjectModelAttribute attribute) {
- String value = findTagValue(TopiaTagValues.TAG_NOT_NULL, attribute, null);
+// String value = findTagValue(TopiaTagValues.TAG_NOT_NULL, attribute, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_NOT_NULL, attribute);
return value;
}
@@ -1454,7 +1453,8 @@
* @since 2.5
*/
public static String getProxyInterfaceTagValue(ObjectModelClassifier classifier, ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_PROXY_INTERFACE, classifier, model);
+// String value = findTagValue(TopiaTagValues.TAG_PROXY_INTERFACE, classifier, model);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_PROXY_INTERFACE, classifier, model);
return value;
}
@@ -1469,7 +1469,8 @@
* @since 2.5
*/
public static String getNotGenerateToStringTagValue(ObjectModelClassifier clazz, ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_NOT_GENERATE_TO_STRING, clazz, model);
+// String value = findTagValue(TopiaTagValues.TAG_NOT_GENERATE_TO_STRING, clazz, model);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_NOT_GENERATE_TO_STRING, clazz, model);
return value;
}
@@ -1484,7 +1485,8 @@
* @since 2.5
*/
public static String getSortAttributeTagValue(ObjectModelClassifier classifier, ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_SORT_ATTRIBUTE, classifier, model);
+// String value = findTagValue(TopiaTagValues.TAG_SORT_ATTRIBUTE, classifier, model);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_SORT_ATTRIBUTE, classifier, model);
return value;
}
@@ -1497,7 +1499,8 @@
* @since 2.5
*/
public static String getGenerateOperatorForDAOHelperTagValue(ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_GENERATE_OPERATOR_FOR_DAO_HELPER, null, model);
+// String value = findTagValue(TopiaTagValues.TAG_GENERATE_OPERATOR_FOR_DAO_HELPER, null, model);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_GENERATE_OPERATOR_FOR_DAO_HELPER, model);
return value;
}
@@ -1509,12 +1512,21 @@
* @return the none empty value of the found tag value or {@code null} if not found nor empty.
* @see TopiaTagValues#TAG_TYPE
* @since 2.5
+ * @deprecated since 3.0, use now {@link #getHibernateAttributeType(ObjectModelAttribute, ObjectModelClassifier, ObjectModel)}
*/
+ @Deprecated
public static String getTypeTagValue(ObjectModelAttribute attribute) {
- String value = findTagValue(TopiaTagValues.TAG_TYPE, attribute, null);
+// String value = findTagValue(TopiaTagValues.TAG_TYPE, attribute, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_TYPE, attribute);
return value;
}
+ public static String getHibernateAttributeType(ObjectModelAttribute attribute, ObjectModelClassifier classifier, ObjectModel model) {
+ String tagValueName = TopiaTagValues.TAG_HIBERNATE_ATTRIBUTE_TYPE + "." + attribute.getType();
+ String value = TagValues.findTagValue(tagValueName, attribute, classifier, model);
+ return value;
+ }
+
/**
* Obtain the value of the {@link TopiaTagValues#TAG_SQL_TYPE}
* tag value on the given attribute.
@@ -1525,7 +1537,8 @@
* @since 2.5
*/
public static String getSqlTypeTagValue(ObjectModelAttribute attribute) {
- String value = findTagValue(TopiaTagValues.TAG_SQL_TYPE, attribute, null);
+// String value = findTagValue(TopiaTagValues.TAG_SQL_TYPE, attribute, null);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_SQL_TYPE, attribute);
return value;
}
@@ -1540,7 +1553,8 @@
* @since 2.5
*/
public static String getDaoImplementationTagValue(ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_DAO_IMPLEMENTATION, null, model);
+// String value = findTagValue(TopiaTagValues.TAG_DAO_IMPLEMENTATION, null, model);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_DAO_IMPLEMENTATION, model);
return value;
}
@@ -1556,18 +1570,21 @@
* @since 2.6.5
*/
public static String getIndexForeignKeys(ObjectModelAttribute attribute, ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_INDEX_FOREIGN_KEYS, attribute, model);
+// String value = findTagValue(TopiaTagValues.TAG_INDEX_FOREIGN_KEYS, attribute, model);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_INDEX_FOREIGN_KEYS, attribute, model);
return value;
}
//TODO Javadoc
public static boolean hasUseEnumerationNameTagValue(ObjectModelClassifier classifier, ObjectModelAttribute attr, ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_USE_ENUMERATION_NAME, classifier, model);
- if (value == null) {
- // try on attribute
- value = findTagValue(TopiaTagValues.TAG_USE_ENUMERATION_NAME, attr, null);
- }
- return Boolean.parseBoolean(value);
+// String value = findTagValue(TopiaTagValues.TAG_USE_ENUMERATION_NAME, classifier, model);
+// if (value == null) {
+// // try on attribute
+// value = findTagValue(TopiaTagValues.TAG_USE_ENUMERATION_NAME, attr);
+// }
+// return Boolean.parseBoolean(value);
+ boolean value = TagValues.findBooleanTagValue(TopiaTagValues.TAG_USE_ENUMERATION_NAME, attr, classifier, model);
+ return value;
}
/**
@@ -1581,9 +1598,11 @@
* @since 2.6.7
*/
public static boolean shouldGenerateDTOTopiaIdTagValue(ObjectModelClassifier classifier, ObjectModel model) {
- String tagValue = findTagValue(TopiaTagValues.TAG_GENERATE_TOPIA_ID_IN_DTO, classifier, model);
- boolean generate = StringUtils.isNotEmpty(tagValue) && Boolean.valueOf(tagValue);
- return generate;
+// String tagValue = findTagValue(TopiaTagValues.TAG_GENERATE_TOPIA_ID_IN_DTO, classifier, model);
+// boolean generate = StringUtils.isNotEmpty(tagValue) && Boolean.valueOf(tagValue);
+// return generate;
+ boolean value = TagValues.findBooleanTagValue(TopiaTagValues.TAG_GENERATE_TOPIA_ID_IN_DTO, classifier, model);
+ return value;
}
/**
@@ -1596,7 +1615,8 @@
* @since 3.0
*/
public static String getPersistenceContextSuperClassTagValue(ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_PERSISTENCE_CONTEXT_SUPER_CLASS, null, model);
+// String value = findTagValue(TopiaTagValues.TAG_PERSISTENCE_CONTEXT_SUPER_CLASS, null, model);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_PERSISTENCE_CONTEXT_SUPER_CLASS, model);
return value;
}
@@ -1610,7 +1630,8 @@
* @since 3.0
*/
public static String getApplicationContextSuperClassTagValue(ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_APPLICATION_CONTEXT_SUPER_CLASS, null, model);
+// String value = findTagValue(TopiaTagValues.TAG_APPLICATION_CONTEXT_SUPER_CLASS, null, model);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_APPLICATION_CONTEXT_SUPER_CLASS, model);
return value;
}
@@ -1624,7 +1645,8 @@
* @since 3.0
*/
public static String getDaoSuperClassTagValue(ObjectModelClassifier classifier, ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_DAO_SUPER_CLASS, classifier, model);
+// String value = findTagValue(TopiaTagValues.TAG_DAO_SUPER_CLASS, classifier, model);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_DAO_SUPER_CLASS, classifier, model);
return value;
}
@@ -1638,7 +1660,8 @@
* @since 3.0
*/
public static String getEntitySuperClassTagValue(ObjectModelClassifier classifier, ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_ENTITY_SUPER_CLASS, classifier, model);
+// String value = findTagValue(TopiaTagValues.TAG_ENTITY_SUPER_CLASS, classifier, model);
+ String value = TagValues.findTagValue(TopiaTagValues.TAG_ENTITY_SUPER_CLASS, classifier, model);
return value;
}
Added: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaModelPropertiesProvider.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaModelPropertiesProvider.java (rev 0)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaModelPropertiesProvider.java 2014-04-26 17:39:39 UTC (rev 3082)
@@ -0,0 +1,19 @@
+package org.nuiton.topia.templates;
+
+import org.nuiton.eugene.metas.ModelPropertiesProvider;
+
+/**
+ * The ToPIA provider of tag values and stereotypes.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @plexus.component role="org.nuiton.eugene.metas.ModelPropertiesProvider" role-hint="topia"
+ * @since 2.3
+ */
+public class TopiaModelPropertiesProvider extends ModelPropertiesProvider {
+
+ @Override
+ public void init() throws IllegalAccessException {
+ scanStereotypeClass(TopiaStereoTypes.class);
+ scanTagValueClass(TopiaTagValues.class);
+ }
+}
Property changes on: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaModelPropertiesProvider.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaStereoTypes.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaStereoTypes.java 2014-04-25 13:31:15 UTC (rev 3081)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaStereoTypes.java 2014-04-26 17:39:39 UTC (rev 3082)
@@ -29,7 +29,7 @@
import org.nuiton.eugene.models.object.ObjectModelClassifier;
import org.nuiton.eugene.models.object.ObjectModelOperation;
-import static org.nuiton.eugene.ModelPropertiesUtil.StereotypeDefinition;
+import org.nuiton.eugene.metas.StereotypeDefinition;
/**
* All extra stereotypes usable in topia generators.
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java 2014-04-25 13:31:15 UTC (rev 3081)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java 2014-04-26 17:39:39 UTC (rev 3082)
@@ -33,7 +33,7 @@
import org.nuiton.topia.persistence.TopiaDaoSupplier;
import org.nuiton.topia.persistence.TopiaEntityContextable;
-import static org.nuiton.eugene.ModelPropertiesUtil.TagValueDefinition;
+import org.nuiton.eugene.metas.TagValueDefinition;
/**
* All extra tag values usable in topia generators.
@@ -272,7 +272,10 @@
*
* @see TopiaGeneratorUtil#getTypeTagValue(ObjectModelAttribute)
* @since 2.5
+ * @deprecated since 3.0, use now {@link #TAG_HIBERNATE_ATTRIBUTE_TYPE} which
+ * permits to deal the same thing but at also model and classifier scope.
*/
+ @Deprecated
@TagValueDefinition(target = {ObjectModelAttribute.class},
documentation = "Sets the hibernate type of an attribute (Hibernate mapping)")
String TAG_TYPE = "type";
@@ -380,4 +383,29 @@
@TagValueDefinition(target = {ObjectModelClassifier.class, ObjectModel.class},
documentation = "Change the super class to use when generating Entity.")
String TAG_ENTITY_SUPER_CLASS = "entitySuperClass";
+
+ /**
+ * Tag to change the type of an attribute in a hibernate mapping.
+ *
+ * This is a special tagValue that is dynamic.
+ *
+ * For example to change the type {@code String} into hibernate mapping type {@code text}, add this:
+ * <pre>
+ * model.tagValue.hibernateAttributeType.String=text
+ * </pre>
+ *
+ * Before 3.0, you could do the same thing using:
+ * <pre>
+ * model.tagValue.String=text
+ * </pre>
+ *
+ * The new way permits us to validate the usage of the tagValue, old way can't.
+ *
+ * @see TopiaGeneratorUtil#getHibernateAttributeType(ObjectModelAttribute, ObjectModelClassifier, ObjectModel)
+ * @since 3.0
+ */
+ @TagValueDefinition(target = {ObjectModelAttribute.class, ObjectModelClassifier.class, ObjectModel.class},
+ documentation = "Change the super class to use when generating Entity.")
+ String TAG_HIBERNATE_ATTRIBUTE_TYPE = "hibernateAttributeType";
+
}
Deleted: trunk/topia-templates/src/main/resources/META-INF/services/org.nuiton.eugene.ModelPropertiesUtil$ModelPropertiesProvider
===================================================================
--- trunk/topia-templates/src/main/resources/META-INF/services/org.nuiton.eugene.ModelPropertiesUtil$ModelPropertiesProvider 2014-04-25 13:31:15 UTC (rev 3081)
+++ trunk/topia-templates/src/main/resources/META-INF/services/org.nuiton.eugene.ModelPropertiesUtil$ModelPropertiesProvider 2014-04-26 17:39:39 UTC (rev 3082)
@@ -1 +0,0 @@
-org.nuiton.topia.templates.TopiaGeneratorUtil$TopiaModelPropertiesProvider
\ No newline at end of file
Copied: trunk/topia-templates/src/main/resources/META-INF/services/org.nuiton.eugene.metas.ModelPropertiesProvider (from rev 3080, trunk/topia-templates/src/main/resources/META-INF/services/org.nuiton.eugene.ModelPropertiesUtil$ModelPropertiesProvider)
===================================================================
--- trunk/topia-templates/src/main/resources/META-INF/services/org.nuiton.eugene.metas.ModelPropertiesProvider (rev 0)
+++ trunk/topia-templates/src/main/resources/META-INF/services/org.nuiton.eugene.metas.ModelPropertiesProvider 2014-04-26 17:39:39 UTC (rev 3082)
@@ -0,0 +1 @@
+org.nuiton.topia.templates.TopiaModelPropertiesProvider
\ No newline at end of file
Modified: trunk/topia-templates/src/test/java/org/nuiton/topia/templates/TopiaModelPropertiesProviderTest.java
===================================================================
--- trunk/topia-templates/src/test/java/org/nuiton/topia/templates/TopiaModelPropertiesProviderTest.java 2014-04-25 13:31:15 UTC (rev 3081)
+++ trunk/topia-templates/src/test/java/org/nuiton/topia/templates/TopiaModelPropertiesProviderTest.java 2014-04-26 17:39:39 UTC (rev 3082)
@@ -27,23 +27,23 @@
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.nuiton.eugene.ModelPropertiesUtil;
+import org.nuiton.eugene.metas.ModelPropertiesProvider;
import org.nuiton.eugene.models.object.ObjectModelClassifier;
import org.nuiton.eugene.models.object.ObjectModelOperation;
/**
- * To test {@link TopiaGeneratorUtil.TopiaModelPropertiesProvider}.
+ * To test {@link TopiaModelPropertiesProvider}.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 2.3
*/
public class TopiaModelPropertiesProviderTest {
- protected ModelPropertiesUtil.ModelPropertiesProvider provider;
+ protected ModelPropertiesProvider provider;
@Before
public void setUp() throws Exception {
- provider = new TopiaGeneratorUtil.TopiaModelPropertiesProvider();
+ provider = new TopiaModelPropertiesProvider();
provider.init();
}
1
0
r3081 - trunk/topia-templates/src/main/java/org/nuiton/topia/templates
by tchemit@users.nuiton.org 25 Apr '14
by tchemit@users.nuiton.org 25 Apr '14
25 Apr '14
Author: tchemit
Date: 2014-04-25 15:31:15 +0200 (Fri, 25 Apr 2014)
New Revision: 3081
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3081
Log:
fixes #3174
Modified:
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityHibernateMappingGenerator.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityTransformer.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaGeneratorUtil.java
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityHibernateMappingGenerator.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityHibernateMappingGenerator.java 2014-04-22 19:08:44 UTC (rev 3080)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityHibernateMappingGenerator.java 2014-04-25 13:31:15 UTC (rev 3081)
@@ -288,7 +288,7 @@
generateHibernateOneToOne(output, attr, prefix);
}
} else {
- generateHibernateProperty(output, attr, prefix);
+ generateHibernateProperty(output, clazz, attr, prefix);
}
} else {
if (attr.getClassifier() != null && TopiaGeneratorUtil.isEntity(attr.getClassifier())) {
@@ -298,7 +298,7 @@
generateHibernateOneToMany(output, attr, prefix);
}
} else {
- generateHibernateMany(output, attr, prefix);
+ generateHibernateMany(output, clazz, attr, prefix);
}
}
}
@@ -397,6 +397,7 @@
}
protected void generateHibernateProperty(Writer output,
+ ObjectModelClass clazz,
ObjectModelAttribute attr,
String prefix) throws IOException {
String attrType = getType(attr);
@@ -502,7 +503,7 @@
// if the user tuned the model to use name instead of
// ordinal to store the values, we must add a clause
- boolean useEnumerationName = TopiaGeneratorUtil.hasUseEnumerationNameTagValue(attr, model);
+ boolean useEnumerationName = TopiaGeneratorUtil.hasUseEnumerationNameTagValue(clazz, attr, model);
if (useEnumerationName) {
String enumSQLType = String.valueOf(Types.VARCHAR);
/*{
@@ -638,6 +639,7 @@
}
protected void generateHibernateMany(Writer output,
+ ObjectModelClass clazz,
ObjectModelAttribute attr,
String prefix) throws IOException {
boolean needsIndex = JavaGeneratorUtil.isOrdered(attr);
@@ -658,7 +660,7 @@
}
if (attrIsEnumeration) {
- boolean useEnumerationName = TopiaGeneratorUtil.hasUseEnumerationNameTagValue(attr, model);
+ boolean useEnumerationName = TopiaGeneratorUtil.hasUseEnumerationNameTagValue(clazz, attr, model);
/*{<%=prefix%> <element column="<%=attrColumn%>" node="id">
<%=prefix%> <type name="org.hibernate.type.EnumType">
<%=prefix%> <param name="<%=org.hibernate.type.EnumType.ENUM%>"><%=attrType%></param>
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityTransformer.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityTransformer.java 2014-04-22 19:08:44 UTC (rev 3080)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/EntityTransformer.java 2014-04-25 13:31:15 UTC (rev 3081)
@@ -40,6 +40,7 @@
import org.nuiton.eugene.models.object.ObjectModelModifier;
import org.nuiton.eugene.models.object.ObjectModelOperation;
import org.nuiton.eugene.models.object.ObjectModelParameter;
+import org.nuiton.eugene.models.object.xml.ObjectModelInterfaceImpl;
import org.nuiton.topia.persistence.TopiaEntityVisitor;
import org.nuiton.topia.persistence.internal.AbstractTopiaEntity;
import org.nuiton.topia.persistence.TopiaDaoSupplier;
@@ -144,6 +145,11 @@
// Create Entity Interface and its header
createEntityInterface(input);
+ } else {
+
+ // mock it
+ outputInterface = new ObjectModelInterfaceImpl();
+ ((ObjectModelInterfaceImpl)outputInterface).setName(input.getName());
}
if (generateAbstract) {
@@ -664,6 +670,7 @@
* @see #addMultipleGetOperationFromEntity(ObjectModelAttribute)
* @see #addMultipleSizeOperation(ObjectModelAttribute)
* @see #addMultipleIsEmptyOperations(ObjectModelAttribute)
+ * @see #addMultipleGetByIndexOperation(ObjectModelAttribute)
*/
protected void generatePropertyOperations(ObjectModelAttribute attribute) {
@@ -740,9 +747,10 @@
}
- if (attribute.hasAssociationClass()) {
- // getXXX with entity parameter
- addMultipleGetOperationFromEntity(attribute);
+ if (TopiaGeneratorUtil.isOrdered(attribute)) {
+
+ // getXXX(index)
+ addMultipleGetByIndexOperation(attribute);
}
// sizeXXX
@@ -1129,6 +1137,35 @@
);
}
+ protected void addMultipleGetByIndexOperation(ObjectModelAttribute attribute) {
+
+ String attrName = getPropertyName(attribute);
+ String attrType = getPropertyType(attribute);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Generate multiple 'getByTopiaId' operation for property : " + attrName +
+ " [" + attrType + "]");
+ }
+
+ // Interface operation
+ ObjectModelOperation interfaceOperation =
+ addOperation(outputInterface, getJavaBeanMethodName("get", attrName),
+ attrType, ObjectModelJavaModifier.PACKAGE);
+ ObjectModelParameter param =
+ addParameter(interfaceOperation, Integer.class, "index");
+
+ // Implementation
+ ObjectModelOperation implOperation =
+ createImplOperation(interfaceOperation);
+
+ addImport(outputAbstract, TopiaEntityHelper.class);
+
+ setOperationBody(implOperation, ""
+/*{
+ return <%=attrName%>.get(index);
+ }*/
+ );
+ }
protected void addMultipleGetByTopiaIdOperation(ObjectModelAttribute attribute) {
String attrName = getPropertyName(attribute);
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaGeneratorUtil.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaGeneratorUtil.java 2014-04-22 19:08:44 UTC (rev 3080)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaGeneratorUtil.java 2014-04-25 13:31:15 UTC (rev 3081)
@@ -1561,8 +1561,12 @@
}
//TODO Javadoc
- public static boolean hasUseEnumerationNameTagValue(ObjectModelAttribute attr, ObjectModel model) {
- String value = findTagValue(TopiaTagValues.TAG_USE_ENUMERATION_NAME, attr, model);
+ public static boolean hasUseEnumerationNameTagValue(ObjectModelClassifier classifier, ObjectModelAttribute attr, ObjectModel model) {
+ String value = findTagValue(TopiaTagValues.TAG_USE_ENUMERATION_NAME, classifier, model);
+ if (value == null) {
+ // try on attribute
+ value = findTagValue(TopiaTagValues.TAG_USE_ENUMERATION_NAME, attr, null);
+ }
return Boolean.parseBoolean(value);
}
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java 2014-04-22 19:08:44 UTC (rev 3080)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTagValues.java 2014-04-25 13:31:15 UTC (rev 3081)
@@ -197,8 +197,10 @@
* énumération : l'ajout de la tagValue indique qu'il faut utiliser le
* {@code name} de l'énumération et non l'ordinal pour stocker la valeur en
* base
+ * @see TopiaGeneratorUtil#hasUseEnumerationNameTagValue(ObjectModelClassifier,ObjectModelAttribute,ObjectModel)
+ * @since 3.0
*/
- @TagValueDefinition(target = {ObjectModelAttribute.class},
+ @TagValueDefinition(target = {ObjectModel.class, ObjectModelClassifier.class, ObjectModelAttribute.class},
documentation = "'true' if the value of this attribute of type Enumeration should be stored with its name (instead of using ordinal)")
String TAG_USE_ENUMERATION_NAME = "useEnumerationName";
1
0
r3080 - trunk/topia-templates/src/main/java/org/nuiton/topia/templates
by tchemit@users.nuiton.org 22 Apr '14
by tchemit@users.nuiton.org 22 Apr '14
22 Apr '14
Author: tchemit
Date: 2014-04-22 21:08:44 +0200 (Tue, 22 Apr 2014)
New Revision: 3080
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3080
Log:
refs #3168
Modified:
trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaJavaValidator.java
Modified: trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaJavaValidator.java
===================================================================
--- trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaJavaValidator.java 2014-04-22 10:33:34 UTC (rev 3079)
+++ trunk/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaJavaValidator.java 2014-04-22 19:08:44 UTC (rev 3080)
@@ -24,6 +24,7 @@
* #L%
*/
+import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.nuiton.eugene.models.object.ObjectModel;
import org.nuiton.eugene.models.object.ObjectModelAttribute;
@@ -69,8 +70,7 @@
if (!isJavaIdentifier(attr.getName())) {
isValid = false;
- addError(attr, "Attribute name " + attr.getName()
- + " is not valid java identifier");
+ addError(attr, "Attribute name " + attr.getName() + " is not valid java identifier");
}
// test sur les mots réservés ?
@@ -94,8 +94,7 @@
}
String attrName = attr.getName();
if (!attributesName.add(attrName)) {
- addError(attr, "Attribute name " + attrName
- + " already exists");
+ addError(attr, "Attribute name " + attrName + " already exists");
isValid = false;
}
@@ -103,24 +102,31 @@
if (TopiaGeneratorUtil.isEntity(clazz)) {
- Set<String> methodsName = new HashSet<String>();
+ Set<String> gettersName = new HashSet<String>();
+ Set<String> settersName = new HashSet<String>();
for (ObjectModelAttribute attr : clazz.getAttributes()) {
String capitalizeAttrName = StringUtils.capitalize(attr.getName());
- methodsName.add(TopiaGeneratorUtil.OPERATION_GETTER_BOOLEAN_PREFIX + capitalizeAttrName);
- methodsName.add(TopiaGeneratorUtil.OPERATION_GETTER_DEFAULT_PREFIX + capitalizeAttrName);
- methodsName.add("set" + capitalizeAttrName);
+ gettersName.add(TopiaGeneratorUtil.OPERATION_GETTER_BOOLEAN_PREFIX + capitalizeAttrName);
+ gettersName.add(TopiaGeneratorUtil.OPERATION_GETTER_DEFAULT_PREFIX + capitalizeAttrName);
+ settersName.add("set" + capitalizeAttrName);
}
// test if there is a method an already reserved name
for (ObjectModelOperation operation : clazz.getOperations()) {
String operationName = operation.getName();
- if (methodsName.contains(operationName)) {
+ if (gettersName.contains(operationName) && CollectionUtils.isEmpty(operation.getParameters())) {
addError(operation, "Operation name " + operationName
- + " is already reserved for a getter/setter of an entity attribute");
+ + " is already reserved for a getter of an entity attribute");
isValid = false;
}
+ if (settersName.contains(operationName) && operation.getParameters().size() == 1) {
+ addError(operation, "Operation name " + operationName
+ + " is already reserved for a setter of an entity attribute");
+
+ isValid = false;
+ }
}
}
1
0
The ToPIA team is pleased to announce the topia-3.0-beta-3 release!
Tools for Portable and Independent Architecture :
Framework de persistance et de distribution d'application.
Documentation of the project can be found here:
https://doc.nuiton.org/topia
Changes
-------
Changes in this version include:
New features:
o Review implications of ordering and uniqueness in collections Issue: 3148. Thanks to Brendan Le Ny. Resolved by bleny.
o Add a way to add costum generics method inherited by all application DAO Issue: 3134. Thanks to Éric Chatellier. Resolved by bleny.
Fixed Bugs:
o NPE when using TopiaDao#update(...) method on non persisted entity Issue: 3153. Thanks to Arnaud Thimel. Resolved by athimel.
o When making a addAll and initializing reverse attribute collection, use reverse attribute type instead of self type Issue: 3150. Thanks to Brendan Le Ny. Resolved by bleny.
Downloads
---------
No release file deployed. (all files are deployed in the maven repository)
Maven artifacts
---------------
Artifacts are deployed in Maven Central Repository
http://repo1.maven.org/maven2/
Find us at
* http://search.maven.org/#artifactdetails|org.nuiton|topia|3.0-beta-3|jar
Have fun!
-ToPIA team
1
0
r3079 - in trunk: . topia-it topia-junit topia-persistence topia-service-csv topia-service-migration topia-service-replication topia-templates
by maven-release@users.nuiton.org 22 Apr '14
by maven-release@users.nuiton.org 22 Apr '14
22 Apr '14
Author: maven-release
Date: 2014-04-22 12:33:34 +0200 (Tue, 22 Apr 2014)
New Revision: 3079
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3079
Log:
[maven-release-plugin] prepare for next development iteration
Modified:
trunk/pom.xml
trunk/topia-it/pom.xml
trunk/topia-junit/pom.xml
trunk/topia-persistence/pom.xml
trunk/topia-service-csv/pom.xml
trunk/topia-service-migration/pom.xml
trunk/topia-service-replication/pom.xml
trunk/topia-templates/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-04-22 10:33:27 UTC (rev 3078)
+++ trunk/pom.xml 2014-04-22 10:33:34 UTC (rev 3079)
@@ -33,7 +33,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>3.0-beta-3</version>
+ <version>3.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>ToPIA</name>
@@ -211,12 +211,12 @@
</modules>
<scm>
- <connection>scm:svn:https://svn.nuiton.org/topia/tags/topia-3.0-beta-3</connection>
+ <connection>scm:svn:https://svn.nuiton.org/topia/trunk</connection>
<developerConnection>
- scm:svn:https://svn.nuiton.org/topia/tags/topia-3.0-beta-3
+ scm:svn:https://svn.nuiton.org/topia/trunk
</developerConnection>
<url>
- https://forge.nuiton.org/projects/topia/repository/show/tags/topia-3.0-beta…
+ https://forge.nuiton.org/projects/topia/repository/show/trunk
</url>
</scm>
<distributionManagement>
Modified: trunk/topia-it/pom.xml
===================================================================
--- trunk/topia-it/pom.xml 2014-04-22 10:33:27 UTC (rev 3078)
+++ trunk/topia-it/pom.xml 2014-04-22 10:33:34 UTC (rev 3079)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-beta-3</version>
+ <version>3.0-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-junit/pom.xml
===================================================================
--- trunk/topia-junit/pom.xml 2014-04-22 10:33:27 UTC (rev 3078)
+++ trunk/topia-junit/pom.xml 2014-04-22 10:33:34 UTC (rev 3079)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-beta-3</version>
+ <version>3.0-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-persistence/pom.xml
===================================================================
--- trunk/topia-persistence/pom.xml 2014-04-22 10:33:27 UTC (rev 3078)
+++ trunk/topia-persistence/pom.xml 2014-04-22 10:33:34 UTC (rev 3079)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-beta-3</version>
+ <version>3.0-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-csv/pom.xml
===================================================================
--- trunk/topia-service-csv/pom.xml 2014-04-22 10:33:27 UTC (rev 3078)
+++ trunk/topia-service-csv/pom.xml 2014-04-22 10:33:34 UTC (rev 3079)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-beta-3</version>
+ <version>3.0-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-migration/pom.xml
===================================================================
--- trunk/topia-service-migration/pom.xml 2014-04-22 10:33:27 UTC (rev 3078)
+++ trunk/topia-service-migration/pom.xml 2014-04-22 10:33:34 UTC (rev 3079)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-beta-3</version>
+ <version>3.0-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-replication/pom.xml
===================================================================
--- trunk/topia-service-replication/pom.xml 2014-04-22 10:33:27 UTC (rev 3078)
+++ trunk/topia-service-replication/pom.xml 2014-04-22 10:33:34 UTC (rev 3079)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-beta-3</version>
+ <version>3.0-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-templates/pom.xml
===================================================================
--- trunk/topia-templates/pom.xml 2014-04-22 10:33:27 UTC (rev 3078)
+++ trunk/topia-templates/pom.xml 2014-04-22 10:33:34 UTC (rev 3079)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-beta-3</version>
+ <version>3.0-SNAPSHOT</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
Author: maven-release
Date: 2014-04-22 12:33:27 +0200 (Tue, 22 Apr 2014)
New Revision: 3078
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3078
Log:
[maven-release-plugin] copy for tag topia-3.0-beta-3
Added:
tags/topia-3.0-beta-3/
Property changes on: tags/topia-3.0-beta-3
___________________________________________________________________
Added: svn:ignore
+ *.ipr
*.iws
.classpath
*.iml
.project
target
.settings
.idea
atlassian-ide-plugin.xml
Added: svn:mergeinfo
+ /branches/from2.2.2-eugene2-beta:1662-1714
/branches/topia-2.6.x:2293-2300
1
0
r3077 - in trunk: . topia-it topia-junit topia-persistence topia-service-csv topia-service-migration topia-service-replication topia-templates
by maven-release@users.nuiton.org 22 Apr '14
by maven-release@users.nuiton.org 22 Apr '14
22 Apr '14
Author: maven-release
Date: 2014-04-22 12:33:23 +0200 (Tue, 22 Apr 2014)
New Revision: 3077
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3077
Log:
[maven-release-plugin] prepare release topia-3.0-beta-3
Modified:
trunk/pom.xml
trunk/topia-it/pom.xml
trunk/topia-junit/pom.xml
trunk/topia-persistence/pom.xml
trunk/topia-service-csv/pom.xml
trunk/topia-service-migration/pom.xml
trunk/topia-service-replication/pom.xml
trunk/topia-templates/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2014-04-18 17:22:04 UTC (rev 3076)
+++ trunk/pom.xml 2014-04-22 10:33:23 UTC (rev 3077)
@@ -33,7 +33,7 @@
</parent>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-beta-3</version>
<packaging>pom</packaging>
<name>ToPIA</name>
@@ -211,12 +211,12 @@
</modules>
<scm>
- <connection>scm:svn:https://svn.nuiton.org/topia/trunk</connection>
+ <connection>scm:svn:https://svn.nuiton.org/topia/tags/topia-3.0-beta-3</connection>
<developerConnection>
- scm:svn:https://svn.nuiton.org/topia/trunk
+ scm:svn:https://svn.nuiton.org/topia/tags/topia-3.0-beta-3
</developerConnection>
<url>
- https://forge.nuiton.org/projects/topia/repository/show/trunk
+ https://forge.nuiton.org/projects/topia/repository/show/tags/topia-3.0-beta…
</url>
</scm>
<distributionManagement>
Modified: trunk/topia-it/pom.xml
===================================================================
--- trunk/topia-it/pom.xml 2014-04-18 17:22:04 UTC (rev 3076)
+++ trunk/topia-it/pom.xml 2014-04-22 10:33:23 UTC (rev 3077)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-beta-3</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-junit/pom.xml
===================================================================
--- trunk/topia-junit/pom.xml 2014-04-18 17:22:04 UTC (rev 3076)
+++ trunk/topia-junit/pom.xml 2014-04-22 10:33:23 UTC (rev 3077)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-beta-3</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-persistence/pom.xml
===================================================================
--- trunk/topia-persistence/pom.xml 2014-04-18 17:22:04 UTC (rev 3076)
+++ trunk/topia-persistence/pom.xml 2014-04-22 10:33:23 UTC (rev 3077)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-beta-3</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-csv/pom.xml
===================================================================
--- trunk/topia-service-csv/pom.xml 2014-04-18 17:22:04 UTC (rev 3076)
+++ trunk/topia-service-csv/pom.xml 2014-04-22 10:33:23 UTC (rev 3077)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-beta-3</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-migration/pom.xml
===================================================================
--- trunk/topia-service-migration/pom.xml 2014-04-18 17:22:04 UTC (rev 3076)
+++ trunk/topia-service-migration/pom.xml 2014-04-22 10:33:23 UTC (rev 3077)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-beta-3</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-service-replication/pom.xml
===================================================================
--- trunk/topia-service-replication/pom.xml 2014-04-18 17:22:04 UTC (rev 3076)
+++ trunk/topia-service-replication/pom.xml 2014-04-22 10:33:23 UTC (rev 3077)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-beta-3</version>
</parent>
<groupId>org.nuiton.topia</groupId>
Modified: trunk/topia-templates/pom.xml
===================================================================
--- trunk/topia-templates/pom.xml 2014-04-18 17:22:04 UTC (rev 3076)
+++ trunk/topia-templates/pom.xml 2014-04-22 10:33:23 UTC (rev 3077)
@@ -30,7 +30,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>topia</artifactId>
- <version>3.0-SNAPSHOT</version>
+ <version>3.0-beta-3</version>
</parent>
<groupId>org.nuiton.topia</groupId>
1
0
Author: athimel
Date: 2014-04-18 19:22:04 +0200 (Fri, 18 Apr 2014)
New Revision: 3076
Url: http://forge.nuiton.org/projects/topia/repository/revisions/3076
Log:
organize doc
Added:
trunk/src/site/rst/user/ordered_vs_indexed_migration.rst
Removed:
trunk/src/site/rst/migrate_to_3.0_ordered_vs_indexed_migration.rst
Modified:
trunk/src/site/rst/migrate_to_3.0.rst
trunk/src/site/site_fr.xml
Modified: trunk/src/site/rst/migrate_to_3.0.rst
===================================================================
--- trunk/src/site/rst/migrate_to_3.0.rst 2014-04-18 16:28:46 UTC (rev 3075)
+++ trunk/src/site/rst/migrate_to_3.0.rst 2014-04-18 17:22:04 UTC (rev 3076)
@@ -70,14 +70,14 @@
Vous devez migrer votre modèle zargo depuis la beta-3 suite à une confusion entre ordered et indexed (stéréotypes
à placer sur une association-end d'un lien entre deux entités).
- * Le stéréotype "indexed" est déprécié, vous devez le remplacer par "ordered"
- * Le stéréotype "ordered" maintient l'ordre d'insertion en base, il faut donc vous assurer qu'une colonne
- _idx est bien présente dans la base et au besoin écrire la migration nécessaire pour ajouter la colonne
- et fixer les indexes manquants (en commençant à 0).
- * Les types des collections générées ont changés afin d'utiliser un contrat plus proche du modèle (selon
- que les stéréotypes "unique" et/ou "ordered" ont été posés).
+ * Le stéréotype "indexed" est déprécié, vous devez le remplacer par l'attribut "ordered"
+ * L'attribut (ou le stéréotype) "ordered" maintient l'ordre d'insertion en base, il faut donc vous assurer qu'une
+ colonne <champ>_idx est bien présente dans la base de donnée et au besoin écrire la migration nécessaire (voir
+ `le guide dédié`_) pour ajouter la colonne et fixer les indexes manquants (en commençant à 0).
+ * Les types des collections générées ont changé afin d'utiliser un contrat plus proche du modèle (selon la présence
+ des stéréotypes "unique" et/ou "ordered").
-Vous trouverez des examples de scripts de migration dans la `section dediée`_.
+NB : La documentation contient des `examples de migration pour la refonte des indexed/ordered`_.
Code déprécié
=============
@@ -312,7 +312,8 @@
grep -m 1 -nr 'TopiaContextFactory.CONFIG_' . | awk -F ':' '{print $1}' | xargs sed -i -e 's/TopiaContextFactory.CONFIG_/TopiaConfigurationConstants.CONFIG_/g'
-.. _section dediée: ./migrate_to_3.0_ordered_vs_indexed_migration.html
+.. _le guide dédié: ./user/ordered_vs_indexed_migration.html
+.. _examples de migration pour la refonte des indexed/ordered: ./user/ordered_vs_indexed_migration.html
.. |RECOMMENDED| image:: recommended.png
.. |MANDATORY| image:: mandatory.png
Deleted: trunk/src/site/rst/migrate_to_3.0_ordered_vs_indexed_migration.rst
===================================================================
--- trunk/src/site/rst/migrate_to_3.0_ordered_vs_indexed_migration.rst 2014-04-18 16:28:46 UTC (rev 3075)
+++ trunk/src/site/rst/migrate_to_3.0_ordered_vs_indexed_migration.rst 2014-04-18 17:22:04 UTC (rev 3076)
@@ -1,132 +0,0 @@
-.. -
-.. * #%L
-.. * ToPIA
-.. * $Id$
-.. * $HeadURL$
-.. * %%
-.. * Copyright (C) 2004 - 2014 CodeLutin
-.. * %%
-.. * This program is free software: you can redistribute it and/or modify
-.. * it under the terms of the GNU Lesser General Public License as
-.. * published by the Free Software Foundation, either version 3 of the
-.. * License, or (at your option) any later version.
-.. *
-.. * This program is distributed in the hope that it will be useful,
-.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
-.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-.. * GNU General Lesser Public License for more details.
-.. *
-.. * You should have received a copy of the GNU General Lesser Public
-.. * License along with this program. If not, see
-.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
-.. * #L%
-.. -
-
-=============================================
-Migration vers ToPIA 3.0 - ordered vs indexed
-=============================================
-
-
-Vous devez migrer votre modèle zargo depuis la beta-3 suite à une confusion entre ordered et indexed (stéréotypes
-à placer sur une association-end d'un lien entre deux entités).
-
- * Le stéréotype "indexed" est déprécié, vous devez le remplacer par "ordered"
- * Le stéréotype "ordered" maintient l'ordre d'insertion en base, il faut donc vous assurer qu'une colonne
- _idx est bien présente dans la base et au besoin écrire la migration nécessaire pour ajouter la colonne
- et fixer les indexes manquants (en commençant à 0).
- * Les types des collections générées ont changés afin d'utiliser un contrat plus proche du modèle (selon
- que les stéréotypes "unique" et/ou "ordered" ont été posés).
-
-
-Exemples de scripts de migration SQL
-====================================
-
-Cas simple d'une relation 1..n
-------------------------------
-
-::
-
- --
- -- relation is : Car -----[*]- Tyre
- --
-
- -- Add index to be able to order tyres
- ALTER TABLE tyre ADD COLUMN car_idx integer;
-
- -- Generate unique car_idx according to topiaCreateDate and topiaId
- UPDATE tyre SET car_idx = (
- SELECT COUNT(topiaId)
- FROM tyre t
- WHERE t.car = tyre.car
- AND (t.topiaCreateDate || t.topiaId) < (tyre.topiaCreateDate || tyre.topiaId)
- );
-
-
-Cas d'une relation 1..n vers une entité abstraite
--------------------------------------------------
-
-Note : cela n'est nécessaire que pour la stratégie d'héritage union-subclass.
-
-
-::
-
-
- --
- -- relation is : Person -----[*]- Pet (abstract)
- -- ^
- -- |
- -- -----------
- -- | |
- -- Cat Dog
- --
-
- -- create a temporary table to be able to orders cats and dogs
- CREATE TABLE person_to_pet_tmp (
- person character varying(255) NOT NULL,
- type character varying(255) NOT NULL,
- petTopiaId character varying(255) NOT NULL,
- petTopiaCreateDate timestamp without time zone,
- person_idx integer
- );
-
- -- populate table with cats
- INSERT INTO person_to_pet_tmp (person, type, petTopiaId, petTopiaCreateDate)
- SELECT person, 'cat', topiaId, topiaCreateDate FROM cat;
-
- -- populate table with dogs
- INSERT INTO person_to_pet_tmp (person, type, petTopiaId, petTopiaCreateDate)
- SELECT person, 'dog', topiaId, topiaCreateDate FROM dog;
-
- -- compute index for cats and dogs together
- UPDATE person_to_pet_tmp SET person_idx = (
- SELECT COUNT(ptpt.person)
- FROM person_to_pet_tmp ptpt
- WHERE ptpt.person = person_to_pet_tmp.person
- AND (ptpt.petTopiaCreateDate || ptpt.petTopiaId) < (person_to_pet_tmp.petTopiaCreateDate || person_to_pet_tmp.petTopiaId)
- );
-
- -- add index to be able to order cats
- ALTER TABLE cat ADD COLUMN person_idx integer;
-
- -- add indexes to cats
- UPDATE cat SET person_idx = (
- SELECT person_idx
- FROM person_to_pet_tmp ptpt
- WHERE ptpt.petTopiaId = cat.topiaId
- );
-
- -- add index to be able to order dogs
- ALTER TABLE dog ADD COLUMN person_idx integer;
-
- -- add indexes to dogs
- UPDATE dog SET person_idx = (
- SELECT person_idx
- FROM person_to_pet_tmp ptpt
- WHERE ptpt.petTopiaId = dog.topiaId
- );
-
- -- remove temporary table
- DROP TABLE person_to_pet_tmp;
-
-
-
Copied: trunk/src/site/rst/user/ordered_vs_indexed_migration.rst (from rev 3075, trunk/src/site/rst/migrate_to_3.0_ordered_vs_indexed_migration.rst)
===================================================================
--- trunk/src/site/rst/user/ordered_vs_indexed_migration.rst (rev 0)
+++ trunk/src/site/rst/user/ordered_vs_indexed_migration.rst 2014-04-18 17:22:04 UTC (rev 3076)
@@ -0,0 +1,132 @@
+.. -
+.. * #%L
+.. * ToPIA
+.. * $Id$
+.. * $HeadURL$
+.. * %%
+.. * Copyright (C) 2004 - 2014 CodeLutin
+.. * %%
+.. * This program is free software: you can redistribute it and/or modify
+.. * it under the terms of the GNU Lesser General Public License as
+.. * published by the Free Software Foundation, either version 3 of the
+.. * License, or (at your option) any later version.
+.. *
+.. * This program is distributed in the hope that it will be useful,
+.. * but WITHOUT ANY WARRANTY; without even the implied warranty of
+.. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+.. * GNU General Lesser Public License for more details.
+.. *
+.. * You should have received a copy of the GNU General Lesser Public
+.. * License along with this program. If not, see
+.. * <http://www.gnu.org/licenses/lgpl-3.0.html>.
+.. * #L%
+.. -
+
+=============================================
+Migration vers ToPIA 3.0 - ordered vs indexed
+=============================================
+
+
+Vous devez migrer votre modèle zargo depuis la beta-3 suite à une confusion entre ordered et indexed (stéréotypes
+à placer sur une association-end d'un lien entre deux entités).
+
+ * Le stéréotype "indexed" est déprécié, vous devez le remplacer par l'attribut "ordered"
+ * L'attribut (ou le stéréotype) "ordered" maintient l'ordre d'insertion en base, il faut donc vous assurer qu'une
+ colonne <champ>_idx est bien présente dans la base de donnée et au besoin écrire la migration nécessaire (voir ci-
+ dessous) pour ajouter la colonne et fixer les indexes manquants (en commençant à 0).
+ * Les types des collections générées ont changé afin d'utiliser un contrat plus proche du modèle (selon la présence
+ des stéréotypes "unique" et/ou "ordered").
+
+
+Exemples de scripts de migration SQL
+====================================
+
+Cas simple d'une relation 1..n
+------------------------------
+
+::
+
+ --
+ -- relation is : Car -----[*]- Tyre
+ --
+
+ -- Add index to be able to order tyres
+ ALTER TABLE tyre ADD COLUMN car_idx integer;
+
+ -- Generate unique car_idx according to topiaCreateDate and topiaId
+ UPDATE tyre SET car_idx = (
+ SELECT COUNT(topiaId)
+ FROM tyre t
+ WHERE t.car = tyre.car
+ AND (t.topiaCreateDate || t.topiaId) < (tyre.topiaCreateDate || tyre.topiaId)
+ );
+
+
+Cas d'une relation 1..n vers une entité abstraite
+-------------------------------------------------
+
+Note : cela n'est nécessaire que pour la stratégie d'héritage union-subclass.
+
+
+::
+
+
+ --
+ -- relation is : Person -----[*]- Pet (abstract)
+ -- ^
+ -- |
+ -- -----------
+ -- | |
+ -- Cat Dog
+ --
+
+ -- create a temporary table to be able to orders cats and dogs
+ CREATE TABLE person_to_pet_tmp (
+ person character varying(255) NOT NULL,
+ type character varying(255) NOT NULL,
+ petTopiaId character varying(255) NOT NULL,
+ petTopiaCreateDate timestamp without time zone,
+ person_idx integer
+ );
+
+ -- populate table with cats
+ INSERT INTO person_to_pet_tmp (person, type, petTopiaId, petTopiaCreateDate)
+ SELECT person, 'cat', topiaId, topiaCreateDate FROM cat;
+
+ -- populate table with dogs
+ INSERT INTO person_to_pet_tmp (person, type, petTopiaId, petTopiaCreateDate)
+ SELECT person, 'dog', topiaId, topiaCreateDate FROM dog;
+
+ -- compute index for cats and dogs together
+ UPDATE person_to_pet_tmp SET person_idx = (
+ SELECT COUNT(ptpt.person)
+ FROM person_to_pet_tmp ptpt
+ WHERE ptpt.person = person_to_pet_tmp.person
+ AND (ptpt.petTopiaCreateDate || ptpt.petTopiaId) < (person_to_pet_tmp.petTopiaCreateDate || person_to_pet_tmp.petTopiaId)
+ );
+
+ -- add index to be able to order cats
+ ALTER TABLE cat ADD COLUMN person_idx integer;
+
+ -- add indexes to cats
+ UPDATE cat SET person_idx = (
+ SELECT person_idx
+ FROM person_to_pet_tmp ptpt
+ WHERE ptpt.petTopiaId = cat.topiaId
+ );
+
+ -- add index to be able to order dogs
+ ALTER TABLE dog ADD COLUMN person_idx integer;
+
+ -- add indexes to dogs
+ UPDATE dog SET person_idx = (
+ SELECT person_idx
+ FROM person_to_pet_tmp ptpt
+ WHERE ptpt.petTopiaId = dog.topiaId
+ );
+
+ -- remove temporary table
+ DROP TABLE person_to_pet_tmp;
+
+
+
Modified: trunk/src/site/site_fr.xml
===================================================================
--- trunk/src/site/site_fr.xml 2014-04-18 16:28:46 UTC (rev 3075)
+++ trunk/src/site/site_fr.xml 2014-04-18 17:22:04 UTC (rev 3076)
@@ -94,7 +94,6 @@
<menu name="Documentation" inherit="top">
<item name="Présentation" href="index.html" />
- <item name="Migration vers ToPIA 3.0" href="migrate_to_3.0.html" />
<item name="Utilisation" href="user/howto.html" />
<item name="Génération des modèles" href="user/ModelGeneration.html"/>
<item name="Tag values" href="user/tagvalues.html" />
@@ -105,14 +104,16 @@
<item name="Démarrer avec ToPIA et Maven" href="user/start.html" />
<item name="Commencer à développer avec l'API ToPIA" href="user/start_using_api.html" />
<item name="Étendre le modèle" href="user/extend_model.html" />
- <item name="Continer le développement" href="user/continue_devel.html" />
+ <item name="Continuer le développement" href="user/continue_devel.html" />
+ <item name="Migration vers ToPIA 3.0" href="migrate_to_3.0.html" />
+ <item name="Examples de migration pour le refonte des indexed/ordered" href="user/ordered_vs_indexed_migration.html" />
</menu>
<menu name="Développeurs">
<item name="Todo" href="devel/Todo.html"/>
- <item name="Mapping hibernate" href="devel/HibernateMapping.html"/>
+ <item name="Mapping Hibernate" href="devel/HibernateMapping.html"/>
<item name="Isolation" href="devel/Isolation.html"/>
- <item name="Schema migration" href="devel/SchemaMigration.html"/>
+ <item name="Migration de schéma" href="devel/SchemaMigration.html"/>
<item name="Sécurité" href="devel/security.html"/>
<item name="TopiaContextFactory" href="devel/Devel.html"/>
<item name="Projets similaires" href="devel/project.html"/>
1
0