]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-3175 applied objectexit refactoring to blob and media service. Also, refactor...
authorLaramie Crocker <laramie@berkeley.edu>
Mon, 6 Dec 2010 23:46:45 +0000 (23:46 +0000)
committerLaramie Crocker <laramie@berkeley.edu>
Mon, 6 Dec 2010 23:46:45 +0000 (23:46 +0000)
services/blob/service/src/main/java/org/collectionspace/services/blob/BlobResource.java
services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobConstants.java [deleted file]
services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobDocumentModelHandler.java
services/common/src/main/java/org/collectionspace/services/common/DocHandlerBase.java [new file with mode: 0755]
services/common/src/main/java/org/collectionspace/services/common/ResourceBase.java
services/media/service/src/main/java/org/collectionspace/services/media/MediaResource.java
services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaConstants.java [deleted file]
services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaDocumentModelHandler.java
services/objectexit/service/src/main/java/org/collectionspace/services/objectexit/ObjectExitResource.java
services/objectexit/service/src/main/java/org/collectionspace/services/objectexit/nuxeo/ObjectExitConstants.java [deleted file]
services/objectexit/service/src/main/java/org/collectionspace/services/objectexit/nuxeo/ObjectExitDocumentModelHandler.java

index 4b56c158582683772e7b4eede3529ee69134ddd0..6eeb42e9a9d19a0c00f34bf6180676e75a401e51 100644 (file)
@@ -43,8 +43,6 @@ public class BlobResource extends ResourceBase {
         return "blob";
     };
 
-    //FIXME retrieve client type from configuration
-    final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();
 
     @Override
     protected String getVersionString() {
@@ -56,23 +54,5 @@ public class BlobResource extends ResourceBase {
     public Class<BlobCommon> getCommonPartClass() {
        return BlobCommon.class;
     }
-
-    public Class getResourceClass() {
-        return this.getClass();
-    }
-
-    public BlobCommonList getBlobList(MultivaluedMap<String, String> queryParams) {
-        return (BlobCommonList)getList(queryParams);
-    }
-
-    @Deprecated
-    public BlobCommonList getBlobList(List<String> csidList) {
-        return (BlobCommonList) getList(csidList);
-    }
-
-    protected BlobCommonList search(MultivaluedMap<String,String> queryParams,String keywords) {
-         return (BlobCommonList) super.search(queryParams, keywords);
-    }
-
     
 }
diff --git a/services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobConstants.java b/services/blob/service/src/main/java/org/collectionspace/services/blob/nuxeo/BlobConstants.java
deleted file mode 100644 (file)
index afbe67b..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *  This document is a part of the source code and related artifacts
- *  for CollectionSpace, an open source collections management system
- *  for museums and related institutions:
-
- *  http://www.collectionspace.org
- *  http://wiki.collectionspace.org
-
- *  Copyright 2009 University of California at Berkeley
-
- *  Licensed under the Educational Community License (ECL), Version 2.0.
- *  You may not use this file except in compliance with this License.
-
- *  You may obtain a copy of the ECL 2.0 License at
-
- *  https://source.collectionspace.org/collection-space/LICENSE.txt
-
- *  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.blob.nuxeo;
-
-/**
- * BlobConstants specifies constants for the Loans Out service
- *
- */
-public class BlobConstants {
-
-    public final static String NUXEO_DOCTYPE = "Blob";
-    public final static String NUXEO_SCHEMA_NAME = "blob";
-    public final static String NUXEO_DC_TITLE = "CollectionSpace-Blob";
-}
index 94b335e40b3b6b35961f7b30ba9485e9fbe548c8..777955134ed2baf7f9b6fac93115cdfadbce3984 100644 (file)
@@ -27,146 +27,43 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.collectionspace.services.BlobJAXBSchema;
-import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.common.DocHandlerBase;
 import org.collectionspace.services.blob.BlobCommon;
 import org.collectionspace.services.blob.BlobCommonList;
 import org.collectionspace.services.blob.BlobCommonList.BlobListItem;
 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;
 
-/**
- * The Class BlobDocumentModelHandler.
- */
 public class BlobDocumentModelHandler
-        extends RemoteDocumentModelHandlerImpl<BlobCommon, BlobCommonList> {
-
-    /** The logger. */
-    private final Logger logger = LoggerFactory.getLogger(BlobDocumentModelHandler.class);
-    
-    /** The blob. */
-    private BlobCommon blob;
-    
-    /** The blob list. */
-    private BlobCommonList blobList;
-
-
-    /**
-     * Gets the common part.
-     *
-     * @return the common part
-     */
-    @Override
-    public BlobCommon getCommonPart() {
-        return blob;
-    }
-
-    /**
-     * Sets the common part.
-     *
-     * @param blob the new common part
-     */
-    @Override
-    public void setCommonPart(BlobCommon blob) {
-        this.blob = blob;
-    }
+        extends DocHandlerBase<BlobCommon, AbstractCommonList> {
 
-    /**
-     * Gets the common part list.
-     *
-     * @return the common part list
-     */
-    @Override
-    public BlobCommonList getCommonPartList() {
-        return blobList;
+    public final String getNuxeoSchemaName(){
+        return "blob";
     }
 
-    /**
-     * Sets the common part list.
-     *
-     * @param blobList the new common part list
-     */
-    @Override
-    public void setCommonPartList(BlobCommonList blobList) {
-        this.blobList = blobList;
+    public String getSummaryFields(AbstractCommonList commonList){
+        return "name|mimeType|encoding|length|uri|csid";
     }
 
-    /**
-     * Extract common part.
-     *
-     * @param wrapDoc the wrap doc
-     * @return the blob common
-     * @throws Exception the exception
-     */
-    @Override
-    public BlobCommon extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc)
-            throws Exception {
-        throw new UnsupportedOperationException();
+    public AbstractCommonList createAbstractCommonListImpl(){
+        return new BlobCommonList();
     }
 
-    /**
-     * Fill common part.
-     *
-     * @param blobObject the blob object
-     * @param wrapDoc the wrap doc
-     * @throws Exception the exception
-     */
-    @Override
-    public void fillCommonPart(BlobCommon blobObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * Extract common part list.
-     *
-     * @param wrapDoc the wrap doc
-     * @return the blob common list
-     * @throws Exception the exception
-     */
-    @Override
-    public BlobCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-        BlobCommonList coList = extractPagingInfo(new BlobCommonList(), wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        commonList.setFieldsReturned("name|mimeType|encoding|length|csid");
-
-
-        List<BlobCommonList.BlobListItem> list = coList.getBlobListItem();
-        Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-        while(iter.hasNext()){
-            DocumentModel docModel = iter.next();
-            BlobListItem item = new BlobListItem();
-
-            String label = getServiceContext().getCommonPartLabel();
-            item.setEncoding((String) docModel.getProperty(label, BlobJAXBSchema.encoding));
-            item.setMimeType((String) docModel.getProperty(label, BlobJAXBSchema.mimeType));
-            String theData = (String) docModel.getProperty(label, BlobJAXBSchema.data);
-            item.setName((String) docModel.getProperty(label, BlobJAXBSchema.name));
-            item.setLength((String) docModel.getProperty(label, BlobJAXBSchema.length));
-
-
-            String id = NuxeoUtils.extractId(docModel.getPathAsString());
-            item.setUri(getServiceContextPath() + id);
-            item.setCsid(id);
-            list.add(item);
-        }
-
-        return coList;
+    public List createItemsList(AbstractCommonList commonList){
+        List list = ((BlobCommonList)commonList).getBlobListItem();
+        return list;
     }
 
-    /**
-     * Gets the q property.
-     *
-     * @param prop the prop
-     * @return the q property
-     */
-    @Override
-    public String getQProperty(String prop) {
-        return BlobConstants.NUXEO_SCHEMA_NAME + ":" + prop;
+    public Object createItemForCommonList(DocumentModel docModel, String label, String id) throws Exception {
+        BlobListItem item = new BlobListItem();
+        item.setEncoding((String) docModel.getProperty(label, BlobJAXBSchema.encoding));
+        item.setMimeType((String) docModel.getProperty(label, BlobJAXBSchema.mimeType));
+        //String theData = (String) docModel.getProperty(label, BlobJAXBSchema.data);
+        item.setName((String) docModel.getProperty(label, BlobJAXBSchema.name));
+        item.setLength((String) docModel.getProperty(label, BlobJAXBSchema.length));
+        item.setUri(getServiceContextPath() + id);
+        item.setCsid(id);
+        return item;
     }
 }
 
diff --git a/services/common/src/main/java/org/collectionspace/services/common/DocHandlerBase.java b/services/common/src/main/java/org/collectionspace/services/common/DocHandlerBase.java
new file mode 100755 (executable)
index 0000000..e2afaef
--- /dev/null
@@ -0,0 +1,118 @@
+/**\r
+ *  This document is a part of the source code and related artifacts\r
+ *  for CollectionSpace, an open source collections management system\r
+ *  for museums and related institutions:\r
+\r
+ *  http://www.collectionspace.org\r
+ *  http://wiki.collectionspace.org\r
+\r
+ *  Copyright 2009 University of California at Berkeley\r
+\r
+ *  Licensed under the Educational Community License (ECL), Version 2.0.\r
+ *  You may not use this file except in compliance with this License.\r
+\r
+ *  You may obtain a copy of the ECL 2.0 License at\r
+\r
+ *  https://source.collectionspace.org/collection-space/LICENSE.txt\r
+\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+package org.collectionspace.services.common;\r
+\r
+import java.util.Iterator;\r
+import java.util.List;\r
+\r
+import org.collectionspace.services.common.document.DocumentWrapper;\r
+import org.collectionspace.services.jaxb.AbstractCommonList;\r
+import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;\r
+import org.collectionspace.services.nuxeo.util.NuxeoUtils;\r
+import org.nuxeo.ecm.core.api.DocumentModel;\r
+import org.nuxeo.ecm.core.api.DocumentModelList;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+\r
+/**\r
+ * User: laramie\r
+ * $LastChangedRevision:  $\r
+ * $LastChangedDate:  $\r
+ */\r
+public abstract class DocHandlerBase<T, TL>\r
+        extends RemoteDocumentModelHandlerImpl<T, TL> {\r
+\r
+    /** The logger. */\r
+    private final Logger logger = LoggerFactory.getLogger(this.getClass());\r
+\r
+    private AbstractCommonList commonList;\r
+\r
+    @Override\r
+    public TL getCommonPartList() {\r
+        return (TL)commonList;\r
+    }\r
+\r
+    public void setCommonPartList(AbstractCommonList aCommonList) {\r
+        this.commonList = aCommonList;\r
+    }\r
+\r
+    private T commonPart;\r
+\r
+    @Override\r
+    public T getCommonPart() {\r
+        return (T)commonPart;\r
+    }\r
+\r
+    public void setCommonPart(T commonPart) {\r
+        this.commonPart = commonPart;\r
+    }\r
+\r
+    public abstract String getNuxeoSchemaName();\r
+\r
+    public abstract String getSummaryFields(AbstractCommonList commonList);\r
+\r
+    public abstract AbstractCommonList createAbstractCommonListImpl();\r
+\r
+    public abstract List createItemsList(AbstractCommonList commonList );\r
+    \r
+    /** DocHandlerBase calls this method with the CSID as id */\r
+    public abstract Object createItemForCommonList(DocumentModel docModel, String label, String id) throws Exception;\r
+\r
+    @Override\r
+    public T extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc) throws Exception {\r
+        throw new UnsupportedOperationException();\r
+    }\r
+\r
+    public void fillCommonPart(T objectexitObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {\r
+        throw new UnsupportedOperationException();\r
+    }\r
+\r
+    @Override\r
+    public TL extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {\r
+        String label = getServiceContext().getCommonPartLabel();\r
+\r
+        AbstractCommonList commonList = createAbstractCommonListImpl();\r
+        //ObjectexitCommonList oeList = (ObjectexitCommonList)extractPagingInfo(commonList, wrapDoc);\r
+        extractPagingInfo(((TL)commonList), wrapDoc);\r
+        commonList.setFieldsReturned(getSummaryFields(commonList));\r
+        List list = createItemsList(commonList);\r
+        Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();\r
+        while(iter.hasNext()){\r
+            DocumentModel docModel = iter.next();\r
+            String id = NuxeoUtils.extractId(docModel.getPathAsString());\r
+            Object item = createItemForCommonList(docModel, label, id);\r
+            list.add(item);\r
+        }\r
+        return (TL)commonList;\r
+    }\r
+\r
+    @Override\r
+    public String getQProperty(String prop) {\r
+        return getNuxeoSchemaName() + ":" + prop;\r
+    }\r
+\r
+\r
+\r
+}\r
+\r
index 6193df8156ec43bd84af100315c0b6494e57e9fc..7bea31e786a0d28a51d2dc690e1c6358067b3943 100644 (file)
@@ -36,6 +36,9 @@ extends AbstractMultiPartCollectionSpaceResourceImpl {
     public static final String DELETE = "delete";\r
     public static final String LIST   = "list";\r
 \r
+    //FIXME retrieve client type from configuration\r
+    final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();\r
+\r
     public void ensureCSID(String csid, String crudType) throws WebApplicationException {\r
         if (logger.isDebugEnabled()) {\r
             logger.debug(crudType+" for "+getClass().getName()+" with csid=" + csid);\r
index 408af96284742aaad13741e1c4cc03ed8338b94e..f392b4888ea2e7737fb00abc28cb3345e0417b0b 100644 (file)
@@ -57,22 +57,6 @@ public class MediaResource extends ResourceBase {
        return MediaCommon.class;
     }
 
-    public Class getResourceClass() {
-        return this.getClass();
-    }
-
-    public MediaCommonList getMediaList(MultivaluedMap<String, String> queryParams) {
-        return (MediaCommonList)getList(queryParams);
-    }
-
-    @Deprecated
-    public MediaCommonList getMediaList(List<String> csidList) {
-        return (MediaCommonList) getList(csidList);
-    }
-
-    protected MediaCommonList search(MultivaluedMap<String,String> queryParams,String keywords) {
-         return (MediaCommonList) super.search(queryParams, keywords);
-    }
 
     
 }
diff --git a/services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaConstants.java b/services/media/service/src/main/java/org/collectionspace/services/media/nuxeo/MediaConstants.java
deleted file mode 100644 (file)
index 41f18d8..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *  This document is a part of the source code and related artifacts
- *  for CollectionSpace, an open source collections management system
- *  for museums and related institutions:
-
- *  http://www.collectionspace.org
- *  http://wiki.collectionspace.org
-
- *  Copyright 2009 University of California at Berkeley
-
- *  Licensed under the Educational Community License (ECL), Version 2.0.
- *  You may not use this file except in compliance with this License.
-
- *  You may obtain a copy of the ECL 2.0 License at
-
- *  https://source.collectionspace.org/collection-space/LICENSE.txt
-
- *  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.media.nuxeo;
-
-/**
- * MediaConstants specifies constants for the Loans Out service
- *
- */
-public class MediaConstants {
-
-    public final static String NUXEO_DOCTYPE = "Media";
-    public final static String NUXEO_SCHEMA_NAME = "media";
-    public final static String NUXEO_DC_TITLE = "CollectionSpace-Media";
-}
index e089455e65246010e013b3d3f1c2693d12213520..3f3edeb81d1fb37ad260e3cb9139e87d2353c4e7 100644 (file)
  */
 package org.collectionspace.services.media.nuxeo;
 
-import java.util.Iterator;
 import java.util.List;
 
 import org.collectionspace.services.MediaJAXBSchema;
-import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.common.DocHandlerBase;
 import org.collectionspace.services.media.MediaCommon;
 import org.collectionspace.services.media.MediaCommonList;
 import org.collectionspace.services.media.MediaCommonList.MediaListItem;
 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;
 
 /**
  * The Class MediaDocumentModelHandler.
  */
 public class MediaDocumentModelHandler
-        extends RemoteDocumentModelHandlerImpl<MediaCommon, MediaCommonList> {
+        extends DocHandlerBase<MediaCommon, AbstractCommonList> {
 
-    /** The logger. */
-    private final Logger logger = LoggerFactory.getLogger(MediaDocumentModelHandler.class);
-    
-    /** The media. */
-    private MediaCommon media;
-    
-    /** The media list. */
-    private MediaCommonList mediaList;
-
-
-    /**
-     * Gets the common part.
-     *
-     * @return the common part
-     */
-    @Override
-    public MediaCommon getCommonPart() {
-        return media;
-    }
-
-    /**
-     * Sets the common part.
-     *
-     * @param media the new common part
-     */
-    @Override
-    public void setCommonPart(MediaCommon media) {
-        this.media = media;
-    }
-
-    /**
-     * Gets the common part list.
-     *
-     * @return the common part list
-     */
-    @Override
-    public MediaCommonList getCommonPartList() {
-        return mediaList;
+    public final String getNuxeoSchemaName(){
+        return "media";
     }
 
-    /**
-     * Sets the common part list.
-     *
-     * @param mediaList the new common part list
-     */
-    @Override
-    public void setCommonPartList(MediaCommonList mediaList) {
-        this.mediaList = mediaList;
+    public String getSummaryFields(AbstractCommonList commonList){
+        return "title|source|filename|identificationNumber|uri|csid";
     }
 
-    /**
-     * Extract common part.
-     *
-     * @param wrapDoc the wrap doc
-     * @return the media common
-     * @throws Exception the exception
-     */
-    @Override
-    public MediaCommon extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc)
-            throws Exception {
-        throw new UnsupportedOperationException();
+    public AbstractCommonList createAbstractCommonListImpl(){
+        return new MediaCommonList();
     }
 
-    /**
-     * Fill common part.
-     *
-     * @param mediaObject the media object
-     * @param wrapDoc the wrap doc
-     * @throws Exception the exception
-     */
-    @Override
-    public void fillCommonPart(MediaCommon mediaObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * Extract common part list.
-     *
-     * @param wrapDoc the wrap doc
-     * @return the media common list
-     * @throws Exception the exception
-     */
-    @Override
-    public MediaCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-        MediaCommonList coList = extractPagingInfo(new MediaCommonList(), wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        //CSPACE-3209 don't use all fields.  commonList.setFieldsReturned("currentOwner|depositor|exitDate|exitMethod|exitNote|exitNumber|exitReason|packingNote|uri|csid");
-        commonList.setFieldsReturned("exitNumber|currentOwner|uri|csid");  //CSPACE-3209 now do this
-        List<MediaCommonList.MediaListItem> list = coList.getMediaListItem();
-        Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-        while(iter.hasNext()){
-            DocumentModel docModel = iter.next();
-            MediaListItem item = new MediaListItem();
-
-            String label = getServiceContext().getCommonPartLabel();
-
-            item.setTitle((String) docModel.getProperty(label, MediaJAXBSchema.title));
-            item.setSource((String) docModel.getProperty(label, MediaJAXBSchema.source));
-            item.setFilename((String) docModel.getProperty(label, MediaJAXBSchema.filename));
-            item.setIdentificationNumber((String) docModel.getProperty(label, MediaJAXBSchema.identificationNumber));
-            
-            String id = NuxeoUtils.extractId(docModel.getPathAsString());
-            item.setUri(getServiceContextPath() + id);
-            item.setCsid(id);
-            list.add(item);
-        }
-
-        return coList;
+    public List createItemsList(AbstractCommonList commonList){
+        List list = ((MediaCommonList)commonList).getMediaListItem();
+        return list;
     }
 
-    /**
-     * Gets the q property.
-     *
-     * @param prop the prop
-     * @return the q property
-     */
-    @Override
-    public String getQProperty(String prop) {
-        return MediaConstants.NUXEO_SCHEMA_NAME + ":" + prop;
+    public Object createItemForCommonList(DocumentModel docModel, String label, String id) throws Exception {
+        MediaListItem item = new MediaListItem();
+        item.setTitle((String) docModel.getProperty(label, MediaJAXBSchema.title));
+        item.setSource((String) docModel.getProperty(label, MediaJAXBSchema.source));
+        item.setFilename((String) docModel.getProperty(label, MediaJAXBSchema.filename));
+        item.setIdentificationNumber((String) docModel.getProperty(label, MediaJAXBSchema.identificationNumber));
+        item.setUri(getServiceContextPath() + id);
+        item.setCsid(id);
+        return item;
     }
 }
 
index e8019644271804d3d168d3392e30df708b25a0d7..0b5d8a1ba49cb06222ef8fd4b512d620d309fa6a 100644 (file)
@@ -54,25 +54,5 @@ public class ObjectExitResource extends ResourceBase {
     public Class<ObjectexitCommon> getCommonPartClass() {
        return ObjectexitCommon.class;
     }
-    /*
-    public Class getResourceClass() {
-        return this.getClass();
-    }
-
-    public ObjectexitCommonList getObjectexitList(MultivaluedMap<String, String> queryParams) {
-        return (ObjectexitCommonList)getList(queryParams);
-    }
-
-    @Deprecated
-    public ObjectexitCommonList getObjectexitList(List<String> csidList) {
-        return (ObjectexitCommonList) getList(csidList);
-    }
-
-    protected ObjectexitCommonList search(MultivaluedMap<String,String> queryParams,String keywords) {
-         return (ObjectexitCommonList) super.search(queryParams, keywords);
-    }
-    */
-   
-
     
 }
diff --git a/services/objectexit/service/src/main/java/org/collectionspace/services/objectexit/nuxeo/ObjectExitConstants.java b/services/objectexit/service/src/main/java/org/collectionspace/services/objectexit/nuxeo/ObjectExitConstants.java
deleted file mode 100644 (file)
index 2ddc216..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- *  This document is a part of the source code and related artifacts
- *  for CollectionSpace, an open source collections management system
- *  for museums and related institutions:
-
- *  http://www.collectionspace.org
- *  http://wiki.collectionspace.org
-
- *  Copyright 2009 University of California at Berkeley
-
- *  Licensed under the Educational Community License (ECL), Version 2.0.
- *  You may not use this file except in compliance with this License.
-
- *  You may obtain a copy of the ECL 2.0 License at
-
- *  https://source.collectionspace.org/collection-space/LICENSE.txt
-
- *  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.objectexit.nuxeo;
-
-/**
- * ObjectExitConstants specifies constants for the Loans Out service
- *
- */
-public class ObjectExitConstants {
-
-    public final static String NUXEO_DOCTYPE = "ObjectExit";
-    public final static String NUXEO_SCHEMA_NAME = "objectexit";
-    public final static String NUXEO_DC_TITLE = "CollectionSpace-ObjectExit";
-}
index d63987af9b8ada99110eba1288667c926b2f6025..f4185d2620ed4e1f8738521fa4e4dcbcd4c47e84 100644 (file)
  */
 package org.collectionspace.services.objectexit.nuxeo;
 
-import java.util.Iterator;
 import java.util.List;
 
 import org.collectionspace.services.ObjectexitJAXBSchema;
-import org.collectionspace.services.common.document.DocumentWrapper;
+import org.collectionspace.services.common.DocHandlerBase;
 import org.collectionspace.services.objectexit.ObjectexitCommon;
 import org.collectionspace.services.objectexit.ObjectexitCommonList;
 import org.collectionspace.services.objectexit.ObjectexitCommonList.ObjectexitListItem;
 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;
 
 /**
  * The Class ObjectExitDocumentModelHandler.
  */
 public class ObjectExitDocumentModelHandler
-        extends RemoteDocumentModelHandlerImpl<ObjectexitCommon, ObjectexitCommonList> {
+        extends DocHandlerBase<ObjectexitCommon, AbstractCommonList> {
 
-    /** The logger. */
-    private final Logger logger = LoggerFactory.getLogger(ObjectExitDocumentModelHandler.class);
-    
-    /** The objectexit. */
-    private ObjectexitCommon objectexit;
-    
-    /** The objectexit list. */
-    private ObjectexitCommonList objectexitList;
-
-
-    /**
-     * Gets the common part.
-     *
-     * @return the common part
-     */
-    @Override
-    public ObjectexitCommon getCommonPart() {
-        return objectexit;
+    public final String getNuxeoSchemaName(){
+        return "objectexit";
     }
 
-    /**
-     * Sets the common part.
-     *
-     * @param objectexit the new common part
-     */
     @Override
-    public void setCommonPart(ObjectexitCommon objectexit) {
-        this.objectexit = objectexit;
+    public String getSummaryFields(AbstractCommonList commonList){
+        return "exitNumber|currentOwner|uri|csid";
     }
 
-    /**
-     * Gets the common part list.
-     *
-     * @return the common part list
-     */
-    @Override
-    public ObjectexitCommonList getCommonPartList() {
-        return objectexitList;
+    public AbstractCommonList createAbstractCommonListImpl(){
+        return new ObjectexitCommonList();
     }
 
-    /**
-     * Sets the common part list.
-     *
-     * @param objectexitList the new common part list
-     */
-    @Override
-    public void setCommonPartList(ObjectexitCommonList objectexitList) {
-        this.objectexitList = objectexitList;
+    public List createItemsList(AbstractCommonList commonList){
+        //actually means getObjectexitListItems(), plural -- it's a list, but element is named singular, so JAXB generates like so.
+        List list = ((ObjectexitCommonList)commonList).getObjectexitListItem(); //List<ObjectexitCommonList.ObjectexitListItem> list = oeList.getObjectexitListItem();
+        return list;
     }
 
-    /**
-     * Extract common part.
-     *
-     * @param wrapDoc the wrap doc
-     * @return the objectexit common
-     * @throws Exception the exception
-     */
-    @Override
-    public ObjectexitCommon extractCommonPart(DocumentWrapper<DocumentModel> wrapDoc)
-            throws Exception {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * Fill common part.
-     *
-     * @param objectexitObject the objectexit object
-     * @param wrapDoc the wrap doc
-     * @throws Exception the exception
-     */
-    @Override
-    public void fillCommonPart(ObjectexitCommon objectexitObject, DocumentWrapper<DocumentModel> wrapDoc) throws Exception {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * Extract common part list.
-     *
-     * @param wrapDoc the wrap doc
-     * @return the objectexit common list
-     * @throws Exception the exception
-     */
-    @Override
-    public ObjectexitCommonList extractCommonPartList(DocumentWrapper<DocumentModelList> wrapDoc) throws Exception {
-        ObjectexitCommonList coList = extractPagingInfo(new ObjectexitCommonList(), wrapDoc);
-        AbstractCommonList commonList = (AbstractCommonList) coList;
-        //CSPACE-3209 don't use all fields.  commonList.setFieldsReturned("currentOwner|depositor|exitDate|exitMethod|exitNote|exitNumber|exitReason|packingNote|uri|csid");
-        commonList.setFieldsReturned("exitNumber|currentOwner|uri|csid");  //CSPACE-3209 now do this
-        List<ObjectexitCommonList.ObjectexitListItem> list = coList.getObjectexitListItem();
-        Iterator<DocumentModel> iter = wrapDoc.getWrappedObject().iterator();
-        while(iter.hasNext()){
-            DocumentModel docModel = iter.next();
-            ObjectexitListItem ilistItem = new ObjectexitListItem();
-
-            String label = getServiceContext().getCommonPartLabel();
-            ilistItem.setExitNumber((String) docModel.getProperty(label, ObjectexitJAXBSchema.OBJECT_EXIT_NUMBER));
-            //CSPACE-3209 ilistItem.setExitDate((String) docModel.getProperty(label, ObjectexitJAXBSchema.OBJECT_EXIT_DATE));
-            ilistItem.setCurrentOwner((String) docModel.getProperty(label, ObjectexitJAXBSchema.OBJECT_EXIT_CURRENT_OWNER));  //CSPACE-3209
-            String id = NuxeoUtils.extractId(docModel.getPathAsString());
-            ilistItem.setUri(getServiceContextPath() + id);
-            ilistItem.setCsid(id);
-            list.add(ilistItem);
-        }
-
-        return coList;
-    }
-
-    /**
-     * Gets the q property.
-     *
-     * @param prop the prop
-     * @return the q property
-     */
-    @Override
-    public String getQProperty(String prop) {
-        return ObjectExitConstants.NUXEO_SCHEMA_NAME + ":" + prop;
+    public Object createItemForCommonList(DocumentModel docModel, String label, String id) throws Exception {
+        ObjectexitListItem item = new ObjectexitListItem();
+        item.setExitNumber((String) docModel.getProperty(label, ObjectexitJAXBSchema.OBJECT_EXIT_NUMBER));
+        item.setCurrentOwner((String) docModel.getProperty(label, ObjectexitJAXBSchema.OBJECT_EXIT_CURRENT_OWNER));
+        item.setUri(getServiceContextPath() + id);
+        item.setCsid(id);
+        return item;
     }
 }