From: Laramie Crocker Date: Tue, 10 May 2011 20:24:40 +0000 (+0000) Subject: CSPACE-3899 Added basic Batch service on branch CSPACE-3899 X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=d0cb0a7c2f56cfdff66286052cf2c756c7e6d62e;p=tmp%2Fjakarta-migration.git CSPACE-3899 Added basic Batch service on branch CSPACE-3899 --- diff --git a/services/JaxRsServiceProvider/pom.xml b/services/JaxRsServiceProvider/pom.xml index 107906e63..8295c02fe 100644 --- a/services/JaxRsServiceProvider/pom.xml +++ b/services/JaxRsServiceProvider/pom.xml @@ -121,6 +121,11 @@ org.collectionspace.services.objectexit.service ${project.version} + + org.collectionspace.services + org.collectionspace.services.batch.service + ${project.version} + org.collectionspace.services org.collectionspace.services.imports.service diff --git a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java index 580ce929e..8f41d889e 100644 --- a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java +++ b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java @@ -33,6 +33,7 @@ import org.collectionspace.services.intake.IntakeResource; import org.collectionspace.services.loanin.LoaninResource; import org.collectionspace.services.loanout.LoanoutResource; import org.collectionspace.services.objectexit.ObjectExitResource; +import org.collectionspace.services.batch.BatchResource; import org.collectionspace.services.imports.ImportsResource; import org.collectionspace.services.location.LocationAuthorityResource; import org.collectionspace.services.taxonomy.TaxonomyAuthorityResource; @@ -96,6 +97,7 @@ public class CollectionSpaceJaxRsApplication extends Application { singletons.add(new LoanoutResource()); singletons.add(new AcquisitionResource()); singletons.add(new ObjectExitResource()); + singletons.add(new BatchResource()); singletons.add(new ImportsResource()); singletons.add(new MediaResource()); singletons.add(new BlobResource()); diff --git a/services/batch/.project b/services/batch/.project new file mode 100644 index 000000000..6b6c5f3af --- /dev/null +++ b/services/batch/.project @@ -0,0 +1,17 @@ + + + org.collectionspace.services.batch + + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.maven.ide.eclipse.maven2Nature + + diff --git a/services/batch/3rdparty/.project b/services/batch/3rdparty/.project new file mode 100644 index 000000000..543b33641 --- /dev/null +++ b/services/batch/3rdparty/.project @@ -0,0 +1,17 @@ + + + org.collectionspace.services.batch.3rdparty + + + + + + org.maven.ide.eclipse.maven2Builder + + + + + + org.maven.ide.eclipse.maven2Nature + + diff --git a/services/batch/3rdparty/.settings/org.maven.ide.eclipse.prefs b/services/batch/3rdparty/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..e2ce08c02 --- /dev/null +++ b/services/batch/3rdparty/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Fri Aug 27 16:35:21 PDT 2010 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/services/batch/3rdparty/build.xml b/services/batch/3rdparty/build.xml new file mode 100644 index 000000000..bba913755 --- /dev/null +++ b/services/batch/3rdparty/build.xml @@ -0,0 +1,127 @@ + + + + batch service 3rdparty + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/batch/3rdparty/nuxeo-platform-cs-batch/.classpath b/services/batch/3rdparty/nuxeo-platform-cs-batch/.classpath new file mode 100644 index 000000000..8ad8fad8e --- /dev/null +++ b/services/batch/3rdparty/nuxeo-platform-cs-batch/.classpath @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/services/batch/3rdparty/nuxeo-platform-cs-batch/.project b/services/batch/3rdparty/nuxeo-platform-cs-batch/.project new file mode 100644 index 000000000..5ca0d0a01 --- /dev/null +++ b/services/batch/3rdparty/nuxeo-platform-cs-batch/.project @@ -0,0 +1,17 @@ + + org.collectionspace.services.batch.3rdparty.nuxeo + Batch Nuxeo Document Type. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + org.eclipse.jdt.core.javabuilder + + + org.maven.ide.eclipse.maven2Builder + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + diff --git a/services/batch/3rdparty/nuxeo-platform-cs-batch/.settings/org.maven.ide.eclipse.prefs b/services/batch/3rdparty/nuxeo-platform-cs-batch/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..e2ce08c02 --- /dev/null +++ b/services/batch/3rdparty/nuxeo-platform-cs-batch/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Fri Aug 27 16:35:21 PDT 2010 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/services/batch/3rdparty/nuxeo-platform-cs-batch/build.xml b/services/batch/3rdparty/nuxeo-platform-cs-batch/build.xml new file mode 100644 index 000000000..dda9125ca --- /dev/null +++ b/services/batch/3rdparty/nuxeo-platform-cs-batch/build.xml @@ -0,0 +1,143 @@ + + + + batch nuxeo document type + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/batch/3rdparty/nuxeo-platform-cs-batch/pom.xml b/services/batch/3rdparty/nuxeo-platform-cs-batch/pom.xml new file mode 100644 index 000000000..e1e7056e2 --- /dev/null +++ b/services/batch/3rdparty/nuxeo-platform-cs-batch/pom.xml @@ -0,0 +1,38 @@ + + + + org.collectionspace.services + org.collectionspace.services.batch.3rdparty + 1.7-SNAPSHOT + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.batch.3rdparty.nuxeo + services.batch.3rdparty.nuxeo + jar + + Batch Nuxeo Document Type + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + src/main/resources/META-INF/MANIFEST.MF + + ${eclipseVersion} + 2 + + + + + + + + diff --git a/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/META-INF/MANIFEST.MF b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 000000000..d05375dbd --- /dev/null +++ b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,23 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 1 +Bundle-Name: NuxeoCS +Bundle-SymbolicName: org.collectionspace.batch;singleton:=true +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Bundle-Vendor: Nuxeo +Require-Bundle: org.nuxeo.runtime, + org.nuxeo.ecm.core.api, + org.nuxeo.ecm.core, + org.nuxeo.ecm.core.api, + org.nuxeo.ecm.platform.types.api, + org.nuxeo.ecm.platform.versioning.api, + org.nuxeo.ecm.platform.ui, + org.nuxeo.ecm.platform.forms.layout.client, + org.nuxeo.ecm.platform.ws, + org.collectionspace.collectionspace_core +Provide-Package: org.collectionspace.batch +Nuxeo-Component: OSGI-INF/core-types-contrib.xml, + OSGI-INF/life-cycle-contrib.xml, + OSGI-INF/ecm-types-contrib.xml, + OSGI-INF/layouts-contrib.xml + diff --git a/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/core-types-contrib.xml b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/core-types-contrib.xml new file mode 100644 index 000000000..4fa03a052 --- /dev/null +++ b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/core-types-contrib.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/deployment-fragment.xml b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/deployment-fragment.xml new file mode 100644 index 000000000..88b94ffd1 --- /dev/null +++ b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/deployment-fragment.xml @@ -0,0 +1,408 @@ + + + + + + ${bundle.fileName} + + + + + nuxeo.war + /nuxeo + + + + + + + + + + + + Seam Context Filter + /ws/FileManageWS + + + + Seam Context Filter + /DocumentManagerWS + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + #{currentServerLocation.name}/#{currentTabAction.label} + + + + Create new document in #{currentDocument.name} + + + + Create new document in #{currentDocument.name} + + + + breadcrumb=command.user_dashboard + + + + breadcrumb=command.manageMembers + + + + breadcrumb=command.manageMembers + + + + breadcrumb=title.vocabularies + + + + breadcrumb=command.advancedSearch + + + + + + en + en_GB + en_US + fr + de + es + it + ar + ru + ja + vn + + + messages + + + + config/addWorkspace.jpdl.xml + + + + + + generic_error_page + /generic_error_page.xhtml + + + + + generic_message_page + /generic_message_page.xhtml + + + + + home + /nxstartup.xhtml + + + + + user_login + /login.xhtml + + + + + user_logout + /logout.xhtml + + + + + view_servers + /view_servers.xhtml + + + + + + + view_domains + /view_domains.xhtml + + + + + select_document_type + /select_document_type.xhtml + + + + + create_document + /create_document.xhtml + + + + + edit_document + /edit_document.xhtml + + + + + view_documents + /view_documents.xhtml + + + + + create_file + /create_file.xhtml + + + + + create_workspace_wizard + /createWorkspaceWizard.xhtml + + + + + send_email + /document_email.xhtml + + + + + + view_workspaces + /view_workspaces.xhtml + + + + + + create_domain + /create_domain.xhtml + + + + + + edit_domain + /edit_domain.xhtml + + + + + + create_workspace + /create_workspace.xhtml + + + + + + edit_workspace + /edit_workspace.xhtml + + + + + + + members_management + /members_management.xhtml + + + + + view_users + /view_users.xhtml + + + + + view_many_users + /view_many_users.xhtml + + + + + edit_user + /edit_user.xhtml + + + + + edit_user_password + /edit_user_password.xhtml + + + + + view_user + /view_user.xhtml + + + + + create_user + /create_user.xhtml + + + + + view_groups + /view_groups.xhtml + + + + + view_group + /view_group.xhtml + + + + + edit_group + /edit_group.xhtml + + + + + create_group + /create_group.xhtml + + + + + view_vocabularies + /view_vocabularies.xhtml + + + + + view_vocabulary + /view_vocabulary.xhtml + + + + + + + search_form + /search/search_form.xhtml + + + + + search_results_nxql + /search/search_results_nxql.xhtml + + + + + search_results_advanced + + /search/search_results_advanced.xhtml + + + + + + search_results_simple + /search/search_results_simple.xhtml + + + + + + + clipboard + /incl/clipboard.xhtml + + + + + user_dashboard + /user_dashboard.xhtml + + + + + select_workspace_template + /select_workspace_template.xhtml + + + + + pdf_generation_error + /pdf_generation_error.xhtml + + + + + mass_edit + /massedit_documents.xhtml + + + + + mass_edit_confirm + /massedit_documents_preview.xhtml + + + + + + diff --git a/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/ecm-types-contrib.xml b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/ecm-types-contrib.xml new file mode 100644 index 000000000..ae2e9aefe --- /dev/null +++ b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/ecm-types-contrib.xml @@ -0,0 +1,29 @@ + + + + + + + view_documents + + + heading + collectionspace_core + batch + + + + + + Batch + + + + + + Batch + + + + + diff --git a/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/layouts-contrib.xml b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/layouts-contrib.xml new file mode 100644 index 000000000..7ce0bfd8d --- /dev/null +++ b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/layouts-contrib.xml @@ -0,0 +1,212 @@ + + + + + + + + + + + + + + + batchNumber + borrower + borrowersContact + lendersAuthorizer + lendersAuthorizationDate + lendersContact + + + + + + + batchDate + loanReturnDate + loanRenewalApplicationDate + specialConditionsOfLoan + batchNote + loanPurpose + + + + + + + true + + batchNumber + + + dataInputText + + + + + + + + true + + borrower + + + dataInputText + + + + + + + + true + + borrowersContact + + + dataInputText + + + + + + + + true + + lendersAuthorizer + + + dataInputText + + + + + + + + true + + lendersAuthorizationDate + + + dataInputText + + + + + + + + true + + lendersContact + + + dataInputText + + + + + + + + true + + batchDate + + + dataInputText + + + + + + + + true + + loanReturnDate + + + dataInputText + + + + + + + + true + + loanRenewalApplicationDate + + + dataInputText + + + + + + + + true + + specialConditionsOfLoan + + + dataInputText + + + + + + + + true + + batchNote + + + dataInputText + + + + + + + + true + + loanPurpose + + + dataInputText + + + + + + diff --git a/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/life-cycle-contrib.xml b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/life-cycle-contrib.xml new file mode 100644 index 000000000..2e17ebdd3 --- /dev/null +++ b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/OSGI-INF/life-cycle-contrib.xml @@ -0,0 +1,11 @@ + + + + + + default + + + + diff --git a/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/schemas/batch_common.xsd b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/schemas/batch_common.xsd new file mode 100644 index 000000000..749ab3afc --- /dev/null +++ b/services/batch/3rdparty/nuxeo-platform-cs-batch/src/main/resources/schemas/batch_common.xsd @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/batch/3rdparty/pom.xml b/services/batch/3rdparty/pom.xml new file mode 100644 index 000000000..70e559500 --- /dev/null +++ b/services/batch/3rdparty/pom.xml @@ -0,0 +1,24 @@ + + + + org.collectionspace.services.batch + org.collectionspace.services + 1.7-SNAPSHOT + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.batch.3rdparty + services.batch.3rdparty + pom + + + 3rd party build for batch service + + + + nuxeo-platform-cs-batch + + diff --git a/services/batch/build.xml b/services/batch/build.xml new file mode 100644 index 000000000..869baa422 --- /dev/null +++ b/services/batch/build.xml @@ -0,0 +1,124 @@ + + + + batch service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/batch/client/.classpath b/services/batch/client/.classpath new file mode 100644 index 000000000..64bfdac38 --- /dev/null +++ b/services/batch/client/.classpath @@ -0,0 +1,313 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/batch/client/.project b/services/batch/client/.project new file mode 100644 index 000000000..ac4a8374b --- /dev/null +++ b/services/batch/client/.project @@ -0,0 +1,29 @@ + + org.collectionspace.services.batch.client + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + org.collectionspace.services.3rdparty.nuxeo.quote-api + org.collectionspace.services.client + org.collectionspace.services.common + org.collectionspace.services.common-api + org.collectionspace.services.contact.client + org.collectionspace.services.contact.jaxb + org.collectionspace.services.hyperjaxb + org.collectionspace.services.jaxb + org.collectionspace.services.batch.jaxb + org.collectionspace.services.person.client + org.collectionspace.services.person.jaxb + + + + org.eclipse.jdt.core.javabuilder + + + org.maven.ide.eclipse.maven2Builder + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + \ No newline at end of file diff --git a/services/batch/client/.settings/org.maven.ide.eclipse.prefs b/services/batch/client/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..e2ce08c02 --- /dev/null +++ b/services/batch/client/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Fri Aug 27 16:35:21 PDT 2010 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/services/batch/client/pom.xml b/services/batch/client/pom.xml new file mode 100644 index 000000000..0ec465eff --- /dev/null +++ b/services/batch/client/pom.xml @@ -0,0 +1,96 @@ + + + + org.collectionspace.services + org.collectionspace.services.batch + 1.7-SNAPSHOT + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.batch.client + services.batch.client + + + + + org.slf4j + slf4j-api + test + + + org.slf4j + slf4j-log4j12 + test + + + + org.collectionspace.services + org.collectionspace.services.authority + true + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.common + true + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.client + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.batch.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.person.client + ${project.version} + + + + org.testng + testng + 5.6 + + + org.jboss.resteasy + resteasy-jaxrs + + + + tjws + webserver + + + + + org.jboss.resteasy + resteasy-jaxb-provider + + + org.jboss.resteasy + resteasy-multipart-provider + + + commons-httpclient + commons-httpclient + 3.1 + + + + + collectionspace-services-batch-client + + diff --git a/services/batch/client/src/main/java/org/collectionspace/services/client/BatchClient.java b/services/batch/client/src/main/java/org/collectionspace/services/client/BatchClient.java new file mode 100644 index 000000000..82c06e016 --- /dev/null +++ b/services/batch/client/src/main/java/org/collectionspace/services/client/BatchClient.java @@ -0,0 +1,66 @@ +/** + * 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 (c) 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 + */ +package org.collectionspace.services.client; + +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.collectionspace.services.batch.BatchCommonList; + +import org.jboss.resteasy.client.ClientResponse; + +/** + * BatchClient.java + * + * $LastChangedRevision: 2108 $ + * $LastChangedDate: 2010-05-17 18:25:37 -0700 (Mon, 17 May 2010) $ + * + */ +public class BatchClient extends AbstractPoxServiceClientImpl { + public static final String SERVICE_NAME = "batch"; + public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; + public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT; + public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME; + + @Override + public String getServiceName() { + return SERVICE_NAME; + } + + @Override + public String getServicePathComponent() { + return SERVICE_PATH_COMPONENT; + } + + @Override + public Class getProxyClass() { + // TODO Auto-generated method stub + return BatchProxy.class; + } + + /* + * Proxied service calls. + * + */ + + public ClientResponse readList() { + return getProxy().readList(); + } + + public BatchCommonList readList2(){ + BatchCommonList list = readList().getEntity(BatchCommonList.class); + return list; + } +} diff --git a/services/batch/client/src/main/java/org/collectionspace/services/client/BatchProxy.java b/services/batch/client/src/main/java/org/collectionspace/services/client/BatchProxy.java new file mode 100644 index 000000000..88af51a30 --- /dev/null +++ b/services/batch/client/src/main/java/org/collectionspace/services/client/BatchProxy.java @@ -0,0 +1,38 @@ +package org.collectionspace.services.client; + +import org.jboss.resteasy.client.ClientResponse; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; + +import org.collectionspace.services.client.workflow.WorkflowClient; +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.collectionspace.services.batch.BatchCommonList; + + +/** + * @version $Revision: 2108 $ + */ +@Path(BatchClient.SERVICE_PATH + "/") +@Produces({"application/xml"}) +@Consumes({"application/xml"}) +public interface BatchProxy extends CollectionSpacePoxProxy { + // List + @GET + ClientResponse readList(); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse readIncludeDeleted( + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); + + @Override + @GET + @Produces({"application/xml"}) + ClientResponse keywordSearchIncludeDeleted( + @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, + @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted); +} diff --git a/services/batch/client/src/test/java/org/collectionspace/services/client/test/BatchAuthRefsTest.java b/services/batch/client/src/test/java/org/collectionspace/services/client/test/BatchAuthRefsTest.java new file mode 100644 index 000000000..38e1f0586 --- /dev/null +++ b/services/batch/client/src/test/java/org/collectionspace/services/client/test/BatchAuthRefsTest.java @@ -0,0 +1,233 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright © 2009 Regents of the University of California + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.client.test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.collectionspace.services.PersonJAXBSchema; +import org.collectionspace.services.client.CollectionSpaceClient; +import org.collectionspace.services.client.ContactClient; +import org.collectionspace.services.client.BatchClient; +import org.collectionspace.services.client.PayloadOutputPart; +import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonAuthorityClientUtils; +import org.collectionspace.services.client.PoxPayloadIn; +import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.common.authorityref.AuthorityRefList; +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.collectionspace.services.batch.BatchCommon; + +import org.jboss.resteasy.client.ClientResponse; + +import org.jboss.resteasy.plugins.providers.multipart.OutputPart; +import org.testng.Assert; +import org.testng.annotations.AfterClass; +import org.testng.annotations.Test; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * BatchAuthRefsTest, carries out Authority References tests against a deployed and running Batch (aka Loans Out) Service. + * $LastChangedRevision: $ + * $LastChangedDate: $ + */ +public class BatchAuthRefsTest extends BaseServiceTest { + + private final String CLASS_NAME = BatchAuthRefsTest.class.getName(); + private final Logger logger = LoggerFactory.getLogger(CLASS_NAME); + final String PERSON_AUTHORITY_NAME = "BatchPersonAuth"; + private String knownResourceId = null; + private List batchIdsCreated = new ArrayList(); + private List personIdsCreated = new ArrayList(); + private String personAuthCSID = null; + private String depositorRefName = null; + private String exitDate = null; + private String exitNumber = null; + + @Override + public String getServicePathComponent() { + return BatchClient.SERVICE_PATH_COMPONENT; + } + + @Override + protected String getServiceName() { + return BatchClient.SERVICE_NAME; + } + + @Override + protected CollectionSpaceClient getClientInstance() { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + + @Override + protected AbstractCommonList getAbstractCommonList(ClientResponse response) { + throw new UnsupportedOperationException(); //method not supported (or needed) in this test class + } + + private PoxPayloadOut createBatchInstance(String depositorRefName, String exitNumber, String exitDate) { + this.exitDate = exitDate; + this.exitNumber = exitNumber; + this.depositorRefName = depositorRefName; + BatchCommon batch = new BatchCommon(); + batch.setDepositor(depositorRefName); + batch.setExitNumber(exitNumber); + batch.setExitDate(exitDate); + + PoxPayloadOut multipart = new PoxPayloadOut(BatchClient.SERVICE_PAYLOAD_NAME); + PayloadOutputPart commonPart = multipart.addPart(batch, MediaType.APPLICATION_XML_TYPE); + commonPart.setLabel(new BatchClient().getCommonPartName()); + logger.debug("to be created, batch common: " + objectAsXmlString(batch, BatchCommon.class)); + return multipart; + } + + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void createWithAuthRefs(String testName) throws Exception { + logger.debug(testBanner(testName, CLASS_NAME)); + testSetup(STATUS_CREATED, ServiceRequestType.CREATE); + String identifier = createIdentifier(); // Submit the request to the service and store the response. + createPersonRefs();// Create all the person refs and entities + // Create a new Loans In resource. One or more fields in this resource will be PersonAuthority + // references, and will refer to Person resources by their refNames. + BatchClient batchClient = new BatchClient(); + PoxPayloadOut multipart = createBatchInstance(depositorRefName, "exitNumber-" + identifier, "exitDate-" + identifier); + ClientResponse res = batchClient.create(multipart); + assertStatusCode(res, testName); + if (knownResourceId == null) {// Store the ID returned from the first resource created for additional tests below. + knownResourceId = extractId(res); + } + batchIdsCreated.add(extractId(res));// Store the IDs from every resource created; delete on cleanup + } + + protected void createPersonRefs() { + PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + // Create a temporary PersonAuthority resource, and its corresponding refName by which it can be identified. + PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName()); + ClientResponse res = personAuthClient.create(multipart); + assertStatusCode(res, "createPersonRefs (not a surefire test)"); + personAuthCSID = extractId(res); + String authRefName = PersonAuthorityClientUtils.getAuthorityRefName(personAuthCSID, null); + // Create temporary Person resources, and their corresponding refNames by which they can be identified. + String csid = ""; + + csid = createPerson("Owen the Cur", "Owner", "owenCurOwner", authRefName); + personIdsCreated.add(csid); + depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); + + csid = createPerson("Davenport", "Depositor", "davenportDepositor", authRefName); + personIdsCreated.add(csid); + depositorRefName = PersonAuthorityClientUtils.getPersonRefName(personAuthCSID, csid, null); + } + + protected String createPerson(String firstName, String surName, String shortId, String authRefName) { + PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + Map personInfo = new HashMap(); + personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); + personInfo.put(PersonJAXBSchema.SUR_NAME, surName); + personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId); + PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, authRefName, personInfo, personAuthClient.getItemCommonPartName()); + ClientResponse res = personAuthClient.createItem(personAuthCSID, multipart); + assertStatusCode(res, "createPerson (not a surefire test)"); + return extractId(res); + } + + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createWithAuthRefs"}) + public void readAndCheckAuthRefs(String testName) throws Exception { + logger.debug(testBanner(testName, CLASS_NAME)); + testSetup(STATUS_OK, ServiceRequestType.READ); + BatchClient batchClient = new BatchClient(); + ClientResponse res = batchClient.read(knownResourceId); + assertStatusCode(res, testName); + PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); + BatchCommon batch = (BatchCommon) extractPart(input, batchClient.getCommonPartName(), BatchCommon.class); + Assert.assertNotNull(batch); + logger.debug(objectAsXmlString(batch, BatchCommon.class)); + + // Check a couple of fields + Assert.assertEquals(batch.getDepositor(), depositorRefName); + Assert.assertEquals(batch.getExitDate(), exitDate); + Assert.assertEquals(batch.getExitNumber(), exitNumber); + + // Get the auth refs and check them + ClientResponse res2 = batchClient.getAuthorityRefs(knownResourceId); + assertStatusCode(res2, testName); + AuthorityRefList list = res2.getEntity(); + List items = list.getAuthorityRefItem(); + int numAuthRefsFound = items.size(); + logger.debug("Authority references, found " + numAuthRefsFound); + //Assert.assertEquals(numAuthRefsFound, NUM_AUTH_REFS_EXPECTED, + // "Did not find all expected authority references! " + + // "Expected " + NUM_AUTH_REFS_EXPECTED + ", found " + numAuthRefsFound); + if (logger.isDebugEnabled()) { + int i = 0; + for (AuthorityRefList.AuthorityRefItem item : items) { + logger.debug(testName + ": list-item[" + i + "] Field:" + item.getSourceField() + "= " + item.getAuthDisplayName() + item.getItemDisplayName()); + logger.debug(testName + ": list-item[" + i + "] refName=" + item.getRefName()); + logger.debug(testName + ": list-item[" + i + "] URI=" + item.getUri()); + i++; + } + } + } + + /** + * Deletes all resources created by tests, after all tests have been run. + *

+ * This cleanup method will always be run, even if one or more tests fail. + * For this reason, it attempts to remove all resources created + * at any point during testing, even if some of those resources + * may be expected to be deleted by certain tests. + */ + @AfterClass(alwaysRun = true) + public void cleanUp() { + String noTest = System.getProperty("noTestCleanup"); + if (Boolean.TRUE.toString().equalsIgnoreCase(noTest)) { + logger.debug("Skipping Cleanup phase ..."); + return; + } + logger.debug("Cleaning up temporary resources created for testing ..."); + PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + // Delete Person resource(s) (before PersonAuthority resources). + for (String resourceId : personIdsCreated) { + // Note: Any non-success responses are ignored and not reported. + personAuthClient.deleteItem(personAuthCSID, resourceId); + } + // Delete PersonAuthority resource(s). + // Note: Any non-success response is ignored and not reported. + if (personAuthCSID != null) { + personAuthClient.delete(personAuthCSID); + // Delete Loans In resource(s). + BatchClient batchClient = new BatchClient(); + for (String resourceId : batchIdsCreated) { + // Note: Any non-success responses are ignored and not reported. + batchClient.delete(resourceId); + } + } + } + +} diff --git a/services/batch/client/src/test/java/org/collectionspace/services/client/test/BatchServiceTest.java b/services/batch/client/src/test/java/org/collectionspace/services/client/test/BatchServiceTest.java new file mode 100644 index 000000000..8b6551006 --- /dev/null +++ b/services/batch/client/src/test/java/org/collectionspace/services/client/test/BatchServiceTest.java @@ -0,0 +1,304 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright © 2009 Regents of the University of California + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.client.test; + +import java.util.List; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.collectionspace.services.client.CollectionSpaceClient; +import org.collectionspace.services.client.BatchClient; +import org.collectionspace.services.client.BatchProxy; +import org.collectionspace.services.client.PayloadOutputPart; +import org.collectionspace.services.client.PoxPayloadIn; +import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.collectionspace.services.batch.BatchCommonList; +import org.collectionspace.services.batch.BatchCommon; + +import org.jboss.resteasy.client.ClientResponse; + +import org.testng.Assert; +import org.testng.annotations.Test; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +//import org.w3c.dom.Element; +//import org.w3c.dom.Node; + +/** + * BatchServiceTest, carries out tests against a deployed and running Batch Service.

+ * $LastChangedRevision: $ + * $LastChangedDate: $ + */ +public class BatchServiceTest extends AbstractServiceTestImpl { + + private final String CLASS_NAME = BatchServiceTest.class.getName(); + private final Logger logger = LoggerFactory.getLogger(CLASS_NAME); + final String SERVICE_PATH_COMPONENT = "batch"; + private String knownResourceId = null; + + @Override + public String getServicePathComponent() { + return BatchClient.SERVICE_PATH_COMPONENT; + } + + @Override + protected String getServiceName() { + return BatchClient.SERVICE_NAME; + } + + @Override + protected CollectionSpaceClient getClientInstance() { + return new BatchClient(); + } + + @Override + protected AbstractCommonList getAbstractCommonList(ClientResponse response) { + return response.getEntity(BatchCommonList.class); + } + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class) + public void create(String testName) throws Exception { + logger.debug(testBanner(testName, CLASS_NAME)); + setupCreate(); + BatchClient client = new BatchClient(); + PoxPayloadOut multipart = createBatchInstance(createIdentifier()); + ClientResponse res = client.create(multipart); + assertStatusCode(res, testName); + if (knownResourceId == null) { + knownResourceId = extractId(res); // Store the ID returned from the first resource created for additional tests below. + logger.debug(testName + ": knownResourceId=" + knownResourceId); + } + allResourceIdsCreated.add(extractId(res)); // Store the IDs from every resource created by tests so they can be deleted after tests have been run. + } + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"}) + public void createList(String testName) throws Exception { + logger.debug(testBanner(testName, CLASS_NAME)); + for (int i = 0; i < 3; i++) { + create(testName); + } + } + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create"}) + public void read(String testName) throws Exception { + logger.debug(testBanner(testName, CLASS_NAME)); + setupRead(); + BatchClient client = new BatchClient(); + ClientResponse res = client.read(knownResourceId); + assertStatusCode(res, testName); + PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); + BatchCommon batch = (BatchCommon) extractPart(input, client.getCommonPartName(), BatchCommon.class); + Assert.assertNotNull(batch); + } + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"createList", "read"}) + public void readList(String testName) throws Exception { + logger.debug(testBanner(testName, CLASS_NAME)); + setupReadList(); + BatchClient client = new BatchClient(); + ClientResponse res = client.readList(); + String bar = "\r\n\r\n=================================\r\n\r\n"; + System.out.println(bar+" res: "+res); + BatchCommonList list = res.getEntity(); + + System.out.println(bar+" list: "+list); + assertStatusCode(res, testName); + + if (logger.isDebugEnabled()) { + List items = + list.getListItem(); + int i = 0; + for(AbstractCommonList.ListItem item : items){ + logger.debug(testName + ": list-item[" + i + "] " + + item.toString()); + i++; + } + } + + /* + List items = list.getListItem(); + int i = 0; + for(AbstractCommonList.ListItem item : items){ + List elList = item.getAny(); + StringBuilder elementStrings = new StringBuilder(); + for(Element el : elList) { + Node textEl = el.getFirstChild(); + if (textEl != null){ + elementStrings.append("["+el.getNodeName()+":"+textEl.getNodeValue()+"] "); + } + } + System.out.println("\r\n\r\n\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~"+testName + ": list-item[" + i + "]: "+elementStrings.toString()); + i++; + } + */ + } + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"}) + public void update(String testName) throws Exception { + logger.debug(testBanner(testName, CLASS_NAME)); + setupUpdate(); + BatchClient client = new BatchClient(); + ClientResponse res = client.read(knownResourceId); + assertStatusCode(res, testName); + logger.debug("got object to update with ID: " + knownResourceId); + PoxPayloadIn input = new PoxPayloadIn(res.getEntity()); + BatchCommon batch = (BatchCommon) extractPart(input, client.getCommonPartName(), BatchCommon.class); + Assert.assertNotNull(batch); + + batch.setExitNumber("updated-" + batch.getExitNumber()); + logger.debug("Object to be updated:"+objectAsXmlString(batch, BatchCommon.class)); + PoxPayloadOut output = new PoxPayloadOut(BatchClient.SERVICE_PAYLOAD_NAME); + PayloadOutputPart commonPart = output.addPart(batch, MediaType.APPLICATION_XML_TYPE); + commonPart.setLabel(client.getCommonPartName()); + res = client.update(knownResourceId, output); + assertStatusCode(res, testName); + input = new PoxPayloadIn(res.getEntity()); + BatchCommon updatedBatch = (BatchCommon) extractPart(input, client.getCommonPartName(), BatchCommon.class); + Assert.assertNotNull(updatedBatch); + } + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update", "testSubmitRequest"}) + public void updateNonExistent(String testName) throws Exception { + logger.debug(testBanner(testName, CLASS_NAME)); + 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. + BatchClient client = new BatchClient(); + PoxPayloadOut multipart = createBatchInstance(NON_EXISTENT_ID); + ClientResponse res = client.update(NON_EXISTENT_ID, multipart); + assertStatusCode(res, testName); + } + + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"create", "readList", "testSubmitRequest", "update"}) + public void delete(String testName) throws Exception { + logger.debug(testBanner(testName, CLASS_NAME)); + setupDelete(); + BatchClient client = new BatchClient(); + ClientResponse res = client.delete(knownResourceId); + assertStatusCode(res, testName); + } + + // --------------------------------------------------------------- + // Failure outcome tests : means we expect response to fail, but test to succeed + // --------------------------------------------------------------- + + // Failure outcome + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"read"}) + public void readNonExistent(String testName) throws Exception { + logger.debug(testBanner(testName, CLASS_NAME)); + setupReadNonExistent(); + BatchClient client = new BatchClient(); + ClientResponse res = client.read(NON_EXISTENT_ID); + assertStatusCode(res, testName); + } + + // Failure outcome + @Override + @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"delete"}) + public void deleteNonExistent(String testName) throws Exception { + logger.debug(testBanner(testName, CLASS_NAME)); + setupDeleteNonExistent(); + BatchClient client = new BatchClient(); + ClientResponse res = client.delete(NON_EXISTENT_ID); + assertStatusCode(res, testName); + } + + // Failure outcomes + // Placeholders until the tests below can be implemented. See Issue CSPACE-401. + + @Override + public void createWithEmptyEntityBody(String testName) throws Exception { + } + + @Override + public void createWithMalformedXml(String testName) throws Exception { + } + + @Override + public void createWithWrongXmlSchema(String testName) throws Exception { + } + + @Override + public void updateWithEmptyEntityBody(String testName) throws Exception { + } + + @Override + public void updateWithMalformedXml(String testName) throws Exception { + } + + @Override + public void updateWithWrongXmlSchema(String testName) throws Exception { + } + + // --------------------------------------------------------------- + // Utility tests : tests of code used in tests above + // --------------------------------------------------------------- + + @Test(dependsOnMethods = {"create", "read"}) + public void testSubmitRequest() { + final int EXPECTED_STATUS = Response.Status.OK.getStatusCode(); // Expected status code: 200 OK + String method = ServiceRequestType.READ.httpMethodName(); + String url = getResourceURL(knownResourceId); + int statusCode = submitRequest(method, url); + logger.debug("testSubmitRequest: url=" + url + " status=" + statusCode); + Assert.assertEquals(statusCode, EXPECTED_STATUS); + } + + // --------------------------------------------------------------- + // Utility methods used by tests above + // --------------------------------------------------------------- + + @Override + protected PoxPayloadOut createInstance(String identifier) { + BatchClient client = new BatchClient(); + return createBatchInstance(identifier); + } + + private PoxPayloadOut createBatchInstance(String exitNumber) { + String identifier = "batchNumber-" + exitNumber; + BatchCommon batch = new BatchCommon(); + batch.setExitNumber(identifier); + batch.setDepositor("urn:cspace:org.collectionspace.demo:orgauthority:name(TestOrgAuth):organization:name(Northern Climes Museum)'Northern Climes Museum'"); + PoxPayloadOut multipart = new PoxPayloadOut(BatchClient.SERVICE_PAYLOAD_NAME); + PayloadOutputPart commonPart = multipart.addPart(batch, MediaType.APPLICATION_XML_TYPE); + commonPart.setLabel(new BatchClient().getCommonPartName()); + + if (logger.isDebugEnabled()) { + logger.debug("to be created, batch common"); + logger.debug(objectAsXmlString(batch, BatchCommon.class)); + } + + return multipart; + } +} diff --git a/services/batch/client/src/test/resources/log4j.properties b/services/batch/client/src/test/resources/log4j.properties new file mode 100644 index 000000000..18c510350 --- /dev/null +++ b/services/batch/client/src/test/resources/log4j.properties @@ -0,0 +1,23 @@ +log4j.rootLogger=debug, stdout, R + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout + +# Pattern to output the caller's file name and line number. +log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n + +log4j.appender.R=org.apache.log4j.RollingFileAppender +log4j.appender.R.File=target/test-client.log + +log4j.appender.R.MaxFileSize=100KB +# Keep one backup file +log4j.appender.R.MaxBackupIndex=1 + +log4j.appender.R.layout=org.apache.log4j.PatternLayout +log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n + +#packages +log4j.logger.org.collectionspace=DEBUG +log4j.logger.org.apache=INFO +log4j.logger.httpclient=INFO +log4j.logger.org.jboss.resteasy=INFO diff --git a/services/batch/jaxb/.classpath b/services/batch/jaxb/.classpath new file mode 100644 index 000000000..1674079c1 --- /dev/null +++ b/services/batch/jaxb/.classpath @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/batch/jaxb/.project b/services/batch/jaxb/.project new file mode 100644 index 000000000..3ec7c4574 --- /dev/null +++ b/services/batch/jaxb/.project @@ -0,0 +1,19 @@ + + org.collectionspace.services.batch.jaxb + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + org.collectionspace.services.jaxb + + + + org.eclipse.jdt.core.javabuilder + + + org.maven.ide.eclipse.maven2Builder + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + \ No newline at end of file diff --git a/services/batch/jaxb/.settings/org.maven.ide.eclipse.prefs b/services/batch/jaxb/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..c9f07df5d --- /dev/null +++ b/services/batch/jaxb/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Wed Jan 19 22:49:45 PST 2011 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/services/batch/jaxb/pom.xml b/services/batch/jaxb/pom.xml new file mode 100644 index 000000000..d3535d19c --- /dev/null +++ b/services/batch/jaxb/pom.xml @@ -0,0 +1,47 @@ + + + + org.collectionspace.services.batch + org.collectionspace.services + 1.7-SNAPSHOT + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.batch.jaxb + services.batch.jaxb + + + + com.sun.xml.bind + jaxb-impl + + + org.jvnet.jaxb2-commons + property-listener-injector + + + org.jvnet.jaxb2_commons + runtime + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + + + collectionspace-services-batch-jaxb + install + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + + + + + diff --git a/services/batch/jaxb/src/main/java/org/collectionspace/services/BatchJAXBSchema.java b/services/batch/jaxb/src/main/java/org/collectionspace/services/BatchJAXBSchema.java new file mode 100644 index 000000000..8613c0868 --- /dev/null +++ b/services/batch/jaxb/src/main/java/org/collectionspace/services/BatchJAXBSchema.java @@ -0,0 +1,16 @@ +/** + * + */ +package org.collectionspace.services; + +public interface BatchJAXBSchema { + final static String OBJECT_EXIT_CURRENT_OWNER = "currentOwner"; + final static String OBJECT_EXIT_DEPOSITOR = "depositor"; + final static String OBJECT_EXIT_DATE = "exitDate"; + final static String OBJECT_EXIT_METHODS = "exitMethods"; + final static String OBJECT_EXIT_METHOD = "exitMethod"; + final static String OBJECT_EXIT_NOTE = "exitNote"; + final static String OBJECT_EXIT_NUMBER = "exitNumber"; + final static String OBJECT_EXIT_REASON = "exitReason"; + final static String OBJECT_EXIT_PACKING_NOTE = "packingNote"; +} diff --git a/services/batch/jaxb/src/main/java/org/collectionspace/services/BatchListItemJAXBSchema.java b/services/batch/jaxb/src/main/java/org/collectionspace/services/BatchListItemJAXBSchema.java new file mode 100644 index 000000000..ab7f83029 --- /dev/null +++ b/services/batch/jaxb/src/main/java/org/collectionspace/services/BatchListItemJAXBSchema.java @@ -0,0 +1,9 @@ +package org.collectionspace.services; + +public interface BatchListItemJAXBSchema { + final static String OBJECT_EXIT_CURRENT_OWNER = "currentOwner"; + final static String OBJECT_EXIT_NUMBER = "exitNumber"; + + final static String CSID = "csid"; + final static String URI = "url"; +} diff --git a/services/batch/jaxb/src/main/resources/batch_common.xsd b/services/batch/jaxb/src/main/resources/batch_common.xsd new file mode 100644 index 000000000..9645abe9c --- /dev/null +++ b/services/batch/jaxb/src/main/resources/batch_common.xsd @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/batch/pom.xml b/services/batch/pom.xml new file mode 100644 index 000000000..af95e6ebf --- /dev/null +++ b/services/batch/pom.xml @@ -0,0 +1,24 @@ + + + + + org.collectionspace.services + org.collectionspace.services.main + 1.7-SNAPSHOT + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.batch + services.batch + pom + + + jaxb + service + 3rdparty + client + + + + diff --git a/services/batch/service/.classpath b/services/batch/service/.classpath new file mode 100644 index 000000000..cb47d7256 --- /dev/null +++ b/services/batch/service/.classpath @@ -0,0 +1,316 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/services/batch/service/.project b/services/batch/service/.project new file mode 100644 index 000000000..a099a73a3 --- /dev/null +++ b/services/batch/service/.project @@ -0,0 +1,31 @@ + + org.collectionspace.services.batch.service + NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + org.collectionspace.services.3rdparty.nuxeo.quote-api + org.collectionspace.services.client + org.collectionspace.services.collectionobject.jaxb + org.collectionspace.services.common + org.collectionspace.services.common-api + org.collectionspace.services.contact.client + org.collectionspace.services.contact.jaxb + org.collectionspace.services.hyperjaxb + org.collectionspace.services.jaxb + org.collectionspace.services.batch.client + org.collectionspace.services.batch.jaxb + org.collectionspace.services.person.client + org.collectionspace.services.person.jaxb + + + + org.eclipse.jdt.core.javabuilder + + + org.maven.ide.eclipse.maven2Builder + + + + org.eclipse.jdt.core.javanature + org.maven.ide.eclipse.maven2Nature + + \ No newline at end of file diff --git a/services/batch/service/.settings/org.maven.ide.eclipse.prefs b/services/batch/service/.settings/org.maven.ide.eclipse.prefs new file mode 100644 index 000000000..e2ce08c02 --- /dev/null +++ b/services/batch/service/.settings/org.maven.ide.eclipse.prefs @@ -0,0 +1,9 @@ +#Fri Aug 27 16:35:21 PDT 2010 +activeProfiles= +eclipse.preferences.version=1 +fullBuildGoals=process-test-resources +includeModules=false +resolveWorkspaceProjects=true +resourceFilterGoals=process-resources resources\:testResources +skipCompilerPlugin=true +version=1 diff --git a/services/batch/service/pom.xml b/services/batch/service/pom.xml new file mode 100644 index 000000000..3a7b49558 --- /dev/null +++ b/services/batch/service/pom.xml @@ -0,0 +1,122 @@ + + + + + org.collectionspace.services + org.collectionspace.services.batch + 1.7-SNAPSHOT + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.batch.service + services.batch.service + jar + + + + org.collectionspace.services + org.collectionspace.services.common + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.batch.client + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.batch.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.collectionobject.jaxb + ${project.version} + + + + junit + junit + 4.1 + test + + + org.testng + testng + 5.6 + + + + + + javax.security + jaas + 1.0.01 + provided + + + + dom4j + dom4j + 1.6.1 + 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 + ${nuxeo.core.version} + + + jboss-remoting + jboss + + + + + + org.restlet + org.restlet + 1.0.7 + + + com.noelios.restlet + com.noelios.restlet.ext.httpclient + 1.0.7 + + + com.noelios.restlet + com.noelios.restlet + 1.0.7 + + + + + collectionspace-services-batch + + + diff --git a/services/batch/service/profiles.xml b/services/batch/service/profiles.xml new file mode 100644 index 000000000..347b9df22 --- /dev/null +++ b/services/batch/service/profiles.xml @@ -0,0 +1,4 @@ + + + \ No newline at end of file diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/BatchResource.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/BatchResource.java new file mode 100644 index 000000000..cdf6f6a7b --- /dev/null +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/BatchResource.java @@ -0,0 +1,59 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + + * http://www.collectionspace.org + * http://wiki.collectionspace.org + + * Copyright 2009 University of California at Berkeley + + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + + * You may obtain a copy of the ECL 2.0 License at + + * https://source.collectionspace.org/collection-space/LICENSE.txt + + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.batch; + +import org.collectionspace.services.client.BatchClient; +import org.collectionspace.services.common.ResourceBase; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +@Path(BatchClient.SERVICE_PATH) +@Produces({"application/xml"}) +@Consumes({"application/xml"}) +public class BatchResource extends ResourceBase { + + @Override + public String getServiceName(){ + return BatchClient.SERVICE_NAME; + } + + @Override + protected String getVersionString() { + final String lastChangeRevision = "$LastChangedRevision: 2108 $"; + return lastChangeRevision; + } + + @Override + //public Class getCommonPartClass() { + public Class getCommonPartClass() { + try { + return Class.forName("org.collectionspace.services.batch.BatchCommon");//.class; + } catch (ClassNotFoundException e){ + return null; + } + } + +} diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchDocumentModelHandler.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchDocumentModelHandler.java new file mode 100644 index 000000000..a5fe3e0c4 --- /dev/null +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchDocumentModelHandler.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 + + * Copyright 2009 University of California at Berkeley + + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + + * You may obtain a copy of the ECL 2.0 License at + + * https://source.collectionspace.org/collection-space/LICENSE.txt + + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.batch.nuxeo; + +import org.collectionspace.services.nuxeo.client.java.DocHandlerBase; +import org.collectionspace.services.batch.BatchCommon; + +public class BatchDocumentModelHandler + extends DocHandlerBase { +} + diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchValidatorHandler.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchValidatorHandler.java new file mode 100644 index 000000000..990094eb2 --- /dev/null +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchValidatorHandler.java @@ -0,0 +1,18 @@ +package org.collectionspace.services.batch.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 BatchValidatorHandler implements ValidatorHandler { + + @Override + public void validate(Action action, ServiceContext ctx) + throws InvalidDocumentException { + // TODO Auto-generated method stub + System.out.println("BatchValidatorHandler executed."); + + } + +} diff --git a/services/batch/service/src/test/java/org/collectionspace/services/test/BatchServiceTest.java b/services/batch/service/src/test/java/org/collectionspace/services/test/BatchServiceTest.java new file mode 100644 index 000000000..75bf416ad --- /dev/null +++ b/services/batch/service/src/test/java/org/collectionspace/services/test/BatchServiceTest.java @@ -0,0 +1,13 @@ +package org.collectionspace.services.test; + +//import org.collectionspace.services.batch.Batch; +//import org.collectionspace.services.batch.BatchList; + +/** + * Placeholder for server-side testing of Loan Out service code. + * + * @version $Revision: 2108 $ + */ +public class BatchServiceTest { + //empty +} diff --git a/services/batch/service/src/test/resources/log4j.xml b/services/batch/service/src/test/resources/log4j.xml new file mode 100644 index 000000000..52121cb83 --- /dev/null +++ b/services/batch/service/src/test/resources/log4j.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/build.xml b/services/build.xml index 8e1b360fa..1b4245c33 100644 --- a/services/build.xml +++ b/services/build.xml @@ -164,6 +164,7 @@ + @@ -191,6 +192,7 @@ + @@ -237,6 +239,7 @@ + diff --git a/services/common/src/main/cspace/config/services/tenant-bindings-proto.xml b/services/common/src/main/cspace/config/services/tenant-bindings-proto.xml index 4a1f8e16b..7b0371eab 100644 --- a/services/common/src/main/cspace/config/services/tenant-bindings-proto.xml +++ b/services/common/src/main/cspace/config/services/tenant-bindings-proto.xml @@ -526,6 +526,74 @@ + + + /batch/*/workflow/ + default-domain + org.collectionspace.services.batch.nuxeo.BatchDocumentModelHandler + + org.collectionspace.services.batch.nuxeo.BatchDocumentModelHandler + + batch + batch + exitNumber|currentOwner|uri|csid + org.collectionspace.services.batch.BatchCommonList + org.collectionspace.services.batch.BatchCommonList$BatchListItem + getBatchListItem + + + exitNumber + exitNumber + setExitNumber + + + currentOwner + currentOwner + setCurrentOwner + + + + + org.collectionspace.services.batch.nuxeo.BatchValidatorHandler + + + objectNameProperty + currentOwner + + + objectNumberProperty + exitNumber + + + + + + + + + + + + authRef + currentOwner + + + authRef + depositor + + + + + + + + + + + + + + /groups/*/workflow/ diff --git a/services/common/src/main/cspace/config/services/tenants/collectionspace/tenant-bindings.xml b/services/common/src/main/cspace/config/services/tenants/collectionspace/tenant-bindings.xml index 65900ea3b..c3dfe0f26 100644 --- a/services/common/src/main/cspace/config/services/tenants/collectionspace/tenant-bindings.xml +++ b/services/common/src/main/cspace/config/services/tenants/collectionspace/tenant-bindings.xml @@ -526,6 +526,74 @@ + + + /batch/*/workflow/ + default-domain + org.collectionspace.services.batch.nuxeo.BatchDocumentModelHandler + + org.collectionspace.services.batch.nuxeo.BatchDocumentModelHandler + + batch + batch + exitNumber|currentOwner|uri|csid + org.collectionspace.services.batch.BatchCommonList + org.collectionspace.services.batch.BatchCommonList$BatchListItem + getBatchListItem + + + exitNumber + exitNumber + setExitNumber + + + currentOwner + currentOwner + setCurrentOwner + + + + + org.collectionspace.services.batch.nuxeo.BatchValidatorHandler + + + objectNameProperty + currentOwner + + + objectNumberProperty + exitNumber + + + + + + + + + + + + authRef + currentOwner + + + authRef + depositor + + + + + + + + + + + + + + /groups/*/workflow/ diff --git a/services/pom.xml b/services/pom.xml index d07a2fb96..54c453114 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -47,6 +47,7 @@ loanout media objectexit + batch imports location taxonomy