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;
}
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);
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);
// 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.
<dependencies>
<!-- CollectionSpace dependencies -->
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.contact.service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.config</artifactId>
* 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;
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;
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();
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.
--- /dev/null
+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<AICommon> extends AuthorityItemDocumentModelHandler<AICommon> {
+
+ public AuthorityItemWithContactsDocumentModelHandler(String authorityCommonSchemaName,
+ String authorityItemCommonSchemaName) {
+ super(authorityCommonSchemaName, authorityItemCommonSchemaName);
+ // TODO Auto-generated constructor stub
+ }
+
+ @Override
+ public void completeCreate(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+ super.completeCreate(wrapDoc);
+ handleContactPayload(wrapDoc);
+ }
+
+ private void handleContactPayload(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
+ ContactClient contactClient = new ContactClient();
+ ServiceContext<PoxPayloadIn, PoxPayloadOut> 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 = "<?xml version='1.0' encoding='UTF-8'?><document>%s</document>";
+ String xmlPayload = String.format(payloadTemplate, contactPart.asXML());
+ PoxPayloadIn input = new PoxPayloadIn(xmlPayload);
+
+ AuthorityResourceWithContacts contactResource = (AuthorityResourceWithContacts) getServiceContext().getResource();
+
+ contactResource.createContact(getServiceContext(), authorityCsid, itemCsid, input, null);
+ }
+}
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;
}
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);
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<String, String> personInfo = new HashMap<String, String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
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.
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;
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);
}
protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception {
- PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ PersonClient personAuthClient = new PersonClient();
Map<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
//
// 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();
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;
*/
private void createPersonAuthority(String displayName, String shortIdentifier) throws Exception {
testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
- PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ PersonClient personAuthClient = new PersonClient();
PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
displayName, shortIdentifier, personAuthClient.getCommonPartName());
Response res = personAuthClient.create(multipart);
term.setTermDisplayName(termName);
term.setTermName(termName);
personTerms.add(term);
- PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ PersonClient personAuthClient = new PersonClient();
PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
personAuthRefName, personInfo, personTerms, personAuthClient.getItemCommonPartName());
Response res = personAuthClient.createItem(personAuthCSID, multipart);
*/
private void createOrgAuthority(String displayName, String shortIdentifier) throws Exception {
testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
- OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
+ OrganizationClient orgAuthClient = new OrganizationClient();
PoxPayloadOut multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
displayName, shortIdentifier, orgAuthClient.getCommonPartName());
Response res = orgAuthClient.create(multipart);
term.setTermName(shortName);
orgTerms.add(term);
- OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
+ OrganizationClient orgAuthClient = new OrganizationClient();
PoxPayloadOut multipart =
OrgAuthorityClientUtils.createOrganizationInstance(orgAuthRefName, orgInfo, orgTerms, orgAuthClient.getItemCommonPartName());
Response res = orgAuthClient.createItem(orgAuthCSID, multipart);
//
// Delete persons before PersonAuth
- 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();
//
// Delete organizations before OrgAuth
- OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
+ OrganizationClient orgAuthClient = new OrganizationClient();
for (String resourceId : orgIdsCreated) {
// Note: Any non-success responses are ignored and not reported.
orgAuthClient.deleteItem(orgAuthCSID, resourceId).close();
// 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<DocumentModel> wrapDoc, boolean forUpdate) throws Exception {
- ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = getServiceContext();
+ ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = getServiceContext();
PoxPayloadIn input = ctx.getInput();
DocumentModel documentModel = (wrapDoc.getWrappedObject());
String itemCsid = documentModel.getName();
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;
}
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(
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<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
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) {
import org.collectionspace.services.PersonJAXBSchema;
import org.collectionspace.services.client.CollectionSpaceClient;
import org.collectionspace.services.client.ConservationClient;
-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;
}
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(
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<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
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) {
<artifactId>org.collectionspace.services.config</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
+<!-- <dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.authority.service</artifactId>
<optional>true</optional>
<version>${project.version}</version>
</dependency>
- <dependency>
+ --> <dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.common</artifactId>
</dependency>
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;
//
// 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);
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<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
}
//
// 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();
}
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;
* @throws Exception
*/
protected void createOrgRefs() throws Exception{
- OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
+ OrganizationClient orgAuthClient = new OrganizationClient();
//orgAuthRefName =
// OrgAuthorityClientUtils.createOrgAuthRefName(ORGANIZATION_AUTHORITY_NAME, null);
PoxPayloadOut multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
protected String createOrganization(String shortId, String shortName, String longName) throws Exception {
String result = null;
- OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
+ OrganizationClient orgAuthClient = new OrganizationClient();
Map<String, String> orgInfo = new HashMap<String,String>();
orgInfo.put(OrganizationJAXBSchema.SHORT_IDENTIFIER, shortId);
testSetup(STATUS_OK, ServiceRequestType.READ);
// Get the auth ref docs and check them
- OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
+ OrganizationClient orgAuthClient = new OrganizationClient();
Response refDocListResp = orgAuthClient.getReferencingObjects(orgAuthCSID, currentOwnerOrgCSID);
AuthorityRefDocList list = null;
try {
intakeClient.delete(resourceId).close();
}
// Delete persons before PersonAuth
- OrgAuthorityClient personAuthClient = new OrgAuthorityClient();
+ OrganizationClient personAuthClient = new OrganizationClient();
for (String resourceId : orgIdsCreated) {
personAuthClient.deleteItem(orgAuthCSID, resourceId).close();
}
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.PoxPayloadOut;
import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils;
* @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);
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<String, String> personInfo = new HashMap<String, String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
// 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 {
//
// Get the referencing objects
//
- personAuthClient = new PersonAuthorityClient();
+ personAuthClient = new PersonClient();
res = personAuthClient.getReferencingObjects(personAuthCSID, depositorPersonCSID);
try {
assertStatusCode(res, testName);
// 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 {
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();
}
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;
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(
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<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
//
// Delete Person resource(s) (before PersonAuthority resources).
//
- PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ PersonClient personAuthClient = new PersonClient();
for (String csid : personIdsCreated) {
Response res = null;
try {
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;
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(
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<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
//
// 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 {
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;
}
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());
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<String, String> personInfo = new HashMap<String, String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
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.
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;
}
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(
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<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
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.
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;
}
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());
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<String, String> personInfo = new HashMap<String, String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
//
// 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.
-/**
- * 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<OrgauthoritiesCommon, OrganizationsCommon, OrgAuthorityProxy> {
-
- 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<OrgAuthorityProxy> 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();
- }
}
* @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);
* @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);
//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);
*/
public static String createItemInAuthority( String inAuthority,
String orgAuthorityRefName, Map<String, String> orgInfo, List<OrgTermGroup> terms,
- Map<String, List<String>> orgRepeatablesInfo, OrgAuthorityClient client) {
+ Map<String, List<String>> orgRepeatablesInfo, OrganizationClient client) {
// Expected status code: 201 Created
int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();
// Type of service request being tested
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);
/**
* @version $Revision$
*/
-@Path(OrgAuthorityClient.SERVICE_PATH + "/")
+@Path(OrganizationClient.SERVICE_PATH + "/")
@Produces({"application/xml"})
@Consumes({"application/xml"})
public interface OrgAuthorityProxy extends AuthorityWithContactsProxy {
--- /dev/null
+/**
+ * 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<OrgauthoritiesCommon, OrganizationsCommon, OrgAuthorityProxy> {
+
+ 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<OrgAuthorityProxy> 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();
+ }
+}
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;
@Override
public String getServicePathComponent() {
- return OrgAuthorityClient.SERVICE_PATH_COMPONENT;
+ return OrganizationClient.SERVICE_PATH_COMPONENT;
}
@Override
protected String getServiceName() {
- return OrgAuthorityClient.SERVICE_NAME;
+ return OrganizationClient.SERVICE_NAME;
}
protected String knownItemResourceId = null;
testSetup(STATUS_CREATED, ServiceRequestType.CREATE);
// Create a new Organization Authority resource.
- OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
+ OrganizationClient orgAuthClient = new OrganizationClient();
String shortId = createIdentifier();
String displayName = "TestOrgAuth-" + shortId;
//String baseRefName = OrgAuthorityClientUtils.createOrgAuthRefName(shortId, null);
* @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(
* @throws Exception
*/
protected String createPerson(String personAuthCSID, String firstName, String surName, String shortId, String authRefName ) throws Exception {
- PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ PersonClient personAuthClient = new PersonClient();
Map<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.SHORT_IDENTIFIER, shortId);
List<PersonTermGroup> personTerms = new ArrayList<PersonTermGroup>();
testSetup(STATUS_OK, ServiceRequestType.READ);
// Submit the request to the service and store the response.
- OrgAuthorityClient orgAuthClient = new OrgAuthorityClient();
+ OrganizationClient orgAuthClient = new OrganizationClient();
Response res = orgAuthClient.readItem(knownResourceId, knownItemResourceId);
OrganizationsCommon organization = null;
try {
String parentResourceId;
String itemResourceId;
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
// Clean up item resources.
for (Map.Entry<String, String> entry : allResourceItemIdsCreated.entrySet()) {
itemResourceId = entry.getKey();
// that we needed to delete the objects/records referencing these authority items first since
// we can't delete authority items that still have records referencing them
//
- 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.
import org.collectionspace.services.contact.AddressGroup;
import org.collectionspace.services.contact.AddressGroupList;
import org.collectionspace.services.contact.ContactsCommon;
-import org.collectionspace.services.client.OrgAuthorityClient;
+import org.collectionspace.services.client.OrganizationClient;
import org.collectionspace.services.client.OrgAuthorityClientUtils;
import org.collectionspace.services.jaxb.AbstractCommonList;
import org.collectionspace.services.organization.OrgauthoritiesCommon;
@Override
public String getServicePathComponent() {
- return OrgAuthorityClient.SERVICE_PATH_COMPONENT;
+ return OrganizationClient.SERVICE_PATH_COMPONENT;
}
@Override
protected String getServiceName() {
- return OrgAuthorityClient.SERVICE_NAME;
+ return OrganizationClient.SERVICE_NAME;
}
private final String TEST_ORG_NAME = "Test Org";
*/
@Override
protected CollectionSpaceClient getClientInstance() throws Exception {
- return new OrgAuthorityClient();
+ return new OrganizationClient();
}
@Override
protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
- return new OrgAuthorityClient(clientPropertiesFilename);
+ return new OrganizationClient(clientPropertiesFilename);
}
@Override
protected PoxPayloadOut createInstance(String identifier) throws Exception {
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
String displayName = "displayName-" + identifier;
PoxPayloadOut multipart = OrgAuthorityClientUtils.createOrgAuthorityInstance(
displayName, identifier, client.getCommonPartName());
@Override
protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) throws Exception {
- String headerLabel = new OrgAuthorityClient().getItemCommonPartName();
+ String headerLabel = new OrganizationClient().getItemCommonPartName();
String shortId = TEST_SHORTID + identifier;
Map<String, String> testOrgMap = new HashMap<String, String>();
testOrgRepeatablesMap.put(OrganizationJAXBSchema.CONTACT_NAMES, testOrgContactNames);
String newID = OrgAuthorityClientUtils.createItemInAuthority(
- vcsid, authRefName, testOrgMap, terms, testOrgRepeatablesMap, (OrgAuthorityClient) client);
+ vcsid, authRefName, testOrgMap, terms, testOrgRepeatablesMap, (OrganizationClient) client);
// Store the ID returned from the first item resource created
// for additional tests below.
setupCreate();
// Submit the request to the service and store the response.
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
String identifier = createIdentifier();
PoxPayloadOut multipart =
ContactClientUtils.createContactInstance(parentcsid,
setupRead();
// Submit the request to the service and store the response.
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
Response res = null;
if (CSID != null) {
res = client.read(CSID);
try {
PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class));
OrgauthoritiesCommon orgAuthority = (OrgauthoritiesCommon) extractPart(input,
- new OrgAuthorityClient().getCommonPartName(), OrgauthoritiesCommon.class);
+ new OrganizationClient().getCommonPartName(), OrgauthoritiesCommon.class);
if (logger.isDebugEnabled()) {
logger.debug(objectAsXmlString(orgAuthority, OrgauthoritiesCommon.class));
}
setupRead();
// Submit the request to the service and store the response.
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
Response res = null;
if (authCSID != null) {
if (itemCSID != null) {
//
// First read our known resource.
//
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
Response res = client.readItem(knownResourceId, knownItemResourceId);
OrganizationsCommon organization = null;
try {
setupUpdateWithInvalidBody(); // we expect a failure
// Submit the updated resource to the service and store the response.
- PoxPayloadOut output = new PoxPayloadOut(OrgAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+ PoxPayloadOut output = new PoxPayloadOut(OrganizationClient.SERVICE_ITEM_PAYLOAD_NAME);
PayloadOutputPart commonPart = output.addPart(client.getItemCommonPartName(),
organization);
res = client.updateItem(knownResourceId, knownItemResourceId, output);
setupRead();
// Submit the request to the service and store the response.
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
Response res =client.readContact(knownResourceId, knownItemResourceId,
knownContactResourceId);
try {
setupReadNonExistent();
// Submit the request to the service and store the response.
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
Response res = client.readContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
try {
int statusCode = res.getStatus();
setupReadList();
// Submit the request to the service and store the response.
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
Response res = null;
if (vcsid != null) {
res = client.readItemList(vcsid, null, null);
setupReadList();
// Submit the request to the service and store the response.
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
Response res = client.readContactList(parentcsid, itemcsid);
AbstractCommonList list = null;
try {
setupUpdate();
// Retrieve the contents of a resource to update.
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
Response res = client.readContact(knownResourceId, knownItemResourceId, knownContactResourceId);
ContactsCommon contact = null;
try {
}
// Submit the request to the service and store the response.
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
Response res = client.deleteContact(knownResourceId, knownItemResourceId, knownContactResourceId);
try {
assertStatusCode(res, testName);
setupDeleteNonExistent();
// Submit the request to the service and store the response.
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
Response res = client.deleteContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
try {
assertStatusCode(res, testName);
String contactResourceId;
// Clean up contact resources.
parentResourceId = knownResourceId;
- OrgAuthorityClient client = new OrgAuthorityClient();
+ OrganizationClient client = new OrganizationClient();
for (Map.Entry<String, String> entry : allContactResourceIdsCreated.entrySet()) {
contactResourceId = entry.getKey();
itemResourceId = entry.getValue();
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;
* related to Organization authority-related resources.
*/
-@Path(OrgAuthorityClient.SERVICE_PATH)
+@Path(OrganizationClient.SERVICE_PATH)
@Consumes("application/xml")
@Produces("application/xml")
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;
}
}
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;
/**
extends AuthorityDocumentModelHandler<OrgauthoritiesCommon> {
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);
}
/**
*/
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;
/**
*
*/
public class OrganizationDocumentModelHandler
- extends AuthorityItemDocumentModelHandler<OrganizationsCommon> {
+ extends AuthorityItemWithContactsDocumentModelHandler<OrganizationsCommon> {
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
}
/**
@Override
public String getParentCommonSchemaName() {
// TODO Auto-generated method stub
- return OrgAuthorityClient.SERVICE_COMMON_PART_NAME;
+ return OrganizationClient.SERVICE_COMMON_PART_NAME;
}
}
-/**
- * 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<PersonauthoritiesCommon, PersonsCommon, PersonAuthorityProxy> {
-
- 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<PersonAuthorityProxy> 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();
- }
}
* @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 {
* @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 {
//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);
}
}
- 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);
public static String createItemInAuthority(String vcsid,
String personAuthorityRefName, Map<String,String> personMap,
List<PersonTermGroup> terms, Map<String, List<String>> personRepeatablesMap,
- PersonAuthorityClient client ) {
+ PersonClient client ) {
// Expected status code: 201 Created
int EXPECTED_STATUS_CODE = Response.Status.CREATED.getStatusCode();
// Type of service request being tested
/**
* @version $Revision:$
*/
-@Path(PersonAuthorityClient.SERVICE_PATH + "/")
+@Path(PersonClient.SERVICE_PATH + "/")
@Produces({"application/xml"})
@Consumes({"application/xml"})
public interface PersonAuthorityProxy extends AuthorityWithContactsProxy {
--- /dev/null
+/**
+ * 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<PersonauthoritiesCommon, PersonsCommon, PersonAuthorityProxy> {
+
+ 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<PersonAuthorityProxy> 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();
+ }
+}
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;
@Override
public String getServicePathComponent() {
- return PersonAuthorityClient.SERVICE_PATH_COMPONENT;
+ return PersonClient.SERVICE_PATH_COMPONENT;
}
@Override
protected String getServiceName() {
- return PersonAuthorityClient.SERVICE_NAME;
+ return PersonClient.SERVICE_NAME;
}
final String UTF8_CHARSET_NAME = "UTF-8";
*/
@Override
protected CollectionSpaceClient getClientInstance() throws Exception {
- return new PersonAuthorityClient();
+ return new PersonClient();
}
@Override
protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
- return new PersonAuthorityClient(clientPropertiesFilename);
+ return new PersonClient(clientPropertiesFilename);
}
/* (non-Javadoc)
testSetup(expectedStatusCode, requestType);
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
Response res = null;
if (authorityCsid != null) {
res = client.readItemList(authorityCsid, partialTerm, keywords);
}
String parentResourceId;
String itemResourceId;
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
parentResourceId = knownResourceId;
// Clean up item resources.
for (Map.Entry<String, String> entry : allItemResourceIdsCreated.entrySet()) {
testSetup(expectedStatusCode, requestType);
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
String shortId = createIdentifier();
String displayName = "displayName-" + shortId;
//String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(shortId, null);
testSetup(expectedStatusCode, requestType);
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
Map<String, String> partialTermPersonMap = new HashMap<String,String>();
//
// Fill values for the UNICODE item
String testName,
String authorityCsid,
String authRefName,
- PersonAuthorityClient client,
+ PersonClient client,
Map<String, String> partialTermPersonMap,
List<PersonTermGroup> partialTerms,
Map<String, List<String>> partialTermRepeatablesMap) throws Exception {
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;
@Override
public String getServicePathComponent() {
- return PersonAuthorityClient.SERVICE_PATH_COMPONENT;
+ return PersonClient.SERVICE_PATH_COMPONENT;
}
@Override
protected String getServiceName() {
- return PersonAuthorityClient.SERVICE_NAME;
+ return PersonClient.SERVICE_NAME;
}
/* (non-Javadoc)
*/
@Override
protected CollectionSpaceClient getClientInstance() throws Exception {
- return new PersonAuthorityClient();
+ return new PersonClient();
}
@Override
protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
- return new PersonAuthorityClient(clientPropertiesFilename);
+ return new PersonClient(clientPropertiesFilename);
}
/* (non-Javadoc)
testSetup(expectedStatusCode, requestType);
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
String shortId = "perfTestPersons";
String displayName = "Perf Test Person Auth";
//String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(shortId, null);
* @param authorityCsid The CSID of the Authority in which the term will be created.
* @param authRefName The refName of the Authority in which the term will be created.
*/
- private void createItem(String firstName, String lastName, PersonAuthorityClient client )
+ private void createItem(String firstName, String lastName, PersonClient client )
throws Exception {
int expectedStatusCode = Response.Status.CREATED.getStatusCode();
testSetup(expectedStatusCode, requestType);
if(client==null) {
- client = new PersonAuthorityClient();
+ client = new PersonClient();
}
// Submit the request to the service and store the response.
private void createItems()
throws Exception {
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
String fullTest = System.getProperty("runFullItemsTest");
runFullTest = Boolean.TRUE.toString().equalsIgnoreCase(fullTest);
int maxSuff = shortTestLimit;
testSetup(expectedStatusCode, requestType);
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
Response res = null;
if (authorityCsid != null) {
res = client.readItemList(authorityCsid, partialTerm, keywords);
}
// Note: Any non-success responses from the delete operations
// below are ignored and not reported.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
// Clean up item resources.
for (String itemId : allItemIdsCreated) {
client.deleteItem(authId, itemId).close();
import org.collectionspace.services.contact.AddressGroup;
import org.collectionspace.services.contact.AddressGroupList;
import org.collectionspace.services.contact.ContactsCommon;
-import org.collectionspace.services.client.PersonAuthorityClient;
+import org.collectionspace.services.client.PersonClient;
import org.collectionspace.services.client.PersonAuthorityClientUtils;
import org.collectionspace.services.jaxb.AbstractCommonList;
import org.collectionspace.services.PersonJAXBSchema;
@Override
public String getServicePathComponent() {
- return PersonAuthorityClient.SERVICE_PATH_COMPONENT;
+ return PersonClient.SERVICE_PATH_COMPONENT;
}
@Override
protected String getServiceName() {
- return PersonAuthorityClient.SERVICE_NAME;
+ return PersonClient.SERVICE_NAME;
}
public String getItemServicePathComponent() {
*/
@Override
protected CollectionSpaceClient getClientInstance() throws Exception {
- return new PersonAuthorityClient();
+ return new PersonClient();
}
@Override
protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception {
- return new PersonAuthorityClient(clientPropertiesFilename);
+ return new PersonClient(clientPropertiesFilename);
}
// ---------------------------------------------------------------
setupCreate();
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
String shortId = createIdentifier();
String displayName = "displayName-" + shortId;
//String baseRefName = PersonAuthorityClientUtils.createPersonAuthRefName(shortId, null);
@Override
protected PoxPayloadOut createInstance(String identifier) throws Exception {
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
String displayName = "displayName-" + identifier;
PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
@Override
protected PoxPayloadOut createItemInstance(String parentCsid, String identifier) throws Exception {
- String headerLabel = new PersonAuthorityClient().getItemCommonPartName();
+ String headerLabel = new PersonClient().getItemCommonPartName();
HashMap<String, String> personInfo = new HashMap<String, String>();
String shortId = "MarkTwainAuthor" + identifier;
// Submit the request to the service and store the response.
if (client == null) {
- client = new PersonAuthorityClient();
+ client = new PersonClient();
}
PoxPayloadOut multipart =
PersonAuthorityClientUtils.createPersonInstance(vcsid, null /*authRefName*/, itemFieldProperties,
logger.debug(testName + ":...");
}
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
String identifier = createIdentifier();
PoxPayloadOut multipart = ContactClientUtils.createContactInstance(parentcsid,
itemcsid, identifier, new ContactClient().getCommonPartName());
testSetup(testExpectedStatusCode, testRequestType);
// Create the payload to be included in the body of the request
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
String shortId = createIdentifier() + "*" + createIdentifier();
String displayName = "displayName-" + shortId;
PoxPayloadOut multipart =
testRequestType = ServiceRequestType.CREATE;
testSetup(testExpectedStatusCode, testRequestType);
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
// Create the payload to be included in the body of the request
String shortId = "7-Eleven";
Map<String, String> fieldProperties = new HashMap<String, String>();
protected void readInternal(String testName, String CSID, String shortId) throws Exception {
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
Response res = null;
setupRead();
if (CSID != null) {
}
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
setupRead();
Response res = null;
if (authCSID != null) {
setupRead();
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
Response res = client.readItem(knownResourceId, knownItemResourceId);
PoxPayloadIn input = null;
try {
terms.get(0).setTermName(null);
// Submit the updated resource to the service and store the response.
- PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+ PoxPayloadOut output = new PoxPayloadOut(PersonClient.SERVICE_ITEM_PAYLOAD_NAME);
output.addPart(client.getItemCommonPartName(), person);
setupUpdateWithInvalidBody();
res = client.updateItem(knownResourceId, knownItemResourceId, output);
setupRead();
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
PoxPayloadIn input = null;
Response res = client.readContact(knownResourceId, knownItemResourceId,
knownContactResourceId);
setupReadNonExistent();
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
Response res = client.readContact(knownResourceId, knownItemResourceId,
NON_EXISTENT_ID);
try {
setupReadList();
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
AbstractCommonList list = null;
Response res = client.readContactList(parentcsid, itemcsid);
try {
// groups = {"update"}, dependsOnGroups = {"readItem", "readList"})
public void update(String testName) throws Exception {
// Retrieve the contents of a resource to update.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
PoxPayloadIn input = null;
setupRead();
Response res = client.read(knownResourceId);
}
// Submit the updated resource to the service and store the response.
- PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_PAYLOAD_NAME);
+ PoxPayloadOut output = new PoxPayloadOut(PersonClient.SERVICE_PAYLOAD_NAME);
output.addPart(client.getCommonPartName(), personAuthority);
setupUpdate();
res = client.update(knownResourceId, output);
@Override
public void updateItem(String testName) throws Exception {
// Retrieve the contents of a resource to update.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
PoxPayloadIn input = null;
setupRead();
Response res = client.readItem(knownResourceId, knownItemResourceId);
}
// Submit the updated resource to the service and store the response.
- PoxPayloadOut output = new PoxPayloadOut(PersonAuthorityClient.SERVICE_ITEM_PAYLOAD_NAME);
+ PoxPayloadOut output = new PoxPayloadOut(PersonClient.SERVICE_ITEM_PAYLOAD_NAME);
output.addPart(client.getItemCommonPartName(), person);
setupUpdate();
res = client.updateItem(knownResourceId, knownItemResourceId, output);
String contactsCommonLabel = new ContactClient().getCommonPartName();
// Retrieve the contents of a resource to update.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
PoxPayloadIn input = null;
setupRead();
Response res = client.readContact(knownResourceId, knownItemResourceId,
}
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
setupDelete();
Response res = client.deleteContact(knownResourceId, knownItemResourceId,
knownContactResourceId);
dependsOnMethods = {"deleteContact"})
public void deleteNonExistentContact(String testName) throws Exception {
// Submit the request to the service and store the response.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
setupDeleteNonExistent();
Response res = client.deleteContact(knownResourceId, knownItemResourceId, NON_EXISTENT_ID);
try {
String itemResourceId;
String contactResourceId;
// Clean up contact resources.
- PersonAuthorityClient client = new PersonAuthorityClient();
+ PersonClient client = new PersonClient();
parentResourceId = this.getKnowResourceId();
for (Map.Entry<String, String> entry : allContactResourceIdsCreated.entrySet()) {
contactResourceId = entry.getKey();
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;
* 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<PersonauthoritiesCommon, PersonDocumentModelHandler> {
public PersonAuthorityResource() {
super(PersonauthoritiesCommon.class, PersonAuthorityResource.class,
- PersonAuthorityClient.SERVICE_COMMON_PART_NAME, PersonAuthorityClient.SERVICE_ITEM_COMMON_PART_NAME);
+ PersonClient.SERVICE_COMMON_PART_NAME, PersonClient.SERVICE_ITEM_COMMON_PART_NAME);
}
@Override
public String getServiceName() {
- return PersonAuthorityClient.SERVICE_NAME;
+ return PersonClient.SERVICE_NAME;
}
@Override
public String getItemServiceName() {
- return PersonAuthorityClient.SERVICE_ITEM_NAME;
+ return PersonClient.SERVICE_ITEM_NAME;
}
@Override
public String getItemTermInfoGroupXPathBase() {
- return PersonAuthorityClient.TERM_INFO_GROUP_XPATH_BASE;
+ return PersonClient.TERM_INFO_GROUP_XPATH_BASE;
}
@Override
package org.collectionspace.services.person.nuxeo;
import org.collectionspace.services.person.PersonauthoritiesCommon;
-import org.collectionspace.services.client.PersonAuthorityClient;
+import org.collectionspace.services.client.PersonClient;
import org.collectionspace.services.common.vocabulary.nuxeo.AuthorityDocumentModelHandler;
/**
extends AuthorityDocumentModelHandler<PersonauthoritiesCommon> {
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);
}
/**
*/
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;
/**
*
*/
public class PersonDocumentModelHandler
- extends AuthorityItemDocumentModelHandler<PersonsCommon> {
+ extends AuthorityItemWithContactsDocumentModelHandler<PersonsCommon> {
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
}
/**
@Override
public String getParentCommonSchemaName() {
// TODO Auto-generated method stub
- return PersonAuthorityClient.SERVICE_COMMON_PART_NAME;
+ return PersonClient.SERVICE_COMMON_PART_NAME;
}
}
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;
}
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(
}
protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception {
- PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ PersonClient personAuthClient = new PersonClient();
Map<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
//
// 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();
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;
* @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(
}
protected String createPerson(String firstName, String surName, String shortId, String authRefName ) throws Exception {
- PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ PersonClient personAuthClient = new PersonClient();
Map<String, String> personInfo = new HashMap<String,String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
//
// 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();
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;
private void createPersonRefs() throws Exception {
setupCreate();
- PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ PersonClient personAuthClient = new PersonClient();
PoxPayloadOut multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
personAuthDisplayName, personAuthShortId, personAuthClient.getCommonPartName());
Response res = personAuthClient.create(multipart);
@AfterSuite
private void deletePersonRefs() throws Exception {
- PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ PersonClient personAuthClient = new PersonClient();
for (String csid:personIdsCreated) {
Response res = personAuthClient.deleteItem(personAuthCSID, csid);
try {
private String createPerson(String firstName, String surName, String shortId, String authRefName) throws Exception {
String result = null;
- PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ PersonClient personAuthClient = new PersonClient();
Map<String, String> personInfo = new HashMap<String, String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
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;
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,
throws Exception {
String result = null;
- PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ PersonClient personAuthClient = new PersonClient();
Map<String, String> personInfo = new HashMap<String, String>();
personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
//
// Delete Person resource(s) (before PersonAuthority resources).
//
- PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ PersonClient personAuthClient = new PersonClient();
for (String csid : personIdsCreated) {
Response res = null;
try {