]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-520, CSPACE-472: Edited descriptions of default ID Generator instances, to...
authorAron Roberts <aron@socrates.berkeley.edu>
Thu, 15 Oct 2009 20:14:21 +0000 (20:14 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Thu, 15 Oct 2009 20:14:21 +0000 (20:14 +0000)
services/id/service/src/main/java/org/collectionspace/services/id/IDResource.java
services/id/service/src/main/java/org/collectionspace/services/id/IDServiceJdbcImpl.java
services/id/service/src/main/resources/db/mysql/create_id_generators_table.sql
services/id/service/src/main/resources/db/mysql/load_id_generators.sql

index 41328a8a198092f58d14686c39bbb2b11e31444e..f7a187d9e15d0d13e3901b25e4113771ae7be47c 100644 (file)
@@ -537,7 +537,6 @@ public class IDResource {
         Element generatorRoot = null;
         String generatorStr = "";
         Document generatorDoc = null;
-        IDGeneratorInstance instance = null;
         for (String csidValue : generators.keySet() )
         {
             listitem = root.addElement(ID_GENERATOR_LIST_ITEM_NAME);
@@ -545,15 +544,16 @@ public class IDResource {
             csid.addText(csidValue);
             uri = listitem.addElement("uri");
             uri.addText(getRelativePath(csidValue));
-            instance = generators.get(csidValue);
             displayname = listitem.addElement("displayname");
-            displayname.addText(instance.getDisplayName());
+            // Retrieve the matching ID generator instance by CSID,
+            // and then pull out several of its values.
+            displayname.addText(generators.get(csidValue).getDisplayName());
             description = listitem.addElement("description");
-            description.addText(instance.getDescription());
+            description.addText(generators.get(csidValue).getDescription());
             generator = listitem.addElement("idgenerator");
             // Using the CSID as a key, get the XML string
             // representation of the ID generator.
-            generatorStr = instance.getGeneratorState();
+            generatorStr = generators.get(csidValue).getGeneratorState();
             // Convert the XML string representation of the
             // ID generator to a new XML document, copy its
             // root element, and append it to the relevant location
index 8ee6824f85d25ab87912acf1cd3223391e0e165b..3e33dc06a0b7368efe55d80ac562cc887ab650be 100644 (file)
@@ -87,7 +87,7 @@ import java.sql.Statement;
 // May at some point instead use
 // org.jboss.resteasy.spi.NotFoundException
 import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import org.collectionspace.services.common.repository.BadRequestException;
@@ -629,7 +629,7 @@ public class IDServiceJdbcImpl implements IDService {
                logger.debug("> in readIDGeneratorsList");
 
                Map<String,IDGeneratorInstance> generators =
-            new HashMap<String,IDGeneratorInstance>();
+            new LinkedHashMap<String,IDGeneratorInstance>();
 
                Connection conn = null;
                try {
@@ -639,7 +639,8 @@ public class IDServiceJdbcImpl implements IDService {
 
                        ResultSet rs = stmt.executeQuery(
                          "SELECT csid, displayname, description, " +
-              "id_generator_state FROM id_generators");
+              "id_generator_state FROM id_generators " +
+              "ORDER BY displayname ASC, priority ASC");
 
                        boolean moreRows = rs.next();
                        if (! moreRows) {
index 2d311b39b8568b8c0502e8d94ea6a99c7dcc7def..ddf141307d59fad280b5aaf376ef70dad341876f 100644 (file)
@@ -21,8 +21,8 @@
  * Creates the "id_generators" table, used by the ID Service,
  * and sets the access permissions of that table.
  *
- * $LastChangedRevision: 302 $
- * $LastChangedDate: 2009-07-15 17:42:23 -0700 (Wed, 15 Jul 2009) $
+ * $LastChangedRevision$
+ * $LastChangedDate$
  */
 
 /*
@@ -39,7 +39,8 @@ CREATE TABLE `id_generators` (
   `csid`                varchar(80) PRIMARY KEY,
   `displayname`         varchar(80),
   `description`         varchar(500),
-  `id_generator_state`  varchar(8000),
+  `priority`            smallint(1) DEFAULT 9 NOT NULL,
+  `id_generator_state`  varchar(8000) NOT NULL,
   `last_generated_id`   varchar(255),
   `modified`            timestamp NOT NULL
                         default CURRENT_TIMESTAMP
index adb8d4bd053e307dc5d8845f90de276d14f8c034..1f3799d50914123ca7aaf16d9cf3e5fac8316d65 100644 (file)
  * Loads a default set of data into the "id_generators" table,
  * used by the ID Service.
  *
- * $LastChangedRevision: 302 $
- * $LastChangedDate: 2009-09-25 15:51:39 -0700 (Fri, 25 Sep 2009) $
+ * $LastChangedRevision$
+ * $LastChangedDate$
  */
 
 /*
- * NOTE: For numeric sequence parts whose first generated
- * value is expected to start at the initial value (such as '1'),
- * enter '-1' for the current value.
+ * Note: in the priority column, values range from  '1' (highest)
+ * to '9' (lowest).
+ */
+
+/*
+ * NOTE: In the id_generator_state column, for numeric sequence parts
+ * whose first generated value should start at the initial value
+ * (such as '1'), enter '-1' for the <currentValue>
  *
  * Otherwise, the first generated value will be the next value
  * in the sequence after the initial value (e.g. '2', if the
@@ -40,13 +45,13 @@ USE `cspace`;
 -- ACCESSION_LOT_NUMBER
 
 INSERT INTO `id_generators`
-    (csid, displayname, description, last_generated_id, id_generator_state)
+    (csid, displayname, description, priority, last_generated_id, id_generator_state)
   VALUES 
     ('1a67470b-19b1-4ae3-88d4-2a0aa936270e',
      'Accession Activity Number',
-     'Generates accession lot or activity numbers, to identify accession
-activities in which a lot of one or more collection objects is
-acquired by the institution.',
+     'Identifies accession activities, in which a lot of
+one or more collection objects is acquired by the institution.',
+     '9',
      '',
 '<org.collectionspace.services.id.SettableIDGenerator>
   <parts>
@@ -68,13 +73,14 @@ acquired by the institution.',
 -- ACCESSION_NUMBER
 
 INSERT INTO `id_generators`
-    (csid, displayname, description, last_generated_id, id_generator_state)
+    (csid, displayname, description, priority, last_generated_id, id_generator_state)
   VALUES 
     ('9dd92952-c384-44dc-a736-95e435c1759c',
      'Accession Number',
-     'Generates accession numbers, to identify individual
-collection objects individually acquired by the museum.  This
-generator is used for collection objects without parts.',
+     'Identifies individual collection objects formally
+acquired by the institution. Used for collection objects
+without parts.',
+     '9',
      '',
 '<org.collectionspace.services.id.SettableIDGenerator>
   <parts>
@@ -105,13 +111,14 @@ generator is used for collection objects without parts.',
 -- ARCHIVES_NUMBER
 
 INSERT INTO `id_generators`
-    (csid, displayname, description, last_generated_id, id_generator_state)
+    (csid, displayname, description, priority, last_generated_id, id_generator_state)
   VALUES 
     ('70586d30-9dca-4a07-a3a2-1976fe898028',
      'Archives Number',
-     'Generates archives numbers, to identify accession activities
+     'Identifies archives-related accession activities,
 in which a lot of one or more collection objects is formally
 acquired for the archives.',
+     '9',
      '',
 '<org.collectionspace.services.id.SettableIDGenerator>
   <parts>
@@ -137,13 +144,14 @@ acquired for the archives.',
 -- EVALUATION_NUMBER
 
 INSERT INTO `id_generators`
-    (csid, displayname, description, last_generated_id, id_generator_state)
+    (csid, displayname, description, priority, last_generated_id, id_generator_state)
   VALUES 
     ('d2d80822-25c7-4c7c-a105-fc40cdb0c50f',
      'Evaluation Number',
-     'Generates evaluation numbers, to identify intake activities
+     'Identifies evaluation-related intake activities,
 in which a lot of one or more collection objects is formally
 acquired for evaluation.',
+     '9',
      '',
 '<org.collectionspace.services.id.SettableIDGenerator>
   <parts>
@@ -169,13 +177,13 @@ acquired for evaluation.',
 -- INTAKE_NUMBER
 
 INSERT INTO `id_generators`
-    (csid, displayname, description, last_generated_id, id_generator_state)
+    (csid, displayname, description, priority, last_generated_id, id_generator_state)
   VALUES 
     ('8088cfa5-c743-4824-bb4d-fb11b12847f7',
      'Intake Number',
-     'Generates intake activity numbers, to identify intake activities
-in which a lot of one or more collection objects enters
-the institution for evaluation.',
+     'Identifies intake activities, in which a lot of one
+or more collection objects enters the institution.',
+     '9',
      '',
 '<org.collectionspace.services.id.SettableIDGenerator>
    <parts>
@@ -201,14 +209,14 @@ the institution for evaluation.',
 -- INTAKE_OBJECT_NUMBER
 
 INSERT INTO `id_generators`
-    (csid, displayname, description, last_generated_id, id_generator_state)
+    (csid, displayname, description, priority, last_generated_id, id_generator_state)
   VALUES 
     ('a91db555-5c53-4996-9918-6712351397a0',
      'Intake Object Number',
-     'Generates intake numbers, to identify individual
-collection objects that enter the institution through
-intake activities, before they are either returned to
-their owner or formally acquired by the institution.',
+     'Identifies individual collection objects that enter
+the institution through intake activities, before they are 
+either returned to their owner or formally acquired.',
+     '9',
      '',
 '<org.collectionspace.services.id.SettableIDGenerator>
   <parts>
@@ -243,12 +251,14 @@ their owner or formally acquired by the institution.',
 -- LIBRARY_NUMBER
 
 INSERT INTO `id_generators`
-    (csid, displayname, description, last_generated_id, id_generator_state)
+    (csid, displayname, description, priority, last_generated_id, id_generator_state)
   VALUES 
     ('80fedaf6-1647-4f30-9f53-a75a3cac2ffd',
      'Library Number',
-     'Generates library numbers, in which a lot of one or more
-collection objects is formally acquired for the library.',
+     'Identifies library-related accession activities,
+in which a lot of one or more collection objects is
+formally acquired for the library.',
+     '9',
      '',
 '<org.collectionspace.services.id.SettableIDGenerator>
    <parts>
@@ -274,12 +284,13 @@ collection objects is formally acquired for the library.',
 -- LOANS_IN_NUMBER
 
 INSERT INTO `id_generators`
-    (csid, displayname, description, last_generated_id, id_generator_state)
+    (csid, displayname, description, priority, last_generated_id, id_generator_state)
   VALUES 
     ('ed87e7c6-0678-4f42-9d33-f671835586ef',
      'Loans-in Number',
-     'Generates loans-in numbers, to identify individual
-collection objects that are received on loan.',
+     'Identifies individual collection objects that are
+received on loan.',
+     '9',
      '',
 '<org.collectionspace.services.id.SettableIDGenerator>
   <parts>
@@ -314,13 +325,14 @@ collection objects that are received on loan.',
 -- STUDY_NUMBER
 
 INSERT INTO `id_generators`
-    (csid, displayname, description, last_generated_id, id_generator_state)
+    (csid, displayname, description, priority, last_generated_id, id_generator_state)
   VALUES 
     ('0518132e-dd8c-4773-8fa9-07c9af4444ee',
      'Study Number',
-     'Generates study numbers, to identify intake activities
-in which a lot of one or more collection objects is formally
-acquired for study.',
+     'Identifies study-related intake activities,
+in which a lot of one or more collection objects is
+formally acquired for study.',
+     '9',
      '',
 '<org.collectionspace.services.id.SettableIDGenerator>
    <parts>
@@ -345,14 +357,20 @@ acquired for study.',
 
 -- UUID
 
+/*
+ * Note: these are Type 4 UUIDs, whose generation is based on
+ * random and pseudo-random parts.
+ */
+
 INSERT INTO `id_generators`
-    (csid, displayname, description, last_generated_id, id_generator_state)
+    (csid, displayname, description, priority, last_generated_id, id_generator_state)
   VALUES 
     ('1fa40353-05b8-4ae6-82a6-44a18b4f3c12',
      'UUID',
-     'Generates universally unique identifiers (UUIDs), which may be
-used for CollectionSpace IDs (CSIDs) and other purposes. (These are
-Type 4 UUIDs, whose generation is based on random and pseudo-random parts.)',
+     'Universally unique identifiers (UUIDs), which may be
+used for CollectionSpace IDs (CSIDs) and any other relevant
+purposes.',
+     '9',
      '',
 '<org.collectionspace.services.id.SettableIDGenerator>
   <parts>