<artifactId>org.collectionspace.services.intake.service</artifactId>\r
<version>1.0</version>\r
</dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.acquisition.service</artifactId>\r
+ <version>1.0</version>\r
+ </dependency>\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.relation.service</artifactId>\r
import org.collectionspace.services.intake.IntakeResource;
//import org.collectionspace.services.relation.RelationResource;
import org.collectionspace.services.relation.NewRelationResource;
+import org.collectionspace.services.acquisition.AcquisitionResource;
import org.collectionspace.services.query.QueryResource;
import javax.ws.rs.core.Application;
singletons.add(new CollectionObjectResource());
singletons.add(new IDResource());
singletons.add(new IntakeResource());
+ singletons.add(new AcquisitionResource());
// singletons.add(new RelationResource());
singletons.add(new NewRelationResource());
singletons.add(new QueryResource());
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>acquisition-service</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+#Thu Apr 30 16:21:29 PDT 2009\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.source=1.6\r
--- /dev/null
+#Thu Apr 30 16:20:57 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+version=1\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.acquisition.3rdparty</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+#Mon Jun 29 14:28:26 PDT 2009\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.source=1.6\r
--- /dev/null
+#Mon Jun 29 14:27:15 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+version=1\r
--- /dev/null
+\r
+<project name="acquisition.3rdparty" default="package" basedir=".">\r
+ <description>\r
+ acquisition service 3rdparty\r
+ </description>\r
+ <!-- set global properties for this build -->\r
+ <property name="services.trunk" value="../../.."/>\r
+ <property file="${services.trunk}/build.properties" />\r
+ <property name="mvn.opts" value="" />\r
+ <property name="src" location="src"/>\r
+\r
+ <condition property="osfamily-unix">\r
+ <os family="unix" />\r
+ </condition>\r
+ <condition property="osfamily-windows">\r
+ <os family="windows" />\r
+ </condition>\r
+\r
+ <target name="init" >\r
+ <!-- Create the time stamp -->\r
+ <tstamp/>\r
+ </target>\r
+\r
+ <target name="package" depends="package-unix,package-windows"\r
+ description="Package CollectionSpace Services" />\r
+ <target name="package-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="package" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="package-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="package" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+ <target name="install" depends="package,install-unix,install-windows"\r
+ description="Install" />\r
+ <target name="install-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="install" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="install-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="install" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ \r
+ <target name="clean" depends="clean-unix,clean-windows"\r
+ description="Delete target directories" >\r
+ <delete dir="${build}"/>\r
+ </target>\r
+ <target name="clean-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="clean" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="clean-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="clean" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+ <target name="test" depends="test-unix,test-windows" description="Run tests" />\r
+ <target name="test-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="test" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="test-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="test" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+ <target name="deploy" depends="package"\r
+ description="deploy acquisition in ${jboss.server.nuxeo}">\r
+ <ant antfile="nuxeo-platform-cs-acquisition/build.xml" target="deploy" inheritall="false"/>\r
+ </target>\r
+\r
+ <target name="undeploy"\r
+ description="undeploy acquisition from ${jboss.server.nuxeo}">\r
+ <ant antfile="nuxeo-platform-cs-acquisition/build.xml" target="undeploy" inheritall="false"/>\r
+ </target>\r
+\r
+ <target name="dist"\r
+ description="generate distribution for acquisition" depends="package">\r
+ <ant antfile="nuxeo-platform-cs-acquisition/build.xml" target="dist" inheritall="false"/>\r
+ </target>\r
+\r
+\r
+</project>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>nuxeo-platform-collectionspace</name>\r
+ <comment>Nuxeo Enterprise Platform: CS extensions</comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+#Wed Aug 26 09:55:09 PDT 2009\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5\r
+org.eclipse.jdt.core.compiler.compliance=1.5\r
+org.eclipse.jdt.core.compiler.source=1.5\r
--- /dev/null
+#Wed Apr 08 13:24:46 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+version=1\r
--- /dev/null
+
+<project name="nuxeo-platform-cs-acquisition" default="package" basedir=".">
+ <description>
+ acquisition nuxeo document type
+ </description>
+ <!-- set global properties for this build -->
+ <property name="services.trunk" value="../../../.."/>
+ <property file="${services.trunk}/build.properties" />
+ <property name="mvn.opts" value="" />
+ <property name="src" location="src"/>
+ <property name="nuxeo.acquisition.jar" value="org.collectionspace.services.acquisition.3rdparty.nuxeo-1.0.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.bat" />
+ <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="package,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.bat" />
+ <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.bat" />
+ <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.bat" />
+ <arg value="test" />
+ <arg value="${mvn.opts}" />
+ </exec>
+ </target>
+
+ <target name="deploy" depends="package"
+ description="deploy acquisition doctype in ${jboss.server.nuxeo}">
+ <copy file="${basedir}/target/${nuxeo.acquisition.jar}"
+ todir="${jboss.deploy.nuxeo.system}"/>
+ </target>
+
+ <target name="undeploy"
+ description="undeploy acquisition doctype from ${jboss.server.nuxeo}">
+ <delete file="${jboss.deploy.nuxeo.system}/${nuxeo.acquisition.jar}"/>
+ </target>
+
+
+ <target name="dist"
+ description="generate distribution for acquisition doctype" depends="package">
+ <copy todir="${services.trunk}/${dist.deploy.nuxeo.system}">
+ <fileset file="${basedir}/target/${nuxeo.acquisition.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>nuxeo-platform-collectionspace</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <version>1.0</version>
+ <artifactId>org.collectionspace.services.acquisition.3rdparty.nuxeo</artifactId>
+ <packaging>jar</packaging>
+ <name>services.acquisition.3rdparty.nuxeo</name>
+ <description>
+ Acquisition Nuxeo Document Type
+ </description>
+</project>
--- /dev/null
+Manifest-Version: 1.0 \r
+Bundle-ManifestVersion: 1 \r
+Bundle-Name: NuxeoCS\r
+Bundle-SymbolicName: org.collectionspace.acquisition;singleton:=true \r
+Bundle-Version: 1.0.0\r
+Bundle-Localization: plugin\r
+Bundle-Vendor: Nuxeo \r
+Require-Bundle: org.nuxeo.runtime, \r
+ org.nuxeo.ecm.core.api, \r
+ org.nuxeo.ecm.core,\r
+ org.nuxeo.ecm.core.api,\r
+ org.nuxeo.ecm.platform.types.api,\r
+ org.nuxeo.ecm.platform.versioning.api,\r
+ org.nuxeo.ecm.platform.ui,\r
+ org.nuxeo.ecm.platform.forms.layout.client,\r
+ org.nuxeo.ecm.platform.publishing.api,\r
+ org.nuxeo.ecm.platform.ws \r
+Provide-Package: org.collectionspace.acquisition\r
+Nuxeo-Component: OSGI-INF/core-types-contrib.xml,\r
+ OSGI-INF/ecm-types-contrib.xml,\r
+ OSGI-INF/layouts-contrib.xml\r
+\r
--- /dev/null
+<?xml version="1.0"?>
+<component name="org.collectionspace.acquisition.coreTypes">
+ <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
+ <schema name="acquisition" prefix="acquisition" src="schemas/acquisition.xsd"/>
+ </extension>
+ <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
+ <doctype name="Acquisition" extends="Document">
+ <schema name="common"/>
+ <schema name="dublincore"/>
+ <schema name="acquisition"/>
+ </doctype>
+ </extension>
+</component>
--- /dev/null
+<?xml version="1.0"?>
+<fragment>
+
+ <extension target="application#MODULE">
+ <module>
+ <ejb>${bundle.fileName}</ejb>
+ </module>
+
+ <module>
+ <web>
+ <web-uri>nuxeo.war</web-uri>
+ <context-root>/nuxeo</context-root>
+ </web>
+ </module>
+ </extension>
+
+ <!-- uncomment that to enable tomcat based auth
+ <extension target="web#LOGIN-CONFIG">
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <realm-name>nuxeo.ecm</realm-name>
+ <form-login-config>
+ <form-login-page>/login.jsp</form-login-page>
+ <form-error-page>/login.jsp?loginFailed=true</form-error-page>
+ </form-login-config>
+ </login-config>
+ </extension>
+ -->
+
+ <extension target="web#FILTER-MAPPING">
+
+ <!-- Seam Context Filter is declared in org.nuxeo.ecm.platform.ui.web
+ deployment fragment -->
+
+ <filter-mapping>
+ <filter-name>Seam Context Filter</filter-name>
+ <url-pattern>/ws/FileManageWS</url-pattern>
+ </filter-mapping>
+
+ <filter-mapping>
+ <filter-name>Seam Context Filter</filter-name>
+ <url-pattern>/DocumentManagerWS</url-pattern>
+ </filter-mapping>
+ </extension>
+
+ <extension target="web#SERVLET">
+ </extension>
+
+ <extension target="web#SERVLET-MAPPING">
+ </extension>
+
+ <extension target="pages#PAGES">
+ <!-- This calls a method which load the Workspace logo -->
+ <page view-id="/showLogo.xhtml" action="#{logoHelper.getLogo}"/>
+
+ <!-- Bind URL to the Document URL resolver-->
+ <page view-id="/getDocument.xhtml"
+ action="#{navigationContext.navigateToURL}">
+ </page>
+
+ <page view-id="/nxliveedit.xhtml" action="#{liveEditHelper.getBootstrap()}"/>
+
+ <!-- Bind URL to the Parallele conversation Document URL resolver-->
+ <page view-id="/parallele.xhtml"
+ action="#{paralleleNavigationHelper.navigateToURL}">
+ </page>
+
+ <!-- Post login and 'home' view handler -->
+ <page view-id="/nxstartup.xhtml"
+ action="#{startupHelper.initDomainAndFindStartupPage('Default domain', 'view')}"/>
+
+ <!-- To redirect to the user dashboard instead, use instead:
+
+ <page view-id="/nxstartup.xhtml"
+ action="#{startupHelper.initDomainAndFindStartupPage('Default domain', 'user_dashboard')}" />
+ -->
+
+ <!-- config for workspace management
+ = give a description for each viewId
+ -->
+
+ <page view-id="/view_domains.xhtml">
+ #{currentServerLocation.name}/#{currentTabAction.label}
+ </page>
+
+ <page view-id="/select_document_type.faces.xhtml">
+ Create new document in #{currentDocument.name}
+ </page>
+
+ <page view-id="/create_document.faces.xhtml">
+ Create new document in #{currentDocument.name}
+ </page>
+
+ <page view-id="/user_dashboard.xhtml">
+ breadcrumb=command.user_dashboard
+ </page>
+
+ <page view-id="/view_users.xhtml">
+ breadcrumb=command.manageMembers
+ </page>
+
+ <page view-id="/view_many_users.xhtml">
+ breadcrumb=command.manageMembers
+ </page>
+
+ <page view-id="/view_vocabularies.xhtml">
+ breadcrumb=title.vocabularies
+ </page>
+
+ <page view-id="/search/search_form.xhtml">
+ breadcrumb=command.advancedSearch
+ </page>
+ </extension>
+
+ <extension target="faces-config#APPLICATION">
+ <locale-config>
+ <default-locale>en</default-locale>
+ <supported-locale>en_GB</supported-locale>
+ <supported-locale>en_US</supported-locale>
+ <supported-locale>fr</supported-locale>
+ <supported-locale>de</supported-locale>
+ <supported-locale>es</supported-locale>
+ <supported-locale>it</supported-locale>
+ <supported-locale>ar</supported-locale>
+ <supported-locale>ru</supported-locale>
+ <supported-locale>ja</supported-locale>
+ <supported-locale>vn</supported-locale>
+ </locale-config>
+
+ <message-bundle>messages</message-bundle>
+ </extension>
+
+ <extension target="components#PAGEFLOW">
+ <value>config/addWorkspace.jpdl.xml</value>
+ </extension>
+
+ <extension target="faces-config#NAVIGATION">
+ <!-- generic pages -->
+ <navigation-case>
+ <from-outcome>generic_error_page</from-outcome>
+ <to-view-id>/generic_error_page.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>generic_message_page</from-outcome>
+ <to-view-id>/generic_message_page.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>home</from-outcome>
+ <to-view-id>/nxstartup.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>user_login</from-outcome>
+ <to-view-id>/login.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>user_logout</from-outcome>
+ <to-view-id>/logout.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_servers</from-outcome>
+ <to-view-id>/view_servers.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- pages for document actions -->
+
+ <navigation-case>
+ <from-outcome>view_domains</from-outcome>
+ <to-view-id>/view_domains.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>select_document_type</from-outcome>
+ <to-view-id>/select_document_type.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_document</from-outcome>
+ <to-view-id>/create_document.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>edit_document</from-outcome>
+ <to-view-id>/edit_document.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_documents</from-outcome>
+ <to-view-id>/view_documents.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_file</from-outcome>
+ <to-view-id>/create_file.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_workspace_wizard</from-outcome>
+ <to-view-id>/createWorkspaceWizard.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>send_email</from-outcome>
+ <to-view-id>/document_email.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use view_documents instead -->
+ <navigation-case>
+ <from-outcome>view_workspaces</from-outcome>
+ <to-view-id>/view_workspaces.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use create_document instead -->
+ <navigation-case>
+ <from-outcome>create_domain</from-outcome>
+ <to-view-id>/create_domain.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use edit_document instead -->
+ <navigation-case>
+ <from-outcome>edit_domain</from-outcome>
+ <to-view-id>/edit_domain.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use create_document instead -->
+ <navigation-case>
+ <from-outcome>create_workspace</from-outcome>
+ <to-view-id>/create_workspace.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- AT: BBB, use edit_document instead -->
+ <navigation-case>
+ <from-outcome>edit_workspace</from-outcome>
+ <to-view-id>/edit_workspace.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- users ang groups -->
+
+ <navigation-case>
+ <from-outcome>members_management</from-outcome>
+ <to-view-id>/members_management.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_users</from-outcome>
+ <to-view-id>/view_users.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_many_users</from-outcome>
+ <to-view-id>/view_many_users.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>edit_user</from-outcome>
+ <to-view-id>/edit_user.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>edit_user_password</from-outcome>
+ <to-view-id>/edit_user_password.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_user</from-outcome>
+ <to-view-id>/view_user.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_user</from-outcome>
+ <to-view-id>/create_user.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_groups</from-outcome>
+ <to-view-id>/view_groups.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_group</from-outcome>
+ <to-view-id>/view_group.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>edit_group</from-outcome>
+ <to-view-id>/edit_group.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>create_group</from-outcome>
+ <to-view-id>/create_group.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_vocabularies</from-outcome>
+ <to-view-id>/view_vocabularies.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>view_vocabulary</from-outcome>
+ <to-view-id>/view_vocabulary.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- search -->
+
+ <navigation-case>
+ <from-outcome>search_form</from-outcome>
+ <to-view-id>/search/search_form.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>search_results_nxql</from-outcome>
+ <to-view-id>/search/search_results_nxql.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>search_results_advanced</from-outcome>
+ <to-view-id>
+ /search/search_results_advanced.xhtml
+ </to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>search_results_simple</from-outcome>
+ <to-view-id>/search/search_results_simple.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <!-- miscellaneaous -->
+
+ <navigation-case>
+ <from-outcome>clipboard</from-outcome>
+ <to-view-id>/incl/clipboard.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>user_dashboard</from-outcome>
+ <to-view-id>/user_dashboard.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>select_workspace_template</from-outcome>
+ <to-view-id>/select_workspace_template.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>pdf_generation_error</from-outcome>
+ <to-view-id>/pdf_generation_error.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>mass_edit</from-outcome>
+ <to-view-id>/massedit_documents.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+
+ <navigation-case>
+ <from-outcome>mass_edit_confirm</from-outcome>
+ <to-view-id>/massedit_documents_preview.xhtml</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </extension>
+
+</fragment>
+
--- /dev/null
+<?xml version="1.0"?>
+<component name="org.collectionspace.acquisition.ecm.types">
+ <extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
+ <type id="Acquisition" coretype="Acquisition">
+ <label>org.collectionspace.acquisition</label>
+ <!--icon>/icons/file.gif</icon-->
+ <default-view>view_documents</default-view>
+
+ <layouts mode="any">
+ <layout>heading</layout>
+ <layout>acquisition</layout>
+ </layouts>
+ </type>
+
+ <type id="Folder" coretype="Folder">
+ <subtypes>
+ <type>Acquisition</type>
+ </subtypes>
+ </type>
+
+ <type id="Workspace" coretype="Workspace">
+ <subtypes>
+ <type>Acquisition</type>
+ </subtypes>
+ </type>
+
+ </extension>
+</component>
--- /dev/null
+<?xml version="1.0"?>
+
+<component name="org.collectionspace.acquisition.layouts.webapp">
+
+ <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
+ point="layouts">
+
+ <layout name="acquisition">
+ <templates>
+ <template mode="any">/layouts/layout_default_template.xhtml</template>
+ </templates>
+ <rows>
+ <row><widget>accessiondate</widget></row>
+ </rows>
+
+ <widget name="accessiondate" type="text">
+ <labels>
+ <label mode="any">accessiondate</label>
+ </labels>
+ <translated>true</translated>
+ <fields>
+ <field schema="acquisition">accessiondate</field>
+ </fields>
+ <properties widgetMode="edit">
+ <property name="styleClass">dataInputText</property>
+ </properties>
+ </widget>
+
+ </layout>
+ </extension>
+</component>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\r
+<xs:schema \r
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"\r
+ xmlns:ns="http://collectionspace.org/acquisition/"\r
+ xmlns="http://collectionspace.org/acquisition/"\r
+ targetNamespace="http://collectionspace.org/acquisition/"\r
+ version="0.1">\r
+ \r
+ <!-- See http://wiki.collectionspace.org/display/collectionspace/Acquisition+Schema -->\r
+\r
+<!-- Object Entry Information Group -->\r
+ <xs:element name="accessiondate" type="xs:string"/>\r
+ \r
+</xs:schema>\r
--- /dev/null
+\r
+<project xmlns="http://maven.apache.org/POM/4.0.0"\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+ <parent>\r
+ <artifactId>org.collectionspace.services.acquisition</artifactId>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <version>1.0</version>\r
+ </parent>\r
+ <modelVersion>4.0.0</modelVersion>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <version>1.0</version>\r
+ <artifactId>org.collectionspace.services.acquisition.3rdparty</artifactId>\r
+ <packaging>pom</packaging>\r
+ <name>services.acquisition.3rdparty</name>\r
+ <description>\r
+ 3rd party build for acquisition service\r
+ </description>\r
+\r
+ <modules>\r
+ <module>nuxeo-platform-cs-acquisition</module>\r
+ </modules>\r
+</project>\r
--- /dev/null
+\r
+<project name="acquisition" default="package" basedir=".">\r
+ <description>\r
+ acquisition service\r
+ </description>\r
+ <!-- set global properties for this build -->\r
+ <property name="services.trunk" value="../.."/>\r
+ <property file="${services.trunk}/build.properties" />\r
+ <property name="mvn.opts" value="" />\r
+ <property name="src" location="src"/>\r
+\r
+ <condition property="osfamily-unix">\r
+ <os family="unix" />\r
+ </condition>\r
+ <condition property="osfamily-windows">\r
+ <os family="windows" />\r
+ </condition>\r
+\r
+ <target name="package" depends="package-unix,package-windows"\r
+ description="Package CollectionSpace Services" />\r
+ \r
+ <target name="package-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="package" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ \r
+ <target name="package-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="package" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+\r
+ <target name="install" depends="package,install-unix,install-windows"\r
+ description="Install" />\r
+ <target name="install-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="install" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="install-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="install" />\r
+ <arg value="-Dmaven.test.skip=true" />\r
+ <arg value="-f" />\r
+ <arg value="${basedir}/pom.xml" />\r
+ <arg value="-N" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+ <target name="clean" depends="clean-unix,clean-windows"\r
+ description="Delete target directories" >\r
+ <delete dir="${build}"/>\r
+ </target>\r
+ <target name="clean-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="clean" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="clean-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="clean" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+ <target name="test" depends="test-unix,test-windows" description="Run tests" />\r
+ <target name="test-unix" if="osfamily-unix">\r
+ <exec executable="mvn" failonerror="true">\r
+ <arg value="test" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+ <target name="test-windows" if="osfamily-windows">\r
+ <exec executable="cmd" failonerror="true">\r
+ <arg value="/c" />\r
+ <arg value="mvn.bat" />\r
+ <arg value="test" />\r
+ <arg value="${mvn.opts}" />\r
+ </exec>\r
+ </target>\r
+\r
+ <target name="deploy" depends="package"\r
+ description="deploy acquisition service">\r
+ <ant antfile="3rdparty/build.xml" target="deploy" inheritall="false"/>\r
+ </target>\r
+\r
+ <target name="undeploy"\r
+ description="undeploy acquisition service">\r
+ <ant antfile="3rdparty/build.xml" target="undeploy" inheritall="false"/>\r
+ </target>\r
+\r
+ <target name="dist" depends="package"\r
+ description="distribute acquisition service">\r
+ <ant antfile="3rdparty/build.xml" target="dist" inheritall="false"/>\r
+ </target>\r
+\r
+</project>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>javaee-acquisition-client</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+#Thu Mar 26 13:03:04 PDT 2009\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate\r
+org.eclipse.jdt.core.compiler.debug.localVariable=generate\r
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.source=1.6\r
--- /dev/null
+#Thu Feb 26 16:30:28 PST 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+version=1\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<project xmlns="http://maven.apache.org/POM/4.0.0"\r
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">\r
+\r
+ <parent>\r
+ <artifactId>org.collectionspace.services.acquisition</artifactId>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <version>1.0</version>\r
+ </parent>\r
+\r
+ <modelVersion>4.0.0</modelVersion>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.acquisition.client</artifactId>\r
+ <version>1.0</version>\r
+ <name>services.acquisition.client</name>\r
+ \r
+ <dependencies>\r
+ <!-- keep slf4j dependencies on the top -->\r
+ <dependency>\r
+ <groupId>org.slf4j</groupId>\r
+ <artifactId>slf4j-api</artifactId>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.slf4j</groupId>\r
+ <artifactId>slf4j-log4j12</artifactId>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.acquisition.jaxb</artifactId>\r
+ <version>1.0</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.client</artifactId>\r
+ <version>1.0</version>\r
+ </dependency>\r
+ \r
+ <dependency>\r
+ <groupId>org.testng</groupId>\r
+ <artifactId>testng</artifactId>\r
+ <version>5.6</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.slf4j</groupId>\r
+ <artifactId>slf4j-api</artifactId>\r
+ <version>1.5.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.slf4j</groupId>\r
+ <artifactId>slf4j-log4j12</artifactId>\r
+ <version>1.5.2</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-jaxrs</artifactId>\r
+ <version>1.0.2.GA</version>\r
+ <!-- filter out unwanted jars -->\r
+ <exclusions>\r
+ <exclusion>\r
+ <groupId>tjws</groupId>\r
+ <artifactId>webserver</artifactId>\r
+ </exclusion>\r
+ </exclusions>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-jaxb-provider</artifactId>\r
+ <version>1.0.2.GA</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-multipart-provider</artifactId>\r
+ <version>1.0.2.GA</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>commons-httpclient</groupId>\r
+ <artifactId>commons-httpclient</artifactId>\r
+ <version>3.1</version>\r
+ </dependency>\r
+ </dependencies>\r
+ \r
+ <build>\r
+ <finalName>collectionspace-services-acquisition-client</finalName>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-surefire-plugin</artifactId>\r
+ <configuration>\r
+ <systemProperties>\r
+ <property>\r
+ <name>log4j.configuration</name>\r
+ <value>file:target/test-classes/log4j.properties</value>\r
+ </property>\r
+ </systemProperties>\r
+ </configuration>\r
+ </plugin>\r
+ <plugin>\r
+ <artifactId>maven-compiler-plugin</artifactId>\r
+ <version>2.0.2</version>\r
+ <configuration>\r
+ <source>1.6</source>\r
+ <target>1.6</target>\r
+ </configuration>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+</project>\r
+\r
--- /dev/null
+package org.collectionspace.services.client;
+
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.acquisition.Acquisition;
+import org.collectionspace.services.acquisition.AcquisitionList;
+
+import org.jboss.resteasy.client.ProxyFactory;
+import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
+import org.jboss.resteasy.client.ClientResponse;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
+/**
+ * An AcquisitionClient.
+
+ * @version $Revision:$
+ */
+public class AcquisitionClient extends BaseServiceClient {
+
+
+ /**
+ *
+ */
+ private static final AcquisitionClient instance = new AcquisitionClient();
+ /**
+ *
+ */
+ private AcquisitionProxy acquisitionProxy;
+
+ /**
+ *
+ * Default constructor for IntakeClient class.
+ *
+ */
+ public AcquisitionClient() {
+ ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance();
+ RegisterBuiltin.register(factory);
+ acquisitionProxy = ProxyFactory.create(AcquisitionProxy.class, getBaseURL());
+ }
+
+ /**
+ * FIXME Comment this
+ *
+ * @return
+ */
+ public static AcquisitionClient getInstance() {
+ return instance;
+ }
+
+ /**
+ * @return
+ * @see org.collectionspace.hello.client.IntakeProxy#getIntake()
+ */
+ public ClientResponse<AcquisitionList> readList() {
+ return acquisitionProxy.readList();
+ }
+
+ /**
+ * @param csid
+ * @return
+ * @see org.collectionspace.hello.client.IntakeProxy#getIntake(java.lang.String)
+ */
+ public ClientResponse<Acquisition> read(String csid) {
+ return acquisitionProxy.read(csid);
+ }
+
+ /**
+ * @param intake
+ * @return
+ * @see org.collectionspace.hello.client.IntakeProxy#createIntake(org.collectionspace.hello.Intake)
+ */
+ public ClientResponse<Response> create(Acquisition intake) {
+ return acquisitionProxy.create(intake);
+ }
+
+ /**
+ * @param csid
+ * @param intake
+ * @return
+ * @see org.collectionspace.hello.client.IntakeProxy#updateIntake(java.lang.Long, org.collectionspace.hello.Intake)
+ */
+ public ClientResponse<Acquisition> update(String csid, Acquisition intake) {
+ return acquisitionProxy.update(csid, intake);
+ }
+
+ /**
+ * @param csid
+ * @return
+ * @see org.collectionspace.hello.client.IntakeProxy#deleteIntake(java.lang.Long)
+ */
+ public ClientResponse<Response> delete(String csid) {
+ return acquisitionProxy.delete(csid);
+ }
+}
--- /dev/null
+package org.collectionspace.services.client;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.acquisition.Acquisition;
+import org.collectionspace.services.acquisition.AcquisitionList;
+import org.jboss.resteasy.client.ClientResponse;
+
+/**
+ * @version $Revision:$
+ */
+@Path("/acquisitions/")
+@Produces({"application/xml"})
+@Consumes({"application/xml"})
+public interface AcquisitionProxy {
+
+ @GET
+ ClientResponse<AcquisitionList> readList();
+
+ //(C)reate
+ @POST
+ ClientResponse<Response> create(Acquisition co);
+
+ //(R)ead
+ @GET
+ @Path("/{csid}")
+ ClientResponse<Acquisition> read(@PathParam("csid") String csid);
+
+ //(U)pdate
+ @PUT
+ @Path("/{csid}")
+ ClientResponse<Acquisition> update(@PathParam("csid") String csid, Acquisition co);
+
+ //(D)elete
+ @DELETE
+ @Path("/{csid}")
+ ClientResponse<Response> delete(@PathParam("csid") String csid);
+}
\ No newline at end of file
--- /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.List;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.Response.Status;
+
+import org.collectionspace.services.client.AcquisitionClient;
+import org.collectionspace.services.client.test.ServiceRequestType;
+import org.collectionspace.services.acquisition.Acquisition;
+import org.collectionspace.services.acquisition.AcquisitionList;
+
+import org.jboss.resteasy.client.ClientResponse;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * AcquisitionServiceTest, carries out tests against a
+ * deployed and running Acquisition Service.
+ *
+ * $LastChangedRevision: 621 $
+ * $LastChangedDate: 2009-09-02 16:49:01 -0700 (Wed, 02 Sep 2009) $
+ */
+public class AcquisitionServiceTest extends AbstractServiceTest {
+
+ // Instance variables specific to this test.
+ private AcquisitionClient client = new AcquisitionClient();
+ final String SERVICE_PATH_COMPONENT = "acquisitions";
+ private String knownResourceId = null;
+
+
+ // ---------------------------------------------------------------
+ // CRUD tests : CREATE tests
+ // ---------------------------------------------------------------
+
+ // Success outcomes
+
+ @Override
+ @Test
+ public void create() {
+
+ // Perform setup, such as initializing the type of service request
+ // (e.g. CREATE, DELETE), its valid and expected status codes, and
+ // its associated HTTP method name (e.g. POST, DELETE).
+ setupCreate();
+
+ // Submit the request to the service and store the response.
+ String identifier = createIdentifier();
+ Acquisition acquisition = createAcquisitionInstance(identifier);
+ ClientResponse<Response> res = client.create(acquisition);
+ 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?
+ verbose("create: status = " + statusCode);
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+ // Store the ID returned from this create operation for
+ // additional tests below.
+ knownResourceId = extractId(res);
+ }
+
+ @Override
+ @Test(dependsOnMethods = {"create"})
+ public void createList() {
+ for(int i = 0; i < 3; i++){
+ create();
+ }
+ }
+
+ // Failure outcomes
+
+ @Override
+ @Test(dependsOnMethods = {"create"},
+ expectedExceptions = IllegalArgumentException.class)
+ public void createNull() {
+ ClientResponse<Response> res = client.create(null);
+ }
+
+ // Placeholders until the two tests below can be uncommented.
+ // See Issue CSPACE-401.
+ public void createWithMalformedXml() {}
+ public void createWithWrongXmlSchema() {}
+
+/*
+ @Override
+ @Test(dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithMalformedXml() {
+
+ // Perform setup.
+ setupCreateWithMalformedXml();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getServiceRootURL();
+ final String entity = MALFORMED_XML_DATA; // Constant from base class.
+ int statusCode = submitRequest(method, url, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("createWithMalformedXml url=" + url + " status=" + statusCode);
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
+
+ @Override
+ @Test(dependsOnMethods = {"create", "testSubmitRequest"})
+ public void createWithWrongXmlSchema() {
+
+ // Perform setup.
+ setupCreateWithWrongXmlSchema();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getServiceRootURL();
+ final String entity = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("createWithWrongSchema url=" + url + " status=" + statusCode);
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
+*/
+
+ // ---------------------------------------------------------------
+ // CRUD tests : READ tests
+ // ---------------------------------------------------------------
+
+ // Success outcomes
+
+ @Override
+ @Test(dependsOnMethods = {"create"})
+ public void read() {
+
+ // Perform setup.
+ setupRead();
+
+ // Submit the request to the service and store the response.
+ ClientResponse<Acquisition> res = client.read(knownResourceId);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("read: status = " + statusCode);
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
+
+ // Failure outcomes
+
+ @Override
+ @Test(dependsOnMethods = {"read"})
+ public void readNonExistent() {
+
+ // Perform setup.
+ setupReadNonExistent();
+
+ // Submit the request to the service and store the response.
+ ClientResponse<Acquisition> res = client.read(NON_EXISTENT_ID);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("readNonExistent: status = " + res.getStatus());
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
+
+
+ // ---------------------------------------------------------------
+ // CRUD tests : READ_LIST tests
+ // ---------------------------------------------------------------
+
+ // Success outcomes
+
+ @Override
+ @Test(dependsOnMethods = {"createList"})
+ public void readList() {
+
+ // Perform setup.
+ setupReadList();
+
+ // Submit the request to the service and store the response.
+ ClientResponse<AcquisitionList> res = client.readList();
+ AcquisitionList list = res.getEntity();
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("readList: status = " + res.getStatus());
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+ // Optionally output additional data about list members for debugging.
+ boolean iterateThroughList = false;
+ if (iterateThroughList && logger.isDebugEnabled()) {
+ List<AcquisitionList.AcquisitionListItem> items =
+ list.getAcquisitionListItem();
+ int i = 0;
+ for(AcquisitionList.AcquisitionListItem item : items){
+ verbose("readList: list-item[" + i + "] csid=" +
+ item.getCsid());
+ verbose("readList: list-item[" + i + "] objectNumber=" +
+ item.getAccessiondate());
+ verbose("readList: list-item[" + i + "] URI=" +
+ item.getUri());
+ i++;
+ }
+ }
+
+ }
+
+ // Failure outcomes
+
+ // None at present.
+
+
+ // ---------------------------------------------------------------
+ // CRUD tests : UPDATE tests
+ // ---------------------------------------------------------------
+
+ // Success outcomes
+
+ @Override
+ @Test(dependsOnMethods = {"create"})
+ public void update() {
+
+ // Perform setup.
+ setupUpdate();
+
+ // Retrieve an existing resource that we can update.
+ ClientResponse<Acquisition> res = client.read(knownResourceId);
+ verbose("read: status = " + res.getStatus());
+ Assert.assertEquals(res.getStatus(), EXPECTED_STATUS_CODE);
+ Acquisition acquisition = res.getEntity();
+ verbose("Got object to update with ID: " + knownResourceId,
+ acquisition, Acquisition.class);
+
+ // Update the content of this resource.
+ acquisition.setAccessiondate("updated-" + acquisition.getAccessiondate());
+// acquisition.setEntryDate("updated-" + acquisition.getEntryDate());
+
+ // Submit the request to the service and store the response.
+ res = client.update(knownResourceId, acquisition);
+ int statusCode = res.getStatus();
+ Acquisition updatedObject = res.getEntity();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("update: status = " + res.getStatus());
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+ // Check the contents of the response: does it match
+ // what was submitted?
+ verbose("update: ", updatedObject, Acquisition.class);
+ Assert.assertEquals(updatedObject.getAccessiondate(),
+ acquisition.getAccessiondate(),
+ "Data in updated object did not match submitted data.");
+ }
+
+ // Failure outcomes
+
+ // Placeholders until the two tests below can be uncommented.
+ // See Issue CSPACE-401.
+ public void updateWithMalformedXml() {}
+ public void updateWithWrongXmlSchema() {}
+
+/*
+ @Override
+ @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithMalformedXml() {
+
+ // Perform setup.
+ setupUpdateWithMalformedXml();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getResourceURL(knownResourceId);
+ final String entity = MALFORMED_XML_DATA;
+ int statusCode = submitRequest(method, url, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("updateWithMalformedXml: url=" + url + " status=" + statusCode);
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
+
+ @Override
+ @Test(dependsOnMethods = {"create", "update", "testSubmitRequest"})
+ public void updateWithWrongXmlSchema() {
+
+ // Perform setup.
+ setupUpdateWithWrongXmlSchema();
+
+ // Submit the request to the service and store the response.
+ String method = REQUEST_TYPE.httpMethodName();
+ String url = getResourceURL(knownResourceId);
+ final String entity = WRONG_XML_SCHEMA_DATA;
+ int statusCode = submitRequest(method, url, entity);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("updateWithWrongSchema: url=" + url + " status=" + statusCode);
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
+*/
+
+ @Override
+ @Test(dependsOnMethods = {"update", "testSubmitRequest"})
+ public void updateNonExistent() {
+
+ // Perform setup.
+ setupUpdateNonExistent();
+
+ // Submit the request to the service and store the response.
+ // Note: The ID used in this 'create' call may be arbitrary.
+ // The only relevant ID may be the one used in update(), below.
+ Acquisition acquisition = createAcquisitionInstance(NON_EXISTENT_ID);
+ ClientResponse<Acquisition> res =
+ client.update(NON_EXISTENT_ID, acquisition);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("updateNonExistent: status = " + res.getStatus());
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
+
+ // ---------------------------------------------------------------
+ // CRUD tests : DELETE tests
+ // ---------------------------------------------------------------
+
+ // Success outcomes
+
+ @Override
+ @Test(dependsOnMethods =
+ {"create", "read", "update"})
+ public void delete() {
+
+ // Perform setup.
+ setupDelete();
+
+ // Submit the request to the service and store the response.
+ ClientResponse<Response> res = client.delete(knownResourceId);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("delete: status = " + res.getStatus());
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
+
+ // Failure outcomes
+
+ @Override
+ @Test(dependsOnMethods = {"delete"})
+ public void deleteNonExistent() {
+
+ // Perform setup.
+ setupDeleteNonExistent();
+
+ // Submit the request to the service and store the response.
+ ClientResponse<Response> res = client.delete(NON_EXISTENT_ID);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("deleteNonExistent: status = " + res.getStatus());
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ }
+
+
+ // ---------------------------------------------------------------
+ // Utility tests : tests of code used in tests above
+ // ---------------------------------------------------------------
+
+ /**
+ * Tests the code for manually submitting data that is used by several
+ * of the methods above.
+ */
+ @Test(dependsOnMethods = {"create", "read"})
+ public void testSubmitRequest() {
+
+ // Expected status code: 200 OK
+ final int EXPECTED_STATUS_CODE = Response.Status.OK.getStatusCode();
+
+ // Submit the request to the service and store the response.
+ String method = ServiceRequestType.READ.httpMethodName();
+ String url = getResourceURL(knownResourceId);
+ int statusCode = submitRequest(method, url);
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ verbose("testSubmitRequest: url=" + url + " status=" + statusCode);
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+ }
+
+ // ---------------------------------------------------------------
+ // Utility methods used by tests above
+ // ---------------------------------------------------------------
+
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ private Acquisition createAcquisitionInstance(String identifier) {
+ Acquisition acquisition =
+ createAcquisitionInstance(
+ "entryNumber-" + identifier,
+ "entryDate-" + identifier);
+ return acquisition;
+ }
+
+ private Acquisition createAcquisitionInstance(String entryNumber, String entryDate) {
+ Acquisition acquisition = new Acquisition();
+// acquisition.setEntryNumber(entryNumber);
+ acquisition.setAccessiondate(entryDate);
+ return acquisition;
+ }
+
+}
--- /dev/null
+log4j.rootLogger=debug, stdout, R\r
+\r
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender\r
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout\r
+\r
+# Pattern to output the caller's file name and line number.\r
+log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n\r
+\r
+log4j.appender.R=org.apache.log4j.RollingFileAppender\r
+log4j.appender.R.File=target/test-client.log\r
+\r
+log4j.appender.R.MaxFileSize=100KB\r
+# Keep one backup file\r
+log4j.appender.R.MaxBackupIndex=1\r
+\r
+log4j.appender.R.layout=org.apache.log4j.PatternLayout\r
+log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n\r
+\r
+#packages\r
+log4j.logger.org.collectionspace=DEBUG\r
+log4j.logger.org.apache=INFO\r
+log4j.logger.httpclient=INFO\r
+log4j.logger.org.jboss.resteasy=INFO\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry kind="src" path="target/generated-sources/xjc"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>javaee-acquisition-jaxb</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+#Thu Jul 30 17:14:47 PDT 2009\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate\r
+org.eclipse.jdt.core.compiler.debug.localVariable=generate\r
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.source=1.6\r
--- /dev/null
+#Thu Feb 26 16:30:28 PST 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+version=1\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <artifactId>org.collectionspace.services.acquisition</artifactId>
+ <groupId>org.collectionspace.services</groupId>
+ <version>1.0</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.acquisition.jaxb</artifactId>
+ <version>1.0</version>
+ <name>services.acquisition.jaxb</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.0.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2-commons</groupId>
+ <artifactId>property-listener-injector</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jvnet.jaxb2_commons</groupId>
+ <artifactId>runtime</artifactId>
+ <version>0.4.1.4</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <finalName>collectionspace-services-acquisition-jaxb</finalName>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.jvnet.jaxb2.maven2</groupId>
+ <artifactId>maven-jaxb2-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <!-- javax.activation.DataSource provider is required by spec -->
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>2.1.2</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <args>
+ <arg>-XtoString</arg>
+ <arg>-Xinject-listener-code</arg>
+
+ <!-- <arg>-Xcollection-setter-injector</arg>
+ <arg>-Xfluent-api</arg> -->
+ </args>
+ <plugins>
+ <plugin>
+ <groupId>
+ org.jvnet.jaxb2_commons
+ </groupId>
+ <artifactId>basic</artifactId>
+ <version>0.4.1</version>
+ </plugin>
+ <plugin>
+ <groupId>
+ org.jvnet.jaxb2-commons
+ </groupId>
+ <artifactId>
+ property-listener-injector
+ </artifactId>
+ <version>1.0</version>
+ </plugin>
+
+ </plugins>
+ <!--generatePackage>
+ org.collectionspace.hello
+ </generatePackage-->
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.0.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+
--- /dev/null
+/**\r
+ * \r
+ */\r
+package org.collectionspace.services;\r
+\r
+/**\r
+ * @author remillet\r
+ *\r
+ */\r
+public interface AcquisitionJAXBSchema {\r
+ final static String ACCESSIONDATE = "accessiondate";\r
+}\r
+\r
+\r
--- /dev/null
+package org.collectionspace.services;\r
+\r
+public interface AcquisitionListItemJAXBSchema {\r
+ final static String ENTRY_NUMBER = "xyz";\r
+ final static String CSID = "csid";\r
+ final static String URI = "url";\r
+}\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xs:schema
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:ns="http://collectionspace.org/acquisition"
+ xmlns="http://collectionspace.org/acquisition"
+ targetNamespace="http://services.collectionspace.org/acquisition"
+ version="0.1"
+>
+
+
+<!-- avoid XmlRootElement nightnmare, see http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html-->
+ <!-- See http://wiki.collectionspace.org/display/collectionspace/Acquisition+Schema -->
+
+ <!-- acquisition -->
+ <xs:element name="acquisition">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="csid" type="xs:string" />
+ <!-- Object Entry Information Group -->
+ <xs:element name="accessiondate" type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- acquisition records, as in nuxeo repository -->
+ <xs:element name="acquisition-list">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="acquisition-list-item" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="accessiondate" type="xs:string"
+ minOccurs="1" />
+ <!-- uri to retrive acquisition details -->
+ <xs:element name="uri" type="xs:anyURI"
+ minOccurs="1" />
+ <xs:element name="csid" type="xs:string"
+ minOccurs="1" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!-- A comment. -->\r
+<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">\r
+ <parent>\r
+ <artifactId>org.collectionspace.services.main</artifactId>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <version>1.0</version>\r
+ </parent>\r
+ <modelVersion>4.0.0</modelVersion>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <version>1.0</version>\r
+ <artifactId>org.collectionspace.services.acquisition</artifactId>\r
+ <packaging>pom</packaging>\r
+ <name>services.acquisition</name>\r
+\r
+\r
+ <modules>\r
+ <module>jaxb</module>\r
+ <module>service</module>\r
+ <module>3rdparty</module>\r
+ <module>client</module>\r
+ </modules>\r
+\r
+ <build>\r
+ <pluginManagement>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-compiler-plugin</artifactId>\r
+ <configuration>\r
+ <source>1.5</source>\r
+ <target>1.5</target>\r
+ </configuration>\r
+ </plugin>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-site-plugin</artifactId>\r
+ <configuration>\r
+ <unzipCommand>/usr/bin/unzip -o > err.txt</unzipCommand>\r
+ </configuration>\r
+ </plugin>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-war-plugin</artifactId>\r
+ <version>2.0.1</version>\r
+ <configuration>\r
+ <warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>\r
+ <archive>\r
+ <manifest>\r
+ <addClasspath>true</addClasspath>\r
+\r
+ </manifest>\r
+ </archive>\r
+ </configuration>\r
+ </plugin>\r
+ </plugins>\r
+ </pluginManagement>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-compiler-plugin</artifactId>\r
+ <version>2.0.2</version>\r
+ <configuration>\r
+ <source>1.6</source>\r
+ <target>1.6</target>\r
+ </configuration>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+</project>\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
+ <classpathentry kind="output" path="target/classes"/>\r
+</classpath>\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>org.collectionspace.services.acquisition.service</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.jdt.core.javabuilder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ <buildCommand>\r
+ <name>org.maven.ide.eclipse.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.jdt.core.javanature</nature>\r
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
--- /dev/null
+#Thu Jul 30 17:13:26 PDT 2009\r
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve\r
+org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate\r
+org.eclipse.jdt.core.compiler.debug.localVariable=generate\r
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.source=1.6\r
--- /dev/null
+#Mon Jun 29 14:27:15 PDT 2009\r
+activeProfiles=\r
+eclipse.preferences.version=1\r
+fullBuildGoals=process-test-resources\r
+includeModules=false\r
+resolveWorkspaceProjects=true\r
+resourceFilterGoals=process-resources resources\:testResources\r
+version=1\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<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">\r
+\r
+ <parent>\r
+ <artifactId>org.collectionspace.services.acquisition</artifactId>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <version>1.0</version>\r
+ </parent>\r
+ \r
+ <modelVersion>4.0.0</modelVersion>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.acquisition.service</artifactId>\r
+ <packaging>jar</packaging>\r
+ <version>1.0</version>\r
+ <name>services.acquisition.service</name>\r
+\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.common</artifactId>\r
+ <version>1.0</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.acquisition.jaxb</artifactId>\r
+ <version>1.0</version>\r
+ </dependency>\r
+ \r
+ <dependency>\r
+ <groupId>junit</groupId>\r
+ <artifactId>junit</artifactId>\r
+ <version>4.1</version>\r
+ <scope>test</scope>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.testng</groupId>\r
+ <artifactId>testng</artifactId>\r
+ <version>5.6</version>\r
+ </dependency>\r
+ \r
+\r
+ <!-- javax -->\r
+\r
+\r
+ <dependency>\r
+ <groupId>javax.security</groupId>\r
+ <artifactId>jaas</artifactId>\r
+ <version>1.0.01</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+\r
+ <dependency>\r
+ <groupId>dom4j</groupId>\r
+ <artifactId>dom4j</artifactId>\r
+ <version>1.6.1</version>\r
+ <scope>provided</scope>\r
+ </dependency>\r
+ \r
+ <!-- jboss -->\r
+\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-jaxrs</artifactId>\r
+ <version>1.0.2.GA</version>\r
+ <exclusions>\r
+ <exclusion>\r
+ <groupId>tjws</groupId>\r
+ <artifactId>webserver</artifactId>\r
+ </exclusion>\r
+ </exclusions>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-jaxb-provider</artifactId>\r
+ <version>1.0.2.GA</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>org.jboss.resteasy</groupId>\r
+ <artifactId>resteasy-multipart-provider</artifactId>\r
+ <version>1.0.2.GA</version>\r
+ </dependency>\r
+ \r
+ <!-- nuxeo -->\r
+\r
+ <dependency>\r
+ <groupId>org.nuxeo.ecm.core</groupId>\r
+ <artifactId>nuxeo-core-api</artifactId>\r
+ <version>${nuxeo.version.1.5}</version>\r
+ <exclusions>\r
+ <exclusion>\r
+ <artifactId>jboss-remoting</artifactId>\r
+ <groupId>jboss</groupId>\r
+ </exclusion>\r
+ </exclusions>\r
+ </dependency>\r
+\r
+ <dependency>\r
+ <groupId>org.restlet</groupId>\r
+ <artifactId>org.restlet</artifactId>\r
+ <version>1.0.7</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.noelios.restlet</groupId>\r
+ <artifactId>com.noelios.restlet.ext.httpclient</artifactId>\r
+ <version>1.0.7</version>\r
+ </dependency>\r
+ <dependency>\r
+ <groupId>com.noelios.restlet</groupId>\r
+ <artifactId>com.noelios.restlet</artifactId>\r
+ <version>1.0.7</version>\r
+ </dependency>\r
+\r
+ </dependencies>\r
+ \r
+ <build>\r
+ <finalName>collectionspace-services-acquisition</finalName>\r
+ <plugins>\r
+ <plugin>\r
+ <groupId>org.codehaus.mojo</groupId>\r
+ <artifactId>jboss-maven-plugin</artifactId>\r
+ <configuration>\r
+ <jbossHome>${jboss.dir}</jbossHome>\r
+ </configuration>\r
+ </plugin>\r
+ <plugin>\r
+ <groupId>org.apache.maven.plugins</groupId>\r
+ <artifactId>maven-compiler-plugin</artifactId>\r
+ <configuration>\r
+ <source>1.6</source>\r
+ <target>1.6</target>\r
+ <showDeprecation>true</showDeprecation>\r
+ </configuration>\r
+ </plugin>\r
+ </plugins>\r
+ </build>\r
+</project>\r
+\r
--- /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.acquisition;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriInfo;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+
+import org.collectionspace.services.acquisition.AcquisitionList.*;
+
+import org.collectionspace.services.acquisition.nuxeo.AcquisitionConstants;
+import org.collectionspace.services.acquisition.nuxeo.AcquisitionHandlerFactory;
+import org.collectionspace.services.common.NuxeoClientType;
+import org.collectionspace.services.common.ServiceMain;
+import org.collectionspace.services.common.repository.DocumentNotFoundException;
+import org.collectionspace.services.common.repository.DocumentHandler;
+import org.collectionspace.services.common.repository.RepositoryClient;
+import org.collectionspace.services.common.repository.RepositoryClientFactory;
+import org.jboss.resteasy.util.HttpResponseCodes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Path("/acquisitions")
+@Consumes("application/xml")
+@Produces("application/xml")
+public class AcquisitionResource {
+
+ public final static String ACQUISITION_SERVICE_NAME = "acquisitions";
+ final Logger logger = LoggerFactory.getLogger(AcquisitionResource.class);
+ //FIXME retrieve client type from configuration
+ final static NuxeoClientType CLIENT_TYPE = ServiceMain.getInstance().getNuxeoClientType();
+
+ public AcquisitionResource() {
+ // do nothing
+ }
+
+ @POST
+ public Response createAcquisition(
+ Acquisition acquisitionObject) {
+
+ String csid = null;
+ try{
+ RepositoryClientFactory clientFactory = RepositoryClientFactory.getInstance();
+ RepositoryClient client = clientFactory.getClient(CLIENT_TYPE.toString());
+ AcquisitionHandlerFactory handlerFactory = AcquisitionHandlerFactory.getInstance();
+ DocumentHandler handler = (DocumentHandler) handlerFactory.getHandler(CLIENT_TYPE.toString());
+ handler.setCommonObject(acquisitionObject);
+ csid = client.create(ACQUISITION_SERVICE_NAME, handler);
+ acquisitionObject.setCsid(csid);
+ if(logger.isDebugEnabled()){
+ verbose("createAcquisition: ", acquisitionObject);
+ }
+ UriBuilder path = UriBuilder.fromResource(AcquisitionResource.class);
+ path.path("" + csid);
+ Response response = Response.created(path.build()).build();
+ return response;
+ }catch(Exception e){
+ if(logger.isDebugEnabled()){
+ logger.debug("Caught exception in createAcquisition", e);
+ }
+ Response response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Create failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ }
+
+ @GET
+ @Path("{csid}")
+ public Acquisition getAcquisition(
+ @PathParam("csid") String csid) {
+ if(logger.isDebugEnabled()){
+ verbose("getAcquisition with csid=" + csid);
+ }
+ if(csid == null || "".equals(csid)){
+ logger.error("getAcquisition: missing csid!");
+ Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+ "get failed on Acquisition csid=" + csid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ Acquisition acquisitionObject = null;
+ try{
+ RepositoryClientFactory clientFactory = RepositoryClientFactory.getInstance();
+ RepositoryClient client = clientFactory.getClient(CLIENT_TYPE.toString());
+ AcquisitionHandlerFactory handlerFactory = AcquisitionHandlerFactory.getInstance();
+ DocumentHandler handler = (DocumentHandler) handlerFactory.getHandler(CLIENT_TYPE.toString());
+ client.get(csid, handler);
+ acquisitionObject = (Acquisition) handler.getCommonObject();
+ }catch(DocumentNotFoundException dnfe){
+ if(logger.isDebugEnabled()){
+ logger.debug("getAcquisition", dnfe);
+ }
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Get failed on Acquisition csid=" + csid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }catch(Exception e){
+ if(logger.isDebugEnabled()){
+ logger.debug("getAcquisition", e);
+ }
+ Response response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Get failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+
+ if(acquisitionObject == null){
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Get failed, the requested Acquisition CSID:" + csid + ": was not found.").type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ if(logger.isDebugEnabled()){
+ verbose("getAcquisition: ", acquisitionObject);
+ }
+ return acquisitionObject;
+ }
+
+ @GET
+ public AcquisitionList getAcquisitionList(@Context UriInfo ui) {
+ AcquisitionList acquisitionObjectList = new AcquisitionList();
+ try{
+ RepositoryClientFactory clientFactory = RepositoryClientFactory.getInstance();
+ RepositoryClient client = clientFactory.getClient(CLIENT_TYPE.toString());
+ AcquisitionHandlerFactory handlerFactory = AcquisitionHandlerFactory.getInstance();
+ DocumentHandler handler = (DocumentHandler) handlerFactory.getHandler(CLIENT_TYPE.toString());
+ client.getAll(ACQUISITION_SERVICE_NAME, handler);
+ acquisitionObjectList = (AcquisitionList) handler.getCommonObjectList();
+ }catch(Exception e){
+ if(logger.isDebugEnabled()){
+ logger.debug("Caught exception in getAcquisitionList", e);
+ }
+ Response response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ return acquisitionObjectList;
+ }
+
+ @PUT
+ @Path("{csid}")
+ public Acquisition updateAcquisition(
+ @PathParam("csid") String csid,
+ Acquisition theUpdate) {
+ if(logger.isDebugEnabled()){
+ verbose("updateAcquisition with csid=" + csid);
+ }
+ if(csid == null || "".equals(csid)){
+ logger.error("updateAcquisition: missing csid!");
+ Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+ "update failed on Acquisition csid=" + csid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ if(logger.isDebugEnabled()){
+ verbose("updateAcquisition with input: ", theUpdate);
+ }
+ try{
+ RepositoryClientFactory clientFactory = RepositoryClientFactory.getInstance();
+ RepositoryClient client = clientFactory.getClient(CLIENT_TYPE.toString());
+ AcquisitionHandlerFactory handlerFactory = AcquisitionHandlerFactory.getInstance();
+ DocumentHandler handler = (DocumentHandler) handlerFactory.getHandler(CLIENT_TYPE.toString());
+ handler.setCommonObject(theUpdate);
+ client.update(csid, handler);
+ }catch(DocumentNotFoundException dnfe){
+ if(logger.isDebugEnabled()){
+ logger.debug("caugth exception in updateAcquisition", dnfe);
+ }
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Update failed on Acquisition csid=" + csid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }catch(Exception e){
+ Response response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Update failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ return theUpdate;
+ }
+
+ @DELETE
+ @Path("{csid}")
+ public Response deleteAcquisition(@PathParam("csid") String csid) {
+
+ if(logger.isDebugEnabled()){
+ verbose("deleteAcquisition with csid=" + csid);
+ }
+ if(csid == null || "".equals(csid)){
+ logger.error("deleteAcquisition: missing csid!");
+ Response response = Response.status(Response.Status.BAD_REQUEST).entity(
+ "delete failed on Acquisition csid=" + csid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ try{
+ RepositoryClientFactory clientFactory = RepositoryClientFactory.getInstance();
+ RepositoryClient client = clientFactory.getClient(CLIENT_TYPE.toString());
+ client.delete(csid);
+ return Response.status(HttpResponseCodes.SC_OK).build();
+ }catch(DocumentNotFoundException dnfe){
+ if(logger.isDebugEnabled()){
+ logger.debug("caught exception in deleteAcquisition", dnfe);
+ }
+ Response response = Response.status(Response.Status.NOT_FOUND).entity(
+ "Delete failed on Acquisition csid=" + csid).type(
+ "text/plain").build();
+ throw new WebApplicationException(response);
+ }catch(Exception e){
+ Response response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Delete failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+
+ }
+
+ private void verbose(String msg, Acquisition acquisitionObject) {
+ try{
+ verbose(msg);
+ JAXBContext jc = JAXBContext.newInstance(
+ Acquisition.class);
+
+ Marshaller m = jc.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ m.marshal(acquisitionObject, System.out);
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
+ }
+
+ private void verbose(String msg) {
+ System.out.println("AcquisitionResource. " + msg);
+ }
+}
--- /dev/null
+/**\r
+ * \r
+ */\r
+package org.collectionspace.services.acquisition;\r
+\r
+import java.io.IOException;\r
+import org.dom4j.Document;\r
+import org.dom4j.DocumentException;\r
+\r
+import org.collectionspace.services.acquisition.Acquisition;\r
+\r
+/**\r
+ * @author remillet\r
+ * \r
+ */\r
+public interface AcquisitionService {\r
+\r
+ public final static String ACQUISITION_SCHEMA_NAME = "acquisition";\r
+\r
+ // Create\r
+ Document postAcquisition(Acquisition co)\r
+ throws DocumentException, IOException;\r
+\r
+ // Read single object\r
+ Document getAcquisition(String csid) throws DocumentException,\r
+ IOException;\r
+\r
+ // Read a list of objects\r
+ Document getAcquisitionList() throws DocumentException, IOException;\r
+\r
+ // Update\r
+ Document putAcquisition(String csid, Acquisition theUpdate)\r
+ throws DocumentException, IOException;\r
+\r
+ // Delete\r
+ Document deleteAcquisition(String csid) throws DocumentException,\r
+ IOException;\r
+}\r
--- /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.acquisition.nuxeo;
+
+/**
+ * IntakeConstants processes CollectionObject document
+ *
+ */
+public class AcquisitionConstants {
+
+ public final static String NUXEO_DOCTYPE = "Acquisition";
+ public final static String NUXEO_SCHEMA_NAME = "acquisition";
+ public final static String NUXEO_DC_TITLE = "CollectionSpace-Acquisition";
+}
--- /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.acquisition.nuxeo;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.collectionspace.services.AcquisitionJAXBSchema;
+import org.collectionspace.services.common.repository.DocumentWrapper;
+import org.collectionspace.services.acquisition.Acquisition;
+import org.collectionspace.services.acquisition.AcquisitionList;
+import org.collectionspace.services.acquisition.AcquisitionList.AcquisitionListItem;
+import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler;
+import org.collectionspace.services.acquisition.nuxeo.AcquisitionConstants;
+
+import org.nuxeo.ecm.core.api.DocumentModel;
+import org.nuxeo.ecm.core.api.DocumentModelList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * AcquisitionDocumentModelHandler
+ *
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+public class AcquisitionDocumentModelHandler
+ extends DocumentModelHandler<Acquisition, AcquisitionList> {
+
+ private final Logger logger = LoggerFactory.getLogger(AcquisitionDocumentModelHandler.class);
+ /**
+ * acquisition is used to stash JAXB object to use when handle is called
+ * for Action.CREATE, Action.UPDATE or Action.GET
+ */
+ private Acquisition acquisition;
+ /**
+ * acquisitionList is stashed when handle is called
+ * for ACTION.GET_ALL
+ */
+ private AcquisitionList acquisitionList;
+
+ @Override
+ public void prepare(Action action) throws Exception {
+ //no specific action needed
+ }
+
+ /**
+ * getCommonObject get associated acquisition
+ * @return
+ */
+ @Override
+ public Acquisition getCommonObject() {
+ return acquisition;
+ }
+
+ /**
+ * setCommonObject set associated acquisition
+ * @param acquisition
+ */
+ @Override
+ public void setCommonObject(Acquisition acquisition) {
+ this.acquisition = acquisition;
+ }
+
+ /**
+ * getAcquisitionList get associated acquisition (for index/GET_ALL)
+ * @return
+ */
+ @Override
+ public AcquisitionList getCommonObjectList() {
+ return acquisitionList;
+ }
+
+ @Override
+ public void setCommonObjectList(AcquisitionList acquisitionList) {
+ this.acquisitionList = acquisitionList;
+ }
+
+ @Override
+ public Acquisition extractCommonObject(DocumentWrapper wrapDoc)
+ throws Exception {
+ DocumentModel docModel = (DocumentModel) wrapDoc.getWrappedObject();
+ Acquisition acquisitionObject = new Acquisition();
+
+ //FIXME property get should be dynamically set using schema inspection
+ //so it does not require hard coding
+
+ // acquisition core values
+ acquisitionObject.setAccessiondate((String)docModel.getPropertyValue(
+ getQProperty(AcquisitionJAXBSchema.ACCESSIONDATE)));
+
+ return acquisitionObject;
+ }
+
+ @Override
+ public void fillCommonObject(Acquisition acquisitionObject, DocumentWrapper wrapDoc) throws Exception {
+ DocumentModel docModel = (DocumentModel) wrapDoc.getWrappedObject();
+ //FIXME property setter should be dynamically set using schema inspection
+ //so it does not require hard coding
+
+ // a default title for the Dublin Core schema
+ docModel.setPropertyValue("dublincore:title", AcquisitionConstants.NUXEO_DC_TITLE);
+
+ // acquisition core values
+ if(acquisitionObject.getAccessiondate() != null){
+ docModel.setPropertyValue(getQProperty(
+ AcquisitionJAXBSchema.ACCESSIONDATE), acquisitionObject.getAccessiondate());
+ }
+ }
+
+ @Override
+ public AcquisitionList extractCommonObjectList(DocumentWrapper wrapDoc) throws Exception {
+ DocumentModelList docList = (DocumentModelList) wrapDoc.getWrappedObject();
+
+ AcquisitionList coList = new AcquisitionList();
+ List<AcquisitionList.AcquisitionListItem> list = coList.getAcquisitionListItem();
+
+ //FIXME: iterating over a long list of documents is not a long term
+ //strategy...need to change to more efficient iterating in future
+ Iterator<DocumentModel> iter = docList.iterator();
+ while(iter.hasNext()){
+ DocumentModel docModel = iter.next();
+ AcquisitionListItem listItem = new AcquisitionListItem();
+ listItem.setAccessiondate((String)docModel.getPropertyValue(
+ getQProperty(AcquisitionJAXBSchema.ACCESSIONDATE)));
+ //need fully qualified context for URI
+ String id = docModel.getId();
+ listItem.setUri("/acquisitions/" + id);
+ listItem.setCsid(id);
+ list.add(listItem);
+ }
+
+ return coList;
+ }
+
+ @Override
+ public void fillCommonObjectList(AcquisitionList obj, DocumentWrapper wrapDoc) throws Exception {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
+ * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#getDocumentType()
+ */
+ public String getDocumentType() {
+ return AcquisitionConstants.NUXEO_DOCTYPE;
+ }
+
+ /**
+ * getQProperty converts the given property to qualified schema property
+ * @param prop
+ * @return
+ */
+ private String getQProperty(String prop) {
+ return AcquisitionConstants.NUXEO_SCHEMA_NAME + ":" + prop;
+ }
+}
+
--- /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.acquisition.nuxeo;
+
+import org.collectionspace.services.common.NuxeoClientType;
+import org.collectionspace.services.common.repository.DocumentHandler;
+
+/**
+ * AcquisitionHandlerFactory creates handlers for acquisition based
+ * on type of Nuxeo client used
+ *
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+public class AcquisitionHandlerFactory {
+
+ private static final AcquisitionHandlerFactory self = new AcquisitionHandlerFactory();
+
+ private AcquisitionHandlerFactory() {
+ }
+
+ public static AcquisitionHandlerFactory getInstance() {
+ return self;
+ }
+
+ public DocumentHandler getHandler(String clientType) {
+ if(NuxeoClientType.JAVA.toString().equals(clientType)){
+ return new AcquisitionDocumentModelHandler();
+ }
+
+ throw new IllegalArgumentException("Not supported client=" + clientType);
+ }
+}
--- /dev/null
+package org.collectionspace.services.test;
+
+//import org.collectionspace.services.acquisition.Acquisition;
+//import org.collectionspace.services.acquisition.AcquisitionList;
+
+/**
+ * A AcquisitionServiceTest.
+ *
+ * @version $Revision:$
+ */
+public class AcquisitionServiceTest {
+ //empty
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <appender name="console" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <layout class="org.apache.log4j.TTCCLayout">
+ <param name="DateFormat" value="ISO8601" />
+ </layout>
+ </appender>
+
+
+ <appender name="unit-tests"
+ class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="./target/unit-tests.log" />
+ <param name="MaxFileSize" value="10240KB" />
+ <param name="MaxBackupIndex" value="6" />
+ <layout class="org.apache.log4j.TTCCLayout">
+ <param name="DateFormat" value="ISO8601" />
+ </layout>
+ </appender>
+
+ <logger name="org.apache.commons.httpclient" additivity="false">
+ <level value="warn" />
+ <appender-ref ref="console" />
+ <appender-ref ref="unit-tests" />
+ </logger>
+
+ <logger name="httpclient.wire" additivity="false">
+ <level value="info" />
+ <appender-ref ref="console" />
+ <appender-ref ref="unit-tests" />
+ </logger>
+
+ <root>
+ <priority value="debug" />
+ <appender-ref ref="console" />
+ <appender-ref ref="unit-tests" />
+ </root>
+
+</log4j:configuration>
+
+
+
+
<service-name>relations</service-name>
<workspace-name>Relations</workspace-name>
</workspace>
+ <workspace>
+ <service-name>acquisitions</service-name>
+ <workspace-name>Acquisitions</workspace-name>
+ </workspace>
</nuxeo-workspace>
</ns1:service-config>
<module>authentication</module>\r
<module>relation</module>\r
<module>query</module>\r
+ <module>acquisition</module>\r
<module>vocabulary</module>\r
<module>id</module>\r
<module>collectionobject</module>\r