]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-3872 - Fix Location authority schema to put conditionNode and conditionNodeDat...
authorPatrick Schmitz <pschmitz@berkeley.edu>
Thu, 21 Apr 2011 19:06:36 +0000 (19:06 +0000)
committerPatrick Schmitz <pschmitz@berkeley.edu>
Thu, 21 Apr 2011 19:06:36 +0000 (19:06 +0000)
services/location/3rdparty/nuxeo-platform-cs-location/src/main/resources/schemas/locations_common.xsd
services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityClientUtils.java
services/location/client/src/test/java/org/collectionspace/services/client/test/LocationAuthorityServiceTest.java
services/location/jaxb/src/main/java/org/collectionspace/services/LocationJAXBSchema.java
services/location/jaxb/src/main/resources/location_common.xsd

index 62c41681fbfab6ac080c08a8ea6d696b9bb67597..6028c10ecb0d89170934d84ebfc33345c33836d4 100644 (file)
     <xs:element name="shortDisplayName" type="xs:string"/>
     <xs:element name="shortDisplayNameComputed" type="xs:boolean"/>
     <xs:element name="name" type="xs:string"/>
-    <xs:element name="conditionNote" type="xs:string"/>
-    <xs:element name="conditionNoteDate" type="xs:string"/>
+               <xs:element name="conditionGroupList" type="conditionGroupList"/>
     <xs:element name="securityNote" type="xs:string"/>
     <xs:element name="accessNote" type="xs:string"/>
     <xs:element name="address" type="xs:string"/>
     <xs:element name="locationType" type="xs:string"/>
 
+    <xs:complexType name="conditionGroupList">
+        <xs:sequence>
+            <xs:element name="conditionGroup" type="conditionGroup" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="conditionGroup">
+        <xs:sequence>
+                                       <xs:element name="conditionNote" type="xs:string"/>
+                                       <xs:element name="conditionNoteDate" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
+    
 </xs:schema>
 
index eb2f5fadd3e94544bec36782aa700ea311b598ab..d1ab2e8b1c5a99f963807a1cf4a92e78731da4c1 100644 (file)
@@ -14,6 +14,8 @@ import org.apache.commons.io.FileUtils;
 import org.collectionspace.services.LocationJAXBSchema;\r
 import org.collectionspace.services.client.test.ServiceRequestType;\r
 import org.collectionspace.services.location.LocationsCommon;\r
+import org.collectionspace.services.location.ConditionGroupList;\r
+import org.collectionspace.services.location.ConditionGroup;\r
 import org.collectionspace.services.location.LocationauthoritiesCommon;\r
 import org.dom4j.DocumentException;\r
 import org.jboss.resteasy.client.ClientResponse;\r
@@ -54,12 +56,14 @@ public class LocationAuthorityClientUtils {
 \r
     /**\r
      * @param locationRefName  The proper refName for this authority\r
-     * @param locationInfo the properties for the new Location\r
+     * @param locationInfo the properties for the new Location. Can pass in one condition\r
+     *                                                 note and date string.\r
      * @param headerLabel      The common part label\r
      * @return The PoxPayloadOut payload for the create call\r
      */\r
     public static PoxPayloadOut createLocationInstance( \r
-               String locationAuthRefName, Map<String, String> locationInfo, String headerLabel){\r
+               String locationAuthRefName, Map<String, String> locationInfo, \r
+                               String headerLabel){\r
         LocationsCommon location = new LocationsCommon();\r
        String shortId = locationInfo.get(LocationJAXBSchema.SHORT_IDENTIFIER);\r
        String displayName = locationInfo.get(LocationJAXBSchema.DISPLAY_NAME);\r
@@ -72,10 +76,16 @@ public class LocationAuthorityClientUtils {
        location.setDisplayNameComputed(displayNameComputed);\r
         if((value = (String)locationInfo.get(LocationJAXBSchema.NAME))!=null)\r
                location.setName(value);\r
-        if((value = (String)locationInfo.get(LocationJAXBSchema.CONDITION_NOTE))!=null)\r
-               location.setConditionNote(value);\r
-        if((value = (String)locationInfo.get(LocationJAXBSchema.CONDITION_NOTE_DATE))!=null)\r
-               location.setConditionNoteDate(value);\r
+        if((value = (String)locationInfo.get(LocationJAXBSchema.CONDITION_NOTE))!=null) {\r
+            ConditionGroupList conditionGroupList = new ConditionGroupList();\r
+            List<ConditionGroup> conditionGroups = conditionGroupList.getConditionGroup();\r
+            ConditionGroup conditionGroup = new ConditionGroup();\r
+            conditionGroup.setConditionNote(value);\r
+            if((value = (String)locationInfo.get(LocationJAXBSchema.CONDITION_NOTE_DATE))!=null)\r
+               conditionGroup.setConditionNoteDate(value);\r
+            conditionGroups.add(conditionGroup);\r
+            location.setConditionGroupList(conditionGroupList);\r
+        }\r
         if((value = (String)locationInfo.get(LocationJAXBSchema.SECURITY_NOTE))!=null)\r
                location.setSecurityNote(value);\r
         if((value = (String)locationInfo.get(LocationJAXBSchema.ACCESS_NOTE))!=null)\r
@@ -86,6 +96,7 @@ public class LocationAuthorityClientUtils {
                location.setAddress(value);\r
         if((value = (String)locationInfo.get(LocationJAXBSchema.TERM_STATUS))!=null)\r
                location.setTermStatus(value);\r
+\r
         PoxPayloadOut multipart = new PoxPayloadOut(LocationAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);\r
         PayloadOutputPart commonPart = multipart.addPart(location,\r
             MediaType.APPLICATION_XML_TYPE);\r
index 81b3bababd5c2d38d42a73e55cf1905ca5db8657..a35fe76169c3cd67e5469b4a07c2e96718050aa8 100644 (file)
@@ -156,9 +156,10 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
     @Override
     protected PoxPayloadOut createInstance(String identifier) {
        LocationAuthorityClient client = new LocationAuthorityClient();
-        String shortId = createIdentifier();
+        String shortId = identifier;
        String displayName = "displayName-" + shortId;
-       String baseRefName = LocationAuthorityClientUtils.createLocationAuthRefName(shortId, null);
+       String baseRefName = 
+               LocationAuthorityClientUtils.createLocationAuthRefName(shortId, null);
        PoxPayloadOut multipart = 
             LocationAuthorityClientUtils.createLocationAuthorityInstance(
            displayName, shortId, client.getCommonPartName());
@@ -189,7 +190,9 @@ public class LocationAuthorityServiceTest extends AbstractServiceTestImpl { //FI
         LocationAuthorityClient client = new LocationAuthorityClient();
         String shortId = createIdentifier();
        String displayName = "displayName-" + shortId;
-       String baseRefName = LocationAuthorityClientUtils.createLocationAuthRefName(shortId, null);
+       String baseRefName = 
+               LocationAuthorityClientUtils.createLocationAuthRefName(shortId, null);
+       
        PoxPayloadOut multipart = 
             LocationAuthorityClientUtils.createLocationAuthorityInstance(
            displayName, shortId, client.getCommonPartName());
index 1621792a5971ccfa5dc38162fc01e1adefb0f189..65ad36ae981b16b41ca9359c205bea73b93862d7 100644 (file)
@@ -11,6 +11,8 @@ import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
 public interface LocationJAXBSchema extends AuthorityItemJAXBSchema {\r
        final static String LOCATIONS_COMMON = "locations_common";\r
        final static String NAME = "name";\r
+       final static String CONDITION_GROUP_LIST = "conditionGroupList";\r
+       final static String CONDITION_GROUP = "conditionGroup";\r
        final static String CONDITION_NOTE = "conditionNote";\r
        final static String CONDITION_NOTE_DATE = "conditionNoteDate";\r
        final static String SECURITY_NOTE = "securityNote";\r
index 673c55364914e18305ac3f209034f4fc2b55d662..a21d01fa1a22c4b049226bc7f6f90dc4ef32e044 100644 (file)
@@ -30,8 +30,7 @@
                                                            <xs:element name="shortDisplayName" type="xs:string"/>
                                                            <xs:element name="shortDisplayNameComputed" type="xs:boolean"/>
                                                                <xs:element name="name" type="xs:string"/>
-                                                               <xs:element name="conditionNote" type="xs:string"/>
-                                                               <xs:element name="conditionNoteDate" type="xs:string"/>
+                                                               <xs:element name="conditionGroupList" type="conditionGroupList"/>
                                                                <xs:element name="securityNote" type="xs:string"/>
                                                                <xs:element name="accessNote" type="xs:string"/>
                                                                <xs:element name="address" type="xs:string"/>
         </xs:complexType>
     </xs:element>
     
+    <xs:complexType name="conditionGroupList">
+        <xs:sequence>
+            <xs:element name="conditionGroup" type="conditionGroup" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="conditionGroup">
+        <xs:sequence>
+                                       <xs:element name="conditionNote" type="xs:string"/>
+                                       <xs:element name="conditionNoteDate" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
+
     <!-- This is the base class for paginated lists -->
     <xs:complexType name="abstractCommonListItem">
         <xs:annotation>