]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-5440: Allow multiple fields of the same name, across different tables, to...
authorAron Roberts <aron@socrates.berkeley.edu>
Wed, 8 Aug 2012 00:53:38 +0000 (17:53 -0700)
committerAron Roberts <aron@socrates.berkeley.edu>
Wed, 8 Aug 2012 00:53:38 +0000 (17:53 -0700)
services/common/src/main/java/org/collectionspace/services/common/CollectionSpaceServiceContextListener.java
services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java

index bb9eb648956b20250f53c65915a9470dc77dc202..f189d1166be4afb7ddf8fcd89d1fb943151512f8 100644 (file)
@@ -24,7 +24,7 @@ public class CollectionSpaceServiceContextListener implements ServletContextList
             
             svcMain.retrieveAllWorkspaceIds();
             
-            // Create required indexes / indices in tables not associated
+            // Create required indexes (aka indices) in tables not associated
             // with any specific tenant.
             svcMain.createRequiredIndices();
             //
index 2ff40364eb7d74aa053c1bfda896634503918d2c..3a93a231b7fbc7160dca77c8bb9359a9df6879a8 100644 (file)
@@ -207,7 +207,7 @@ public class ServiceMain {
     }\r
     \r
     /**\r
-     * Create required indices (aka indexes) in database tables not associated\r
+     * Create required indexes (aka indices) in database tables not associated\r
      * with any specific tenant.\r
      * \r
      * @throws Exception \r
@@ -220,11 +220,11 @@ public class ServiceMain {
          final String NUXEO_FULLTEXT_TABLE_NAME = "fulltext";\r
          final String NUXEO_HIERARCHY_TABLE_NAME = "hierarchy";\r
          \r
-         Map<String,String> indexableFields = new HashMap<String,String>();\r
-         indexableFields.put("tenantid", COLLECTIONSPACE_CORE_TABLE_NAME);\r
-         indexableFields.put("updatedat", COLLECTIONSPACE_CORE_TABLE_NAME);\r
-         indexableFields.put("jobid", NUXEO_FULLTEXT_TABLE_NAME);\r
-         indexableFields.put("name", NUXEO_HIERARCHY_TABLE_NAME);\r
+         Map<Integer,List<String>> fieldsToIndex = new HashMap<Integer,List<String>>();\r
+         fieldsToIndex.put(1, new ArrayList(Arrays.asList(COLLECTIONSPACE_CORE_TABLE_NAME, "tenantid")));\r
+         fieldsToIndex.put(2, new ArrayList(Arrays.asList(COLLECTIONSPACE_CORE_TABLE_NAME, "updatedat")));\r
+         fieldsToIndex.put(3, new ArrayList(Arrays.asList(NUXEO_FULLTEXT_TABLE_NAME, "jobid")));\r
+         fieldsToIndex.put(4, new ArrayList(Arrays.asList(NUXEO_HIERARCHY_TABLE_NAME, "name")));\r
        \r
          // Invoke existing post-init code to create these indexes,\r
          // sending in the set of values above, in contrast to\r
@@ -232,10 +232,10 @@ public class ServiceMain {
          DataSource dataSource = JDBCTools.getDataSource(JDBCTools.NUXEO_REPOSITORY_NAME);\r
          AddIndices addindices = new AddIndices();\r
          List<Field> fields = new ArrayList<Field>();\r
-         for (Map.Entry<String,String> entry : indexableFields.entrySet()) {\r
+         for (Map.Entry<Integer,List<String>> entry : fieldsToIndex.entrySet()) {\r
              Field field = new Field();\r
-             field.setCol(entry.getKey());\r
-             field.setTable(entry.getValue());\r
+             field.setTable(entry.getValue().get(0)); // Table name from List item 0\r
+             field.setCol(entry.getValue().get(1)); // Column name from List item 1\r
              fields.add(field);\r
          }\r
          addindices.onRepositoryInitialized(dataSource, null, fields, null);\r