branch develop updated (3aca94a -> 7ab4e83)
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 3aca94a [jgitflow-maven-plugin]Updating develop poms back to pre merge state new ed14abc refs #3674 Fix reverse attribute name new 4c19056 fixes #3674: The generated indexes via the indexForeignKeys model tag value does not take account of the dbName Merge branch 'feature/3674' into develop new 5222744 refs #3675 improve index name new 7ab4e83 fixes #3675: Improve the name of the generated indexes via the indexForeignKeys model tag value Merge branch 'feature/3675' into develop The 4 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 7ab4e8304320106835f32afc8b4962431c40c455 Merge: 4c19056 5222744 Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Apr 16 11:53:33 2015 +0200 fixes #3675: Improve the name of the generated indexes via the indexForeignKeys model tag value Merge branch 'feature/3675' into develop commit 5222744bfd9102d130b59a73fc729cfe2e3f561b Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Apr 16 11:53:28 2015 +0200 refs #3675 improve index name commit 4c19056e5e11e4b043694b3d4e353818c3b38dae Merge: 3aca94a ed14abc Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Apr 16 11:14:01 2015 +0200 fixes #3674: The generated indexes via the indexForeignKeys model tag value does not take account of the dbName Merge branch 'feature/3674' into develop commit ed14abc6b2b330fc71098c252f9bf5fe224633df Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Apr 16 11:13:58 2015 +0200 refs #3674 Fix reverse attribute name Summary of changes: .../generator/EntityHibernateMappingGenerator.java | 23 +++++++--- .../nuiton/topia/generator/TopiaGeneratorUtil.java | 49 +++++++++++++++++++++- 2 files changed, 64 insertions(+), 8 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 ed14abc6b2b330fc71098c252f9bf5fe224633df Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Apr 16 11:13:58 2015 +0200 refs #3674 Fix reverse attribute name --- .../generator/EntityHibernateMappingGenerator.java | 8 +++- .../nuiton/topia/generator/TopiaGeneratorUtil.java | 49 +++++++++++++++++++++- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityHibernateMappingGenerator.java b/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityHibernateMappingGenerator.java index 006f385..640d698 100644 --- a/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityHibernateMappingGenerator.java +++ b/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityHibernateMappingGenerator.java @@ -239,12 +239,16 @@ public class EntityHibernateMappingGenerator extends ObjectModelGenerator { // many to many tableName = TopiaGeneratorUtil.getManyToManyTableName(attribute); - propertyName = TopiaGeneratorUtil.getDbName(attribute.getReverseAttribute()); + //propertyName = TopiaGeneratorUtil.getDbName(attribute.getReverseAttribute()); + // FIX https://forge.nuiton.org/issues/3674 + propertyName = TopiaGeneratorUtil.getReverseDbNameOnReverseAttribute(attribute); } else { // one to many tableName =TopiaGeneratorUtil.getDbName(attribute.getClassifier()); - propertyName = TopiaGeneratorUtil.getDbName(attribute.getReverseAttribute()); + //propertyName = TopiaGeneratorUtil.getDbName(attribute.getReverseAttribute()); + // FIX https://forge.nuiton.org/issues/3674 + propertyName = TopiaGeneratorUtil.getReverseDbNameOnReverseAttribute(attribute); } // add schema if exist (http://nuiton.org/issues/2052) diff --git a/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java b/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java index 4a75ea2..8eabb93 100644 --- a/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java +++ b/topia-persistence/src/main/java/org/nuiton/topia/generator/TopiaGeneratorUtil.java @@ -24,8 +24,6 @@ package org.nuiton.topia.generator; -import java.util.LinkedHashSet; - import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; @@ -56,6 +54,7 @@ import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -203,6 +202,52 @@ public class TopiaGeneratorUtil extends JavaGeneratorUtil { } /** + * Obtain the reverse db name of a reverse attribute. + * + * <strong>Note that the reverse attribute can't be null here.</strong> + * <ul> + * <li>Try first to get the reverse db Name from the ReverseDbname tag-value</li> + * <li>If not found, try then the ReverseDbname tag-value on the same attribute but from this other side of the relation</li> + * <li>If not found, try then just get the name of the reverse attribute</li> + * </ul> + * @param attr the attribute to seek + * @return the value of the reverse db name on the revser attribute + * @since 2.9.5.2 + */ + public static String getReverseDbNameOnReverseAttribute(ObjectModelAttribute attr) { + + ObjectModelAttribute reverseAttribute = attr.getReverseAttribute(); + + if (reverseAttribute == null) { + throw new IllegalArgumentException("The reverse attribute can't be null, but was on " + attr); + } + + String result = getReverseDbNameTagValue(reverseAttribute); + if (StringUtils.isEmpty(result)) { + + // Try to get it from the other site of the relation + ObjectModelAttribute reverseAttribute2 = reverseAttribute.getClassifier().getAttribute(attr.getName()); + result = getReverseDbNameTagValue(reverseAttribute2); + + } + +// if (StringUtils.isEmpty(result)) { +// +// result = getDbNameTagValue(reverseAttribute); +// +// } + + if (StringUtils.isEmpty(result)) { + + result = toLowerCaseFirstLetter(reverseAttribute.getName()); + + } + + return result; + + } + + /** * Renvoie le nom BD de l'élement passé en paramètre. Elle se base sur le * tag associé si il existe, sinon sur le nom de l'élément * -- 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 4c19056e5e11e4b043694b3d4e353818c3b38dae Merge: 3aca94a ed14abc Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Apr 16 11:14:01 2015 +0200 fixes #3674: The generated indexes via the indexForeignKeys model tag value does not take account of the dbName Merge branch 'feature/3674' into develop .../generator/EntityHibernateMappingGenerator.java | 8 +++- .../nuiton/topia/generator/TopiaGeneratorUtil.java | 49 +++++++++++++++++++++- 2 files changed, 53 insertions(+), 4 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 5222744bfd9102d130b59a73fc729cfe2e3f561b Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Apr 16 11:53:28 2015 +0200 refs #3675 improve index name --- .../topia/generator/EntityHibernateMappingGenerator.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityHibernateMappingGenerator.java b/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityHibernateMappingGenerator.java index 640d698..01930dd 100644 --- a/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityHibernateMappingGenerator.java +++ b/topia-persistence/src/main/java/org/nuiton/topia/generator/EntityHibernateMappingGenerator.java @@ -230,8 +230,10 @@ public class EntityHibernateMappingGenerator extends ObjectModelGenerator { // add database-object to create and drop index + // add schema if exist (http://nuiton.org/issues/2052) + String schema = TopiaGeneratorUtil.getDbSchemaNameTagValue(clazz, model); + boolean withSchema = StringUtils.isNotEmpty(schema); String tableName; - String indexName = "idx_" + clazz.getName() + "_" + attribute.getName(); String propertyName; @@ -251,9 +253,14 @@ public class EntityHibernateMappingGenerator extends ObjectModelGenerator { propertyName = TopiaGeneratorUtil.getReverseDbNameOnReverseAttribute(attribute); } - // add schema if exist (http://nuiton.org/issues/2052) - String schema = TopiaGeneratorUtil.getDbSchemaNameTagValue(clazz, model); - if (StringUtils.isNotEmpty(schema)) { + String indexName = "idx"; + if (withSchema) { + indexName += '_' + schema; + } + indexName += '_' + propertyName + '_' + tableName; + indexName = indexName.toLowerCase(); + + if (withSchema) { tableName = schema + "." + tableName; } /*{ <database-object> -- 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 7ab4e8304320106835f32afc8b4962431c40c455 Merge: 4c19056 5222744 Author: Tony CHEMIT <chemit@codelutin.com> Date: Thu Apr 16 11:53:33 2015 +0200 fixes #3675: Improve the name of the generated indexes via the indexForeignKeys model tag value Merge branch 'feature/3675' into develop .../topia/generator/EntityHibernateMappingGenerator.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) -- To stop receiving notification emails like this one, please contact nuiton.org SCM administrator <admin+scm@nuiton.org>.
participants (1)
-
nuiton.org scm