*/
package org.collectionspace.services.blob.nuxeo;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.List;
-
-import org.collectionspace.services.jaxb.AbstractCommonList;
-import org.collectionspace.services.jaxb.BlobJAXBSchema;
-
+import org.collectionspace.services.blob.BlobsCommon;
+import org.collectionspace.services.blob.BlobsCommonList;
+import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
import org.collectionspace.services.common.blob.BlobInput;
import org.collectionspace.services.common.blob.BlobOutput;
import org.collectionspace.services.common.blob.BlobUtil;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.DocumentWrapper;
-import org.collectionspace.services.common.document.DocumentHandler.Action;
import org.collectionspace.services.common.imaging.nuxeo.NuxeoImageUtils;
-import org.collectionspace.services.common.DocHandlerBase;
-
-import org.collectionspace.services.blob.BlobsCommonList;
-import org.collectionspace.services.blob.BlobsCommon;
-import org.collectionspace.services.blob.BlobsCommonList.BlobListItem;
-
-import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler;
-import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl;
-import org.collectionspace.services.nuxeo.util.NuxeoUtils;
-
-import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.collectionspace.services.jaxb.AbstractCommonList;
+import org.collectionspace.services.jaxb.BlobJAXBSchema;
+import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.DocumentModelList;
import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
-import org.nuxeo.ecm.core.api.ClientException;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.List;
+
/**
* The Class BlobDocumentModelHandler.
*/
/** The logger. */
private final Logger logger = LoggerFactory.getLogger(BlobDocumentModelHandler.class);
-
- public final String getNuxeoSchemaName(){
- return "blobs";
- }
- public String getSummaryFields(AbstractCommonList commonList){
- return "name|mimeType|encoding|length|uri|csid";
- }
-
- public AbstractCommonList createAbstractCommonListImpl(){
- return new BlobsCommonList();
- }
+ public static DocHandlerBase.CommonListReflection clr;
+ static {
+ clr = new DocHandlerBase.CommonListReflection();
+ clr.NuxeoSchemaName= "blobs";
+ clr.SummaryFields = "name|mimeType|encoding|length|uri|csid";
+ clr.AbstractCommonListClassname = "org.collectionspace.services.blob.BlobsCommonList";
+ clr.CommonListItemClassname = "org.collectionspace.services.blob.BlobsCommonList$BlobListItem";
+ clr.ListItemMethodName = "getBlobListItem";
+ clr.ListItemsArray = new String[][] {{"setEncoding", "encoding"},
+ {"setMimeType", "mimeType"},
+ {"setName", "name"},
+ {"setLength", "length"}
+ };
+ }
+ public DocHandlerBase.CommonListReflection getCommonListReflection(){
+ return clr;
+ }
+
+ //==============================================================================
- public List createItemsList(AbstractCommonList commonList){
- List list = ((BlobsCommonList)commonList).getBlobListItem();
- return list;
- }
-
private String getDerivativePathBase(DocumentModel docModel) {
return getServiceContextPath() + docModel.getName() + "/" +
BlobInput.URI_DERIVATIVES_PATH + "/";
}
- public Object createItemForCommonList(DocumentModel docModel, String label, String id) throws Exception {
+ /*public Object createItemForCommonList(DocumentModel docModel, String label, String id) throws Exception {
BlobListItem item = new BlobListItem();
item.setEncoding((String)
docModel.getProperty(label, BlobJAXBSchema.encoding));
item.setCsid(id);
return item;
}
-
+ */
private BlobsCommon getCommonPartProperties(DocumentModel docModel) throws Exception {
String label = getServiceContext().getCommonPartLabel();
BlobsCommon result = new BlobsCommon();
*/
package org.collectionspace.services.media.nuxeo;
-import java.util.List;
-
import org.collectionspace.services.MediaJAXBSchema;
-import org.collectionspace.services.blob.BlobsCommon;
-import org.collectionspace.services.common.DocHandlerBase;
+import org.collectionspace.services.nuxeo.client.java.DocHandlerBase;
import org.collectionspace.services.common.blob.BlobInput;
import org.collectionspace.services.common.blob.BlobUtil;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.document.DocumentWrapper;
-import org.collectionspace.services.common.document.DocumentHandler.Action;
-import org.collectionspace.services.common.imaging.nuxeo.NuxeoImageUtils;
-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.jaxb.BlobJAXBSchema;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartInput;
-import org.jboss.resteasy.plugins.providers.multipart.MultipartOutput;
+import org.collectionspace.services.media.MediaCommon;
import org.nuxeo.ecm.core.api.DocumentModel;
-import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
+
+import java.util.List;
/**
* The Class MediaDocumentModelHandler.
*/
public class MediaDocumentModelHandler
extends DocHandlerBase<MediaCommon, AbstractCommonList> {
-
- public final String getNuxeoSchemaName(){
- return "media";
- }
- public String getSummaryFields(AbstractCommonList commonList){
- return "title|source|filename|identificationNumber|uri|csid";
+ public static DocHandlerBase.CommonListReflection clr;
+ static {
+ clr = new DocHandlerBase.CommonListReflection();
+ clr.NuxeoSchemaName= "media";
+ clr.SummaryFields = "title|source|filename|identificationNumber|uri|csid";
+ clr.AbstractCommonListClassname = "org.collectionspace.services.media.MediaCommonList";
+ clr.CommonListItemClassname = "org.collectionspace.services.media.MediaCommonList$MediaListItem";
+ clr.ListItemMethodName = "getMediaListItem";
+ clr.ListItemsArray = new String[][] {{"setTitle", "title"},
+ {"setSource", "source"},
+ {"setFilename", "filename"},
+ {"setIdentificationNumber", "identificationNumber"}
+ };
}
-
- public AbstractCommonList createAbstractCommonListImpl(){
- return new MediaCommonList();
+ public DocHandlerBase.CommonListReflection getCommonListReflection(){
+ return clr;
}
+ //==============================================================================
- public List createItemsList(AbstractCommonList commonList){
- List list = ((MediaCommonList)commonList).getMediaListItem();
- return list;
- }
-
private MediaCommon getCommonPartProperties(DocumentModel docModel) throws Exception {
String label = getServiceContext().getCommonPartLabel();
MediaCommon result = new MediaCommon();
return result;
}
- 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;
- }
-
- @Override
+ @Override
public void extractAllParts(DocumentWrapper<DocumentModel> wrapDoc)
throws Exception {
ServiceContext ctx = this.getServiceContext();