]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
NOJIRA: Adding person, org, and location terms.
authorRichard Millet <remillet@yahoo.com>
Thu, 13 Sep 2018 21:14:04 +0000 (14:14 -0700)
committerRichard Millet <remillet@yahoo.com>
Thu, 13 Sep 2018 21:14:04 +0000 (14:14 -0700)
cspace-ui/build.xml
services/jaxb/src/main/resources/relations_common.xsd
services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityClient.java
services/location/client/src/main/java/org/collectionspace/services/client/LocationAuthorityClientUtils.java
services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClientUtils.java
services/relation/3rdparty/nuxeo-platform-cs-relation/src/main/resources/schemas/relations_common.xsd

index 7fc3444e506cd80b18688e5fd6dc90a6a6382926..8a394507ca2332a5baaa41ce9ded310e7e52d2e3 100644 (file)
        -->
        <target name="download_core">
                <!-- Core UI -->
+               <echo>Downloading from https://unpkg.com/cspace-ui@${cspace.ui.version}/dist/${cspace.ui.webapp.name}.min.js</echo>
+               
                <exec executable="curl"  failonerror="true">
                        <arg line="-o ${cspace.ui.js} --fail --insecure --remote-name --location https://unpkg.com/cspace-ui@${cspace.ui.version}/dist/${cspace.ui.webapp.name}.min.js"/>
                </exec>
index 897a50c8a9f52b1b46a56d6e9860a48112dc7e93..923d1d3fd57e144c73ab1caddb3282b93e8687d9 100644 (file)
@@ -25,6 +25,8 @@
             <xs:sequence>
                <xs:element name="csid" type="xs:string" />
                         
+                <xs:element name="active" type="xs:boolean" default="true" minOccurs="1" maxOccurs="1"/>     <!-- true=active false=soft-deleted -->
+                        
                 <xs:element name="subjectCsid" type="xs:string"  minOccurs="1" maxOccurs="1"/>     <!-- new name for documentId1 -->
                 <xs:element name="subjectDocumentType" type="xs:string"  minOccurs="1" maxOccurs="1"/>     <!-- new name for documentType1 -->
                 <xs:element name="subjectUri" type="xs:string" minOccurs="1"/>
index efe97c7d6105cb3f95792ad7a70a603c4f301943..48238bfe3f1f1fc07eb1676cbe87d93d7b052881 100644 (file)
@@ -90,9 +90,10 @@ public class LocationAuthorityClient extends AuthorityClientImpl<Locationauthori
                return poxPayloadout.asXML();
        }
 
+       
        @Override
        public String createAuthorityItemInstance(String shortIdentifier, String displayName) {
-               // TODO Auto-generated method stub
-               return null;
+        PoxPayloadOut locationAuthorityInstance = LocationAuthorityClientUtils.createLocationInstance(shortIdentifier, displayName, SERVICE_ITEM_COMMON_PART_NAME);
+        return locationAuthorityInstance.asXML();
        }
 }
index 1af7856285b09c23338ed15225473bf408925f7a..15b1cb454337e64c0db020fcbae617ed247117d6 100644 (file)
@@ -3,16 +3,21 @@ package org.collectionspace.services.client;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.core.Response;
-import org.apache.commons.io.FileUtils;
+
 import org.collectionspace.services.LocationJAXBSchema;
+import org.collectionspace.services.PersonJAXBSchema;
 import org.collectionspace.services.client.test.ServiceRequestType;
 import org.collectionspace.services.common.api.Tools;
 import org.collectionspace.services.location.*;
+
+import org.apache.commons.io.FileUtils;
 import org.dom4j.DocumentException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -57,8 +62,10 @@ public class LocationAuthorityClientUtils {
      * @return The PoxPayloadOut payload for the create call
      */
     public static PoxPayloadOut createLocationInstance( 
-               String locationAuthRefName, Map<String, String> locationInfo, 
-                               List<LocTermGroup> terms, String headerLabel){
+               String locationAuthRefName,
+               Map<String, String> locationInfo, 
+               List<LocTermGroup> terms, 
+               String headerLabel) {
         LocationsCommon location = new LocationsCommon();
        String shortId = locationInfo.get(LocationJAXBSchema.SHORT_IDENTIFIER);
        String displayName = locationInfo.get(LocationJAXBSchema.DISPLAY_NAME);
@@ -314,4 +321,30 @@ public class LocationAuthorityClientUtils {
         return "id" + new Date().getTime(); 
    }
 
+    public static PoxPayloadOut createLocationInstance(String shortIdentifier, String displayName,
+            String serviceItemCommonPartName) {
+        List<LocTermGroup> terms = getTermGroupInstance(shortIdentifier, displayName);
+        
+        Map<String, String> locationInfo = new HashMap<String, String>();
+        locationInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortIdentifier);
+
+        return createLocationInstance(null, locationInfo, terms, serviceItemCommonPartName);
+    }
+
+    private static List<LocTermGroup> getTermGroupInstance(String shortIdentifier, String displayName) {
+        if (Tools.isBlank(shortIdentifier)) {
+            shortIdentifier = getGeneratedIdentifier();
+        }
+        if (Tools.isBlank(shortIdentifier)) {
+            displayName = shortIdentifier;
+        }
+        
+        List<LocTermGroup> terms = new ArrayList<LocTermGroup>();
+        LocTermGroup term = new LocTermGroup();
+        term.setTermDisplayName(displayName);
+        term.setTermName(shortIdentifier);
+        terms.add(term);
+        return terms;
+    }
+
 }
index 9c85b5687d43fc65a5310f13ec6471a19972fec0..5462a357a79e437e2dc30d6c945773585664ec99 100644 (file)
@@ -166,7 +166,7 @@ public class PersonAuthorityClientUtils {
        personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortIdentifier);
 
                return createPersonInstance(null, null, personInfo, terms, null, headerLabel);
-       }    
+       }
     
     /**
      * Creates a person instance.
index 2e25c67fd695c4fc012ffeb620fe6edef8165f80..d7f86519babde8a85ba9a32d7156fd8e6ac53ff9 100644 (file)
@@ -24,6 +24,8 @@
        <!-- document-id-2 would be the id of the contained (or child) collectionobject -->
        <!-- document-type-2 would be the doc-type of the collectionobejct -->
        
+       <xs:element name="active" type="xs:boolean" default="true" minOccurs="1" maxOccurs="1"/>     <!-- true=active false=soft-deleted -->
+       
        <xs:element name="subjectCsid" type="xs:string" minOccurs="1"
                maxOccurs="1" />     <!-- new name for documentId1 -->
        <xs:element name="subjectDocumentType" type="xs:string"