]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
DRYD-1390: Consultation Procedure (#414)
authorMichael Ritter <mikejritter@users.noreply.github.com>
Fri, 5 Jul 2024 18:36:39 +0000 (12:36 -0600)
committerGitHub <noreply@github.com>
Fri, 5 Jul 2024 18:36:39 +0000 (14:36 -0400)
15 files changed:
services/JaxRsServiceProvider/pom.xml
services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java
services/common/src/main/resources/db/postgresql/load_id_generators.sql
services/consultation/build.xml [new file with mode: 0644]
services/consultation/client/pom.xml [new file with mode: 0644]
services/consultation/client/src/main/java/org/collectionspace/services/client/ConsultationClient.java [new file with mode: 0644]
services/consultation/client/src/main/java/org/collectionspace/services/client/ConsultationProxy.java [new file with mode: 0644]
services/consultation/jaxb/pom.xml [new file with mode: 0644]
services/consultation/jaxb/src/main/resources/consultations_common.xsd [new file with mode: 0644]
services/consultation/pom.xml [new file with mode: 0644]
services/consultation/service/pom.xml [new file with mode: 0644]
services/consultation/service/src/main/java/org/collectionspace/services/consultation/ConsultationResource.java [new file with mode: 0644]
services/consultation/service/src/main/java/org/collectionspace/services/consultation/nuxeo/ConsultationDocumentModelHandler.java [new file with mode: 0644]
services/consultation/service/src/main/java/org/collectionspace/services/consultation/nuxeo/ConsultationValidatorHandler.java [new file with mode: 0644]
services/pom.xml

index 0b3a70ebe19c3bfb81afcf8a0eb004eeceb479fa..a1b61e04d3023b330d64307d421665ee0f40c690 100644 (file)
             <artifactId>org.collectionspace.services.heldintrust.service</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.collectionspace.services</groupId>
+            <artifactId>org.collectionspace.services.consultation.service</artifactId>
+            <version>${project.version}</version>
+        </dependency>
 
       <!--dependency>
           <groupId>org.collectionspace.services</groupId>
index b0687fe18ade6ab09533552399ad1bb9ea10cfc9..d7fa366182605ce7310a4528f4cfdeb050ab1dd0 100644 (file)
@@ -27,6 +27,7 @@ import org.collectionspace.services.account.TenantResource;
 import org.collectionspace.services.blob.BlobResource;
 import org.collectionspace.services.chronology.ChronologyAuthorityResource;
 import org.collectionspace.services.collectionobject.CollectionObjectResource;
+import org.collectionspace.services.consultation.ConsultationResource;
 import org.collectionspace.services.dutyofcare.DutyofcareResource;
 import org.collectionspace.services.heldintrust.HeldInTrustResource;
 import org.collectionspace.services.id.IDResource;
@@ -173,6 +174,7 @@ public class CollectionSpaceJaxRsApplication extends Application
         addResourceToMapAndSingletons(new NagpraInventoryResource());
         addResourceToMapAndSingletons(new SummaryDocumentationResource());
         addResourceToMapAndSingletons(new HeldInTrustResource());
+        addResourceToMapAndSingletons(new ConsultationResource());
 
         singletons.add(new IDResource());
 
index bcbbc4487d16b367110ffdc2a6bf64e3ed896927..4a6bc990ea6ed3141f34df76b23aeb01b160eb4a 100644 (file)
@@ -1270,3 +1270,39 @@ INSERT INTO id_generators
         SELECT  csid
         FROM    id_generators
         );
+
+-- CONSULTATION_NUMBER
+
+INSERT INTO id_generators
+    (csid, displayname, description, priority, last_generated_id, id_generator_state)
+  SELECT
+     '48dfa8e6-6c18-4d6e-bb2d-bbc69cc2cb36',
+     'Consultation Number',
+     'Identifies a consultation document.',
+     '9',
+     '',
+'<org.collectionspace.services.id.SettableIDGenerator>
+  <parts>
+    <org.collectionspace.services.id.StringIDGeneratorPart>
+      <initialValue>CN</initialValue>
+      <currentValue>CN</currentValue>
+    </org.collectionspace.services.id.StringIDGeneratorPart>
+    <org.collectionspace.services.id.YearIDGeneratorPart>
+      <currentValue></currentValue>
+    </org.collectionspace.services.id.YearIDGeneratorPart>
+    <org.collectionspace.services.id.StringIDGeneratorPart>
+      <initialValue>.</initialValue>
+      <currentValue>.</currentValue>
+    </org.collectionspace.services.id.StringIDGeneratorPart>
+    <org.collectionspace.services.id.NumericIDGeneratorPart>
+      <maxLength>6</maxLength>
+      <initialValue>1</initialValue>
+      <currentValue>-1</currentValue>
+    </org.collectionspace.services.id.NumericIDGeneratorPart>
+  </parts>
+</org.collectionspace.services.id.SettableIDGenerator>'
+  WHERE '48dfa8e6-6c18-4d6e-bb2d-bbc69cc2cb36' NOT IN
+        (
+        SELECT  csid
+        FROM    id_generators
+        );
diff --git a/services/consultation/build.xml b/services/consultation/build.xml
new file mode 100644 (file)
index 0000000..70d90dc
--- /dev/null
@@ -0,0 +1,106 @@
+<project name="consultation" default="package" basedir=".">
+  <description>
+    consultation service
+  </description>
+  <!-- set global properties for this build -->
+  <property name="services.trunk" value="../.." />
+  <!-- environment should be declared before reading build.properties -->
+  <property environment="env" />
+  <property file="${services.trunk}/build.properties" />
+  <property name="mvn.opts" value="-V" />
+  <property name="src" location="src" />
+
+  <condition property="osfamily-unix">
+    <os family="unix" />
+  </condition>
+  <condition property="osfamily-windows">
+    <os family="windows" />
+  </condition>
+
+  <target name="package" depends="package-unix,package-windows"
+    description="Package CollectionSpace Services" />
+
+  <target name="package-unix" if="osfamily-unix">
+    <exec executable="mvn" failonerror="true">
+      <arg value="package" />
+      <arg value="-Dmaven.test.skip=true" />
+      <arg value="-f" />
+      <arg value="${basedir}/pom.xml" />
+      <arg value="-N" />
+      <arg value="${mvn.opts}" />
+    </exec>
+  </target>
+
+  <target name="package-windows" if="osfamily-windows">
+    <exec executable="cmd" failonerror="true">
+      <arg value="/c" />
+      <arg value="mvn" />
+      <arg value="package" />
+      <arg value="-Dmaven.test.skip=true" />
+      <arg value="-f" />
+      <arg value="${basedir}/pom.xml" />
+      <arg value="-N" />
+      <arg value="${mvn.opts}" />
+    </exec>
+  </target>
+
+  <target name="install" depends="install-unix,install-windows"
+    description="Install" />
+  <target name="install-unix" if="osfamily-unix">
+    <exec executable="mvn" failonerror="true">
+      <arg value="install" />
+      <arg value="-Dmaven.test.skip=true" />
+      <arg value="-f" />
+      <arg value="${basedir}/pom.xml" />
+      <arg value="-N" />
+      <arg value="${mvn.opts}" />
+    </exec>
+  </target>
+  <target name="install-windows" if="osfamily-windows">
+    <exec executable="cmd" failonerror="true">
+      <arg value="/c" />
+      <arg value="mvn" />
+      <arg value="install" />
+      <arg value="-Dmaven.test.skip=true" />
+      <arg value="-f" />
+      <arg value="${basedir}/pom.xml" />
+      <arg value="-N" />
+      <arg value="${mvn.opts}" />
+    </exec>
+  </target>
+
+  <target name="clean" depends="clean-unix,clean-windows"
+    description="Delete target directories">
+    <delete dir="${build}" />
+  </target>
+  <target name="clean-unix" if="osfamily-unix">
+    <exec executable="mvn" failonerror="true">
+      <arg value="clean" />
+      <arg value="${mvn.opts}" />
+    </exec>
+  </target>
+  <target name="clean-windows" if="osfamily-windows">
+    <exec executable="cmd" failonerror="true">
+      <arg value="/c" />
+      <arg value="mvn" />
+      <arg value="clean" />
+      <arg value="${mvn.opts}" />
+    </exec>
+  </target>
+
+  <target name="test" depends="test-unix,test-windows" description="Run tests" />
+  <target name="test-unix" if="osfamily-unix">
+    <exec executable="mvn" failonerror="true">
+      <arg value="test" />
+      <arg value="${mvn.opts}" />
+    </exec>
+  </target>
+  <target name="test-windows" if="osfamily-windows">
+    <exec executable="cmd" failonerror="true">
+      <arg value="/c" />
+      <arg value="mvn" />
+      <arg value="test" />
+      <arg value="${mvn.opts}" />
+    </exec>
+  </target>
+</project>
\ No newline at end of file
diff --git a/services/consultation/client/pom.xml b/services/consultation/client/pom.xml
new file mode 100644 (file)
index 0000000..848d86d
--- /dev/null
@@ -0,0 +1,61 @@
+<?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.consultation</artifactId>
+    <version>${revision}</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>org.collectionspace.services.consultation.client</artifactId>
+  <name>services.consultation.client</name>
+
+  <dependencies>
+    <!-- CollectionSpace dependencies -->
+    <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.consultation.jaxb</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- External dependencies -->
+    <dependency>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
+    </dependency>
+    <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>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <finalName>collectionspace-services-consultation-client</finalName>
+  </build>
+</project>
\ No newline at end of file
diff --git a/services/consultation/client/src/main/java/org/collectionspace/services/client/ConsultationClient.java b/services/consultation/client/src/main/java/org/collectionspace/services/client/ConsultationClient.java
new file mode 100644 (file)
index 0000000..10809ac
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
+ * 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.consultation.ConsultationsCommon;
+
+/**
+ * ConsultationClient.java
+ */
+public class ConsultationClient extends AbstractCommonListPoxServiceClientImpl<ConsultationProxy, ConsultationsCommon> {
+
+    public static final String SERVICE_NAME = "consultations";
+    public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
+    public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
+    public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";
+
+    public ConsultationClient() throws Exception {
+        super();
+    }
+
+    public ConsultationClient(String clientPropertiesFilename) throws Exception {
+        super(clientPropertiesFilename);
+    }
+
+    @Override
+    public String getServicePathComponent() {
+        return SERVICE_PATH_COMPONENT;
+    }
+
+    @Override
+    public String getServiceName() {
+        return SERVICE_NAME;
+    }
+
+    @Override
+    public Class<ConsultationProxy> getProxyClass() {
+        return ConsultationProxy.class;
+    }
+}
diff --git a/services/consultation/client/src/main/java/org/collectionspace/services/client/ConsultationProxy.java b/services/consultation/client/src/main/java/org/collectionspace/services/client/ConsultationProxy.java
new file mode 100644 (file)
index 0000000..b36b2a0
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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
+ *
+ * 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 javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+
+/**
+ * ConsultationProxy.java
+ */
+@Path(ConsultationClient.SERVICE_PATH_PROXY)
+@Produces({"application/xml"})
+@Consumes({"application/xml"})
+public interface ConsultationProxy extends CollectionSpaceCommonListPoxProxy {}
diff --git a/services/consultation/jaxb/pom.xml b/services/consultation/jaxb/pom.xml
new file mode 100644 (file)
index 0000000..98cc855
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <artifactId>org.collectionspace.services.consultation</artifactId>
+    <groupId>org.collectionspace.services</groupId>
+    <version>${revision}</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>org.collectionspace.services.consultation.jaxb</artifactId>
+  <name>services.consultation.jaxb</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.collectionspace.services</groupId>
+      <artifactId>org.collectionspace.services.jaxb</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <finalName>collectionspace-services-consultation-jaxb</finalName>
+    <defaultGoal>install</defaultGoal>
+    <plugins>
+      <plugin>
+        <groupId>org.jvnet.jaxb2.maven2</groupId>
+        <artifactId>maven-jaxb2-plugin</artifactId>
+      </plugin>
+    </plugins>
+  </build>
+</project>
\ No newline at end of file
diff --git a/services/consultation/jaxb/src/main/resources/consultations_common.xsd b/services/consultation/jaxb/src/main/resources/consultations_common.xsd
new file mode 100644 (file)
index 0000000..0f1af8b
--- /dev/null
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+
+<!--
+    Consultation schema (XSD)
+
+    Entity  : Consultation
+    Part    : Common
+    Used for: JAXB binding between XML and Java objects
+-->
+
+<xs:schema
+  xmlns:xs="http://www.w3.org/2001/XMLSchema"
+  xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+  jaxb:version="2.0" elementFormDefault="unqualified"
+  xmlns="http://collectionspace.org/services/consultation"
+  targetNamespace="http://collectionspace.org/services/consultation"
+  version="0.1"
+>
+
+  <!--  Consultation Information Group -->
+  <xs:element name="consultations_common">
+    <xs:complexType>
+      <xs:sequence>
+        <xs:element name="consultationNumber" type="xs:string" />
+        <xs:element name="consultationDate" type="xs:date" />
+        <xs:element name="reason" type="xs:string" />
+        <xs:element name="note" type="notes" />
+
+        <xs:element name="consultationLogGroupList" type="consultationLogGroupList" />
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:complexType name="notes">
+    <xs:sequence>
+      <xs:element name="note" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="consultationLogGroupList">
+    <xs:sequence>
+      <xs:element name="consultationLogGroup" type="consultationLogGroup" minOccurs="0" maxOccurs="unbounded" />
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="consultationLogGroup">
+    <xs:sequence>
+      <xs:element name="consultType" type="xs:string" />
+      <xs:element name="consultParties" type="consultParties" />
+      <xs:element name="consultStatus" type="xs:string" />
+      <xs:element name="consultDate" type="xs:date" />
+      <xs:element name="consultNote" type="xs:string" />
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="consultParties">
+    <xs:sequence>
+      <xs:element name="consultParty" type="xs:string" minOccurs="0" maxOccurs="unbounded" />
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
\ No newline at end of file
diff --git a/services/consultation/pom.xml b/services/consultation/pom.xml
new file mode 100644 (file)
index 0000000..d32e28c
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <parent>
+    <groupId>org.collectionspace.services</groupId>
+    <artifactId>org.collectionspace.services.main</artifactId>
+    <version>${revision}</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>org.collectionspace.services.consultation</artifactId>
+  <name>services.consultation</name>
+  <packaging>pom</packaging>
+
+  <properties>
+    <!-- spotless 2.30.0 is the last version that supports java 8 -->
+    <spotless.version>2.30.0</spotless.version>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>com.diffplug.spotless</groupId>
+        <artifactId>spotless-maven-plugin</artifactId>
+        <version>${spotless.version}</version>
+        <configuration>
+          <formats>
+            <!-- you can define as many formats as you want, each is independent -->
+            <format>
+              <includes>
+                <include>src/main/java/**/*.java</include>
+                <include>src/test/java/**/*.java</include>
+              </includes>
+              <trimTrailingWhitespace />
+              <endWithNewline />
+              <indent>
+                <spaces>true</spaces>
+                <spacesPerTab>4</spacesPerTab>
+              </indent>
+            </format>
+          </formats>
+          <!-- define a language-specific format -->
+          <java>
+            <palantirJavaFormat />
+          </java>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+
+  <modules>
+    <module>jaxb</module>
+    <module>service</module>
+    <module>client</module>
+  </modules>
+
+</project>
\ No newline at end of file
diff --git a/services/consultation/service/pom.xml b/services/consultation/service/pom.xml
new file mode 100644 (file)
index 0000000..67491af
--- /dev/null
@@ -0,0 +1,89 @@
+<?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.consultation</artifactId>
+    <version>${revision}</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>org.collectionspace.services.consultation.service</artifactId>
+  <name>services.consultation.service</name>
+  <packaging>jar</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.collectionspace.services</groupId>
+      <artifactId>org.collectionspace.services.common</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.collectionspace.services</groupId>
+      <artifactId>org.collectionspace.services.consultation.jaxb</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.collectionspace.services</groupId>
+      <artifactId>org.collectionspace.services.consultation.client</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <!-- External dependencies -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.testng</groupId>
+      <artifactId>testng</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- javax -->
+    <dependency>
+      <groupId>javax.security</groupId>
+      <artifactId>jaas</artifactId>
+      <version>1.0.01</version>
+      <scope>provided</scope>
+    </dependency>
+
+    <!-- jboss -->
+    <dependency>
+      <groupId>org.jboss.resteasy</groupId>
+      <artifactId>resteasy-jaxrs</artifactId>
+      <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-consultation</finalName>
+  </build>
+</project>
diff --git a/services/consultation/service/src/main/java/org/collectionspace/services/consultation/ConsultationResource.java b/services/consultation/service/src/main/java/org/collectionspace/services/consultation/ConsultationResource.java
new file mode 100644 (file)
index 0000000..4333cc6
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ *  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
+ *
+ *  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.consultation;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import org.collectionspace.services.client.ConsultationClient;
+import org.collectionspace.services.common.NuxeoBasedResource;
+
+@Path(ConsultationClient.SERVICE_PATH)
+@Consumes("application/xml")
+@Produces("application/xml")
+public class ConsultationResource extends NuxeoBasedResource {
+
+    @Override
+    protected String getVersionString() {
+        return "$LastChangedRevision$";
+    }
+
+    @Override
+    public String getServiceName() {
+        return ConsultationClient.SERVICE_NAME;
+    }
+
+    @Override
+    public Class<ConsultationsCommon> getCommonPartClass() {
+        return ConsultationsCommon.class;
+    }
+}
diff --git a/services/consultation/service/src/main/java/org/collectionspace/services/consultation/nuxeo/ConsultationDocumentModelHandler.java b/services/consultation/service/src/main/java/org/collectionspace/services/consultation/nuxeo/ConsultationDocumentModelHandler.java
new file mode 100644 (file)
index 0000000..1fd08da
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ *  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
+ *
+ *  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.consultation.nuxeo;
+
+import org.collectionspace.services.consultation.ConsultationsCommon;
+import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler;
+
+/**
+ * ConsultationDocumentModelHandler
+ */
+public class ConsultationDocumentModelHandler extends NuxeoDocumentModelHandler<ConsultationsCommon> {}
diff --git a/services/consultation/service/src/main/java/org/collectionspace/services/consultation/nuxeo/ConsultationValidatorHandler.java b/services/consultation/service/src/main/java/org/collectionspace/services/consultation/nuxeo/ConsultationValidatorHandler.java
new file mode 100644 (file)
index 0000000..fcc91c5
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * 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
+ *
+ * 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.consultation.nuxeo;
+
+import org.collectionspace.services.client.PoxPayloadIn;
+import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.common.document.InvalidDocumentException;
+import org.collectionspace.services.common.document.ValidatorHandlerImpl;
+import org.collectionspace.services.consultation.ConsultationsCommon;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ConsultationValidatorHandler extends ValidatorHandlerImpl<PoxPayloadIn, PoxPayloadOut> {
+
+    private static final Logger logger = LoggerFactory.getLogger(ConsultationValidatorHandler.class);
+
+    private static final String COMMON_PART_MISSING = "Validation exception: nagprainventories_common part is missing";
+    private static final String CONSULTATION_NUMBER_MISSING =
+            "Validation exception: The consultation field \"consultationNumber\" cannot be empty or missing";
+
+    @Override
+    protected Class<?> getCommonPartClass() {
+        return ConsultationsCommon.class;
+    }
+
+    @Override
+    protected void handleCreate() throws InvalidDocumentException {
+        final ConsultationsCommon consultation = (ConsultationsCommon) getCommonPart();
+        if (consultation == null) {
+            logger.error(COMMON_PART_MISSING);
+            throw new InvalidDocumentException(COMMON_PART_MISSING);
+        }
+
+        final String consultationNumber = consultation.getConsultationNumber();
+        if (consultationNumber == null || consultationNumber.isEmpty()) {
+            logger.error(CONSULTATION_NUMBER_MISSING);
+            throw new InvalidDocumentException(CONSULTATION_NUMBER_MISSING);
+        }
+    }
+
+    @Override
+    protected void handleGet() {}
+
+    @Override
+    protected void handleGetAll() {}
+
+    @Override
+    protected void handleUpdate() {}
+
+    @Override
+    protected void handleDelete() {}
+}
index ea2552fc98428bd6fd11a9449510263b53a50ccc..5ca7ab40ec0d9dfdd86410e52945336122943664 100644 (file)
                <module>nagprainventory</module>
                <module>summarydocumentation</module>
                <module>heldintrust</module>
+               <module>consultation</module>
                <module>IntegrationTests</module>
                <module>PerformanceTests</module>
                <module>security</module>