From 09dbdacb9272916a240fd17a5c04a6f6c7754902 Mon Sep 17 00:00:00 2001 From: Richard Millet Date: Mon, 20 Aug 2018 19:59:51 -0700 Subject: [PATCH] DRYD-458: Allowing Person and Org payloads to include contacts_common payload in POST and UPDATE requests. --- .../client/test/AcquisitionAuthRefsTest.java | 8 +- services/authority/service/pom.xml | 5 + .../AuthorityResourceWithContacts.java | 22 +++- ...yItemWithContactsDocumentModelHandler.java | 49 ++++++++ .../client/test/BlobAuthRefsTest.java | 8 +- .../client/test/ClaimAuthRefsTest.java | 8 +- .../test/CollectionObjectAuthRefsTest.java | 16 +-- .../java/RemoteDocumentModelHandlerImpl.java | 2 +- .../test/ConditioncheckAuthRefsTest.java | 8 +- .../client/test/ConservationAuthRefsTest.java | 8 +- services/contact/service/pom.xml | 4 +- .../client/test/IntakeAuthRefsTest.java | 8 +- .../test/OrganizationAuthRefDocsTest.java | 10 +- .../client/test/PersonAuthRefDocsTest.java | 14 +-- .../client/test/LoaninAuthRefsTest.java | 8 +- .../client/test/LoanoutAuthRefsTest.java | 8 +- .../client/test/MediaAuthRefsTest.java | 8 +- .../client/test/MovementAuthRefsTest.java | 8 +- .../client/test/ObjectExitAuthRefsTest.java | 8 +- .../services/client/OrgAuthorityClient.java | 103 +--------------- .../client/OrgAuthorityClientUtils.java | 14 +-- .../services/client/OrgAuthorityProxy.java | 2 +- .../services/client/OrganizationClient.java | 109 +++++++++++++++++ .../client/test/OrgAuthorityAuthRefsTest.java | 20 ++-- .../client/test/OrgAuthorityServiceTest.java | 44 +++---- .../organization/OrgAuthorityResource.java | 14 +-- .../OrgAuthorityDocumentModelHandler.java | 4 +- .../OrganizationDocumentModelHandler.java | 13 +-- .../client/PersonAuthorityClient.java | 104 +---------------- .../client/PersonAuthorityClientUtils.java | 14 +-- .../services/client/PersonAuthorityProxy.java | 2 +- .../services/client/PersonClient.java | 110 ++++++++++++++++++ .../test/PersonAuthoritySearchTest.java | 20 ++-- .../test/PersonAuthorityServicePerfTest.java | 22 ++-- .../test/PersonAuthorityServiceTest.java | 54 ++++----- .../person/PersonAuthorityResource.java | 14 +-- .../PersonAuthorityDocumentModelHandler.java | 4 +- .../nuxeo/PersonDocumentModelHandler.java | 12 +- .../client/test/PottagAuthRefsTest.java | 8 +- .../client/test/PropagationAuthRefsTest.java | 8 +- .../client/test/RelationServiceTest.java | 8 +- .../services/client/test/UocAuthRefsTest.java | 8 +- 42 files changed, 509 insertions(+), 412 deletions(-) rename services/{contact/service/src/main/java/org/collectionspace/services/contact => authority/service/src/main/java/org/collectionspace/services/common/vocabulary}/AuthorityResourceWithContacts.java (94%) create mode 100644 services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemWithContactsDocumentModelHandler.java create mode 100644 services/organization/client/src/main/java/org/collectionspace/services/client/OrganizationClient.java create mode 100644 services/person/client/src/main/java/org/collectionspace/services/client/PersonClient.java diff --git a/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java b/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java index 41ea72852..ad6a2f950 100644 --- a/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java +++ b/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java @@ -33,7 +33,7 @@ import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.AcquisitionClient; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.PayloadOutputPart; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; @@ -155,7 +155,7 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest } protected void createPersonRefs() throws Exception{ - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance( PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName()); Response res = personAuthClient.create(multipart); @@ -212,7 +212,7 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest personTerms.add(term); String result = null; - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonInstance(personAuthCSID, authRefName, personInfo, personTerms, personAuthClient.getItemCommonPartName()); Response res = personAuthClient.createItem(personAuthCSID, multipart); @@ -356,7 +356,7 @@ public class AcquisitionAuthRefsTest extends BaseServiceTest // Note: Any non-success responses are ignored and not reported. acquisitionClient.delete(resourceId).close(); } - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // Delete persons before PersonAuth for (String resourceId : personIdsCreated) { // Note: Any non-success responses are ignored and not reported. diff --git a/services/authority/service/pom.xml b/services/authority/service/pom.xml index 5dcca17df..34e050c23 100644 --- a/services/authority/service/pom.xml +++ b/services/authority/service/pom.xml @@ -14,6 +14,11 @@ + + org.collectionspace.services + org.collectionspace.services.contact.service + ${project.version} + org.collectionspace.services org.collectionspace.services.config diff --git a/services/contact/service/src/main/java/org/collectionspace/services/contact/AuthorityResourceWithContacts.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResourceWithContacts.java similarity index 94% rename from services/contact/service/src/main/java/org/collectionspace/services/contact/AuthorityResourceWithContacts.java rename to services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResourceWithContacts.java index 51ca42f40..44d14ceaf 100644 --- a/services/contact/service/src/main/java/org/collectionspace/services/contact/AuthorityResourceWithContacts.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResourceWithContacts.java @@ -21,9 +21,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.collectionspace.services.contact; +package org.collectionspace.services.common.vocabulary; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,7 +34,6 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Context; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; @@ -130,6 +128,7 @@ public abstract class AuthorityResourceWithContacts ServiceContext ctx = createServiceContext(getContactServiceName(), input); DocumentHandler handler = createContactDocumentHandler(ctx, parentcsid, itemcsid, ui); String csid = getRepositoryClient(ctx).create(ctx, handler); + UriBuilder path = UriBuilder.fromResource(resourceClass); path.path("" + parentcsid + "/items/" + itemcsid + "/contacts/" + csid); Response response = Response.created(path.build()).build(); @@ -141,6 +140,23 @@ public abstract class AuthorityResourceWithContacts itemspecifier); } } + + public String createContact(ServiceContext existingCtx, String parentCsid, String itemCsid, PoxPayloadIn input, + UriInfo ui) throws Exception { + ServiceContext ctx = createServiceContext(getContactServiceName(), input); + if (existingCtx != null) { + Object repoSession = existingCtx.getCurrentRepositorySession(); + if (repoSession != null) { + ctx.setCurrentRepositorySession(repoSession); + ctx.setProperties(existingCtx.getProperties()); + } + } + + DocumentHandler handler = createContactDocumentHandler(ctx, parentCsid, itemCsid, ui); + String csid = getRepositoryClient(ctx).create(ctx, handler); + + return csid; + } /** * Gets the contact list. diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemWithContactsDocumentModelHandler.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemWithContactsDocumentModelHandler.java new file mode 100644 index 000000000..8b5dad99b --- /dev/null +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemWithContactsDocumentModelHandler.java @@ -0,0 +1,49 @@ +package org.collectionspace.services.common.vocabulary.nuxeo; + +import org.collectionspace.services.client.ContactClient; +import org.collectionspace.services.client.PayloadInputPart; +import org.collectionspace.services.client.PoxPayloadIn; +import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.common.context.ServiceContext; +import org.collectionspace.services.common.document.DocumentWrapper; +import org.collectionspace.services.common.vocabulary.AuthorityResourceWithContacts; +import org.nuxeo.ecm.core.api.DocumentModel; + +public abstract class AuthorityItemWithContactsDocumentModelHandler extends AuthorityItemDocumentModelHandler { + + public AuthorityItemWithContactsDocumentModelHandler(String authorityCommonSchemaName, + String authorityItemCommonSchemaName) { + super(authorityCommonSchemaName, authorityItemCommonSchemaName); + // TODO Auto-generated constructor stub + } + + @Override + public void completeCreate(DocumentWrapper wrapDoc) throws Exception { + super.completeCreate(wrapDoc); + handleContactPayload(wrapDoc); + } + + private void handleContactPayload(DocumentWrapper wrapDoc) throws Exception { + ContactClient contactClient = new ContactClient(); + ServiceContext ctx = getServiceContext(); + PoxPayloadIn input = ctx.getInput(); + PayloadInputPart contactPart = input.getPart(contactClient.getCommonPartName()); + if (contactPart != null) { + DocumentModel docModel = wrapDoc.getWrappedObject(); + String authorityCsid = this.getInAuthorityCsid(); + String itemCsid = this.getCsid(docModel); + createContact(authorityCsid, itemCsid, contactPart); + } + } + + private void createContact(String authorityCsid, String itemCsid, PayloadInputPart contactPart) throws Exception { + ContactClient contactClient = new ContactClient(); + String payloadTemplate = "%s"; + String xmlPayload = String.format(payloadTemplate, contactPart.asXML()); + PoxPayloadIn input = new PoxPayloadIn(xmlPayload); + + AuthorityResourceWithContacts contactResource = (AuthorityResourceWithContacts) getServiceContext().getResource(); + + contactResource.createContact(getServiceContext(), authorityCsid, itemCsid, input, null); + } +} diff --git a/services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobAuthRefsTest.java b/services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobAuthRefsTest.java index 04f97b985..b81924f20 100644 --- a/services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobAuthRefsTest.java +++ b/services/blob/client/src/test/java/org/collectionspace/services/client/test/BlobAuthRefsTest.java @@ -33,7 +33,7 @@ import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.BlobClient; import org.collectionspace.services.client.PayloadOutputPart; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; @@ -125,7 +125,7 @@ public class BlobAuthRefsTest extends BaseServiceTest { } protected void createPersonRefs() throws Exception { - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // 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()); Response res = personAuthClient.create(multipart); @@ -153,7 +153,7 @@ public class BlobAuthRefsTest extends BaseServiceTest { protected String createPerson(String firstName, String surName, String shortId, String authRefName) throws Exception { String result = null; - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Map personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -250,7 +250,7 @@ public class BlobAuthRefsTest extends BaseServiceTest { return; } logger.debug("Cleaning up temporary resources created for testing ..."); - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // Delete Person resource(s) (before PersonAuthority resources). for (String resourceId : personIdsCreated) { // Note: Any non-success responses are ignored and not reported. diff --git a/services/claim/client/src/test/java/org/collectionspace/services/client/test/ClaimAuthRefsTest.java b/services/claim/client/src/test/java/org/collectionspace/services/client/test/ClaimAuthRefsTest.java index 8cc3ba40c..0faf71cd1 100644 --- a/services/claim/client/src/test/java/org/collectionspace/services/client/test/ClaimAuthRefsTest.java +++ b/services/claim/client/src/test/java/org/collectionspace/services/client/test/ClaimAuthRefsTest.java @@ -33,7 +33,7 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.ClaimClient; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.client.PoxPayloadIn; @@ -136,7 +136,7 @@ public class ClaimAuthRefsTest extends BaseServiceTest { protected void createPersonRefs() throws Exception{ // Create a temporary PersonAuthority resource, and its corresponding // refName by which it can be identified. - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance( PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName()); Response res = personAuthClient.create(multipart); @@ -164,7 +164,7 @@ public class ClaimAuthRefsTest extends BaseServiceTest { } protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception { - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Map personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -293,7 +293,7 @@ public class ClaimAuthRefsTest extends BaseServiceTest { // // Delete Person resource(s) (before PersonAuthority resources). - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); for (String resourceId : personIdsCreated) { // Note: Any non-success responses are ignored and not reported. personAuthClient.deleteItem(personAuthCSID, resourceId).close(); diff --git a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java index 429232c21..8d5ca6d3d 100644 --- a/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java +++ b/services/collectionobject/client/src/test/java/org/collectionspace/services/client/test/CollectionObjectAuthRefsTest.java @@ -34,10 +34,10 @@ import org.collectionspace.services.OrganizationJAXBSchema; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionObjectClient; import org.collectionspace.services.client.CollectionSpaceClient; -import org.collectionspace.services.client.OrgAuthorityClient; +import org.collectionspace.services.client.OrganizationClient; import org.collectionspace.services.client.OrgAuthorityClientUtils; import org.collectionspace.services.client.PayloadOutputPart; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; @@ -220,7 +220,7 @@ public class CollectionObjectAuthRefsTest extends BaseServiceTest // since a save on Create might fail, and we would not want to create relations for something // that may not be created... private void handleRelationsPayload(DocumentWrapper wrapDoc, boolean forUpdate) throws Exception { - ServiceContext ctx = getServiceContext(); + ServiceContext ctx = getServiceContext(); PoxPayloadIn input = ctx.getInput(); DocumentModel documentModel = (wrapDoc.getWrappedObject()); String itemCsid = documentModel.getName(); diff --git a/services/conditioncheck/client/src/test/java/org/collectionspace/services/client/test/ConditioncheckAuthRefsTest.java b/services/conditioncheck/client/src/test/java/org/collectionspace/services/client/test/ConditioncheckAuthRefsTest.java index af8196de0..1a7ef765d 100644 --- a/services/conditioncheck/client/src/test/java/org/collectionspace/services/client/test/ConditioncheckAuthRefsTest.java +++ b/services/conditioncheck/client/src/test/java/org/collectionspace/services/client/test/ConditioncheckAuthRefsTest.java @@ -32,7 +32,7 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.ConditioncheckClient; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.client.PoxPayloadIn; @@ -146,7 +146,7 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -300,7 +300,7 @@ public class ConditioncheckAuthRefsTest extends BaseServiceTest personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -340,7 +340,7 @@ public class ConservationAuthRefsTest extends BaseServiceTestorg.collectionspace.services.config ${project.version} - + org.collectionspace.services org.collectionspace.services.common diff --git a/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeAuthRefsTest.java b/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeAuthRefsTest.java index eebe5109d..24b96e4cc 100644 --- a/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeAuthRefsTest.java +++ b/services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeAuthRefsTest.java @@ -33,7 +33,7 @@ import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.IntakeClient; import org.collectionspace.services.client.PayloadOutputPart; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; @@ -166,7 +166,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest { // // First, create a new person authority // - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance( PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName()); Response res = personAuthClient.create(multipart); @@ -205,7 +205,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest { protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception { String result = null; - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Map personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -329,7 +329,7 @@ public class IntakeAuthRefsTest extends BaseServiceTest { } // // Delete all the person records then the parent resource - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); for (String resourceId : personIdsCreated) { personAuthClient.deleteItem(personAuthCSID, resourceId).close(); } diff --git a/services/intake/client/src/test/java/org/collectionspace/services/client/test/OrganizationAuthRefDocsTest.java b/services/intake/client/src/test/java/org/collectionspace/services/client/test/OrganizationAuthRefDocsTest.java index f75673788..87a7a9095 100644 --- a/services/intake/client/src/test/java/org/collectionspace/services/client/test/OrganizationAuthRefDocsTest.java +++ b/services/intake/client/src/test/java/org/collectionspace/services/client/test/OrganizationAuthRefDocsTest.java @@ -32,7 +32,7 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.OrganizationJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.IntakeClient; -import org.collectionspace.services.client.OrgAuthorityClient; +import org.collectionspace.services.client.OrganizationClient; import org.collectionspace.services.client.OrgAuthorityClientUtils; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.client.PoxPayloadOut; @@ -172,7 +172,7 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest orgInfo = new HashMap(); orgInfo.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, shortId); @@ -255,7 +255,7 @@ public class OrganizationAuthRefDocsTest extends BaseServiceTest { * @throws Exception */ protected void createPersonRefs() throws Exception { - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance( PERSON_AUTHORITY_NAME, PERSON_AUTHORITY_NAME, personAuthClient.getCommonPartName()); Response res = personAuthClient.create(multipart); @@ -226,7 +226,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest { protected String createPerson(String firstName, String surName, String shortId, String authRefName) throws Exception { String result = null; - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Map personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -263,7 +263,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest { // Get the auth ref docs and check them - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Response res = personAuthClient.getReferencingObjects(personAuthCSID, currentOwnerPersonCSID); AuthorityRefDocList list = null; try { @@ -303,7 +303,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest { // // Get the referencing objects // - personAuthClient = new PersonAuthorityClient(); + personAuthClient = new PersonClient(); res = personAuthClient.getReferencingObjects(personAuthCSID, depositorPersonCSID); try { assertStatusCode(res, testName); @@ -354,7 +354,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest { // Get the auth ref docs and check them // Single scalar field - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Response res = personAuthClient.getReferencingObjects(personAuthCSID, insurerPersonCSID); AuthorityRefDocList list = null; try { @@ -425,7 +425,7 @@ public class PersonAuthRefDocsTest extends BaseServiceTest { intakeClient.delete(resourceId).close(); } // Delete persons before PersonAuth - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); for (String resourceId : personIdsCreated) { personAuthClient.deleteItem(personAuthCSID, resourceId).close(); } diff --git a/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java b/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java index b8ef0b8eb..7e8c473fd 100644 --- a/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java +++ b/services/loanin/client/src/test/java/org/collectionspace/services/client/test/LoaninAuthRefsTest.java @@ -32,7 +32,7 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.LoaninClient; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.client.PoxPayloadIn; @@ -164,7 +164,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest { protected void createPersonRefs() throws Exception{ - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // Create a temporary PersonAuthority resource, and its corresponding // refName by which it can be identified. PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance( @@ -212,7 +212,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest { protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception { String result = null; - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Map personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -365,7 +365,7 @@ public class LoaninAuthRefsTest extends BaseServiceTest { // // Delete Person resource(s) (before PersonAuthority resources). // - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); for (String csid : personIdsCreated) { Response res = null; try { diff --git a/services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutAuthRefsTest.java b/services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutAuthRefsTest.java index 94076561f..ccad5c08d 100644 --- a/services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutAuthRefsTest.java +++ b/services/loanout/client/src/test/java/org/collectionspace/services/client/test/LoanoutAuthRefsTest.java @@ -33,7 +33,7 @@ import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.LoanoutClient; import org.collectionspace.services.client.PayloadOutputPart; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; @@ -167,7 +167,7 @@ public class LoanoutAuthRefsTest extends BaseServiceTest { protected void createPersonRefs() throws Exception{ - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // Create a temporary PersonAuthority resource, and its corresponding // refName by which it can be identified. PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance( @@ -208,7 +208,7 @@ public class LoanoutAuthRefsTest extends BaseServiceTest { protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception { String result = null; - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Map personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -357,7 +357,7 @@ public class LoanoutAuthRefsTest extends BaseServiceTest { // // Delete the person terms/items before the person authority // - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); for (String resourceId : personIdsCreated) { Response res = null; try { diff --git a/services/media/client/src/test/java/org/collectionspace/services/client/test/MediaAuthRefsTest.java b/services/media/client/src/test/java/org/collectionspace/services/client/test/MediaAuthRefsTest.java index 86151b5c4..e0765df66 100644 --- a/services/media/client/src/test/java/org/collectionspace/services/client/test/MediaAuthRefsTest.java +++ b/services/media/client/src/test/java/org/collectionspace/services/client/test/MediaAuthRefsTest.java @@ -33,7 +33,7 @@ import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.MediaClient; import org.collectionspace.services.client.PayloadOutputPart; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; @@ -124,7 +124,7 @@ public class MediaAuthRefsTest extends BaseServiceTest { } protected void createPersonRefs() throws Exception { - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // 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()); @@ -153,7 +153,7 @@ public class MediaAuthRefsTest extends BaseServiceTest { protected String createPerson(String firstName, String surName, String shortId, String authRefName) throws Exception { String result = null; - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Map personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -255,7 +255,7 @@ public class MediaAuthRefsTest extends BaseServiceTest { return; } logger.debug("Cleaning up temporary resources created for testing ..."); - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // Delete Person resource(s) (before PersonAuthority resources). for (String resourceId : personIdsCreated) { // Note: Any non-success responses are ignored and not reported. diff --git a/services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementAuthRefsTest.java b/services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementAuthRefsTest.java index 0ab86d940..2387d472d 100644 --- a/services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementAuthRefsTest.java +++ b/services/movement/client/src/test/java/org/collectionspace/services/client/test/MovementAuthRefsTest.java @@ -33,7 +33,7 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.MovementClient; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PayloadInputPart; import org.collectionspace.services.client.PayloadOutputPart; @@ -155,7 +155,7 @@ public class MovementAuthRefsTest extends BaseServiceTest { } protected void createPersonRefs() throws Exception{ - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // Create a temporary PersonAuthority resource, and its corresponding // refName by which it can be identified. PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance( @@ -184,7 +184,7 @@ public class MovementAuthRefsTest extends BaseServiceTest { protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception { String result = null; - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Map personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -310,7 +310,7 @@ public class MovementAuthRefsTest extends BaseServiceTest { if (logger.isDebugEnabled()) { logger.debug("Cleaning up temporary resources created for testing ..."); } - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // Delete Person resource(s) (before PersonAuthority resources). for (String resourceId : personIdsCreated) { // Note: Any non-success responses are ignored and not reported. diff --git a/services/objectexit/client/src/test/java/org/collectionspace/services/client/test/ObjectExitAuthRefsTest.java b/services/objectexit/client/src/test/java/org/collectionspace/services/client/test/ObjectExitAuthRefsTest.java index 5916fdf86..f30b0d5d4 100644 --- a/services/objectexit/client/src/test/java/org/collectionspace/services/client/test/ObjectExitAuthRefsTest.java +++ b/services/objectexit/client/src/test/java/org/collectionspace/services/client/test/ObjectExitAuthRefsTest.java @@ -33,7 +33,7 @@ import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.ObjectExitClient; import org.collectionspace.services.client.PayloadOutputPart; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; @@ -143,7 +143,7 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest } protected void createPersonRefs() throws Exception { - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // 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()); @@ -172,7 +172,7 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest protected String createPerson(String firstName, String surName, String shortId, String authRefName) throws Exception { String result = null; - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Map personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -279,7 +279,7 @@ public class ObjectExitAuthRefsTest extends BaseServiceTest // // Next, delete the terms // - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // Delete Person resource(s) (before PersonAuthority resources). for (String resourceId : personIdsCreated) { // Note: Any non-success responses are ignored and not reported. diff --git a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java index bb2146d49..bcfcffd8c 100644 --- a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java +++ b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClient.java @@ -1,109 +1,14 @@ -/** - * OrgAuthorityClient.java - * - * {Purpose of This Class} - * - * {Other Notes Relating to This Class (Optional)} - * - * $LastChangedBy: $ $LastChangedRevision$ $LastChangedDate$ - * - * This document is a part of the source code and related artifacts for - * CollectionSpace, an open source collections management system for museums and - * related institutions: - * - * http://www.collectionspace.org http://wiki.collectionspace.org - * - * Copyright © 2009 {Contributing Institution} - * - * Licensed under the Educational Community License (ECL), Version 2.0. You may - * not use this file except in compliance with this License. - * - * You may obtain a copy of the ECL 2.0 License at - * https://source.collectionspace.org/collection-space/LICENSE.txt - */ package org.collectionspace.services.client; -import org.collectionspace.services.organization.OrganizationsCommon; -import org.collectionspace.services.organization.OrgauthoritiesCommon; +public class OrgAuthorityClient extends OrganizationClient { -/** - * The Class OrgAuthorityClient. - */ -public class OrgAuthorityClient extends AuthorityWithContactsClientImpl { - - public static final String SERVICE_NAME = "orgauthorities"; - public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; - public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT; - public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME; - public static final String TERM_INFO_GROUP_XPATH_BASE = "orgTermGroupList"; - - // - // Subitem constants - // - public static final String SERVICE_ITEM_NAME = "organizations"; - public static final String SERVICE_ITEM_PAYLOAD_NAME = SERVICE_ITEM_NAME; - // - // Payload Part/Schema part names - // - public static final String SERVICE_COMMON_PART_NAME = SERVICE_NAME - + PART_LABEL_SEPARATOR + PART_COMMON_LABEL; - public static final String SERVICE_ITEM_COMMON_PART_NAME = SERVICE_ITEM_NAME - + PART_LABEL_SEPARATOR + PART_COMMON_LABEL; - - // - // Constructors - // public OrgAuthorityClient() throws Exception { - super(); + super(); } public OrgAuthorityClient(String clientPropertiesFilename) throws Exception { - super(clientPropertiesFilename); - } - - // - // Overrides - // - - @Override - public String getServiceName() { - return SERVICE_NAME; - } - - @Override - public String getServicePathComponent() { - return SERVICE_PATH_COMPONENT; - } - - @Override - public Class getProxyClass() { - return OrgAuthorityProxy.class; - } - - @Override - public String getItemCommonPartName() { - return getCommonPartName(SERVICE_ITEM_NAME); - } - - @Override - public String getInAuthority(OrganizationsCommon item) { - return item.getInAuthority(); - } - - @Override - public void setInAuthority(OrganizationsCommon item, String inAuthorityCsid) { - item.setInAuthority(inAuthorityCsid); + super(clientPropertiesFilename); + // TODO Auto-generated constructor stub } - @Override - public String createAuthorityInstance(String shortIdentifier, String displayName) { - PoxPayloadOut poxPayloadout = OrgAuthorityClientUtils.createOrgAuthorityInstance(displayName, shortIdentifier, SERVICE_COMMON_PART_NAME); - return poxPayloadout.asXML(); - } - - @Override - public String createAuthorityItemInstance(String shortIdentifier, String displayName) { - PoxPayloadOut orgAuthorityInstance = OrgAuthorityClientUtils.createOrganizationInstance(shortIdentifier, displayName, SERVICE_ITEM_COMMON_PART_NAME); - return orgAuthorityInstance.asXML(); - } } diff --git a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java index 3d3618979..69520c7b1 100644 --- a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java +++ b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java @@ -60,9 +60,9 @@ public class OrgAuthorityClientUtils { * @return * @throws Exception */ - public static String getAuthorityRefName(String csid, OrgAuthorityClient client) throws Exception{ + public static String getAuthorityRefName(String csid, OrganizationClient client) throws Exception{ if (client==null) { - client = new OrgAuthorityClient(); + client = new OrganizationClient(); } Response res = client.read(csid); @@ -96,9 +96,9 @@ public class OrgAuthorityClientUtils { * @return * @throws Exception */ - public static String getOrgRefName(String inAuthority, String csid, OrgAuthorityClient client) throws Exception{ + public static String getOrgRefName(String inAuthority, String csid, OrganizationClient client) throws Exception{ if (client == null) { - client = new OrgAuthorityClient(); + client = new OrganizationClient(); } Response res = client.readItem(inAuthority, csid); @@ -142,7 +142,7 @@ public class OrgAuthorityClientUtils { //String refName = createOrgAuthRefName(shortIdentifier, displayName); //orgAuthority.setRefName(refName); orgAuthority.setVocabType("OrgAuthority"); - PoxPayloadOut multipart = new PoxPayloadOut(OrgAuthorityClient.SERVICE_PAYLOAD_NAME); + PoxPayloadOut multipart = new PoxPayloadOut(OrganizationClient.SERVICE_PAYLOAD_NAME); PayloadOutputPart commonPart = multipart.addPart(orgAuthority, MediaType.APPLICATION_XML_TYPE); commonPart.setLabel(headerLabel); @@ -165,7 +165,7 @@ public class OrgAuthorityClientUtils { */ public static String createItemInAuthority( String inAuthority, String orgAuthorityRefName, Map orgInfo, List terms, - Map> orgRepeatablesInfo, OrgAuthorityClient client) { + Map> orgRepeatablesInfo, OrganizationClient client) { // Expected status code: 201 Created int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode(); // Type of service request being tested @@ -327,7 +327,7 @@ public class OrgAuthorityClientUtils { organization.setHistoryNotes(historyNotesList); } - PoxPayloadOut multipart = new PoxPayloadOut(OrgAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME); + PoxPayloadOut multipart = new PoxPayloadOut(OrganizationClient.SERVICE_ITEM_PAYLOAD_NAME); PayloadOutputPart commonPart = multipart.addPart(organization, MediaType.APPLICATION_XML_TYPE); commonPart.setLabel(headerLabel); diff --git a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java index ddf9e901b..71ba05017 100644 --- a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java +++ b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityProxy.java @@ -6,7 +6,7 @@ import javax.ws.rs.Produces; /** * @version $Revision$ */ -@Path(OrgAuthorityClient.SERVICE_PATH + "/") +@Path(OrganizationClient.SERVICE_PATH + "/") @Produces({"application/xml"}) @Consumes({"application/xml"}) public interface OrgAuthorityProxy extends AuthorityWithContactsProxy { diff --git a/services/organization/client/src/main/java/org/collectionspace/services/client/OrganizationClient.java b/services/organization/client/src/main/java/org/collectionspace/services/client/OrganizationClient.java new file mode 100644 index 000000000..e3f21bcab --- /dev/null +++ b/services/organization/client/src/main/java/org/collectionspace/services/client/OrganizationClient.java @@ -0,0 +1,109 @@ +/** + * OrgAuthorityClient.java + * + * {Purpose of This Class} + * + * {Other Notes Relating to This Class (Optional)} + * + * $LastChangedBy: $ $LastChangedRevision$ $LastChangedDate$ + * + * This document is a part of the source code and related artifacts for + * CollectionSpace, an open source collections management system for museums and + * related institutions: + * + * http://www.collectionspace.org http://wiki.collectionspace.org + * + * Copyright © 2009 {Contributing Institution} + * + * Licensed under the Educational Community License (ECL), Version 2.0. You may + * not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + */ +package org.collectionspace.services.client; + +import org.collectionspace.services.organization.OrganizationsCommon; +import org.collectionspace.services.organization.OrgauthoritiesCommon; + +/** + * The Class OrgAuthorityClient. + */ +public class OrganizationClient extends AuthorityWithContactsClientImpl { + + public static final String SERVICE_NAME = "orgauthorities"; + public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; + public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT; + public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME; + public static final String TERM_INFO_GROUP_XPATH_BASE = "orgTermGroupList"; + + // + // Subitem constants + // + public static final String SERVICE_ITEM_NAME = "organizations"; + public static final String SERVICE_ITEM_PAYLOAD_NAME = SERVICE_ITEM_NAME; + // + // Payload Part/Schema part names + // + public static final String SERVICE_COMMON_PART_NAME = SERVICE_NAME + + PART_LABEL_SEPARATOR + PART_COMMON_LABEL; + public static final String SERVICE_ITEM_COMMON_PART_NAME = SERVICE_ITEM_NAME + + PART_LABEL_SEPARATOR + PART_COMMON_LABEL; + + // + // Constructors + // + public OrganizationClient() throws Exception { + super(); + } + + public OrganizationClient(String clientPropertiesFilename) throws Exception { + super(clientPropertiesFilename); + } + + // + // Overrides + // + + @Override + public String getServiceName() { + return SERVICE_NAME; + } + + @Override + public String getServicePathComponent() { + return SERVICE_PATH_COMPONENT; + } + + @Override + public Class getProxyClass() { + return OrgAuthorityProxy.class; + } + + @Override + public String getItemCommonPartName() { + return getCommonPartName(SERVICE_ITEM_NAME); + } + + @Override + public String getInAuthority(OrganizationsCommon item) { + return item.getInAuthority(); + } + + @Override + public void setInAuthority(OrganizationsCommon item, String inAuthorityCsid) { + item.setInAuthority(inAuthorityCsid); + } + + @Override + public String createAuthorityInstance(String shortIdentifier, String displayName) { + PoxPayloadOut poxPayloadout = OrgAuthorityClientUtils.createOrgAuthorityInstance(displayName, shortIdentifier, SERVICE_COMMON_PART_NAME); + return poxPayloadout.asXML(); + } + + @Override + public String createAuthorityItemInstance(String shortIdentifier, String displayName) { + PoxPayloadOut orgAuthorityInstance = OrgAuthorityClientUtils.createOrganizationInstance(shortIdentifier, displayName, SERVICE_ITEM_COMMON_PART_NAME); + return orgAuthorityInstance.asXML(); + } +} diff --git a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java index fe98e8d1d..7d7904257 100644 --- a/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java +++ b/services/organization/client/src/test/java/org/collectionspace/services/client/test/OrgAuthorityAuthRefsTest.java @@ -32,9 +32,9 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.OrganizationJAXBSchema; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; -import org.collectionspace.services.client.OrgAuthorityClient; +import org.collectionspace.services.client.OrganizationClient; import org.collectionspace.services.client.OrgAuthorityClientUtils; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; @@ -68,12 +68,12 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId); List personTerms = new ArrayList(); @@ -300,7 +300,7 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest entry : allResourceItemIdsCreated.entrySet()) { itemResourceId = entry.getKey(); @@ -410,7 +410,7 @@ public class OrgAuthorityAuthRefsTest extends BaseServiceTest testOrgMap = new HashMap(); @@ -188,7 +188,7 @@ public class OrgAuthorityServiceTest extends AbstractAuthorityServiceTest entry : allContactResourceIdsCreated.entrySet()) { contactResourceId = entry.getKey(); itemResourceId = entry.getValue(); diff --git a/services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java b/services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java index 40373aa91..ad6d556a0 100644 --- a/services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java +++ b/services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java @@ -26,8 +26,8 @@ package org.collectionspace.services.organization; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.Produces; -import org.collectionspace.services.client.OrgAuthorityClient; -import org.collectionspace.services.contact.AuthorityResourceWithContacts; +import org.collectionspace.services.client.OrganizationClient; +import org.collectionspace.services.common.vocabulary.AuthorityResourceWithContacts; import org.collectionspace.services.organization.nuxeo.OrganizationDocumentModelHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory; * related to Organization authority-related resources. */ -@Path(OrgAuthorityClient.SERVICE_PATH) +@Path(OrganizationClient.SERVICE_PATH) @Consumes("application/xml") @Produces("application/xml") public class OrgAuthorityResource extends @@ -49,22 +49,22 @@ public class OrgAuthorityResource extends public OrgAuthorityResource() { super(OrgauthoritiesCommon.class, OrgAuthorityResource.class, - OrgAuthorityClient.SERVICE_COMMON_PART_NAME, OrgAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME); + OrganizationClient.SERVICE_COMMON_PART_NAME, OrganizationClient.SERVICE_ITEM_COMMON_PART_NAME); } @Override public String getServiceName() { - return OrgAuthorityClient.SERVICE_NAME; + return OrganizationClient.SERVICE_NAME; } @Override public String getItemServiceName() { - return OrgAuthorityClient.SERVICE_ITEM_NAME; + return OrganizationClient.SERVICE_ITEM_NAME; } @Override public String getItemTermInfoGroupXPathBase() { - return OrgAuthorityClient.TERM_INFO_GROUP_XPATH_BASE; + return OrganizationClient.TERM_INFO_GROUP_XPATH_BASE; } } diff --git a/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrgAuthorityDocumentModelHandler.java b/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrgAuthorityDocumentModelHandler.java index 9f350736b..be53db7c1 100644 --- a/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrgAuthorityDocumentModelHandler.java +++ b/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrgAuthorityDocumentModelHandler.java @@ -24,7 +24,7 @@ package org.collectionspace.services.organization.nuxeo; import org.collectionspace.services.organization.OrgauthoritiesCommon; -import org.collectionspace.services.client.OrgAuthorityClient; +import org.collectionspace.services.client.OrganizationClient; import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityDocumentModelHandler; /** @@ -35,7 +35,7 @@ public class OrgAuthorityDocumentModelHandler extends AuthorityDocumentModelHandler { public OrgAuthorityDocumentModelHandler() { - super(OrgAuthorityClient.SERVICE_COMMON_PART_NAME, OrgAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME); + super(OrganizationClient.SERVICE_COMMON_PART_NAME, OrganizationClient.SERVICE_ITEM_COMMON_PART_NAME); } /** diff --git a/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java b/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java index 8d1f4b9ee..3d73181b5 100644 --- a/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java +++ b/services/organization/service/src/main/java/org/collectionspace/services/organization/nuxeo/OrganizationDocumentModelHandler.java @@ -23,9 +23,8 @@ */ package org.collectionspace.services.organization.nuxeo; -import org.collectionspace.services.client.OrgAuthorityClient; -import org.collectionspace.services.client.PersonAuthorityClient; -import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler; +import org.collectionspace.services.client.OrganizationClient; +import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemWithContactsDocumentModelHandler; import org.collectionspace.services.organization.OrganizationsCommon; /** @@ -33,15 +32,15 @@ import org.collectionspace.services.organization.OrganizationsCommon; * */ public class OrganizationDocumentModelHandler - extends AuthorityItemDocumentModelHandler { + extends AuthorityItemWithContactsDocumentModelHandler { public OrganizationDocumentModelHandler() { - super(OrgAuthorityClient.SERVICE_COMMON_PART_NAME, OrgAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME); + super(OrganizationClient.SERVICE_COMMON_PART_NAME, OrganizationClient.SERVICE_ITEM_COMMON_PART_NAME); } @Override public String getAuthorityServicePath(){ - return OrgAuthorityClient.SERVICE_PATH_COMPONENT; // CSPACE-3932 + return OrganizationClient.SERVICE_PATH_COMPONENT; // CSPACE-3932 } /** @@ -57,7 +56,7 @@ public class OrganizationDocumentModelHandler @Override public String getParentCommonSchemaName() { // TODO Auto-generated method stub - return OrgAuthorityClient.SERVICE_COMMON_PART_NAME; + return OrganizationClient.SERVICE_COMMON_PART_NAME; } } diff --git a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java index 44e1a85c6..d91e5b1eb 100644 --- a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java +++ b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClient.java @@ -1,110 +1,14 @@ -/** - * PersonAuthorityClient.java - * - * This document is a part of the source code and related artifacts for - * CollectionSpace, an open source collections management system for museums and - * related institutions: - * - * http://www.collectionspace.org http://wiki.collectionspace.org - * - * Copyright © 2009 University of California, Berkeley - * - * Licensed under the Educational Community License (ECL), Version 2.0. You may - * not use this file except in compliance with this License. - * - * You may obtain a copy of the ECL 2.0 License at - * https://source.collectionspace.org/collection-space/LICENSE.txt - */ package org.collectionspace.services.client; -import org.collectionspace.services.person.PersonauthoritiesCommon; -import org.collectionspace.services.person.PersonsCommon; +public class PersonAuthorityClient extends PersonClient { -/** - * The Class PersonAuthorityClient. - */ -public class PersonAuthorityClient extends AuthorityWithContactsClientImpl { - - public static final String SERVICE_NAME = "personauthorities"; - public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; - public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT; - public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME; - public static final String TERM_INFO_GROUP_XPATH_BASE = "personTermGroupList"; - // - // Subitem constants - // - public static final String SERVICE_ITEM_NAME = "persons"; - public static final String SERVICE_ITEM_PAYLOAD_NAME = SERVICE_ITEM_NAME; - // - // Payload Part/Schema part names - // - public static final String SERVICE_COMMON_PART_NAME = SERVICE_NAME - + PART_LABEL_SEPARATOR + PART_COMMON_LABEL; - public static final String SERVICE_ITEM_COMMON_PART_NAME = SERVICE_ITEM_NAME - + PART_LABEL_SEPARATOR + PART_COMMON_LABEL; - - // - // Constructors - // public PersonAuthorityClient() throws Exception { - super(); + super(); } public PersonAuthorityClient(String clientPropertiesFilename) throws Exception { - super(clientPropertiesFilename); - } - - // - // Overrides - // - - @Override - public String getServiceName() { - return SERVICE_NAME; + super(clientPropertiesFilename); + // TODO Auto-generated constructor stub } - @Override - public String getServicePathComponent() { - return SERVICE_PATH_COMPONENT; - } - - @Override - public String getItemCommonPartName() { - return getCommonPartName(SERVICE_ITEM_PAYLOAD_NAME); - } - - @Deprecated // Use getItemCommonPartName() instead - public String getCommonPartItemName() { - return getCommonPartName(SERVICE_ITEM_PAYLOAD_NAME); - } - - @Override - public Class getProxyClass() { - return PersonAuthorityProxy.class; - } - - @Override - public String getInAuthority(PersonsCommon item) { - return item.getInAuthority(); - } - - @Override - public void setInAuthority(PersonsCommon item, String inAuthorityCsid) { - item.setInAuthority(inAuthorityCsid); - } - - // - // Should return a valid XML payload for creating an authority instance - // - @Override - public String createAuthorityInstance(String shortIdentifier, String displayName) { - PoxPayloadOut personAuthorityInstance = PersonAuthorityClientUtils.createPersonAuthorityInstance(displayName, shortIdentifier, SERVICE_COMMON_PART_NAME); - return personAuthorityInstance.asXML(); - } - - @Override - public String createAuthorityItemInstance(String shortIdentifier, String displayName) { - PoxPayloadOut personAuthorityInstance = PersonAuthorityClientUtils.createPersonInstance(shortIdentifier, displayName, SERVICE_ITEM_COMMON_PART_NAME); - return personAuthorityInstance.asXML(); - } } diff --git a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClientUtils.java b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClientUtils.java index 029da410e..9c85b5687 100644 --- a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClientUtils.java +++ b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityClientUtils.java @@ -64,9 +64,9 @@ public class PersonAuthorityClientUtils { * @return * @throws Exception */ - public static String getAuthorityRefName(String csid, PersonAuthorityClient client) throws Exception{ + public static String getAuthorityRefName(String csid, PersonClient client) throws Exception{ if (client == null) { - client = new PersonAuthorityClient(); + client = new PersonClient(); } Response res = client.read(csid); try { @@ -99,9 +99,9 @@ public class PersonAuthorityClientUtils { * @return * @throws Exception */ - public static String getPersonRefName(String inAuthority, String csid, PersonAuthorityClient client) throws Exception{ + public static String getPersonRefName(String inAuthority, String csid, PersonClient client) throws Exception{ if ( client == null) { - client = new PersonAuthorityClient(); + client = new PersonClient(); } Response res = client.readItem(inAuthority, csid); try { @@ -143,7 +143,7 @@ public class PersonAuthorityClientUtils { //String refName = createPersonAuthRefName(shortIdentifier, displayName); //personAuthority.setRefName(refName); personAuthority.setVocabType("PersonAuthority"); - PoxPayloadOut multipart = new PoxPayloadOut(PersonAuthorityClient.SERVICE_PAYLOAD_NAME); + PoxPayloadOut multipart = new PoxPayloadOut(PersonClient.SERVICE_PAYLOAD_NAME); PayloadOutputPart commonPart = multipart.addPart(personAuthority, MediaType.APPLICATION_XML_TYPE); commonPart.setLabel(headerLabel); @@ -281,7 +281,7 @@ public class PersonAuthorityClientUtils { } } - PoxPayloadOut multipart = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME); + PoxPayloadOut multipart = new PoxPayloadOut(PersonClient.SERVICE_ITEM_PAYLOAD_NAME); PayloadOutputPart commonPart = multipart.addPart(person, MediaType.APPLICATION_XML_TYPE); commonPart.setLabel(headerLabel); @@ -304,7 +304,7 @@ public class PersonAuthorityClientUtils { public static String createItemInAuthority(String vcsid, String personAuthorityRefName, Map personMap, List terms, Map> personRepeatablesMap, - PersonAuthorityClient client ) { + PersonClient client ) { // Expected status code: 201 Created int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode(); // Type of service request being tested diff --git a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java index b348057c6..31eef2382 100644 --- a/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java +++ b/services/person/client/src/main/java/org/collectionspace/services/client/PersonAuthorityProxy.java @@ -7,7 +7,7 @@ import javax.ws.rs.Produces; /** * @version $Revision:$ */ -@Path(PersonAuthorityClient.SERVICE_PATH + "/") +@Path(PersonClient.SERVICE_PATH + "/") @Produces({"application/xml"}) @Consumes({"application/xml"}) public interface PersonAuthorityProxy extends AuthorityWithContactsProxy { diff --git a/services/person/client/src/main/java/org/collectionspace/services/client/PersonClient.java b/services/person/client/src/main/java/org/collectionspace/services/client/PersonClient.java new file mode 100644 index 000000000..d9484ea7d --- /dev/null +++ b/services/person/client/src/main/java/org/collectionspace/services/client/PersonClient.java @@ -0,0 +1,110 @@ +/** + * PersonAuthorityClient.java + * + * This document is a part of the source code and related artifacts for + * CollectionSpace, an open source collections management system for museums and + * related institutions: + * + * http://www.collectionspace.org http://wiki.collectionspace.org + * + * Copyright © 2009 University of California, Berkeley + * + * Licensed under the Educational Community License (ECL), Version 2.0. You may + * not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + */ +package org.collectionspace.services.client; + +import org.collectionspace.services.person.PersonauthoritiesCommon; +import org.collectionspace.services.person.PersonsCommon; + +/** + * The Class PersonAuthorityClient. + */ +public class PersonClient extends AuthorityWithContactsClientImpl { + + public static final String SERVICE_NAME = "personauthorities"; + public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; + public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT; + public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME; + public static final String TERM_INFO_GROUP_XPATH_BASE = "personTermGroupList"; + // + // Subitem constants + // + public static final String SERVICE_ITEM_NAME = "persons"; + public static final String SERVICE_ITEM_PAYLOAD_NAME = SERVICE_ITEM_NAME; + // + // Payload Part/Schema part names + // + public static final String SERVICE_COMMON_PART_NAME = SERVICE_NAME + + PART_LABEL_SEPARATOR + PART_COMMON_LABEL; + public static final String SERVICE_ITEM_COMMON_PART_NAME = SERVICE_ITEM_NAME + + PART_LABEL_SEPARATOR + PART_COMMON_LABEL; + + // + // Constructors + // + public PersonClient() throws Exception { + super(); + } + + public PersonClient(String clientPropertiesFilename) throws Exception { + super(clientPropertiesFilename); + } + + // + // Overrides + // + + @Override + public String getServiceName() { + return SERVICE_NAME; + } + + @Override + public String getServicePathComponent() { + return SERVICE_PATH_COMPONENT; + } + + @Override + public String getItemCommonPartName() { + return getCommonPartName(SERVICE_ITEM_PAYLOAD_NAME); + } + + @Deprecated // Use getItemCommonPartName() instead + public String getCommonPartItemName() { + return getCommonPartName(SERVICE_ITEM_PAYLOAD_NAME); + } + + @Override + public Class getProxyClass() { + return PersonAuthorityProxy.class; + } + + @Override + public String getInAuthority(PersonsCommon item) { + return item.getInAuthority(); + } + + @Override + public void setInAuthority(PersonsCommon item, String inAuthorityCsid) { + item.setInAuthority(inAuthorityCsid); + } + + // + // Should return a valid XML payload for creating an authority instance + // + @Override + public String createAuthorityInstance(String shortIdentifier, String displayName) { + PoxPayloadOut personAuthorityInstance = PersonAuthorityClientUtils.createPersonAuthorityInstance(displayName, shortIdentifier, SERVICE_COMMON_PART_NAME); + return personAuthorityInstance.asXML(); + } + + @Override + public String createAuthorityItemInstance(String shortIdentifier, String displayName) { + PoxPayloadOut personAuthorityInstance = PersonAuthorityClientUtils.createPersonInstance(shortIdentifier, displayName, SERVICE_ITEM_COMMON_PART_NAME); + return personAuthorityInstance.asXML(); + } +} diff --git a/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthoritySearchTest.java b/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthoritySearchTest.java index b010db497..78a24afa2 100644 --- a/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthoritySearchTest.java +++ b/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthoritySearchTest.java @@ -33,7 +33,7 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.jaxb.AbstractCommonList; @@ -59,12 +59,12 @@ public class PersonAuthoritySearchTest extends BaseServiceTest entry : allItemResourceIdsCreated.entrySet()) { @@ -565,7 +565,7 @@ public class PersonAuthoritySearchTest extends BaseServiceTest partialTermPersonMap = new HashMap(); // // Fill values for the UNICODE item @@ -657,7 +657,7 @@ public class PersonAuthoritySearchTest extends BaseServiceTest partialTermPersonMap, List partialTerms, Map> partialTermRepeatablesMap) throws Exception { diff --git a/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServicePerfTest.java b/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServicePerfTest.java index 15200e89a..833354fe0 100644 --- a/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServicePerfTest.java +++ b/services/person/client/src/test/java/org/collectionspace/services/client/test/PersonAuthorityServicePerfTest.java @@ -31,7 +31,7 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.jaxb.AbstractCommonList; @@ -94,12 +94,12 @@ public class PersonAuthorityServicePerfTest extends BaseServiceTest personInfo = new HashMap(); String shortId = "MarkTwainAuthor" + identifier; @@ -300,7 +300,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest fieldProperties = new HashMap(); @@ -554,7 +554,7 @@ public class PersonAuthorityServiceTest extends AbstractAuthorityServiceTest entry : allContactResourceIdsCreated.entrySet()) { contactResourceId = entry.getKey(); diff --git a/services/person/service/src/main/java/org/collectionspace/services/person/PersonAuthorityResource.java b/services/person/service/src/main/java/org/collectionspace/services/person/PersonAuthorityResource.java index 2724e8be8..9d6f1c8ac 100644 --- a/services/person/service/src/main/java/org/collectionspace/services/person/PersonAuthorityResource.java +++ b/services/person/service/src/main/java/org/collectionspace/services/person/PersonAuthorityResource.java @@ -25,8 +25,8 @@ package org.collectionspace.services.person; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.Produces; -import org.collectionspace.services.client.PersonAuthorityClient; -import org.collectionspace.services.contact.AuthorityResourceWithContacts; +import org.collectionspace.services.client.PersonClient; +import org.collectionspace.services.common.vocabulary.AuthorityResourceWithContacts; import org.collectionspace.services.person.nuxeo.PersonDocumentModelHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory; * Handles, dispatches, and returns responses to RESTful requests related to * Person authority-related resources. */ -@Path(PersonAuthorityClient.SERVICE_PATH) +@Path(PersonClient.SERVICE_PATH) @Consumes("application/xml") @Produces("application/xml") public class PersonAuthorityResource extends AuthorityResourceWithContacts { @@ -46,22 +46,22 @@ public class PersonAuthorityResource extends AuthorityResourceWithContacts { public PersonAuthorityDocumentModelHandler() { - super(PersonAuthorityClient.SERVICE_COMMON_PART_NAME, PersonAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME); + super(PersonClient.SERVICE_COMMON_PART_NAME, PersonClient.SERVICE_ITEM_COMMON_PART_NAME); } /** diff --git a/services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonDocumentModelHandler.java b/services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonDocumentModelHandler.java index 088abf597..59955e769 100644 --- a/services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonDocumentModelHandler.java +++ b/services/person/service/src/main/java/org/collectionspace/services/person/nuxeo/PersonDocumentModelHandler.java @@ -23,8 +23,8 @@ */ package org.collectionspace.services.person.nuxeo; -import org.collectionspace.services.client.PersonAuthorityClient; -import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemDocumentModelHandler; +import org.collectionspace.services.client.PersonClient; +import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityItemWithContactsDocumentModelHandler; import org.collectionspace.services.person.PersonsCommon; /** @@ -32,15 +32,15 @@ import org.collectionspace.services.person.PersonsCommon; * */ public class PersonDocumentModelHandler - extends AuthorityItemDocumentModelHandler { + extends AuthorityItemWithContactsDocumentModelHandler { public PersonDocumentModelHandler() { - super(PersonAuthorityClient.SERVICE_COMMON_PART_NAME, PersonAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME); + super(PersonClient.SERVICE_COMMON_PART_NAME, PersonClient.SERVICE_ITEM_COMMON_PART_NAME); } @Override public String getAuthorityServicePath(){ - return PersonAuthorityClient.SERVICE_PATH_COMPONENT; // CSPACE-3932 + return PersonClient.SERVICE_PATH_COMPONENT; // CSPACE-3932 } /** @@ -56,7 +56,7 @@ public class PersonDocumentModelHandler @Override public String getParentCommonSchemaName() { // TODO Auto-generated method stub - return PersonAuthorityClient.SERVICE_COMMON_PART_NAME; + return PersonClient.SERVICE_COMMON_PART_NAME; } } diff --git a/services/pottag/client/src/test/java/org/collectionspace/services/client/test/PottagAuthRefsTest.java b/services/pottag/client/src/test/java/org/collectionspace/services/client/test/PottagAuthRefsTest.java index 9637b4ab5..bd0463654 100644 --- a/services/pottag/client/src/test/java/org/collectionspace/services/client/test/PottagAuthRefsTest.java +++ b/services/pottag/client/src/test/java/org/collectionspace/services/client/test/PottagAuthRefsTest.java @@ -32,7 +32,7 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.PottagClient; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.client.PoxPayloadIn; @@ -122,7 +122,7 @@ public class PottagAuthRefsTest extends BaseServiceTest { } protected void createPersonRefs() throws Exception { - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // Create a temporary PersonAuthority resource, and its corresponding // refName by which it can be identified. PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance( @@ -145,7 +145,7 @@ public class PottagAuthRefsTest extends BaseServiceTest { } protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception { - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Map personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -273,7 +273,7 @@ public class PottagAuthRefsTest extends BaseServiceTest { // // Delete Person resource(s) (before PersonAuthority resources). - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); for (String resourceId : personIdsCreated) { // Note: Any non-success responses are ignored and not reported. personAuthClient.deleteItem(personAuthCSID, resourceId).close(); diff --git a/services/propagation/client/src/test/java/org/collectionspace/services/client/test/PropagationAuthRefsTest.java b/services/propagation/client/src/test/java/org/collectionspace/services/client/test/PropagationAuthRefsTest.java index b34b6f32c..9b518ff7a 100644 --- a/services/propagation/client/src/test/java/org/collectionspace/services/client/test/PropagationAuthRefsTest.java +++ b/services/propagation/client/src/test/java/org/collectionspace/services/client/test/PropagationAuthRefsTest.java @@ -33,7 +33,7 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.PropagationClient; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.client.PoxPayloadIn; @@ -135,7 +135,7 @@ public class PropagationAuthRefsTest extends BaseServiceTest * @throws Exception */ protected void createPersonRefs() throws Exception { - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // Create a temporary PersonAuthority resource, and its corresponding // refName by which it can be identified. PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance( @@ -162,7 +162,7 @@ public class PropagationAuthRefsTest extends BaseServiceTest } protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception { - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Map personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -294,7 +294,7 @@ public class PropagationAuthRefsTest extends BaseServiceTest // // Delete Person resource(s) (before PersonAuthority resources). - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); for (String resourceId : personIdsCreated) { // Note: Any non-success responses are ignored and not reported. personAuthClient.deleteItem(personAuthCSID, resourceId).close(); diff --git a/services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java b/services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java index eaf89ee7e..768e8f3bb 100644 --- a/services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java +++ b/services/relation/client/src/test/java/org/collectionspace/services/client/test/RelationServiceTest.java @@ -32,7 +32,7 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.PayloadOutputPart; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.client.RelationClient; @@ -103,7 +103,7 @@ public class RelationServiceTest extends AbstractPoxServiceTestImpl personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); diff --git a/services/uoc/client/src/test/java/org/collectionspace/services/client/test/UocAuthRefsTest.java b/services/uoc/client/src/test/java/org/collectionspace/services/client/test/UocAuthRefsTest.java index 5eda18c2c..ff2e12edd 100644 --- a/services/uoc/client/src/test/java/org/collectionspace/services/client/test/UocAuthRefsTest.java +++ b/services/uoc/client/src/test/java/org/collectionspace/services/client/test/UocAuthRefsTest.java @@ -32,7 +32,7 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.PersonJAXBSchema; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.UocClient; -import org.collectionspace.services.client.PersonAuthorityClient; +import org.collectionspace.services.client.PersonClient; import org.collectionspace.services.client.PersonAuthorityClientUtils; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.client.PoxPayloadIn; @@ -154,7 +154,7 @@ public class UocAuthRefsTest extends BaseServiceTest { protected void createPersonRefs() throws Exception { - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); // Create a temporary PersonAuthority resource, and its corresponding // refName by which it can be identified. PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(PERSON_AUTHORITY_NAME, @@ -212,7 +212,7 @@ public class UocAuthRefsTest extends BaseServiceTest { throws Exception { String result = null; - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); Map personInfo = new HashMap(); personInfo.put(PersonJAXBSchema.FORE_NAME, firstName); personInfo.put(PersonJAXBSchema.SUR_NAME, surName); @@ -356,7 +356,7 @@ public class UocAuthRefsTest extends BaseServiceTest { // // Delete Person resource(s) (before PersonAuthority resources). // - PersonAuthorityClient personAuthClient = new PersonAuthorityClient(); + PersonClient personAuthClient = new PersonClient(); for (String csid : personIdsCreated) { Response res = null; try { -- 2.47.3