Refactored the code that was in IntakeDocumentModelHandler (getAuthorityRefs) into RemoteDocumentModelHandlerImpl.
Added tests for both services.
<artifactId>org.collectionspace.services.client</artifactId>\r
<version>${cspace.services.client.version}</version>\r
</dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.person.client</artifactId>\r
+ <version>${cspace.services.client.version}</version>\r
+ </dependency>\r
\r
<dependency>\r
<groupId>org.testng</groupId>\r
import javax.ws.rs.core.Response;
import org.collectionspace.services.acquisition.AcquisitionsCommonList;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.collectionspace.services.common.context.ServiceContext;
import org.jboss.resteasy.client.ProxyFactory;
import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
return acquisitionProxy.read(csid);
}
+ /**
+ * @param csid
+ * @return
+ * @see org.collectionspace.services.client.CollectionObjectProxy#getAuthorityRefs(java.lang.String)
+ */
+ public ClientResponse<AuthorityRefList> getAuthorityRefs(String csid) {
+ return acquisitionProxy.getAuthorityRefs(csid);
+ }
+
/**
* @param intake
* @return
import javax.ws.rs.core.Response;
import org.collectionspace.services.acquisition.AcquisitionsCommonList;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.jboss.resteasy.client.ClientResponse;
import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
@Path("/{csid}")
ClientResponse<MultipartInput> read(@PathParam("csid") String csid);
+ // List Authority references
+ @GET
+ @Produces({"application/xml"})
+ @Path("/{csid}/authorityrefs/")
+ ClientResponse<AuthorityRefList> getAuthorityRefs(@PathParam("csid") String csid);
+
//(U)pdate
@PUT
@Path("/{csid}")
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright © 2009 Regents of the University of California
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.collectionspace.services.client.test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.PersonJAXBSchema;
+import org.collectionspace.services.client.AcquisitionClient;
+import org.collectionspace.services.client.PersonAuthorityClient;
+import org.collectionspace.services.client.PersonAuthorityClientUtils;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.acquisition.AcquisitionsCommon;
+import org.collectionspace.services.acquisition.AcquisitionsCommonList;
+
+import org.jboss.resteasy.client.ClientResponse;
+
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * AcquisitionAuthRefsTest, carries out tests against a
+ * deployed and running Acquisition Service.
+ *
+ * $LastChangedRevision: 1327 $
+ * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $
+ */
+public class AcquisitionAuthRefsTest extends BaseServiceTest {
+
+ private final Logger logger =
+ LoggerFactory.getLogger(AcquisitionAuthRefsTest.class);
+
+ // Instance variables specific to this test.
+ private AcquisitionClient acquisitionClient = new AcquisitionClient();
+ private PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ final String SERVICE_PATH_COMPONENT = "acquisitions";
+ final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
+ private String knownResourceId = null;
+ private List<String> acquisitionIdsCreated = new ArrayList();
+ private List<String> personIdsCreated = new ArrayList();
+ private int CREATED_STATUS = Response.Status.CREATED.getStatusCode();
+ private int OK_STATUS = Response.Status.OK.getStatusCode();
+ private String personAuthCSID = null;
+ private String acquisitionAuthorizerRefName = null;
+ private String acquisitionFundingSourceRefName = null;
+ // Not ready for multiples, yet
+ //private String acquisitionSourcesRefName = null;
+ private String fieldCollectorRefName = null;
+ private final int NUM_AUTH_REFS_EXPECTED = 3;
+
+ // ---------------------------------------------------------------
+ // CRUD tests : CREATE tests
+ // ---------------------------------------------------------------
+ // Success outcomes
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
+ public void createWithAuthRefs(String testName) throws Exception {
+
+ testSetup(CREATED_STATUS, ServiceRequestType.CREATE,testName);
+
+ // Submit the request to the service and store the response.
+ String identifier = createIdentifier();
+
+ // Create all the person refs and entities
+ createPersonRefs();
+
+ MultipartOutput multipart = createAcquisitionInstance(
+ "April 1, 2010",
+ acquisitionAuthorizerRefName,
+ acquisitionFundingSourceRefName,
+ fieldCollectorRefName );
+
+ ClientResponse<Response> res = acquisitionClient.create(multipart);
+
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ //
+ // Specifically:
+ // Does it fall within the set of valid status codes?
+ // Does it exactly match the expected status code?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+ // Store the ID returned from the first resource created
+ // for additional tests below.
+ if (knownResourceId == null){
+ knownResourceId = extractId(res);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testName + ": knownResourceId=" + knownResourceId);
+ }
+ }
+
+ // Store the IDs from every resource created by tests,
+ // so they can be deleted after tests have been run.
+ acquisitionIdsCreated.add(extractId(res));
+ }
+
+ protected void createPersonRefs(){
+ String authRefName =
+ PersonAuthorityClientUtils.createPersonAuthRefName(PERSON_AUTHORITY_NAME, false);
+ MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
+ PERSON_AUTHORITY_NAME, authRefName, personAuthClient.getCommonPartName());
+ ClientResponse<Response> res = personAuthClient.create(multipart);
+ int statusCode = res.getStatus();
+
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, CREATED_STATUS);
+ personAuthCSID = extractId(res);
+
+ acquisitionAuthorizerRefName = PersonAuthorityClientUtils.createPersonRefName(
+ authRefName, "Annie Authorizer", true);
+ personIdsCreated.add(createPerson("Annie", "Authorizer", acquisitionAuthorizerRefName));
+
+ acquisitionFundingSourceRefName = PersonAuthorityClientUtils.createPersonRefName(
+ authRefName, "Sammy Source", true);
+ personIdsCreated.add(createPerson("Sammy", "Source", acquisitionFundingSourceRefName));
+
+
+ fieldCollectorRefName = PersonAuthorityClientUtils.createPersonRefName(
+ authRefName, "Connie Collector", true);
+ personIdsCreated.add(createPerson("Connie", "Collector", fieldCollectorRefName));
+ }
+
+ protected String createPerson(String firstName, String surName, String refName ) {
+ Map<String, String> personInfo = new HashMap<String,String>();
+ personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
+ personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
+ MultipartOutput multipart =
+ PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
+ refName, personInfo, personAuthClient.getItemCommonPartName());
+ ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
+ int statusCode = res.getStatus();
+
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, CREATED_STATUS);
+ return extractId(res);
+ }
+
+ // Success outcomes
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+ dependsOnMethods = {"createWithAuthRefs"})
+ public void readAndCheckAuthRefs(String testName) throws Exception {
+
+ // Perform setup.
+ testSetup(OK_STATUS, ServiceRequestType.READ,testName);
+
+ // Submit the request to the service and store the response.
+ ClientResponse<MultipartInput> res = acquisitionClient.read(knownResourceId);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ".read: status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+ MultipartInput input = (MultipartInput) res.getEntity();
+ AcquisitionsCommon acquisition = (AcquisitionsCommon) extractPart(input,
+ acquisitionClient.getCommonPartName(), AcquisitionsCommon.class);
+ Assert.assertNotNull(acquisition);
+ // Check a couple of fields
+ Assert.assertEquals(acquisition.getAcquisitionAuthorizer(), acquisitionAuthorizerRefName);
+ Assert.assertEquals(acquisition.getFieldCollector(), fieldCollectorRefName);
+
+ // Get the auth refs and check them
+ ClientResponse<AuthorityRefList> res2 = acquisitionClient.getAuthorityRefs(knownResourceId);
+ statusCode = res2.getStatus();
+
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ".getAuthorityRefs: status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ AuthorityRefList list = res2.getEntity();
+
+ // Optionally output additional data about list members for debugging.
+ boolean iterateThroughList = true;
+ if(iterateThroughList && logger.isDebugEnabled()){
+ List<AuthorityRefList.AuthorityRefItem> items =
+ list.getAuthorityRefItem();
+ int i = 0;
+ for(AuthorityRefList.AuthorityRefItem item : items){
+ logger.debug(testName + ": list-item[" + i + "] Field:" +
+ item.getSourceField() + "= " +
+ item.getAuthDisplayName() +
+ item.getItemDisplayName());
+ logger.debug(testName + ": list-item[" + i + "] refName=" +
+ item.getRefName());
+ logger.debug(testName + ": list-item[" + i + "] URI=" +
+ item.getUri());
+ i++;
+ }
+ Assert.assertEquals(i, NUM_AUTH_REFS_EXPECTED, "Did not find all authrefs!");
+ }
+ }
+
+
+ // ---------------------------------------------------------------
+ // Cleanup of resources created during testing
+ // ---------------------------------------------------------------
+
+ /**
+ * Deletes all resources created by tests, after all tests have been run.
+ *
+ * This cleanup method will always be run, even if one or more tests fail.
+ * For this reason, it attempts to remove all resources created
+ * at any point during testing, even if some of those resources
+ * may be expected to be deleted by certain tests.
+ */
+ // @AfterClass(alwaysRun=true)
+ public void cleanUp() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Cleaning up temporary resources created for testing ...");
+ }
+ // Note: Any non-success responses are ignored and not reported.
+ for (String resourceId : acquisitionIdsCreated) {
+ ClientResponse<Response> res = acquisitionClient.delete(resourceId);
+ }
+ // Delete persons before PersonAuth
+ for (String resourceId : personIdsCreated) {
+ ClientResponse<Response> res = personAuthClient.deleteItem(personAuthCSID, resourceId);
+ }
+ ClientResponse<Response> res = personAuthClient.delete(personAuthCSID);
+ }
+
+ // ---------------------------------------------------------------
+ // Utility methods used by tests above
+ // ---------------------------------------------------------------
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ private MultipartOutput createAcquisitionInstance(
+ String accessionDate,
+ String acquisitionAuthorizer,
+ String acquisitionFundingSource,
+ String fieldCollector ) {
+ AcquisitionsCommon acquisition = new AcquisitionsCommon();
+ acquisition.setAccessionDate(accessionDate);
+ acquisition.setAcquisitionAuthorizer(acquisitionAuthorizer);
+ acquisition.setAcquisitionFundingSource(acquisitionFundingSource);
+ acquisition.setFieldCollector(fieldCollector);
+ MultipartOutput multipart = new MultipartOutput();
+ OutputPart commonPart =
+ multipart.addPart(acquisition, MediaType.APPLICATION_XML_TYPE);
+ commonPart.getHeaders().add("label", acquisitionClient.getCommonPartName());
+
+ if(logger.isDebugEnabled()){
+ logger.debug("to be created, acquisition common");
+ logger.debug(objectAsXmlString(acquisition, AcquisitionsCommon.class));
+ }
+
+ return multipart;
+ }
+}
*/
package org.collectionspace.services.acquisition;
+import java.util.List;
+
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.UriInfo;
import org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.collectionspace.services.common.context.MultipartServiceContext;
import org.collectionspace.services.common.context.MultipartServiceContextFactory;
+import org.collectionspace.services.common.context.MultipartServiceContextImpl;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.DocumentFilter;
import org.collectionspace.services.common.document.DocumentNotFoundException;
import org.collectionspace.services.common.document.DocumentHandler;
+import org.collectionspace.services.common.document.DocumentWrapper;
import org.collectionspace.services.common.query.IQueryManager;
import org.collectionspace.services.common.query.QueryManager;
import org.collectionspace.services.common.security.UnauthorizedException;
+import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
import org.jboss.resteasy.util.HttpResponseCodes;
+import org.nuxeo.ecm.core.api.DocumentModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
throw new WebApplicationException(response);
}
return acquisitionObjectList;
- }
+ }
+
+ @GET
+ @Path("{csid}/authorityrefs")
+ @Produces("application/xml")
+ public AuthorityRefList getAuthorityRefs(
+ @PathParam("csid") String csid,
+ @Context UriInfo ui) {
+ AuthorityRefList authRefList = null;
+ try {
+ ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
+ DocumentWrapper<DocumentModel> docWrapper =
+ getRepositoryClient(ctx).getDoc(ctx, csid);
+ RemoteDocumentModelHandlerImpl handler
+ = (RemoteDocumentModelHandlerImpl)createDocumentHandler(ctx);
+ List<String> authRefFields = ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues("authRef");
+ String prefix = ctx.getCommonPartLabel()+":";
+ authRefList = handler.getAuthorityRefs(docWrapper, prefix, authRefFields);
+ } catch (UnauthorizedException ue) {
+ Response response = Response.status(
+ Response.Status.UNAUTHORIZED).entity("Index failed reason " + ue.getErrorReason()).type("text/plain").build();
+ throw new WebApplicationException(response);
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Caught exception in getAuthorityRefs", e);
+ }
+ Response response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ return authRefList;
+ }
+
}
<artifactId>org.collectionspace.services.client</artifactId>\r
<version>${cspace.services.client.version}</version>\r
</dependency>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.person.client</artifactId>\r
+ <version>${cspace.services.client.version}</version>\r
+ </dependency>\r
\r
<dependency>\r
<groupId>org.testng</groupId>\r
import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.query.IQueryManager;
import org.jboss.resteasy.client.ProxyFactory;
/**
* Read list.
*
+ * @see org.collectionspace.services.client.CollectionObjectProxy#readList()
* @return the client response< collectionobjects common list>
*/
public ClientResponse<CollectionobjectsCommonList> readList() {
* This is an intentionally empty method that is used for performance test
* to get a rough time estimate of the client to server response-request overhead.
*
+ * @see org.collectionspace.services.client.CollectionObjectProxy#roundtrip()
* @return the client response< response>
*/
public ClientResponse<Response> roundtrip() {
*
* @param keywords the keywords
*
+ * @see org.collectionspace.services.client.CollectionObjectProxy#keywordSearch()
* @return the client response< collectionobjects common list>
*/
public ClientResponse<CollectionobjectsCommonList> keywordSearch(String keywords) {
*
* @param csid the csid
*
+ * @see org.collectionspace.services.client.CollectionObjectProxy#keywordSearch()
* @return the client response< multipart input>
*/
public ClientResponse<MultipartInput> read(String csid) {
return collectionObjectProxy.read(csid);
}
+ /**
+ * @param csid
+ * @return
+ * @see org.collectionspace.services.client.CollectionObjectProxy#getAuthorityRefs(java.lang.String)
+ */
+ public ClientResponse<AuthorityRefList> getAuthorityRefs(String csid) {
+ return collectionObjectProxy.getAuthorityRefs(csid);
+ }
+
+
/**
* Creates the.
*
* @param multipart the multipart
*
+ * @see org.collectionspace.services.client.CollectionObjectProxy#create()
* @return the client response< response>
*/
public ClientResponse<Response> create(MultipartOutput multipart) {
* @param csid the csid
* @param multipart the multipart
*
+ * @see org.collectionspace.services.client.CollectionObjectProxy#update()
* @return the client response< multipart input>
*/
public ClientResponse<MultipartInput> update(String csid, MultipartOutput multipart) {
*
* @param csid the csid
*
+ * @see org.collectionspace.services.client.CollectionObjectProxy#delete()
* @return the client response< response>
*/
public ClientResponse<Response> delete(String csid) {
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.collectionspace.services.common.query.IQueryManager;
import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
import org.jboss.resteasy.client.ClientResponse;
@GET
@Path("/{csid}")
ClientResponse<MultipartInput> read(@PathParam("csid") String csid);
+
+ // List Authority references
+ @GET
+ @Produces({"application/xml"})
+ @Path("/{csid}/authorityrefs/")
+ ClientResponse<AuthorityRefList> getAuthorityRefs(@PathParam("csid") String csid);
+
//(U)pdate
@PUT
--- /dev/null
+/**
+ * This document is a part of the source code and related artifacts
+ * for CollectionSpace, an open source collections management system
+ * for museums and related institutions:
+ *
+ * http://www.collectionspace.org
+ * http://wiki.collectionspace.org
+ *
+ * Copyright © 2009 Regents of the University of California
+ *
+ * Licensed under the Educational Community License (ECL), Version 2.0.
+ * You may not use this file except in compliance with this License.
+ *
+ * You may obtain a copy of the ECL 2.0 License at
+ * https://source.collectionspace.org/collection-space/LICENSE.txt
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.collectionspace.services.client.test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.PersonJAXBSchema;
+import org.collectionspace.services.client.CollectionObjectClient;
+import org.collectionspace.services.client.PersonAuthorityClient;
+import org.collectionspace.services.client.PersonAuthorityClientUtils;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
+import org.collectionspace.services.collectionobject.CollectionobjectsCommon;
+import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
+
+import org.jboss.resteasy.client.ClientResponse;
+
+import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
+import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.Test;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * CollectionObjectAuthRefsTest, carries out tests against a
+ * deployed and running CollectionObject Service.
+ *
+ * $LastChangedRevision: 1327 $
+ * $LastChangedDate: 2010-02-12 10:35:11 -0800 (Fri, 12 Feb 2010) $
+ */
+public class CollectionObjectAuthRefsTest extends BaseServiceTest {
+
+ private final Logger logger =
+ LoggerFactory.getLogger(CollectionObjectAuthRefsTest.class);
+
+ // Instance variables specific to this test.
+ private CollectionObjectClient collectionObjectClient = new CollectionObjectClient();
+ private PersonAuthorityClient personAuthClient = new PersonAuthorityClient();
+ final String SERVICE_PATH_COMPONENT = "collectionobjects";
+ final String PERSON_AUTHORITY_NAME = "TestPersonAuth";
+ private String knownResourceId = null;
+ private List<String> collectionObjectIdsCreated = new ArrayList();
+ private List<String> personIdsCreated = new ArrayList();
+ private int CREATED_STATUS = Response.Status.CREATED.getStatusCode();
+ private int OK_STATUS = Response.Status.OK.getStatusCode();
+ private String personAuthCSID = null;
+ private String contentOrganizationRefName = null;
+ private String contentPeopleRefName = null;
+ private String contentPersonRefName = null;
+ private String inscriberRefName = null;
+ private final int NUM_AUTH_REFS_EXPECTED = 4;
+
+ // ---------------------------------------------------------------
+ // CRUD tests : CREATE tests
+ // ---------------------------------------------------------------
+ // Success outcomes
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class)
+ public void createWithAuthRefs(String testName) throws Exception {
+
+ testSetup(CREATED_STATUS, ServiceRequestType.CREATE,testName);
+
+ // Submit the request to the service and store the response.
+ String identifier = createIdentifier();
+
+ // Create all the person refs and entities
+ createPersonRefs();
+
+ MultipartOutput multipart = createCollectionObjectInstance(
+ "Obj Title",
+ "ObjNum-1234",
+ contentOrganizationRefName,
+ contentPeopleRefName,
+ contentPersonRefName,
+ inscriberRefName );
+
+ ClientResponse<Response> res = collectionObjectClient.create(multipart);
+
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ //
+ // Specifically:
+ // Does it fall within the set of valid status codes?
+ // Does it exactly match the expected status code?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+ // Store the ID returned from the first resource created
+ // for additional tests below.
+ if (knownResourceId == null){
+ knownResourceId = extractId(res);
+ if (logger.isDebugEnabled()) {
+ logger.debug(testName + ": knownResourceId=" + knownResourceId);
+ }
+ }
+
+ // Store the IDs from every resource created by tests,
+ // so they can be deleted after tests have been run.
+ collectionObjectIdsCreated.add(extractId(res));
+ }
+
+ protected void createPersonRefs(){
+ String authRefName =
+ PersonAuthorityClientUtils.createPersonAuthRefName(PERSON_AUTHORITY_NAME, false);
+ MultipartOutput multipart = PersonAuthorityClientUtils.createPersonAuthorityInstance(
+ PERSON_AUTHORITY_NAME, authRefName, personAuthClient.getCommonPartName());
+ ClientResponse<Response> res = personAuthClient.create(multipart);
+ int statusCode = res.getStatus();
+
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, CREATED_STATUS);
+ personAuthCSID = extractId(res);
+
+ contentOrganizationRefName = PersonAuthorityClientUtils.createPersonRefName(
+ authRefName, "Omni Org", true);
+ personIdsCreated.add(createPerson("Omni", "Org", contentOrganizationRefName));
+
+ contentPeopleRefName = PersonAuthorityClientUtils.createPersonRefName(
+ authRefName, "Pushy People", true);
+ personIdsCreated.add(createPerson("Pushy", "People", contentPeopleRefName));
+
+ contentPersonRefName = PersonAuthorityClientUtils.createPersonRefName(
+ authRefName, "Connie ContactPerson", true);
+ personIdsCreated.add(createPerson("Connie", "ContactPerson", contentPersonRefName));
+
+ inscriberRefName = PersonAuthorityClientUtils.createPersonRefName(
+ authRefName, "Ingrid Inscriber", true);
+ personIdsCreated.add(createPerson("Ingrid", "Inscriber", inscriberRefName));
+ }
+
+ protected String createPerson(String firstName, String surName, String refName ) {
+ Map<String, String> personInfo = new HashMap<String,String>();
+ personInfo.put(PersonJAXBSchema.FORE_NAME, firstName);
+ personInfo.put(PersonJAXBSchema.SUR_NAME, surName);
+ MultipartOutput multipart =
+ PersonAuthorityClientUtils.createPersonInstance(personAuthCSID,
+ refName, personInfo, personAuthClient.getItemCommonPartName());
+ ClientResponse<Response> res = personAuthClient.createItem(personAuthCSID, multipart);
+ int statusCode = res.getStatus();
+
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, CREATED_STATUS);
+ return extractId(res);
+ }
+
+ // Success outcomes
+ @Test(dataProvider="testName", dataProviderClass=AbstractServiceTestImpl.class,
+ dependsOnMethods = {"createWithAuthRefs"})
+ public void readAndCheckAuthRefs(String testName) throws Exception {
+
+ // Perform setup.
+ testSetup(OK_STATUS, ServiceRequestType.READ,testName);
+
+ // Submit the request to the service and store the response.
+ ClientResponse<MultipartInput> res = collectionObjectClient.read(knownResourceId);
+ int statusCode = res.getStatus();
+
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ".read: status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+
+ MultipartInput input = (MultipartInput) res.getEntity();
+ CollectionobjectsCommon collectionObject = (CollectionobjectsCommon) extractPart(input,
+ collectionObjectClient.getCommonPartName(), CollectionobjectsCommon.class);
+ Assert.assertNotNull(collectionObject);
+ // Check a couple of fields
+ Assert.assertEquals(collectionObject.getContentOrganization(), contentOrganizationRefName);
+ Assert.assertEquals(collectionObject.getInscriber(), inscriberRefName);
+
+ // Get the auth refs and check them
+ ClientResponse<AuthorityRefList> res2 = collectionObjectClient.getAuthorityRefs(knownResourceId);
+ statusCode = res2.getStatus();
+
+ if(logger.isDebugEnabled()){
+ logger.debug(testName + ".getAuthorityRefs: status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ AuthorityRefList list = res2.getEntity();
+
+ // Optionally output additional data about list members for debugging.
+ boolean iterateThroughList = true;
+ if(iterateThroughList && logger.isDebugEnabled()){
+ List<AuthorityRefList.AuthorityRefItem> items =
+ list.getAuthorityRefItem();
+ int i = 0;
+ for(AuthorityRefList.AuthorityRefItem item : items){
+ logger.debug(testName + ": list-item[" + i + "] Field:" +
+ item.getSourceField() + "= " +
+ item.getAuthDisplayName() +
+ item.getItemDisplayName());
+ logger.debug(testName + ": list-item[" + i + "] refName=" +
+ item.getRefName());
+ logger.debug(testName + ": list-item[" + i + "] URI=" +
+ item.getUri());
+ i++;
+ }
+ Assert.assertEquals(i, NUM_AUTH_REFS_EXPECTED, "Did not find all authrefs!");
+ }
+ }
+
+
+ // ---------------------------------------------------------------
+ // Cleanup of resources created during testing
+ // ---------------------------------------------------------------
+
+ /**
+ * Deletes all resources created by tests, after all tests have been run.
+ *
+ * This cleanup method will always be run, even if one or more tests fail.
+ * For this reason, it attempts to remove all resources created
+ * at any point during testing, even if some of those resources
+ * may be expected to be deleted by certain tests.
+ */
+ // @AfterClass(alwaysRun=true)
+ public void cleanUp() {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Cleaning up temporary resources created for testing ...");
+ }
+ // Note: Any non-success responses are ignored and not reported.
+ for (String resourceId : collectionObjectIdsCreated) {
+ ClientResponse<Response> res = collectionObjectClient.delete(resourceId);
+ }
+ // Delete persons before PersonAuth
+ for (String resourceId : personIdsCreated) {
+ ClientResponse<Response> res = personAuthClient.deleteItem(personAuthCSID, resourceId);
+ }
+ ClientResponse<Response> res = personAuthClient.delete(personAuthCSID);
+ }
+
+ // ---------------------------------------------------------------
+ // Utility methods used by tests above
+ // ---------------------------------------------------------------
+ @Override
+ public String getServicePathComponent() {
+ return SERVICE_PATH_COMPONENT;
+ }
+
+ private MultipartOutput createCollectionObjectInstance(
+ String title,
+ String objNum,
+ String contentOrganization,
+ String contentPeople,
+ String contentPerson,
+ String inscriber ) {
+ CollectionobjectsCommon collectionObject = new CollectionobjectsCommon();
+ collectionObject.setTitle(title);
+ collectionObject.setObjectNumber(objNum);
+ collectionObject.setContentOrganization(contentOrganization);
+ collectionObject.setContentPeople(contentPeople);
+ collectionObject.setContentPerson(contentPerson);
+ collectionObject.setInscriber(inscriber);
+ MultipartOutput multipart = new MultipartOutput();
+ OutputPart commonPart =
+ multipart.addPart(collectionObject, MediaType.APPLICATION_XML_TYPE);
+ commonPart.getHeaders().add("label", collectionObjectClient.getCommonPartName());
+
+ if(logger.isDebugEnabled()){
+ logger.debug("to be created, collectionObject common");
+ logger.debug(objectAsXmlString(collectionObject, CollectionobjectsCommon.class));
+ }
+
+ return multipart;
+ }
+}
*/
package org.collectionspace.services.collectionobject;
-import java.util.List;
import java.util.ArrayList;
-import java.util.Iterator;
-import java.lang.reflect.Type;
+import java.util.List;
import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
-import org.collectionspace.services.common.query.QueryManager;
-import org.collectionspace.services.common.query.IQueryManager;
import org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.collectionspace.services.common.context.MultipartServiceContext;
import org.collectionspace.services.common.context.MultipartServiceContextFactory;
+import org.collectionspace.services.common.context.MultipartServiceContextImpl;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.BadRequestException;
-import org.collectionspace.services.common.document.DocumentNotFoundException;
-import org.collectionspace.services.common.document.DocumentHandler;
import org.collectionspace.services.common.document.DocumentFilter;
+import org.collectionspace.services.common.document.DocumentHandler;
+import org.collectionspace.services.common.document.DocumentNotFoundException;
+import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.common.query.IQueryManager;
+import org.collectionspace.services.common.query.QueryManager;
import org.collectionspace.services.common.security.UnauthorizedException;
-import org.jboss.resteasy.plugins.providers.multipart.InputPart;
+import org.collectionspace.services.intake.IntakeResource;
+import org.collectionspace.services.intake.IntakesCommonList;
+import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
+import org.collectionspace.services.relation.NewRelationResource;
+import org.collectionspace.services.relation.RelationsCommonList;
+import org.collectionspace.services.relation.RelationshipType;
import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
-import org.jboss.resteasy.plugins.providers.multipart.OutputPart;
import org.jboss.resteasy.util.HttpResponseCodes;
+import org.nuxeo.ecm.core.api.DocumentModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.collectionspace.services.intake.IntakesCommonList;
-import org.collectionspace.services.intake.IntakeResource;
-
-import org.collectionspace.services.relation.NewRelationResource;
-import org.collectionspace.services.relation.RelationshipType;
-import org.collectionspace.services.relation.RelationsCommonList;
-import org.collectionspace.services.relation.RelationsCommon;
-
/**
* The Class CollectionObjectResource.
return result;
}
+
+ @GET
+ @Path("{csid}/authorityrefs")
+ @Produces("application/xml")
+ public AuthorityRefList getAuthorityRefs(
+ @PathParam("csid") String csid,
+ @Context UriInfo ui) {
+ AuthorityRefList authRefList = null;
+ try {
+ ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
+ DocumentWrapper<DocumentModel> docWrapper =
+ getRepositoryClient(ctx).getDoc(ctx, csid);
+ RemoteDocumentModelHandlerImpl handler
+ = (RemoteDocumentModelHandlerImpl)createDocumentHandler(ctx);
+ List<String> authRefFields = ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues("authRef");
+ String prefix = ctx.getCommonPartLabel()+":";
+ authRefList = handler.getAuthorityRefs(docWrapper, prefix, authRefFields);
+ } catch (UnauthorizedException ue) {
+ Response response = Response.status(
+ Response.Status.UNAUTHORIZED).entity("Index failed reason " + ue.getErrorReason()).type("text/plain").build();
+ throw new WebApplicationException(response);
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Caught exception in getAuthorityRefs", e);
+ }
+ Response response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ return authRefList;
+ }
/**
* Roundtrip.
<service:part id="1" control_group="Managed"
versionable="true" auditable="false"
label="collectionobjects_common" updated="" order="1">
+ <service:properties>
+ <types:item><types:key>authRef</types:key><types:value>contentOrganization</types:value></types:item>
+ <types:item><types:key>authRef</types:key><types:value>contentPeople</types:value></types:item>
+ <types:item><types:key>authRef</types:key><types:value>contentPerson</types:value></types:item>
+ <types:item><types:key>authRef</types:key><types:value>inscriber</types:value></types:item>
+ </service:properties>
<service:content contentType="application/xml">
<service:xmlContent
namespaceURI="http://collectionspace.org/services/collectionobject"
<service:part id="1" control_group="Managed"
versionable="true" auditable="false"
label="acquisitions_common" updated="" order="1">
- <service:content contentType="application/xml">
+ <service:properties>
+ <types:item><types:key>authRef</types:key><types:value>acquisitionAuthorizer</types:value></types:item>
+ <types:item><types:key>authRef</types:key><types:value>acquisitionFundingSource</types:value></types:item>
+ <!-- Need to handle repeating ref fields, like "acquisitionSources" -->
+ <types:item><types:key>authRef</types:key><types:value>fieldCollector</types:value></types:item>
+ </service:properties>
+ <service:content contentType="application/xml">
<service:xmlContent
namespaceURI="http://collectionspace.org/services/acquisition"
schemaLocation="http://collectionspace.org/services/acquisition http://services.collectionspace.org/acquisition/acquisitions_common.xsd">
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+
+import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.collectionspace.services.common.context.MultipartServiceContext;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.BadRequestException;
import org.collectionspace.services.common.document.DocumentUtils;
import org.collectionspace.services.common.document.DocumentWrapper;
import org.collectionspace.services.common.service.ObjectPartType;
+import org.collectionspace.services.common.vocabulary.RefNameUtils;
import org.jboss.resteasy.plugins.providers.multipart.InputPart;
import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
import org.nuxeo.ecm.core.api.DocumentModel;
ctx.addOutputPart(schema, doc, partMeta.getContent().getContentType());
} //TODO: handle other media types
}
+
+ public AuthorityRefList getAuthorityRefs(
+ DocumentWrapper<DocumentModel> docWrapper,
+ String pathPrefix,
+ List<String> authRefFields) {
+ AuthorityRefList authRefList = new AuthorityRefList();
+ try {
+ DocumentModel docModel = docWrapper.getWrappedObject();
+ List<AuthorityRefList.AuthorityRefItem> list =
+ authRefList.getAuthorityRefItem();
+
+ for(String field:authRefFields){
+ String refName = (String)docModel.getPropertyValue(pathPrefix+field);
+ if(refName==null)
+ continue;
+ try{
+ RefNameUtils.AuthorityTermInfo termInfo =
+ RefNameUtils.parseAuthorityTermInfo(refName);
+ AuthorityRefList.AuthorityRefItem ilistItem =
+ new AuthorityRefList.AuthorityRefItem();
+ ilistItem.setRefName(refName);
+ ilistItem.setAuthDisplayName(termInfo.inAuthority.displayName);
+ ilistItem.setItemDisplayName(termInfo.displayName);
+ ilistItem.setSourceField(field);
+ ilistItem.setUri(termInfo.getRelativeUri());
+ list.add(ilistItem);
+ } catch( Exception e ) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Caught exception in getAuthorityRefs", e);
+ }
+ }
+ }
+ } catch (Exception e) {
+ if (logger.isDebugEnabled()) {
+ logger.debug("Caught exception in getAuthorityRefs", e);
+ }
+ Response response = Response.status(
+ Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
+ throw new WebApplicationException(response);
+ }
+ return authRefList;
+ }
+
+
}
*/
package org.collectionspace.services.intake;
-import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
-import org.collectionspace.services.IntakeJAXBSchema;
import org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl;
-
-import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.collectionspace.services.common.ClientType;
import org.collectionspace.services.common.ServiceMain;
+import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.collectionspace.services.common.context.MultipartServiceContext;
import org.collectionspace.services.common.context.MultipartServiceContextFactory;
import org.collectionspace.services.common.context.MultipartServiceContextImpl;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.DocumentFilter;
-import org.collectionspace.services.common.document.DocumentNotFoundException;
import org.collectionspace.services.common.document.DocumentHandler;
+import org.collectionspace.services.common.document.DocumentNotFoundException;
import org.collectionspace.services.common.document.DocumentWrapper;
import org.collectionspace.services.common.query.IQueryManager;
import org.collectionspace.services.common.query.QueryManager;
import org.collectionspace.services.common.security.UnauthorizedException;
-import org.collectionspace.services.common.service.ObjectPartType;
-import org.collectionspace.services.common.vocabulary.RefNameUtils;
-import org.collectionspace.services.intake.IntakesCommonList.IntakeListItem;
-import org.collectionspace.services.intake.nuxeo.IntakeDocumentModelHandler;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
+import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
import org.jboss.resteasy.util.HttpResponseCodes;
ServiceContext ctx = MultipartServiceContextFactory.get().createServiceContext(null, getServiceName());
DocumentWrapper<DocumentModel> docWrapper =
getRepositoryClient(ctx).getDoc(ctx, csid);
- IntakeDocumentModelHandler handler = (IntakeDocumentModelHandler)createDocumentHandler(ctx);
+ RemoteDocumentModelHandlerImpl handler
+ = (RemoteDocumentModelHandlerImpl)createDocumentHandler(ctx);
List<String> authRefFields = ((MultipartServiceContextImpl)ctx).getCommonPartPropertyValues("authRef");
String prefix = ctx.getCommonPartLabel()+":";
authRefList = handler.getAuthorityRefs(docWrapper, prefix, authRefFields);
import java.util.Iterator;
import java.util.List;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
import org.collectionspace.services.IntakeJAXBSchema;
-import org.collectionspace.services.common.authorityref.AuthorityRefList;
-import org.collectionspace.services.common.context.MultipartServiceContextFactory;
-import org.collectionspace.services.common.context.MultipartServiceContextImpl;
-import org.collectionspace.services.common.context.ServiceContext;
-import org.collectionspace.services.common.document.DocumentHandler.Action;
import org.collectionspace.services.common.document.DocumentWrapper;
-import org.collectionspace.services.common.security.UnauthorizedException;
-import org.collectionspace.services.common.vocabulary.RefNameUtils;
import org.collectionspace.services.intake.IntakesCommon;
import org.collectionspace.services.intake.IntakesCommonList;
import org.collectionspace.services.intake.IntakesCommonList.IntakeListItem;
-
import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
import org.collectionspace.services.nuxeo.util.NuxeoUtils;
import org.nuxeo.ecm.core.api.DocumentModel;
public String getQProperty(String prop) {
return IntakeConstants.NUXEO_SCHEMA_NAME + ":" + prop;
}
-
- public AuthorityRefList getAuthorityRefs(
- DocumentWrapper<DocumentModel> docWrapper,
- String pathPrefix,
- List<String> authRefFields) {
- AuthorityRefList authRefList = new AuthorityRefList();
- try {
- DocumentModel docModel = docWrapper.getWrappedObject();
- List<AuthorityRefList.AuthorityRefItem> list =
- authRefList.getAuthorityRefItem();
-
- for(String field:authRefFields){
- String refName = (String)docModel.getPropertyValue(pathPrefix+field);
- if(refName==null)
- continue;
- try{
- RefNameUtils.AuthorityTermInfo termInfo =
- RefNameUtils.parseAuthorityTermInfo(refName);
- AuthorityRefList.AuthorityRefItem ilistItem =
- new AuthorityRefList.AuthorityRefItem();
- ilistItem.setRefName(refName);
- ilistItem.setAuthDisplayName(termInfo.inAuthority.displayName);
- ilistItem.setItemDisplayName(termInfo.displayName);
- ilistItem.setSourceField(field);
- ilistItem.setUri(termInfo.getRelativeUri());
- list.add(ilistItem);
- } catch( Exception e ) {
- if (logger.isDebugEnabled()) {
- logger.debug("Caught exception in getAuthorityRefs", e);
- }
- }
- }
- } catch (Exception e) {
- if (logger.isDebugEnabled()) {
- logger.debug("Caught exception in getIntakeList", e);
- }
- Response response = Response.status(
- Response.Status.INTERNAL_SERVER_ERROR).entity("Index failed").type("text/plain").build();
- throw new WebApplicationException(response);
- }
- return authRefList;
- }
-
+
}