<scope>test</scope>\r
</dependency>\r
<!-- CollectionSpace dependencies -->\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.authorization.service</artifactId>\r
package org.collectionspace.services.client;
import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
-
import org.collectionspace.services.account.AccountsCommon;
import org.collectionspace.services.account.AccountsCommonList;
import org.jboss.resteasy.client.ClientResponse;
-
-
/**
* @version $Revision:$
*/
@Path("/accounts/")
@Produces({"application/xml"})
@Consumes({"application/xml"})
-public interface AccountProxy extends CollectionSpaceProxy {
+public interface AccountProxy extends CollectionSpaceProxy<AccountsCommonList> {
@GET
@Produces({"application/xml"})
//(U)pdate
@PUT
@Path("/{csid}")
- ClientResponse<AccountsCommon> update(@PathParam("csid") String csid, AccountsCommon multipart);
+ ClientResponse<AccountsCommon> update(@PathParam("csid") String csid, AccountsCommon multipart);
}
@Path("/accounts")
@Produces({"application/xml"})
@Consumes({"application/xml"})
-public interface AccountRoleProxy extends CollectionSpaceProxy {
+public interface AccountRoleProxy extends CollectionSpaceProxy<AccountRole> {
//(C)reate
@POST
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTestImpl#readPaginatedList(java.lang.String)
*/
- @Test(dataProvider = "testName")
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class,
+ dependsOnMethods = {"readList"})
@Override
public void readPaginatedList(String testName) throws Exception {
//FIXME: http://issues.collectionspace.org/browse/CSPACE-1697
<scope>test</scope>\r
</dependency>\r
<!-- CollectionSpace Dependencies -->\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.jaxb</artifactId>\r
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.jaxb.AbstractCommonList;
import org.jboss.resteasy.client.ClientResponse;
public interface AcquisitionProxy extends CollectionSpacePoxProxy<AbstractCommonList> {
@GET
ClientResponse<AbstractCommonList> readList();
+
+ @Override
+ @GET
+ @Produces({"application/xml"})
+ ClientResponse<AbstractCommonList> readIncludeDeleted(
+ @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
}
@Path("/authorization/permissions")
@Produces({"application/xml"})
@Consumes({"application/xml"})
-public interface PermissionProxy extends CollectionSpaceProxy {
+public interface PermissionProxy extends CollectionSpaceProxy<PermissionsList> {
@GET
@Produces({"application/xml"})
@Path("/authorization/permissions")
@Produces({"application/xml"})
@Consumes({"application/xml"})
-public interface PermissionRoleProxy extends CollectionSpaceProxy {
+public interface PermissionRoleProxy extends CollectionSpaceProxy<PermissionRole> {
//(C)reate
@POST
@Path("/{csid}/permroles")
@Path("/authorization/roles")
@Produces({"application/xml"})
@Consumes({"application/xml"})
-public interface RolePermissionProxy extends CollectionSpaceProxy {
+public interface RolePermissionProxy extends CollectionSpaceProxy<PermissionRole> {
//(C)reate
@POST
@Path("/authorization/roles")
@Produces({"application/xml"})
@Consumes({"application/xml"})
-public interface RoleProxy extends CollectionSpaceProxy {
+public interface RoleProxy extends CollectionSpaceProxy<RolesList> {
@GET
@Produces({"application/xml"})
<scope>test</scope>
</dependency>
<!-- CollectionSpace dependencies -->
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.jaxb</artifactId>
description="deploy services in ${jboss.server.cspace}">\r
<ant antfile="authentication/build.xml" target="deploy" inheritAll="false"/>\r
<ant antfile="authorization/build.xml" target="deploy" inheritAll="false"/>\r
+ <ant antfile="authority/build.xml" target="deploy" inheritAll="false"/>\r
<ant antfile="blob/build.xml" target="deploy" inheritAll="false"/>\r
<ant antfile="workflow/build.xml" target="deploy" inheritAll="false"/>\r
<ant antfile="common/build.xml" target="deploy" inheritAll="false"/>\r
<ant antfile="media/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="blob/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="workflow/build.xml" target="undeploy" inheritAll="false"/>\r
+ <ant antfile="authority/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="authorization/build.xml" target="undeploy" inheritAll="false"/>\r
<ant antfile="authentication/build.xml" target="undeploy" inheritAll="false"/>\r
</target>\r
description="create distribution for services">\r
<ant antfile="authentication/build.xml" target="dist" inheritAll="false"/>\r
<ant antfile="authorization/build.xml" target="dist" inheritAll="false"/>\r
+ <ant antfile="authority/build.xml" target="dist" inheritAll="false"/>\r
<ant antfile="account/build.xml" target="dist" inheritAll="false"/>\r
<ant antfile="blob/build.xml" target="dist" inheritAll="false"/>\r
<ant antfile="workflow/build.xml" target="dist" inheritAll="false"/>\r
public ClientResponse<String> update(String csid, PoxPayloadOut xmlPayload) {\r
return getProxy().update(csid, xmlPayload.getBytes());\r
}\r
+ \r
+ @Override\r
+ public ClientResponse<LT> readIncludeDeleted(Boolean includeDeleted) {\r
+ CollectionSpacePoxProxy<LT> proxy = getProxy();\r
+ return proxy.readIncludeDeleted(includeDeleted.toString());\r
+ } \r
}\r
* @param <CommonListType> \r
* @param <ListType> \r
*/\r
-public abstract class AbstractServiceClientImpl<LT, P extends CollectionSpaceProxy>\r
+public abstract class AbstractServiceClientImpl<LT, P extends CollectionSpaceProxy<LT>>\r
implements CollectionSpaceClient<LT, P> {\r
\r
/** The logger. */\r
/**
*
*/
-public interface CollectionSpaceClient<LT, P extends CollectionSpaceProxy> {
+public interface CollectionSpaceClient<LT, P extends CollectionSpaceProxy<LT>> {
public static final String AUTH_PROPERTY = "cspace.auth";
public static final String PASSWORD_PROPERTY = "cspace.password";
public ClientResponse<String> read(String csid);\r
\r
public ClientResponse<String> update(String csid, PoxPayloadOut xmlPayload);\r
+ \r
+ public ClientResponse<LT> readIncludeDeleted(Boolean includeDeleted);\r
}\r
import org.collectionspace.services.jaxb.AbstractCommonList;\r
import org.jboss.resteasy.client.ClientResponse;\r
\r
-public interface CollectionSpacePoxProxy<LT extends AbstractCommonList> extends CollectionSpaceProxy {\r
+public interface CollectionSpacePoxProxy<LT extends AbstractCommonList> extends CollectionSpaceProxy<LT> {\r
//(C)reate\r
@POST\r
ClientResponse<Response> create(byte[] payload);\r
* The Interface CollectionSpaceProxy.\r
* FIXME: http://issues.collectionspace.org/browse/CSPACE-1684\r
*/\r
-public interface CollectionSpaceProxy {\r
+public interface CollectionSpaceProxy<LT> {\r
\r
//(D)elete\r
@DELETE\r
ClientResponse<AbstractCommonList> readList(\r
@QueryParam(IClientQueryParams.PAGE_SIZE_PARAM) Long pageSize,\r
@QueryParam(IClientQueryParams.START_PAGE_PARAM) Long pageNumber);\r
- \r
+ \r
/**\r
* Read list.\r
* @param sortBy \r
package org.collectionspace.services.client;\r
\r
-public interface TestServiceProxy extends CollectionSpaceProxy {\r
+public interface TestServiceProxy extends CollectionSpaceProxy<Object> {\r
\r
}\r
import org.collectionspace.services.workflow.WorkflowCommon;
import org.collectionspace.services.client.AbstractPoxServiceClientImpl;
import org.collectionspace.services.client.CollectionSpaceClient;
+import org.collectionspace.services.client.CollectionSpacePoxClient;
import org.collectionspace.services.client.PayloadOutputPart;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
*/
private AbstractCommonList readList(String testName,
CollectionSpaceClient client,
- long pageSize, long pageNumber) throws Exception {
+ long pageSize,
+ long pageNumber,
+ int expectedStatus) throws Exception {
- return readList(testName, client, EMPTY_SORT_BY_ORDER, pageSize, pageNumber);
+ return readList(testName, client, EMPTY_SORT_BY_ORDER, pageSize, pageNumber, expectedStatus);
}
/**
* @throws Exception the exception
*/
private AbstractCommonList readList(String testName,
- CollectionSpaceClient client, String sortBy,
- long pageSize, long pageNumber) throws Exception {
+ CollectionSpaceClient client,
+ String sortBy,
+ long pageSize,
+ long pageNumber,
+ int expectedStatus) throws Exception {
ClientResponse<AbstractCommonList> response =
client.readList(sortBy, pageSize, pageNumber);
AbstractCommonList result = null;
if (getLogger().isDebugEnabled()) {
getLogger().debug(testName + ": status = " + statusCode);
}
- Assert.assertTrue(this.REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(this.REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, this.EXPECTED_STATUS_CODE);
+ Assert.assertEquals(statusCode, expectedStatus);
result = this.getAbstractCommonList(response);
} finally {
// Get the current total number of items.
// If there are no items then create some
- AbstractCommonList list = (AbstractCommonList) this.readList(testName, client, 1 /*pgSz*/, 0 /*pgNum*/);
+ AbstractCommonList list = (AbstractCommonList) this.readList(testName,
+ client,
+ 1 /*pgSz*/,
+ 0 /*pgNum*/,
+ EXPECTED_STATUS_CODE);
if (list == null || list.getTotalItems() == 0) {
this.createPaginatedList(testName, DEFAULT_PAGINATEDLIST_SIZE);
- list = (AbstractCommonList) this.readList(testName, client, 1 /*pgSz*/, 0 /*pgNum*/);
+ setupReadList();
+ list = (AbstractCommonList) this.readList(testName,
+ client,
+ 1 /*pgSz*/,
+ 0 /*pgNum*/,
+ EXPECTED_STATUS_CODE);
}
// Print out the current list size to be paginated
long pageSize = totalItems / 3; //create up to 3 pages to iterate over
long pagesTotal = pageSize > 0 ? (totalItems / pageSize) : 0;
for (int i = 0; i < pagesTotal; i++) {
- list = (AbstractCommonList) this.readList(testName, client, pageSize, i);
+ list = (AbstractCommonList) this.readList(testName, client, pageSize, i, EXPECTED_STATUS_CODE);
assertPaginationInfo(testName,
list,
i, //expected page number
// if there are any remainders be sure to paginate them as well
long mod = pageSize != 0 ? totalItems % pageSize : totalItems;
if (mod != 0) {
- list = (AbstractCommonList) this.readList(testName, client, pageSize, pagesTotal);
+ list = (AbstractCommonList) this.readList(testName, client, pageSize, pagesTotal, EXPECTED_STATUS_CODE);
assertPaginationInfo(testName,
list,
pagesTotal, //expected page number
Assert.assertEquals(updatedWorkflowCommons.getCurrentLifeCycleState(), lifeCycleState);
}
- /*
- * Sub-classes must override for the workflow tests.
- */
+ protected long readIncludeDeleted(String testName, Boolean includeDeleted) {
+ long result = 0;
+ // Perform setup.
+ setupReadList();
+
+ //
+ // Check to see if we have a POX client
+ //
+ CollectionSpaceClient clientCandidate = this.getClientInstance();
+ if (CollectionSpacePoxClient.class.isInstance(clientCandidate) != true) { //FIXME: REM - We should remove this check and instead make CollectionSpaceClient support the readIncludeDeleted() method.
+ String msg = "Workflow tests are incomplete because " +
+ clientCandidate.getClass().getName() + " does not support readIncludeDeleted() method.";
+ logger.warn(msg);
+ throw new UnsupportedOperationException();
+ }
+
+ //
+ // Ask for a list of all resources filtered by the incoming 'includeDeleted' workflow param
+ //
+ CollectionSpacePoxClient client = (CollectionSpacePoxClient)clientCandidate;
+ ClientResponse<AbstractCommonList> res = client.readIncludeDeleted(includeDeleted);
+ AbstractCommonList list = res.getEntity();
+ int statusCode = res.getStatus();
+ //
+ // Check the status code of the response: does it match
+ // the expected response(s)?
+ //
+ if (logger.isDebugEnabled()) {
+ logger.debug(testName + ": status = " + statusCode);
+ }
+ Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
+ invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
+ Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
+ //
+ // Now check that list size is correct
+ //
+ /*
+ List<AbstractCommonList.ListItem> items =
+ list.getListItem();
+ result = items.size();
+ */
+ result = list.getTotalItems();
+
+ return result;
+ }
+
+ /*
+ * This test assumes that no objects exist yet.
+ *
+ * http://localhost:8180/cspace-services/intakes?wf_deleted=false
+ */
+ @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class)
+ public void readWorkflow(String testName) throws Exception {
+ try {
+ //
+ // Get the total count of non-deleted existing records
+ //
+ long existingRecords = readIncludeDeleted(testName, Boolean.FALSE);
+
+ //
+ // Create 3 new objects
+ //
+ final int OBJECTS_TO_CREATE = 3;
+ for (int i = 0; i < OBJECTS_TO_CREATE; i++) {
+ this.createWorkflowTarget(testName);
+ }
+
+ //
+ // Mark one as soft deleted
+ //
+ int existingTestCreated = allResourceIdsCreated.size(); // assumption is that no other test created records were soft deleted
+ String csid = allResourceIdsCreated.get(existingTestCreated - 1); //0-based index to get the last one added
+ this.setupUpdate();
+ this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED);
+ //
+ // Read the list of existing non-deleted records
+ //
+ long updatedTotal = readIncludeDeleted(testName, Boolean.FALSE);
+ Assert.assertEquals(updatedTotal, existingRecords + OBJECTS_TO_CREATE - 1, "Deleted items seem to be returned in list results.");
+ } catch (UnsupportedOperationException e) {
+ logger.warn(this.getClass().getName() + " did not implement createWorkflowTarget() method. No workflow tests performed.");
+ return;
+ }
+ }
+
+ protected String createTestObject(String testName) throws Exception {
+ String result = null;
+
+ CollectionSpacePoxClient client = (CollectionSpacePoxClient)getClientInstance();
+ String identifier = createIdentifier();
+ PoxPayloadOut multipart = createInstance(identifier);
+ ClientResponse<Response> res = client.create(multipart);
+
+ int statusCode = res.getStatus();
+ Assert.assertEquals(statusCode, STATUS_CREATED);
+
+ result = extractId(res);
+ allResourceIdsCreated.add(result);
+
+ return result;
+ }
protected String createWorkflowTarget(String testName) throws Exception {
- logger.warn("Sub-class test clients should override this method");
- throw new UnsupportedOperationException();
+ String result = null;
+
+ result = createTestObject(testName);
+
+ return result;
}
- protected String createTestObject(String testName) throws Exception {
+ /*
+ * Sub-classes must override for the workflow tests.
+ */
+
+ protected PoxPayloadOut createInstance(String identifier) {
logger.warn("Sub-class test clients should override this method");
throw new UnsupportedOperationException();
}
<optional>true</optional>\r
<version>${project.version}</version>\r
</dependency> \r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.client</artifactId>\r
public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
public static final String SERVICE_PATH_PROXY = SERVICE_PATH + "/";
public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME;
+ public static final String SERVICE_COMMON_PART_NAME = SERVICE_NAME + PART_LABEL_SEPARATOR + PART_COMMON_LABEL;
@Override
public String getServiceName() {
import javax.ws.rs.Produces;
import javax.ws.rs.core.Response;
+import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.collectionobject.CollectionobjectsCommonList;
/**
@Produces({"application/xml"})
ClientResponse<CollectionobjectsCommonList> readList();
+ @Override
+ @GET
+ @Produces({"application/xml"})
+ ClientResponse<CollectionobjectsCommonList> readIncludeDeleted(
+ @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
+
/**
* Keyword search.
*
"objectNumber-" + identifier,
"objectName-" + identifier);
}
+
+ @Override
+ protected PoxPayloadOut createInstance(String identifier) {
+ String commonPartName = CollectionObjectClient.SERVICE_COMMON_PART_NAME;
+ return createCollectionObjectInstance(commonPartName, identifier);
+ }
/**
* Creates the collection object instance.
Repository workspace so we have to configure that.
-->
<tenant:serviceBindings name="Vocabularyitems" version="0.1">
+ <service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
+ /vocabularyitems/*/workflow/
+ </service:uriPath>
<!-- other URI paths using which this service could be accessed -->
<!--
<service:uriPath xmlns:service='http://collectionspace.org/services/common/service'>
import java.util.Map;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
import org.collectionspace.services.client.PayloadInputPart;
import org.collectionspace.services.client.PoxPayloadIn;
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.DocumentNotFoundException;
import org.collectionspace.services.common.document.DocumentUtils;
import org.collectionspace.services.common.document.DocumentWrapper;
import org.collectionspace.services.common.document.DocumentHandler.Action;
import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
import org.collectionspace.services.workflow.WorkflowCommon;
import org.dom4j.Element;
+import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
extends DocHandlerBase<WorkflowCommon> {
/** The logger. */
- private final Logger logger = LoggerFactory.getLogger(WorkflowDocumentModelHandler.class);
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowDocumentModelHandler.class);
/*
* Workflow transitions
throws Exception {
WorkflowCommon workflowsCommon = (WorkflowCommon)part.getBody();
docModel.followTransition(getTransitionFromState(workflowsCommon.getCurrentLifeCycleState()));
- }
-
+ }
}
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
+import javax.ws.rs.core.MultivaluedMap;
+
import org.collectionspace.services.client.IQueryManager;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
+import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
import org.collectionspace.services.common.query.QueryContext;
import org.collectionspace.services.common.repository.RepositoryClient;
+import org.collectionspace.services.common.workflow.service.nuxeo.WorkflowDocumentModelHandler;
import org.collectionspace.services.common.profile.Profiler;
import org.collectionspace.services.nuxeo.util.NuxeoUtils;
}
+ public void assertWorkflowState(ServiceContext ctx,
+ DocumentModel docModel) throws DocumentNotFoundException, ClientException {
+ MultivaluedMap<String, String> queryParams = ctx.getQueryParams();
+ if (queryParams != null) {
+ //
+ // Look for the workflow "delete" query param and see if we need to assert that the
+ // docModel is in a non-deleted workflow state.
+ //
+ String currentState = docModel.getCurrentLifeCycleState();
+ String includeDeletedStr = queryParams.getFirst(WorkflowClient.WORKFLOW_QUERY_NONDELETED);
+ boolean includeDeleted = Boolean.parseBoolean(includeDeletedStr);
+ if (includeDeleted == false) {
+ //
+ // We don't wanted soft-deleted object, so throw an exception if this one is soft-deleted.
+ //
+ if (currentState.equalsIgnoreCase(WorkflowClient.WORKFLOWSTATE_DELETED)) {
+ String msg = "GET assertion that docModel not be in 'deleted' workflow state failed.";
+ logger.debug(msg);
+ throw new DocumentNotFoundException(msg);
+ }
+ }
+ }
+ }
+
/**
* Sets the collection space core values.
*
* @param ctx the ctx
* @param documentModel the document model
- * @throws ClientException the client exception
+ * @throws ClientException the client exception //FIXME: REM - This behavior needs to be part of the base DocumentHandler classes, so our JPA services get this behavior as well
*/
private void setCollectionSpaceCoreValues(ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx,
DocumentModel documentModel,
handler.prepare(Action.GET);
repoSession = getRepositorySession();
DocumentRef docRef = NuxeoUtils.createPathRef(ctx, id);
- DocumentModel doc = null;
+ DocumentModel docModel = null;
try {
- doc = repoSession.getDocument(docRef);
+ docModel = repoSession.getDocument(docRef);
+ assertWorkflowState(ctx, docModel);
} catch (ClientException ce) {
- String msg = "could not find document with id=" + id;
+ String msg = "Could not find document with id=" + id;
logger.error(msg, ce);
throw new DocumentNotFoundException(msg, ce);
}
//set reposession to handle the document
((DocumentModelHandler) handler).setRepositorySession(repoSession);
- DocumentWrapper<DocumentModel> wrapDoc = new DocumentWrapperImpl<DocumentModel>(doc);
+ DocumentWrapper<DocumentModel> wrapDoc = new DocumentWrapperImpl<DocumentModel>(docModel);
handler.handle(Action.GET, wrapDoc);
handler.complete(Action.GET, wrapDoc);
} catch (IllegalArgumentException iae) {
<packaging>jar</packaging>
<dependencies>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.common</artifactId>
public ClientResponse<DimensionsCommonList> readList() {
DimensionProxy proxy = (DimensionProxy)getProxy();
return proxy.readList();
- }
-
- public ClientResponse<DimensionsCommonList> readIncludeDeleted(Boolean includeDeleted) { //FIXME: REM - This should be defined in the base class with a generic return list type
- DimensionProxy proxy = (DimensionProxy)getProxy();
- return proxy.readIncludeDeleted(includeDeleted.toString());
- }
+ }
}
return multipart;
}
-
- @Override
- protected String createWorkflowTarget(String testName) throws Exception {
- String result = null;
-
- result = createTestObject(testName);
-
- return result;
- }
@Override
protected String createTestObject(String testName) throws Exception {
@GET
@Path("{csid}")
public byte[] getDimension(
+ @Context UriInfo ui,
@PathParam("csid") String csid) {
if (logger.isDebugEnabled()) {
logger.debug("getDimension with csid=" + csid);
}
PoxPayloadOut result = null;
try {
- ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext();
+ MultivaluedMap<String, String> queryParams = ui.getQueryParameters();
+ ServiceContext<PoxPayloadIn, PoxPayloadOut> ctx = createServiceContext(queryParams);
DocumentHandler handler = createDocumentHandler(ctx);
getRepositoryClient(ctx).get(ctx, csid, handler);
result = ctx.getOutput();
@Path("/idgenerators/")
@Produces({"application/xml"})
@Consumes({"text/plain"})
-public interface IdProxy extends CollectionSpaceProxy {
+public interface IdProxy extends CollectionSpaceProxy<String> {
@GET
@Produces({"application/xml"})
<scope>test</scope>\r
</dependency>\r
<!-- CollectionSpace dependencies -->\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.jaxb</artifactId>\r
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.intake.IntakesCommonList;
/**
@GET
@Produces({"application/xml"})
ClientResponse<IntakesCommonList> readList();
+
+ @Override
+ @GET
+ @Produces({"application/xml"})
+ ClientResponse<IntakesCommonList> readIncludeDeleted(
+ @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
}
// Submit the request to the service and store the response.
IntakeClient client = new IntakeClient();
String identifier = createIdentifier();
- PoxPayloadOut multipart = createIntakeInstance(identifier);
+ PoxPayloadOut multipart = createInstance(identifier);
ClientResponse<Response> res = client.create(multipart);
int statusCode = res.getStatus();
// Note: The ID used in this 'create' call may be arbitrary.
// The only relevant ID may be the one used in update(), below.
IntakeClient client = new IntakeClient();
- PoxPayloadOut multipart = createIntakeInstance(NON_EXISTENT_ID);
+ PoxPayloadOut multipart = createInstance(NON_EXISTENT_ID);
ClientResponse<String> res =
client.update(NON_EXISTENT_ID, multipart);
int statusCode = res.getStatus();
invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
}
-
+
// Failure outcomes
/* (non-Javadoc)
* @see org.collectionspace.services.client.test.AbstractServiceTestImpl#deleteNonExistent(java.lang.String)
* @param identifier the identifier
* @return the multipart output
*/
- private PoxPayloadOut createIntakeInstance(String identifier) {
+ @Override
+ protected PoxPayloadOut createInstance(String identifier) {
return createIntakeInstance(
"entryNumber-" + identifier,
"entryDate-" + identifier,
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.jaxb.AbstractCommonList;
/**
// List
@GET
ClientResponse<AbstractCommonList> readList();
+
+ @Override
+ @GET
+ @Produces({"application/xml"})
+ ClientResponse<AbstractCommonList> readIncludeDeleted(
+ @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
}
<name>services.loanin</name>
<packaging>pom</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
<modules>
<module>jaxb</module>
<module>service</module>
<scope>test</scope>
</dependency>
<!-- CollectionSpace dependencies -->
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.jaxb</artifactId>
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
+import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.location.LocationauthoritiesCommonList;
import org.collectionspace.services.location.LocationsCommonList;
@QueryParam (IQueryManager.SEARCH_TYPE_PARTIALTERM) String partialTerm,
@QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords);
+ @Override
+ @GET
+ @Produces({"application/xml"})
+ ClientResponse<LocationauthoritiesCommonList> readIncludeDeleted(
+ @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
+
}
<name>services.location</name>\r
<packaging>pom</packaging>\r
\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
+ </dependencies>\r
+\r
<modules>\r
<module>jaxb</module>\r
<module>service</module>\r
<scope>test</scope>
</dependency>
<!-- CollectionSpace dependencies -->
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.jaxb</artifactId>
<scope>provided</scope>
</dependency>
<!-- CollectionSpace dependencies -->
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.jaxb</artifactId>
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
+import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.movement.MovementsCommonList;
/**
@Produces({"application/xml"})
ClientResponse<MovementsCommonList> readListSortedBy(
@QueryParam(IClientQueryParams.SORT_BY_PARAM) String sortFieldName);
+
+ @Override
+ @GET
+ @Produces({"application/xml"})
+ ClientResponse<MovementsCommonList> readIncludeDeleted(
+ @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
@GET
@Produces({"application/xml"})
* @return Multipart output suitable for use as a payload
* in a create or update request.
*/
- private PoxPayloadOut createInstance(String movementReferenceNumber) {
+ @Override
+ public PoxPayloadOut createInstance(String movementReferenceNumber) {
MovementsCommon movementCommon = new MovementsCommon();
// FIXME: Values of currentLocation, normalLocation,
// and movementContact should be refNames.
<artifactId>slf4j-log4j12</artifactId>\r
</dependency>\r
<!-- CollectionSpace dependencies -->\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.note.jaxb</artifactId>\r
@Path("/notes/")\r
@Produces({"application/xml;charset=UTF-8"})\r
@Consumes({"application/xml"})\r
-public interface NoteProxy extends CollectionSpaceProxy {\r
+public interface NoteProxy extends CollectionSpaceProxy<NotesCommonList> {\r
\r
@GET\r
@Produces({"application/xml"})\r
<scope>test</scope>
</dependency>
<!-- CollectionSpace dependencies -->
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.jaxb</artifactId>
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import org.collectionspace.services.client.workflow.WorkflowClient;
import org.collectionspace.services.jaxb.AbstractCommonList;
/**
// List
@GET
ClientResponse<AbstractCommonList> readList();
+
+ @Override
+ @GET
+ @Produces({"application/xml"})
+ ClientResponse<AbstractCommonList> readIncludeDeleted(
+ @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
}
<scope>provided</scope>\r
</dependency>\r
<!-- CollectionSpace dependencies -->\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.organization.jaxb</artifactId>\r
<name>services.organization.jaxb</name>
<dependencies>
+ <dependency>
+ <groupId>org.collectionspace.services</groupId>
+ <artifactId>org.collectionspace.services.authority</artifactId>
+ <optional>true</optional>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.collectionspace.services</groupId>
<artifactId>org.collectionspace.services.common</artifactId>
<artifactId>slf4j-log4j12</artifactId>\r
</dependency>\r
<!-- CollectionSpace dependencies -->\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.common</artifactId>\r
<name>services.person</name>\r
<packaging>pom</packaging>\r
\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
+ </dependencies>\r
+\r
<modules>\r
<module>jaxb</module>\r
<module>service</module>\r
<module>jaxb</module>
<module>hyperjaxb</module>
<module>common</module>
+ <module>authority</module>
<module>authorization-mgt</module> <!-- relies on authorization -->
<module>common-test</module>
<module>account</module> <!-- relies on authorization-mgt.import -->
<packaging>jar</packaging> \r
\r
<dependencies>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.common</artifactId>\r
<artifactId>slf4j-log4j12</artifactId>\r
</dependency>\r
<!-- CollectionSpace dependencies -->\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.vocabulary.jaxb</artifactId>\r
<name>services.vocabulary</name>\r
<packaging>pom</packaging>\r
\r
+ <dependencies>\r
+ <dependency>\r
+ <groupId>org.collectionspace.services</groupId>\r
+ <artifactId>org.collectionspace.services.authority</artifactId>\r
+ <optional>true</optional>\r
+ <version>${project.version}</version>\r
+ </dependency> \r
+ </dependencies>\r
+\r
<modules>\r
<module>jaxb</module>\r
<module>service</module>\r
this.createTestObject(testName);
}
- private int readIncludeDeleted(String testName, Boolean includeDeleted) {
- int result = 0;
- // Perform setup.
- setupReadList();
-
- // Submit the request to the service and store the response.
- DimensionClient client = new DimensionClient();
- ClientResponse<DimensionsCommonList> res = client.readIncludeDeleted(includeDeleted);
- DimensionsCommonList list = res.getEntity();
- int statusCode = res.getStatus();
- //
- // Check the status code of the response: does it match
- // the expected response(s)?
- //
- if (logger.isDebugEnabled()) {
- logger.debug(testName + ": status = " + statusCode);
- }
- Assert.assertTrue(REQUEST_TYPE.isValidStatusCode(statusCode),
- invalidStatusCodeMessage(REQUEST_TYPE, statusCode));
- Assert.assertEquals(statusCode, EXPECTED_STATUS_CODE);
- //
- // Now check that list size is correct
- //
- List<DimensionsCommonList.DimensionListItem> items =
- list.getDimensionListItem();
- result = items.size();
-
- return result;
- }
@Override
public void readList(String testName) throws Exception {
}
-
- /*
- * This test assumes that no objects exist yet.
- *
- * http://localhost:8180/cspace-services/intakes?wf_deleted=false
- */
- @Test(dataProvider = "testName", dataProviderClass = AbstractServiceTestImpl.class, dependsOnMethods = {"update"})
- public void readWorkflow(String testName) throws Exception {
- //
- // Get the total count of non-deleted existing records
- //
- int existingRecords = readIncludeDeleted(testName, Boolean.FALSE);
-
- //
- // Create 3 new objects
- //
- final int OBJECTS_TO_CREATE = 3;
- for (int i = 0; i < OBJECTS_TO_CREATE; i++) {
- this.createWorkflowTarget(testName);
- }
-
- //
- // Mark one as soft deleted
- //
- int existingTestCreated = allResourceIdsCreated.size(); // assumption is that no other test created records were soft deleted
- String csid = allResourceIdsCreated.get(existingTestCreated - 1); //0-based index to get the last one added
- this.setupUpdate();
- this.updateLifeCycleState(testName, csid, WorkflowClient.WORKFLOWSTATE_DELETED);
- //
- // Read the list of existing non-deleted records
- //
- int updatedTotal = readIncludeDeleted(testName, Boolean.FALSE);
- Assert.assertEquals(updatedTotal, existingRecords + OBJECTS_TO_CREATE - 1, "Deleted items seem to be returned in list results.");
- }
-
+
@Override
public void readPaginatedList(String testName) throws Exception {
//empty N/A