From: Richard Millet Date: Tue, 29 May 2012 19:20:50 +0000 (-0700) Subject: CSPACE-5036: Needed to shuffle some of the Relationship service constants to avoid... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=61227a5b4d727f3d7ea46dad8bf433e256c08675;p=tmp%2Fjakarta-migration.git CSPACE-5036: Needed to shuffle some of the Relationship service constants to avoid dependency cycles. --- diff --git a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java index 87c0c1d91..a1eb74d2e 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java +++ b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClient.java @@ -26,8 +26,6 @@ package org.collectionspace.services.client; 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; /** diff --git a/services/common/pom.xml b/services/common/pom.xml index ddd7fa93e..a892bfeec 100644 --- a/services/common/pom.xml +++ b/services/common/pom.xml @@ -50,11 +50,6 @@ org.collectionspace.services.client ${project.version} - - org.collectionspace.services - org.collectionspace.services.relation.client - ${project.version} - org.collectionspace.services org.collectionspace.services.authentication.jaxb diff --git a/services/common/src/main/java/org/collectionspace/services/common/relation/nuxeo/RelationConstants.java b/services/common/src/main/java/org/collectionspace/services/common/relation/nuxeo/RelationConstants.java index ef9982447..e640ad98e 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/relation/nuxeo/RelationConstants.java +++ b/services/common/src/main/java/org/collectionspace/services/common/relation/nuxeo/RelationConstants.java @@ -23,6 +23,7 @@ */ package org.collectionspace.services.common.relation.nuxeo; + /** * CollectionObjectConstants processes CollectionObject document * @@ -33,4 +34,6 @@ public class RelationConstants { 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"; + + } diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java index 4bef1cb51..9b81c8210 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocHandlerBase.java @@ -30,6 +30,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; +import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.common.ReflectionMapper; import org.collectionspace.services.common.api.Tools; import org.collectionspace.services.common.context.MultipartServiceContext; @@ -67,9 +68,9 @@ public abstract class DocHandlerBase extends RemoteDocumentModelHandlerImpl extends RemoteDocumentModelHandlerImpl 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 diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java index d0ec9fc6c..3e5dc322a 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RemoteDocumentModelHandlerImpl.java @@ -24,7 +24,6 @@ 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; @@ -39,6 +38,7 @@ import javax.xml.bind.JAXBElement; 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; @@ -48,7 +48,6 @@ import org.collectionspace.services.common.authorityref.AuthorityRefList; 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; @@ -59,7 +58,6 @@ import org.collectionspace.services.common.storage.jpa.JpaStorageUtils; 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; @@ -67,12 +65,9 @@ import org.dom4j.Element; 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; @@ -210,7 +205,7 @@ public abstract class RemoteDocumentModelHandlerImpl continue; // unknown part, ignore } Map 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); @@ -220,7 +215,7 @@ public abstract class RemoteDocumentModelHandlerImpl private void addExtraCoreValues(DocumentModel docModel, Map unQObjectProperties) throws Exception { - unQObjectProperties.put(COLLECTIONSPACE_CORE_WORKFLOWSTATE, docModel.getCurrentLifeCycleState()); + unQObjectProperties.put(CollectionSpaceClient.COLLECTIONSPACE_CORE_WORKFLOWSTATE, docModel.getCurrentLifeCycleState()); } private void addAccountPermissionsPart() throws Exception { @@ -319,11 +314,11 @@ public abstract class RemoteDocumentModelHandlerImpl public void filterReadOnlyPropertiesForPart( Map 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(). } diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java index d3a0d82f0..0e70d4800 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java @@ -27,6 +27,7 @@ import java.util.UUID; 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; @@ -692,8 +693,8 @@ public class RepositoryJavaClientImpl implements RepositoryClient 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; } diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java index 9855919bc..ecc0a72a4 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java @@ -30,6 +30,7 @@ import java.util.regex.Matcher; 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; @@ -39,8 +40,6 @@ import org.collectionspace.services.common.context.ServiceContext; 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; @@ -283,8 +282,8 @@ public class NuxeoUtils { // // 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 diff --git a/services/dimension/service/src/main/java/org/collectionspace/services/dimension/nuxeo/DimensionDocumentModelHandler.java b/services/dimension/service/src/main/java/org/collectionspace/services/dimension/nuxeo/DimensionDocumentModelHandler.java index 65cc55f67..6bd499298 100644 --- a/services/dimension/service/src/main/java/org/collectionspace/services/dimension/nuxeo/DimensionDocumentModelHandler.java +++ b/services/dimension/service/src/main/java/org/collectionspace/services/dimension/nuxeo/DimensionDocumentModelHandler.java @@ -26,11 +26,7 @@ package org.collectionspace.services.dimension.nuxeo; 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; diff --git a/services/relation/client/src/main/java/org/collectionspace/services/client/RelationClient.java b/services/relation/client/src/main/java/org/collectionspace/services/client/RelationClient.java index 7949c3345..7e3f5aef1 100644 --- a/services/relation/client/src/main/java/org/collectionspace/services/client/RelationClient.java +++ b/services/relation/client/src/main/java/org/collectionspace/services/client/RelationClient.java @@ -29,28 +29,20 @@ package org.collectionspace.services.client; import org.jboss.resteasy.client.ClientResponse; import org.collectionspace.services.relation.RelationsCommonList; - /** * The Class RelationClient. */ public class RelationClient extends AbstractPoxServiceClientImpl { - 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() { diff --git a/services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java b/services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java index 689319ae3..d2732224a 100644 --- a/services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java +++ b/services/relation/service/src/main/java/org/collectionspace/services/relation/nuxeo/RelationDocumentModelHandler.java @@ -50,6 +50,7 @@ import org.collectionspace.services.relation.RelationsCommonList.RelationListIte 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; @@ -430,8 +431,8 @@ public class RelationDocumentModelHandler 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);