]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-4172,CSPACE-3332: Revised Intake service to return CommonList format for list...
authorAron Roberts <aron@socrates.berkeley.edu>
Wed, 29 Jun 2011 03:15:18 +0000 (03:15 +0000)
committerAron Roberts <aron@socrates.berkeley.edu>
Wed, 29 Jun 2011 03:15:18 +0000 (03:15 +0000)
services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto.xml
services/intake/client/src/main/java/org/collectionspace/services/client/IntakeClient.java
services/intake/client/src/main/java/org/collectionspace/services/client/IntakeProxy.java
services/intake/client/src/test/java/org/collectionspace/services/client/test/IntakeServiceTest.java
services/intake/service/src/main/java/org/collectionspace/services/intake/nuxeo/IntakeDocumentModelHandler.java

index ba019d47b9c5f62ab85023a026163c097e4a5f87..0518d72125cfbf0c40ce57dbed0254a32d48ae35 100644 (file)
             </service:uriPath> -->
       <service:repositoryDomain xmlns:service="http://collectionspace.org/services/common/service">default-domain</service:repositoryDomain>
       <service:documentHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.intake.nuxeo.IntakeDocumentModelHandler</service:documentHandler>
+      <service:DocHandlerParams xmlns:service="http://collectionspace.org/services/common/service">
+        <service:classname>org.collectionspace.services.group.nuxeo.IntakeDocumentModelHandler</service:classname>
+        <service:params>
+          <service:SchemaName>intakes</service:SchemaName>
+          <service:DublinCoreTitle>intakes</service:DublinCoreTitle>
+          <service:SummaryFields> entryNumber|depositor|currentOwner|uri|csid</service:SummaryFields>
+          <service:AbstractCommonListClassname />
+          <service:CommonListItemClassname />
+          <service:ListResultsItemMethodName>getIntakeListItem</service:ListResultsItemMethodName>
+          <service:ListResultsFields>
+            <service:ListResultField>
+              <service:element>entryNumber</service:element>
+              <service:xpath>entryNumber</service:xpath>
+            </service:ListResultField>
+            <service:ListResultField>
+              <service:element>depositor</service:element>
+              <service:xpath>depositor</service:xpath>
+            </service:ListResultField><service:ListResultField>
+              <service:element>currentOwner</service:element>
+              <service:xpath>currentOwner</service:xpath>
+            </service:ListResultField>
+          </service:ListResultsFields>
+        </service:params>
+      </service:DocHandlerParams> 
       <service:validatorHandler xmlns:service="http://collectionspace.org/services/common/service">org.collectionspace.services.intake.nuxeo.IntakeValidatorHandler</service:validatorHandler>
       <service:properties xmlns:service="http://collectionspace.org/services/common/service">
         <!-- What to use for name???
index 70d3b219967f008df28d4d8bd0abaed5719694bf..913b98508379196652450af565568c64e016e769 100644 (file)
@@ -27,7 +27,7 @@
 package org.collectionspace.services.client;
 
 import org.jboss.resteasy.client.ClientResponse;
-import org.collectionspace.services.intake.IntakesCommonList;
+import org.collectionspace.services.jaxb.AbstractCommonList;
 
 /**
  * A IntakeClient.
@@ -35,7 +35,7 @@ import org.collectionspace.services.intake.IntakesCommonList;
  * @version $Revision:$
  * FIXME: http://issues.collectionspace.org/browse/CSPACE-1684
  */
-public class IntakeClient extends AbstractPoxServiceClientImpl<IntakesCommonList, IntakeProxy> {
+public class IntakeClient extends AbstractPoxServiceClientImpl<AbstractCommonList, IntakeProxy> {
        public static final String SERVICE_NAME = "intakes";
        public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;       
        public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT;
@@ -66,7 +66,7 @@ public class IntakeClient extends AbstractPoxServiceClientImpl<IntakesCommonList
      * @return
      * @see org.collectionspace.services.client.IntakeProxy#getIntake()
      */
-    public ClientResponse<IntakesCommonList> readList() {
+    public ClientResponse<AbstractCommonList> readList() {
         return getProxy().readList();
     }    
 }
index 35432ac5e3bf70271ce503a3523aeb57006fad6f..3ba64c3a9011d4b283783c647bd6f2461fc46994 100644 (file)
@@ -34,7 +34,7 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.QueryParam;
 
 import org.collectionspace.services.client.workflow.WorkflowClient;
-import org.collectionspace.services.intake.IntakesCommonList;
+import org.collectionspace.services.jaxb.AbstractCommonList;
 
 /**
  * @version $Revision:$
@@ -43,7 +43,7 @@ import org.collectionspace.services.intake.IntakesCommonList;
 @Path(IntakeClient.SERVICE_PATH_PROXY)
 @Produces({"application/xml"})
 @Consumes({"application/xml"})
-public interface IntakeProxy extends CollectionSpacePoxProxy<IntakesCommonList> {
+public interface IntakeProxy extends CollectionSpacePoxProxy<AbstractCommonList> {
     /**
      * Read list.
      *
@@ -51,18 +51,18 @@ public interface IntakeProxy extends CollectionSpacePoxProxy<IntakesCommonList>
      */
     @GET
     @Produces({"application/xml"})
-    ClientResponse<IntakesCommonList> readList();
+    ClientResponse<AbstractCommonList> readList();
     
     @Override
        @GET
     @Produces({"application/xml"})
-    ClientResponse<IntakesCommonList> readIncludeDeleted(
+    ClientResponse<AbstractCommonList> readIncludeDeleted(
             @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);    
 
     @Override
     @GET
     @Produces({"application/xml"})
-    ClientResponse<IntakesCommonList> keywordSearchIncludeDeleted(
+    ClientResponse<AbstractCommonList> keywordSearchIncludeDeleted(
                @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords,
             @QueryParam(WorkflowClient.WORKFLOW_QUERY_NONDELETED) String includeDeleted);
 }
index ca97537e73f05cdd23c5a19d4a075b35d335c91b..1e0d806354c154a0a4936d6f3884f6442bae8145 100644 (file)
@@ -37,7 +37,6 @@ import org.collectionspace.services.intake.FieldCollectionEventNameList;
 import org.collectionspace.services.intake.CurrentLocationGroup;
 import org.collectionspace.services.intake.CurrentLocationGroupList;
 import org.collectionspace.services.intake.IntakesCommon;
-import org.collectionspace.services.intake.IntakesCommonList;
 import org.collectionspace.services.jaxb.AbstractCommonList;
 
 import org.jboss.resteasy.client.ClientResponse;
@@ -83,7 +82,7 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
     @Override
        protected AbstractCommonList getAbstractCommonList(
                        ClientResponse<AbstractCommonList> response) {
-       return response.getEntity(IntakesCommonList.class);
+       return response.getEntity(AbstractCommonList.class);
     }
     
     // ---------------------------------------------------------------
@@ -391,8 +390,8 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
 
         // Submit the request to the service and store the response.
         IntakeClient client = new IntakeClient();
-        ClientResponse<IntakesCommonList> res = client.readList();
-        IntakesCommonList list = res.getEntity();
+        ClientResponse<AbstractCommonList> res = client.readList();
+        AbstractCommonList list = res.getEntity();
         int statusCode = res.getStatus();
 
         // Check the status code of the response: does it match
@@ -407,16 +406,12 @@ public class IntakeServiceTest extends AbstractServiceTestImpl {
         // Optionally output additional data about list members for debugging.
         boolean iterateThroughList = false;
         if(iterateThroughList && logger.isDebugEnabled()){
-            List<IntakesCommonList.IntakeListItem> items =
-                    list.getIntakeListItem();
+            List<AbstractCommonList.ListItem> items =
+                    list.getListItem();
             int i = 0;
-            for(IntakesCommonList.IntakeListItem item : items){
-                logger.debug(testName + ": list-item[" + i + "] csid=" +
-                        item.getCsid());
-                logger.debug(testName + ": list-item[" + i + "] objectNumber=" +
-                        item.getEntryNumber());
-                logger.debug(testName + ": list-item[" + i + "] URI=" +
-                        item.getUri());
+            for(AbstractCommonList.ListItem item : items){
+                logger.debug(testName + ": list-item[" + i + "] " +
+                        item.toString());
                 i++;
             }
         }
index 6abd060cdcba3259c3a7219fe59f907b71248a23..be75254cf44761434e91c267c259b7faeaf73174 100644 (file)
  */
 package org.collectionspace.services.intake.nuxeo;
 
-import java.util.Iterator;
-import java.util.List;
-
-import org.collectionspace.services.IntakeJAXBSchema;
-import org.collectionspace.services.common.document.DocumentWrapper;
 import org.collectionspace.services.intake.IntakesCommon;
-import org.collectionspace.services.intake.IntakesCommonList;
-import org.collectionspace.services.intake.IntakesCommonList.IntakeListItem;
-import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
 
 /**
  * IntakeDocumentModelHandler
@@ -46,112 +33,6 @@ import org.slf4j.LoggerFactory;
  * $LastChangedDate: $
  */
 public class IntakeDocumentModelHandler
-        extends RemoteDocumentModelHandlerImpl<IntakesCommon, IntakesCommonList> {
-
-    /** The logger. */
-    private final Logger logger = LoggerFactory.getLogger(IntakeDocumentModelHandler.class);
-    /**
-     * intake is used to stash JAXB object to use when handle is called
-     * for Action.CREATE, Action.UPDATE or Action.GET
-     */
-    private IntakesCommon intake;
-    /**
-     * intakeList is stashed when handle is called
-     * for ACTION.GET_ALL
-     */
-    private IntakesCommonList intakeList;
-
-
-    /**
-     * getCommonPart get associated intake
-     * @return
-     */
-    @Override
-    public IntakesCommon getCommonPart() {
-        return intake;
-    }
-
-    /**
-     * setCommonPart set associated intake
-     * @param intake
-     */
-    @Override
-    public void setCommonPart(IntakesCommon intake) {
-        this.intake = intake;
-    }
-
-    /**
-     * getCommonPartList get associated intake (for index/GET_ALL)
-     * @return
-     */
-    @Override
-    public IntakesCommonList getCommonPartList() {
-        return intakeList;
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#setCommonPartList(java.lang.Object)
-     */
-    @Override
-    public void setCommonPartList(IntakesCommonList intakeList) {
-        this.intakeList = intakeList;
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPart(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public IntakesCommon extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc)
-            throws Exception {
-        throw new UnsupportedOperationException();
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#fillCommonPart(java.lang.Object, org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public void fillCommonPart(IntakesCommon intakeObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-        throw new UnsupportedOperationException();
-    }
-
-    /* (non-Javadoc)
-     * @see org.collectionspace.services.nuxeo.client.java.DocumentModelHandler#extractCommonPartList(org.collectionspace.services.common.document.DocumentWrapper)
-     */
-    @Override
-    public IntakesCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-        IntakesCommonList coList = this.extractPagingInfo(new IntakesCommonList(), wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        commonList.setFieldsReturned("entryNumber|depositor|currentOwner|uri|csid");
-        List<IntakesCommonList.IntakeListItem> list = coList.getIntakeListItem();
-        Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-        String label = getServiceContext().getCommonPartLabel();
-        while(iter.hasNext()){
-            DocumentModel docModel = iter.next();
-            IntakeListItem ilistItem = new IntakeListItem();
-            ilistItem.setEntryNumber((String) docModel.getProperty(label,
-                    IntakeJAXBSchema.ENTRY_NUMBER));
-            ilistItem.setDepositor((String) docModel.getProperty(label,
-                    IntakeJAXBSchema.DEPOSITOR));
-            ilistItem.setCurrentOwner((String) docModel.getProperty(label,
-                    IntakeJAXBSchema.CURRENT_OWNER));
-            String id = getCsid(docModel);//NuxeoUtils.extractId(docModel.getPathAsString());
-            ilistItem.setUri(getServiceContextPath() + id);
-            ilistItem.setCsid(id);
-            list.add(ilistItem);
-        }
-
-        return coList;
-    }
-
-    /**
-     * getQProperty converts the given property to qualified schema property
-     * @param prop
-     * @return
-     */
-    @Override
-    public String getQProperty(String prop) {
-        return IntakeConstants.NUXEO_SCHEMA_NAME + ":" + prop;
-    }
+        extends DocHandlerBase<IntakesCommon> {
 }