From: remillet Date: Mon, 11 Jan 2016 19:09:38 +0000 (-0800) Subject: CSPACE-6869: Changed CMIS relationship queries to use service binding document types... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=fe12423d46cb8171168d46b6e3b2eeb2ca88c834;p=tmp%2Fjakarta-migration.git CSPACE-6869: Changed CMIS relationship queries to use service binding document types instead of tenant qualified document types. --- diff --git a/services/client/src/main/java/org/collectionspace/services/client/IQueryManager.java b/services/client/src/main/java/org/collectionspace/services/client/IQueryManager.java index 0536a38ed..abc45b684 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/IQueryManager.java +++ b/services/client/src/main/java/org/collectionspace/services/client/IQueryManager.java @@ -75,7 +75,8 @@ public interface IQueryManager { final static String CMIS_NUXEO_ID = CMIS_OBJECT_ID; final static String CMIS_NUXEO_NAME = CMIS_NUXEO_PATHSEGMENT; final static String CMIS_NUXEO_TITLE = "dc:title"; - final static String CMIS_CS_UPDATED_AT = CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA + ":" + CollectionSpaceClient.COLLECTIONSPACE_CORE_UPDATED_AT; + final static String CMIS_CS_UPDATED_AT = CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA + ":" + + CollectionSpaceClient.COLLECTIONSPACE_CORE_UPDATED_AT; // CollectionSpace CMIS property mapping constants final static String CMIS_TARGET_PREFIX = "DOC"; @@ -85,8 +86,9 @@ public interface IQueryManager { final static String CMIS_JOIN_NUXEO_IS_VERSION_FILTER = IQueryManager.CMIS_TARGET_PREFIX + "." + IQueryManager.NUXEO_CMIS_IS_VERSION_FILTER; + final static String CMIS_JOIN_TENANT_ID_FILTER = + IQueryManager.CMIS_RELATIONS_PREFIX + "." + CollectionSpaceClient.CORE_TENANTID; - final static String CMIS_TARGET_NUXEO_ID = CMIS_TARGET_PREFIX + "." + CMIS_NUXEO_ID; final static String CMIS_TARGET_CSID = CMIS_TARGET_PREFIX + "." + CMIS_NUXEO_NAME; final static String CMIS_TARGET_TITLE = CMIS_TARGET_PREFIX + "." + CMIS_NUXEO_TITLE; diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java index b451aaa4b..d5d342499 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/DocumentModelHandler.java @@ -486,10 +486,8 @@ public abstract class DocumentModelHandler String matchObjDocTypes = (String)queryParams.getFirst(IQueryManager.SEARCH_RELATED_MATCH_OBJ_DOCTYPES); String selectDocType = (String)queryParams.getFirst(IQueryManager.SELECT_DOC_TYPE_FIELD); - //String docType = this.getServiceContext().getDocumentType(); - // If this type in this tenant has been extended, be sure to use that so extension schema is visible. - String docType = NuxeoUtils.getTenantQualifiedDocType(this.getServiceContext()); - if (selectDocType != null && !selectDocType.isEmpty()) { + String docType = this.getServiceContext().getDocumentType(); + if (selectDocType != null && !selectDocType.isEmpty()) { docType = selectDocType; } String selectFields = IQueryManager.CMIS_TARGET_CSID + ", " @@ -502,6 +500,7 @@ public abstract class DocumentModelHandler String relObjectCsidCol = IRelationsManager.CMIS_CSPACE_RELATIONS_OBJECT_ID; String relSubjectCsidCol = IRelationsManager.CMIS_CSPACE_RELATIONS_SUBJECT_ID; String targetCsidCol = IQueryManager.CMIS_TARGET_CSID; + String tenantID = this.getServiceContext().getTenantId(); // // Create the "ON" and "WHERE" query clauses based on the params passed into the HTTP request. @@ -533,6 +532,9 @@ public abstract class DocumentModelHandler + " IN " + matchObjDocTypes + ")"; } + // Qualify the query with the current tenant ID. + theWhereClause += IQueryManager.SEARCH_QUALIFIER_AND + IQueryManager.CMIS_JOIN_TENANT_ID_FILTER + " = '" + tenantID + "'"; + // This could later be in control of a queryParam, to omit if we want to see versions, or to // only see old versions. theWhereClause += IQueryManager.SEARCH_QUALIFIER_AND + IQueryManager.CMIS_JOIN_NUXEO_IS_VERSION_FILTER;