String predicate = RelationshipType.COLLECTIONOBJECT_INTAKE.toString();
ClientResponse<RelationsCommonList> resultResponse = relationClient.readList(
collectionObjectCsid,
- CollectionobjectsCommon.class.getSimpleName(),
+ null, //CollectionobjectsCommon.class.getSimpleName(),
predicate,
intakeCsid,
- IntakesCommon.class.getSimpleName());
+ null ); //IntakesCommon.class.getSimpleName());
RelationsCommonList relationList = null;
try {
Assert.assertEquals(resultResponse.getStatus(), Response.Status.OK.getStatusCode());
for (String collectionObjectCsid : collectionObjectIDList) {
ClientResponse<RelationsCommonList> resultResponse = relationClient.readList(
intakeCsid,
- IntakesCommon.class.getSimpleName(), //subject
+ null, //IntakesCommon.class.getSimpleName(), //subject
predicate,
collectionObjectCsid,
- CollectionobjectsCommon.class.getSimpleName()); //object
+ null); //CollectionobjectsCommon.class.getSimpleName()); //object
try {
Assert.assertEquals(resultResponse.getStatus(), Response.Status.OK.getStatusCode());
<document name="locations">
<ns2:locations_common xmlns:ns2="http://collectionspace.org/services/location" xmlns:ns3="http://collectionspace.org/services/jaxb">
<shortIdentifier>${shortIdentifier}</shortIdentifier>
- <refName>urn:cspace:org.collectionspace.demo:locationauthority:name(${authShortIdentifier}):location:name(${shortIdentifier})</refName>
+ <!-- <refName>urn:cspace:org.collectionspace.demo:locationauthority:name(${authShortIdentifier}):location:name(${shortIdentifier})</refName> -->
<termStatus>Approved</termStatus>
<displayNameComputed>true</displayNameComputed>
<shortDisplayNameComputed>false</shortDisplayNameComputed>
<?xml version="1.0" encoding="UTF-8"?>\r
<document name="locations">\r
<ns2:locations_common xmlns:ns2="http://collectionspace.org/services/location" xmlns:ns3="http://collectionspace.org/services/jaxb">\r
- <inAuthority>${inAuthority}</inAuthority>\r
+ <!-- <inAuthority>${inAuthority}</inAuthority>\r
<shortIdentifier>${shortIdentifier}</shortIdentifier>\r
- <refName>urn:cspace:org.collectionspace.demo:locationauthority:name(${authShortIdentifier}):location:name(${shortIdentifier})'${name}'</refName>\r
+ <refName>urn:cspace:org.collectionspace.demo:locationauthority:name(${authShortIdentifier}):location:name(${shortIdentifier})'${name}'</refName> -->\r
<displayName>${name}</displayName>\r
<displayNameComputed>false</displayNameComputed>\r
<shortDisplayNameComputed>true</shortDisplayNameComputed>\r
<predicate>hasBroader</predicate>\r
<subject>\r
<csid>${itemCSID}</csid>\r
- <documentType>Locationitem</documentType>\r
+ <!-- <documentType>Locationitem</documentType> -->\r
</subject>\r
<object>\r
<csid>${parentCSID}</csid>\r
- <uri>${parentUri}</uri>\r
- <documentType>Locationitem</documentType>\r
+ <!-- <uri>${parentUri}</uri>\r
+ <documentType>Locationitem</documentType> -->\r
</object>\r
</relation-list-item>\r
<relation-list-item>\r
<predicate>hasBroader</predicate>\r
<subject>\r
<csid>${childCSID}</csid>\r
- <uri>${childUri}</uri>\r
+ <!-- <uri>${childUri}</uri>\r
<documentType>Locationitem</documentType>\r
<name>Child1</name>\r
- <number>2200</number>\r
+ <number>2200</number> -->\r
</subject>\r
<object>\r
<csid>${itemCSID}</csid>\r
- <documentType>Locationitem</documentType>\r
+ <!-- <documentType>Locationitem</documentType>\r
<name>Item</name>\r
- <number>1111</number>\r
+ <number>1111</number> -->\r
</object>\r
</relation-list-item>\r
<relation-list-item>\r
<predicate>hasBroader</predicate>\r
<subject>\r
- <uri>${child2Uri}</uri>\r
<csid>${child2CSID}</csid>\r
+ <!-- <uri>${child2Uri}</uri>\r
<documentType>Locationitem</documentType>\r
<name>Child2</name>\r
- <number>2222</number>\r
+ <number>2222</number> -->\r
</subject>\r
<object>\r
<csid>${itemCSID}</csid>\r
- <documentType>Locationitem</documentType>\r
+ <!-- <documentType>Locationitem</documentType>\r
<name>Item</name>\r
- <number>1111</number>\r
+ <number>1111</number> -->\r
</object>\r
</relation-list-item>\r
<relation-list-item>\r
<predicate>hasBroader</predicate>\r
<subject>\r
- <uri>${child3Uri}</uri>\r
<csid>${child3CSID}</csid>\r
+ <!-- <uri>${child3Uri}</uri>\r
<documentType>Locationitem</documentType>\r
<name>Child3</name>\r
- <number>3333</number>\r
+ <number>3333</number> -->\r
</subject>\r
<object>\r
<csid>${itemCSID}</csid>\r
- <documentType>Locationitem</documentType>\r
+ <!-- <documentType>Locationitem</documentType>\r
<name>Item</name>\r
- <number>1111</number>\r
+ <number>1111</number> -->\r
</object>\r
</relation-list-item>\r
</ns3:relations-common-list>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<document name="locations">\r
+ <ns2:locations_common xmlns:ns2="http://collectionspace.org/services/location" xmlns:ns3="http://collectionspace.org/services/jaxb">\r
+ <shortIdentifier>${shortIdentifier}</shortIdentifier>\r
+ <displayName>${name}</displayName>\r
+ <displayNameComputed>false</displayNameComputed>\r
+ </ns2:locations_common>\r
+ <!-- \r
+ WARNING: ${itemCSID} does NOT get expanded by XmlReplay. \r
+ It passes through and then the service deals with it.\r
+ -->\r
+ <ns3:relations-common-list xmlns:ns3="http://collectionspace.org/services/relation" xmlns:ns2="http://collectionspace.org/services/jaxb">\r
+ <relation-list-item>\r
+ <predicate>hasBroader</predicate>\r
+ <subject>\r
+ <csid>${itemCSID}</csid>\r
+ </subject>\r
+ <object>\r
+ <refName>urn:cspace:core.collectionspace.org:locationauthorities:name(CSPACE3739LocationAuthority):item:name(Aisle3)'Aisle 3'</refName>\r
+ </object>\r
+ </relation-list-item>\r
+ <relation-list-item>\r
+ <predicate>hasBroader</predicate>\r
+ <subject>\r
+ <refName>urn:cspace:core.collectionspace.org:locationauthorities:name(CSPACE3739LocationAuthority):item:name(Shelf1)'Shelf 1'</refName>\r
+ </subject>\r
+ <object>\r
+ <csid>${itemCSID}</csid>\r
+ </object>\r
+ </relation-list-item>\r
+ <relation-list-item>\r
+ <predicate>hasBroader</predicate>\r
+ <subject>\r
+ <refName>urn:cspace:core.collectionspace.org:locationauthorities:name(CSPACE3739LocationAuthority):item:name(Shelf2)'Shelf 2'</refName>\r
+ </subject>\r
+ <object>\r
+ <csid>${itemCSID}</csid>\r
+ </object>\r
+ </relation-list-item>\r
+ <relation-list-item>\r
+ <predicate>hasBroader</predicate>\r
+ <subject>\r
+ <refName>urn:cspace:core.collectionspace.org:locationauthorities:name(CSPACE3739LocationAuthority):item:name(Shelf3)'Shelf 3'</refName>\r
+ </subject>\r
+ <object>\r
+ <csid>${itemCSID}</csid>\r
+ </object>\r
+ </relation-list-item>\r
+ </ns3:relations-common-list>\r
+</document>\r
+\r
+\r
+\r
<var ID="name">Aisle 3</var>
</vars>
</test>
+
+ <test ID="Location1_old">
+ <method>POST</method>
+ <uri>/cspace-services/locationauthorities/urn:cspace:name(CSPACE3739LocationAuthority)/items/</uri>
+ <filename>location/hierarchy/3-locations_w_relations_CSID.xml</filename>
+ <vars>
+ <var ID="name">Cabinet 1</var>
+ <var ID="parentCSID">${LocationParent.CSID}</var>
+ <var ID="childCSID">${LocationChild1.CSID}</var>
+ <var ID="child2CSID">${LocationChild2.CSID}</var>
+ <var ID="child3CSID">${LocationChild3.CSID}</var>
+ </vars>
+ </test>
<test ID="Location1">
<method>POST</method>
<uri>/cspace-services/locationauthorities/urn:cspace:name(CSPACE3739LocationAuthority)/items/</uri>
- <filename>location/hierarchy/3-locations_w_relations.xml</filename>
+ <filename>location/hierarchy/5-locations_w_relations_RefNames.xml</filename>
<vars>
- <var ID="inAuthority">${LocationAuth1.CSID}</var>
- <var ID="authShortIdentifier">CSPACE3739LocationAuthority</var>
- <var ID="shortIdentifier">Cabinet1</var>
- <var ID="name">Cabinet 1</var>
- <var ID="parentCSID">${LocationParent.CSID}</var>
- <var ID="parentUri">/cspace-services/locationauthorities/urn:cspace:name(CSPACE3739LocationAuthority-setting-error-parent)/items/${LocationParent.CSID}</var>
+ <var ID="shortIdentifier">Cabinet1a</var>
+ <var ID="name">Cabinet 1a</var>
<var ID="childCSID">${LocationChild1.CSID}</var>
- <var ID="childUri">/cspace-services/locationauthorities/urn:cspace:name(CSPACE3739LocationAuthority)/items/${LocationChild1.CSID}</var>
<var ID="child2CSID">${LocationChild2.CSID}</var>
- <var ID="child2Uri">/cspace-services/locationauthorities/urn:cspace:name(CSPACE3739LocationAuthority)/items/${LocationChild2.CSID}</var>
<var ID="child3CSID">${LocationChild3.CSID}</var>
- <var ID="child3Uri">/cspace-services/locationauthorities/urn:cspace:name(CSPACE3739LocationAuthority)/items/${LocationChild3.CSID}</var>
</vars>
</test>
<vars>\r
<var ID="inAuthority">${PersonAuth1.CSID}</var>\r
<var ID="authShortIdentifier">CSPACE3739PersonAuthority</var>\r
+ <var ID="shortIdentifier">johnWayneActor1</var>\r
</vars>\r
</test>\r
<test ID="Person2">\r
<run controlFile="acquisitions/acquisitions.xml" testGroup="makeone" />\r
<run controlFile="acquisitions/acquisitions.xml" testGroup="testList" />\r
<run controlFile="relation/relation.xml" testGroup="makeRelations" />\r
- <run controlFile="relation/relation.xml" testGroup="r2only" />\r
+ <!-- No - this test is broken\r
+ <run controlFile="relation/relation.xml" testGroup="r2only" />\r
+ -->\r
<run controlFile="person/person.xml" testGroup="postPerson" />\r
<run controlFile="person/person.xml" testGroup="updatePerson" />\r
<run controlFile="person/person.xml" testGroup="PersonAddRelsDeleteRels" />\r
<!-- CollectionSpace dependencies -->\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <artifactId>org.collectionspace.services.authority.service</artifactId>\r
<version>${project.version}</version>\r
</dependency> \r
<dependency>\r
singletons.add(new RoleResource());
singletons.add(new PermissionResource());
- singletons.add(new VocabularyResource());
- singletons.add(new PersonAuthorityResource());
- singletons.add(new OrgAuthorityResource());
- singletons.add(new LocationAuthorityResource());
- singletons.add(new TaxonomyAuthorityResource());
-
- singletons.add(new AcquisitionResource());
-
+ addResourceToMapAndSingletons(new VocabularyResource());
+ addResourceToMapAndSingletons(new PersonAuthorityResource());
+ addResourceToMapAndSingletons(new OrgAuthorityResource());
+ addResourceToMapAndSingletons(new LocationAuthorityResource());
+ addResourceToMapAndSingletons(new TaxonomyAuthorityResource());
+ addResourceToMapAndSingletons(new AcquisitionResource());
addResourceToMapAndSingletons(new ContactResource());
addResourceToMapAndSingletons(new CollectionObjectResource());
addResourceToMapAndSingletons(new GroupResource());
<!-- CollectionSpace Dependencies -->\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>\r
<optional>true</optional>\r
<version>${project.version}</version>\r
</dependency> \r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>org.collectionspace.services.authority</artifactId>
+ <groupId>org.collectionspace.services</groupId>
+ <version>1.12-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+ <name>services.authority.jaxb</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2-commons</groupId>
+ <artifactId>property-listener-injector</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2_commons</groupId>
+ <artifactId>runtime</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <!-- until we have schemas to compile, we can omit the plugin
+ <build>
+ <finalName>collectionspace-services-authority-jaxb</finalName>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ -->
+</project>
+
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.authority</artifactId>\r
<name>services.authority</name>\r
- <packaging>jar</packaging>\r
+ <packaging>pom</packaging>\r
\r
- <dependencies>\r
- <!-- CollectionSpace dependencies -->\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.common-api</artifactId>\r
- <version>${project.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.jaxb</artifactId>\r
- <version>${project.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.client</artifactId>\r
- <version>${project.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.common</artifactId>\r
- <version>${project.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.authentication.jaxb</artifactId>\r
- <version>${project.version}</version>\r
- <scope>provided</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.authentication.service</artifactId>\r
- <version>${project.version}</version>\r
- <scope>provided</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.authorization.jaxb</artifactId>\r
- <version>${project.version}</version>\r
- <scope>provided</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.authorization.service</artifactId>\r
- <version>${project.version}</version>\r
- <scope>provided</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.relation.service</artifactId>\r
- <version>${project.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.relation.client</artifactId>\r
- <version>${project.version}</version>\r
- </dependency>\r
-\r
-\r
- <!-- Utilities -->\r
-\r
- <dependency>\r
- <groupId>org.slf4j</groupId>\r
- <artifactId>slf4j-api</artifactId>\r
- <scope>provided</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.slf4j</groupId>\r
- <artifactId>slf4j-log4j12</artifactId>\r
- <scope>provided</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>log4j</groupId>\r
- <artifactId>log4j</artifactId>\r
- <version>1.2.14</version>\r
- <scope>provided</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.apache.commons</groupId>\r
- <artifactId>commons-jexl</artifactId>\r
- <version>2.0.1</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>commons-codec</groupId>\r
- <artifactId>commons-codec</artifactId>\r
- <version>1.4</version>\r
- </dependency>\r
-\r
- <!-- javax -->\r
- <dependency>\r
- <groupId>javax.servlet</groupId>\r
- <artifactId>servlet-api</artifactId>\r
- <version>2.5</version>\r
- <scope>provided</scope>\r
- </dependency>\r
-\r
- <dependency>\r
- <groupId>javax.security</groupId>\r
- <artifactId>jaas</artifactId>\r
- <version>1.0.01</version>\r
- <scope>provided</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>javax.security</groupId>\r
- <artifactId>jacc</artifactId>\r
- <version>1.0</version>\r
- <scope>provided</scope>\r
- </dependency>\r
- <!--\r
- <dependency>\r
- <groupId>dom4j</groupId>\r
- <artifactId>dom4j</artifactId>\r
- <version>1.6.1</version>\r
- <scope>provided</scope>\r
- </dependency>\r
- -->\r
- <dependency>\r
- <groupId>mysql</groupId>\r
- <artifactId>mysql-connector-java</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>postgresql</groupId>\r
- <artifactId>postgresql</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>javax.persistence</groupId>\r
- <artifactId>persistence-api</artifactId>\r
- </dependency>\r
-\r
- <dependency>\r
- <groupId>com.sun.xml.bind</groupId>\r
- <artifactId>jaxb-impl</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.jvnet.jaxb2-commons</groupId>\r
- <artifactId>property-listener-injector</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.jvnet.jaxb2_commons</groupId>\r
- <artifactId>runtime</artifactId>\r
- </dependency>\r
-\r
- <!-- jboss -->\r
- <dependency>\r
- <groupId>org.jboss.resteasy</groupId>\r
- <artifactId>jaxrs-api</artifactId>\r
- </dependency> \r
- <dependency>\r
- <groupId>org.jboss.resteasy</groupId>\r
- <artifactId>resteasy-jaxrs</artifactId>\r
- <exclusions>\r
- <exclusion>\r
- <groupId>tjws</groupId>\r
- <artifactId>webserver</artifactId>\r
- </exclusion>\r
- </exclusions>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.jboss.resteasy</groupId>\r
- <artifactId>resteasy-jaxb-provider</artifactId>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.jboss.resteasy</groupId>\r
- <artifactId>resteasy-multipart-provider</artifactId>\r
- </dependency>\r
-\r
- <dependency>\r
- <groupId>org.hibernate</groupId>\r
- <artifactId>hibernate-entitymanager</artifactId>\r
- </dependency>\r
- <!-- jboss -->\r
- <dependency>\r
- <groupId>jboss</groupId>\r
- <artifactId>jbosssx</artifactId>\r
- <version>4.2.3.GA</version>\r
- <scope>provided</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>jboss</groupId>\r
- <artifactId>jboss-remoting</artifactId>\r
- <version>2.2.2.SP8</version>\r
- <scope>provided</scope>\r
- </dependency>\r
- <!-- nuxeo -->\r
- <dependency>\r
- <groupId>org.nuxeo.ecm.platform</groupId>\r
- <artifactId>nuxeo-platform-mimetype-api</artifactId>\r
- <version>${nuxeo.platform.version}</version>\r
- </dependency> \r
- <dependency>\r
- <groupId>org.nuxeo.ecm.platform</groupId>\r
- <artifactId>nuxeo-platform-imaging-core</artifactId>\r
- <version>${nuxeo.platform.version}</version>\r
- </dependency> \r
- <dependency>\r
- <groupId>org.nuxeo.ecm.platform</groupId>\r
- <artifactId>nuxeo-platform-imaging-api</artifactId>\r
- <version>${nuxeo.platform.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.nuxeo.ecm.platform</groupId>\r
- <artifactId>nuxeo-platform-filemanager-api</artifactId>\r
- <version>${nuxeo.platform.version}</version> \r
- </dependency>\r
- <dependency>\r
- <groupId>org.nuxeo.common</groupId>\r
- <artifactId>nuxeo-common</artifactId>\r
- <version>${nuxeo.core.version}</version>\r
- <scope>provided</scope>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.nuxeo.runtime</groupId>\r
- <artifactId>nuxeo-runtime</artifactId>\r
- <version>${nuxeo.core.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.nuxeo.ecm.core</groupId>\r
- <artifactId>nuxeo-core-api</artifactId>\r
- <version>${nuxeo.core.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.nuxeo.ecm.core</groupId>\r
- <artifactId>nuxeo-core-client</artifactId>\r
- <version>${nuxeo.core.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.nuxeo.ecm.core</groupId>\r
- <artifactId>nuxeo-core-query</artifactId>\r
- <version>${nuxeo.core.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.nuxeo.ecm.core</groupId>\r
- <artifactId>nuxeo-core-schema</artifactId>\r
- <version>${nuxeo.core.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.nuxeo.ecm.core</groupId>\r
- <artifactId>nuxeo-core-storage-sql</artifactId>\r
- <version>${nuxeo.core.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.nuxeo.ecm.core</groupId>\r
- <artifactId>nuxeo-core-io</artifactId>\r
- <version>${nuxeo.core.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.nuxeo.ecm.core</groupId>\r
- <artifactId>nuxeo-core-facade</artifactId>\r
- <version>${nuxeo.core.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.nuxeo.ecm.core</groupId>\r
- <artifactId>nuxeo-core-io</artifactId>\r
- <version>${nuxeo.core.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.nuxeo.runtime</groupId>\r
- <artifactId>nuxeo-runtime-osgi</artifactId>\r
- <version>${nuxeo.core.version}</version>\r
- </dependency>\r
- <dependency>\r
- <groupId>org.osgi</groupId>\r
- <artifactId>org.osgi.core</artifactId>\r
- <version>4.1.0</version>\r
- </dependency>\r
- </dependencies>\r
+ <modules>\r
+ <module>jaxb</module>\r
+ <module>service</module>\r
+ </modules>\r
</project>\r
\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0" \r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" \r
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+ <parent>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.main</artifactId>\r
+ <version>1.12-SNAPSHOT</version>\r
+ </parent>\r
+\r
+ <modelVersion>4.0.0</modelVersion>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority.service</artifactId>\r
+ <name>services.authority</name>\r
+ <packaging>jar</packaging>\r
+\r
+ <dependencies>\r
+ <!-- CollectionSpace dependencies -->\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.common-api</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.jaxb</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.client</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.common</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authentication.jaxb</artifactId>\r
+ <version>${project.version}</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authentication.service</artifactId>\r
+ <version>${project.version}</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authorization.jaxb</artifactId>\r
+ <version>${project.version}</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authorization.service</artifactId>\r
+ <version>${project.version}</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.relation.service</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.relation.client</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+\r
+\r
+ <!-- Utilities -->\r
+\r
+ <dependency>\r
+ <groupId>org.slf4j</groupId>\r
+ <artifactId>slf4j-api</artifactId>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.slf4j</groupId>\r
+ <artifactId>slf4j-log4j12</artifactId>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>log4j</groupId>\r
+ <artifactId>log4j</artifactId>\r
+ <version>1.2.14</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.apache.commons</groupId>\r
+ <artifactId>commons-jexl</artifactId>\r
+ <version>2.0.1</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>commons-codec</groupId>\r
+ <artifactId>commons-codec</artifactId>\r
+ <version>1.4</version>\r
+ </dependency>\r
+\r
+ <!-- javax -->\r
+ <dependency>\r
+ <groupId>javax.servlet</groupId>\r
+ <artifactId>servlet-api</artifactId>\r
+ <version>2.5</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+\r
+ <dependency>\r
+ <groupId>javax.security</groupId>\r
+ <artifactId>jaas</artifactId>\r
+ <version>1.0.01</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>javax.security</groupId>\r
+ <artifactId>jacc</artifactId>\r
+ <version>1.0</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <!--\r
+ <dependency>\r
+ <groupId>dom4j</groupId>\r
+ <artifactId>dom4j</artifactId>\r
+ <version>1.6.1</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ -->\r
+ <dependency>\r
+ <groupId>mysql</groupId>\r
+ <artifactId>mysql-connector-java</artifactId>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>postgresql</groupId>\r
+ <artifactId>postgresql</artifactId>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>javax.persistence</groupId>\r
+ <artifactId>persistence-api</artifactId>\r
+ </dependency>\r
+\r
+ <dependency>\r
+ <groupId>com.sun.xml.bind</groupId>\r
+ <artifactId>jaxb-impl</artifactId>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jvnet.jaxb2-commons</groupId>\r
+ <artifactId>property-listener-injector</artifactId>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jvnet.jaxb2_commons</groupId>\r
+ <artifactId>runtime</artifactId>\r
+ </dependency>\r
+\r
+ <!-- jboss -->\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>jaxrs-api</artifactId>\r
+ </dependency> \r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-jaxrs</artifactId>\r
+ <exclusions>\r
+ <exclusion>\r
+ <groupId>tjws</groupId>\r
+ <artifactId>webserver</artifactId>\r
+ </exclusion>\r
+ </exclusions>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-jaxb-provider</artifactId>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-multipart-provider</artifactId>\r
+ </dependency>\r
+\r
+ <dependency>\r
+ <groupId>org.hibernate</groupId>\r
+ <artifactId>hibernate-entitymanager</artifactId>\r
+ </dependency>\r
+ <!-- jboss -->\r
+ <dependency>\r
+ <groupId>jboss</groupId>\r
+ <artifactId>jbosssx</artifactId>\r
+ <version>4.2.3.GA</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>jboss</groupId>\r
+ <artifactId>jboss-remoting</artifactId>\r
+ <version>2.2.2.SP8</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <!-- nuxeo -->\r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.platform</groupId>\r
+ <artifactId>nuxeo-platform-mimetype-api</artifactId>\r
+ <version>${nuxeo.platform.version}</version>\r
+ </dependency> \r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.platform</groupId>\r
+ <artifactId>nuxeo-platform-imaging-core</artifactId>\r
+ <version>${nuxeo.platform.version}</version>\r
+ </dependency> \r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.platform</groupId>\r
+ <artifactId>nuxeo-platform-imaging-api</artifactId>\r
+ <version>${nuxeo.platform.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.platform</groupId>\r
+ <artifactId>nuxeo-platform-filemanager-api</artifactId>\r
+ <version>${nuxeo.platform.version}</version> \r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.nuxeo.common</groupId>\r
+ <artifactId>nuxeo-common</artifactId>\r
+ <version>${nuxeo.core.version}</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.nuxeo.runtime</groupId>\r
+ <artifactId>nuxeo-runtime</artifactId>\r
+ <version>${nuxeo.core.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.core</groupId>\r
+ <artifactId>nuxeo-core-api</artifactId>\r
+ <version>${nuxeo.core.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.core</groupId>\r
+ <artifactId>nuxeo-core-client</artifactId>\r
+ <version>${nuxeo.core.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.core</groupId>\r
+ <artifactId>nuxeo-core-query</artifactId>\r
+ <version>${nuxeo.core.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.core</groupId>\r
+ <artifactId>nuxeo-core-schema</artifactId>\r
+ <version>${nuxeo.core.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.core</groupId>\r
+ <artifactId>nuxeo-core-storage-sql</artifactId>\r
+ <version>${nuxeo.core.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.core</groupId>\r
+ <artifactId>nuxeo-core-io</artifactId>\r
+ <version>${nuxeo.core.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.core</groupId>\r
+ <artifactId>nuxeo-core-facade</artifactId>\r
+ <version>${nuxeo.core.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.core</groupId>\r
+ <artifactId>nuxeo-core-io</artifactId>\r
+ <version>${nuxeo.core.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.nuxeo.runtime</groupId>\r
+ <artifactId>nuxeo-runtime-osgi</artifactId>\r
+ <version>${nuxeo.core.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.osgi</groupId>\r
+ <artifactId>org.osgi.core</artifactId>\r
+ <version>4.1.0</version>\r
+ </dependency>\r
+ </dependencies>\r
+</project>\r
+\r
import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.common.ClientType;
import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.ServiceMain;
import org.collectionspace.services.common.ServiceMessages;
import org.collectionspace.services.common.XmlTools;
return itemcsid;
}
+ /*
+ * Generally, callers will first call RefName.AuthorityItem.parse with a refName, and then
+ * use the returned item.inAuthority.resource and a resourceMap to get a service-specific
+ * Resource. They then call this method on that resource.
+ */
+ @Override
+ public DocumentModel getDocModelForAuthorityItem(RefName.AuthorityItem item)
+ throws Exception, DocumentNotFoundException {
+ if(item == null) {
+ return null;
+ }
+ String whereClause = buildWhereForAuthByName(item.getParentShortIdentifier());
+ // Ensure we have the right context.
+ ServiceContext ctx = createServiceContext(item.inAuthority.resource);
+
+ String parentcsid = getRepositoryClient(ctx).findDocCSID(ctx, whereClause);
+
+ String itemWhereClause = buildWhereForAuthItemByName(item.getShortIdentifier(), parentcsid);
+ ctx = createServiceContext(getItemServiceName());
+ DocumentWrapper<DocumentModel> docWrapper = getRepositoryClient(ctx).findDoc(ctx, itemWhereClause);
+ DocumentModel docModel = docWrapper.getWrappedObject();
+ return docModel;
+ }
+
+
@POST
public Response createAuthority(String xmlPayload) {
try {
*************************************************************************/
@POST
@Path("{csid}/items")
- public Response createAuthorityItem(@Context UriInfo ui, @PathParam("csid") String specifier, String xmlPayload) {
+ public Response createAuthorityItem(@Context ResourceMap resourceMap, @Context UriInfo ui,
+ @PathParam("csid") String specifier, String xmlPayload) {
try {
PoxPayloadIn input = new PoxPayloadIn(xmlPayload);
ServiceContext ctx = createServiceContext(getItemServiceName(), input);
+ ctx.setResourceMap(resourceMap);
ctx.setUriInfo(ui); //Laramie
// Note: must have the parentShortId, to do the create.
@PUT
@Path("{csid}/items/{itemcsid}")
public byte[] updateAuthorityItem(
+ @Context ResourceMap resourceMap,
@Context UriInfo ui,
@PathParam("csid") String parentspecifier,
@PathParam("itemcsid") String itemspecifier,
String parentcsid = lookupParentCSID(parentspecifier, "updateAuthorityItem(parent)", "UPDATE_ITEM", null);
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(getItemServiceName(), theUpdate);
+ ctx.setResourceMap(resourceMap);
String itemcsid = lookupItemCSID(itemspecifier, parentcsid, "updateAuthorityItem(item)", "UPDATE_ITEM", ctx);
// We omit the parentShortId, only needed when doing a create...
public void handleCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
// first fill all the parts of the document
super.handleCreate(wrapDoc);
+ // Ensure we have required fields set properly
handleInAuthority(wrapDoc.getWrappedObject());
+
handleComputedDisplayNames(wrapDoc.getWrappedObject());
String displayName = (String) wrapDoc.getWrappedObject().getProperty(authorityItemCommonSchemaName,
AuthorityItemJAXBSchema.DISPLAY_NAME);
logger.warn("Creating Authority Item with no displayName!");
}
// CSPACE-3178:
- // Uncomment once debugged and App layer is read to integrate
- // Experimenting with these uncommented now ...
handleDisplayNameAsShortIdentifier(wrapDoc.getWrappedObject(), authorityItemCommonSchemaName);
+ // refName includes displayName, so we force a correct value here.
updateRefnameForAuthorityItem(wrapDoc, authorityItemCommonSchemaName, getAuthorityRefNameBase());
}
public void fillAllParts(DocumentWrapper<DocumentModel> wrapDoc, Action action) throws Exception {
super.fillAllParts(wrapDoc, action);
+ /*
ServiceContext ctx = getServiceContext();
PoxPayloadIn input = (PoxPayloadIn) ctx.getInput();
DocumentModel documentModel = (wrapDoc.getWrappedObject());
PayloadOutputPart payloadOutputPart = new PayloadOutputPart(RelationClient.SERVICE_COMMON_LIST_NAME, relationsCommonList);
ctx.setProperty(RelationClient.SERVICE_COMMON_LIST_NAME, payloadOutputPart);
+ */
+ }
+
+ public void completeCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+ super.completeCreate(wrapDoc);
+ handleRelationsPayload(wrapDoc, false);
}
public void completeUpdate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
super.completeUpdate(wrapDoc);
- //now we add part for relations list
- ServiceContext ctx = getServiceContext();
- PayloadOutputPart foo = (PayloadOutputPart) ctx.getProperty(RelationClient.SERVICE_COMMON_LIST_NAME);
- ((PoxPayloadOut) ctx.getOutput()).addPart(foo);
+ handleRelationsPayload(wrapDoc, true);
handleItemRefNameReferenceUpdate();
}
+
+ // Note that we must do this after we have completed the Update, so that the repository has the
+ // info for the item itself. The relations code must call into the repo to get info for each end.
+ // This could be optimized to pass in the parent docModel, since it will often be one end.
+ // Nevertheless, we should complete the item save before we do work on the relations, especially
+ // since a save on Create might fail, and we would not want to create relations for something
+ // that may not be created...
+ private void handleRelationsPayload(DocumentWrapper<DocumentModel> wrapDoc, boolean fUpdate) throws Exception {
+ ServiceContext ctx = getServiceContext();
+ PoxPayloadIn input = (PoxPayloadIn) ctx.getInput();
+ DocumentModel documentModel = (wrapDoc.getWrappedObject());
+ String itemCsid = documentModel.getName();
+
+ //Updates relations part
+ RelationsCommonList relationsCommonList = updateRelations(itemCsid, input, wrapDoc, fUpdate);
+
+ PayloadOutputPart payloadOutputPart = new PayloadOutputPart(RelationClient.SERVICE_COMMON_LIST_NAME, relationsCommonList);
+ ctx.setProperty(RelationClient.SERVICE_COMMON_LIST_NAME, payloadOutputPart);
+
+ //now we add part for relations list
+ //ServiceContext ctx = getServiceContext();
+ //PayloadOutputPart foo = (PayloadOutputPart) ctx.getProperty(RelationClient.SERVICE_COMMON_LIST_NAME);
+ ((PoxPayloadOut) ctx.getOutput()).addPart(payloadOutputPart);
+ }
/** updateRelations strategy:
child-b parent-d child-c
parent-a
*/
- public RelationsCommonList updateRelations(String itemCSID, PoxPayloadIn input, DocumentWrapper<DocumentModel> wrapDoc)
+ private RelationsCommonList updateRelations(
+ String itemCSID, PoxPayloadIn input, DocumentWrapper<DocumentModel> wrapDoc, boolean fUpdate)
throws Exception {
+ if(logger.isTraceEnabled()) {
+ logger.trace("AuthItemDocHndler.updateRelations for: "+itemCSID);
+ }
PayloadInputPart part = input.getPart(RelationClient.SERVICE_COMMON_LIST_NAME); //input.getPart("relations_common");
if (part == null) {
return null; //nothing to do--they didn't send a list of relations.
}
RelationsCommonList relationsCommonListBody = (RelationsCommonList) part.getBody();
+ List<RelationsCommonList.RelationListItem> inboundList = relationsCommonListBody.getRelationListItem();
+ List<RelationsCommonList.RelationListItem> actionList = newList();
+ List<RelationsCommonList.RelationListItem> childList = null;
+ List<RelationsCommonList.RelationListItem> parentList = null;
+ DocumentModel docModel = wrapDoc.getWrappedObject();
ServiceContext ctx = getServiceContext();
- UriInfo uriInfo = ctx.getUriInfo();
- MultivaluedMap queryParams = uriInfo.getQueryParameters();
-
- //Run getList() once as sent to get childListOuter:
- String predicate = RelationshipType.HAS_BROADER.value();
- queryParams.putSingle(IRelationsManager.PREDICATE_QP, predicate);
- queryParams.putSingle(IRelationsManager.SUBJECT_QP, null);
- queryParams.putSingle(IRelationsManager.SUBJECT_TYPE_QP, null);
- queryParams.putSingle(IRelationsManager.OBJECT_QP, itemCSID);
- queryParams.putSingle(IRelationsManager.OBJECT_TYPE_QP, null);
- RelationsCommonList childListOuter = (new RelationResource()).getList(ctx.getUriInfo()); //magically knows all query params because they are in the context.
-
- //Now run getList() again, leaving predicate, swapping subject and object, to get parentListOuter.
- queryParams.putSingle(IRelationsManager.PREDICATE_QP, predicate);
- queryParams.putSingle(IRelationsManager.SUBJECT_QP, itemCSID);
- queryParams.putSingle(IRelationsManager.OBJECT_QP, null);
- RelationsCommonList parentListOuter = (new RelationResource()).getList(ctx.getUriInfo());
+ //Do magic replacement of ${itemCSID} and fix URI's.
+ fixupInboundListItems(ctx, inboundList, docModel, itemCSID);
String HAS_BROADER = RelationshipType.HAS_BROADER.value();
+ UriInfo uriInfo = ctx.getUriInfo();
+ MultivaluedMap queryParams = uriInfo.getQueryParameters();
- List<RelationsCommonList.RelationListItem> inboundList = relationsCommonListBody.getRelationListItem();
- List<RelationsCommonList.RelationListItem> actionList = newList();
- List<RelationsCommonList.RelationListItem> childList = childListOuter.getRelationListItem();
- List<RelationsCommonList.RelationListItem> parentList = parentListOuter.getRelationListItem();
-
- if (parentList.size() > 1) {
- throw new Exception("Too many parents for object: " + itemCSID + " list: " + dumpList(parentList, "parentList"));
+ if(fUpdate) {
+ //Run getList() once as sent to get childListOuter:
+ String predicate = RelationshipType.HAS_BROADER.value();
+ queryParams.putSingle(IRelationsManager.PREDICATE_QP, predicate);
+ queryParams.putSingle(IRelationsManager.SUBJECT_QP, null);
+ queryParams.putSingle(IRelationsManager.SUBJECT_TYPE_QP, null);
+ queryParams.putSingle(IRelationsManager.OBJECT_QP, itemCSID);
+ queryParams.putSingle(IRelationsManager.OBJECT_TYPE_QP, null);
+ RelationsCommonList childListOuter = (new RelationResource()).getList(ctx.getUriInfo()); //magically knows all query params because they are in the context.
+
+ //Now run getList() again, leaving predicate, swapping subject and object, to get parentListOuter.
+ queryParams.putSingle(IRelationsManager.PREDICATE_QP, predicate);
+ queryParams.putSingle(IRelationsManager.SUBJECT_QP, itemCSID);
+ queryParams.putSingle(IRelationsManager.OBJECT_QP, null);
+ RelationsCommonList parentListOuter = (new RelationResource()).getList(ctx.getUriInfo());
+
+
+ childList = childListOuter.getRelationListItem();
+ parentList = parentListOuter.getRelationListItem();
+
+ if (parentList.size() > 1) {
+ throw new Exception("Too many parents for object: " + itemCSID + " list: " + dumpList(parentList, "parentList"));
+ }
+
+ if(logger.isTraceEnabled()) {
+ logger.trace("AuthItemDocHndler.updateRelations for: "+itemCSID+" got existing relations.");
+ }
}
- DocumentModel docModel = wrapDoc.getWrappedObject();
-
- //Do magic replacement of ${itemCSID} and fix URI's.
- fixupInboundListItems(ctx, inboundList, docModel, itemCSID);
for (RelationsCommonList.RelationListItem inboundItem : inboundList) {
- if (inboundItem.getObject().getCsid().equals(itemCSID) && inboundItem.getPredicate().equals(HAS_BROADER)) {
+ // Note that the relations may specify the other (non-item) bit with a refName, not a CSID,
+ // and so the CSID for those may be null
+ if (itemCSID.equals(inboundItem.getObject().getCsid())
+ && inboundItem.getPredicate().equals(HAS_BROADER)) {
//then this is an item that says we have a child. That child is inboundItem
- RelationsCommonList.RelationListItem childItem = findInList(childList, inboundItem);
+ RelationsCommonList.RelationListItem childItem =
+ (childList==null)?null:findInList(childList, inboundItem);
if (childItem != null) {
removeFromList(childList, childItem); //exists, just take it off delete list
} else {
}
ensureChildHasNoOtherParents(ctx, queryParams, inboundItem.getSubject().getCsid());
- } else if (inboundItem.getSubject().getCsid().equals(itemCSID) && inboundItem.getPredicate().equals(HAS_BROADER)) {
+ } else if (itemCSID.equals(inboundItem.getSubject().getCsid())
+ && inboundItem.getPredicate().equals(HAS_BROADER)) {
//then this is an item that says we have a parent. inboundItem is that parent.
- RelationsCommonList.RelationListItem parentItem = findInList(parentList, inboundItem);
+ RelationsCommonList.RelationListItem parentItem =
+ (parentList==null)?null:findInList(parentList, inboundItem);
if (parentItem != null) {
removeFromList(parentList, parentItem); //exists, just take it off delete list
} else {
//not dealing with: hasNarrower or any other predicate.
}
}
- String dump = dumpLists(itemCSID, parentList, childList, actionList);
- //System.out.println("====dump====="+CR+dump);
- logger.info("~~~~~~~~~~~~~~~~~~~~~~dump~~~~~~~~~~~~~~~~~~~~~~~~" + CR + dump);
- deleteRelations(parentList, ctx, "parentList"); //todo: there are items appearing on both lists....april 20.
- deleteRelations(childList, ctx, "childList");
+ if(logger.isTraceEnabled()) {
+ String dump = dumpLists(itemCSID, parentList, childList, actionList);
+ //System.out.println("====dump====="+CR+dump);
+ logger.trace("~~~~~~~~~~~~~~~~~~~~~~dump~~~~~~~~~~~~~~~~~~~~~~~~" + CR + dump);
+ }
+ if(fUpdate) {
+ if(logger.isTraceEnabled()) {
+ logger.trace("AuthItemDocHndler.updateRelations for: "+itemCSID+" deleting "
+ +parentList.size()+" existing parents and "+childList.size()+" existing children.");
+ }
+ deleteRelations(parentList, ctx, "parentList"); //todo: there are items appearing on both lists....april 20.
+ deleteRelations(childList, ctx, "childList");
+ }
+ if(logger.isTraceEnabled()) {
+ logger.trace("AuthItemDocHndler.updateRelations for: "+itemCSID+" adding "
+ +actionList.size()+" new parents and children.");
+ }
createRelations(actionList, ctx);
+ if(logger.isTraceEnabled()) {
+ logger.trace("AuthItemDocHndler.updateRelations for: "+itemCSID+" done.");
+ }
//We return all elements on the inbound list, since we have just worked to make them exist in the system
// and be non-redundant, etc. That list came from relationsCommonListBody, so it is still attached to it, just pass that back.
return relationsCommonListBody;
RelationsDocListItem inboundItemObject = inboundItem.getObject();
RelationsDocListItem inboundItemSubject = inboundItem.getSubject();
- if (inboundItemObject.getCsid().equalsIgnoreCase(CommonAPI.AuthorityItemCSID_REPLACE)) {
+ if (CommonAPI.AuthorityItemCSID_REPLACE.equalsIgnoreCase(inboundItemObject.getCsid())) {
inboundItem.setObjectCsid(itemCSID);
inboundItemObject.setCsid(itemCSID);
- inboundItemObject.setUri(getUri(docModel));
+ //inboundItemObject.setUri(getUri(docModel));
} else {
+ /*
String objectCsid = inboundItemObject.getCsid();
DocumentModel itemDocModel = NuxeoUtils.getDocFromCsid(getRepositorySession(), ctx, objectCsid); //null if not found.
DocumentWrapper wrapper = new DocumentWrapperImpl(itemDocModel);
String uri = this.getRepositoryClient(ctx).getDocURI(wrapper);
inboundItemObject.setUri(uri); //CSPACE-4037
+ */
}
- uriPointsToSameAuthority(thisURI, inboundItemObject.getUri()); //CSPACE-4042
+ //uriPointsToSameAuthority(thisURI, inboundItemObject.getUri()); //CSPACE-4042
- if (inboundItemSubject.getCsid().equalsIgnoreCase(CommonAPI.AuthorityItemCSID_REPLACE)) {
+ if (CommonAPI.AuthorityItemCSID_REPLACE.equalsIgnoreCase(inboundItemSubject.getCsid())) {
inboundItem.setSubjectCsid(itemCSID);
inboundItemSubject.setCsid(itemCSID);
- inboundItemSubject.setUri(getUri(docModel));
+ //inboundItemSubject.setUri(getUri(docModel));
} else {
+ /*
String subjectCsid = inboundItemSubject.getCsid();
DocumentModel itemDocModel = NuxeoUtils.getDocFromCsid(getRepositorySession(), ctx, subjectCsid); //null if not found.
DocumentWrapper wrapper = new DocumentWrapperImpl(itemDocModel);
String uri = this.getRepositoryClient(ctx).getDocURI(wrapper);
inboundItemSubject.setUri(uri); //CSPACE-4037
+ */
}
- uriPointsToSameAuthority(thisURI, inboundItemSubject.getUri()); //CSPACE-4042
+ //uriPointsToSameAuthority(thisURI, inboundItemSubject.getUri()); //CSPACE-4042
}
}
- public RepositoryClient getRepositoryClient(ServiceContext ctx) {
- RepositoryClient repositoryClient = RepositoryClientFactory.getInstance().getClient(ctx.getRepositoryClientName());
- return repositoryClient;
- }
-
// this method calls the RelationResource to have it create the relations and persist them.
- private void createRelations(List<RelationsCommonList.RelationListItem> inboundList, ServiceContext ctx) {
+ private void createRelations(List<RelationsCommonList.RelationListItem> inboundList, ServiceContext ctx) throws Exception {
for (RelationsCommonList.RelationListItem item : inboundList) {
RelationsCommon rc = new RelationsCommon();
//rc.setCsid(item.getCsid());
RelationsDocListItem itemSubject = item.getSubject();
RelationsDocListItem itemObject = item.getObject();
+ // Set at least one of CSID and refName for Subject and Object
+ // Either value might be null for for each of Subject and Object
String subjectCsid = itemSubject.getCsid();
rc.setSubjectCsid(subjectCsid);
rc.setDocumentId1(subjectCsid); // populate legacy field for backward compatibility
//RelationshipType foo = (RelationshipType.valueOf(item.getPredicate())) ;
//rc.setPredicate(foo); //this must be one of the type found in the enum in services/jaxb/src/main/resources/relations_common.xsd
+ // This is superfluous, since it will be fetched by the Relations Create logic.
rc.setSubjectDocumentType(itemSubject.getDocumentType());
rc.setObjectDocumentType(itemObject.getDocumentType());
// populate legacy fields for backward compatibility
rc.setDocumentType1(itemSubject.getDocumentType());
rc.setDocumentType2(itemObject.getDocumentType());
+ // This is superfluous, since it will be fetched by the Relations Create logic.
rc.setSubjectUri(itemSubject.getUri());
rc.setObjectUri(itemObject.getUri());
+ // May not have the info here. Only really require CSID or refName.
+ // Rest is handled in the Relation create mechanism
+ //uriPointsToSameAuthority(itemSubject.getUri(), itemObject.getUri());
PoxPayloadOut payloadOut = new PoxPayloadOut(RelationClient.SERVICE_PAYLOAD_NAME);
PayloadOutputPart outputPart = new PayloadOutputPart(RelationClient.SERVICE_COMMONPART_NAME, rc);
payloadOut.addPart(outputPart);
//System.out.println("\r\n==== TO CREATE: "+rc.getDocumentId1()+"==>"+rc.getPredicate()+"==>"+rc.getDocumentId2());
RelationResource relationResource = new RelationResource();
- Object res = relationResource.create(ctx.getUriInfo(), payloadOut.toXML()); //NOTE ui recycled from above to pass in unknown query params.
+ Object res = relationResource.create(ctx.getResourceMap(),
+ ctx.getUriInfo(), payloadOut.toXML()); //NOTE ui recycled from above to pass in unknown query params.
}
}
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.authority</artifactId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
<optional>true</optional>
<version>${project.version}</version>
</dependency>
// First, create the Loanout
// We fetch the resource class by service name
ResourceBase resource = resourceMap.get( LoanoutClient.SERVICE_NAME);
- Response response = resource.create(null, loanoutPayload);
+ Response response = resource.create(resourceMap, null, loanoutPayload);
if(response.getStatus() != CREATED_STATUS) {
completionStatus = STATUS_ERROR;
errorInfo = new InvocationError(INT_ERROR_STATUS,
+ "<predicateDisplayName>"+RELATION_PREDICATE_DISP+"</predicateDisplayName>"
+ "</ns2:relations_common></document>";
ResourceBase resource = resourceMap.get(RelationClient.SERVICE_NAME);
- Response response = resource.create(null, relationPayload);
+ Response response = resource.create(resourceMap, null, relationPayload);
if(response.getStatus() != CREATED_STATUS) {
completionStatus = STATUS_ERROR;
errorInfo = new InvocationError(INT_ERROR_STATUS,
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.authority</artifactId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
<optional>true</optional>
<version>${project.version}</version>
</dependency>
import org.collectionspace.services.client.PoxPayloadOut;
import org.collectionspace.services.common.FileUtils;
import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.ServiceMessages;
import org.collectionspace.services.common.blob.BlobInput;
import org.collectionspace.services.common.blob.BlobUtil;
@POST
@Override
- public Response create(@Context UriInfo ui,
+ public Response create(
+ @Context ResourceMap resourceMap,
+ @Context UriInfo ui,
String xmlPayload) {
Response response = null;
MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
blobInput.createBlobFile(blobUri);
response = this.create(null, ctx);
} else {
- response = super.create(ui, xmlPayload);
+ response = super.create(resourceMap, ui, xmlPayload);
}
} catch (Exception e) {
throw bigReThrow(e, ServiceMessages.CREATE_FAILED);
</dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>\r
<optional>true</optional>\r
<version>${project.version}</version>\r
</dependency> \r
import org.collectionspace.services.client.IQueryManager;\r
import org.collectionspace.services.client.PoxPayloadIn;\r
import org.collectionspace.services.client.PoxPayloadOut;\r
+import org.collectionspace.services.common.api.RefName;\r
import org.collectionspace.services.common.authorityref.AuthorityRefList;\r
import org.collectionspace.services.common.context.MultipartServiceContextImpl;\r
import org.collectionspace.services.common.context.ServiceBindingUtils;\r
\r
\r
//======================= CREATE ====================================================\r
+ \r
@POST\r
- public Response create(@Context UriInfo ui,\r
+ public Response create(@Context ResourceMap resourceMap, @Context UriInfo ui,\r
String xmlPayload) {\r
try {\r
PoxPayloadIn input = new PoxPayloadIn(xmlPayload);\r
//System.out.println("\r\n\r\n==============================\r\nxmlPayload:\r\n"+xmlPayload);\r
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(input);\r
+ ctx.setResourceMap(resourceMap);\r
return create(input, ctx);\r
} catch (Exception e) {\r
throw bigReThrow(e, ServiceMessages.CREATE_FAILED);\r
//======================= UPDATE ====================================================\r
@PUT\r
@Path("{csid}")\r
- public byte[] update(@PathParam("csid") String csid, String xmlPayload) {\r
+ public byte[] update(@Context ResourceMap resourceMap, @PathParam("csid") String csid, String xmlPayload) {\r
PoxPayloadOut result = null;\r
ensureCSID(csid, UPDATE);\r
try {\r
PoxPayloadIn theUpdate = new PoxPayloadIn(xmlPayload);\r
ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(theUpdate);\r
+ ctx.setResourceMap(resourceMap);\r
result = update(csid, theUpdate, ctx); //==> CALL implementation method, which subclasses may override.\r
} catch (Exception e) {\r
throw bigReThrow(e, ServiceMessages.UPDATE_FAILED, csid);\r
}\r
return authRefList;\r
}\r
+ \r
+ //======================== UTILITY : getDocModelForRefName ========================================\r
+ /*\r
+ * ResourceBase create and update calls will set the resourceMap into the service context\r
+ * for all inheriting resource classes. Just use ServiceContext.getResourceMap() to get\r
+ * the map, and pass it in.\r
+ */\r
+ public static DocumentModel getDocModelForRefName(String refName, ResourceMap resourceMap) \r
+ throws Exception, DocumentNotFoundException {\r
+ // TODO - we need to generalize the idea of a refName to more than Authorities and Items. \r
+ RefName.AuthorityItem item = RefName.AuthorityItem.parse(refName);\r
+ if(item == null) {\r
+ return null;\r
+ }\r
+ ResourceBase resource = resourceMap.get(item.inAuthority.resource);\r
+ return resource.getDocModelForAuthorityItem(item);\r
+ }\r
+\r
+ // THis is ugly, but prevents us parsing the refName twice. Once we make refName a little more\r
+ // general, and less Authority(Item) specific, this will look better.\r
+ public DocumentModel getDocModelForAuthorityItem(RefName.AuthorityItem item) \r
+ throws Exception, DocumentNotFoundException {\r
+ logger.warn("Default (ResourceBase) getDocModelForAuthorityItem called - should not happen!");\r
+ return null;\r
+ }\r
+\r
+ public DocumentModel getDocModelForRefName(String refName) \r
+ throws Exception, DocumentNotFoundException {\r
+ return getDocModelForAuthorityItem(RefName.AuthorityItem.parse(refName));\r
+ }\r
+\r
}\r
import javax.ws.rs.core.MultivaluedMap;
+import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.security.UnauthorizedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** The target of the HTTP request **/
JaxRsContext jaxRsContext;
+ ResourceMap resourceMap = null;
+
@Override
public void setJaxRsContext(JaxRsContext theJaxRsContext) {
this.jaxRsContext = theJaxRsContext;
this.output = output;
}
+ /**
+ * @return the map of service names to resource classes.
+ */
+ public ResourceMap getResourceMap() {
+ return resourceMap;
+ }
+
+ /**
+ * @param map the map of service names to resource instances.
+ */
+ public void setResourceMap(ResourceMap map) {
+ this.resourceMap = map;
+ }
+
+
+
/* (non-Javadoc)
* @see org.collectionspace.services.common.context.RemoteServiceContext#getLocalContext(java.lang.String)
*/
import javax.ws.rs.core.UriInfo;
import org.collectionspace.services.common.ClientType;
+import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.document.DocumentHandler;
import org.collectionspace.services.common.document.ValidatorHandler;
import org.collectionspace.services.common.query.QueryContext;
* between various components of the service framework while processing
* a service request.
*/
+/**
+ * @author pschmitz
+ *
+ * @param <IT>
+ * @param <OT>
+ */
public interface ServiceContext<IT, OT> {
/**
* @return the input
*/
public IT getInput();
-
+
/**
* setInput is used to set request input before starting to
* process input data
*/
public void setOutput(OT output);
+ /**
+ * @return the map of service names to resource classes.
+ */
+ public ResourceMap getResourceMap();
+
+ /**
+ * @param map the map of service names to resource instances.
+ */
+ public void setResourceMap(ResourceMap map);
+
/**
* getPartsMetadata returns metadata for object parts used by the service
* @return
\r
import org.collectionspace.services.common.ReflectionMapper;\r
import org.collectionspace.services.common.api.Tools;\r
+import org.collectionspace.services.common.repository.RepositoryClient;\r
+import org.collectionspace.services.common.repository.RepositoryClientFactory;\r
import org.collectionspace.services.common.service.ListResultField;\r
import org.collectionspace.services.common.service.DocHandlerParams;\r
import org.collectionspace.services.common.service.ServiceBindingType;\r
import org.collectionspace.services.common.context.MultipartServiceContext;\r
+import org.collectionspace.services.common.context.ServiceContext;\r
import org.collectionspace.services.common.datetime.DateTimeFormatUtils;\r
import org.collectionspace.services.common.document.DocumentException;\r
import org.collectionspace.services.common.document.DocumentWrapper;\r
this.commonPart = commonPart;\r
}\r
\r
+\r
/** Subclass DocHandlers may override this method to control exact creation of the common list.\r
* This class instantiates an AbstractCommonList from the classname returned by getDocHandlerParams().AbstractCommonListClassname.\r
* @return\r
import org.collectionspace.services.nuxeo.client.*;
import org.collectionspace.services.nuxeo.util.NuxeoUtils;
import org.collectionspace.services.common.profile.Profiler;
+import org.collectionspace.services.common.repository.RepositoryClient;
+import org.collectionspace.services.common.repository.RepositoryClientFactory;
import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.DocumentModel;
}
+ public RepositoryClient getRepositoryClient(ServiceContext ctx) {
+ RepositoryClient repositoryClient = RepositoryClientFactory.getInstance().getClient(ctx.getRepositoryClientName());
+ return repositoryClient;
+ }
+
/**
* getRepositorySession returns Nuxeo Repository Session
* @return
<dependencies>
<dependency>
<groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.authority</artifactId>
+ <artifactId>org.collectionspace.services.authority.service</artifactId>
<optional>true</optional>
<version>${project.version}</version>
</dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.authority</artifactId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
<optional>true</optional>
<version>${project.version}</version>
</dependency>
<!-- CollectionSpace dependencies -->\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>\r
<optional>true</optional>\r
<version>${project.version}</version>\r
</dependency> \r
private List<String> intakeIdsCreated = new ArrayList<String>();\r
private List<String> orgIdsCreated = new ArrayList<String>();\r
private String orgAuthCSID = null; \r
- private String orgAuthRefName = null; \r
+ //private String orgAuthRefName = null; \r
private String currentOwnerOrgCSID = null; \r
private String currentOwnerRefName = null;\r
private String depositorRefName = null;\r
*/\r
protected void createOrgRefs(){\r
OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();\r
- orgAuthRefName = \r
- OrgAuthorityClientUtils.createOrgAuthRefName(ORGANIZATION_AUTHORITY_NAME, null);\r
+ //orgAuthRefName = \r
+ // OrgAuthorityClientUtils.createOrgAuthRefName(ORGANIZATION_AUTHORITY_NAME, null);\r
PoxPayloadOut multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(\r
ORGANIZATION_AUTHORITY_NAME, ORGANIZATION_AUTHORITY_NAME, orgAuthClient.getCommonPartName());\r
ClientResponse<Response> res = orgAuthClient.create(multipart);\r
orgInfo.put(OrganizationJAXBSchema.SHORT_NAME, shortName);\r
orgInfo.put(OrganizationJAXBSchema.LONG_NAME, longName);\r
PoxPayloadOut multipart = \r
- OrgAuthorityClientUtils.createOrganizationInstance(orgAuthRefName,\r
+ OrgAuthorityClientUtils.createOrganizationInstance(null, //orgAuthRefName,\r
orgInfo, orgAuthClient.getItemCommonPartName());\r
ClientResponse<Response> res = orgAuthClient.createItem(orgAuthCSID, multipart);\r
int statusCode = res.getStatus();\r
<artifactId>org.collectionspace.services.person.client</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!-- External dependencies -->
<dependency>
<groupId>org.testng</groupId>
import javax.ws.rs.core.Response;
import org.collectionspace.services.PersonJAXBSchema;
+import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;
import org.collectionspace.services.client.CollectionSpaceClient;
import org.collectionspace.services.client.LoaninClient;
import org.collectionspace.services.client.PersonAuthorityClient;
<packaging>pom</packaging>
<dependencies>
- <dependency>
- <groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.authority</artifactId>
- <optional>true</optional>
- <version>${project.version}</version>
- </dependency>
</dependencies>
<modules>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.authority</artifactId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
<optional>true</optional>
<version>${project.version}</version>
</dependency>
<artifactId>org.collectionspace.services.location.jaxb</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.client</artifactId>\r
<artifactId>org.collectionspace.services.jaxb</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
<packaging>pom</packaging>\r
\r
<dependencies>\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.authority</artifactId>\r
- <optional>true</optional>\r
- <version>${project.version}</version>\r
- </dependency> \r
</dependencies>\r
\r
<modules>\r
<artifactId>org.collectionspace.services.location.client</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority.service</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.contact.service</artifactId>\r
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.authority</artifactId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
<optional>true</optional>
<version>${project.version}</version>
</dependency>
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.authority</artifactId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
<optional>true</optional>
<version>${project.version}</version>
</dependency>
<artifactId>slf4j-log4j12</artifactId>\r
</dependency>\r
<!-- CollectionSpace dependencies -->\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.authority</artifactId>\r
- <optional>true</optional>\r
- <version>${project.version}</version>\r
- </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.note.jaxb</artifactId>\r
<!-- CollectionSpace dependencies -->
<dependency>
<groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.authority</artifactId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
<optional>true</optional>
<version>${project.version}</version>
</dependency>
<scope>provided</scope>\r
</dependency>\r
<!-- CollectionSpace dependencies -->\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.authority</artifactId>\r
- <version>${project.version}</version>\r
- </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.organization.jaxb</artifactId>\r
OrgauthoritiesCommon orgAuthority = new OrgauthoritiesCommon();\r
orgAuthority.setDisplayName(displayName);\r
orgAuthority.setShortIdentifier(shortIdentifier);\r
- String refName = createOrgAuthRefName(shortIdentifier, displayName);\r
- orgAuthority.setRefName(refName);\r
+ //String refName = createOrgAuthRefName(shortIdentifier, displayName);\r
+ //orgAuthority.setRefName(refName);\r
orgAuthority.setVocabType("OrgAuthority");\r
PoxPayloadOut multipart = new PoxPayloadOut(OrgAuthorityClient.SERVICE_PAYLOAD_NAME);\r
PayloadOutputPart commonPart = multipart.addPart(orgAuthority, MediaType.APPLICATION_XML_TYPE);\r
if((value = (String)orgInfo.get(OrganizationJAXBSchema.SHORT_DISPLAY_NAME))!=null)\r
organization.setShortDisplayName(value);\r
\r
- String refName = createOrganizationRefName(orgAuthRefName, shortId, value);\r
- organization.setRefName(refName);\r
+ //String refName = createOrganizationRefName(orgAuthRefName, shortId, value);\r
+ //organization.setRefName(refName);\r
\r
if (mainBodyList != null) {\r
organization.setMainBodyGroupList(mainBodyList);\r
* @param displaySuffix displayName to be appended, if non-null\r
* @return the string\r
*/\r
+ /*\r
public static String createOrgAuthRefName(String shortId, String displaySuffix) {\r
String refName = "urn:cspace:org.collectionspace.demo:orgauthority:name("\r
+shortId+")";\r
refName += "'"+displaySuffix+"'";\r
return refName;\r
}\r
+ */\r
\r
/**\r
* Creates the organization ref name.\r
* @param displaySuffix displayName to be appended, if non-null\r
* @return the string\r
*/\r
+ /*\r
public static String createOrganizationRefName(\r
String orgAuthRefName, String shortId, String displaySuffix) {\r
String refName = orgAuthRefName+":organization:name("+shortId+")";\r
refName += "'"+displaySuffix+"'";\r
return refName;\r
}\r
+ */\r
\r
/**\r
* Produces a default displayName from the basic name and foundingPlace fields.\r
OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
String shortId = createIdentifier();
String displayName = "TestOrgAuth-" + shortId;
- String baseRefName = OrgAuthorityClientUtils.createOrgAuthRefName(shortId, null);
+ //String baseRefName = OrgAuthorityClientUtils.createOrgAuthRefName(shortId, null);
PoxPayloadOut multipart =
OrgAuthorityClientUtils.createOrgAuthorityInstance(
displayName, shortId, orgAuthClient.getCommonPartName());
// so they can be deleted after tests have been run.
String newId = extractId(res);
if (knownResourceId == null){
- setKnownResource( newId, baseRefName );
+ setKnownResource( newId, null ); //baseRefName );
}
allResourceIdsCreated.add(newId);
} finally {
res.releaseConnection();
}
- String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
+ //String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
// Create temporary Person resources, and their corresponding refNames
// by which they can be identified.
- String csid = createPerson("Charlie", "Orgcontact", "charlieOrgcontact", authRefName);
+ String csid = createPerson("Charlie", "Orgcontact", "charlieOrgcontact", null ); // authRefName);
personIdsCreated.add(csid);
organizationContactPersonRefName1 = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
// Create temporary Person resources, and their corresponding refNames
// by which they can be identified.
- csid = createPerson("Chelsie", "Contact", "chelsieContact", authRefName);
+ csid = createPerson("Chelsie", "Contact", "chelsieContact", null ); // authRefName);
personIdsCreated.add(csid);
organizationContactPersonRefName2 = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
}
OrgAuthorityClient client = new OrgAuthorityClient();
String shortId = createIdentifier();
String displayName = "displayName-" + shortId;
- String baseRefName = OrgAuthorityClientUtils.createOrgAuthRefName(shortId, null);
+ //String baseRefName = OrgAuthorityClientUtils.createOrgAuthRefName(shortId, null);
PoxPayloadOut multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
displayName, shortId, client.getCommonPartName());
// Store the ID returned from the first resource created
// for additional tests below.
if (knownResourceId == null) {
- setKnownResource(newID, shortId, baseRefName);
+ setKnownResource(newID, shortId, null ); //baseRefName);
if (logger.isDebugEnabled()) {
logger.debug(testName + ": knownResourceId=" + knownResourceId);
}
<name>services.organization.jaxb</name>
<dependencies>
- <dependency>
- <groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.authority</artifactId>
- <optional>true</optional>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.common</artifactId>
<artifactId>org.collectionspace.services.jaxb</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
<packaging>pom</packaging>\r
\r
<dependencies>\r
+ <!--\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.authority</artifactId>\r
<optional>true</optional>\r
<version>${project.version}</version>\r
</dependency> \r
+ -->\r
</dependencies>\r
\r
<modules>\r
<!-- CollectionSpace dependencies -->\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <artifactId>org.collectionspace.services.authority.service</artifactId>\r
<optional>true</optional>\r
<version>${project.version}</version>\r
</dependency> \r
<artifactId>org.collectionspace.services.jaxb</artifactId>\r
<version>${project.version}</version>\r
</dependency> \r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.common</artifactId>\r
PersonauthoritiesCommon personAuthority = new PersonauthoritiesCommon();\r
personAuthority.setDisplayName(displayName);\r
personAuthority.setShortIdentifier(shortIdentifier);\r
- String refName = createPersonAuthRefName(shortIdentifier, displayName);\r
- personAuthority.setRefName(refName);\r
+ //String refName = createPersonAuthRefName(shortIdentifier, displayName);\r
+ //personAuthority.setRefName(refName);\r
personAuthority.setVocabType("PersonAuthority");\r
PoxPayloadOut multipart = new PoxPayloadOut(PersonAuthorityClient.SERVICE_PAYLOAD_NAME);\r
PayloadOutputPart commonPart = multipart.addPart(personAuthority, MediaType.APPLICATION_XML_TYPE);\r
String headerLabel){\r
final Map<String, List<String>> EMPTY_PERSON_REPEATABLES_INFO =\r
new HashMap<String, List<String>>();\r
- return createPersonInstance(inAuthority, personAuthRefName, personInfo,\r
+ return createPersonInstance(inAuthority, null /*personAuthRefName*/, personInfo,\r
EMPTY_PERSON_REPEATABLES_INFO, headerLabel);\r
}\r
\r
throw new IllegalArgumentException("shortDisplayName cannot be null when shortDisplayComputed is 'false'");\r
} \r
\r
- String refName = createPersonRefName(personAuthRefName, shortId, displayName);\r
- person.setRefName(refName);\r
+ //String refName = createPersonRefName(personAuthRefName, shortId, displayName);\r
+ //person.setRefName(refName);\r
\r
String value;\r
List<String> values = null;\r
\r
if(logger.isDebugEnabled()){\r
logger.debug("Import: Create Item: \"" + displayName\r
- +"\" in personAuthorityulary: \"" + personAuthorityRefName +"\"");\r
+ +"\" in personAuthorityulary: \"" + vcsid +"\"");\r
}\r
PoxPayloadOut multipart = \r
- createPersonInstance(vcsid, personAuthorityRefName,\r
+ createPersonInstance(vcsid, null /*personAuthorityRefName*/,\r
personMap, personRepeatablesMap, client.getItemCommonPartName());\r
\r
String result = null;\r
\r
if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
throw new RuntimeException("Could not create Item: \""+personMap.get(PersonJAXBSchema.SHORT_IDENTIFIER)\r
- +"\" in personAuthority: \"" + personAuthorityRefName\r
+ +"\" in personAuthority: \"" + vcsid //personAuthorityRefName\r
+"\" "+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
}\r
if(statusCode != EXPECTED_STATUS_CODE) {\r
throw new RuntimeException("Unexpected Status when creating Item: \""+personMap.get(PersonJAXBSchema.SHORT_IDENTIFIER)\r
- +"\" in personAuthority: \"" + personAuthorityRefName +"\", Status:"+ statusCode);\r
+ +"\" in personAuthority: \"" + vcsid /*personAuthorityRefName*/ +"\", Status:"+ statusCode);\r
}\r
\r
result = extractId(res);\r
* @param displaySuffix displayName to be appended, if non-null\r
* @return the string\r
*/\r
+ /*\r
public static String createPersonAuthRefName(String shortId, String displaySuffix) {\r
String refName = "urn:cspace:org.collectionspace.demo:personauthority:name("\r
+shortId+")";\r
refName += "'"+displaySuffix+"'";\r
return refName;\r
}\r
+ */\r
\r
/**\r
* Creates the person ref name.\r
* @param displaySuffix displayName to be appended, if non-null\r
* @return the string\r
*/\r
+ /*\r
public static String createPersonRefName(\r
String personAuthRefName, String shortId, String displaySuffix) {\r
String refName = personAuthRefName+":person:name("+shortId+")";\r
refName += "'"+displaySuffix+"'";\r
return refName;\r
}\r
+ */\r
\r
/**\r
* Extract id.\r
private String knownResourceId = null;
/** The known resource ref name. */
- private String knownResourceRefName = null;
+ //private String knownResourceRefName = null;
/** The known item resource id. */
private String knownItemResourceId = null;
Assert.fail("Could not create new Authority for search tests.", e);
}
try {
- createItemsInAuthorityForPartialTermMatch(knownResourceId, knownResourceRefName);
+ createItemsInAuthorityForPartialTermMatch(knownResourceId, null ); //knownResourceRefName);
} catch (Exception e) {
Assert.fail("Could not create new item in Authority for search tests.", e);
}
PersonAuthorityClient client = new PersonAuthorityClient();
String shortId = createIdentifier();
String displayName = "displayName-" + shortId;
- String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(shortId, null);
+ //String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(shortId, null);
PoxPayloadOut multipart =
PersonAuthorityClientUtils.createPersonAuthorityInstance(
displayName, shortId, client.getCommonPartName());
}
// Store the refname from the first resource created
// for additional tests below.
- knownResourceRefName = baseRefName;
+ //knownResourceRefName = baseRefName;
// Store the ID returned from the first resource created
// for additional tests below.
if (knownResourceId == null){
knownResourceId = newID;
- knownResourceRefName = baseRefName;
+ //knownResourceRefName = baseRefName;
}
// Store the IDs from every resource created by tests,
styles.add(TEST_KWD_UTF8_STYLE);
partialTermRepeatablesMap.put(PersonJAXBSchema.SCHOOLS_OR_STYLES, styles);
- createItem(testName, authorityCsid, authRefName, client,
+ createItem(testName, authorityCsid, null /*authRefName*/, client,
partialTermPersonMap, partialTermRepeatablesMap);
//
// Adjust the property map for the QUOTE item
partialTermPersonMap.put(PersonJAXBSchema.SUR_NAME, TEST_PARTIAL_TERM_SUR_NAME_QUOTE);
partialTermPersonMap.put(PersonJAXBSchema.BIO_NOTE, TEST_KWD_BIO_NOTE_DBL_QUOTES);
- createItem(testName, authorityCsid, authRefName, client,
+ createItem(testName, authorityCsid, null /*authRefName*/, client,
partialTermPersonMap, partialTermRepeatablesMap);
}
Map<String, String> partialTermPersonMap,
Map<String, List<String>> partialTermRepeatablesMap) throws Exception {
PoxPayloadOut multipart =
- PersonAuthorityClientUtils.createPersonInstance(authorityCsid, authRefName,
+ PersonAuthorityClientUtils.createPersonInstance(authorityCsid, null, //authRefName,
partialTermPersonMap, partialTermRepeatablesMap, client.getItemCommonPartName() );
String newID = null;
// final String SERVICE_PATH_COMPONENT = "personauthorities";
// final String ITEM_SERVICE_PATH_COMPONENT = "items";
private String authId = null;
- private String authRefName = null;
+ //private String authRefName = null;
private List<String> allItemIdsCreated = new ArrayList<String>();
private String[] firstNames = {
"Ann","Anne","Anno",
PersonAuthorityClient client = new PersonAuthorityClient();
String shortId = "perfTestPersons";
String displayName = "Perf Test Person Auth";
- String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(shortId, null);
+ //String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(shortId, null);
PoxPayloadOut multipart =
PersonAuthorityClientUtils.createPersonAuthorityInstance(
displayName, shortId, client.getCommonPartName());
}
// Store the refname from the first resource created
// for additional tests below.
- authRefName = baseRefName;
+ //authRefName = baseRefName;
// Store the ID returned from the first resource created
// for additional tests below.
authId = newID;
personMap.put(PersonJAXBSchema.SUR_NAME, lastName);
Map<String, List<String>> personRepeatablesMap = new HashMap<String, List<String>>();
PoxPayloadOut multipart =
- PersonAuthorityClientUtils.createPersonInstance(authId, authRefName,
+ PersonAuthorityClientUtils.createPersonInstance(authId, null, //authRefName,
personMap, personRepeatablesMap, client.getItemCommonPartName() );
String newID = null;
// Hold some values for a recently created item to verify upon read.
private String knownResourceId = null;
private String knownResourceShortIdentifer = null;
- private String knownResourceRefName = null;
+ //private String knownResourceRefName = null;
private String knownItemResourceId = null;
private String knownItemResourceShortIdentifer = null;
// The resource ID of an item resource used for partial term matching tests.
String refName) {
knownResourceId = id;
knownResourceShortIdentifer = shortIdentifer;
- knownResourceRefName = refName;
+ //knownResourceRefName = refName;
}
protected void setKnownItemResource(String id, String shortIdentifer) {
PersonAuthorityClient client = new PersonAuthorityClient();
String shortId = createIdentifier();
String displayName = "displayName-" + shortId;
- String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(shortId, null);
+ //String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(shortId, null);
PoxPayloadOut multipart =
PersonAuthorityClientUtils.createPersonAuthorityInstance(
displayName, shortId, client.getCommonPartName());
}
// Save values for additional tests
if (knownResourceId == null) {
- setKnownResource(newID, shortId, baseRefName);
+ setKnownResource(newID, shortId, null ); //baseRefName);
if (logger.isDebugEnabled()) {
logger.debug(testName + ": knownResourceId=" + knownResourceId);
}
logger.debug(testBanner(testName, CLASS_NAME));
}
setupCreate();
- String newID = createItemInAuthority(knownResourceId, knownResourceRefName);
+ String newID = createItemInAuthority(knownResourceId, null ); //knownResourceRefName);
}
/**
johnWayneGroups.add("Scottish");
johnWayneRepeatablesMap.put(PersonJAXBSchema.GROUPS, johnWayneGroups);
- return createItemInAuthority(vcsid, authRefName, shortId, johnWayneMap, johnWayneRepeatablesMap);
+ return createItemInAuthority(vcsid, null /*authRefName*/, shortId, johnWayneMap, johnWayneRepeatablesMap);
}
PersonAuthorityClient client = new PersonAuthorityClient();
PoxPayloadOut multipart =
- PersonAuthorityClientUtils.createPersonInstance(vcsid, authRefName, itemFieldProperties,
+ PersonAuthorityClientUtils.createPersonInstance(vcsid, null /*authRefName*/, itemFieldProperties,
itemRepeatableFieldProperties, client.getItemCommonPartName());
String newID = null;
final Map NULL_REPEATABLE_FIELD_PROPERTIES = null;
PoxPayloadOut multipart =
PersonAuthorityClientUtils.createPersonInstance(knownResourceId,
- knownResourceRefName, fieldProperties,
+ null /*knownResourceRefName*/, fieldProperties,
NULL_REPEATABLE_FIELD_PROPERTIES, client.getItemCommonPartName());
// Send the request and receive a response
Map<String, List<String>> nonexRepeatablesMap = new HashMap<String, List<String>>();
PoxPayloadOut multipart =
PersonAuthorityClientUtils.createPersonInstance(NON_EXISTENT_ID,
- PersonAuthorityClientUtils.createPersonAuthRefName(NON_EXISTENT_ID, null),
+ null, //PersonAuthorityClientUtils.createPersonAuthRefName(NON_EXISTENT_ID, null),
nonexMap, nonexRepeatablesMap, client.getItemCommonPartName());
ClientResponse<String> res =
client.updateItem(knownResourceId, NON_EXISTENT_ID, multipart);
log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n\r
\r
#packages\r
-log4j.logger.org.collectionspace=INFO\r
+log4j.logger.org.collectionspace=DEBUG\r
log4j.logger.org.apache=INFO\r
log4j.logger.httpclient=INFO\r
log4j.logger.org.jboss.resteasy=INFO\r
<artifactId>org.collectionspace.services.jaxb</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
<packaging>pom</packaging>\r
\r
<dependencies>\r
+ <!--\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.authority</artifactId>\r
<optional>true</optional>\r
<version>${project.version}</version>\r
</dependency> \r
+ -->\r
</dependencies>\r
\r
<modules>\r
<artifactId>org.collectionspace.services.common</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority.service</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.person.jaxb</artifactId>\r
<artifactId>org.collectionspace.services.client</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.person.client</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.common</artifactId>\r
*/
package org.collectionspace.services.client.test;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.collectionspace.services.PersonJAXBSchema;
import org.collectionspace.services.client.CollectionSpaceClient;
import org.collectionspace.services.client.PayloadInputPart;
import org.collectionspace.services.client.PayloadOutputPart;
+import org.collectionspace.services.client.PersonAuthorityClient;
+import org.collectionspace.services.client.PersonAuthorityClientUtils;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
import org.collectionspace.services.client.RelationClient;
/** The logger. */
private final String CLASS_NAME = RelationServiceTest.class.getName();
+ private final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+ private List<String> personIdsCreated = new ArrayList<String>();
+ private String samSubjectPersonCSID = null;
+ private String oliveObjectPersonCSID = null;
+ private String samSubjectRefName = null;
+ private String oliveObjectRefName = null;
+ private String personAuthCSID = null;
+ private String personShortId = PERSON_AUTHORITY_NAME;
+
/** The SERVICE path component. */
final String SERVICE_PATH_COMPONENT = "relations";
// (e.g. CREATE, DELETE), its valid and expected status codes, and
// its associated HTTP method name (e.g. POST, DELETE).
setupCreate();
+ createPersonRefs();
// Submit the request to the service and store the response.
RelationClient client = new RelationClient();
// so they can be deleted after tests have been run.
allResourceIdsCreated.add(extractId(res));
}
+
+ /**
+ * Creates the person refs.
+ */
+ protected void createPersonRefs() {
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
+ PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
+ ClientResponse<Response> res = personAuthClient.create(multipart);
+ int statusCode = res.getStatus();
+
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, STATUS_CREATED);
+ personAuthCSID = extractId(res);
+
+ String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
+
+ String csid = createPerson("Sam", "Subject", "samSubject", authRefName);
+ Assert.assertNotNull(csid);
+ samSubjectPersonCSID = csid;
+ samSubjectRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ Assert.assertNotNull(samSubjectRefName);
+ personIdsCreated.add(csid);
+
+ csid = createPerson("Olive", "Object", "oliveObject", authRefName);
+ Assert.assertNotNull(csid);
+ oliveObjectRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ oliveObjectPersonCSID = csid;
+ Assert.assertNotNull(oliveObjectRefName);
+ personIdsCreated.add(csid);
+ }
+
+ protected String createPerson(String firstName, String surName, String shortId, String authRefName) {
+ PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ Map<String, String> personInfo = new HashMap<String, String>();
+ personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
+ personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
+ personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
+ PoxPayloadOut multipart =
+ PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
+ authRefName, personInfo, personAuthClient.getItemCommonPartName());
+ ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
+ int statusCode = res.getStatus();
+
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, STATUS_CREATED);
+ return extractId(res);
+ }
+
+
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String)
* @param identifier the identifier
*/
private void fillRelation(RelationsCommon relationCommon, String identifier) {
- fillRelation(relationCommon, "Subject-" + identifier,
- "SubjectType-" + identifier + "-type",
- "Object-" + identifier,
- "ObjectType-" + identifier + "-type",
+ fillRelation(relationCommon, samSubjectPersonCSID, null, oliveObjectPersonCSID, null,
RelationshipType.COLLECTIONOBJECT_INTAKE.toString(),
RelationshipType.COLLECTIONOBJECT_INTAKE + ".displayName");
}
<version>5.6</version>\r
</dependency>\r
\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.person.client</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.organization.client</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.location.client</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.taxonomy.client</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
\r
<!-- javax -->\r
\r
*/
package org.collectionspace.services.relation.nuxeo;
+import java.util.HashMap;
import java.util.Iterator;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.ServiceMain;
+import org.collectionspace.services.common.api.RefName;
import org.collectionspace.services.common.api.Tools;
import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl;
import org.collectionspace.services.common.context.ServiceBindingUtils;
+import org.collectionspace.services.common.document.DocumentNotFoundException;
import org.collectionspace.services.common.document.InvalidDocumentException;
import org.collectionspace.services.common.relation.RelationJAXBSchema;
import org.collectionspace.services.common.relation.nuxeo.RelationConstants;
import org.collectionspace.services.relation.RelationsCommonList;
import org.collectionspace.services.relation.RelationsCommonList.RelationListItem;
+// HACK HACK HACK
+import org.collectionspace.services.client.PersonAuthorityClient;
+import org.collectionspace.services.client.OrgAuthorityClient;
+import org.collectionspace.services.client.LocationAuthorityClient;
+import org.collectionspace.services.client.TaxonomyAuthorityClient;
+
import org.collectionspace.services.common.document.DocumentWrapper;
import org.collectionspace.services.jaxb.AbstractCommonList;
import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
import org.collectionspace.services.relation.RelationsDocListItem;
+import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.core.api.DocumentModelList;
import org.nuxeo.ecm.core.api.model.PropertyException;
@Override
public void handleCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+ // Merge in the data from the payload
+ super.handleCreate(wrapDoc);
- // Obtain document models for the subject and object of the relation.
+ // Obtain document models for the subject and object of the relation, so that
+ // we ensure we have value docType, URI info. If the docModels support refNames,
+ // we will also set those.
+ // Note that this introduces another caching problem...
DocumentModel relationDocModel = wrapDoc.getWrappedObject();
ServiceContext ctx = getServiceContext();
- DocumentModel subjectDocModel = getSubjectDocModel(relationDocModel, ctx);
- DocumentModel objectDocModel = getObjectDocModel(relationDocModel, ctx);
+ DocumentModel subjectDocModel = getSubjectOrObjectDocModel(relationDocModel, ctx, SUBJ_DOC_MODEL);
+ DocumentModel objectDocModel = getSubjectOrObjectDocModel(relationDocModel, ctx, OBJ_DOC_MODEL);
// Use values from the subject and object document models to populate the
// relevant fields of the relation's own document model.
if (subjectDocModel != null) {
- relationDocModel = populateSubjectValues(relationDocModel, subjectDocModel);
+ populateSubjectOrObjectValues(relationDocModel, subjectDocModel, ctx, SUBJ_DOC_MODEL);
}
if (objectDocModel != null) {
- relationDocModel = populateObjectValues(relationDocModel, objectDocModel);
+ populateSubjectOrObjectValues(relationDocModel, objectDocModel, ctx, OBJ_DOC_MODEL);
}
-
- // FIXME: Verify the following:
- // Do we call this method here, only after we've updated the relationDocModel?
- // Has the wrapDoc instance itself been updated, in the process of updating the relationDocModel,
- // or do we need to pass the updated relationDocModel back into that instance?
- super.handleCreate(wrapDoc);
-
}
@Override
String subjectUri = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.SUBJECT_URI);
subject.setUri(subjectUri);
+ String subjectRefName = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.SUBJECT_REFNAME);
+ subject.setRefName(subjectRefName);
relationListItem.setSubject(subject);
String objectCsid = relationListItem.getObjectCsid();
String objectUri = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.OBJECT_URI);
object.setUri(objectUri);
+ String objectRefName = (String) docModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.OBJECT_REFNAME);
+ object.setRefName(objectRefName);
relationListItem.setObject(object);
return relationListItem;
return "/" + RelationConstants.NUXEO_SCHEMA_ROOT_ELEMENT + "/" + prop;
}
- /**
- * Obtains the subject resource and uses its values to populate
- * subject-related fields in the relation resource.
- */
- private DocumentModel getSubjectDocModel(DocumentModel relationDocModel, ServiceContext ctx) throws Exception {
- // Get the document model for the subject of the relation.
- DocumentModel subjectDocModel = null;
- String subjectCsid = "";
- String subjectRefName = "";
- // FIXME: Currently assumes that the object CSID is valid if present
- // in the incoming payload.
- try {
- subjectCsid = (String) relationDocModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.SUBJECT_CSID);
- // FIXME: Remove this entire 'if' statement when legacy fields are removed from the Relation record:
- if (Tools.isBlank(subjectCsid)) {
- subjectCsid = (String) relationDocModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.DOCUMENT_ID_1);
- }
- } catch (PropertyException pe) {
- // Per CSPACE-4468, ignore any property exception here.
- // (See parallel comment below in getObjectDocModel.)
- }
- if (Tools.notBlank(subjectCsid)) {
- // FIXME: Call a utility routine here that uses the CSID to retrieve the subject record's docModel.
- // The following is a placeholder:
- subjectDocModel = getDocModelFromCsid(subjectCsid);
- }
- if (Tools.isBlank(subjectCsid)) {
- try {
- subjectRefName = (String) relationDocModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.SUBJECT_REFNAME);
- // FIXME: Call a utility routine here - for which the method below is currently a
- // placeholder - that uses the refName to retrieve the subject record's docModel.
- subjectDocModel = getDocModelFromRefname(subjectRefName);
- } catch (Exception e) {
- throw new InvalidDocumentException(
- "Relation record must contain a CSID or refName to identify the subject of the relation.", e);
- }
- }
- return subjectDocModel;
- }
-
- /**
- * Obtains the object resource and uses its values to populate
- * object-related fields in the relation resource.
- */
- private DocumentModel getObjectDocModel(DocumentModel relationDocModel, ServiceContext ctx) throws Exception {
+ private final boolean SUBJ_DOC_MODEL = true;
+ private final boolean OBJ_DOC_MODEL = false;
+
+ private DocumentModel getSubjectOrObjectDocModel(
+ DocumentModel relationDocModel, ServiceContext ctx, boolean fSubject) throws Exception {
// Get the document model for the object of the relation.
- String objectCsid = "";
- String objectRefName = "";
- DocumentModel objectDocModel = null;
+ String commonPartLabel = ctx.getCommonPartLabel();
+ String csid = "";
+ String refName = "";
+ DocumentModel docModel = null;
// FIXME: Currently assumes that the object CSID is valid if present
// in the incoming payload.
try {
- objectCsid = (String) relationDocModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.OBJECT_CSID);
+ csid = (String) relationDocModel.getProperty(commonPartLabel,
+ (fSubject?RelationJAXBSchema.SUBJECT_CSID:RelationJAXBSchema.OBJECT_CSID));
// FIXME: Remove this entire 'if' statement when legacy fields are removed from the Relation record:
- if (Tools.isBlank(objectCsid)) {
- objectCsid = (String) relationDocModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.DOCUMENT_ID_2);
+ if (Tools.isBlank(csid)) {
+ csid = (String) relationDocModel.getProperty(commonPartLabel,
+ (fSubject?RelationJAXBSchema.DOCUMENT_ID_1:RelationJAXBSchema.DOCUMENT_ID_2));
}
} catch (PropertyException pe) {
// Per CSPACE-4468, ignore any property exception here.
// can now be null (missing), because a refName value can be
// provided as an alternate identifier.
}
- if (Tools.isBlank(objectCsid)) {
+ if (Tools.notBlank(csid)) {
+ DocumentWrapper<DocumentModel> docWrapper = getRepositoryClient(ctx).getDocFromCsid(ctx, csid);
+ docModel = docWrapper.getWrappedObject();
+ } else { // if (Tools.isBlank(objectCsid)) {
try {
- objectRefName = (String) relationDocModel.getProperty(ctx.getCommonPartLabel(), RelationJAXBSchema.OBJECT_REFNAME);
- // FIXME: Call a utility routine here - for which the method below is currently a
- // placeholder - that uses the refName to retrieve the object record's docModel.
- objectDocModel = getDocModelFromRefname(objectRefName);
+ refName = (String) relationDocModel.getProperty(commonPartLabel,
+ (fSubject?RelationJAXBSchema.SUBJECT_REFNAME:RelationJAXBSchema.OBJECT_REFNAME));
+ docModel = ResourceBase.getDocModelForRefName(refName, ctx.getResourceMap());
} catch (Exception e) {
throw new InvalidDocumentException(
"Relation record must have a CSID or refName to identify the object of the relation.", e);
}
}
- return objectDocModel;
+ if(docModel==null) {
+ throw new DocumentNotFoundException("Relation.getSubjectOrObjectDocModel could not find doc with CSID: "
+ +csid+" and/or refName: "+refName );
+ }
+ return docModel;
}
-
- // CSPACE-4468 placeholder methods:
- // FIXME: Placeholder method.
- private DocumentModel getDocModelFromCsid(String csid) {
- return null;
- }
+ private void populateSubjectOrObjectValues(
+ DocumentModel relationDocModel,
+ DocumentModel subjectOrObjectDocModel,
+ ServiceContext ctx,
+ boolean fSubject ) {
+ HashMap<String,Object> properties = new HashMap<String,Object>();
- // FIXME: Placeholder method.
- // Patrick is providing a working replacement for this method, in a framework class.
- private DocumentModel getDocModelFromRefname(String csid) {
- return null;
- }
+ try {
+ String doctype = (String) subjectOrObjectDocModel.getType();
+ properties.put((fSubject?RelationJAXBSchema.SUBJECT_DOCTYPE:RelationJAXBSchema.OBJECT_DOCTYPE),
+ doctype);
+ // FIXME: Remove the line below when legacy fields are removed from the Relation record:
+ properties.put((fSubject?RelationJAXBSchema.DOCUMENT_TYPE_1:RelationJAXBSchema.DOCUMENT_TYPE_2),
+ doctype);
+
+ String csid = (String) subjectOrObjectDocModel.getName();
+ properties.put((fSubject?RelationJAXBSchema.SUBJECT_CSID:RelationJAXBSchema.OBJECT_CSID),
+ csid);
+ // FIXME: Remove the two lines immediately below when legacy fields are removed from the Relation record:
+ properties.put((fSubject?RelationJAXBSchema.DOCUMENT_ID_1:RelationJAXBSchema.DOCUMENT_ID_2),
+ csid);
+
+ String uri = (String) subjectOrObjectDocModel.getProperty(COLLECTIONSPACE_CORE_SCHEMA,
+ COLLECTIONSPACE_CORE_URI);
+ properties.put((fSubject?RelationJAXBSchema.SUBJECT_URI:RelationJAXBSchema.OBJECT_URI),
+ uri);
+
+ String common_schema = getCommonSchemaNameForDocType(doctype);
+
+ if(common_schema!=null) {
+ String refname = (String)subjectOrObjectDocModel.getProperty(common_schema,
+ RefName.REFNAME );
+ properties.put((fSubject?RelationJAXBSchema.SUBJECT_REFNAME:RelationJAXBSchema.OBJECT_REFNAME),
+ refname);
+ }
+ } catch (ClientException ce) {
+ throw new RuntimeException(
+ "populateSubjectOrObjectValues: Problem fetching field " + ce.getLocalizedMessage());
+ }
- // FIXME: Placeholder method.
- private DocumentModel populateSubjectValues(DocumentModel relationDocModel, DocumentModel objectDocModel) {
- throw new UnsupportedOperationException("Not yet implemented");
+ // FIXME: Call below is based solely on Nuxeo API docs; have not yet verified that it correctly updates existing
+ // property values in the target document model.
+ try {
+ relationDocModel.setProperties(ctx.getCommonPartLabel(), properties);
+ } catch (ClientException ce) {
+ throw new RuntimeException(
+ "populateSubjectValues: Problem setting fields " + ce.getLocalizedMessage());
+ }
}
-
- // FIXME: Placeholder method.
- private DocumentModel populateObjectValues(DocumentModel relationDocModel, DocumentModel objectDocModel) {
- throw new UnsupportedOperationException("Not yet implemented");
+
+ private String getCommonSchemaNameForDocType(String docType) {
+ String common_schema = null;
+ if("Person".equals(docType))
+ common_schema = PersonAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
+ else if("Organization".equals(docType))
+ common_schema = OrgAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
+ else if("Locationitem".equals(docType))
+ common_schema = LocationAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
+ else if("Taxon".equals(docType))
+ common_schema = TaxonomyAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
+ //else leave it null.
+ return common_schema;
}
+
}
<dependencies>\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>\r
<optional>true</optional>\r
<version>${project.version}</version>\r
</dependency> \r
<artifactId>org.collectionspace.services.taxonomy.jaxb</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.client</artifactId>
<artifactId>org.collectionspace.services.jaxb</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
<build>
<packaging>pom</packaging>
<dependencies>
+ <!--
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.authority</artifactId>
<optional>true</optional>
<version>${project.version}</version>
</dependency>
+ -->
</dependencies>
<modules>
</dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
- <artifactId>org.collectionspace.services.contact.service</artifactId>
+ <artifactId>org.collectionspace.services.authority.service</artifactId>
<version>${project.version}</version>
</dependency>
<!-- External dependencies -->
<artifactId>org.collectionspace.services.vocabulary.jaxb</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.client</artifactId>\r
VocabulariesCommon vocabulary = new VocabulariesCommon();\r
vocabulary.setDisplayName(displayName);\r
vocabulary.setShortIdentifier(shortIdentifier);\r
- String refName = createVocabularyRefName(shortIdentifier, displayName);\r
- vocabulary.setRefName(refName);\r
+ //String refName = createVocabularyRefName(shortIdentifier, displayName);\r
+ //vocabulary.setRefName(refName);\r
vocabulary.setVocabType("enum");\r
PoxPayloadOut multipart = new PoxPayloadOut(VocabularyClient.SERVICE_PAYLOAD_NAME);\r
PayloadOutputPart commonPart = multipart.addPart(vocabulary, MediaType.APPLICATION_XML_TYPE);\r
String displayName = vocabItemInfo.get(AuthorityItemJAXBSchema.DISPLAY_NAME);\r
vocabularyItem.setShortIdentifier(shortId);\r
vocabularyItem.setDisplayName(displayName);\r
- String refName = createVocabularyItemRefName(vocabularyRefName, shortId, displayName);\r
- vocabularyItem.setRefName(refName);\r
+ //String refName = createVocabularyItemRefName(vocabularyRefName, shortId, displayName);\r
+ //vocabularyItem.setRefName(refName);\r
PoxPayloadOut multipart = new PoxPayloadOut(VocabularyClient.SERVICE_ITEM_PAYLOAD_NAME);\r
PayloadOutputPart commonPart = multipart.addPart(vocabularyItem,\r
MediaType.APPLICATION_XML_TYPE);\r
logger.debug("Import: Create Item: \""+itemMap.get(AuthorityItemJAXBSchema.SHORT_IDENTIFIER)\r
+"\" in personAuthority: \"" + vcsid +"\"");\r
}\r
- PoxPayloadOut multipart = createVocabularyItemInstance(vocabularyRefName,\r
+ PoxPayloadOut multipart = createVocabularyItemInstance(null, //vocabularyRefName,\r
itemMap, client.getCommonPartItemName());\r
ClientResponse<Response> res = client.createItem(vcsid, multipart);\r
\r
\r
if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {\r
throw new RuntimeException("Could not create Item: \"" + itemMap.get(AuthorityItemJAXBSchema.DISPLAY_NAME)\r
- + "\" in personAuthority: \"" + vocabularyRefName\r
+ + "\" in personAuthority: \"" + vcsid //vocabularyRefName\r
+ "\" " + invalidStatusCodeMessage(REQUEST_TYPE, statusCode));\r
}\r
if(statusCode != EXPECTED_STATUS_CODE) {\r
throw new RuntimeException("Unexpected Status when creating Item: \""+itemMap.get(AuthorityItemJAXBSchema.DISPLAY_NAME)\r
- + "\" in personAuthority: \"" + vocabularyRefName + "\", Status:" + statusCode);\r
+ + "\" in personAuthority: \"" + vcsid /*vocabularyRefName*/ + "\", Status:" + statusCode);\r
}\r
\r
return extractId(res);\r
return id;\r
}\r
\r
+ /*\r
public static String createVocabularyRefName(String shortIdentifier, String displaySuffix) {\r
String refName = "urn:cspace:org.collectionspace.demo:vocabulary:name("\r
+ shortIdentifier + ")";\r
refName += "'" + displaySuffix + "'";\r
return refName;\r
}\r
+ */\r
\r
}\r
final String SERVICE_ITEM_PAYLOAD_NAME = VocabularyClient.SERVICE_ITEM_PAYLOAD_NAME;
private String knownResourceId = null;
private String knownResourceShortIdentifer = null;
- private String knownResourceRefName = null;
- private String knownResourceFullRefName = null;
+ //private String knownResourceRefName = null;
+ //private String knownResourceFullRefName = null;
private String knownItemResourceId = null;
private int nItemsToCreateInList = 5;
// private List<String> allResourceIdsCreated = new ArrayList<String>();
String refName, String fullRefName) {
knownResourceId = id;
knownResourceShortIdentifer = shortIdentifer;
- knownResourceRefName = refName;
- knownResourceFullRefName = fullRefName;
+ //knownResourceRefName = refName;
+ //knownResourceFullRefName = fullRefName;
}
/* (non-Javadoc)
// Store the ID returned from the first resource created
// for additional tests below.
if (knownResourceId == null) {
- setKnownResource(extractId(res), identifier,
- VocabularyClientUtils.createVocabularyRefName(identifier, null),
- VocabularyClientUtils.createVocabularyRefName(identifier, displayName));
+ setKnownResource(extractId(res), identifier, null, null );
+ //VocabularyClientUtils.createVocabularyRefName(identifier, null),
+ //VocabularyClientUtils.createVocabularyRefName(identifier, displayName));
if (logger.isDebugEnabled()) {
logger.debug(testName + ": knownResourceId=" + knownResourceId);
}
itemInfo.put(AuthorityItemJAXBSchema.SHORT_IDENTIFIER, shortId);
itemInfo.put(AuthorityItemJAXBSchema.DISPLAY_NAME, "display-" + shortId);
String newID = VocabularyClientUtils.createItemInVocabulary(knownResourceId,
- knownResourceRefName, itemInfo, client);
+ null /*knownResourceRefName*/, itemInfo, client);
// Store the ID returned from the first item resource created
// for additional tests below.
itemInfo.put(AuthorityItemJAXBSchema.SHORT_IDENTIFIER, "Bad Item Short Id!");
itemInfo.put(AuthorityItemJAXBSchema.DISPLAY_NAME, "Bad Item!");
PoxPayloadOut multipart =
- VocabularyClientUtils.createVocabularyItemInstance(knownResourceRefName,
+ VocabularyClientUtils.createVocabularyItemInstance(null, //knownResourceRefName,
itemInfo, client.getCommonPartItemName());
ClientResponse<Response> res = client.createItem(knownResourceId, multipart);
if (!REQUEST_TYPE.isValidStatusCode(statusCode)) {
throw new RuntimeException("Could not create Item: \"" + itemInfo.get(AuthorityItemJAXBSchema.DISPLAY_NAME)
- + "\" in personAuthority: \"" + knownResourceRefName
+ + "\" in personAuthority: \"" + knownResourceId //knownResourceRefName
+ "\" " + invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
}
if (statusCode != EXPECTED_STATUS_CODE) {
throw new RuntimeException("Unexpected Status when creating Item: \"" + itemInfo.get(AuthorityItemJAXBSchema.DISPLAY_NAME)
- + "\" in personAuthority: \"" + knownResourceRefName + "\", Status:" + statusCode);
+ + "\" in personAuthority: \"" + knownResourceId /*knownResourceRefName*/ + "\", Status:" + statusCode);
}
}
client.getCommonPartName(), VocabulariesCommon.class);
Assert.assertNotNull(vocabulary);
- Assert.assertEquals(vocabulary.getRefName(), knownResourceFullRefName);
+ //Assert.assertEquals(vocabulary.getRefName(), knownResourceFullRefName);
}
/**
itemInfo.put(AuthorityItemJAXBSchema.DISPLAY_NAME, "display-nonex");
PoxPayloadOut multipart =
VocabularyClientUtils.createVocabularyItemInstance(
- VocabularyClientUtils.createVocabularyRefName(NON_EXISTENT_ID, null),
+ null, //VocabularyClientUtils.createVocabularyRefName(NON_EXISTENT_ID, null),
itemInfo, client.getCommonPartItemName());
ClientResponse<String> res =
client.updateItem(knownResourceId, NON_EXISTENT_ID, multipart);
<packaging>pom</packaging>\r
\r
<dependencies>\r
+ <!--\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.authority</artifactId>\r
<optional>true</optional>\r
<version>${project.version}</version>\r
</dependency> \r
+ -->\r
</dependencies>\r
\r
<modules>\r
<artifactId>org.collectionspace.services.common</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority.service</artifactId>\r
+ <version>${project.version}</version>\r
+ </dependency>\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.vocabulary.jaxb</artifactId>\r
import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.common.ResourceBase;
+import org.collectionspace.services.common.ResourceMap;
import org.collectionspace.services.common.ServiceMessages;
import org.collectionspace.services.jaxb.AbstractCommonList;
@Override
@POST
- public Response create(@Context UriInfo ui, String xmlPayload) {
+ public Response create(@Context ResourceMap resourceMap, @Context UriInfo ui, String xmlPayload) {
Response response = Response.status(Response.Status.BAD_REQUEST)
.entity(ServiceMessages.POST_UNSUPPORTED).type("text/plain").build();
return response;