]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5943: Obtain the name of the relevant termgroup table in the database via...
authorAron Roberts <aron@socrates.berkeley.edu>
Thu, 28 Mar 2013 00:46:40 +0000 (17:46 -0700)
committerAron Roberts <aron@socrates.berkeley.edu>
Thu, 28 Mar 2013 00:46:40 +0000 (17:46 -0700)
services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java
services/location/service/src/main/java/org/collectionspace/services/location/nuxeo/LocationDocumentModelHandler.java
services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonDocumentModelHandler.java

index 849466f5dce276efe8ee3fe3afdd1268c1f6f00b..967661d9a9f0d3b052bbf6b4f6e9b0839685b20e 100644 (file)
@@ -91,7 +91,7 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
     protected String authorityRefNameBase = null;
     // Used to determine when the displayName changes as part of the update.
     protected String oldDisplayNameOnUpdate = null;
-    private String TERM_GROUP_TABLE_NAME_SUFFIX = "termgroup";
+    private final static String LIST_SUFFIX = "List";
 
     public AuthorityItemDocumentModelHandler(String authorityItemCommonSchemaName) {
         this.authorityItemCommonSchemaName = authorityItemCommonSchemaName;
@@ -686,8 +686,12 @@ public abstract class AuthorityItemDocumentModelHandler<AICommon>
        return result;
     }
     
+    // By convention, the name of the database table that contains
+    // repeatable term information group records is derivable from
+    // an XPath base value by removing a suffix and converting to lowercase
     protected String getTermGroupTableName() {
-        return TERM_GROUP_TABLE_NAME_SUFFIX;
+        String termInfoGroupListName = getItemTermInfoGroupXPathBase();
+        return termInfoGroupListName.substring(0, termInfoGroupListName.lastIndexOf(LIST_SUFFIX)).toLowerCase();
     }
     
     @Override
index a5bac79fb8ef5cc6ae7a0878befe35a63290703c..7029d5dea18f368f6eee8d7dfc99ef7f0fce6882 100644 (file)
@@ -117,10 +117,6 @@ public class LocationDocumentModelHandler
     public String getQProperty(String prop) {
         return LocationConstants.NUXEO_SCHEMA_NAME + ":" + prop;
     }
-    
-    @Override
-    protected String getTermGroupTableName() {
-        return "loc" + super.getTermGroupTableName();
-    }
+
 }
 
index 5219690c705377a861a97ce8ada22eddf8d128a3..635fd4c46c963b6f191c38514cb64fc35d26d5bb 100644 (file)
@@ -175,10 +175,6 @@ public class PersonDocumentModelHandler
     public String getQProperty(String prop) {
         return PersonConstants.NUXEO_SCHEMA_NAME + ":" + prop;
     }
-    
-    @Override
-    protected String getTermGroupTableName() {
-        return "person" + super.getTermGroupTableName();
-    }
+
 }