import javax.ws.rs.core.Response;
import org.apache.commons.httpclient.HttpClient;
import org.jboss.resteasy.client.ClientResponse;
-
-import org.collectionspace.services.jaxb.AbstractCommonList;
import org.collectionspace.services.common.authorityref.AuthorityRefList;
/**
<artifactId>org.collectionspace.services.client</artifactId>\r
<version>${project.version}</version>\r
</dependency>\r
- <dependency>\r
- <groupId>org.collectionspace.services</groupId>\r
- <artifactId>org.collectionspace.services.relation.client</artifactId>\r
- <version>${project.version}</version>\r
- </dependency>\r
<dependency>\r
<groupId>org.collectionspace.services</groupId>\r
<artifactId>org.collectionspace.services.authentication.jaxb</artifactId>\r
*/
package org.collectionspace.services.common.relation.nuxeo;
+
/**
* CollectionObjectConstants processes CollectionObject document
*
public final static String NUXEO_SCHEMA_NAME = "relations_common";
/** The Constant REL_NUXEO_SCHEMA_ROOT_ELEMENT. */
final public static String NUXEO_SCHEMA_ROOT_ELEMENT = "relationtype";
+
+
}
import java.util.Iterator;\r
import java.util.List;\r
\r
+import org.collectionspace.services.client.CollectionSpaceClient;\r
import org.collectionspace.services.common.ReflectionMapper;\r
import org.collectionspace.services.common.api.Tools;\r
import org.collectionspace.services.common.context.MultipartServiceContext;\r
\r
protected static final int NUM_STANDARD_LIST_RESULT_FIELDS = 4;\r
protected static final String STANDARD_LIST_CSID_FIELD = "csid";\r
- protected static final String STANDARD_LIST_URI_FIELD = COLLECTIONSPACE_CORE_URI;\r
- protected static final String STANDARD_LIST_UPDATED_AT_FIELD = COLLECTIONSPACE_CORE_UPDATED_AT;\r
- protected static final String STANDARD_LIST_WORKFLOW_FIELD = COLLECTIONSPACE_CORE_WORKFLOWSTATE;\r
+ protected static final String STANDARD_LIST_URI_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_URI;\r
+ protected static final String STANDARD_LIST_UPDATED_AT_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_UPDATED_AT;\r
+ protected static final String STANDARD_LIST_WORKFLOW_FIELD = CollectionSpaceClient.COLLECTIONSPACE_CORE_WORKFLOWSTATE;\r
\r
@Override\r
public AbstractCommonList getCommonPartList() {\r
\r
public static String getUpdatedAtAsString(DocumentModel docModel) throws Exception {\r
GregorianCalendar cal = (GregorianCalendar)\r
- docModel.getProperty(COLLECTIONSPACE_CORE_SCHEMA,\r
- COLLECTIONSPACE_CORE_UPDATED_AT);\r
+ docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,\r
+ CollectionSpaceClient.COLLECTIONSPACE_CORE_UPDATED_AT);\r
String updatedAt = DateTimeFormatUtils.formatAsISO8601Timestamp(cal);\r
return updatedAt;\r
}\r
import org.collectionspace.services.client.CollectionSpaceClient;
import org.collectionspace.services.client.IQueryManager;
+import org.collectionspace.services.client.IRelationsManager;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
-import org.collectionspace.services.client.RelationClient;
import org.collectionspace.services.common.authorityref.AuthorityRefList;
import org.collectionspace.services.common.context.ServiceContext;
import org.collectionspace.services.common.datetime.GregorianCalendarDateTimeUtils;
String docType = this.getServiceContext().getDocumentType();
String selectFields = IQueryManager.CMIS_TARGET_CSID + ", "
+ IQueryManager.CMIS_TARGET_TITLE + ", "
- + RelationClient.CMIS_CSPACE_RELATIONS_TITLE + ", "
- + RelationClient.CMIS_CSPACE_RELATIONS_OBJECT_ID + ", "
- + RelationClient.CMIS_CSPACE_RELATIONS_SUBJECT_ID;
+ + IRelationsManager.CMIS_CSPACE_RELATIONS_TITLE + ", "
+ + IRelationsManager.CMIS_CSPACE_RELATIONS_OBJECT_ID + ", "
+ + IRelationsManager.CMIS_CSPACE_RELATIONS_SUBJECT_ID;
String targetTable = docType + " " + IQueryManager.CMIS_TARGET_PREFIX;
- String relTable = RelationClient.SERVICE_DOC_TYPE + " " + IQueryManager.CMIS_RELATIONS_PREFIX;
- String relObjectCsidCol = RelationClient.CMIS_CSPACE_RELATIONS_OBJECT_ID;
- String relSubjectCsidCol = RelationClient.CMIS_CSPACE_RELATIONS_SUBJECT_ID;
+ String relTable = IRelationsManager.DOC_TYPE + " " + IQueryManager.CMIS_RELATIONS_PREFIX;
+ String relObjectCsidCol = IRelationsManager.CMIS_CSPACE_RELATIONS_OBJECT_ID;
+ String relSubjectCsidCol = IRelationsManager.CMIS_CSPACE_RELATIONS_SUBJECT_ID;
String targetCsidCol = IQueryManager.CMIS_TARGET_CSID;
//
// Build up the query arguments
package org.collectionspace.services.nuxeo.client.java;
import java.util.ArrayList;
-import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.collectionspace.services.authorization.AccountPermission;
import org.collectionspace.services.jaxb.AbstractCommonList;
import org.collectionspace.services.lifecycle.TransitionDef;
+import org.collectionspace.services.client.CollectionSpaceClient;
import org.collectionspace.services.client.PayloadInputPart;
import org.collectionspace.services.client.PayloadOutputPart;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.common.context.JaxRsContext;
import org.collectionspace.services.common.context.MultipartServiceContext;
import org.collectionspace.services.common.context.ServiceContext;
-import org.collectionspace.services.common.datetime.DateTimeFormatUtils;
import org.collectionspace.services.common.document.BadRequestException;
import org.collectionspace.services.common.document.DocumentUtils;
import org.collectionspace.services.common.document.DocumentWrapper;
import org.collectionspace.services.common.vocabulary.RefNameUtils;
import org.collectionspace.services.common.vocabulary.RefNameServiceUtils;
import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.AuthRefConfigInfo;
-import org.collectionspace.services.config.service.InitHandler.Params.Field;
import org.collectionspace.services.config.service.ListResultField;
import org.collectionspace.services.config.service.ObjectPartType;
import org.collectionspace.services.nuxeo.util.NuxeoUtils;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.core.api.DocumentModelList;
-import org.nuxeo.ecm.core.api.model.Property;
import org.nuxeo.ecm.core.api.model.PropertyException;
import org.nuxeo.ecm.core.api.repository.RepositoryInstance;
-import org.nuxeo.ecm.core.schema.types.Schema;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
continue; // unknown part, ignore
}
Map<String, Object> unQObjectProperties = extractPart(docModel, schema, partMeta);
- if(COLLECTIONSPACE_CORE_SCHEMA.equals(schema)) {
+ if(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA.equals(schema)) {
addExtraCoreValues(docModel, unQObjectProperties);
}
addOutputPart(unQObjectProperties, schema, partMeta);
private void addExtraCoreValues(DocumentModel docModel, Map<String, Object> unQObjectProperties)
throws Exception {
- unQObjectProperties.put(COLLECTIONSPACE_CORE_WORKFLOWSTATE, docModel.getCurrentLifeCycleState());
+ unQObjectProperties.put(CollectionSpaceClient.COLLECTIONSPACE_CORE_WORKFLOWSTATE, docModel.getCurrentLifeCycleState());
}
private void addAccountPermissionsPart() throws Exception {
public void filterReadOnlyPropertiesForPart(
Map<String, Object> objectProps, ObjectPartType partMeta) {
// Should add in logic to filter most of the core items on update
- if(partMeta.getLabel().equalsIgnoreCase(COLLECTIONSPACE_CORE_SCHEMA)) {
- objectProps.remove(COLLECTIONSPACE_CORE_CREATED_AT);
- objectProps.remove(COLLECTIONSPACE_CORE_CREATED_BY);
- objectProps.remove(COLLECTIONSPACE_CORE_URI);
- objectProps.remove(COLLECTIONSPACE_CORE_TENANTID);
+ if(partMeta.getLabel().equalsIgnoreCase(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA)) {
+ objectProps.remove(CollectionSpaceClient.COLLECTIONSPACE_CORE_CREATED_AT);
+ objectProps.remove(CollectionSpaceClient.COLLECTIONSPACE_CORE_CREATED_BY);
+ objectProps.remove(CollectionSpaceClient.COLLECTIONSPACE_CORE_URI);
+ objectProps.remove(CollectionSpaceClient.COLLECTIONSPACE_CORE_TENANTID);
// Note that the updatedAt/updatedBy fields are set internally
// in DocumentModelHandler.handleCoreValues().
}
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.MultivaluedMap;
+import org.collectionspace.services.client.CollectionSpaceClient;
import org.collectionspace.services.client.IQueryManager;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
@Override
public String getDocURI(DocumentWrapper<DocumentModel> wrappedDoc) throws ClientException {
DocumentModel docModel = wrappedDoc.getWrappedObject();
- String uri = (String)docModel.getProperty(DocumentModelHandler.COLLECTIONSPACE_CORE_SCHEMA,
- DocumentModelHandler.COLLECTIONSPACE_CORE_URI);
+ String uri = (String)docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,
+ CollectionSpaceClient.COLLECTIONSPACE_CORE_URI);
return uri;
}
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
+import org.collectionspace.services.client.CollectionSpaceClient;
import org.collectionspace.services.client.IQueryManager;
import org.collectionspace.services.client.PoxPayloadIn;
import org.collectionspace.services.client.PoxPayloadOut;
import org.collectionspace.services.common.datetime.DateTimeFormatUtils;
import org.collectionspace.services.common.document.DocumentException;
import org.collectionspace.services.common.query.QueryContext;
-import org.collectionspace.services.config.service.ListResultField;
-import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler;
import org.dom4j.Document;
import org.dom4j.io.SAXReader;
//
// Restrict search to the current tenant ID. Is the domain path filter (above) still needed?
//
- query.append(/*IQueryManager.SEARCH_QUALIFIER_AND +*/ " WHERE " + DocumentModelHandler.COLLECTIONSPACE_CORE_SCHEMA + ":"
- + DocumentModelHandler.COLLECTIONSPACE_CORE_TENANTID
+ query.append(/*IQueryManager.SEARCH_QUALIFIER_AND +*/ " WHERE " + CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA + ":"
+ + CollectionSpaceClient.COLLECTIONSPACE_CORE_TENANTID
+ " = " + queryContext.getTenantId());
//
// Finally, append the incoming where clause
import java.util.Iterator;
import java.util.List;
-import javax.ws.rs.core.MultivaluedMap;
-
import org.collectionspace.services.dimension.DimensionJAXBSchema;
-import org.collectionspace.services.client.IQueryManager;
-import org.collectionspace.services.client.RelationClient;
import org.collectionspace.services.common.document.DocumentWrapper;
import org.collectionspace.services.dimension.DimensionsCommon;
import org.collectionspace.services.dimension.DimensionsCommonList;
import org.jboss.resteasy.client.ClientResponse;
import org.collectionspace.services.relation.RelationsCommonList;
-
/**
* The Class RelationClient.
*/
public class RelationClient extends AbstractPoxServiceClientImpl<RelationsCommonList, RelationProxy> {
- public static final String SERVICE_DOC_TYPE = "Relation"; // Used for CMIS queries only -should be the same as what's in the tenant bindings
- public static final String SERVICE_NAME = "relations";
+ public static final String SERVICE_DOC_TYPE = IRelationsManager.DOC_TYPE; // Used for CMIS queries only -should be the same as what's in the tenant bindings
+ public static final String SERVICE_NAME = IRelationsManager.SERVICE_NAME;
public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME;
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_LIST_NAME = "relations-common-list";
- public static final String SERVICE_COMMONPART_NAME = SERVICE_NAME + PART_LABEL_SEPARATOR + PART_COMMON_LABEL;
+ public static final String SERVICE_COMMONPART_NAME = IRelationsManager.SERVICE_COMMONPART_NAME;
- // Relations CMIS property mapping constants
- public final static String CMIS_CSPACE_RELATIONS_SUBJECT_ID = IQueryManager.CMIS_RELATIONS_PREFIX
- + "." + SERVICE_COMMONPART_NAME + ":subjectCsid";
- public final static String CMIS_CSPACE_RELATIONS_OBJECT_ID = IQueryManager.CMIS_RELATIONS_PREFIX
- + "." + SERVICE_COMMONPART_NAME + ":objectCsid";
- public final static String CMIS_CSPACE_RELATIONS_TITLE = IQueryManager.CMIS_RELATIONS_PREFIX
- + "." + IQueryManager.CMIS_NUXEO_TITLE;
@Override
public String getServiceName() {
import org.collectionspace.services.relation.RelationsDocListItem;
// HACK HACK HACK
+import org.collectionspace.services.client.CollectionSpaceClient;
import org.collectionspace.services.client.PersonAuthorityClient;
import org.collectionspace.services.client.OrgAuthorityClient;
import org.collectionspace.services.client.LocationAuthorityClient;
properties.put((fSubject?RelationJAXBSchema.SUBJECT_CSID:RelationJAXBSchema.OBJECT_CSID),
csid);
- String uri = (String) subjectOrObjectDocModel.getProperty(COLLECTIONSPACE_CORE_SCHEMA,
- COLLECTIONSPACE_CORE_URI);
+ String uri = (String) subjectOrObjectDocModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA,
+ CollectionSpaceClient.COLLECTIONSPACE_CORE_URI);
properties.put((fSubject?RelationJAXBSchema.SUBJECT_URI:RelationJAXBSchema.OBJECT_URI),
uri);