From 31fd6782d23f058b971e8373e364dfe61e813a96 Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Fri, 3 Jun 2022 23:21:05 -0600 Subject: [PATCH] DRYD-1036: IterationReport Procedure (#295) * DRYD-1036: Create iterationreport procedure * Drop deprecated module --- services/JaxRsServiceProvider/pom.xml | 5 + .../CollectionSpaceJaxRsApplication.java | 2 + .../db/postgresql/load_id_generators.sql | 36 ++ services/iterationreport/build.xml | 124 ++++ services/iterationreport/client/pom.xml | 81 +++ .../client/IterationreportClient.java | 53 ++ .../services/client/IterationreportProxy.java | 28 + .../test/IterationreportServiceTest.java | 553 ++++++++++++++++++ services/iterationreport/jaxb/pom.xml | 33 ++ .../services/IterationreportJAXBSchema.java | 18 + .../IterationreportListItemJAXBSchema.java | 20 + .../resources/iterationreports_common.xsd | 34 ++ services/iterationreport/pom.xml | 20 + services/iterationreport/service/pom.xml | 94 +++ .../IterationreportResource.java | 56 ++ .../nuxeo/IterationreportConstants.java | 33 ++ .../IterationreportDocumentModelHandler.java | 32 + .../IterationreportValidatorHandler.java | 32 + .../test/IterationreportServiceTest.java | 29 + services/pom.xml | 1 + 20 files changed, 1284 insertions(+) create mode 100644 services/iterationreport/build.xml create mode 100644 services/iterationreport/client/pom.xml create mode 100644 services/iterationreport/client/src/main/java/org/collectionspace/services/client/IterationreportClient.java create mode 100644 services/iterationreport/client/src/main/java/org/collectionspace/services/client/IterationreportProxy.java create mode 100644 services/iterationreport/client/src/test/java/org/collectionspace/services/client/test/IterationreportServiceTest.java create mode 100644 services/iterationreport/jaxb/pom.xml create mode 100644 services/iterationreport/jaxb/src/main/java/org/collectionspace/services/IterationreportJAXBSchema.java create mode 100644 services/iterationreport/jaxb/src/main/java/org/collectionspace/services/IterationreportListItemJAXBSchema.java create mode 100644 services/iterationreport/jaxb/src/main/resources/iterationreports_common.xsd create mode 100644 services/iterationreport/pom.xml create mode 100644 services/iterationreport/service/pom.xml create mode 100644 services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/IterationreportResource.java create mode 100644 services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/nuxeo/IterationreportConstants.java create mode 100644 services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/nuxeo/IterationreportDocumentModelHandler.java create mode 100644 services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/nuxeo/IterationreportValidatorHandler.java create mode 100644 services/iterationreport/service/src/test/java/org/collectionspace/services/test/IterationreportServiceTest.java diff --git a/services/JaxRsServiceProvider/pom.xml b/services/JaxRsServiceProvider/pom.xml index b866a2a7e..b8998395f 100644 --- a/services/JaxRsServiceProvider/pom.xml +++ b/services/JaxRsServiceProvider/pom.xml @@ -393,6 +393,11 @@ org.collectionspace.services.workflow.service ${project.version} + + org.collectionspace.services + org.collectionspace.services.iterationreport.service + ${project.version} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/iterationreport/client/pom.xml b/services/iterationreport/client/pom.xml new file mode 100644 index 000000000..07d00e9d1 --- /dev/null +++ b/services/iterationreport/client/pom.xml @@ -0,0 +1,81 @@ + + + + org.collectionspace.services + org.collectionspace.services.iterationreport + ${revision} + + + 4.0.0 + org.collectionspace.services.iterationreport.client + services.iterationreport.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.iterationreport.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-iterationreport-client + + diff --git a/services/iterationreport/client/src/main/java/org/collectionspace/services/client/IterationreportClient.java b/services/iterationreport/client/src/main/java/org/collectionspace/services/client/IterationreportClient.java new file mode 100644 index 000000000..db147baee --- /dev/null +++ b/services/iterationreport/client/src/main/java/org/collectionspace/services/client/IterationreportClient.java @@ -0,0 +1,53 @@ +/** + * 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.iterationreport.IterationreportsCommon; + +/** + * IterationreportClient.java + */ +public class IterationreportClient extends AbstractCommonListPoxServiceClientImpl { + + public static final String SERVICE_NAME = "iterationreports"; + 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 IterationreportClient() throws Exception { + super(); + } + + public IterationreportClient(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 IterationreportProxy.class; + } + +} diff --git a/services/iterationreport/client/src/main/java/org/collectionspace/services/client/IterationreportProxy.java b/services/iterationreport/client/src/main/java/org/collectionspace/services/client/IterationreportProxy.java new file mode 100644 index 000000000..0c17a6f39 --- /dev/null +++ b/services/iterationreport/client/src/main/java/org/collectionspace/services/client/IterationreportProxy.java @@ -0,0 +1,28 @@ +/** + * 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; + +/** + * IterationreportProxy.java + */ +@Path(IterationreportClient.SERVICE_PATH_PROXY) +@Produces({"application/xml"}) +@Consumes({"application/xml"}) +public interface IterationreportProxy extends CollectionSpaceCommonListPoxProxy { +} diff --git a/services/iterationreport/client/src/test/java/org/collectionspace/services/client/test/IterationreportServiceTest.java b/services/iterationreport/client/src/test/java/org/collectionspace/services/client/test/IterationreportServiceTest.java new file mode 100644 index 000000000..0730147d5 --- /dev/null +++ b/services/iterationreport/client/src/test/java/org/collectionspace/services/client/test/IterationreportServiceTest.java @@ -0,0 +1,553 @@ +/* + * 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.client.test; + +import javax.ws.rs.core.Response; + +import org.collectionspace.services.client.AbstractCommonListUtils; +import org.collectionspace.services.client.CollectionSpaceClient; +import org.collectionspace.services.client.IterationreportClient; +import org.collectionspace.services.client.PayloadInputPart; +import org.collectionspace.services.client.PayloadOutputPart; +import org.collectionspace.services.client.PoxPayloadIn; +import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.iterationreport.IterationreportsCommon; +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testng.Assert; + +public class IterationreportServiceTest extends AbstractPoxServiceTestImpl { + + /** The logger. */ + private final String CLASS_NAME = IterationreportServiceTest.class.getName(); + private final Logger logger = LoggerFactory.getLogger(CLASS_NAME); + // Instance variables specific to this test. + /** The service path component. */ + final String SERVICE_NAME = "transports"; + final String SERVICE_PATH_COMPONENT = "transports"; + + + /* (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 + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + 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. + IterationreportClient client = new IterationreportClient(); + String identifier = createIdentifier(); + PoxPayloadOut multipart = createIterationreportInstance(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? + if (logger.isDebugEnabled()) { + 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; + if (logger.isDebugEnabled()) { + 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 + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"create"}) + 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 + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"create"}) + public void read(String testName) throws Exception { + // Perform setup. + setupRead(); + + // Submit the request to the service and store the response. + IterationreportClient client = new IterationreportClient(); + Response res = client.read(knownResourceId); + PoxPayloadIn input = null; + 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()); + IterationreportsCommon transportCommon = null; + if (payloadInputPart != null) { + transportCommon = (IterationreportsCommon) payloadInputPart.getBody(); + } + Assert.assertNotNull(transportCommon); + } + + // Failure outcomes + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readNonExistent(java.lang.String) + */ + @Override + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"read"}) + public void readNonExistent(String testName) throws Exception { + // Perform setup. + setupReadNonExistent(); + + // Submit the request to the service and store the response. + IterationreportClient client = new IterationreportClient(); + 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)? + if (logger.isDebugEnabled()) { + 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 + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"createList", "read"}) + public void readList(String testName) throws Exception { + // Perform setup. + setupReadList(); + + // Submit the request to the service and store the response. + AbstractCommonList list = null; + IterationreportClient client = new IterationreportClient(); + 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)? + if (logger.isDebugEnabled()) { + logger.debug(testName + ": status = " + statusCode); + } + Assert.assertTrue(testRequestType.isValidStatusCode(statusCode), + invalidStatusCodeMessage(testRequestType, statusCode)); + Assert.assertEquals(statusCode, testExpectedStatusCode); + + list = res.readEntity(getCommonListType()); + } finally { + if (res != null) { + res.close(); + } + } + + // Optionally output additional data about list members for debugging. + boolean iterateThroughList = true; + if(iterateThroughList && logger.isDebugEnabled()){ + 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 + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"read"}) + public void update(String testName) throws Exception { + // Perform setup. + setupRead(); + + // Retrieve the contents of a resource to update. + IterationreportClient client = new IterationreportClient(); + Response res = client.read(knownResourceId); + PoxPayloadIn input = null; + try { + assertStatusCode(res, testName); + input = new PoxPayloadIn(res.readEntity(String.class)); + if (logger.isDebugEnabled()) { + 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()); + IterationreportsCommon transportCommon = null; + if (payloadInputPart != null) { + transportCommon = (IterationreportsCommon) payloadInputPart.getBody(); + } + Assert.assertNotNull(transportCommon); + + // Update the content of this resource. + transportCommon.setIterationreportReferenceNumber("updated-" + transportCommon.getIterationreportReferenceNumber()); + + if (logger.isDebugEnabled()) { + logger.debug("to be updated object"); + logger.debug(objectAsXmlString(transportCommon, IterationreportsCommon.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(), transportCommon); + 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)? + if (logger.isDebugEnabled()) { + 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()); + IterationreportsCommon updatedIterationreportCommon = null; + if (payloadInputPart != null) { + updatedIterationreportCommon = (IterationreportsCommon) payloadInputPart.getBody(); + } + Assert.assertNotNull(updatedIterationreportCommon); + + // Check selected fields in the updated common part. + Assert.assertEquals(updatedIterationreportCommon.getIterationreportReferenceNumber(), + transportCommon.getIterationreportReferenceNumber(), + "Data in updated object did not match submitted data."); + } + + @Override + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"update", "testSubmitRequest"}) + 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. + IterationreportClient client = new IterationreportClient(); + PoxPayloadOut multipart = createIterationreportInstance(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)? + if (logger.isDebugEnabled()) { + 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 + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"}) + public void delete(String testName) throws Exception { + // Perform setup. + setupDelete(); + + // Submit the request to the service and store the response. + IterationreportClient client = new IterationreportClient(); + Response res = client.delete(knownResourceId); + try { + int statusCode = res.getStatus(); + + // Check the status code of the response: does it match + // the expected response(s)? + if (logger.isDebugEnabled()) { + 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 + // @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, + // dependsOnMethods = {"delete"}) + public void deleteNonExistent(String testName) throws Exception { + // Perform setup. + setupDeleteNonExistent(); + + // Submit the request to the service and store the response. + IterationreportClient client = new IterationreportClient(); + 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)? + if (logger.isDebugEnabled()) { + 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. + */ + // @Test(dependsOnMethods = {"create", "read"}) + 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)? + if (logger.isDebugEnabled()) { + logger.debug("testSubmitRequest: url=" + url + + " status=" + statusCode); + } + Assert.assertEquals(statusCode, EXPECTED_STATUS); + + } + + // --------------------------------------------------------------- + // Utility methods used by tests above + // --------------------------------------------------------------- + + @Override + protected PoxPayloadOut createInstance(String identifier) throws Exception { + return createIterationreportInstance(identifier); + } + + /** + * Creates the transport instance. + * + * @param transportNumber the transport number + * @return the multipart output + * @throws Exception + */ + private PoxPayloadOut createIterationreportInstance(String transportNumber) throws Exception { + + IterationreportsCommon transportCommon = new IterationreportsCommon(); + transportCommon.setIterationreportReferenceNumber(transportNumber); + // transportCommon.setDestination(getUTF8DataFragment()); + + PoxPayloadOut multipart = new PoxPayloadOut(this.getServicePathComponent()); + PayloadOutputPart commonPart = + multipart.addPart(new IterationreportClient().getCommonPartName(), transportCommon); + + if (logger.isDebugEnabled()) { + logger.debug("to be created, transport common"); + logger.debug(objectAsXmlString(transportCommon, IterationreportsCommon.class)); + } + + return multipart; + } + + @Override + public void CRUDTests(String testName) { + // TODO Auto-generated method stub + + } + + @Override + protected PoxPayloadOut createInstance(String commonPartName, + String identifier) throws Exception { + PoxPayloadOut result = createIterationreportInstance(identifier); + return result; + } + + @Override + protected IterationreportsCommon updateInstance(IterationreportsCommon commonPartObject) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected void compareUpdatedInstances(IterationreportsCommon original, + IterationreportsCommon updated) throws Exception { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getClientInstance() + */ + @Override + protected CollectionSpaceClient getClientInstance() throws Exception { + return new IterationreportClient(); + } + + @Override + protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception { + return new IterationreportClient(clientPropertiesFilename); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.test.BaseServiceTest#getServicePathComponent() + */ + @Override + protected String getServicePathComponent() throws Exception { + return SERVICE_PATH_COMPONENT; + } + + @Override + protected String getServiceName() { + return SERVICE_NAME; + } +} diff --git a/services/iterationreport/jaxb/pom.xml b/services/iterationreport/jaxb/pom.xml new file mode 100644 index 000000000..9a38c72b9 --- /dev/null +++ b/services/iterationreport/jaxb/pom.xml @@ -0,0 +1,33 @@ + + + + org.collectionspace.services.iterationreport + org.collectionspace.services + ${revision} + + + 4.0.0 + org.collectionspace.services.iterationreport.jaxb + services.iterationreport.jaxb + + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + + + collectionspace-services-iterationreport-jaxb + install + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + + + + diff --git a/services/iterationreport/jaxb/src/main/java/org/collectionspace/services/IterationreportJAXBSchema.java b/services/iterationreport/jaxb/src/main/java/org/collectionspace/services/IterationreportJAXBSchema.java new file mode 100644 index 000000000..3239b5774 --- /dev/null +++ b/services/iterationreport/jaxb/src/main/java/org/collectionspace/services/IterationreportJAXBSchema.java @@ -0,0 +1,18 @@ +/** + * 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 IterationreportJAXBSchema { +} diff --git a/services/iterationreport/jaxb/src/main/java/org/collectionspace/services/IterationreportListItemJAXBSchema.java b/services/iterationreport/jaxb/src/main/java/org/collectionspace/services/IterationreportListItemJAXBSchema.java new file mode 100644 index 000000000..1015365cf --- /dev/null +++ b/services/iterationreport/jaxb/src/main/java/org/collectionspace/services/IterationreportListItemJAXBSchema.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 IterationreportListItemJAXBSchema { + final static String CSID = "csid"; + final static String URI = "url"; +} diff --git a/services/iterationreport/jaxb/src/main/resources/iterationreports_common.xsd b/services/iterationreport/jaxb/src/main/resources/iterationreports_common.xsd new file mode 100644 index 000000000..bc75d1885 --- /dev/null +++ b/services/iterationreport/jaxb/src/main/resources/iterationreports_common.xsd @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + diff --git a/services/iterationreport/pom.xml b/services/iterationreport/pom.xml new file mode 100644 index 000000000..084f0d3ef --- /dev/null +++ b/services/iterationreport/pom.xml @@ -0,0 +1,20 @@ + + + + org.collectionspace.services + org.collectionspace.services.main + ${revision} + + + 4.0.0 + org.collectionspace.services.iterationreport + services.iterationreport + pom + + + jaxb + service + client + + + diff --git a/services/iterationreport/service/pom.xml b/services/iterationreport/service/pom.xml new file mode 100644 index 000000000..231731ce0 --- /dev/null +++ b/services/iterationreport/service/pom.xml @@ -0,0 +1,94 @@ + + + + + org.collectionspace.services + org.collectionspace.services.iterationreport + ${revision} + + + 4.0.0 + org.collectionspace.services.iterationreport.service + services.iterationreport.service + jar + + + + org.collectionspace.services + org.collectionspace.services.common + + + org.collectionspace.services + org.collectionspace.services.iterationreport.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.iterationreport.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-iterationreport + + diff --git a/services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/IterationreportResource.java b/services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/IterationreportResource.java new file mode 100644 index 000000000..9c1b9e1a6 --- /dev/null +++ b/services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/IterationreportResource.java @@ -0,0 +1,56 @@ +/** + * 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.iterationreport; + +import org.collectionspace.services.client.IterationreportClient; +import org.collectionspace.services.common.NuxeoBasedResource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +@Path(IterationreportClient.SERVICE_PATH) +@Consumes("application/xml") +@Produces("application/xml") +public class IterationreportResource extends NuxeoBasedResource { + + final Logger logger = LoggerFactory.getLogger(IterationreportResource.class); + + @Override + protected String getVersionString() { + final String lastChangeRevision = "$LastChangedRevision$"; + return lastChangeRevision; + } + + @Override + public String getServiceName() { + return IterationreportClient.SERVICE_NAME; + } + + @Override + public Class getCommonPartClass() { + return IterationreportsCommon.class; + } +} + diff --git a/services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/nuxeo/IterationreportConstants.java b/services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/nuxeo/IterationreportConstants.java new file mode 100644 index 000000000..9819d3598 --- /dev/null +++ b/services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/nuxeo/IterationreportConstants.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.iterationreport.nuxeo; + +/** + * IterationreportConstants specifies constants for the Iterationreport service + * + */ +public class IterationreportConstants { + + public final static String NUXEO_DOCTYPE = "Iterationreport"; + public final static String NUXEO_SCHEMA_NAME = "iterationreport"; + public final static String NUXEO_DC_TITLE = "CollectionSpace-Iterationreport"; +} diff --git a/services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/nuxeo/IterationreportDocumentModelHandler.java b/services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/nuxeo/IterationreportDocumentModelHandler.java new file mode 100644 index 000000000..7d0cb878c --- /dev/null +++ b/services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/nuxeo/IterationreportDocumentModelHandler.java @@ -0,0 +1,32 @@ +/** + * 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.iterationreport.nuxeo; + +import org.collectionspace.services.iterationreport.IterationreportsCommon; +import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler; + +/** + * IterationreportDocumentModelHandler + */ +public class IterationreportDocumentModelHandler + extends NuxeoDocumentModelHandler { +} diff --git a/services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/nuxeo/IterationreportValidatorHandler.java b/services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/nuxeo/IterationreportValidatorHandler.java new file mode 100644 index 000000000..f45239dc2 --- /dev/null +++ b/services/iterationreport/service/src/main/java/org/collectionspace/services/iterationreport/nuxeo/IterationreportValidatorHandler.java @@ -0,0 +1,32 @@ +/** + * 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.iterationreport.nuxeo; + +import org.collectionspace.services.common.context.ServiceContext; +import org.collectionspace.services.common.document.InvalidDocumentException; +import org.collectionspace.services.common.document.ValidatorHandler; +import org.collectionspace.services.common.document.DocumentHandler.Action; + +public class IterationreportValidatorHandler implements ValidatorHandler { + + @Override + public void validate(Action action, ServiceContext ctx) + throws InvalidDocumentException { + // TODO Auto-generated method stub + System.out.println("IterationreportValidatorHandler executed."); + + } + +} diff --git a/services/iterationreport/service/src/test/java/org/collectionspace/services/test/IterationreportServiceTest.java b/services/iterationreport/service/src/test/java/org/collectionspace/services/test/IterationreportServiceTest.java new file mode 100644 index 000000000..09c71bd14 --- /dev/null +++ b/services/iterationreport/service/src/test/java/org/collectionspace/services/test/IterationreportServiceTest.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 + + * 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.test; + +/** + * Placeholder for server-side testing of Transport service cod + */ +public class IterationreportServiceTest { + // empty +} diff --git a/services/pom.xml b/services/pom.xml index 25e519325..7271bc700 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -95,6 +95,7 @@ media uoc publicitem + iterationreport IntegrationTests PerformanceTests security -- 2.47.3