branch develop updated (89d7049 -> e4c8032)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository topia. See http://git.nuiton.org/topia.git from 89d7049 Merge branch 'feature/3761' into develop (closes #3761) new 9b4e8c7 Use LinkedHashSet collection implementation type when unique and orderBy but not ordered (See #3768) new e4c8032 Merge branch 'feature/3768' into develop (closes #3768) The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit e4c8032866b40ef371121656ea5c4889d3a12685 Merge: 89d7049 9b4e8c7 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Aug 25 15:07:50 2015 +0200 Merge branch 'feature/3768' into develop (closes #3768) commit 9b4e8c72c5f0c6db38755b5d434fb8bb034be8c3 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Aug 25 15:00:08 2015 +0200 Use LinkedHashSet collection implementation type when unique and orderBy but not ordered (See #3768) Summary of changes: .../nuiton/topia/templates/EntityTransformer.java | 8 ++---- .../topia/templates/TopiaTemplateHelper.java | 33 +++++++++++++++++++--- 2 files changed, 32 insertions(+), 9 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository topia. See http://git.nuiton.org/topia.git commit 9b4e8c72c5f0c6db38755b5d434fb8bb034be8c3 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Aug 25 15:00:08 2015 +0200 Use LinkedHashSet collection implementation type when unique and orderBy but not ordered (See #3768) --- .../nuiton/topia/templates/EntityTransformer.java | 8 ++---- .../topia/templates/TopiaTemplateHelper.java | 33 +++++++++++++++++++--- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/topia-templates/src/main/java/org/nuiton/topia/templates/EntityTransformer.java b/topia-templates/src/main/java/org/nuiton/topia/templates/EntityTransformer.java index f35c7e4..bea9385 100644 --- a/topia-templates/src/main/java/org/nuiton/topia/templates/EntityTransformer.java +++ b/topia-templates/src/main/java/org/nuiton/topia/templates/EntityTransformer.java @@ -739,10 +739,8 @@ public class EntityTransformer extends ObjectModelTransformerToJava { } else { // List, Set or Collection ? - String collectionInterface = - JavaGeneratorUtil.getCollectionType(attribute).getName(); - String collectionImpl = - JavaGeneratorUtil.getCollectionInstanceType(attribute).getName(); + String collectionInterface = templateHelper.getCollectionType(attribute).getName(); + String collectionImpl = templateHelper.getCollectionInstanceType(attribute).getName(); addImport(outputInterface, collectionInterface); addImport(outputAbstract, collectionInterface); @@ -1855,7 +1853,7 @@ public class EntityTransformer extends ObjectModelTransformerToJava { protected String getCollectionType(ObjectModelAttribute attribute) { String result = null; if (!associationClass && GeneratorUtil.isNMultiplicity(attribute)) { - result = JavaGeneratorUtil.getCollectionType(attribute).getName(); + result = templateHelper.getCollectionType(attribute).getName(); } return result; } diff --git a/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTemplateHelper.java b/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTemplateHelper.java index 24821ed..ec57837 100644 --- a/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTemplateHelper.java +++ b/topia-templates/src/main/java/org/nuiton/topia/templates/TopiaTemplateHelper.java @@ -661,9 +661,9 @@ public class TopiaTemplateHelper { for (ObjectModelAttribute attr : aClass.getAttributes()) { fqns.add(attr.getType()); if (GeneratorUtil.isNMultiplicity(attr)) { - String collectionType = JavaGeneratorUtil.getCollectionType(attr).getName(); + String collectionType = getCollectionType(attr).getName(); fqns.add(collectionType); - String collectionObject = JavaGeneratorUtil.getCollectionInstanceType(attr).getName(); + String collectionObject = getCollectionInstanceType(attr).getName(); fqns.add(collectionObject); } } @@ -681,9 +681,9 @@ public class TopiaTemplateHelper { } fqns.add(attr.getType()); if (GeneratorUtil.isNMultiplicity(attr)) { - String collectionType = JavaGeneratorUtil.getCollectionType(attr).getName(); + String collectionType = getCollectionType(attr).getName(); fqns.add(collectionType); - String collectionObject = JavaGeneratorUtil.getCollectionInstanceType(attr).getName(); + String collectionObject = getCollectionInstanceType(attr).getName(); fqns.add(collectionObject); } } @@ -925,6 +925,31 @@ public class TopiaTemplateHelper { return value; } + public Class<?> getCollectionType(ObjectModelAttribute attribute) { + + Class<?> collectionType = JavaGeneratorUtil.getCollectionType(attribute); + return collectionType; + + } + public Class<?> getCollectionInstanceType(ObjectModelAttribute attribute) { + + boolean unique = EugeneStereoTypes.hasUniqueStereotype(attribute); + boolean ordered = EugeneStereoTypes.hasOrderedStereotype(attribute); + boolean orderBy = topiaTagValues.getOrderByTagValue(attribute) != null; + + Class<?> result; + + if (unique && orderBy && !ordered) { + // Special case, we want to keep the order coming from database + // This does not mean we keep order while saving a such relation + result = LinkedHashSet.class; + } else { + result = JavaGeneratorUtil.getCollectionInstanceType(attribute); + } + return result; + + } + protected <T extends TagValueDefinitionProvider> T getTagValueDefinitionProvider(Class<T> providerType) { TagValueDefinitionProviderManagerExtension extension = model.getExtension( -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository topia. See http://git.nuiton.org/topia.git commit e4c8032866b40ef371121656ea5c4889d3a12685 Merge: 89d7049 9b4e8c7 Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Aug 25 15:07:50 2015 +0200 Merge branch 'feature/3768' into develop (closes #3768) .../nuiton/topia/templates/EntityTransformer.java | 8 ++---- .../topia/templates/TopiaTemplateHelper.java | 33 +++++++++++++++++++--- 2 files changed, 32 insertions(+), 9 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm