return "blob";
};
- //FIXME retrieve client type from configuration
- final static ClientType CLIENT_TYPE = ServiceMain.getInstance().getClientType();
@Override
protected String getVersionString() {
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);
- }
-
}
+++ /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 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";
-}
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;
}
-
}
--- /dev/null
+/**\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
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
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);
- }
}
+++ /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 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";
-}
*/
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;
}
-
}
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);
- }
- */
-
-
}
+++ /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 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";
-}
*/
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;
}
-
}