From 7b1d38e177256f2492722f2ac868ab2ff41858f1 Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Wed, 8 May 2024 20:23:57 -0600 Subject: [PATCH] Add DutyOfCare (#405) --- services/JaxRsServiceProvider/pom.xml | 11 +- .../CollectionSpaceJaxRsApplication.java | 3 +- .../db/postgresql/load_id_generators.sql | 36 ++ services/dutyofcare/build.xml | 108 ++++ services/dutyofcare/client/pom.xml | 81 +++ .../services/client/DutyofcareClient.java | 52 ++ .../services/client/DutyofcareProxy.java | 27 + .../client/DutyofcareServiceTest.java | 497 ++++++++++++++++++ services/dutyofcare/jaxb/pom.xml | 33 ++ .../services/DutyofcareJAXBSchema.java | 17 + .../DutyofcareListItemJAXBSchema.java | 20 + .../src/main/resources/dutyofcares_common.xsd | 74 +++ services/dutyofcare/pom.xml | 57 ++ services/dutyofcare/service/pom.xml | 92 ++++ .../dutyofcare/DutyofcareResource.java | 54 ++ .../dutyofcare/nuxeo/DutyofcareConstants.java | 33 ++ .../nuxeo/DutyofcareDocumentModelHandler.java | 30 ++ .../nuxeo/DutyofcareValidatorHandler.java | 29 + services/pom.xml | 1 + 19 files changed, 1251 insertions(+), 4 deletions(-) create mode 100644 services/dutyofcare/build.xml create mode 100644 services/dutyofcare/client/pom.xml create mode 100644 services/dutyofcare/client/src/main/java/org/collectionspace/services/client/DutyofcareClient.java create mode 100644 services/dutyofcare/client/src/main/java/org/collectionspace/services/client/DutyofcareProxy.java create mode 100644 services/dutyofcare/client/src/test/java/org/collectionspace/services/client/DutyofcareServiceTest.java create mode 100644 services/dutyofcare/jaxb/pom.xml create mode 100644 services/dutyofcare/jaxb/src/main/java/org/collectionspace/services/DutyofcareJAXBSchema.java create mode 100644 services/dutyofcare/jaxb/src/main/java/org/collectionspace/services/DutyofcareListItemJAXBSchema.java create mode 100644 services/dutyofcare/jaxb/src/main/resources/dutyofcares_common.xsd create mode 100644 services/dutyofcare/pom.xml create mode 100644 services/dutyofcare/service/pom.xml create mode 100644 services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/DutyofcareResource.java create mode 100644 services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/nuxeo/DutyofcareConstants.java create mode 100644 services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/nuxeo/DutyofcareDocumentModelHandler.java create mode 100644 services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/nuxeo/DutyofcareValidatorHandler.java diff --git a/services/JaxRsServiceProvider/pom.xml b/services/JaxRsServiceProvider/pom.xml index d68a5ef9c..a219239ab 100644 --- a/services/JaxRsServiceProvider/pom.xml +++ b/services/JaxRsServiceProvider/pom.xml @@ -415,9 +415,14 @@ ${project.version} - org.collectionspace.services - org.collectionspace.services.chronology.service - ${project.version} + org.collectionspace.services + org.collectionspace.services.chronology.service + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.dutyofcare.service + ${project.version} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/dutyofcare/client/pom.xml b/services/dutyofcare/client/pom.xml new file mode 100644 index 000000000..c5275152a --- /dev/null +++ b/services/dutyofcare/client/pom.xml @@ -0,0 +1,81 @@ + + + + org.collectionspace.services + org.collectionspace.services.dutyofcare + ${revision} + + + 4.0.0 + org.collectionspace.services.dutyofcare.client + services.dutyofcare.client + + + + + org.collectionspace.services + org.collectionspace.services.authority.jaxb + true + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.common + true + + + org.collectionspace.services + org.collectionspace.services.client + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.dutyofcare.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.person.client + ${project.version} + + + + org.testng + testng + + + org.jboss.resteasy + resteasy-jaxrs + + + + tjws + webserver + + + + + org.jboss.resteasy + resteasy-jaxb-provider + + + org.jboss.resteasy + resteasy-multipart-provider + + + commons-httpclient + commons-httpclient + + + + + collectionspace-services-dutyofcare-client + + diff --git a/services/dutyofcare/client/src/main/java/org/collectionspace/services/client/DutyofcareClient.java b/services/dutyofcare/client/src/main/java/org/collectionspace/services/client/DutyofcareClient.java new file mode 100644 index 000000000..56d7da228 --- /dev/null +++ b/services/dutyofcare/client/src/main/java/org/collectionspace/services/client/DutyofcareClient.java @@ -0,0 +1,52 @@ +/** + * 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.dutyofcare.DutyofcaresCommon; + +/** + * DutyofcareClient.java + */ +public class DutyofcareClient extends AbstractCommonListPoxServiceClientImpl { + + public static final String SERVICE_NAME = "dutyofcares"; + public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; + public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT; + public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/"; + public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME; + + public DutyofcareClient() throws Exception { + super(); + } + + public DutyofcareClient(String clientPropertiesFilename) throws Exception { + super(clientPropertiesFilename); + } + + @Override + public String getServicePathComponent() { + return SERVICE_PATH_COMPONENT; + } + + @Override + public String getServiceName() { + return SERVICE_NAME; + } + + @Override + public Class getProxyClass() { + return DutyofcareProxy.class; + } +} diff --git a/services/dutyofcare/client/src/main/java/org/collectionspace/services/client/DutyofcareProxy.java b/services/dutyofcare/client/src/main/java/org/collectionspace/services/client/DutyofcareProxy.java new file mode 100644 index 000000000..43e6ecc40 --- /dev/null +++ b/services/dutyofcare/client/src/main/java/org/collectionspace/services/client/DutyofcareProxy.java @@ -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; + +/** + * DutyofcareProxy.java + */ +@Path(DutyofcareClient.SERVICE_PATH_PROXY) +@Produces({"application/xml"}) +@Consumes({"application/xml"}) +public interface DutyofcareProxy extends CollectionSpaceCommonListPoxProxy {} diff --git a/services/dutyofcare/client/src/test/java/org/collectionspace/services/client/DutyofcareServiceTest.java b/services/dutyofcare/client/src/test/java/org/collectionspace/services/client/DutyofcareServiceTest.java new file mode 100644 index 000000000..67f5d561c --- /dev/null +++ b/services/dutyofcare/client/src/test/java/org/collectionspace/services/client/DutyofcareServiceTest.java @@ -0,0 +1,497 @@ +/* + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright © 2009 Regents of the University of California + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.client; + +import javax.ws.rs.core.Response; +import org.collectionspace.services.client.test.AbstractPoxServiceTestImpl; +import org.collectionspace.services.client.test.ServiceRequestType; +import org.collectionspace.services.dutyofcare.DutyofcaresCommon; +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testng.Assert; + +public class DutyofcareServiceTest extends AbstractPoxServiceTestImpl { + + private final Logger logger = LoggerFactory.getLogger(DutyofcareServiceTest.class); + + /** The service path component. */ + final String SERVICE_NAME = "dutyofcares"; + + final String SERVICE_PATH_COMPONENT = "dutyofcares"; + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() throws Exception { + return new DutyofcareClient(); + } + + @Override + protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception { + return new DutyofcareClient(clientPropertiesFilename); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getAbstractCommonList(org.jboss.resteasy.client.ClientResponse) + */ + @Override + protected AbstractCommonList getCommonList(Response response) { + return response.readEntity(AbstractCommonList.class); + } + + // --------------------------------------------------------------- + // CRUD tests : CREATE tests + // --------------------------------------------------------------- + + // Success outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.ServiceTest#create(java.lang.String) + */ + @Override + public void create(String testName) throws Exception { + // Perform setup, such as initializing the type of service request + // (e.g. CREATE, DELETE), its valid and expected status codes, and + // its associated HTTP method name (e.g. POST, DELETE). + setupCreate(); + + // Submit the request to the service and store the response. + DutyofcareClient client = new DutyofcareClient(); + String identifier = createIdentifier(); + PoxPayloadOut multipart = createDutyofcareInstance(identifier); + String newID = null; + Response res = client.create(multipart); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + // + // Specifically: + // Does it fall within the set of valid status codes? + // Does it exactly match the expected status code? + logger.debug(testName + ": status = " + statusCode); + Assert.assertTrue( + testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + + newID = extractId(res); + } finally { + if (res != null) { + res.close(); + } + } + + // Store the ID returned from the first resource created + // for additional tests below. + if (knownResourceId == null) { + knownResourceId = newID; + logger.debug(testName + ": knownResourceId=" + knownResourceId); + } + + // Store the IDs from every resource created by tests, + // so they can be deleted after tests have been run. + allResourceIdsCreated.add(newID); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String) + */ + @Override + public void createList(String testName) throws Exception { + for (int i = 0; i < 3; i++) { + create(testName); + } + } + + // --------------------------------------------------------------- + // CRUD tests : READ tests + // --------------------------------------------------------------- + + // Success outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#read(java.lang.String) + */ + @Override + public void read(String testName) throws Exception { + // Perform setup. + setupRead(); + + // Submit the request to the service and store the response. + DutyofcareClient client = new DutyofcareClient(); + Response res = client.read(knownResourceId); + PoxPayloadIn input; + try { + assertStatusCode(res, testName); + input = new PoxPayloadIn(res.readEntity(String.class)); + } finally { + if (res != null) { + res.close(); + } + } + + // Get the common part of the response and verify that it is not null. + PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName()); + DutyofcaresCommon dutyofcareCommon = null; + if (payloadInputPart != null) { + dutyofcareCommon = (DutyofcaresCommon) payloadInputPart.getBody(); + } + Assert.assertNotNull(dutyofcareCommon); + } + + // Failure outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String) + */ + @Override + public void readNonExistent(String testName) throws Exception { + // Perform setup. + setupReadNonExistent(); + + // Submit the request to the service and store the response. + DutyofcareClient client = new DutyofcareClient(); + Response res = client.read(NON_EXISTENT_ID); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + logger.debug(testName + ": status = " + statusCode); + Assert.assertTrue( + testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + } finally { + if (res != null) { + res.close(); + } + } + } + + // --------------------------------------------------------------- + // CRUD tests : READ_LIST tests + // --------------------------------------------------------------- + + // Success outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readList(java.lang.String) + */ + @Override + public void readList(String testName) throws Exception { + // Perform setup. + setupReadList(); + + // Submit the request to the service and store the response. + AbstractCommonList list; + DutyofcareClient client = new DutyofcareClient(); + Response res = client.readList(); + assertStatusCode(res, testName); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + logger.debug(testName + ": status = " + statusCode); + Assert.assertTrue( + testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + + list = res.readEntity(getCommonListType()); + } finally { + res.close(); + } + + // Optionally output additional data about list members for debugging. + AbstractCommonListUtils.ListItemsInAbstractCommonList(list, logger, testName); + } + + // Failure outcomes + // None at present. + + // --------------------------------------------------------------- + // CRUD tests : UPDATE tests + // --------------------------------------------------------------- + + // Success outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#update(java.lang.String) + */ + @Override + public void update(String testName) throws Exception { + // Perform setup. + setupRead(); + + // Retrieve the contents of a resource to update. + DutyofcareClient client = new DutyofcareClient(); + Response res = client.read(knownResourceId); + PoxPayloadIn input; + try { + assertStatusCode(res, testName); + input = new PoxPayloadIn(res.readEntity(String.class)); + logger.debug("got object to update with ID: " + knownResourceId); + } finally { + if (res != null) { + res.close(); + } + } + + // Extract the common part from the response. + PayloadInputPart payloadInputPart = input.getPart(client.getCommonPartName()); + DutyofcaresCommon dutyofcareCommon = null; + if (payloadInputPart != null) { + dutyofcareCommon = (DutyofcaresCommon) payloadInputPart.getBody(); + } + Assert.assertNotNull(dutyofcareCommon); + + // Update the content of this resource. + dutyofcareCommon.setDutyOfCareNumber("updated-" + dutyofcareCommon.getDutyOfCareNumber()); + + logger.debug("to be updated object"); + logger.debug(objectAsXmlString(dutyofcareCommon, DutyofcaresCommon.class)); + + setupUpdate(); + + // Submit the updated common part in an update request to the service + // and store the response. + PoxPayloadOut output = new PoxPayloadOut(this.getServicePathComponent()); + PayloadOutputPart commonPart = output.addPart(client.getCommonPartName(), dutyofcareCommon); + res = client.update(knownResourceId, output); + try { + assertStatusCode(res, testName); + int statusCode = res.getStatus(); + // Check the status code of the response: does it match the expected response(s)? + logger.debug(testName + ": status = " + statusCode); + Assert.assertTrue( + testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + input = new PoxPayloadIn(res.readEntity(String.class)); + } finally { + if (res != null) { + res.close(); + } + } + + // Extract the updated common part from the response. + payloadInputPart = input.getPart(client.getCommonPartName()); + DutyofcaresCommon updatedDutyofcareCommon = null; + if (payloadInputPart != null) { + updatedDutyofcareCommon = (DutyofcaresCommon) payloadInputPart.getBody(); + } + Assert.assertNotNull(updatedDutyofcareCommon); + + // Check selected fields in the updated common part. + Assert.assertEquals( + updatedDutyofcareCommon.getDutyOfCareNumber(), + dutyofcareCommon.getDutyOfCareNumber(), + "Data in updated object did not match submitted data."); + } + + @Override + public void updateNonExistent(String testName) throws Exception { + // Perform setup. + setupUpdateNonExistent(); + + // Submit the request to the service and store the response. + // Note: The ID used in this 'create' call may be arbitrary. + // The only relevant ID may be the one used in update(), below. + DutyofcareClient client = new DutyofcareClient(); + PoxPayloadOut multipart = createDutyofcareInstance(NON_EXISTENT_ID); + Response res = client.update(NON_EXISTENT_ID, multipart); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + logger.debug(testName + ": status = " + statusCode); + Assert.assertTrue( + testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + } finally { + if (res != null) { + res.close(); + } + } + } + + // --------------------------------------------------------------- + // CRUD tests : DELETE tests + // --------------------------------------------------------------- + + // Success outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#delete(java.lang.String) + */ + @Override + public void delete(String testName) throws Exception { + // Perform setup. + setupDelete(); + + // Submit the request to the service and store the response. + DutyofcareClient client = new DutyofcareClient(); + Response res = client.delete(knownResourceId); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + logger.debug(testName + ": status = " + statusCode); + Assert.assertTrue( + testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + } finally { + if (res != null) { + res.close(); + } + } + } + + // Failure outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String) + */ + @Override + public void deleteNonExistent(String testName) throws Exception { + // Perform setup. + setupDeleteNonExistent(); + + // Submit the request to the service and store the response. + DutyofcareClient client = new DutyofcareClient(); + Response res = client.delete(NON_EXISTENT_ID); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + logger.debug(testName + ": status = " + statusCode); + Assert.assertTrue( + testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + } finally { + if (res != null) { + res.close(); + } + } + } + + // --------------------------------------------------------------- + // Utility tests : tests of code used in tests above + // --------------------------------------------------------------- + + /** + * Tests the code for manually submitting data that is used by several + * of the methods above. + */ + public void testSubmitRequest() { + + // Expected status code: 200 OK + final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); + + // Submit the request to the service and store the response. + String method = ServiceRequestType.READ.httpMethodName(); + String url = getResourceURL(knownResourceId); + int statusCode = submitRequest(method, url); + + // Check the status code of the response: does it match + // the expected response(s)? + logger.debug("testSubmitRequest: url=" + url + " status=" + statusCode); + Assert.assertEquals(statusCode, EXPECTED_STATUS); + } + + // --------------------------------------------------------------- + // Utility methods used by tests above + // --------------------------------------------------------------- + + @Override + public String getServiceName() { + return SERVICE_NAME; + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent() + */ + @Override + public String getServicePathComponent() { + return SERVICE_PATH_COMPONENT; + } + + @Override + protected PoxPayloadOut createInstance(String identifier) throws Exception { + return createDutyofcareInstance(identifier); + } + + /** + * Creates the dutyofcare instance. + * + * @param dutyofcareNumber the exhibition number + * @return the multipart output + * @throws Exception + */ + private PoxPayloadOut createDutyofcareInstance(String dutyofcareNumber) throws Exception { + DutyofcaresCommon dutyofcareCommon = new DutyofcaresCommon(); + dutyofcareCommon.setDutyOfCareNumber(dutyofcareNumber); + + PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent()); + PayloadOutputPart commonPart = multipart.addPart(new DutyofcareClient().getCommonPartName(), dutyofcareCommon); + + logger.debug("to be created, dutyofcare common"); + logger.debug(objectAsXmlString(dutyofcareCommon, DutyofcaresCommon.class)); + + return multipart; + } + + @Override + public void CRUDTests(String testName) { + // TODO Auto-generated method stub + + } + + @Override + protected PoxPayloadOut createInstance(String commonPartName, String identifier) throws Exception { + return createDutyofcareInstance(identifier); + } + + @Override + protected DutyofcaresCommon updateInstance(DutyofcaresCommon commonPartObject) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected void compareUpdatedInstances(DutyofcaresCommon original, DutyofcaresCommon updated) { + // TODO Auto-generated method stub + } +} diff --git a/services/dutyofcare/jaxb/pom.xml b/services/dutyofcare/jaxb/pom.xml new file mode 100644 index 000000000..1b85ef8b8 --- /dev/null +++ b/services/dutyofcare/jaxb/pom.xml @@ -0,0 +1,33 @@ + + + + org.collectionspace.services.dutyofcare + org.collectionspace.services + ${revision} + + + 4.0.0 + org.collectionspace.services.dutyofcare.jaxb + services.dutyofcare.jaxb + + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + + + collectionspace-services-dutyofcare-jaxb + install + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + + + + diff --git a/services/dutyofcare/jaxb/src/main/java/org/collectionspace/services/DutyofcareJAXBSchema.java b/services/dutyofcare/jaxb/src/main/java/org/collectionspace/services/DutyofcareJAXBSchema.java new file mode 100644 index 000000000..17ce33c55 --- /dev/null +++ b/services/dutyofcare/jaxb/src/main/java/org/collectionspace/services/DutyofcareJAXBSchema.java @@ -0,0 +1,17 @@ +/** + * 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; + +public interface DutyofcareJAXBSchema {} diff --git a/services/dutyofcare/jaxb/src/main/java/org/collectionspace/services/DutyofcareListItemJAXBSchema.java b/services/dutyofcare/jaxb/src/main/java/org/collectionspace/services/DutyofcareListItemJAXBSchema.java new file mode 100644 index 000000000..64a05c633 --- /dev/null +++ b/services/dutyofcare/jaxb/src/main/java/org/collectionspace/services/DutyofcareListItemJAXBSchema.java @@ -0,0 +1,20 @@ +/** + * 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; + +public interface DutyofcareListItemJAXBSchema { + String CSID = "csid"; + String URI = "url"; +} diff --git a/services/dutyofcare/jaxb/src/main/resources/dutyofcares_common.xsd b/services/dutyofcare/jaxb/src/main/resources/dutyofcares_common.xsd new file mode 100644 index 000000000..4c99b4660 --- /dev/null +++ b/services/dutyofcare/jaxb/src/main/resources/dutyofcares_common.xsd @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/dutyofcare/pom.xml b/services/dutyofcare/pom.xml new file mode 100644 index 000000000..63246bbd6 --- /dev/null +++ b/services/dutyofcare/pom.xml @@ -0,0 +1,57 @@ + + + + org.collectionspace.services + org.collectionspace.services.main + ${revision} + + + 4.0.0 + org.collectionspace.services.dutyofcare + services.dutyofcare + pom + + + + 2.30.0 + + + + + + com.diffplug.spotless + spotless-maven-plugin + ${spotless.version} + + + + + + src/main/java/**/*.java + src/test/java/**/*.java + + + + + true + 4 + + + + + + + + + + + + + + jaxb + service + client + + + diff --git a/services/dutyofcare/service/pom.xml b/services/dutyofcare/service/pom.xml new file mode 100644 index 000000000..478e07674 --- /dev/null +++ b/services/dutyofcare/service/pom.xml @@ -0,0 +1,92 @@ + + + + + org.collectionspace.services + org.collectionspace.services.dutyofcare + ${revision} + + + 4.0.0 + org.collectionspace.services.dutyofcare.service + services.dutyofcare.service + jar + + + + org.collectionspace.services + org.collectionspace.services.common + + + org.collectionspace.services + org.collectionspace.services.dutyofcare.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.dutyofcare.client + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.collectionobject.jaxb + ${project.version} + + + + junit + junit + test + + + org.testng + testng + + + + + javax.security + jaas + 1.0.01 + provided + + + + + org.jboss.resteasy + resteasy-jaxrs + + + tjws + webserver + + + + + org.jboss.resteasy + resteasy-jaxb-provider + + + org.jboss.resteasy + resteasy-multipart-provider + + + + + org.nuxeo.ecm.core + nuxeo-core-api + + + jboss-remoting + jboss + + + + + + + + collectionspace-services-dutyofcare + + diff --git a/services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/DutyofcareResource.java b/services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/DutyofcareResource.java new file mode 100644 index 000000000..0ce4b6e30 --- /dev/null +++ b/services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/DutyofcareResource.java @@ -0,0 +1,54 @@ +/** + * 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.dutyofcare; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import org.collectionspace.services.client.DutyofcareClient; +import org.collectionspace.services.common.NuxeoBasedResource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Path(DutyofcareClient.SERVICE_PATH) +@Consumes("application/xml") +@Produces("application/xml") +public class DutyofcareResource extends NuxeoBasedResource { + + final Logger logger = LoggerFactory.getLogger(DutyofcareResource.class); + + @Override + protected String getVersionString() { + final String lastChangeRevision = "$LastChangedRevision$"; + return lastChangeRevision; + } + + @Override + public String getServiceName() { + return DutyofcareClient.SERVICE_NAME; + } + + @Override + public Class getCommonPartClass() { + return DutyofcaresCommon.class; + } +} diff --git a/services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/nuxeo/DutyofcareConstants.java b/services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/nuxeo/DutyofcareConstants.java new file mode 100644 index 000000000..7660db2d2 --- /dev/null +++ b/services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/nuxeo/DutyofcareConstants.java @@ -0,0 +1,33 @@ +/** + * 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.dutyofcare.nuxeo; + +/** + * DutyofcareConstants specifies constants for the Dutyofcare service + * + */ +public class DutyofcareConstants { + + public static final String NUXEO_DOCTYPE = "Dutyofcare"; + public static final String NUXEO_SCHEMA_NAME = "dutyofcare"; + public static final String NUXEO_DC_TITLE = "CollectionSpace-Dutyofcare"; +} diff --git a/services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/nuxeo/DutyofcareDocumentModelHandler.java b/services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/nuxeo/DutyofcareDocumentModelHandler.java new file mode 100644 index 000000000..6a0297446 --- /dev/null +++ b/services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/nuxeo/DutyofcareDocumentModelHandler.java @@ -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.dutyofcare.nuxeo; + +import org.collectionspace.services.dutyofcare.DutyofcaresCommon; +import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler; + +/** + * DutyofcareDocumentModelHandler + */ +public class DutyofcareDocumentModelHandler extends NuxeoDocumentModelHandler {} diff --git a/services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/nuxeo/DutyofcareValidatorHandler.java b/services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/nuxeo/DutyofcareValidatorHandler.java new file mode 100644 index 000000000..ece48694e --- /dev/null +++ b/services/dutyofcare/service/src/main/java/org/collectionspace/services/dutyofcare/nuxeo/DutyofcareValidatorHandler.java @@ -0,0 +1,29 @@ +/** + * 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.dutyofcare.nuxeo; + +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; + +public class DutyofcareValidatorHandler implements ValidatorHandler { + + @Override + public void validate(Action action, ServiceContext ctx) throws InvalidDocumentException { + // TODO Auto-generated method stub + System.out.println("DutyofcareValidatorHandler executed."); + } +} diff --git a/services/pom.xml b/services/pom.xml index a2019c2ec..f080fdd9d 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -73,6 +73,7 @@ transport conditioncheck conservation + dutyofcare valuationcontrol objectexit propagation -- 2.47.3