]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CODE-6: Rename 'name' field in placeNameGroup to 'placeName' to avoid Advanced Search...
authorRick Jaffe <rjaffe@berkeley.edu>
Thu, 5 Apr 2012 23:53:21 +0000 (16:53 -0700)
committerRick Jaffe <rjaffe@berkeley.edu>
Thu, 5 Apr 2012 23:53:21 +0000 (16:53 -0700)
services/place/3rdparty/nuxeo-platform-cs-place/src/main/resources/schemas/places_common.xsd
services/place/client/src/main/java/org/collectionspace/services/client/PlaceAuthorityClientUtils.java
services/place/client/src/test/java/org/collectionspace/services/client/test/PlaceAuthorityServiceTest.java
services/place/jaxb/src/main/java/org/collectionspace/services/PlaceJAXBSchema.java
services/place/jaxb/src/main/resources/place_common.xsd
services/place/service/src/main/java/org/collectionspace/services/place/nuxeo/PlaceDocumentModelHandler.java

index a59b671c7c16095fb72c02e7edac7ad49d6557a3..393891143e491c1915da2637b86fa04ca1d7cce4 100644 (file)
@@ -68,7 +68,7 @@
 
     <xs:complexType name="placeNameGroup">
         <xs:sequence>
-                       <xs:element name="name" type="xs:string"/>
+                       <xs:element name="placeName" type="xs:string"/>
                        <xs:element name="nameQualifiedName" type="xs:string"/>
                        <xs:element name="nameLanguage" type="xs:string"/>
                        <xs:element name="nameAbbrev" type="xs:string"/>
index b537e8c16a8c51e9ba6f6b1a6f404e92479d0865..75a6138a4f9be650a71160616290002e0d46d85d 100644 (file)
@@ -80,11 +80,11 @@ public class PlaceAuthorityClientUtils {
                        place.setDisplayNameComputed(displayNameComputed);
         /* TODO - think about how much to support. This approach to the client
         * does not scale! We should really favor the document/payload approach. */
-        if((value = (String)placeInfo.get(PlaceJAXBSchema.NAME))!=null) {
+        if((value = (String)placeInfo.get(PlaceJAXBSchema.PLACE_NAME))!=null) {
             PlaceNameGroupList placeNameGroupList = new PlaceNameGroupList();
             List<PlaceNameGroup> placeNameGroups = placeNameGroupList.getPlaceNameGroup();
             PlaceNameGroup placeNameGroup = new PlaceNameGroup();
-            placeNameGroup.setName(value);
+            placeNameGroup.setPlaceName(value);
             placeNameGroups.add(placeNameGroup);
             place.setPlaceNameGroupList(placeNameGroupList);
         }
@@ -131,7 +131,7 @@ public class PlaceAuthorityClientUtils {
                                /* Could try to pull name out of first placeNameGroup
                displayName = 
                        prepareDefaultDisplayName(
-                       placeMap.get(PlaceJAXBSchema.NAME));
+                       placeMap.get(PlaceJAXBSchema.PLACE_NAME));
                                                        */
        }
        
@@ -295,13 +295,13 @@ public class PlaceAuthorityClientUtils {
      * @see PlaceAuthorityDocumentModelHandler.prepareDefaultDisplayName() which
      * duplicates this logic, until we define a service-general utils package
      * that is neither client nor service specific.
-     * @param name     
+     * @param placeName        
      * @return a display name
      */
     public static String prepareDefaultDisplayName(
-               String name ) {
+               String placeName ) {
        StringBuilder newStr = new StringBuilder();
-                       newStr.append(name);
+                       newStr.append(placeName);
                return newStr.toString();
     }
     
index 7186f79bafea77ad4915491f8afe1ed83b5305c0..39cdd129711cee7d8ce0e8df3f040556868d30c1 100644 (file)
@@ -132,7 +132,7 @@ public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest<Plac
         // TODO Make place type and status be controlled vocabs.
         sanjoseMap.put(PlaceJAXBSchema.DISPLAY_NAME, TEST_DNAME);
         sanjoseMap.put(PlaceJAXBSchema.SHORT_IDENTIFIER, TEST_SHORTID);
-        sanjoseMap.put(PlaceJAXBSchema.NAME, TEST_NAME);
+        sanjoseMap.put(PlaceJAXBSchema.PLACE_NAME, TEST_NAME);
         sanjoseMap.put(PlaceJAXBSchema.NOTE, TEST_NOTE);
         sanjoseMap.put(PlaceJAXBSchema.SOURCE, TEST_SOURCE);
         sanjoseMap.put(PlaceJAXBSchema.SOURCE_PAGE, TEST_SOURCE_PAGE);
@@ -207,12 +207,12 @@ public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest<Plac
         List<PlaceNameGroup> placeNameGroups = placeNameGroupList.getPlaceNameGroup();
         Assert.assertNotNull(placeNameGroups);
         Assert.assertTrue(placeNameGroups.size() > 0);
-        String name = placeNameGroups.get(0).getName();
-        Assert.assertNotNull(name);
+        String placeName = placeNameGroups.get(0).getPlaceName();
+        Assert.assertNotNull(placeName);
 
         // Update the contents of this resource.
         final String PLACE_NAME_ADDITION = "verify-item-place-name-updated";
-        placeNameGroups.get(0).setName(PLACE_NAME_ADDITION + TEST_NAME);
+        placeNameGroups.get(0).setPlaceName(PLACE_NAME_ADDITION + TEST_NAME);
         place.setPlaceNameGroupList(placeNameGroupList);
         if (logger.isDebugEnabled()) {
             logger.debug("to be updated Place");
@@ -579,20 +579,20 @@ public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest<Plac
        @Override
        protected PlacesCommon updateItemInstance(PlacesCommon placesCommon) {
                
-                // Get the Name field from the resource passed in      
+                // Get the placeName field from the resource passed in      
                 PlaceNameGroupList placeNameGroupList = placesCommon.getPlaceNameGroupList();
                 Assert.assertNotNull(placeNameGroupList);
                 List<PlaceNameGroup> placeNameGroups = placeNameGroupList.getPlaceNameGroup();
                 Assert.assertNotNull(placeNameGroups);
                 Assert.assertTrue(placeNameGroups.size() > 0);
-                String originalName = placeNameGroups.get(0).getName();
-                Assert.assertNotNull(originalName);
+                String originalPlaceName = placeNameGroups.get(0).getPlaceName();
+                Assert.assertNotNull(originalPlaceName);
                 
                 // Update the contents of the new resource based on original value
                 PlaceNameGroupList updatedPlaceNameGroupList = new PlaceNameGroupList();
                 List<PlaceNameGroup> updatedPlaceNameGroups = updatedPlaceNameGroupList.getPlaceNameGroup();
                 PlaceNameGroup updatedPlaceNameGroup = new PlaceNameGroup();
-                updatedPlaceNameGroup.setName("updated-" + originalName);
+                updatedPlaceNameGroup.setPlaceName("updated-" + originalPlaceName);
                 updatedPlaceNameGroups.add(updatedPlaceNameGroup);
                 PlacesCommon result = new PlacesCommon();
                 result.setPlaceNameGroupList(updatedPlaceNameGroupList);
@@ -606,27 +606,27 @@ public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest<Plac
        protected void compareUpdatedItemInstances(PlacesCommon original,
                        PlacesCommon updated) throws Exception {
         
-                // Get the Name fields each resource passed in      
+                // Get the placeName fields each resource passed in      
                 PlaceNameGroupList placeNameGroupList = original.getPlaceNameGroupList();
                 Assert.assertNotNull(placeNameGroupList);
                 List<PlaceNameGroup> placeNameGroups = placeNameGroupList.getPlaceNameGroup();
                 Assert.assertNotNull(placeNameGroups);
                 Assert.assertTrue(placeNameGroups.size() > 0);
-                String originalName = placeNameGroups.get(0).getName();
-                Assert.assertNotNull(originalName);
+                String originalPlaceName = placeNameGroups.get(0).getPlaceName();
+                Assert.assertNotNull(originalPlaceName);
             
                 PlaceNameGroupList updatedPlaceNameGroupList = updated.getPlaceNameGroupList();
                 Assert.assertNotNull(updatedPlaceNameGroupList);
                 List<PlaceNameGroup> updatedPlaceNameGroups = updatedPlaceNameGroupList.getPlaceNameGroup();
                 Assert.assertNotNull(updatedPlaceNameGroups);
                 Assert.assertTrue(updatedPlaceNameGroups.size() > 0);
-                String updatedName = updatedPlaceNameGroups.get(0).getName();
-                Assert.assertNotNull(updatedName);
+                String updatedPlaceName = updatedPlaceNameGroups.get(0).getPlaceName();
+                Assert.assertNotNull(updatedPlaceName);
             
             
             
             
-                Assert.assertEquals(updatedName, originalName,
+                Assert.assertEquals(updatedPlaceName, originalPlaceName,
                     "Data in updated Place did not match submitted data.");
        }
 
@@ -641,7 +641,7 @@ public class PlaceAuthorityServiceTest extends AbstractAuthorityServiceTest<Plac
        protected PoxPayloadOut createNonExistenceItemInstance(
                        String commonPartName, String identifier) {
         Map<String, String> nonexMap = new HashMap<String,String>();
-        nonexMap.put(PlaceJAXBSchema.NAME, TEST_NAME);
+        nonexMap.put(PlaceJAXBSchema.PLACE_NAME, TEST_NAME);
         nonexMap.put(PlaceJAXBSchema.SHORT_IDENTIFIER, "nonEx");
         nonexMap.put(PlaceJAXBSchema.PLACE_TYPE, TEST_PLACE_TYPE);
         nonexMap.put(PlaceJAXBSchema.TERM_STATUS, TEST_STATUS);
index 12fd66b2c2a722a4d56c03e74b21369653551e22..7f8b0446c92535e29f39fe94a4a788613edabb93 100644 (file)
@@ -15,7 +15,7 @@ public interface PlaceJAXBSchema extends AuthorityItemJAXBSchema {
        final static String SHORT_DISPLAY_NAME = "shortDisplayName";
        final static String SHORT_DISPLAY_NAME_COMPUTED = "shortDisplayNameComputed";
         final static String PLACE_NAME_GROUP_LIST = "placeNameGroupList";
-        final static String NAME = "name";
+        final static String PLACE_NAME = "placeName";
        final static String NOTE = "note";
        final static String SOURCE = "source";
        final static String SOURCE_PAGE = "sourcePage";
index 55a38cd2077b72b8ee93543fb66884542ab15754..ca9e6219be94b29804f9b49f9e0b534d7a60dece 100644 (file)
@@ -71,7 +71,7 @@
 
     <xs:complexType name="placeNameGroup">
         <xs:sequence>
-            <xs:element name="name" type="xs:string"/>
+            <xs:element name="placeName" type="xs:string"/>
             <xs:element name="nameQualifiedName" type="xs:string"/>
             <xs:element name="nameLanguage" type="xs:string"/>
             <xs:element name="nameAbbrev" type="xs:string"/>
index 4163faf9f4cc4f2f6903c2e90d1adc181b37eb94..db09a5658597564cad2983be0463fe76cacd0b0f 100644 (file)
@@ -76,10 +76,10 @@ public class PlaceDocumentModelHandler
                shortDisplayNameComputed = true;
        if (displayNameComputed || shortDisplayNameComputed) {
                 // Obtain the primary place name from the list of place names, for computing the display name.
-               String xpathToName = PlaceJAXBSchema.PLACE_NAME_GROUP_LIST 
-                        + "/[0]/" + PlaceJAXBSchema.NAME;
-               String name = getXPathStringValue(docModel, COMMON_PART_LABEL, xpathToName);
-               String displayName = prepareDefaultDisplayName(name);
+               String xpathToPlaceName = PlaceJAXBSchema.PLACE_NAME_GROUP_LIST 
+                        + "/[0]/" + PlaceJAXBSchema.PLACE_NAME;
+               String placeName = getXPathStringValue(docModel, COMMON_PART_LABEL, xpathToPlaceName);
+               String displayName = prepareDefaultDisplayName(placeName);
                if (displayNameComputed) {
                        docModel.setProperty(commonPartLabel, PlaceJAXBSchema.DISPLAY_NAME,
                                        displayName);
@@ -96,14 +96,14 @@ public class PlaceDocumentModelHandler
      * @see PlaceAuthorityClientUtils.prepareDefaultDisplayName() which
      * duplicates this logic, until we define a service-general utils package
      * that is neither client nor service specific.
-     * @param name
+     * @param placeName
      * @return the default display name
      * @throws Exception
      */
     private static String prepareDefaultDisplayName(
-               String name ) throws Exception {
+               String placeName ) throws Exception {
        StringBuilder newStr = new StringBuilder();
-                       newStr.append(name);
+                       newStr.append(placeName);
                        return newStr.toString();
     }