<artifactId>org.collectionspace.services.intake.service</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.heldintrust.service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.group.service</artifactId>
import org.collectionspace.services.iterationreport.IterationreportResource;
import org.collectionspace.services.media.MediaResource;
import org.collectionspace.services.group.GroupResource;
+import org.collectionspace.services.heldintrust.HeldintrustResource;
import org.collectionspace.services.intake.IntakeResource;
import org.collectionspace.services.index.IndexResource;
import org.collectionspace.services.loanin.LoaninResource;
addResourceToMapAndSingletons(new GroupResource());
addResourceToMapAndSingletons(new InsuranceResource());
addResourceToMapAndSingletons(new IntakeResource());
+ addResourceToMapAndSingletons(new HeldintrustResource());
addResourceToMapAndSingletons(new DimensionResource());
addResourceToMapAndSingletons(new RelationResource());
addResourceToMapAndSingletons(new LoaninResource());
<ant antfile="servicegroup/build.xml" target="deploy" inheritAll="false"/>
<ant antfile="group/build.xml" target="deploy" inheritAll="false"/>
<ant antfile="intake/build.xml" target="deploy" inheritAll="false"/>
+ <ant antfile="heldintrust/build.xml" target="deploy" inheritAll="false"/>
<ant antfile="imports/build.xml" target="deploy" inheritAll="false"/>
<ant antfile="loanin/build.xml" target="deploy" inheritAll="false"/>
<ant antfile="loanout/build.xml" target="deploy" inheritAll="false"/>
<ant antfile="loanout/build.xml" target="undeploy" inheritAll="false"/>
<ant antfile="loanin/build.xml" target="undeploy" inheritAll="false"/>
<ant antfile="media/build.xml" target="undeploy" inheritAll="false"/>
+ <ant antfile="heldintrust/build.xml" target="undeploy" inheritAll="false"/>
<ant antfile="intake/build.xml" target="undeploy" inheritAll="false"/>
<ant antfile="imports/build.xml" target="undeploy" inheritAll="false"/>
<ant antfile="group/build.xml" target="undeploy" inheritAll="false"/>
<ant antfile="servicegroup/build.xml" target="dist" inheritAll="false"/>
<ant antfile="group/build.xml" target="dist" inheritAll="false"/>
<ant antfile="intake/build.xml" target="dist" inheritAll="false"/>
+ <ant antfile="heldintrust/build.xml" target="dist" inheritAll="false"/>
<ant antfile="loanin/build.xml" target="dist" inheritAll="false"/>
<ant antfile="loanout/build.xml" target="dist" inheritAll="false"/>
<ant antfile="location/build.xml" target="dist" inheritAll="false"/>
FROM id_generators
);
+-- HIT_NUMBER
+
+INSERT INTO id_generators
+ (csid, displayname, description, priority, last_generated_id, id_generator_state)
+ SELECT
+ '038b61f2-2975-4b33-ac93-ce8d8b6042f0',
+ 'Held-in-Trust Number',
+ 'Identifies a Held-in-Trust.',
+ '9',
+ '',
+'<org.collectionspace.services.id.SettableIDGenerator>
+ <parts>
+ <org.collectionspace.services.id.StringIDGeneratorPart>
+ <initialValue>HIT</initialValue>
+ <currentValue>HIT</currentValue>
+ </org.collectionspace.services.id.StringIDGeneratorPart>
+ <org.collectionspace.services.id.YearIDGeneratorPart>
+ <currentValue></currentValue>
+ </org.collectionspace.services.id.YearIDGeneratorPart>
+ <org.collectionspace.services.id.StringIDGeneratorPart>
+ <initialValue>.</initialValue>
+ <currentValue>.</currentValue>
+ </org.collectionspace.services.id.StringIDGeneratorPart>
+ <org.collectionspace.services.id.NumericIDGeneratorPart>
+ <maxLength>6</maxLength>
+ <initialValue>1</initialValue>
+ <currentValue>-1</currentValue>
+ </org.collectionspace.services.id.NumericIDGeneratorPart>
+ <org.collectionspace.services.id.StringIDGeneratorPart>
+ <initialValue>.</initialValue>
+ <currentValue>.</currentValue>
+ </org.collectionspace.services.id.StringIDGeneratorPart>
+ <org.collectionspace.services.id.NumericIDGeneratorPart>
+ <maxLength>6</maxLength>
+ <initialValue>1</initialValue>
+ <currentValue>-1</currentValue>
+ </org.collectionspace.services.id.NumericIDGeneratorPart>
+ </parts>
+</org.collectionspace.services.id.SettableIDGenerator>'
+ WHERE '038b61f2-2975-4b33-ac93-ce8d8b6042f0' NOT IN
+ (
+ SELECT csid
+ FROM id_generators
+ );
+
-- CONDITIONCHECK_NUMBER
INSERT INTO id_generators
+++ /dev/null
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
-<suite name="javaee-addressbook-client">
- <test verbose="2" name="org.jboss.resteasy.examples.addressbook.client.AddressBookTest" annotations="JDK">
- <classes>
- <class name="org.jboss.resteasy.examples.addressbook.client.AddressBookTest"/>
- </classes>
- </test>
-</suite>
--- /dev/null
+<project name="heldintrust.3rdparty" default="package" basedir=".">
+ <description>
+ held in trust service 3rdparty
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../../.." />
+ <!-- enviornment should be declared before reading build.properties -->
+ <property environment="env" />
+ <property file="${services.trunk}/build.properties" />
+ <property name="mvn.opts" value="-V" />
+ <property name="src" location="src" />
+
+ <condition property="osfamily-unix">
+ <os family="unix" />
+ </condition>
+ <condition property="osfamily-windows">
+ <os family="windows" />
+ </condition>
+
+ <target name="init">
+ <!-- Create the time stamp -->
+ <tstamp />
+ </target>
+
+ <target name="package" depends="package-unix,package-windows"
+ description="Package CollectionSpace Services" />
+ <target name="package-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="package-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="install" depends="install-unix,install-windows"
+ description="Install" />
+ <target name="install-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="install-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="clean" depends="clean-unix,clean-windows"
+ description="Delete target directories">
+ <delete dir="${build}" />
+ </target>
+ <target name="clean-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="clean-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="test" depends="test-unix,test-windows" description="Run tests" />
+ <target name="test-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="test-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="deploy" depends="install"
+ description="deploy held in trust in ${jee.server.nuxeo}">
+ <!-- This target is obsolete. The Nuxeo artifacts are now created and deployed using the "csmake" tool
+ <ant antfile="nuxeo-platform-cs-heldintrust/build.xml" target="deploy" inheritall="false"/>
+ -->
+ </target>
+
+ <target name="undeploy"
+ description="undeploy held in trust from ${jee.server.nuxeo}">
+ <!-- This target is obsolete. The Nuxeo artifacts are now created and deployed using the
+ "csmake" tool leaving this only for backwards compatibility reasons. -->
+ <ant antfile="nuxeo-platform-cs-heldintrust/build.xml" target="undeploy" inheritall="false" />
+ </target>
+
+ <target name="dist"
+ description="generate distribution for held in trust" depends="package">
+ <ant antfile="nuxeo-platform-cs-heldintrust/build.xml" target="dist" inheritall="false" />
+ </target>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="nuxeo-platform-cs-heldintrust" default="package" basedir=".">
+ <description>
+ held in trust nuxeo document type
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../../../.." />
+ <!-- environment should be declared before reading build.properties -->
+ <property environment="env" />
+ <property file="${services.trunk}/build.properties" />
+ <property name="mvn.opts" value="-V" />
+ <property name="src" location="src" />
+ <!-- JAR files used by CollectionSpace 4.0 and later -->
+ <property name="nuxeo.heldintrust.doctype.jars.all"
+ value="collectionspace.heldintrust.doctype.*.jar" />
+ <property name="nuxeo.heldintrust.schema.jars.all"
+ value="collectionspace.heldintrust.schema.*.jar" />
+ <!-- Legacy JAR files used by CollectionSpace 3.3 and earlier -->
+ <property name="nuxeo.heldintrust.legacy.jars.all"
+ value="org.collectionspace.services.heldintrust.3rdparty.nuxeo-*.jar" />
+ <property name="nuxeo.heldintrust.legacy.jar"
+ value="org.collectionspace.services.heldintrust.3rdparty.nuxeo-${cspace.release}.jar" />
+
+ <condition property="osfamily-unix">
+ <os family="unix" />
+ </condition>
+ <condition property="osfamily-windows">
+ <os family="windows" />
+ </condition>
+
+ <target name="init">
+ <!-- Create the time stamp -->
+ <tstamp />
+ </target>
+
+ <target name="package" depends="package-unix,package-windows"
+ description="Package CollectionSpace Services" />
+ <target name="package-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="package-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="install" depends="install-unix,install-windows"
+ description="Install" />
+ <target name="install-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="install-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="clean" depends="clean-unix,clean-windows"
+ description="Delete target directories">
+ <delete dir="${build}" />
+ </target>
+ <target name="clean-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="clean-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="test" depends="test-unix,test-windows" description="Run tests" />
+ <target name="test-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="test-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="deploy" depends="install"
+ description="deploy held in trust doctype in ${jee.server.nuxeo}">
+ <!-- This target is obsolete. The Nuxeo artifacts are now created and deployed using the
+ "csmake" tool
+ leaving this only for backwards compatibility reasons. -->
+ <copy file="${basedir}/target/${nuxeo.heldintrust.legacy.jar}"
+ todir="${jee.deploy.nuxeo.plugins}" />
+ </target>
+
+ <target name="undeploy"
+ description="undeploy held in trust doctype from ${jee.server.nuxeo}">
+ <delete>
+ <!-- Undeploy doctype and schema artifacts -->
+ <fileset dir="${jee.deploy.nuxeo.plugins}">
+ <include name="${nuxeo.heldintrust.doctype.jars.all}" />
+ </fileset>
+ <fileset dir="${jee.deploy.nuxeo.plugins}">
+ <include name="${nuxeo.heldintrust.schema.jars.all}" />
+ </fileset>
+ <!-- Undeploy legacy artifacts -->
+ <fileset dir="${jee.deploy.nuxeo.plugins}">
+ <include name="${nuxeo.heldintrust.legacy.jars.all}" />
+ </fileset>
+ </delete>
+ <!-- Undeploy legacy artifacts from old deployment location through release 0.6 -->
+ <delete quiet="true">
+ <fileset dir="${jee.deploy.nuxeo.system}">
+ <include name="${nuxeo.heldintrust.legacy.jars.all}" />
+ </fileset>
+ </delete>
+ </target>
+
+ <target name="dist"
+ description="generate distribution for held in trust doctype" depends="package">
+ <copy todir="${services.trunk}/${dist.deploy.nuxeo.plugins}">
+ <fileset file="${basedir}/target/${nuxeo.heldintrust.legacy.jar}" />
+ </copy>
+ </target>
+
+</project>
--- /dev/null
+<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>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.heldintrust.3rdparty</artifactId>
+ <version>${revision}</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.heldintrust.3rdparty.nuxeo</artifactId>
+ <name>services.heldintrust.3rdparty.nuxeo</name>
+ <packaging>jar</packaging>
+ <description>
+ Held In Trust Nuxeo Document Type
+ </description>
+
+ <properties>
+ <ServiceName>heldintrust</ServiceName>
+ <NuxeoDocTypeName>Heldintrust</NuxeoDocTypeName>
+ <CommonSchemaName>heldintrusts_common</CommonSchemaName>
+ <Lifecycle>cs_default</Lifecycle>
+ </properties>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>../../../../3rdparty/nuxeo/nuxeo-doctype/src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifestFile>target/classes/META-INF/MANIFEST.MF </manifestFile>
+ <manifestEntries>
+ <Bundle-Version>${eclipseVersion}</Bundle-Version>
+ <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
--- /dev/null
+Files formerly located in this directory are no longer needed
+-------------------------------------------------------------
+
+In CollectionSpace versions 4.0 and higher, changes were introduced
+which streamline and simplify the process through which you configure
+fields in CollectionSpace's main record types.
+
+In most cases now, you will typically change the behavior of existing fields,
+or create extension schemas to add new fields specific to your museum and/or
+community of practice, merely by editing simpler XML-based configuration
+files within CollectionSpace's Application layer.
+
+Services layer files that were formerly located in this directory and
+other, similar directories - which you previously needed to manually
+create or edit - are now generated automatically from your configuration
+in the Application layer.
\ No newline at end of file
--- /dev/null
+Files formerly located in this directory are no longer needed
+-------------------------------------------------------------
+
+In CollectionSpace versions 4.0 and higher, changes were introduced
+which streamline and simplify the process through which you configure
+fields in CollectionSpace's main record types.
+
+In most cases now, you will typically change the behavior of existing fields,
+or create extension schemas to add new fields specific to your museum and/or
+community of practice, merely by editing simpler XML-based configuration
+files within CollectionSpace's Application layer.
+
+Services layer files that were formerly located in this directory and
+other, similar directories - which you previously needed to manually
+create or edit - are now generated automatically from your configuration
+in the Application layer.
\ No newline at end of file
--- /dev/null
+<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.heldintrust</artifactId>
+ <groupId>org.collectionspace.services</groupId>
+ <version>${revision}</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.heldintrust.3rdparty</artifactId>
+ <name>services.heldintrust.3rdparty</name>
+ <packaging>pom</packaging>
+
+ <description>
+ 3rd party build for held in trust service
+ </description>
+
+ <modules>
+ <!-- This module is obsolete. The Nuxeo artifacts are now created and deployed using the "csmake" tool -->
+ </modules>
+</project>
--- /dev/null
+<project name="heldintrust" default="package" basedir=".">
+ <description>
+ held in trust service
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../.." />
+ <!-- environment should be declared before reading build.properties -->
+ <property environment="env" />
+ <property file="${services.trunk}/build.properties" />
+ <property name="mvn.opts" value="-V" />
+ <property name="src" location="src" />
+
+ <condition property="osfamily-unix">
+ <os family="unix" />
+ </condition>
+ <condition property="osfamily-windows">
+ <os family="windows" />
+ </condition>
+
+ <target name="package" depends="package-unix,package-windows"
+ description="Package CollectionSpace Services" />
+ <target name="package-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="package-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="package" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="install" depends="install-unix,install-windows"
+ description="Install" />
+ <target name="install-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="install-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="install" />
+ <arg value="-Dmaven.test.skip=true" />
+ <arg value="-f" />
+ <arg value="${basedir}/pom.xml" />
+ <arg value="-N" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="clean" depends="clean-unix,clean-windows"
+ description="Delete target directories">
+ <delete dir="${build}" />
+ </target>
+ <target name="clean-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="clean-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="clean" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="test" depends="test-unix,test-windows" description="Run tests" />
+ <target name="test-unix" if="osfamily-unix">
+ <exec executable="mvn" failonerror="true">
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+ <target name="test-windows" if="osfamily-windows">
+ <exec executable="cmd" failonerror="true">
+ <arg value="/c" />
+ <arg value="mvn" />
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="deploy" depends="install"
+ description="deploy held in trust service">
+ <ant antfile="3rdparty/build.xml" target="deploy" inheritall="false" />
+ </target>
+
+ <target name="undeploy"
+ description="undeploy held in trust service">
+ <ant antfile="3rdparty/build.xml" target="undeploy" inheritall="false" />
+ </target>
+
+ <target name="dist" depends="package"
+ description="distribute held in trust service">
+ <ant antfile="3rdparty/build.xml" target="dist" inheritall="false" />
+ </target>
+
+</project>
--- /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>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.heldintrust</artifactId>
+ <version>${revision}</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.heldintrust.client</artifactId>
+ <name>services.heldintrust.client</name>
+
+ <dependencies>
+ <!-- CollectionSpace dependencies -->
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.common</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.heldintrust.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.person.client</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.organization.client</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- External dependencies -->
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-multipart-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>collectionspace-services-heldintrust-client</finalName>
+ </build>
+</project>
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright (c) 2009 Regents of the University of California
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.collectionspace.services.client;
+
+import org.collectionspace.services.heldintrust.HeldintrustsCommon;
+
+/**
+ * HeldInTrustClient
+ *
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+public class HeldintrustClient extends AbstractCommonListPoxServiceClientImpl<HeldintrustProxy, HeldintrustsCommon> {
+
+ public static final String SERVICE_NAME = "heldintrusts";
+ public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
+ public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
+ public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";
+ public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
+
+ public HeldintrustClient() throws Exception {
+ super();
+ }
+
+ public HeldintrustClient(String clientPropertiesFilename) throws Exception {
+ super(clientPropertiesFilename);
+ }
+
+ @Override
+ public String getServiceName() {
+ return SERVICE_NAME;
+ }
+
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ @Override
+ public Class<HeldintrustProxy> getProxyClass() {
+ return HeldintrustProxy.class;
+ }
+}
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright (c) 2009 Regents of the University of California
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.collectionspace.services.client;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+/**
+ * HeldInTrustProxy
+ *
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+@Path(HeldintrustClient.SERVICE_PATH_PROXY)
+@Produces({"application/xml"})
+@Consumes({"application/xml"})
+public interface HeldintrustProxy extends CollectionSpaceCommonListPoxProxy {
+ // Intentionally left blank
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This config is used by the maven surefire plugin (for tests), as configured in services/pom.xml.
+ For runtime logging config, see services/JaxRsServiceProvider/src/main/resources/log4j2.xml.
+-->
+<Configuration status="WARN">
+ <Properties>
+ <Property name="logPattern">%d %-5p [%t] [%c:%L] %m%n</Property>
+ </Properties>
+
+ <Appenders>
+ <Console name="ConsoleAppender" target="SYSTEM_OUT">
+ <PatternLayout pattern="${logPattern}" />
+ </Console>
+
+ <File name="LogFileAppender" append="false" fileName="target/test.log">
+ <PatternLayout pattern="${logPattern}" />
+ </File>
+ </Appenders>
+
+ <Loggers>
+ <Root level="DEBUG">
+ <AppenderRef ref="ConsoleAppender"/>
+ <AppenderRef ref="LogFileAppender" />
+ </Root>
+
+ <Logger name="httpclient" level="INFO" />
+ <Logger name="org.apache" level="INFO" />
+ <Logger name="org.collectionspace.services.client.PoxPayloadIn" level="DEBUG" />
+ <Logger name="org.collectionspace.services.client.PoxPayloadOut" level="DEBUG" />
+ <Logger name="org.collectionspace" level="DEBUG" />
+ <Logger name="org.jboss.resteasy" level="INFO" />
+ </Loggers>
+</Configuration>
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright © 2009 Regents of the University of California
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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.Response;
+
+import org.collectionspace.services.PersonJAXBSchema;
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.HeldintrustClient;
+import org.collectionspace.services.client.PersonAuthorityClientUtils;
+import org.collectionspace.services.client.PersonClient;
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.heldintrust.HeldintrustsCommon;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.person.PersonTermGroup;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+/**
+ * HitAuthRefsTest, carries out tests against a
+ * deployed and running Hit Service.
+ *
+ * $LastChangedRevision: 1327 $
+ * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $
+ */
+public class HeldintrustAuthRefsTest extends BaseServiceTest<AbstractCommonList> {
+
+ // Instance variables specific to this test.
+ final String SERVICE_PATH_COMPONENT = HeldintrustClient.SERVICE_PATH_COMPONENT;
+ final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
+ private final String CLASS_NAME = HeldintrustAuthRefsTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+
+ private final List<String> hitIdsCreated = new ArrayList<String>();
+ private final List<String> personIdsCreated = new ArrayList<String>();
+ private String personAuthCSID = null;
+ private String depositorContactRefName = null;
+ private String depositorRefName = null;
+ private String externalApprovalIndividualRefName = null;
+ private String correspondenceSenderRefName = null;
+ private String valuerRefName = null;
+
+ @Override
+ protected String getServiceName() {
+ throw new UnsupportedOperationException(); //FIXME: REM - See http://issues.collectionspace.org/browse/CSPACE-3498
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
+ */
+ @Override
+ protected CollectionSpaceClient getClientInstance() {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
+ @Override
+ protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client
+ * .ClientResponse)
+ */
+ @Override
+ protected AbstractCommonList getCommonList(Response response) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
+ // ---------------------------------------------------------------
+ // CRUD tests : CREATE tests
+ // ---------------------------------------------------------------
+ // Success outcomes
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+ public void createWithAuthRefs(String testName) throws Exception {
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
+
+ // Submit the request to the service and store the response.
+ String identifier = createIdentifier();
+
+ // Create all the person refs and entities
+ createPersonRefs();
+
+ // Submit the request to the service and store the response.
+ HeldintrustClient heldInTrustClient = new HeldintrustClient();
+ PoxPayloadOut multipart = createHitInstance(
+ "entryNumber-" + identifier,
+ depositorContactRefName,
+ depositorRefName,
+ externalApprovalIndividualRefName,
+ correspondenceSenderRefName);
+
+ String newId;
+ Response res = heldInTrustClient.create(multipart);
+ try {
+ int statusCode = res.getStatus();
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ //
+ // Specifically:
+ // Does it fall within the set of valid status codes?
+ // Does it exactly match the expected status code?
+ logger.debug("{}: status = {}", testName, statusCode);
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, testExpectedStatusCode);
+ newId = extractId(res);
+ } finally {
+ res.close();
+ }
+
+ // Store the ID returned from the first resource created
+ // for additional tests below.
+ if (knownResourceId == null) {
+ knownResourceId = newId;
+ logger.debug("{}: knownResourceId={}", testName, knownResourceId);
+ }
+
+ // Store the IDs from every resource created by tests,
+ // so they can be deleted after tests have been run.
+ hitIdsCreated.add(newId);
+ }
+
+ protected void createPersonRefs() throws Exception {
+ //
+ // First, create a new person authority
+ //
+ PersonClient personAuthClient = new PersonClient();
+ PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
+ PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
+ Response res = personAuthClient.create(multipart);
+ try {
+ int statusCode = res.getStatus();
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, STATUS_CREATED);
+ personAuthCSID = extractId(res);
+ } finally {
+ res.close();
+ }
+
+ String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
+ String csid = createPerson("Olivier", "Contact", "olivierContact", authRefName);
+ depositorContactRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ personIdsCreated.add(csid);
+
+ csid = createPerson("Debbie", "Depositor", "debbieDepositor", authRefName);
+ depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ personIdsCreated.add(csid);
+
+ csid = createPerson("Andrew", "ApprovalIndividual", "andrewApprovalIndividual", authRefName);
+ externalApprovalIndividualRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ personIdsCreated.add(csid);
+
+ csid = createPerson("Ingrid", "Sender", "ingridSender", authRefName);
+ correspondenceSenderRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ personIdsCreated.add(csid);
+
+ csid = createPerson("Vince", "Valuer", "vinceValuer", authRefName);
+ valuerRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ personIdsCreated.add(csid);
+ }
+
+ protected String createPerson(String firstName, String surName, String shortId, String authRefName)
+ throws Exception {
+ String result;
+
+ PersonClient personAuthClient = new PersonClient();
+ 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);
+ List<PersonTermGroup> personTerms = new ArrayList<PersonTermGroup>();
+ PersonTermGroup term = new PersonTermGroup();
+ String termName = firstName + " " + surName;
+ term.setTermDisplayName(termName);
+ term.setTermName(termName);
+ personTerms.add(term);
+ PoxPayloadOut multipart =
+ PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
+ authRefName, personInfo, personTerms,
+ personAuthClient.getItemCommonPartName());
+
+ Response res = personAuthClient.createItem(personAuthCSID, multipart);
+ try {
+ int statusCode = res.getStatus();
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, STATUS_CREATED);
+ result = extractId(res);
+ } finally {
+ res.close();
+ }
+
+ return result;
+ }
+
+ // Success outcomes
+ @Test(dataProvider = "testName", dependsOnMethods = {"createWithAuthRefs"})
+ public void readAndCheckAuthRefs(String testName) throws Exception {
+ // Perform setup.
+ testSetup(STATUS_OK, ServiceRequestType.READ);
+
+ // Submit the request to the service and store the response.
+ HeldintrustClient heldInTrustClient = new HeldintrustClient();
+ Response res = heldInTrustClient.read(knownResourceId);
+ try {
+ assertStatusCode(res, testName);
+ PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class));
+ HeldintrustsCommon hit = (HeldintrustsCommon) extractPart(input, heldInTrustClient.getCommonPartName(),
+ HeldintrustsCommon.class);
+ Assert.assertNotNull(hit);
+ // Check a couple of fields
+ } finally {
+ if (res != null) {
+ res.close();
+ }
+ }
+
+ // Get the auth refs and check them
+ res = heldInTrustClient.getAuthorityRefs(knownResourceId);
+ AuthorityRefList list;
+ try {
+ assertStatusCode(res, testName);
+ list = res.readEntity(AuthorityRefList.class);
+ } finally {
+ if (res != null) {
+ res.close();
+ }
+ }
+
+ List<AuthorityRefList.AuthorityRefItem> items = list.getAuthorityRefItem();
+ int numAuthRefsFound = items.size();
+ logger.debug("Expected {} authority references, found {}", personIdsCreated.size(), numAuthRefsFound);
+
+ // output additional data about list members for debugging.
+ int i = 0;
+ for (AuthorityRefList.AuthorityRefItem item : items) {
+ logger.debug("{}: list-item[{}] Field:{}={}{}", testName, i, item.getSourceField(),
+ item.getAuthDisplayName(), item.getItemDisplayName());
+ logger.debug("{}: list-item[{}] refName={}", testName, i, item.getRefName());
+ logger.debug("{}: list-item[{}] URI={}", testName, i, item.getUri());
+ i++;
+ }
+
+ //
+ // Ensure we got the correct number of authRefs
+ Assert.assertEquals(numAuthRefsFound, personIdsCreated.size(),
+ "Did not find all expected authority references! " + "Expected " + personIdsCreated.size() +
+ ", found " + numAuthRefsFound);
+ }
+
+
+ // ---------------------------------------------------------------
+ // Cleanup of resources created during testing
+ // ---------------------------------------------------------------
+
+ /**
+ * Deletes all resources created by tests, after all tests have been run.
+ *
+ * This cleanup method will always be run, even if one or more tests fail.
+ * For this reason, it attempts to remove all resources created
+ * at any point during testing, even if some of those resources
+ * may be expected to be deleted by certain tests.
+ *
+ * @throws Exception
+ */
+ @AfterClass(alwaysRun = true)
+ public void cleanUp() throws Exception {
+ String noTest = System.getProperty("noTestCleanup");
+ if (Boolean.parseBoolean(noTest)) {
+ logger.debug("Skipping Cleanup phase ...");
+ return;
+ }
+
+ logger.debug("Cleaning up temporary resources created for testing ...");
+ HeldintrustClient heldInTrustClient = new HeldintrustClient();
+ // Note: Any non-success responses are ignored and not reported.
+ for (String resourceId : hitIdsCreated) {
+ heldInTrustClient.delete(resourceId).close();
+ }
+ //
+ // Delete all the person records then the parent resource
+ PersonClient personAuthClient = new PersonClient();
+ for (String resourceId : personIdsCreated) {
+ personAuthClient.deleteItem(personAuthCSID, resourceId).close();
+ }
+ personAuthClient.delete(personAuthCSID).close();
+ }
+
+ // ---------------------------------------------------------------
+ // Utility methods used by tests above
+ // ---------------------------------------------------------------
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ private PoxPayloadOut createHitInstance(String heldInTrustNumber,
+ String depositorContact,
+ String depositor,
+ String externalApprovalIndividual,
+ String correspondenceSender) throws Exception {
+ HeldintrustsCommon hit =
+ HeldintrustClientTestUtil.createHitInstance(heldInTrustNumber, depositorContact, depositor,
+ externalApprovalIndividual, correspondenceSender);
+ hit.setHeldInTrustNumber(heldInTrustNumber);
+
+ PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
+ multipart.addPart(new HeldintrustClient().getCommonPartName(), hit);
+
+ logger.debug("to be created, hit common");
+ logger.debug("{}", objectAsXmlString(hit, HeldintrustsCommon.class));
+
+ return multipart;
+ }
+}
--- /dev/null
+package org.collectionspace.services.client.test;
+
+import java.util.List;
+
+import org.collectionspace.services.heldintrust.CorrespondenceGroup;
+import org.collectionspace.services.heldintrust.CorrespondenceGroupList;
+import org.collectionspace.services.heldintrust.ExternalApprovalGroup;
+import org.collectionspace.services.heldintrust.ExternalApprovalGroupList;
+import org.collectionspace.services.heldintrust.HeldInTrustDepositorGroup;
+import org.collectionspace.services.heldintrust.HeldInTrustDepositorGroupList;
+import org.collectionspace.services.heldintrust.HeldintrustsCommon;
+import org.collectionspace.services.heldintrust.InternalApprovalGroup;
+import org.collectionspace.services.heldintrust.InternalApprovalGroupList;
+
+
+public class HeldintrustClientTestUtil {
+
+ protected static HeldintrustsCommon createHitInstance(
+ String heldInTrustNumber,
+ String depositorContact,
+ String depositor,
+ String externalApprovalIndividual,
+ String correspondenceSender) {
+ HeldintrustsCommon heldInTrust = new HeldintrustsCommon();
+
+ heldInTrust.setHeldInTrustNumber(heldInTrustNumber);
+
+ HeldInTrustDepositorGroupList tempHDGL = heldInTrust.getHeldInTrustDepositorGroupList();
+ if (tempHDGL == null) {
+ tempHDGL = new HeldInTrustDepositorGroupList();
+ }
+ List<HeldInTrustDepositorGroup> hitDepositorGroupList = tempHDGL.getHeldInTrustDepositorGroup();
+ HeldInTrustDepositorGroup hitDepositorGroup = new HeldInTrustDepositorGroup();
+ hitDepositorGroup.setDepositor(depositor);
+ hitDepositorGroup.setDepositorContact(depositorContact);
+ hitDepositorGroupList.add(hitDepositorGroup);
+ heldInTrust.setHeldInTrustDepositorGroupList(tempHDGL);
+
+ InternalApprovalGroupList tempIAGL = heldInTrust.getInternalApprovalGroupList();
+ if (tempIAGL == null) {
+ tempIAGL = new InternalApprovalGroupList();
+ }
+ List<InternalApprovalGroup> internalApprovalGroupList = tempIAGL.getInternalApprovalGroup();
+ InternalApprovalGroup internalApprovalGroup = new InternalApprovalGroup();
+ internalApprovalGroup.setInternalApprovalIndividual(depositor);
+ internalApprovalGroupList.add(internalApprovalGroup);
+ heldInTrust.setInternalApprovalGroupList(tempIAGL);
+
+ ExternalApprovalGroupList tempEAGL = heldInTrust.getExternalApprovalGroupList();
+ if (tempEAGL == null) {
+ tempEAGL = new ExternalApprovalGroupList();
+ }
+ List<ExternalApprovalGroup> externalApprovalGroupList = tempEAGL.getExternalApprovalGroup();
+ ExternalApprovalGroup externalApprovalGroup = new ExternalApprovalGroup();
+ externalApprovalGroup.setExternalApprovalIndividual(externalApprovalIndividual);
+ externalApprovalGroupList.add(externalApprovalGroup);
+ heldInTrust.setExternalApprovalGroupList(tempEAGL);
+
+ CorrespondenceGroupList tempCGL = heldInTrust.getCorrespondenceGroupList();
+ if (tempCGL == null) {
+ tempCGL = new CorrespondenceGroupList();
+ }
+ List<CorrespondenceGroup> correspondanceGroupList = tempCGL.getCorrespondenceGroup();
+ CorrespondenceGroup correspondenceGroup = new CorrespondenceGroup();
+ correspondenceGroup.setCorrespondenceSender(correspondenceSender);
+ correspondanceGroupList.add(correspondenceGroup);
+ heldInTrust.setCorrespondenceGroupList(tempCGL);
+
+ return heldInTrust;
+ }
+
+}
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright © 2009 Regents of the University of California
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.collectionspace.services.client.test;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.HeldintrustClient;
+import org.collectionspace.services.client.PayloadInputPart;
+import org.collectionspace.services.client.PayloadOutputPart;
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils;
+import org.collectionspace.services.heldintrust.HeldintrustsCommon;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.dom4j.Element;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * HeldintrustServiceTest, carries out tests against a deployed and running Hit Service.
+ *
+ * FIXME: http://issues.collectionspace.org/browse/CSPACE-1685
+ *
+ * $LastChangedRevision$
+ * $LastChangedDate$
+ */
+public class HeldintrustServiceTest extends AbstractPoxServiceTestImpl<AbstractCommonList, HeldintrustsCommon> {
+
+ private final static String CURRENT_DATE_UTC = GregorianCalendarDateTimeUtils.currentDateUTC();
+
+ /**
+ * The logger
+ */
+ private final Logger logger = LoggerFactory.getLogger(HeldintrustServiceTest.class);
+
+ @Override
+ protected CollectionSpaceClient getClientInstance() throws Exception {
+ return new HeldintrustClient();
+ }
+
+ @Override
+ protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
+ return new HeldintrustClient(clientPropertiesFilename);
+ }
+
+ @Override
+ protected String getServiceName() {
+ return HeldintrustClient.SERVICE_NAME;
+ }
+
+ // ---------------------------------------------------------------
+ // CRUD tests : READ tests
+ // ---------------------------------------------------------------
+ @Override
+ protected void compareReadInstances(HeldintrustsCommon original, HeldintrustsCommon fromRead) {
+ // Add test here
+ }
+
+ @Override
+ public void delete(String testName) {
+ // Do nothing because this test is not ready to delete the "knownResourceId".
+ // Instead, the method localDelete() will get called later in the dependency chain. The
+ // method localDelete() has a dependency on the test "verifyReadOnlyCoreFields". Once the
+ // "verifyReadOnlyCoreFields"
+ // test is run, the localDelete() test/method will get run. The localDelete() test/method in turn
+ // calls the inherited delete() test/method.
+ }
+
+ @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests", "verifyReadOnlyCoreFields"})
+ public void localDelete(String testName) throws Exception {
+ // Because of issues with TestNG not allowing @Test annotations on override methods,
+ // and because we want the "updateWrongUser" to run before the "delete" test, we need
+ // this method. This method will call super.delete() after all the dependencies have been
+ // met.
+ super.delete(testName);
+ }
+
+ @Test(dataProvider = "testName", dependsOnMethods = {"CRUDTests"})
+ public void verifyReadOnlyCoreFields(String testName) throws Exception {
+ // TODO These should be in some core client utils
+ final String COLLECTIONSPACE_CORE_SCHEMA = "collectionspace_core";
+ final String COLLECTIONSPACE_CORE_TENANTID = "tenantId";
+ final String COLLECTIONSPACE_CORE_URI = "uri";
+ final String COLLECTIONSPACE_CORE_CREATED_AT = "createdAt";
+ final String COLLECTIONSPACE_CORE_CREATED_BY = "createdBy";
+
+ // Perform setup.
+ setupUpdate();
+
+ // Retrieve the contents of a resource to update.
+ HeldintrustClient client = new HeldintrustClient();
+ PoxPayloadIn input;
+ Response res = client.read(knownResourceId);
+ try {
+ logger.debug("{}: read status = {}", testName, res.getStatus());
+ Assert.assertEquals(res.getStatus(), testExpectedStatusCode);
+
+ input = new PoxPayloadIn(res.readEntity(String.class));
+ } finally {
+ res.close();
+ }
+
+ PayloadInputPart payloadInputPart = input.getPart(COLLECTIONSPACE_CORE_SCHEMA);
+ Element coreAsElement = null;
+ if (payloadInputPart != null) {
+ coreAsElement = payloadInputPart.getElementBody();
+ }
+ Assert.assertNotNull(coreAsElement);
+ logger.debug("Core part before update:");
+ logger.debug("{}", coreAsElement.asXML());
+
+ // Update the read-only elements
+ Element tenantId = coreAsElement.element(COLLECTIONSPACE_CORE_TENANTID);
+ String originalTenantId = tenantId.getText();
+ tenantId.setText("foo");
+ Element uri = coreAsElement.element(COLLECTIONSPACE_CORE_URI);
+ String originalUri = uri.getText();
+ uri.setText("foo");
+ Element createdAt = coreAsElement.element(COLLECTIONSPACE_CORE_CREATED_AT);
+ String originalCreatedAt = createdAt.getText();
+ String now = GregorianCalendarDateTimeUtils.timestampUTC();
+ if (originalCreatedAt.equalsIgnoreCase(now)) {
+ logger.warn("Cannot check createdAt read-only; too fast!");
+ }
+ createdAt.setText(now);
+ Element createdBy = coreAsElement.element(COLLECTIONSPACE_CORE_CREATED_BY);
+ String originalCreatedBy = createdBy.getText();
+ createdBy.setText("foo");
+
+ logger.debug("Core part to be updated:");
+ logger.debug("{}", coreAsElement.asXML());
+
+ // Create an output payload to send to the service, and add the common part
+ PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent());
+ output.addPart(COLLECTIONSPACE_CORE_SCHEMA, coreAsElement);
+
+ // Submit the request to the service and store the response.
+ res = client.update(knownResourceId, output);
+ try {
+ int statusCode = res.getStatus();
+ // Check the status code of the response: does it match the expected response(s)?
+ logger.debug("{}: status = {}", testName, statusCode);
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, testExpectedStatusCode);
+
+ input = new PoxPayloadIn(res.readEntity(String.class));
+ } finally {
+ res.close();
+ }
+
+ PayloadInputPart updatedCorePart = input.getPart(COLLECTIONSPACE_CORE_SCHEMA);
+ Element updatedCoreAsElement = null;
+ if (updatedCorePart != null) {
+ updatedCoreAsElement = updatedCorePart.getElementBody();
+ }
+ Assert.assertNotNull(updatedCoreAsElement);
+
+ tenantId = updatedCoreAsElement.element(COLLECTIONSPACE_CORE_TENANTID);
+ String updatedTenantId = tenantId.getText();
+ Assert.assertEquals(updatedTenantId, originalTenantId, "CORE part TenantID was able to update!");
+ uri = updatedCoreAsElement.element(COLLECTIONSPACE_CORE_URI);
+ String updatedUri = uri.getText();
+ Assert.assertEquals(updatedUri, originalUri, "CORE part URI was able to update!");
+ createdAt = updatedCoreAsElement.element(COLLECTIONSPACE_CORE_CREATED_AT);
+ String updatedCreatedAt = createdAt.getText();
+ Assert.assertEquals(updatedCreatedAt, originalCreatedAt, "CORE part CreatedAt was able to update!");
+ createdBy = updatedCoreAsElement.element(COLLECTIONSPACE_CORE_CREATED_BY);
+ String updatedCreatedBy = createdBy.getText();
+ Assert.assertEquals(updatedCreatedBy, originalCreatedBy, "CORE part CreatedBy was able to update!");
+ }
+
+ // ---------------------------------------------------------------
+ // Utility tests : tests of code used in tests above
+ // ---------------------------------------------------------------
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent()
+ */
+ @Override
+ public String getServicePathComponent() {
+ return HeldintrustClient.SERVICE_PATH_COMPONENT;
+ }
+
+ /**
+ * Creates the hit instance.
+ *
+ * @param identifier the identifier
+ * @return the multipart output
+ * @throws Exception
+ */
+ @Override
+ protected PoxPayloadOut createInstance(String identifier) throws Exception {
+ return createHitInstance("entryNumber-" + identifier);
+ }
+
+ /**
+ * Creates the hit instance.
+ *
+ * @param entryNumber the entry number
+ * @return the multipart output
+ * @throws Exception
+ */
+ private PoxPayloadOut createHitInstance(String entryNumber) throws Exception {
+ HeldintrustsCommon hit = new HeldintrustsCommon();
+ hit.setHeldInTrustNumber(entryNumber);
+
+ PoxPayloadOut multipart = new PoxPayloadOut(HeldintrustClient.SERVICE_PAYLOAD_NAME);
+ PayloadOutputPart commonPart = multipart.addPart(hit, MediaType.APPLICATION_XML_TYPE);
+ commonPart.setLabel(new HeldintrustClient().getCommonPartName());
+
+ logger.debug("to be created, HitsCommon instance");
+ logger.debug("{}", objectAsXmlString(hit, HeldintrustsCommon.class));
+
+ return multipart;
+ }
+
+ @Override
+ protected PoxPayloadOut createInstance(String commonPartName, String identifier) throws Exception {
+ return this.createInstance(identifier);
+ }
+
+ @Override
+ protected HeldintrustsCommon updateInstance(HeldintrustsCommon hitsCommon) {
+ HeldintrustsCommon result = new HeldintrustsCommon();
+
+ result.setHeldInTrustNumber("hits");
+
+ return result;
+ }
+
+ @Override
+ protected void compareUpdatedInstances(HeldintrustsCommon original,
+ HeldintrustsCommon updated) {
+ // put test here
+ }
+
+ /*
+ * For convenience and terseness, this test method is the base of the test execution dependency chain. Other
+ * test methods may
+ * refer to this method in their @Test annotation declarations.
+ */
+ @Override
+ @Test(dataProvider = "testName",
+ dependsOnMethods = {
+ "org.collectionspace.services.client.test.AbstractServiceTestImpl.baseCRUDTests"})
+ public void CRUDTests(String testName) {
+ // Needed for TestNG dependency chain.
+ }
+}
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright © 2009 Regents of the University of California
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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.Response;
+
+import org.collectionspace.services.OrganizationJAXBSchema;
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.HeldintrustClient;
+import org.collectionspace.services.client.OrgAuthorityClientUtils;
+import org.collectionspace.services.client.OrganizationClient;
+import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
+import org.collectionspace.services.heldintrust.HeldintrustsCommon;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.organization.OrgTermGroup;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+/**
+ * OrganizationAuthRefDocsTest, carries out tests against a
+ * deployed and running Organization Service.
+ *
+ * $LastChangedRevision: 1327 $
+ * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $
+ */
+public class OrganizationAuthRefDocsTest extends BaseServiceTest<AbstractCommonList> {
+
+ private static final Logger logger = LoggerFactory.getLogger(OrganizationAuthRefDocsTest.class);
+ // Instance variables specific to this test.
+ final String SERVICE_PATH_COMPONENT = "hits";
+ final String ORGANIZATION_AUTHORITY_NAME = "TestOrganizationAuth";
+ private String knownHitId = null;
+ private final List<String> hitIdsCreated = new ArrayList<String>();
+ private final List<String> orgIdsCreated = new ArrayList<String>();
+ private String orgAuthCSID = null;
+ private String currentContactOrgCSID = null;
+ private String depositorContactRefName = null;
+ private String depositorRefName = null;
+ private String externalApprovalIndividualRefName = null;
+ private String correspondenceSenderRefName = null;
+ private String valuerRefName = null;
+
+ @Override
+ protected String getServiceName() {
+ throw new UnsupportedOperationException(); //FIXME: REM - See http://issues.collectionspace.org/browse/CSPACE-3498
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
+ */
+ @Override
+ protected CollectionSpaceClient getClientInstance() {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
+ @Override
+ protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client
+ * .ClientResponse)
+ */
+ @Override
+ protected AbstractCommonList getCommonList(Response response) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
+ // ---------------------------------------------------------------
+ // CRUD tests : CREATE tests
+ // ---------------------------------------------------------------
+ // Success outcomes
+ @Test(dataProvider = "testName", dataProviderClass = BaseServiceTest.class)
+ public void createHitWithAuthRefs(String testName) throws Exception {
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
+
+ // Submit the request to the service and store the response.
+ String identifier = createIdentifier();
+
+ // Create all the organization refs and entities
+ createOrgRefs();
+
+ HeldintrustClient heldInTrustClient = new HeldintrustClient();
+ PoxPayloadOut hitPayload = createHitInstance(
+ "entryNumber-" + identifier,
+ depositorContactRefName,
+ // Use currentOwnerRefName twice to test fix for CSPACE-2863
+ depositorContactRefName,
+ externalApprovalIndividualRefName,
+ correspondenceSenderRefName);
+
+ Response res = heldInTrustClient.create(hitPayload);
+ try {
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match the expected response(s)?
+ // Specifically:
+ // Does it fall within the set of valid status codes?
+ // Does it exactly match the expected status code?
+ logger.debug("{}: status = {}", testName, statusCode);
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, testExpectedStatusCode);
+ String newHitId = extractId(res);
+ Assert.assertNotNull(newHitId, "Could not create a new Hit record.");
+
+ // Store the ID returned from the first resource created
+ // for additional tests below.
+ if (knownHitId == null) {
+ knownHitId = newHitId;
+ logger.debug("{}: knownHitId={}", testName, knownHitId);
+ }
+
+ // Store the IDs from every resource created by tests,
+ // so they can be deleted after tests have been run.
+ hitIdsCreated.add(newHitId);
+ } finally {
+ res.close();
+ }
+
+ }
+
+ /**
+ * Creates the organization refs.
+ *
+ * @throws Exception
+ */
+ protected void createOrgRefs() throws Exception {
+ OrganizationClient orgAuthClient = new OrganizationClient();
+ PoxPayloadOut multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
+ ORGANIZATION_AUTHORITY_NAME, ORGANIZATION_AUTHORITY_NAME, orgAuthClient.getCommonPartName());
+ Response res = orgAuthClient.create(multipart);
+ try {
+ int statusCode = res.getStatus();
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, STATUS_CREATED);
+ orgAuthCSID = extractId(res);
+ Assert.assertNotNull(orgAuthCSID, "Could not create a new Organization authority record.");
+ } finally {
+ res.close();
+ }
+
+ currentContactOrgCSID = createOrganization("olivierContactCompany", "Olivier Contact Company",
+ "Olivier Contact Company");
+ orgIdsCreated.add(currentContactOrgCSID);
+ depositorContactRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID,
+ currentContactOrgCSID, orgAuthClient);
+
+ String newOrgCSID =
+ createOrganization("debbieDepositorAssocs", "Debbie Depositor & Associates",
+ "Debbie Depositor & Associates");
+ depositorRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, newOrgCSID, orgAuthClient);
+ orgIdsCreated.add(newOrgCSID);
+
+ newOrgCSID = createOrganization("andrewExternalApprovalLtd", "Andrew External-Approval Ltd.",
+ "Andrew External-Approval Ltd.");
+ externalApprovalIndividualRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID,
+ newOrgCSID, orgAuthClient);
+ orgIdsCreated.add(newOrgCSID);
+
+ newOrgCSID = createOrganization("ingridCorrespondenceSender", "Ingrid Correspondence Sender",
+ "Ingrid Correspondence Sender");
+ correspondenceSenderRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, newOrgCSID, orgAuthClient);
+ orgIdsCreated.add(newOrgCSID);
+
+ newOrgCSID = createOrganization("vinceValuerLLC", "Vince Valuer LLC", "Vince Valuer LLC");
+ valuerRefName = OrgAuthorityClientUtils.getOrgRefName(orgAuthCSID, newOrgCSID, orgAuthClient);
+ orgIdsCreated.add(newOrgCSID);
+ }
+
+ protected String createOrganization(String shortId, String shortName, String longName) throws Exception {
+ String result;
+
+ OrganizationClient orgAuthClient = new OrganizationClient();
+ Map<String, String> orgInfo = new HashMap<String, String>();
+ orgInfo.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, shortId);
+
+ List<OrgTermGroup> orgTerms = new ArrayList<OrgTermGroup>();
+ OrgTermGroup term = new OrgTermGroup();
+ term.setTermDisplayName(shortName);
+ term.setTermName(shortName);
+ term.setMainBodyName(longName);
+ orgTerms.add(term);
+ PoxPayloadOut multipart =
+ OrgAuthorityClientUtils.createOrganizationInstance(null,
+ orgInfo, orgTerms,
+ orgAuthClient.getItemCommonPartName());
+
+ Response res = orgAuthClient.createItem(orgAuthCSID, multipart);
+ try {
+ int statusCode = res.getStatus();
+
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, STATUS_CREATED);
+ result = extractId(res);
+ } finally {
+ res.close();
+ }
+
+ return result;
+ }
+
+ // Success outcomes here
+ @Test(dataProvider = "testName", dataProviderClass = BaseServiceTest.class,
+ dependsOnMethods = {"createHitWithAuthRefs"})
+ public void readAndCheckAuthRefDocs(String testName) throws Exception {
+ // Perform setup.
+ testSetup(STATUS_OK, ServiceRequestType.READ);
+
+ // Get the auth ref docs and check them
+ OrganizationClient orgAuthClient = new OrganizationClient();
+ Response refDocListResp = orgAuthClient.getReferencingObjects(orgAuthCSID, currentContactOrgCSID);
+ AuthorityRefDocList list;
+ try {
+ assertStatusCode(refDocListResp, testName);
+ list = refDocListResp.readEntity(AuthorityRefDocList.class);
+ Assert.assertNotNull(list);
+ } finally {
+ if (refDocListResp != null) {
+ refDocListResp.close();
+ }
+ }
+
+ // Optionally output additional data about list members for debugging.
+ int nHitsFound = 0;
+ final int EXPECTED_HITS = 3;
+ int i = 0;
+ logger.debug("{}: Docs that use: {}", testName, depositorContactRefName);
+ for (AuthorityRefDocList.AuthorityRefDocItem item : list.getAuthorityRefDocItem()) {
+ logger.debug("{}: list-item[{}] {} ({}) Name:[{}] Number:[{}] in field:[{}]", testName, i,
+ item.getDocType(), item.getDocId(), item.getDocName(), item.getDocNumber(),
+ item.getSourceField());
+ if (knownHitId.equalsIgnoreCase(item.getDocId())) {
+ nHitsFound++;
+ }
+ i++;
+ }
+ Assert.assertTrue((nHitsFound == EXPECTED_HITS), "Did not find Hit (twice more) with authref!");
+ }
+
+
+ // ---------------------------------------------------------------
+ // Cleanup of resources created during testing
+ // ---------------------------------------------------------------
+
+ /**
+ * Deletes all resources created by tests, after all tests have been run.
+ *
+ * This cleanup method will always be run, even if one or more tests fail.
+ * For this reason, it attempts to remove all resources created
+ * at any point during testing, even if some of those resources
+ * may be expected to be deleted by certain tests.
+ *
+ * @throws Exception
+ */
+ @AfterClass(alwaysRun = true)
+ public void cleanUp() throws Exception {
+ String noTest = System.getProperty("noTestCleanup");
+ if (Boolean.parseBoolean(noTest)) {
+ logger.debug("Skipping Cleanup phase ...");
+ return;
+ }
+
+ logger.debug("Cleaning up temporary resources created for testing ...");
+ HeldintrustClient heldInTrustClient = new HeldintrustClient();
+ // Note: Any non-success responses are ignored and not reported.
+ for (String resourceId : hitIdsCreated) {
+ heldInTrustClient.delete(resourceId).close();
+ }
+ // Delete persons before PersonAuth
+ OrganizationClient personAuthClient = new OrganizationClient();
+ for (String resourceId : orgIdsCreated) {
+ personAuthClient.deleteItem(orgAuthCSID, resourceId).close();
+ }
+ if (orgAuthCSID != null) {
+ personAuthClient.delete(orgAuthCSID).close();
+ }
+ }
+
+ // ---------------------------------------------------------------
+ // Utility methods used by tests above
+ // ---------------------------------------------------------------
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ private PoxPayloadOut createHitInstance(String heldInTrustNumber,
+ String depositorContact,
+ String depositor,
+ String externalApprovalIndividual,
+ String correspondenceSender) throws Exception {
+ HeldintrustsCommon hit =
+ HeldintrustClientTestUtil.createHitInstance(heldInTrustNumber, depositorContact, depositor,
+ externalApprovalIndividual, correspondenceSender);
+
+ PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
+ multipart.addPart(new HeldintrustClient().getCommonPartName(), hit);
+
+ logger.debug("to be created, hit common");
+ logger.debug("{}", objectAsXmlString(hit, HeldintrustsCommon.class));
+
+ return multipart;
+ }
+}
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright © 2009 Regents of the University of California
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+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.Response;
+
+import org.collectionspace.services.PersonJAXBSchema;
+import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.HeldintrustClient;
+import org.collectionspace.services.client.PersonAuthorityClientUtils;
+import org.collectionspace.services.client.PersonClient;
+import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.authorityref.AuthorityRefDocList;
+import org.collectionspace.services.heldintrust.HeldintrustsCommon;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.person.PersonTermGroup;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+/**
+ * PersonAuthRefDocsTest, carries out tests against a
+ * deployed and running Person Service.
+ *
+ * $LastChangedRevision: 1327 $
+ * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $
+ */
+public class PersonAuthRefDocsTest extends BaseServiceTest<AbstractCommonList> {
+
+ // Instance variables specific to this test.
+ final String SERVICE_PATH_COMPONENT = "hits";
+ final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
+ private final String CLASS_NAME = PersonAuthRefDocsTest.class.getName();
+ private final Logger logger = LoggerFactory.getLogger(CLASS_NAME);
+ private String knownHitId = null;
+ private final List<String> hitIdsCreated = new ArrayList<String>();
+ private final List<String> personIdsCreated = new ArrayList<String>();
+ private String personAuthCSID = null;
+ private String currentContactPersonCSID = null;
+ private String depositorPersonCSID = null;
+ private String insurerPersonCSID = null;
+ private String depositorContactRefName = null;
+ private String depositorRefName = null;
+ private String externalApprovalIndividualRefName = null;
+ private String correspondenceSenderRefName = null;
+ private String valuerRefName = null;
+ private final String valuerShortId = null;
+
+ @Override
+ public String getServiceName() {
+ throw new UnsupportedOperationException(); //FIXME: REM - http://issues.collectionspace.org/browse/CSPACE-3498
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance()
+ */
+ @Override
+ protected CollectionSpaceClient getClientInstance() {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
+ @Override
+ protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client
+ * .ClientResponse)
+ */
+ @Override
+ protected AbstractCommonList getCommonList(Response response) {
+ throw new UnsupportedOperationException(); //method not supported (or needed) in this test class
+ }
+
+ // ---------------------------------------------------------------
+ // CRUD tests : CREATE tests
+ // ---------------------------------------------------------------
+ // Success outcomes
+ @Test(dataProvider = "testName")
+ public void createHitWithAuthRefs(String testName) throws Exception {
+ testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
+
+ // Submit the request to the service and store the response.
+ String identifier = createIdentifier();
+
+ // Create all the person refs and entities
+ createPersonRefs();
+
+ HeldintrustClient heldInTrustClient = new HeldintrustClient();
+ PoxPayloadOut multipart = createHitInstance(
+ "entryNumber-" + identifier,
+ depositorContactRefName,
+ depositorRefName,
+ externalApprovalIndividualRefName,
+ correspondenceSenderRefName);
+
+ Response res = heldInTrustClient.create(multipart);
+ try {
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ //
+ // Specifically:
+ // Does it fall within the set of valid status codes?
+ // Does it exactly match the expected status code?
+ logger.debug("{}: status = {}", testName, statusCode);
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, testExpectedStatusCode);
+ } finally {
+ res.close();
+ }
+
+ // Store the ID returned from the first resource created
+ // for additional tests below.
+ if (knownHitId == null) {
+ knownHitId = extractId(res);
+ logger.debug("{}: knownHitId={}", testName, knownHitId);
+ }
+
+ // Store the IDs from every resource created by tests,
+ // so they can be deleted after tests have been run.
+ hitIdsCreated.add(extractId(res));
+ }
+
+ /**
+ * Creates the person refs.
+ *
+ * @throws Exception
+ */
+ protected void createPersonRefs() throws Exception {
+ PersonClient personAuthClient = new PersonClient();
+ PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
+ PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName());
+ Response res = personAuthClient.create(multipart);
+ try {
+ int statusCode = res.getStatus();
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, STATUS_CREATED);
+ personAuthCSID = extractId(res);
+ } finally {
+ res.close();
+ }
+
+ String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null);
+
+ String csid = createPerson("Olivier", "Contact", "olivierContact", authRefName);
+ Assert.assertNotNull(csid);
+ currentContactPersonCSID = csid;
+ depositorContactRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ Assert.assertNotNull(depositorContactRefName);
+ personIdsCreated.add(csid);
+
+ csid = createPerson("Debbie", "Depositor", "debbieDepositor", authRefName);
+ Assert.assertNotNull(csid);
+ depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ depositorPersonCSID = csid;
+ Assert.assertNotNull(depositorRefName);
+ personIdsCreated.add(csid);
+
+ csid = createPerson("Andrew", "ApprovalIndividual", "andrewApprovalIndividual", authRefName);
+ Assert.assertNotNull(csid);
+ externalApprovalIndividualRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ Assert.assertNotNull(externalApprovalIndividualRefName);
+ personIdsCreated.add(csid);
+
+ csid = createPerson("Ingrid", "Sender", "ingridSender", authRefName);
+ Assert.assertNotNull(csid);
+ insurerPersonCSID = csid;
+ correspondenceSenderRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ Assert.assertNotNull(correspondenceSenderRefName);
+ personIdsCreated.add(csid);
+
+ csid = createPerson("Vince", "Valuer", "vinceValuer", authRefName);
+ Assert.assertNotNull(csid);
+ valuerRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null);
+ logger.debug("valuerShortId={}", valuerShortId);
+ Assert.assertNotNull(valuerRefName);
+ personIdsCreated.add(csid);
+ }
+
+ protected String createPerson(String firstName, String surName, String shortId, String authRefName)
+ throws Exception {
+ String result;
+
+ PersonClient personAuthClient = new PersonClient();
+ 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);
+ List<PersonTermGroup> personTerms = new ArrayList<PersonTermGroup>();
+ PersonTermGroup term = new PersonTermGroup();
+ String termName = firstName + " " + surName;
+ term.setTermDisplayName(termName);
+ term.setTermName(termName);
+ personTerms.add(term);
+ PoxPayloadOut multipart =
+ PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
+ authRefName, personInfo, personTerms,
+ personAuthClient.getItemCommonPartName());
+ Response res = personAuthClient.createItem(personAuthCSID, multipart);
+ try {
+ int statusCode = res.getStatus();
+
+ Assert.assertTrue(testRequestType.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(testRequestType, statusCode));
+ Assert.assertEquals(statusCode, STATUS_CREATED);
+ result = extractId(res);
+ } finally {
+ res.close();
+ }
+
+ return result;
+ }
+
+ // Success outcomes
+ @Test(dataProvider = "testName", dependsOnMethods = {"createHitWithAuthRefs"})
+ public void readAndCheckAuthRefDocs(String testName) throws Exception {
+ // Perform setup.
+ testSetup(STATUS_OK, ServiceRequestType.READ);
+
+ // Get the auth ref docs and check them
+
+ PersonClient personAuthClient = new PersonClient();
+ Response res = personAuthClient.getReferencingObjects(personAuthCSID, currentContactPersonCSID);
+ AuthorityRefDocList list;
+ try {
+ assertStatusCode(res, testName);
+ list = res.readEntity(AuthorityRefDocList.class);
+ } finally {
+ if (res != null) {
+ res.close();
+ }
+ }
+
+ List<AuthorityRefDocList.AuthorityRefDocItem> items = list.getAuthorityRefDocItem();
+ Assert.assertNotNull(items);
+ Assert.assertFalse(items.isEmpty());
+
+ // output additional data about list members for debugging.
+ boolean fFoundHit = false;
+ int i = 0;
+ logger.debug("{}: Docs that use: {}", testName, depositorContactRefName);
+ for (AuthorityRefDocList.AuthorityRefDocItem item : items) {
+ logger.debug("{}: list-item[{}] {} ({}) Name:[{}] Number:[{}] in field:[{}]", testName, i,
+ item.getDocType(), item.getDocId(), item.getDocName(), item.getDocNumber(),
+ item.getSourceField());
+ if (!fFoundHit && knownHitId.equalsIgnoreCase(item.getDocId())) {
+ fFoundHit = true;
+ }
+ i++;
+ }
+ Assert.assertTrue(fFoundHit, "Did not find Hit with authref!");
+
+ //
+ // Get the referencing objects
+ //
+ personAuthClient = new PersonClient();
+ res = personAuthClient.getReferencingObjects(personAuthCSID, depositorPersonCSID);
+ try {
+ assertStatusCode(res, testName);
+ list = res.readEntity(AuthorityRefDocList.class);
+ } finally {
+ if (res != null) {
+ res.close();
+ }
+ }
+
+ items = list.getAuthorityRefDocItem();
+ Assert.assertNotNull(items);
+ Assert.assertFalse(items.isEmpty());
+ Assert.assertNotNull(items.get(0));
+
+ // Optionally output additional data about list members for debugging.
+ fFoundHit = false;
+ logger.debug("{}: Docs that use: {}", testName, depositorRefName);
+ i = 0;
+ for (AuthorityRefDocList.AuthorityRefDocItem item : items) {
+ logger.debug("{}: list-item[{}] {} ({}) Name:[{}] Number:[{}] in field:[{}]", testName, i,
+ item.getDocType(), item.getDocId(), item.getDocName(), item.getDocNumber(),
+ item.getSourceField());
+ if (!fFoundHit && knownHitId.equalsIgnoreCase(item.getDocId())) {
+ fFoundHit = true;
+ }
+ i++;
+ }
+ Assert.assertTrue(fFoundHit, "Did not find Hit with authref!");
+ }
+
+ /*
+ * Read and check the list of referencing objects, where the authRef field
+ * is a value instance of a repeatable scalar field.
+ */
+ @Test(dataProvider = "testName", dependsOnMethods = {"createHitWithAuthRefs"},
+ groups = {"repeatableScalar"})
+ public void readAndCheckAuthRefDocsRepeatableScalar(String testName) throws Exception {
+ // Perform setup.
+ testSetup(STATUS_OK, ServiceRequestType.READ);
+
+ // Get the auth ref docs and check them
+
+ // Single scalar field
+ PersonClient personAuthClient = new PersonClient();
+ Response res = personAuthClient.getReferencingObjects(personAuthCSID, insurerPersonCSID);
+ AuthorityRefDocList list;
+ try {
+ assertStatusCode(res, testName);
+ list = res.readEntity(AuthorityRefDocList.class);
+ } finally {
+ if (res != null) {
+ res.close();
+ }
+ }
+
+ List<AuthorityRefDocList.AuthorityRefDocItem> items = list.getAuthorityRefDocItem();
+ Assert.assertNotNull(items);
+ Assert.assertFalse(items.isEmpty());
+ Assert.assertNotNull(items.get(0));
+
+ // Optionally output additional data about list members for debugging.
+ boolean fFoundHit = false;
+ int i = 0;
+ logger.debug("{}: Docs that use: {}", testName, correspondenceSenderRefName);
+ for (AuthorityRefDocList.AuthorityRefDocItem item : items) {
+ logger.debug("{}: list-item[{}] {} ({}) Name:[{}] Number:[{}] in field:[{}]", testName, i,
+ item.getDocType(), item.getDocId(), item.getDocName(), item.getDocNumber(),
+ item.getSourceField());
+ if (!fFoundHit && knownHitId.equalsIgnoreCase(item.getDocId())) {
+ fFoundHit = true;
+ }
+ i++;
+ }
+ Assert.assertTrue(fFoundHit, "Did not find Hit with authref!");
+ }
+
+
+ // ---------------------------------------------------------------
+ // Cleanup of resources created during testing
+ // ---------------------------------------------------------------
+
+ /**
+ * Deletes all resources created by tests, after all tests have been run.
+ *
+ * This cleanup method will always be run, even if one or more tests fail.
+ * For this reason, it attempts to remove all resources created
+ * at any point during testing, even if some of those resources
+ * may be expected to be deleted by certain tests.
+ *
+ * @throws Exception
+ */
+ @AfterClass(alwaysRun = true)
+ public void cleanUp() throws Exception {
+ String noTest = System.getProperty("noTestCleanup");
+ if (Boolean.parseBoolean(noTest)) {
+ logger.debug("Skipping Cleanup phase ...");
+ return;
+ }
+
+ logger.debug("Cleaning up temporary resources created for testing ...");
+ HeldintrustClient heldInTrustClient = new HeldintrustClient();
+ // Note: Any non-success responses are ignored and not reported.
+ for (String resourceId : hitIdsCreated) {
+ heldInTrustClient.delete(resourceId).close();
+ }
+ // Delete persons before PersonAuth
+ PersonClient personAuthClient = new PersonClient();
+ for (String resourceId : personIdsCreated) {
+ personAuthClient.deleteItem(personAuthCSID, resourceId).close();
+ }
+ if (personAuthCSID != null) {
+ personAuthClient.delete(personAuthCSID).close();
+ }
+ }
+
+ // ---------------------------------------------------------------
+ // Utility methods used by tests above
+ // ---------------------------------------------------------------
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ private PoxPayloadOut createHitInstance(String heldInTrustNumber,
+ String depositorContact,
+ String depositor,
+ String externalApprovalIndividual,
+ String correspondenceSender) throws Exception {
+ HeldintrustsCommon hit =
+ HeldintrustClientTestUtil.createHitInstance(heldInTrustNumber, depositorContact, depositor,
+ externalApprovalIndividual, correspondenceSender);
+ hit.setHeldInTrustNumber(heldInTrustNumber);
+
+ PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent());
+ multipart.addPart(new HeldintrustClient().getCommonPartName(), hit);
+
+ logger.debug("to be created, hit common");
+ logger.debug("{}", objectAsXmlString(hit, HeldintrustsCommon.class));
+
+ return multipart;
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This config is used by the maven surefire plugin (for tests), as configured in services/pom.xml.
+ For runtime logging config, see services/JaxRsServiceProvider/src/main/resources/log4j2.xml.
+-->
+<Configuration status="WARN">
+ <Properties>
+ <Property name="logPattern">%d %-5p [%t] [%c:%L] %m%n</Property>
+ </Properties>
+
+ <Appenders>
+ <Console name="ConsoleAppender" target="SYSTEM_OUT">
+ <PatternLayout pattern="${logPattern}" />
+ </Console>
+
+ <File name="LogFileAppender" append="false" fileName="target/test.log">
+ <PatternLayout pattern="${logPattern}" />
+ </File>
+ </Appenders>
+
+ <Loggers>
+ <Root level="DEBUG">
+ <AppenderRef ref="ConsoleAppender"/>
+ <AppenderRef ref="LogFileAppender" />
+ </Root>
+
+ <Logger name="httpclient" level="INFO" />
+ <Logger name="org.apache" level="INFO" />
+ <Logger name="org.collectionspace.services.client.PoxPayloadIn" level="DEBUG" />
+ <Logger name="org.collectionspace.services.client.PoxPayloadOut" level="DEBUG" />
+ <Logger name="org.collectionspace" level="DEBUG" />
+ <Logger name="org.jboss.resteasy" level="INFO" />
+ </Loggers>
+</Configuration>
--- /dev/null
+/target/
+/target/
--- /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.heldintrust</artifactId>
+ <groupId>org.collectionspace.services</groupId>
+ <version>${revision}</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.heldintrust.jaxb</artifactId>
+ <name>services.heldintrust.jaxb</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>collectionspace-services-heldintrust-jaxb</finalName>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+package org.collectionspace.services;
+
+/**
+ * @author remillet
+ */
+public interface HeldintrustJAXBSchema {
+}
--- /dev/null
+package org.collectionspace.services;
+
+public interface HeldintrustListItemJAXBSchema {
+ String CSID = "csid";
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+ Held In Trust schema (XSD)
+
+ Entity : Held In Trust
+ Part : Common
+ Used for: JAXB binding between XML and Java objects
+
+ $LastChangedRevision$
+ $LastChangedDate$
+-->
+
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+ jaxb:version="1.0" elementFormDefault="unqualified"
+ xmlns:ns="http://collectionspace.org/services/heldintrust"
+ targetNamespace="http://collectionspace.org/services/heldintrust" version="4.0">
+
+ <!--
+ Avoid XmlRootElement nightmare:
+ See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
+-->
+
+ <xs:element name="heldintrusts_common">
+ <xs:complexType>
+ <xs:sequence >
+ <xs:element name="heldInTrustDepositorGroupList" type="ns:heldInTrustDepositorGroupList"/>
+ <xs:element name="heldInTrustNumber" type="xs:string"/>
+ <xs:element name="entryDate" type="xs:date"/>
+ <xs:element name="externalApprovalGroupList" type="ns:externalApprovalGroupList"/>
+ <xs:element name="entryNote" type="xs:string"/>
+ <xs:element name="returnDate" type="xs:date"/>
+ <xs:element name="correspondenceGroupList" type="ns:correspondenceGroupList"/>
+ <xs:element name="internalApprovalGroupList" type="ns:internalApprovalGroupList"/>
+ <xs:element name="entryMethods">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="entryMethod" type="xs:string" minOccurs="0" maxOccurs="unbounded"
+ />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="handlingPreferences" type="xs:string"/>
+ <xs:element name="agreementRenewalDates">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="agreementRenewalDate" type="xs:date" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="entryReason" type="xs:string"/>
+ <xs:element name="agreementGroupList" type="ns:agreementGroupList"/>
+ <xs:element name="handlingLimitationsGroupList" type="ns:handlingLimitationsGroupList"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="heldInTrustDepositorGroupList">
+ <xs:sequence>
+ <xs:element name="heldInTrustDepositorGroup" type="ns:heldInTrustDepositorGroup" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="heldInTrustDepositorGroup">
+ <xs:sequence>
+ <xs:element name="depositor" type="xs:string"/>
+ <xs:element name="depositorContact" type="xs:string"/>
+ <xs:element name="depositorContactType" type="xs:string"/>
+ <xs:element name="depositorNote" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="correspondenceGroupList">
+ <xs:sequence>
+ <xs:element name="correspondenceGroup" type="ns:correspondenceGroup" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="correspondenceGroup">
+ <xs:sequence>
+ <xs:element name="correspondenceDate" type="xs:date"/>
+ <xs:element name="correspondenceSender" type="xs:string"/>
+ <xs:element name="correspondenceRecipient" type="xs:string"/>
+ <xs:element name="correspondenceSummary" type="xs:string"/>
+ <xs:element name="correspondenceReference" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="externalApprovalGroupList">
+ <xs:sequence>
+ <xs:element name="externalApprovalGroup" type="ns:externalApprovalGroup" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="externalApprovalGroup">
+ <xs:sequence>
+ <xs:element name="externalApprovalGroupName" type="xs:string"/>
+ <xs:element name="externalApprovalIndividual" type="xs:string"/>
+ <xs:element name="externalApprovalStatus" type="xs:string"/>
+ <xs:element name="externalApprovalDate" type="xs:date"/>
+ <xs:element name="externalApprovalNote" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="internalApprovalGroupList">
+ <xs:sequence>
+ <xs:element name="internalApprovalGroup" type="ns:internalApprovalGroup" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="internalApprovalGroup">
+ <xs:sequence>
+ <xs:element name="internalApprovalGroupName" type="xs:string"/>
+ <xs:element name="internalApprovalIndividual" type="xs:string"/>
+ <xs:element name="internalApprovalStatus" type="xs:string"/>
+ <xs:element name="internalApprovalDate" type="xs:date"/>
+ <xs:element name="internalApprovalNote" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <xs:complexType name="agreementGroupList">
+ <xs:sequence>
+ <xs:element name="agreementGroup" type="ns:agreementGroup" minOccurs="0"
+ maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="agreementGroup">
+ <xs:sequence>
+ <xs:element name="agreementStatus" type="xs:string"/>
+ <xs:element name="agreementStatusDate" type="xs:date"/>
+ <xs:element name="agreementStatusNote" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="handlingLimitationsGroupList">
+ <xs:sequence>
+ <xs:element name="handlingLimitationsGroup" type="ns:handlingLimitationsGroup"
+ minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="handlingLimitationsGroup">
+ <xs:sequence>
+ <xs:element name="handlingLimitationsType" type="xs:string"/>
+ <xs:element name="handlingLimitationsLevel" type="xs:string"/>
+ <xs:element name="handlingLimitationsDetail" type="xs:string"/>
+ <xs:element name="handlingLimitationsRequestor" type="xs:string"/>
+ <xs:element name="handlingLimitationsOnBehalfOf" type="xs:string"/>
+ <xs:element name="handlingLimitationsDate" type="xs:date"/>
+ </xs:sequence>
+ </xs:complexType>
+</xs:schema>
--- /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>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.main</artifactId>
+ <version>${revision}</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.heldintrust</artifactId>
+ <name>services.heldintrust</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>jaxb</module>
+ <module>service</module>
+ <module>client</module>
+ </modules>
+
+</project>
--- /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>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.heldintrust</artifactId>
+ <version>${revision}</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>org.collectionspace.services.heldintrust.service</artifactId>
+ <name>services.heldintrust.service</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.heldintrust.jaxb</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.heldintrust.client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!-- External dependencies -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </dependency>
+
+ <!-- javax -->
+
+ <dependency>
+ <groupId>javax.security</groupId>
+ <artifactId>jaas</artifactId>
+ <version>1.0.01</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- jboss -->
+
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxrs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-jaxb-provider</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.resteasy</groupId>
+ <artifactId>resteasy-multipart-provider</artifactId>
+ </dependency>
+
+ <!-- nuxeo -->
+
+ <dependency>
+ <groupId>org.nuxeo.ecm.core</groupId>
+ <artifactId>nuxeo-core-api</artifactId>
+ <exclusions>
+ <exclusion>
+ <artifactId>jboss-remoting</artifactId>
+ <groupId>jboss</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>collectionspace-services-heldintrust</finalName>
+ </build>
+</project>
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright 2009 University of California at Berkeley
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ *
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.collectionspace.services.heldintrust;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+import org.collectionspace.services.client.HeldintrustClient;
+import org.collectionspace.services.common.NuxeoBasedResource;
+
+@Path(HeldintrustClient.SERVICE_PATH)
+@Consumes("application/xml")
+@Produces("application/xml")
+public class HeldintrustResource extends NuxeoBasedResource {
+
+ @Override
+ protected String getVersionString() {
+ return "$LastChangedRevision$";
+ }
+
+ @Override
+ public String getServiceName() {
+ return HeldintrustClient.SERVICE_NAME;
+ }
+
+ @Override
+ public Class<HeldintrustsCommon> getCommonPartClass() {
+ return HeldintrustsCommon.class;
+ }
+
+}
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+
+ * Copyright 2009 University of California at Berkeley
+
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+
+ * You may obtain a copy of the ECL 2.0 License at
+
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.collectionspace.services.heldintrust.nuxeo;
+
+/**
+ * HeldintrustConstants processes CollectionObject document
+ */
+public class HeldintrustConstants {
+
+ public final static String NUXEO_DOCTYPE = "Heldintrust";
+ public final static String NUXEO_SCHEMA_NAME = "heldintrust";
+ public final static String NUXEO_DC_TITLE = "CollectionSpace-Heldintrust";
+
+}
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright 2009 University of California at Berkeley
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ *
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.collectionspace.services.heldintrust.nuxeo;
+
+import org.collectionspace.services.heldintrust.HeldintrustsCommon;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
+
+/**
+ * HeldintrustDocumentModelHandler
+ *
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+public class HeldintrustDocumentModelHandler extends NuxeoDocumentModelHandler<HeldintrustsCommon> {
+}
--- /dev/null
+package org.collectionspace.services.heldintrust.nuxeo;
+
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.document.InvalidDocumentException;
+import org.collectionspace.services.common.document.ValidatorHandlerImpl;
+import org.collectionspace.services.heldintrust.HeldintrustsCommon;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HeldintrustValidatorHandler extends ValidatorHandlerImpl<PoxPayloadIn, PoxPayloadOut> {
+
+ /**
+ * Error Message
+ */
+ private static final String VALIDATION_ERROR =
+ "The heldintrust record payload was invalid. See log file for more details.";
+
+ /**
+ * The logger.
+ */
+ private final Logger logger = LoggerFactory.getLogger(HeldintrustValidatorHandler.class);
+
+ @Override
+ protected Class<?> getCommonPartClass() {
+ return HeldintrustsCommon.class;
+ }
+
+ @Override
+ protected void handleCreate() throws InvalidDocumentException {
+ try {
+ HeldintrustsCommon hitsCommon = (HeldintrustsCommon) getCommonPart();
+ assert (hitsCommon != null);
+ } catch (AssertionError e) {
+ logger.error(e.getMessage(), e);
+ throw new InvalidDocumentException(VALIDATION_ERROR, e);
+ }
+ }
+
+ @Override
+ protected void handleGet() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ protected void handleGetAll() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ protected void handleUpdate() {
+ // TODO Auto-generated method stub
+ }
+
+ @Override
+ protected void handleDelete() {
+ // TODO Auto-generated method stub
+ }
+
+}
--- /dev/null
+package org.collectionspace.services.test;
+
+/**
+ * A HeldInTrustServiceTest.
+ *
+ * @version $Revision:$
+ */
+public class HeldintrustServiceTest {
+ //empty
+}
+++ /dev/null
-<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
-<suite name="javaee-addressbook-client">
- <test verbose="2" name="org.jboss.resteasy.examples.addressbook.client.AddressBookTest" annotations="JDK">
- <classes>
- <class name="org.jboss.resteasy.examples.addressbook.client.AddressBookTest"/>
- </classes>
- </test>
-</suite>
<module>group</module>
<module>insurance</module>
<module>intake</module>
+ <module>heldintrust</module>
<module>loanin</module>
<module>loanout</module>
<module>claim</module>