branch feature/3768 updated (7e270b8 -> 9b4e8c7)
This is an automated email from the git hooks/post-receive script. New change to branch feature/3768 in repository topia. See http://git.nuiton.org/topia.git discards 7e270b8 Use LinkedHashSet collection implementation type when unique and orderBy but not ordered new 9b4e8c7 Use LinkedHashSet collection implementation type when unique and orderBy but not ordered (See #3768) This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (7e270b8) \ N -- N -- N refs/heads/feature/3768 (9b4e8c7) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omits" are not gone; other references still refer to them. Any revisions marked "discards" are gone forever. The 1 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 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: -- 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 feature/3768 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>.
participants (1)
-
nuiton.org scm