]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
Citation Authority
authorseb <seb@csdev-seb.SMK.DK>
Mon, 6 May 2013 08:35:19 +0000 (10:35 +0200)
committerseb <seb@csdev-seb.SMK.DK>
Mon, 6 May 2013 08:35:19 +0000 (10:35 +0200)
45 files changed:
services/JaxRsServiceProvider/pom.xml
services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java
services/citation/.classpath [new file with mode: 0644]
services/citation/.project [new file with mode: 0644]
services/citation/3rdparty/.classpath [new file with mode: 0644]
services/citation/3rdparty/.project [new file with mode: 0644]
services/citation/3rdparty/build.xml [new file with mode: 0644]
services/citation/3rdparty/nuxeo-platform-cs-citation-smk/build.xml [new file with mode: 0644]
services/citation/3rdparty/nuxeo-platform-cs-citation-smk/pom.xml [new file with mode: 0644]
services/citation/3rdparty/nuxeo-platform-cs-citation-smk/src/main/resources/schemas/citations_smk.xsd [new file with mode: 0644]
services/citation/3rdparty/nuxeo-platform-cs-citation/build.xml [new file with mode: 0644]
services/citation/3rdparty/nuxeo-platform-cs-citation/pom.xml [new file with mode: 0644]
services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/META-INF/MANIFEST.MF [new file with mode: 0644]
services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/core-types-contrib.xml [new file with mode: 0644]
services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/deployment-fragment.xml [new file with mode: 0644]
services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/ecm-types-contrib.xml [new file with mode: 0644]
services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/layouts-contrib.xml [new file with mode: 0644]
services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/life-cycle-contrib.xml [new file with mode: 0644]
services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/schemas/citationauthorities_common.xsd [new file with mode: 0644]
services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/schemas/citations_common.xsd [new file with mode: 0644]
services/citation/3rdparty/pom.xml [new file with mode: 0644]
services/citation/build.xml [new file with mode: 0644]
services/citation/client/pom.xml [new file with mode: 0644]
services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityClient.java [new file with mode: 0644]
services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityClientUtils.java [new file with mode: 0644]
services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityProxy.java [new file with mode: 0644]
services/citation/installer/build.xml [new file with mode: 0644]
services/citation/jaxb/pom.xml [new file with mode: 0644]
services/citation/jaxb/src/main/java/org/collectionspace/services/CitationJAXBSchema.java [new file with mode: 0644]
services/citation/jaxb/src/main/resources/citation_common.xsd [new file with mode: 0644]
services/citation/jaxb/src/main/resources/citationauthority_common.xsd [new file with mode: 0644]
services/citation/jaxb/src/main/resources/citations_smk.xsd [new file with mode: 0644]
services/citation/pom.xml [new file with mode: 0644]
services/citation/service/pom.xml [new file with mode: 0644]
services/citation/service/src/main/java/org/collectionspace/services/citation/CitationAuthorityResource.java [new file with mode: 0644]
services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationAuthorityConstants.java [new file with mode: 0644]
services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationAuthorityDocumentModelHandler.java [new file with mode: 0644]
services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationAuthorityValidatorHandler.java [new file with mode: 0644]
services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationConstants.java [new file with mode: 0644]
services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationDocumentModelHandler.java [new file with mode: 0644]
services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationValidatorHandler.java [new file with mode: 0644]
services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml
services/pom.xml
services/relation/service/pom.xml
services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java

index 9052aaa46a2d690a157bfe0dbd392f18be25e115..cc698ca191e1bad918a61c256d7737f77413184c 100644 (file)
         <dependency>\r
             <groupId>org.collectionspace.services</groupId>\r
             <artifactId>org.collectionspace.services.person.service</artifactId>\r
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.citation.service</artifactId>
             <version>${project.version}</version>\r
         </dependency>\r
         <dependency>\r
index ccea44fb7fc40dd9e23079b35ce408e278b2feff..04b42e33f73da629430b1813dacd59e00583884d 100644 (file)
@@ -49,6 +49,7 @@ import org.collectionspace.services.contact.ContactResource;
 import org.collectionspace.services.vocabulary.VocabularyResource;
 import org.collectionspace.services.organization.OrgAuthorityResource;
 import org.collectionspace.services.person.PersonAuthorityResource;
+import org.collectionspace.services.citation.CitationAuthorityResource;
 
 //import org.collectionspace.services.query.QueryResource;
 
@@ -100,6 +101,7 @@ public class CollectionSpaceJaxRsApplication extends Application
 
         addResourceToMapAndSingletons(new VocabularyResource());
         addResourceToMapAndSingletons(new PersonAuthorityResource());
+        addResourceToMapAndSingletons(new CitationAuthorityResource());
         addResourceToMapAndSingletons(new OrgAuthorityResource());
         addResourceToMapAndSingletons(new LocationAuthorityResource());
         addResourceToMapAndSingletons(new ConceptAuthorityResource());
diff --git a/services/citation/.classpath b/services/citation/.classpath
new file mode 100644 (file)
index 0000000..d18316a
--- /dev/null
@@ -0,0 +1,5 @@
+<?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
+</classpath>\r
diff --git a/services/citation/.project b/services/citation/.project
new file mode 100644 (file)
index 0000000..0d6e32b
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>org.collectionspace.services.citation</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
+               <buildCommand>\r
+                       <name>org.eclipse.m2e.core.maven2Builder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>\r
+               <nature>org.eclipse.jdt.core.javanature</nature>\r
+               <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/services/citation/3rdparty/.classpath b/services/citation/3rdparty/.classpath
new file mode 100644 (file)
index 0000000..d18316a
--- /dev/null
@@ -0,0 +1,5 @@
+<?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
+</classpath>\r
diff --git a/services/citation/3rdparty/.project b/services/citation/3rdparty/.project
new file mode 100644 (file)
index 0000000..6f2a74a
--- /dev/null
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+       <name>org.collectionspace.services.citation.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
+               <buildCommand>\r
+                       <name>org.eclipse.m2e.core.maven2Builder</name>\r
+                       <arguments>\r
+                       </arguments>\r
+               </buildCommand>\r
+       </buildSpec>\r
+       <natures>\r
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>\r
+               <nature>org.eclipse.jdt.core.javanature</nature>\r
+               <nature>org.maven.ide.eclipse.maven2Nature</nature>\r
+       </natures>\r
+</projectDescription>\r
diff --git a/services/citation/3rdparty/build.xml b/services/citation/3rdparty/build.xml
new file mode 100644 (file)
index 0000000..56bf81e
--- /dev/null
@@ -0,0 +1,135 @@
+
+<project name="citation.3rdparty" default="package" basedir=".">
+    <description>
+        citation service 3rdparty
+    </description>
+  <!-- set global properties for this build -->
+    <property name="services.trunk" value="../../.."/>
+    <!-- enviornment should be declared before reading build.properties -->
+    <property environment="env" />
+    <property file="${services.trunk}/build.properties" />
+    <property name="mvn.opts" value="" />
+    <property name="src" location="src"/>
+
+    <condition property="osfamily-unix">
+        <os family="unix" />
+    </condition>
+    <condition property="osfamily-windows">
+        <os family="windows" />
+    </condition>
+
+    <target name="init" >
+    <!-- Create the time stamp -->
+        <tstamp/>
+    </target>
+
+    <target name="package" depends="package-unix,package-windows"
+  description="Package CollectionSpace Services" />
+    <target name="package-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    <target name="package-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.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="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="install"
+    description="deploy citation in ${jee.server.nuxeo}">
+        <ant antfile="nuxeo-platform-cs-citation/build.xml" target="deploy" inheritall="false"/>
+       <ant antfile="nuxeo-platform-cs-citation-smk/build.xml" target="deploy" inheritall="false"/>
+    </target>
+
+    <target name="undeploy"
+    description="undeploy citation from ${jee.server.nuxeo}">
+        <ant antfile="nuxeo-platform-cs-citation/build.xml" target="undeploy" inheritall="false"/>
+               <ant antfile="nuxeo-platform-cs-citation-smk/build.xml" target="undeploy" inheritall="false"/>
+   </target>
+
+    <target name="dist"
+    description="generate distribution for citation" depends="package">
+        <ant antfile="nuxeo-platform-cs-citation/build.xml" target="dist" inheritall="false"/>
+               <ant antfile="nuxeo-platform-cs-citation-smk/build.xml" target="dist" inheritall="false"/> 
+    </target>
+    
+    <target name="dist_installer"
+    description="generate distribution for collectionobject" depends="package">
+        <ant antfile="nuxeo-platform-cs-citation/build.xml" target="dist_installer" inheritall="false"/>
+               <ant antfile="nuxeo-platform-cs-citation-smk/build.xml" target="dist_installer" inheritall="false"/> 
+   </target>
+
+</project>
diff --git a/services/citation/3rdparty/nuxeo-platform-cs-citation-smk/build.xml b/services/citation/3rdparty/nuxeo-platform-cs-citation-smk/build.xml
new file mode 100644 (file)
index 0000000..ccba13e
--- /dev/null
@@ -0,0 +1,145 @@
+
+<project name="nuxeo-platform-cs-citation-smk" default="package" basedir=".">
+    <description>
+        citation nuxeo document type for smk tenant
+    </description>
+    <!-- set global properties for this build -->
+    <property name="services.trunk" value="../../../.."/>
+    <!-- environment should be declared before reading build.properties -->
+    <property environment="env" />
+    <property file="${services.trunk}/build.properties" />
+    <property name="mvn.opts" value="" />
+    <property name="src" location="src"/>
+    <property name="nuxeo.citation.jar"
+        value="org.collectionspace.services.citation.3rdparty.smk.nuxeo-${cspace.release}.jar"/>
+    <property name="nuxeo.citation.jars.all"
+        value="org.collectionspace.services.citation.3rdparty.*.nuxeo-*.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="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="install"
+        description="deploy citation doctype in ${jee.server.nuxeo}">
+        <copy file="${basedir}/target/${nuxeo.citation.jar}"
+        todir="${jee.deploy.nuxeo.plugins}"/>
+    </target>
+
+    <target name="undeploy"
+        description="undeploy citation doctype from ${jee.server.nuxeo}">
+        <delete>
+            <fileset dir="${jee.deploy.nuxeo.plugins}">
+                <include name="${nuxeo.citation.jars.all}"/>
+            </fileset>
+        </delete>
+    </target>
+
+    <target name="dist"
+        description="generate distribution for citation doctype" depends="package">
+        <copy todir="${services.trunk}/${dist.deploy.nuxeo.plugins}">
+            <fileset file="${basedir}/target/${nuxeo.citation.jar}"/>
+        </copy>
+    </target>
+
+    <target name="dist_installer"
+       description="Creates an installer distribution for citation doctype" depends="package">
+        <copy todir="${services.trunk}/${dist.installer.services}/citation/nuxeo">
+            <fileset file="${basedir}/target/${nuxeo.citation.jar}"/>
+        </copy>
+    </target>
+
+</project>
+
diff --git a/services/citation/3rdparty/nuxeo-platform-cs-citation-smk/pom.xml b/services/citation/3rdparty/nuxeo-platform-cs-citation-smk/pom.xml
new file mode 100644 (file)
index 0000000..76e08c3
--- /dev/null
@@ -0,0 +1,57 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.citation.3rdparty</artifactId>
+        <version>3.2.2-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.citation.3rdparty.smk.nuxeo</artifactId>
+    <name>services.citation.3rdparty.smk.nuxeo</name>
+    <packaging>jar</packaging>
+    <description>
+        Citation Nuxeo Document Type for smk tenant
+    </description>
+    
+    <properties>
+           <CustomSchemaName>citations_smk</CustomSchemaName>
+           <TenantId>5</TenantId>
+           <TenantLabel>smk</TenantLabel>
+       </properties>
+    
+    <build>
+        <resources>
+               <resource>
+                   <directory>../../../../3rdparty/nuxeo/nuxeo-doctype/src/main/resources</directory>
+                   <filtering>true</filtering>
+               </resource>
+               <resource>
+                   <directory>../../../../3rdparty/nuxeo/nuxeo-doctype-custom/src/main/resources</directory>
+                   <filtering>true</filtering>
+               </resource>
+               <resource>
+                   <directory>src/main/resources</directory>
+                   <filtering>true</filtering>
+               </resource>
+           </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifestFile>target/classes/META-INF/MANIFEST.MF</manifestFile>
+                        <manifestEntries>
+                            <Bundle-Version>${eclipseVersion}</Bundle-Version>
+                            <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
+                        </manifestEntries>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    
+</project>
diff --git a/services/citation/3rdparty/nuxeo-platform-cs-citation-smk/src/main/resources/schemas/citations_smk.xsd b/services/citation/3rdparty/nuxeo-platform-cs-citation-smk/src/main/resources/schemas/citations_smk.xsd
new file mode 100644 (file)
index 0000000..5d173e6
--- /dev/null
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+    Citation schema (XSD)
+    
+    Entity  : Citation
+    Part    : Local - smk
+    Used for: Nuxeo EP core document type
+    
+    $LastChangedRevision: 860 $
+    $LastChangedDate: 2009-10-14 14:48:05 -0700 (Wed, 14 Oct 2009) $
+-->
+
+<xs:schema 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:ns="http://collectionspace.org/services/citation/local/smk"
+  xmlns="http://collectionspace.org/services/citation/local/smk"
+  targetNamespace="http://collectionspace.org/services/citation/local/smk"
+  version="0.1"
+>
+
+
+       <xs:element name="smkCitationPublicationInfoGroupList" type="smkCitationPublicationInfoGroupList" />
+    
+    <xs:complexType name="smkCitationPublicationInfoGroupList">
+        <xs:sequence>
+            <xs:element name="smkCitationPublicationInfoGroup" type="smkCitationPublicationInfoGroup" minOccurs="0"
+                maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="smkCitationPublicationInfoGroup">
+        <xs:sequence>
+               <xs:element name="smkPublisher" type="xs:string"/>
+            <xs:element name="smkPlace" type="xs:string"/>
+            <xs:element name="smkPublicationDate" type="smkStructuredDateSMKGroup" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element name="smkEdition" type="xs:string"/>
+            <xs:element name="smkPages" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    
+  <xs:element name="smkCitationResourceIdentGroupList" type="smkCitationResourceIdentGroupList" />
+    
+    <xs:complexType name="smkCitationResourceIdentGroupList">
+        <xs:sequence>
+            <xs:element name="smkCitationResourceIdentGroup" type="smkCitationResourceIdentGroup" minOccurs="0"
+                maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="smkCitationResourceIdentGroup">
+        <xs:sequence>
+               <xs:element name="smkResourceIdent" type="xs:string"/>
+            <xs:element name="smkType" type="xs:string"/>            
+            <xs:element name="smkCaptureDate" type="smkStructuredDateSMKGroup" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+        
+    <xs:complexType name="smkStructuredDateSMKGroup">
+        <xs:sequence>          
+            <xs:element name="dateSMKDisplayText" type="xs:string"/>
+            <xs:element name="dateSMKDisplayEngText" type="xs:string"/>
+            <xs:element name="dateSMKDateDay" type="xs:string"/>
+            <xs:element name="dateSMKDateMonth" type="xs:string"/>
+            <xs:element name="dateSMKDateYear" type="xs:string"/>
+            <xs:element name="dateSMKEraSelector" type="xs:string"/>
+            <xs:element name="dateSMKSecondDateDay" type="xs:string"/>
+            <xs:element name="dateSMKSecondDateMonth" type="xs:string"/>
+            <xs:element name="dateSMKSecondDateYear" type="xs:string"/>
+            <xs:element name="dateSMKSecondEraSelector" type="xs:string"/>            
+            <xs:element name="dateSMKThirdDateDay" type="xs:string"/>
+            <xs:element name="dateSMKThirdDateMonth" type="xs:string"/>
+            <xs:element name="dateSMKThirdDateYear" type="xs:string"/>
+            <xs:element name="dateSMKThirdEraSelector" type="xs:string"/>            
+            <xs:element name="dateSMKSegmentSelector" type="xs:string"/>
+            <xs:element name="dateSMKTypeSelector" type="xs:string"/> 
+            <xs:element name="dateSMKLatestScalarValue" type="xs:date"/>
+            <xs:element name="dateSMKEarliestScalarValue" type="xs:date"/> 
+            <xs:element name="scalarValuesComputed" type="xs:boolean"/>                                        
+        </xs:sequence>
+    </xs:complexType>                   
+
+</xs:schema>
+
diff --git a/services/citation/3rdparty/nuxeo-platform-cs-citation/build.xml b/services/citation/3rdparty/nuxeo-platform-cs-citation/build.xml
new file mode 100644 (file)
index 0000000..a6a31ec
--- /dev/null
@@ -0,0 +1,145 @@
+
+<project name="nuxeo-platform-cs-citation" default="package" basedir=".">
+    <description>
+        citation nuxeo document type
+    </description>
+    <!-- set global properties for this build -->
+    <property name="services.trunk" value="../../../.."/>
+    <!-- environment should be declared before reading build.properties -->
+    <property environment="env" />
+    <property file="${services.trunk}/build.properties" />
+    <property name="mvn.opts" value="" />
+    <property name="src" location="src"/>
+    <property name="nuxeo.citation.jar"
+        value="org.collectionspace.services.citation.3rdparty.nuxeo-${cspace.release}.jar"/>
+    <property name="nuxeo.citation.jars.all"
+        value="org.collectionspace.services.citation.3rdparty.nuxeo-*.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="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="install"
+        description="deploy citation doctype in ${jee.server.nuxeo}">
+        <copy file="${basedir}/target/${nuxeo.citation.jar}"
+        todir="${jee.deploy.nuxeo.plugins}"/>
+    </target>
+
+    <target name="undeploy"
+        description="undeploy citation doctype from ${jee.server.nuxeo}">
+        <delete>
+            <fileset dir="${jee.deploy.nuxeo.plugins}">
+                <include name="${nuxeo.citation.jars.all}"/>
+            </fileset>
+        </delete>
+    </target>
+
+    <target name="dist"
+        description="generate distribution for citation doctype" depends="package">
+        <copy todir="${services.trunk}/${dist.deploy.nuxeo.plugins}">
+            <fileset file="${basedir}/target/${nuxeo.citation.jar}"/>
+        </copy>
+    </target>
+
+    <target name="dist_installer"
+       description="Creates an installer distribution for citation doctype" depends="package">
+        <copy todir="${services.trunk}/${dist.installer.services}/citation/nuxeo">
+            <fileset file="${basedir}/target/${nuxeo.citation.jar}"/>
+        </copy>
+    </target>
+
+</project>
+
diff --git a/services/citation/3rdparty/nuxeo-platform-cs-citation/pom.xml b/services/citation/3rdparty/nuxeo-platform-cs-citation/pom.xml
new file mode 100644 (file)
index 0000000..8768fce
--- /dev/null
@@ -0,0 +1,43 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.citation.3rdparty</artifactId>
+        <version>3.2.2-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.citation.3rdparty.nuxeo</artifactId>
+    <name>services.citation.3rdparty.nuxeo</name>
+    <packaging>jar</packaging>
+    <description>
+        Citation Nuxeo Document Type
+    </description>
+    
+    <build>
+               <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+               </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifestFile> src/main/resources/META-INF/MANIFEST.MF </manifestFile>
+                        <manifestEntries>
+                            <Bundle-Version>${eclipseVersion}</Bundle-Version>
+                            <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
+                        </manifestEntries>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    
+</project>
diff --git a/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/META-INF/MANIFEST.MF b/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/META-INF/MANIFEST.MF
new file mode 100644 (file)
index 0000000..9beebb6
--- /dev/null
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0 \r
+Bundle-ManifestVersion: 1 \r
+Bundle-Name: NuxeoCS\r
+Bundle-SymbolicName: org.collectionspace.citation;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.ws,\r
+ org.collectionspace.collectionspace_core\r
+Provide-Package: org.collectionspace.citation\r
+Nuxeo-Component: OSGI-INF/core-types-contrib.xml,\r
+ OSGI-INF/life-cycle-contrib.xml,\r
+ OSGI-INF/ecm-types-contrib.xml,\r
+ OSGI-INF/layouts-contrib.xml\r
+\r
diff --git a/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/core-types-contrib.xml b/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/core-types-contrib.xml
new file mode 100644 (file)
index 0000000..5d36ef0
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.citation.coreTypes">
+    <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
+        <schema name="citationauthorities_common" prefix="citationauthorities_common" src="schemas/citationauthorities_common.xsd"/>
+    </extension>
+  
+    <extension target="org.nuxeo.ecm.core.schema.TypeService" point="schema">
+        <schema name="citations_common" prefix="citations_common" src="schemas/citations_common.xsd"/>
+    </extension>
+  
+    <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
+        <doctype name="Citationauthority" extends="Document">
+            <schema name="common"/>
+            <schema name="dublincore"/>
+            <schema name="collectionspace_core"/>
+            <schema name="citationauthorities_common"/>
+        </doctype>
+    </extension>
+  
+    <extension target="org.nuxeo.ecm.core.schema.TypeService" point="doctype">
+        <doctype name="Citation" extends="Document">
+            <schema name="common"/>
+            <schema name="dublincore"/>
+            <schema name="collectionspace_core"/>
+            <schema name="citations_common"/>
+            <prefetch>
+                citations_common:citationTermGroupList/0/termDisplayName
+                citations_common:refName
+                citations_common:shortIdentifier
+            </prefetch>
+        </doctype>
+    </extension>
+    
+</component>
diff --git a/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/deployment-fragment.xml b/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/deployment-fragment.xml
new file mode 100644 (file)
index 0000000..270abbd
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<fragment>
+
+  <extension target="application#MODULE">
+    <module>
+      <java>${bundle.fileName}</java>
+    </module>
+  </extension>
+  
+</fragment>
diff --git a/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/ecm-types-contrib.xml b/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/ecm-types-contrib.xml
new file mode 100644 (file)
index 0000000..e853ae3
--- /dev/null
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.citation.ecm.types">
+  <extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
+    <type id="Citationauthority" coretype="Citationauthority">
+      <label>org.collectionspace.citationauthority</label>
+      <!--icon>/icons/file.gif</icon-->
+      <default-view>view_documents</default-view>
+
+      <layouts mode="any">
+        <layout>heading</layout>
+        <layout>collectionspace_core</layout>
+        <layout>cscitationauthority</layout>
+      </layouts>        
+    </type>
+
+    <type id="Folder" coretype="Folder">
+      <subtypes>
+        <type>Citationauthority</type>
+      </subtypes>
+    </type>
+    
+    <type id="Workspace" coretype="Workspace">
+      <subtypes>
+        <type>Citationauthority</type>
+      </subtypes>
+    </type>
+
+  </extension>
+  <extension target="org.nuxeo.ecm.platform.types.TypeService" point="types">
+    <type id="Citation" coretype="Citation">
+      <label>org.collectionspace.citation</label>
+      <!--icon>/icons/file.gif</icon-->
+      <default-view>view_documents</default-view>
+
+      <layouts mode="any">
+        <layout>heading</layout>
+        <layout>collectionspace_core</layout>
+        <layout>citation</layout>
+      </layouts>        
+    </type>
+
+    <type id="Folder" coretype="Folder">
+      <subtypes>
+        <type>Citation</type>
+      </subtypes>
+    </type>
+    
+    <type id="Workspace" coretype="Workspace">
+      <subtypes>
+        <type>Citation</type>
+      </subtypes>
+    </type>
+
+  </extension>
+</component>
diff --git a/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/layouts-contrib.xml b/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/layouts-contrib.xml
new file mode 100644 (file)
index 0000000..750ac9d
--- /dev/null
@@ -0,0 +1,155 @@
+<?xml version="1.0"?>
+
+<component name="org.collectionspace.citation.layouts.webapp">
+
+       <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
+    point="layouts">
+
+    <layout name="cscitationauthority">
+      <templates>
+        <template mode="any">/layouts/layout_default_template.xhtml</template>
+      </templates>
+      <rows>
+        <row><widget>displayName</widget></row>
+        <row><widget>shortIdentifier</widget></row>
+        <row><widget>refName</widget></row>
+        <row><widget>vocabType</widget></row>
+      </rows>
+
+      <widget name="displayName" type="text">
+        <labels>
+          <label mode="any">Display Name</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="citationauthorities_common">displayName</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+      
+      <widget name="shortIdentifier" type="text">
+        <labels>
+          <label mode="any">Short Identifier</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="citationauthorities_common">shortIdentifier</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+      
+      <widget name="refName" type="text">
+        <labels>
+          <label mode="any">RefName</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="citationauthorities_common">refName</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+      
+      <widget name="vocabType" type="text">
+        <labels>
+          <label mode="any">Type</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="citationauthorities_common">vocabType</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+    </layout>
+  </extension>
+
+  <extension target="org.nuxeo.ecm.platform.forms.layout.WebLayoutManager"
+    point="layouts">
+
+               <layout name="citation">
+      <templates>
+        <template mode="any">/layouts/layout_default_template.xhtml</template>
+      </templates>
+      <rows>
+        <row><widget>displayName</widget></row>
+        <row><widget>shortIdentifier</widget></row>
+        <row><widget>refName</widget></row>
+        <row><widget>inAuthority</widget></row>        
+        <row><widget>termStatus</widget></row>
+      </rows>
+
+      <widget name="displayName" type="text">
+        <labels>
+          <label mode="any">displayName</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="citations_common">displayName</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+      
+      <widget name="shortIdentifier" type="text">
+        <labels>
+          <label mode="any">Short Identifier</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="citations_common">shortIdentifier</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+      
+      <widget name="refName" type="text">
+        <labels>
+          <label mode="any">refName</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="citations_common">refName</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+      
+      <widget name="inAuthority" type="text">
+        <labels>
+          <label mode="any">inAuthority (CitationAuthority)</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="citations_common">inAuthority</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>    
+
+      <widget name="termStatus" type="text">
+        <labels>
+          <label mode="any">termStatus</label>
+        </labels>
+        <translated>true</translated>
+        <fields>
+          <field schema="citations_common">termStatus</field>
+        </fields>
+        <properties widgetMode="edit">
+          <property name="styleClass">dataInputText</property>
+        </properties>
+      </widget>
+      
+    </layout>
+  </extension>
+</component>
diff --git a/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/life-cycle-contrib.xml b/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/OSGI-INF/life-cycle-contrib.xml
new file mode 100644 (file)
index 0000000..f9a212a
--- /dev/null
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<component name="org.collectionspace.ecm.platform.citation.LifeCycleManagerExtensions">
+
+  <extension target="org.nuxeo.ecm.core.lifecycle.LifeCycleService"
+             point="types">
+    <types>
+      <type name="Citationauthority">${Lifecycle}</type>
+      <type name="Citation">${Lifecycle}</type>
+    </types>
+  </extension>
+
+</component>
diff --git a/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/schemas/citationauthorities_common.xsd b/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/schemas/citationauthorities_common.xsd
new file mode 100644 (file)
index 0000000..3e72faf
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+    CitationAuthority schema (XSD)
+    
+    Entity  : CitationAuthority
+    Part    : Common
+    Used for: Nuxeo EP core document type
+    
+    $LastChangedRevision: 928 $
+    $LastChangedDate: 2009-11-10 12:25:58 -0800 (Tue, 10 Nov 2009) $
+-->
+
+<xs:schema 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:ns="http://collectionspace.org/services/citation"
+  xmlns="http://collectionspace.org/services/citation"
+  targetNamespace="http://collectionspace.org/services/citation"
+  version="0.1"
+>
+
+<!-- Flattened version of jaxb schema for nuxeo -->
+<!-- See http://wiki.collectionspace.org/display/collectionspace/Citation+Service+Home -->    
+
+               <!--  CitationAuthority Information Group -->
+               <xs:element name="displayName" type="xs:string"/>
+               <xs:element name="shortIdentifier" type="xs:string"/>
+               <xs:element name="refName" type="xs:string"/>
+               <xs:element name="vocabType" type="xs:string"/>
+               <xs:element name="source" type="xs:string"/>
+               <xs:element name="description" type="xs:string"/>
+
+</xs:schema>
+
diff --git a/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/schemas/citations_common.xsd b/services/citation/3rdparty/nuxeo-platform-cs-citation/src/main/resources/schemas/citations_common.xsd
new file mode 100644 (file)
index 0000000..476c312
--- /dev/null
@@ -0,0 +1,169 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+    Citation schema (XSD)
+    
+    Entity  : Citation
+    Part    : Common
+    Used for: Nuxeo EP core document type
+    
+    $LastChangedRevision: 860 $
+    $LastChangedDate: 2009-10-14 14:48:05 -0700 (Wed, 14 Oct 2009) $
+-->
+
+<xs:schema 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:ns="http://collectionspace.org/services/citation"
+    xmlns="http://collectionspace.org/services/citation"
+    targetNamespace="http://collectionspace.org/services/citation"
+    version="0.1"
+>
+<!-- See http://wiki.collectionspace.org/display/collectionspace/Citation+Service+Home -->    
+
+    <!--  Citation Information Group -->
+    <!--  inAuthority is the csid of the owning CitationAuthority -->
+    <xs:element name="inAuthority" type="xs:string" />
+    <xs:element name="shortIdentifier" type="xs:string"/>
+    <xs:element name="refName" type="xs:string"/>
+
+    <!-- Term Information repeatable group -->
+    <xs:element name="citationTermGroupList" type="citationTermGroupList"/>
+    
+    <xs:complexType name="citationTermGroupList">
+        <xs:sequence>
+            <xs:element name="citationTermGroup" type="citationTermGroup" minOccurs="0"
+                        maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="citationTermGroup">
+        <xs:sequence>
+            <!-- Common across all authority item terms -->
+            <xs:element name="termDisplayName" type="xs:string"/>
+            <xs:element name="termName" type="xs:string"/>
+            <xs:element name="termType" type="xs:string"/>
+            <xs:element name="termStatus" type="xs:string"/>
+            <xs:element name="termQualifier" type="xs:string"/>
+            <xs:element name="termLanguage" type="xs:string"/>
+            <xs:element name="termPrefForLang" type="xs:boolean"/>
+            <xs:element name="termSource" type="xs:string"/>
+            <xs:element name="termSourceDetail" type="xs:string"/>
+            <xs:element name="termSourceID" type="xs:string"/>
+            <xs:element name="termSourceNote" type="xs:string"/>
+
+            <xs:element name="termFullCitation" type="xs:string"/>
+            <xs:element name="termTitle" type="xs:string"/>
+            <xs:element name="termSubTitle" type="xs:string"/>
+            <xs:element name="termSectionTitle" type="xs:string"/>
+            <xs:element name="termVolume" type="xs:string"/>
+            <xs:element name="termIssue" type="xs:string"/>                        
+        </xs:sequence>
+    </xs:complexType>
+    
+    <!-- Before (re)using this generic complex type in any record type -->
+    <!-- other than CollectionObject, be sure to verify that Nuxeo handles -->
+    <!-- that correctly in its table creation/row linking. -->
+    <xs:complexType name="structuredDateGroup">
+        <xs:sequence>
+            <xs:element name="dateDisplayDate" type="xs:string"/>
+            <xs:element name="dateAssociation" type="xs:string"/>
+            <xs:element name="dateEarliestSingleYear" type="xs:integer"/>
+            <xs:element name="dateEarliestSingleMonth" type="xs:integer"/>
+            <xs:element name="dateEarliestSingleDay" type="xs:integer"/>
+            <xs:element name="dateEarliestSingleEra" type="xs:string"/>
+            <xs:element name="dateEarliestSingleCertainty" type="xs:string"/>
+            <xs:element name="dateEarliestSingleQualifier" type="xs:string"/>
+            <xs:element name="dateEarliestSingleQualifierValue" type="xs:integer"/>
+            <xs:element name="dateEarliestSingleQualifierUnit" type="xs:string"/>
+            <xs:element name="dateLatestYear" type="xs:integer"/>
+            <xs:element name="dateLatestMonth" type="xs:integer"/>
+            <xs:element name="dateLatestDay" type="xs:integer"/>
+            <xs:element name="dateLatestEra" type="xs:string"/>
+            <xs:element name="dateLatestCertainty" type="xs:string"/>
+            <xs:element name="dateLatestQualifier" type="xs:string"/>
+            <xs:element name="dateLatestQualifierValue" type="xs:integer"/>
+            <xs:element name="dateLatestQualifierUnit" type="xs:string"/>
+            <xs:element name="datePeriod" type="xs:string"/>
+            <xs:element name="dateNote" type="xs:string"/>
+            <xs:element name="dateEarliestScalarValue" type="xs:date"/>
+            <xs:element name="dateLatestScalarValue" type="xs:date"/>
+            <xs:element name="scalarValuesComputed" type="xs:boolean"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:element name="citationPublicationInfoGroupList" type="citationPublicationInfoGroupList" />
+    
+    <xs:complexType name="citationPublicationInfoGroupList">
+        <xs:sequence>
+            <xs:element name="citationPublicationInfoGroup" type="citationPublicationInfoGroup" minOccurs="0"
+                maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="citationPublicationInfoGroup">
+        <xs:sequence>
+               <xs:element name="publisher" type="xs:string"/>
+            <xs:element name="place" type="xs:string"/>
+            <xs:element name="publicationDate" type="structuredDateGroup" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element name="edition" type="xs:string"/>
+            <xs:element name="pages" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    
+    
+    <xs:element name="citationAgentInfoGroupList" type="citationAgentInfoGroupList" />
+    
+    <xs:complexType name="citationAgentInfoGroupList">
+        <xs:sequence>
+            <xs:element name="citationAgentInfoGroup" type="citationAgentInfoGroup" minOccurs="0"
+                maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="citationAgentInfoGroup">
+        <xs:sequence>
+               <xs:element name="agent" type="xs:string"/>
+            <xs:element name="role" type="xs:string"/>            
+            <xs:element name="note" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
+            
+    <xs:element name="citationResourceIdentGroupList" type="citationResourceIdentGroupList" />
+    
+    <xs:complexType name="citationResourceIdentGroupList">
+        <xs:sequence>
+            <xs:element name="citationResourceIdentGroup" type="citationResourceIdentGroup" minOccurs="0"
+                maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="citationResourceIdentGroup">
+        <xs:sequence>
+               <xs:element name="resourceIdent" type="xs:string"/>
+            <xs:element name="type" type="xs:string"/>            
+            <xs:element name="captureDate" type="structuredDateGroup" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    
+    <xs:element name="citationRelatedTermsGroupList" type="citationRelatedTermsGroupList" />
+    
+    <xs:complexType name="citationRelatedTermsGroupList">
+        <xs:sequence>
+            <xs:element name="citationRelatedTermsGroup" type="citationRelatedTermsGroup" minOccurs="0"
+                maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="citationRelatedTermsGroup">
+        <xs:sequence>
+               <xs:element name="relatedTerm" type="xs:string"/>
+            <xs:element name="relationType" type="xs:string"/>                        
+        </xs:sequence>
+    </xs:complexType>    
+    
+    <xs:element name="citationsNotes" type="xs:string"/>        
+
+</xs:schema>
+
diff --git a/services/citation/3rdparty/pom.xml b/services/citation/3rdparty/pom.xml
new file mode 100644 (file)
index 0000000..8210f5e
--- /dev/null
@@ -0,0 +1,31 @@
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.citation</artifactId>
+        <version>3.2.2-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.citation.3rdparty</artifactId>
+    <name>services.citation.3rdparty</name>
+    <packaging>pom</packaging>
+    <description>
+        3rd party build for citation service
+    </description>
+
+       <properties>
+           <ServiceName>citation</ServiceName>
+           <NuxeoDocTypeName>Citation</NuxeoDocTypeName>  
+           <CommonSchemaName>citations_common</CommonSchemaName>
+           <TenantPrefix>Tenant</TenantPrefix>
+       </properties>
+
+    <modules>
+        <module>nuxeo-platform-cs-citation</module>
+        <module>nuxeo-platform-cs-citation-smk</module>     
+    </modules>
+</project>
diff --git a/services/citation/build.xml b/services/citation/build.xml
new file mode 100644 (file)
index 0000000..c64e939
--- /dev/null
@@ -0,0 +1,132 @@
+
+<project name="citation" default="package" basedir=".">
+    <description>
+        citation service
+    </description>
+  <!-- set global properties for this build -->
+    <property name="services.trunk" value="../.."/>
+        <!-- enviornment should be declared before reading build.properties -->
+    <property environment="env" />
+    <property file="${services.trunk}/build.properties" />
+    <property name="mvn.opts" value="" />
+    <property name="src" location="src"/>
+
+    <condition property="osfamily-unix">
+        <os family="unix" />
+    </condition>
+    <condition property="osfamily-windows">
+        <os family="windows" />
+    </condition>
+
+    <target name="package" depends="package-unix,package-windows"
+  description="Package CollectionSpace Services" />
+  
+    <target name="package-unix" if="osfamily-unix">
+        <exec executable="mvn" failonerror="true">
+            <arg value="package" />
+            <arg value="-Dmaven.test.skip=true" />
+            <arg value="-f" />
+            <arg value="${basedir}/pom.xml" />
+            <arg value="-N" />
+            <arg value="${mvn.opts}" />
+        </exec>
+    </target>
+    
+    <target name="package-windows" if="osfamily-windows">
+        <exec executable="cmd" failonerror="true">
+            <arg value="/c" />
+            <arg value="mvn.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="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="install"
+        description="deploy citation service">
+        <ant antfile="3rdparty/build.xml" target="deploy" inheritall="false"/>
+    </target>
+
+    <target name="undeploy"
+        description="undeploy citation service">
+        <ant antfile="3rdparty/build.xml" target="undeploy" inheritall="false"/>
+    </target>
+
+    <target name="dist" depends="package"
+        description="distribute citation service">
+        <ant antfile="3rdparty/build.xml" target="dist" inheritall="false"/>
+    </target>
+
+    <target name="dist_installer" depends="package"
+        description="distribute citation service">        
+        <!-- copy install scripts, etc. -->
+        <copy todir="${services.trunk}/${dist.installer.services}/citation">
+            <fileset dir="${basedir}/installer/"/>
+        </copy>
+        <ant antfile="3rdparty/build.xml" target="dist_installer" inheritall="false"/>
+    </target>
+
+</project>
diff --git a/services/citation/client/pom.xml b/services/citation/client/pom.xml
new file mode 100644 (file)
index 0000000..aa731d5
--- /dev/null
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.citation</artifactId>
+        <version>3.2.2-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.citation.client</artifactId>
+    <name>services.citation.client</name>
+    
+    <dependencies>
+        <!-- keep slf4j dependencies on the top -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+        </dependency>
+        <!-- CollectionSpace dependencies -->
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>        
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>        
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.common</artifactId>
+            <optional>true</optional>
+            <version>${project.version}</version>
+        </dependency>        
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.citation.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.client</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.contact.client</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- External dependencies -->
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+        </dependency>
+        <!-- RESTEasy -->
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxrs</artifactId>
+            <!-- filter out unwanted jars -->
+            <exclusions>
+                <exclusion>
+                    <groupId>tjws</groupId>
+                    <artifactId>webserver</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxb-provider</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-multipart-provider</artifactId>
+        </dependency>
+        
+        <dependency>
+            <groupId>commons-httpclient</groupId>
+            <artifactId>commons-httpclient</artifactId>
+            <version>3.1</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <finalName>collectionspace-services-citation-client</finalName>
+        <plugins>
+        </plugins>
+    </build>
+</project>
+
diff --git a/services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityClient.java b/services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityClient.java
new file mode 100644 (file)
index 0000000..e1cb8a4
--- /dev/null
@@ -0,0 +1,79 @@
+/**
+ * CitationAuthorityClient.java
+ *
+ * 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, 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
+ */
+package org.collectionspace.services.client;
+
+import org.collectionspace.services.citation.CitationsCommon;
+
+/**
+ * The Class CitationAuthorityClient.
+ */
+public class CitationAuthorityClient extends AuthorityWithContactsClientImpl<CitationsCommon, CitationAuthorityProxy> {
+
+    public static final String SERVICE_NAME = "citationauthorities";
+    public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
+    public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
+    public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
+    public static final String TERM_INFO_GROUP_XPATH_BASE = "citationTermGroupList";
+    //
+    // Subitem constants
+    //
+    public static final String SERVICE_ITEM_NAME = "citations";
+    public static final String SERVICE_ITEM_PAYLOAD_NAME = SERVICE_ITEM_NAME;
+    //
+    // Payload Part/Schema part names
+    //
+    public static final String SERVICE_COMMON_PART_NAME = SERVICE_NAME
+            + PART_LABEL_SEPARATOR + PART_COMMON_LABEL;
+    public static final String SERVICE_ITEM_COMMON_PART_NAME = SERVICE_ITEM_NAME
+            + PART_LABEL_SEPARATOR + PART_COMMON_LABEL;
+
+    @Override
+    public String getServiceName() {
+        return SERVICE_NAME;
+    }
+
+    @Override
+    public String getServicePathComponent() {
+        return SERVICE_PATH_COMPONENT;
+    }
+
+    @Override
+    public String getItemCommonPartName() {
+        return getCommonPartName(SERVICE_ITEM_PAYLOAD_NAME);
+    }
+
+    @Deprecated // Use getItemCommonPartName() instead
+    public String getCommonPartItemName() {
+        return getCommonPartName(SERVICE_ITEM_PAYLOAD_NAME);
+    }
+
+    @Override
+    public Class<CitationAuthorityProxy> getProxyClass() {
+        return CitationAuthorityProxy.class;
+    }
+
+    @Override
+    public String getInAuthority(CitationsCommon item) {
+        return item.getInAuthority();
+    }
+
+    @Override
+    public void setInAuthority(CitationsCommon item, String inAuthorityCsid) {
+        item.setInAuthority(inAuthorityCsid);
+    }
+}
diff --git a/services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityClientUtils.java b/services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityClientUtils.java
new file mode 100644 (file)
index 0000000..c2eb57e
--- /dev/null
@@ -0,0 +1,420 @@
+/**    
+ * CitationAuthorityClientUtils.java
+ *
+ * {Purpose of This Class}
+ *
+ * {Other Notes Relating to This Class (Optional)}
+ *
+ * $LastChangedBy: $
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ *
+ * 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 {Contributing Institution}
+ *
+ * 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
+ */
+package org.collectionspace.services.client;
+
+import java.util.*;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.CitationJAXBSchema;
+import org.collectionspace.services.client.test.ServiceRequestType;
+import org.collectionspace.services.common.api.Tools;
+import org.collectionspace.services.citation.CitationTermGroup;
+import org.collectionspace.services.citation.CitationTermGroupList;
+import org.collectionspace.services.citation.CitationsCommon;
+import org.collectionspace.services.citation.CitationauthoritiesCommon;
+import org.jboss.resteasy.client.ClientResponse;
+//import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.collectionspace.services.citation.StructuredDateGroup;
+
+/**
+ * The Class CitationAuthorityClientUtils.
+ */
+public class CitationAuthorityClientUtils {
+    
+    /** The Constant logger. */
+    private static final Logger logger =
+        LoggerFactory.getLogger(CitationAuthorityClientUtils.class);
+       private static final ServiceRequestType READ_REQ = ServiceRequestType.READ;
+
+    /**
+     * @param csid the id of the CitationAuthority
+     * @param client if null, creates a new client
+     * @return
+     */
+    public static String getAuthorityRefName(String csid, CitationAuthorityClient client){
+       if (client == null) {
+               client = new CitationAuthorityClient();
+       }
+        ClientResponse<String> res = client.read(csid);
+        try {
+               int statusCode = res.getStatus();
+               if(!READ_REQ.isValidStatusCode(statusCode)
+                       ||(statusCode != CollectionSpaceClientUtils.STATUS_OK)) {
+                       throw new RuntimeException("Invalid status code returned: "+statusCode);
+               }
+               //FIXME: remove the following try catch once Aron fixes signatures
+               try {
+                   PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+                   CitationauthoritiesCommon citationAuthority = 
+                       (CitationauthoritiesCommon) CollectionSpaceClientUtils.extractPart(input,
+                           client.getCommonPartName(), CitationauthoritiesCommon.class);
+                       if(citationAuthority == null) {
+                               throw new RuntimeException("Null citationAuthority returned from service.");
+                       }
+                   return citationAuthority.getRefName();
+               } catch (Exception e) {
+                   throw new RuntimeException(e);
+               }
+        } finally {
+               res.releaseConnection();
+        }
+    }
+
+    /**
+     * @param csid the id of the CitationAuthority
+     * @param client if null, creates a new client
+     * @return
+     */
+    public static String getCitationRefName(String inAuthority, String csid, CitationAuthorityClient client){
+       if ( client == null) {
+               client = new CitationAuthorityClient();
+       }
+        ClientResponse<String> res = client.readItem(inAuthority, csid);
+        try {
+               int statusCode = res.getStatus();
+               if(!READ_REQ.isValidStatusCode(statusCode)
+                               ||(statusCode != CollectionSpaceClientUtils.STATUS_OK)) {
+                       throw new RuntimeException("Invalid status code returned: "+statusCode);
+               }
+               //FIXME: remove the following try catch once Aron fixes signatures
+               try {
+                   PoxPayloadIn input = new PoxPayloadIn(res.getEntity());
+                   CitationsCommon citation = 
+                       (CitationsCommon) CollectionSpaceClientUtils.extractPart(input,
+                           client.getItemCommonPartName(), CitationsCommon.class);
+                       if (citation == null) {
+                               throw new RuntimeException("Null citation returned from service.");
+                       }
+                   return citation.getRefName();
+               } catch (Exception e) {
+                   throw new RuntimeException(e);
+               }
+        } finally {
+               res.releaseConnection();
+        }
+    }
+
+    /**
+     * Creates the citation authority instance.
+     *
+     * @param displayName the display name
+     * @param shortIdentifier the short Id 
+     * @param headerLabel the header label
+     * @return the multipart output
+     */
+    public static PoxPayloadOut createCitationAuthorityInstance(
+               String displayName, String shortIdentifier, String headerLabel ) {
+        CitationauthoritiesCommon citationAuthority = new CitationauthoritiesCommon();
+        citationAuthority.setDisplayName(displayName);
+        citationAuthority.setShortIdentifier(shortIdentifier);
+        //String refName = createCitationAuthRefName(shortIdentifier, displayName);
+        //citationAuthority.setRefName(refName);
+        citationAuthority.setVocabType("CitationAuthority");
+        PoxPayloadOut multipart = new PoxPayloadOut(CitationAuthorityClient.SERVICE_PAYLOAD_NAME);
+        PayloadOutputPart commonPart = multipart.addPart(citationAuthority, MediaType.APPLICATION_XML_TYPE);
+        commonPart.setLabel(headerLabel);
+
+        if(logger.isDebugEnabled()){
+               logger.debug("to be created, citationAuthority common ", 
+                                       citationAuthority, CitationauthoritiesCommon.class);
+        }
+
+        return multipart;
+    }
+
+    /**
+     * Creates a citation instance.
+     *
+     * @param inAuthority the owning authority
+     * @param citationAuthRefName the owning Authority ref name
+     * @param citationInfo the citation info
+     * @param headerLabel the header label
+     * @return the multipart output
+     */
+    public static PoxPayloadOut createCitationInstance(String inAuthority,
+               String citationAuthRefName,
+               Map<String, String> citationInfo,
+                List<CitationTermGroup> terms,
+               String headerLabel){
+        if (terms == null || terms.isEmpty()) {
+            terms = getTermGroupInstance(getGeneratedIdentifier());
+        }
+        final Map<String, List<String>> EMPTY_CITATION_REPEATABLES_INFO =
+                new HashMap<String, List<String>>();
+        return createCitationInstance(inAuthority, null /*citationAuthRefName*/,
+                citationInfo, terms, EMPTY_CITATION_REPEATABLES_INFO, headerLabel);
+    }
+
+    /**
+     * Creates a citation instance.
+     *
+     * @param inAuthority the owning authority
+     * @param citationAuthRefName the owning Authority ref name
+     * @param citationInfo the citation info
+     * @param terms a list of Citation terms
+     * @param citationRepeatablesInfo names and values of repeatable scalar fields in the Citation record
+     * @param headerLabel the header label
+     * @return the multipart output
+     */
+    public static PoxPayloadOut createCitationInstance(String inAuthority, 
+               String citationAuthRefName, Map<String, String> citationInfo,
+                List<CitationTermGroup> terms,
+                Map<String, List<String>> citationRepeatablesInfo, String headerLabel){
+        CitationsCommon citation = new CitationsCommon();
+        citation.setInAuthority(inAuthority);
+       String shortId = citationInfo.get(CitationJAXBSchema.SHORT_IDENTIFIER);
+       if (shortId == null || shortId.isEmpty()) {
+               throw new IllegalArgumentException("shortIdentifier cannot be null or empty");
+       }       
+       citation.setShortIdentifier(shortId);
+       
+       String value;
+        List<String> values = null;
+        
+        // Set values in the Term Information Group
+        CitationTermGroupList termList = new CitationTermGroupList();
+        if (terms == null || terms.isEmpty()) {
+            terms = getTermGroupInstance(getGeneratedIdentifier());
+        }
+        termList.getCitationTermGroup().addAll(terms); 
+        citation.setCitationTermGroupList(termList);               
+        
+        PoxPayloadOut multipart = new PoxPayloadOut(CitationAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+        PayloadOutputPart commonPart = multipart.addPart(citation,
+            MediaType.APPLICATION_XML_TYPE);
+        commonPart.setLabel(headerLabel);
+
+        if(logger.isDebugEnabled()){
+               logger.debug("to be created, citation common ", citation, CitationsCommon.class);
+        }
+
+        return multipart;
+    }
+    
+    /**
+     * Creates the item in authority.
+     *
+     * @param vcsid the vcsid
+     * @param citationAuthorityRefName the citation authority ref name
+     * @param citationMap the citation map. CitationJAXBSchema.SHORT_IDENTIFIER is REQUIRED.
+     * @param client the client
+     * @return the string
+     */
+    public static String createItemInAuthority(String vcsid, 
+               String citationAuthorityRefName, Map<String,String> citationMap,
+                List<CitationTermGroup> terms, Map<String, List<String>> citationRepeatablesMap,
+                CitationAuthorityClient client ) {
+       // Expected status code: 201 Created
+       int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();
+       // Type of service request being tested
+       ServiceRequestType REQUEST_TYPE = ServiceRequestType.CREATE;
+        
+        String displayName = "";
+        if (terms !=null && terms.size() > 0) {
+            displayName = terms.get(0).getTermDisplayName();
+        }
+       
+       if(logger.isDebugEnabled()){
+               logger.debug("Creating item with display name: \"" + displayName
+                               +"\" in citationAuthority: \"" + vcsid +"\"");
+       }
+       PoxPayloadOut multipart = 
+               createCitationInstance(vcsid, null /*citationAuthorityRefName*/,
+                       citationMap, terms, citationRepeatablesMap, client.getItemCommonPartName());
+       
+       String result = null;
+       ClientResponse<Response> res = client.createItem(vcsid, multipart);
+       try {
+               int statusCode = res.getStatus();
+       
+               if(!REQUEST_TYPE.isValidStatusCode(statusCode)) {
+                       throw new RuntimeException("Could not create Item: \""+citationMap.get(CitationJAXBSchema.SHORT_IDENTIFIER)
+                                       +"\" in citationAuthority: \"" + vcsid //citationAuthorityRefName
+                                       +"\" "+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+               }
+               if(statusCode != EXPECTED_STATUS_CODE) {
+                       throw new RuntimeException("Unexpected Status when creating Item: \""+citationMap.get(CitationJAXBSchema.SHORT_IDENTIFIER)
+                                       +"\" in citationAuthority: \"" + vcsid /*citationAuthorityRefName*/ +"\", Status:"+ statusCode);
+               }
+       
+               result = extractId(res);
+       } finally {
+               res.releaseConnection();
+       }
+       
+       return result;
+    }
+
+    /**
+     * Creates the citationAuthority ref name.
+     *
+     * @param shortId the citationAuthority shortIdentifier
+     * @param displaySuffix displayName to be appended, if non-null
+     * @return the string
+     */
+    /*
+    public static String createCitationAuthRefName(String shortId, String displaySuffix) {
+       String refName = "urn:cspace:org.collectionspace.demo:citationauthority:name("
+                       +shortId+")";
+       if(displaySuffix!=null&&!displaySuffix.isEmpty())
+               refName += "'"+displaySuffix+"'";
+       return refName;
+    }
+    */
+
+    /**
+     * Creates the citation ref name.
+     *
+     * @param citationAuthRefName the citation auth ref name
+     * @param shortId the citation shortIdentifier
+     * @param displaySuffix displayName to be appended, if non-null
+     * @return the string
+     */
+    /*
+    public static String createCitationRefName(
+                                               String citationAuthRefName, String shortId, String displaySuffix) {
+       String refName = citationAuthRefName+":citation:name("+shortId+")";
+       if(displaySuffix!=null&&!displaySuffix.isEmpty())
+               refName += "'"+displaySuffix+"'";
+       return refName;
+    }
+    */
+
+    /**
+     * Extract id.
+     *
+     * @param res the res
+     * @return the string
+     */
+    public static String extractId(ClientResponse<Response> res) {
+        MultivaluedMap<String, Object> mvm = res.getMetadata();
+        // FIXME: This may throw an NPE if the Location: header isn't present
+        String uri = (String) ((ArrayList<Object>) mvm.get("Location")).get(0);
+        if(logger.isDebugEnabled()){
+               logger.debug("extractId:uri=" + uri);
+        }
+        String[] segments = uri.split("/");
+        String id = segments[segments.length - 1];
+        if(logger.isDebugEnabled()){
+               logger.debug("id=" + id);
+        }
+        return id;
+    }
+    
+    /**
+     * Returns an error message indicating that the status code returned by a
+     * specific call to a service does not fall within a set of valid status
+     * codes for that service.
+     *
+     * @param serviceRequestType  A type of service request (e.g. CREATE, DELETE).
+     *
+     * @param statusCode  The invalid status code that was returned in the response,
+     *                    from submitting that type of request to the service.
+     *
+     * @return An error message.
+     */
+    public static String invalidStatusCodeMessage(ServiceRequestType requestType, int statusCode) {
+        return "Status code '" + statusCode + "' in response is NOT within the expected set: " +
+                requestType.validStatusCodesAsString();
+    }
+
+
+    
+    /**
+     * Produces a default displayName from the basic name and dates fields.
+     * @see CitationDocumentModelHandler.prepareDefaultDisplayName() which
+     * duplicates this logic, until we define a service-general utils package
+     * that is neither client nor service specific.
+     * @param foreName 
+     * @param middleName
+     * @param surName
+     * @param birthDate
+     * @param deathDate
+     * @return display name
+     */
+    public static String prepareDefaultDisplayName(
+               String foreName, String middleName, String surName, 
+            String birthDate, String deathDate) {
+       StringBuilder newStr = new StringBuilder();
+               final String sep = " ";
+               final String dateSep = "-";
+               List<String> nameStrings = 
+                       Arrays.asList(foreName, middleName, surName);
+               boolean firstAdded = false;
+       for(String partStr : nameStrings ){
+                       if(null != partStr ) {
+                               if(firstAdded) {
+                                       newStr.append(sep);
+                               }
+                               newStr.append(partStr);
+                               firstAdded = true;
+                       }
+       }
+       // Now we add the dates. In theory could have dates with no name, but that is their problem.
+       boolean foundBirth = false;
+        if(null != birthDate) {
+         if(firstAdded) {
+             newStr.append(sep);
+         }
+         newStr.append(birthDate);
+                 newStr.append(dateSep);     // Put this in whether there is a death date or not
+         foundBirth = true;
+        }
+        if(null != deathDate) {
+         if(!foundBirth) {
+             if(firstAdded) {
+                 newStr.append(sep);
+             }
+             newStr.append(dateSep);
+         }
+         newStr.append(deathDate);
+        }
+               return newStr.toString();
+    }
+    
+    public static List<CitationTermGroup> getTermGroupInstance(String identifier) {
+        if (Tools.isBlank(identifier)) {
+            identifier = getGeneratedIdentifier();
+        }
+        List<CitationTermGroup> terms = new ArrayList<CitationTermGroup>();
+        CitationTermGroup term = new CitationTermGroup();
+        term.setTermDisplayName(identifier);
+        term.setTermName(identifier);
+        terms.add(term);
+        return terms;
+    }
+    
+    private static String getGeneratedIdentifier() {
+        return "id" + new Date().getTime(); 
+   }
+
+}
diff --git a/services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityProxy.java b/services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityProxy.java
new file mode 100644 (file)
index 0000000..015830d
--- /dev/null
@@ -0,0 +1,15 @@
+package org.collectionspace.services.client;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+/**
+ * @version $Revision:$
+ */
+@Path(CitationAuthorityClient.SERVICE_PATH + "/")
+@Produces({"application/xml"})
+@Consumes({"application/xml"})
+public interface CitationAuthorityProxy extends AuthorityWithContactsProxy {
+
+}
diff --git a/services/citation/installer/build.xml b/services/citation/installer/build.xml
new file mode 100644 (file)
index 0000000..e823273
--- /dev/null
@@ -0,0 +1,61 @@
+
+<project name="citation" default="package" basedir=".">
+    <description>
+        citation service
+    </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"/>
+
+    <condition property="osfamily-unix">
+        <os family="unix" />
+    </condition>
+    <condition property="osfamily-windows">
+        <os family="windows" />
+    </condition>
+    
+    <target name="install" description="">
+        <exec executable="echo">
+                       <arg value="Installer: Executing citation Service's &apos;install&apos; target." />
+                               </exec>
+                               <!-- Copy the Nuxeo DocType jar files to the Nuxeo app server domain -->
+        <copy todir="${jee.deploy.nuxeo.plugins}">
+            <fileset file="nuxeo/*.jar"/>
+        </copy>                                
+    </target>    
+
+    <target name="config" description="" depends="install">
+        <exec executable="echo">
+                       <arg value="Installer: Executing Citation Service's &apos;config&apos; target." />
+                               </exec>
+    </target>
+    
+    <target name="predeploy" description="" depends="config">
+        <exec executable="echo">
+                       <arg value="Installer: Executing Citation Service's &apos;predeploy&apos; target." />
+                               </exec>
+    </target>    
+    
+    <target name="deploy" description="">
+        <exec executable="echo">
+                       <arg value="Installer: Executing Citation Service's &apos;deploy&apos; target." />
+                               </exec>
+    </target>
+    
+    <target name="postdeploy">
+        <exec executable="echo">
+                       <arg value="Installer: Executing installer's &apos;postdeploy&apos; target for the Citation Service." />
+                               </exec>         
+        <exec executable="echo">
+                       <arg value="Importing necessary citationauthorities." />
+                               </exec>                         
+        <java jar="./postdeploy/collectionspace-services-citation-importer-jar-with-dependencies.jar"
+               fork="true"
+               failonerror="true">
+                               </java> 
+    </target>
+    
+
+</project>
diff --git a/services/citation/jaxb/pom.xml b/services/citation/jaxb/pom.xml
new file mode 100644 (file)
index 0000000..02b67aa
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.citation</artifactId>
+        <version>3.2.2-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.citation.jaxb</artifactId>
+    <name>services.citation.jaxb</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>        
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.authority.jaxb</artifactId>
+            <optional>true</optional>
+            <version>${project.version}</version>
+        </dependency>    
+    </dependencies>
+
+    <build>
+        <finalName>collectionspace-services-citation-jaxb</finalName>
+        <defaultGoal>install</defaultGoal>
+        <plugins>
+            <plugin>
+                <groupId>org.jvnet.jaxb2.maven2</groupId>
+                <artifactId>maven-jaxb2-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+</project>
+
diff --git a/services/citation/jaxb/src/main/java/org/collectionspace/services/CitationJAXBSchema.java b/services/citation/jaxb/src/main/java/org/collectionspace/services/CitationJAXBSchema.java
new file mode 100644 (file)
index 0000000..fb5453b
--- /dev/null
@@ -0,0 +1,14 @@
+/**\r
+ * \r
+ */\r
+package org.collectionspace.services;\r
+import org.collectionspace.services.common.vocabulary.AuthorityItemJAXBSchema;\r
+\r
+/**\r
+ * @author pschmitz\r
+ *\r
+ */\r
+public interface CitationJAXBSchema extends AuthorityItemJAXBSchema {\r
+       final static String CITATIONS_COMMON = "citations_common";      \r
+}\r
+\r
diff --git a/services/citation/jaxb/src/main/resources/citation_common.xsd b/services/citation/jaxb/src/main/resources/citation_common.xsd
new file mode 100644 (file)
index 0000000..0fd3cf6
--- /dev/null
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+    Citation schema (XSD)
+
+    Entity  : Citation
+    Part    : Common
+    Used for: JAXB binding between XML and Java objects
+
+    $LastChangedRevision: $
+    $LastChangedDate: $
+-->
+
+<xs:schema 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    jaxb:version="1.0" elementFormDefault="unqualified"
+    xmlns:ns="http://collectionspace.org/services/citation"
+    xmlns="http://collectionspace.org/services/citation"
+    targetNamespace="http://collectionspace.org/services/citation"
+    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/Citation+Service+Home -->    
+    
+    <!-- Citation -->
+    <xs:element name="citations_common">
+        <xs:complexType>
+            <xs:sequence>
+                <!--  Common identifier -->
+                <xs:element name="csid" type="xs:string" />
+                
+                <!--  Citation Information Group -->
+                <xs:element name="inAuthority" type="xs:string" />
+                <xs:element name="shortIdentifier" type="xs:string"/>
+                <xs:element name="refName" type="xs:string" />
+                
+                <!-- Term Information repeatable group -->
+                <xs:element name="citationTermGroupList" type="citationTermGroupList"/>
+                
+                <xs:element name="citationPublicationInfoGroupList" type="citationPublicationInfoGroupList" />
+                <xs:element name="citationAgentInfoGroupList" type="citationAgentInfoGroupList" />                    
+                           <xs:element name="citationResourceIdentGroupList" type="citationResourceIdentGroupList" />
+                           <xs:element name="citationRelatedTermsGroupList" type="citationRelatedTermsGroupList" />
+                           <xs:element name="citationsNotes" type="xs:string"/>
+
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+    <xs:complexType name="citationTermGroupList">
+        <xs:sequence>
+            <xs:element name="citationTermGroup" type="citationTermGroup" minOccurs="0"
+                        maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="citationTermGroup">
+        <xs:sequence>
+            <!-- Common across all authority item terms -->
+            <xs:element name="termDisplayName" type="xs:string"/>
+            <xs:element name="termName" type="xs:string"/>
+            <xs:element name="termType" type="xs:string"/>
+            <xs:element name="termStatus" type="xs:string"/>
+            <xs:element name="termQualifier" type="xs:string"/>
+            <xs:element name="termLanguage" type="xs:string"/>
+            <xs:element name="termPrefForLang" type="xs:boolean"/>
+            <xs:element name="termSource" type="xs:string"/>
+            <xs:element name="termSourceDetail" type="xs:string"/>
+            <xs:element name="termSourceID" type="xs:string"/>
+            <xs:element name="termSourceNote" type="xs:string"/>
+
+            <xs:element name="termFullCitation" type="xs:string"/>
+            <xs:element name="termTitle" type="xs:string"/>
+            <xs:element name="termSubTitle" type="xs:string"/>
+            <xs:element name="termSectionTitle" type="xs:string"/>
+            <xs:element name="termVolume" type="xs:string"/>
+            <xs:element name="termIssue" type="xs:string"/>
+           
+        </xs:sequence>
+    </xs:complexType>
+    
+    <!-- Before (re)using this generic complex type in any record type -->
+    <!-- other than CollectionObject, be sure to verify that Nuxeo handles -->
+    <!-- that correctly in its table creation/row linking. -->
+    <xs:complexType name="structuredDateGroup">
+        <xs:sequence>
+            <xs:element name="dateDisplayDate" type="xs:string"/>
+            <xs:element name="dateAssociation" type="xs:string"/>
+            <xs:element name="dateEarliestSingleYear" type="xs:integer"/>
+            <xs:element name="dateEarliestSingleMonth" type="xs:integer"/>
+            <xs:element name="dateEarliestSingleDay" type="xs:integer"/>
+            <xs:element name="dateEarliestSingleEra" type="xs:string"/>
+            <xs:element name="dateEarliestSingleCertainty" type="xs:string"/>
+            <xs:element name="dateEarliestSingleQualifier" type="xs:string"/>
+            <xs:element name="dateEarliestSingleQualifierValue" type="xs:integer"/>
+            <xs:element name="dateEarliestSingleQualifierUnit" type="xs:string"/>
+            <xs:element name="dateLatestYear" type="xs:integer"/>
+            <xs:element name="dateLatestMonth" type="xs:integer"/>
+            <xs:element name="dateLatestDay" type="xs:integer"/>
+            <xs:element name="dateLatestEra" type="xs:string"/>
+            <xs:element name="dateLatestCertainty" type="xs:string"/>
+            <xs:element name="dateLatestQualifier" type="xs:string"/>
+            <xs:element name="dateLatestQualifierValue" type="xs:integer"/>
+            <xs:element name="dateLatestQualifierUnit" type="xs:string"/>
+            <xs:element name="datePeriod" type="xs:string"/>
+            <xs:element name="dateNote" type="xs:string"/>
+            <xs:element name="dateEarliestScalarValue" type="xs:date"/>
+            <xs:element name="dateLatestScalarValue" type="xs:date"/>
+            <xs:element name="scalarValuesComputed" type="xs:boolean"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="citationPublicationInfoGroupList">
+        <xs:sequence>
+            <xs:element name="citationPublicationInfoGroup" type="citationPublicationInfoGroup" minOccurs="0"
+                maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="citationPublicationInfoGroup">
+        <xs:sequence>
+               <xs:element name="publisher" type="xs:string"/>
+            <xs:element name="place" type="xs:string"/>
+            <xs:element name="publicationDate" type="structuredDateGroup" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element name="edition" type="xs:string"/>
+            <xs:element name="pages" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>            
+    
+    <xs:complexType name="citationAgentInfoGroupList">
+        <xs:sequence>
+            <xs:element name="citationAgentInfoGroup" type="citationAgentInfoGroup" minOccurs="0"
+                maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="citationAgentInfoGroup">
+        <xs:sequence>
+               <xs:element name="agent" type="xs:string"/>
+            <xs:element name="role" type="xs:string"/>            
+            <xs:element name="note" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+
+     
+    <xs:complexType name="citationResourceIdentGroupList">
+        <xs:sequence>
+            <xs:element name="citationResourceIdentGroup" type="citationResourceIdentGroup" minOccurs="0"
+                maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="citationResourceIdentGroup">
+        <xs:sequence>
+               <xs:element name="resourceIdent" type="xs:string"/>
+            <xs:element name="type" type="xs:string"/>            
+            <xs:element name="captureDate" type="structuredDateGroup" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    
+    <xs:complexType name="citationRelatedTermsGroupList">
+        <xs:sequence>
+            <xs:element name="citationRelatedTermsGroup" type="citationRelatedTermsGroup" minOccurs="0"
+                maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="citationRelatedTermsGroup">
+        <xs:sequence>
+               <xs:element name="relatedTerm" type="xs:string"/>
+            <xs:element name="relationType" type="xs:string"/>                        
+        </xs:sequence>
+    </xs:complexType>
+    
+</xs:schema>
+
diff --git a/services/citation/jaxb/src/main/resources/citationauthority_common.xsd b/services/citation/jaxb/src/main/resources/citationauthority_common.xsd
new file mode 100644 (file)
index 0000000..68d63d1
--- /dev/null
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+    CitationAuthority schema (XSD)
+    
+    Entity  : CitationAuthority
+    Part    : Common
+    Used for: JAXB binding between XML and Java objects
+    
+    $LastChangedRevision: 1055 $
+    $LastChangedDate: 2009-12-09 12:25:15 -0800 (Wed, 09 Dec 2009) $
+-->
+
+<xs:schema 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    jaxb:version="1.0" elementFormDefault="unqualified"
+    xmlns:ns="http://collectionspace.org/services/citation"
+    xmlns="http://collectionspace.org/services/citation"
+    targetNamespace="http://collectionspace.org/services/citation"
+    version="0.1"
+    >
+    
+    <!--
+        Avoid XmlRootElement nightmare:
+        See http://weblogs.java.net/blog/kohsuke/archive/2006/03/why_does_jaxb_p.html
+    -->
+    <!-- See http://wiki.collectionspace.org/display/collectionspace/Citation+Service+Home -->    
+    
+    <!-- CitationAuthority  -->
+    <xs:element name="citationauthorities_common">
+        <xs:complexType>
+            <xs:sequence>
+                <!--  Common identifier -->
+                <xs:element name="csid" type="xs:string" />
+                
+                <!--  CitationAuthority Information Group -->
+                <xs:element name="displayName" type="xs:string"/>
+                                                               <xs:element name="shortIdentifier" type="xs:string"/>
+                <xs:element name="refName" type="xs:string"/>
+                <xs:element name="vocabType" type="xs:string"/>
+                <xs:element name="source" type="xs:string"/>
+                <xs:element name="description" type="xs:string"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>
+
diff --git a/services/citation/jaxb/src/main/resources/citations_smk.xsd b/services/citation/jaxb/src/main/resources/citations_smk.xsd
new file mode 100644 (file)
index 0000000..ede4e25
--- /dev/null
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+    citation schema (XSD)
+    
+    Entity  : citation
+    Part    : Domain - SMK
+    Used for: JAXB binding between XML and Java objects
+
+    $LastChangedRevision: 987 $
+    $LastChangedDate: 2009-11-30 23:06:32 +0100 (Mon, 30 Nov 2009) $
+-->
+
+<xs:schema 
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:ns="http://collectionspace.org/services/citation/local/smk"
+  xmlns="http://collectionspace.org/services/citation/local/smk"
+  targetNamespace="http://collectionspace.org/services/citation/local/smk"
+  version="0.1"
+>
+    <!-- citations for smk-->
+    <xs:element name="citations_smk">
+        <xs:complexType>
+            <xs:sequence>                              
+                   <xs:element name="smkCitationPublicationInfoGroupList" type="smkCitationPublicationInfoGroupList" />
+                   <xs:element name="smkCitationResourceIdentGroupList" type="smkCitationResourceIdentGroupList" />
+             </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+  
+    <xs:complexType name="smkCitationPublicationInfoGroupList">
+        <xs:sequence>
+            <xs:element name="smkCitationPublicationInfoGroup" type="smkCitationPublicationInfoGroup" minOccurs="0"
+                maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="smkCitationPublicationInfoGroup">
+        <xs:sequence>
+               <xs:element name="smkPublisher" type="xs:string"/>
+            <xs:element name="smkPlace" type="xs:string"/>
+            <xs:element name="smkPublicationDate" type="smkStructuredDateSMKGroup" minOccurs="0" maxOccurs="unbounded"/>
+            <xs:element name="smkEdition" type="xs:string"/>
+            <xs:element name="smkPages" type="xs:string"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="smkCitationResourceIdentGroupList">
+        <xs:sequence>
+            <xs:element name="smkCitationResourceIdentGroup" type="smkCitationResourceIdentGroup" minOccurs="0"
+                maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+    
+    <xs:complexType name="smkCitationResourceIdentGroup">
+        <xs:sequence>
+               <xs:element name="smkResourceIdent" type="xs:string"/>
+            <xs:element name="smkType" type="xs:string"/>            
+            <xs:element name="smkCaptureDate" type="smkStructuredDateSMKGroup" minOccurs="0" maxOccurs="unbounded"/>
+        </xs:sequence>
+    </xs:complexType>
+        
+    <xs:complexType name="smkStructuredDateSMKGroup">
+        <xs:sequence>          
+            <xs:element name="dateSMKDisplayText" type="xs:string"/>
+            <xs:element name="dateSMKDisplayEngText" type="xs:string"/>
+            <xs:element name="dateSMKDateDay" type="xs:string"/>
+            <xs:element name="dateSMKDateMonth" type="xs:string"/>
+            <xs:element name="dateSMKDateYear" type="xs:string"/>
+            <xs:element name="dateSMKEraSelector" type="xs:string"/>
+            <xs:element name="dateSMKSecondDateDay" type="xs:string"/>
+            <xs:element name="dateSMKSecondDateMonth" type="xs:string"/>
+            <xs:element name="dateSMKSecondDateYear" type="xs:string"/>
+            <xs:element name="dateSMKSecondEraSelector" type="xs:string"/>            
+            <xs:element name="dateSMKThirdDateDay" type="xs:string"/>
+            <xs:element name="dateSMKThirdDateMonth" type="xs:string"/>
+            <xs:element name="dateSMKThirdDateYear" type="xs:string"/>
+            <xs:element name="dateSMKThirdEraSelector" type="xs:string"/>            
+            <xs:element name="dateSMKSegmentSelector" type="xs:string"/>
+            <xs:element name="dateSMKTypeSelector" type="xs:string"/>
+            <xs:element name="dateSMKLatestScalarValue" type="xs:date"/> 
+            <xs:element name="dateSMKEarliestScalarValue" type="xs:date"/> 
+            <xs:element name="scalarValuesComputed" type="xs:boolean"/>                                        
+        </xs:sequence>
+    </xs:complexType>
+
+</xs:schema>
\ No newline at end of file
diff --git a/services/citation/pom.xml b/services/citation/pom.xml
new file mode 100644 (file)
index 0000000..0cbb03e
--- /dev/null
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.main</artifactId>
+        <version>3.2.2-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.citation</artifactId>
+    <name>services.citation</name>
+    <packaging>pom</packaging>
+
+    <dependencies>
+                       <!--
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.authority</artifactId>
+            <optional>true</optional>
+            <version>${project.version}</version>
+        </dependency>    
+                               -->
+    </dependencies>
+
+    <modules>
+        <module>jaxb</module>
+        <module>service</module>
+        <module>3rdparty</module>
+        <module>client</module>
+    </modules>
+    
+    <profiles>
+        <profile>
+            <id>samples</id>
+           <modules>
+                <module>sample</module>
+           </modules>
+        </profile>
+    </profiles>
+    
+</project>
+
diff --git a/services/citation/service/pom.xml b/services/citation/service/pom.xml
new file mode 100644 (file)
index 0000000..44f1345
--- /dev/null
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <parent>
+        <groupId>org.collectionspace.services</groupId>
+        <artifactId>org.collectionspace.services.citation</artifactId>
+        <version>3.2.2-SNAPSHOT</version>
+    </parent>
+    
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.citation.service</artifactId>
+    <name>services.citation.service</name>
+    <packaging>jar</packaging>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+        </dependency>
+<!-- CollectionSpace dependencies -->        
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.common</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.authority.service</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.citation.jaxb</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.citation.client</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.contact.service</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- External dependencies -->        
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.1</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+        </dependency>
+        
+        <!-- apache -->
+        <dependency>
+            <groupId>commons-beanutils</groupId>
+            <artifactId>commons-beanutils</artifactId>
+            <version>1.6.1</version>
+        </dependency>
+        <!-- use explict 1.1 version to prevent errors coming from Nuxeo client -->
+        <dependency>
+            <groupId>commons-logging</groupId>
+            <artifactId>commons-logging</artifactId>
+            <version>1.1</version>
+        </dependency>
+      <!-- javax -->
+
+
+        <dependency>
+            <groupId>javax.security</groupId>
+            <artifactId>jaas</artifactId>
+            <version>1.0.01</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>dom4j</groupId>
+            <artifactId>dom4j</artifactId>
+            <version>1.6.1</version>
+            <scope>provided</scope>
+        </dependency>
+        
+        <!-- jboss -->
+
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxrs</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>tjws</groupId>
+                    <artifactId>webserver</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-jaxb-provider</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.jboss.resteasy</groupId>
+            <artifactId>resteasy-multipart-provider</artifactId>
+        </dependency>
+        
+        <!-- nuxeo -->
+
+        <dependency>
+            <groupId>org.nuxeo.ecm.core</groupId>
+            <artifactId>nuxeo-core-api</artifactId>
+            <exclusions>
+                <exclusion>
+                    <artifactId>jboss-remoting</artifactId>
+                    <groupId>jboss</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+    </dependencies>
+    
+    <build>
+        <finalName>collectionspace-services-citation</finalName>
+        <plugins>
+        </plugins>
+    </build>
+</project>
+
diff --git a/services/citation/service/src/main/java/org/collectionspace/services/citation/CitationAuthorityResource.java b/services/citation/service/src/main/java/org/collectionspace/services/citation/CitationAuthorityResource.java
new file mode 100644 (file)
index 0000000..45b7d75
--- /dev/null
@@ -0,0 +1,71 @@
+/**
+ * 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.citation;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import org.collectionspace.services.client.CitationAuthorityClient;
+import org.collectionspace.services.contact.AuthorityResourceWithContacts;
+import org.collectionspace.services.citation.nuxeo.CitationDocumentModelHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * CitationAuthorityResource
+ *
+ * Handles, dispatches, and returns responses to RESTful requests related to
+ * Citation authority-related resources.
+ */
+@Path(CitationAuthorityClient.SERVICE_PATH)
+@Consumes("application/xml")
+@Produces("application/xml")
+public class CitationAuthorityResource extends AuthorityResourceWithContacts<CitationauthoritiesCommon, CitationDocumentModelHandler> {
+
+    final Logger logger = LoggerFactory.getLogger(CitationAuthorityResource.class);
+
+    public CitationAuthorityResource() {
+        super(CitationauthoritiesCommon.class, CitationAuthorityResource.class,
+                CitationAuthorityClient.SERVICE_COMMON_PART_NAME, CitationAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME);
+    }
+
+    @Override
+    public String getServiceName() {
+        return CitationAuthorityClient.SERVICE_NAME;
+    }
+
+    @Override
+    public String getItemServiceName() {
+        return CitationAuthorityClient.SERVICE_ITEM_NAME;
+    }
+
+    @Override
+    public String getItemTermInfoGroupXPathBase() {
+        return CitationAuthorityClient.TERM_INFO_GROUP_XPATH_BASE;
+    }
+
+    @Override
+    public Class<CitationauthoritiesCommon> getCommonPartClass() {
+        return CitationauthoritiesCommon.class;
+    }
+}
diff --git a/services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationAuthorityConstants.java b/services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationAuthorityConstants.java
new file mode 100644 (file)
index 0000000..746cf11
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ *  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.citation.nuxeo;
+
+/**
+ * CitationAuthorityConstants processes CollectionObject document
+ *
+ */
+public class CitationAuthorityConstants {
+
+    public final static String NUXEO_DOCTYPE = "CitationAuthority";
+    public final static String NUXEO_SCHEMA_NAME = "citationauthority";
+    public final static String NUXEO_DC_TITLE = "CollectionSpace-CitationAuthority";
+}
diff --git a/services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationAuthorityDocumentModelHandler.java b/services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationAuthorityDocumentModelHandler.java
new file mode 100644 (file)
index 0000000..a78cdd0
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+ *  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.citation.nuxeo;
+
+import org.collectionspace.services.citation.CitationauthoritiesCommon;
+import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityDocumentModelHandler;
+
+/**
+ * CitationAuthorityDocumentModelHandler
+ *
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+public class CitationAuthorityDocumentModelHandler
+               extends AuthorityDocumentModelHandler<CitationauthoritiesCommon> {
+
+    /**
+     * Common part schema label
+     */
+    private static final String COMMON_PART_LABEL = "citationauthorities_common";   
+    
+    public CitationAuthorityDocumentModelHandler() {
+       super(COMMON_PART_LABEL);
+    }
+       
+    /**
+     * getQProperty converts the given property to qualified schema property
+     * @param prop
+     * @return
+     */
+    @Override
+    public String getQProperty(String prop) {
+        return CitationAuthorityConstants.NUXEO_SCHEMA_NAME + ":" + prop;
+    }
+}
+
diff --git a/services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationAuthorityValidatorHandler.java b/services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationAuthorityValidatorHandler.java
new file mode 100644 (file)
index 0000000..e4314e1
--- /dev/null
@@ -0,0 +1,96 @@
+/**
+ *  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.citation.nuxeo;
+
+import java.util.regex.Pattern;
+
+import org.collectionspace.services.citation.CitationauthoritiesCommon;
+import org.collectionspace.services.common.context.MultipartServiceContext;
+import org.collectionspace.services.common.context.ServiceContext;
+import org.collectionspace.services.common.document.DocumentHandler.Action;
+import org.collectionspace.services.common.document.InvalidDocumentException;
+import org.collectionspace.services.common.document.ValidatorHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * CitationAuthorityValidatorHandler
+ * 
+ * Validates data supplied when attempting to create and/or update CitationAuthority records.
+ * 
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+public class CitationAuthorityValidatorHandler implements ValidatorHandler {
+
+    final Logger logger = LoggerFactory.getLogger(CitationAuthorityValidatorHandler.class);
+    private static final Pattern shortIdBadPattern = Pattern.compile("[\\W]"); //.matcher(input).matches()
+
+    @Override
+    public void validate(Action action, ServiceContext ctx)
+            throws InvalidDocumentException {
+        if (logger.isDebugEnabled()) {
+            logger.debug("validate() action=" + action.name());
+        }
+        
+        // Bail out if the validation action is for delete.
+        if (action.equals(Action.DELETE)) {
+               return;
+        }
+        
+        try {
+            MultipartServiceContext mctx = (MultipartServiceContext) ctx;
+            CitationauthoritiesCommon citationAuth =
+                    (CitationauthoritiesCommon) mctx.getInputPart(mctx.getCommonPartLabel(),
+                    CitationauthoritiesCommon.class);
+            String msg = "";
+            boolean invalid = false;
+
+            if(citationAuth != null) { // No guarantee that there is a common part in every post/update.
+                   // Validation specific to creates or updates
+                   if (action.equals(Action.CREATE)) {
+                       String shortId = citationAuth.getShortIdentifier();
+                       // Per CSPACE-2215, shortIdentifier values that are null (missing)
+                       // oe the empty string are now legally accepted in create payloads.
+                       // In either of those cases, a short identifier will be synthesized from
+                       // a display name or supplied in another manner.
+                       if ((shortId != null) && (shortIdBadPattern.matcher(shortId).find())) {
+                           invalid = true;
+                           msg += "shortIdentifier must only contain standard word characters";
+                       }
+                   } else if (action.equals(Action.UPDATE)) {
+                   }
+            }
+
+            if (invalid) {
+                logger.error(msg);
+                throw new InvalidDocumentException(msg);
+            }
+        } catch (InvalidDocumentException ide) {
+            throw ide;
+        } catch (Exception e) {
+            throw new InvalidDocumentException(e);
+        }
+    }
+}
diff --git a/services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationConstants.java b/services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationConstants.java
new file mode 100644 (file)
index 0000000..a7c1407
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ *  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.citation.nuxeo;
+
+/**
+ * CitationConstants processes CollectionObject document
+ *
+ */
+public class CitationConstants {
+
+    public final static String NUXEO_DOCTYPE = "Citation";
+    public final static String NUXEO_SCHEMA_NAME = "citation";
+    public final static String NUXEO_DC_TITLE = "CollectionSpace-Citation";
+}
diff --git a/services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationDocumentModelHandler.java b/services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationDocumentModelHandler.java
new file mode 100644 (file)
index 0000000..1ac55ec
--- /dev/null
@@ -0,0 +1,74 @@
+/**
+ *  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.citation.nuxeo;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.collectionspace.services.client.CitationAuthorityClient;
+import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler;
+import org.collectionspace.services.CitationJAXBSchema;
+import org.collectionspace.services.citation.CitationsCommon;
+import org.nuxeo.ecm.core.api.DocumentModel;
+
+/**
+ * CitationDocumentModelHandler
+ *
+ * $LastChangedRevision: $
+ * $LastChangedDate: $
+ */
+/**
+ * @author pschmitz
+ *
+ */
+public class CitationDocumentModelHandler
+       extends AuthorityItemDocumentModelHandler<CitationsCommon> {
+
+    /** The logger. */
+    //private final Logger logger = LoggerFactory.getLogger(CitationDocumentModelHandler.class);
+    /**
+     * Common part schema label
+     */
+    private static final String COMMON_PART_LABEL = "citations_common";
+    
+    public CitationDocumentModelHandler() {
+       super(COMMON_PART_LABEL);
+    }
+
+    @Override
+    public String getAuthorityServicePath(){
+        return CitationAuthorityClient.SERVICE_PATH_COMPONENT;    // CSPACE-3932
+    }
+         
+    /**
+     * getQProperty converts the given property to qualified schema property
+     * @param prop
+     * @return
+     */
+    @Override
+    public String getQProperty(String prop) {
+        return CitationConstants.NUXEO_SCHEMA_NAME + ":" + prop;
+    }
+}
+
diff --git a/services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationValidatorHandler.java b/services/citation/service/src/main/java/org/collectionspace/services/citation/nuxeo/CitationValidatorHandler.java
new file mode 100644 (file)
index 0000000..398795e
--- /dev/null
@@ -0,0 +1,144 @@
+/**
+ * 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.citation.nuxeo;
+
+import java.util.List;
+import java.util.regex.Pattern;
+import org.collectionspace.services.common.api.Tools;
+import org.collectionspace.services.common.document.InvalidDocumentException;
+import org.collectionspace.services.common.document.ValidatorHandlerImpl;
+import org.collectionspace.services.citation.CitationTermGroup;
+import org.collectionspace.services.citation.CitationTermGroupList;
+import org.collectionspace.services.citation.CitationsCommon;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * CitationValidatorHandler
+ *
+ * Performs validation when making requests related to Citation records.
+ * As an example, you can modify this class to customize validation of
+ * payloads supplied in requests to create and/or update records.
+ */
+public class CitationValidatorHandler extends ValidatorHandlerImpl {
+
+    final Logger logger = LoggerFactory.getLogger(CitationValidatorHandler.class);
+    // 'Bad pattern' for shortIdentifiers matches any non-word characters
+    private static final Pattern SHORT_ID_BAD_PATTERN = Pattern.compile("[\\W]");
+    private static final String SHORT_ID_BAD_CHARS_ERROR =
+            "shortIdentifier must only contain standard word characters";
+    private static final String HAS_NO_TERMS_ERROR =
+            "Authority items must contain at least one term.";
+    private static final String TERM_HAS_EMPTY_DISPLAYNAME_ERROR =
+            "Each term group in an authority item must contain "
+            + "a non-empty display name.";
+
+    @Override
+    protected Class getCommonPartClass() {
+        return CitationsCommon.class;
+    }
+
+    @Override
+    protected void handleCreate() throws InvalidDocumentException {
+        CitationsCommon citation = (CitationsCommon) getCommonPart();
+        // No guarantee that there is a common part in every post/update.
+        if (citation != null) {
+            try {
+                String shortId = citation.getShortIdentifier();
+                if (shortId != null) {
+                    CS_ASSERT(shortIdentifierContainsOnlyValidChars(shortId), SHORT_ID_BAD_CHARS_ERROR);
+                }
+                CS_ASSERT(containsAtLeastOneTerm(citation), HAS_NO_TERMS_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(citation), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
+            } catch (AssertionError e) {
+                if (logger.isErrorEnabled()) {
+                    logger.error(e.getMessage(), e);
+                }
+                throw new InvalidDocumentException(e.getMessage(), e);
+            }
+        }
+    }
+
+    @Override
+    protected void handleGet() throws InvalidDocumentException {
+    }
+
+    @Override
+    protected void handleGetAll() throws InvalidDocumentException {
+    }
+
+    @Override
+    protected void handleUpdate() throws InvalidDocumentException {
+        CitationsCommon citation = (CitationsCommon) getCommonPart();
+        // No guarantee that there is a common part in every post/update.
+        if (citation != null) {
+            try {
+                // shortIdentifier is among a set of fields that are
+                // prevented from being changed on an update, and thus
+                // we don't need to check its value here.
+                CS_ASSERT(containsAtLeastOneTerm(citation), HAS_NO_TERMS_ERROR);
+                CS_ASSERT(allTermsContainDisplayName(citation), TERM_HAS_EMPTY_DISPLAYNAME_ERROR);
+            } catch (AssertionError e) {
+                if (logger.isErrorEnabled()) {
+                    logger.error(e.getMessage(), e);
+                }
+                throw new InvalidDocumentException(e.getMessage(), e);
+            }
+        }
+    }
+
+    @Override
+    protected void handleDelete() throws InvalidDocumentException {
+    }
+
+    private boolean shortIdentifierContainsOnlyValidChars(String shortId) {
+        // Check whether any characters match the 'bad' pattern
+        if (SHORT_ID_BAD_PATTERN.matcher(shortId).find()) {
+            return false;
+        }
+        return true;
+    }
+
+    private boolean containsAtLeastOneTerm(CitationsCommon citation) {
+        CitationTermGroupList termGroupList = citation.getCitationTermGroupList();
+        if (termGroupList == null) {
+            return false;
+        }
+        List<CitationTermGroup> termGroups = termGroupList.getCitationTermGroup();
+        if ((termGroups == null) || (termGroups.isEmpty())) {
+            return false;
+        }
+        return true;
+    }
+
+    private boolean allTermsContainDisplayName(CitationsCommon citation) {
+        CitationTermGroupList termGroupList = citation.getCitationTermGroupList();
+        List<CitationTermGroup> termGroups = termGroupList.getCitationTermGroup();
+        for (CitationTermGroup termGroup : termGroups) {
+            if (Tools.isBlank(termGroup.getTermDisplayName())) {
+                return false;
+            }
+        }
+        return true;
+    }
+}
index ed2da9e89210e4f21a5b068aa8e5f0aca02a2248..ca6aa72c89613e71b3f790f577e9b09e7229f1ad 100644 (file)
         </tenant:serviceBindings>
         <!-- end person service meta-data -->
         
+    <!-- begin citationauthority service meta-data -->
+        <tenant:serviceBindings id="Citationauthorities" name="Citationauthorities" type="utility" version="0.1">
+            <!-- other URI paths through which this service could be accessed -->
+            <!--
+            <service:uriPath xmlns:service='http://collectionspace.org/services/config/service'>
+                /citationauthorities/*/items/
+            </service:uriPath>
+            <service:uriPath xmlns:service='http://collectionspace.org/services/config/service'>
+                /citationauthorities/*/items/*/refObjs
+            </service:uriPath>
+            -->
+            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/config/service">default-domain</service:repositoryDomain>
+            <service:documentHandler xmlns:service="http://collectionspace.org/services/config/service">org.collectionspace.services.citation.nuxeo.CitationAuthorityDocumentModelHandler</service:documentHandler>
+            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/config/service">
+                <service:params>
+                    <service:ListResultsFields>
+                        <service:ListResultField>
+                            <service:element>displayName</service:element>
+                            <service:xpath>displayName</service:xpath>
+                        </service:ListResultField>
+                        <service:ListResultField>
+                            <service:element>refName</service:element>
+                            <service:xpath>refName</service:xpath>
+                        </service:ListResultField>
+                        <service:ListResultField>
+                            <service:element>shortIdentifier</service:element>
+                            <service:xpath>shortIdentifier</service:xpath>
+                        </service:ListResultField>
+                        <service:ListResultField>
+                            <service:element>vocabType</service:element>
+                            <service:xpath>vocabType</service:xpath>
+                        </service:ListResultField>
+                    </service:ListResultsFields>
+                </service:params>
+            </service:DocHandlerParams>
+            <service:validatorHandler xmlns:service="http://collectionspace.org/services/config/service">org.collectionspace.services.citation.nuxeo.CitationAuthorityValidatorHandler</service:validatorHandler>
+            <service:initHandler xmlns:service="http://collectionspace.org/services/config/service">
+                <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
+                <service:params>
+                    <service:field>
+                        <service:table>citationauthorities_common</service:table>
+                        <service:col>displayname</service:col>
+                    </service:field>
+                    <service:field>
+                        <service:table>citationauthorities_common</service:table>
+                        <service:col>shortidentifier</service:col>
+                    </service:field>
+                </service:params>
+            </service:initHandler>
+            <service:object xmlns:service="http://collectionspace.org/services/config/service" id="1" name="Citationauthority" version="0.1">
+                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="citationauthorities-system" updated="" order="0">
+                    <service:content contentType="application/xml">
+                        <service:xmlContent namespaceURI="http://collectionspace.org/services/config/system" schemaLocation="http://collectionspace.org/services/config/system http://collectionspace.org/services/config/system/system-response.xsd" />
+                    </service:content>
+                </service:part>
+                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="citationauthorities_common" updated="" order="1">
+                    <service:content contentType="application/xml">
+                        <service:xmlContent namespaceURI="http://collectionspace.org/services/citation" schemaLocation="http://collectionspace.org/services/citation http://services.collectionspace.org/citation/citationauthorities_common.xsd" />
+                    </service:content>
+                </service:part>
+                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+                    <service:content contentType="application/xml">
+                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+                    </service:content>
+                </service:part>
+            </service:object>
+        </tenant:serviceBindings>
+        <!-- end citationauthority service meta-data -->
+        
+        <!-- begin citation service meta-data.
+             Note there is no Citation service, but there is a
+             Repository workspace so we have to configure that.
+        -->
+        <tenant:serviceBindings id="Citations" name="Citations" type="authority" version="0.1">
+            <!-- other URI paths through which this service could be accessed -->
+            <!--
+            <service:uriPath xmlns:service='http://collectionspace.org/services/config/service'>
+                /citationauthorities/*/items/
+            </service:uriPath>
+            -->
+            <service:repositoryDomain xmlns:service="http://collectionspace.org/services/config/service">default-domain</service:repositoryDomain>
+            <service:documentHandler xmlns:service="http://collectionspace.org/services/config/service">org.collectionspace.services.citation.nuxeo.CitationDocumentModelHandler</service:documentHandler>
+            <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/config/service">
+                <service:params>
+                       <service:SupportsHierarchy>true</service:SupportsHierarchy> 
+                    <service:ListResultsFields>
+                        <!-- Omit the standard AuthorityItem fields (they are handled by the code) -->
+                        <service:ListResultField>
+                            <service:element>termDisplayName</service:element>
+                            <service:xpath>citationTermGroupList/[0]/termDisplayName</service:xpath>
+                        </service:ListResultField>                        
+                    </service:ListResultsFields>
+                </service:params>
+            </service:DocHandlerParams>
+            <service:validatorHandler xmlns:service="http://collectionspace.org/services/config/service">org.collectionspace.services.citation.nuxeo.CitationValidatorHandler</service:validatorHandler>
+            <service:initHandler xmlns:service="http://collectionspace.org/services/config/service">
+                <service:classname>org.collectionspace.services.common.init.AddIndices</service:classname>
+                <service:params>
+                    <service:field>
+                        <service:table>citations_common</service:table>
+                        <service:col>inauthority</service:col>
+                    </service:field>
+                    <service:field>
+                        <service:table>citationtermgroup</service:table>
+                        <service:col>termdisplayname</service:col>
+                    </service:field>
+                    <service:field>
+                        <service:table>citations_common</service:table>
+                        <service:col>shortidentifier</service:col>
+                    </service:field>
+                </service:params>
+            </service:initHandler>
+            <service:properties xmlns:service="http://collectionspace.org/services/config/service">
+                <types:item xmlns:types="http://collectionspace.org/services/config/types">
+                    <types:key>objectNameProperty</types:key>
+                    <types:value>citationTermGroupList/[0]/termDisplayName</types:value>
+                </types:item>
+                <types:item xmlns:types="http://collectionspace.org/services/config/types">
+                    <types:key>objectNumberProperty</types:key>
+                    <types:value>shortIdentifier</types:value>
+                </types:item>
+            </service:properties>
+            <service:object xmlns:service="http://collectionspace.org/services/config/service" id="1" name="Citation" version="0.1">
+                <service:part id="0" control_group="Managed" versionable="true" auditable="false" label="citations-system" updated="" order="0">
+                    <service:content contentType="application/xml">
+                        <service:xmlContent namespaceURI="http://collectionspace.org/services/config/system" schemaLocation="http://collectionspace.org/services/config/system http://collectionspace.org/services/config/system/system-response.xsd" />
+                    </service:content>
+                </service:part>
+                <service:part id="1" control_group="Managed" versionable="true" auditable="false" label="citations_common" updated="" order="1">
+                    <service:content contentType="application/xml">
+                        <service:xmlContent namespaceURI="http://collectionspace.org/services/citation" schemaLocation="http://collectionspace.org/services/citation http://services.collectionspace.org/citation/citations_common.xsd" />
+                    </service:content>
+                    <service:properties>                        
+                        <!-- Fields containing term list / controlled vocabulary references -->
+                        <types:item xmlns:types="http://collectionspace.org/services/config/types">
+                            <types:key>termRef</types:key>
+                            <types:value>citationTermGroupList/*/termType</types:value>
+                        </types:item>
+                        <types:item xmlns:types="http://collectionspace.org/services/config/types">
+                            <types:key>termRef</types:key>
+                            <types:value>citationTermGroupList/*/termLanguage</types:value>
+                        </types:item>
+                        <types:item xmlns:types="http://collectionspace.org/services/config/types">
+                            <types:key>termRef</types:key>
+                            <types:value>citationTermGroupList/*/termStatus</types:value>
+                        </types:item>                        
+                    </service:properties>
+                </service:part>
+                <service:part id="2" control_group="Managed" versionable="true" auditable="false" label="collectionspace_core" updated="" order="2">
+                    <service:content contentType="application/xml">
+                        <service:xmlContent namespaceURI="http://collectionspace.org/collectionspace_core/" schemaLocation="http://collectionspace.org/collectionspace_core/ http://services.collectionspace.org/collectionspace_core.xsd" />
+                    </service:content>
+                </service:part>
+            </service:object>
+        </tenant:serviceBindings>
+       <!-- end citation service meta-data -->
+    
+    
+    
+        
         <!-- begin locationauthority service meta-data -->
         <tenant:serviceBindings id="Locationauthorities" name="Locationauthorities" type="utility" version="0.1">
             <!-- other URI paths through which this service could be accessed -->
index cb107a96e2987e16313eff483b090265b806c46c..45650fee3a26c1893dd9253a14233955b1627de5 100644 (file)
@@ -51,6 +51,7 @@
         <module>vocabulary</module>
         <module>organization</module>
         <module>person</module>
+        <module>citation</module>
         <module>id</module>
         <module>collectionobject</module>
         <module>servicegroup</module>
index 771bca59b72e35aa4544d00c692b963e11375748..23a3d2bc68f0ce14fbf54bea844c31e4d8323d39 100644 (file)
             <artifactId>org.collectionspace.services.person.client</artifactId>\r
             <version>${project.version}</version>\r
         </dependency>\r
+        
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.citation.client</artifactId>
+            <version>${project.version}</version>
+        </dependency>        
+        
         <dependency>\r
             <groupId>org.collectionspace.services</groupId>\r
             <artifactId>org.collectionspace.services.organization.client</artifactId>\r
index 2b5e22c1412c4180741166f1ab585a7f8d5be325..ae35a6713c14da407e086d6ee8ead1fc39564563 100644 (file)
@@ -52,6 +52,7 @@ import org.collectionspace.services.relation.RelationsDocListItem;
 // HACK HACK HACK
 import org.collectionspace.services.client.CollectionSpaceClient;
 import org.collectionspace.services.client.PersonAuthorityClient;
+import org.collectionspace.services.client.CitationAuthorityClient;
 import org.collectionspace.services.client.OrgAuthorityClient;
 import org.collectionspace.services.client.LocationAuthorityClient;
 import org.collectionspace.services.client.TaxonomyAuthorityClient;
@@ -478,6 +479,8 @@ public class RelationDocumentModelHandler
                // HACK - Use startsWith to allow for extension of schemas.
                if(docType.startsWith("Person"))
                        common_schema = PersonAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
+               else if(docType.startsWith("Citation"))
+                       common_schema = CitationAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
                else if(docType.startsWith("Organization"))
                        common_schema = OrgAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME;
                else if(docType.startsWith("Locationitem"))