]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
CSPACE-1850: Adding support in doc and repository client framework for tenant id.
authorRichard Millet <richard.millet@berkeley.edu>
Mon, 17 May 2010 21:21:24 +0000 (21:21 +0000)
committerRichard Millet <richard.millet@berkeley.edu>
Mon, 17 May 2010 21:21:24 +0000 (21:21 +0000)
services/common/.classpath
services/common/src/main/java/org/collectionspace/services/common/repository/RepositoryClient.java
services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java
services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java
services/organization/service/src/main/java/org/collectionspace/services/organization/OrgAuthorityResource.java
services/person/service/src/main/java/org/collectionspace/services/person/PersonAuthorityResource.java

index 1d5f7653026e84d70a2324314585a4b35e25ae5a..186c603a374f33c74aa7b1ae3d74f26f624a6136 100644 (file)
@@ -1,11 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>\r
 <classpath>\r
-       <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
-       <classpathentry kind="src" output="target/classes" path="target/generated-sources/xjc"/>\r
        <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>\r
+       <classpathentry kind="src" output="target/classes" path="target/generated-sources/xjc"/>\r
+       <classpathentry kind="src" output="target/classes" path="src/main/java"/>\r
        <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>\r
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
        <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>\r
        <classpathentry combineaccessrules="false" kind="src" path="/org.collectionspace.services.client"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/org.collectionspace.services.authentication.jaxb"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/org.collectionspace.services.authentication.service"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/org.collectionspace.services.authorization.jaxb"/>\r
+       <classpathentry combineaccessrules="false" kind="src" path="/org.collectionspace.services.authorization.service"/>\r
        <classpathentry kind="output" path="target/classes"/>\r
 </classpath>\r
index c6078f4794c5703eb4102cea56ffcfec75735d5d..29a6a04793b73cdc69e39876169e3a586ae627b5 100644 (file)
@@ -98,13 +98,21 @@ public interface RepositoryClient extends StorageClient {
 
     /**
      * Find a list of documentModels from the Nuxeo repository
+     * @param ctx 
      * @param docTypes a list of DocType names to match
      * @param where the clause to qualify on
+     * @param pageSize 
+     * @param pageNum 
+     * @param computeTotal 
      * @param domain the domain for the associated services
-     * @return
+     * @return document wrapper
+     * @throws DocumentNotFoundException 
+     * @throws DocumentException 
      */
     public DocumentWrapper<DocumentModelList> findDocs(
-               List<String> docTypes, String where, String domain,
+               ServiceContext ctx,
+               List<String> docTypes,
+               String where,
                int pageSize, int pageNum, boolean computeTotal )
             throws DocumentNotFoundException, DocumentException;
 }
index 98b0d1d7c12cc922c7a9aee74261a93ba0ab001c..693c3ef0fecde52fa768ad34248e2c20e003244c 100644 (file)
@@ -33,7 +33,9 @@ import org.nuxeo.ecm.core.api.DocumentModel;
 import org.nuxeo.ecm.core.api.DocumentModelList;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
+\r
 import org.collectionspace.services.common.ServiceMain;\r
+import org.collectionspace.services.common.context.ServiceContext;\r
 import org.collectionspace.services.common.authorityref.AuthorityRefDocList;\r
 import org.collectionspace.services.common.authorityref.AuthorityRefList;\r
 import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl;\r
@@ -55,22 +57,24 @@ public class RefNameServiceUtils {
 \r
     private final Logger logger = LoggerFactory.getLogger(RefNameServiceUtils.class);\r
     \r
-    public static AuthorityRefDocList getAuthorityRefDocs(RepositoryClient repoClient, \r
-               String tenantId, String serviceType, String refName,\r
-               int pageSize, int pageNum, boolean computeTotal )\r
-               throws DocumentException, DocumentNotFoundException {\r
+    public static AuthorityRefDocList getAuthorityRefDocs(ServiceContext ctx,\r
+               RepositoryClient repoClient, \r
+               String serviceType,\r
+               String refName,\r
+               int pageSize, int pageNum, boolean computeTotal ) throws DocumentException, DocumentNotFoundException {\r
        AuthorityRefDocList wrapperList = new AuthorityRefDocList();\r
         List<AuthorityRefDocList.AuthorityRefDocItem> list = \r
                wrapperList.getAuthorityRefDocItem();\r
        TenantBindingConfigReaderImpl tReader =\r
             ServiceMain.getInstance().getTenantBindingConfigReader();\r
-       List<ServiceBindingType> servicebindings = tReader.getServiceBindingsByType(tenantId, serviceType);\r
-       if(servicebindings==null || servicebindings.isEmpty())\r
+       List<ServiceBindingType> servicebindings = tReader.getServiceBindingsByType(ctx.getTenantId(), serviceType);\r
+       if (servicebindings == null || servicebindings.isEmpty())\r
                return null;\r
        // Need to escape the quotes in the refName\r
        // TODO What if they are already escaped?\r
        String escapedRefName = refName.replaceAll("'", "\\\\'");\r
-       String domain = tReader.getTenantBinding(tenantId).getRepositoryDomain();\r
+//     String domain = \r
+//             tReader.getTenantBinding(ctx.getTenantId()).getRepositoryDomain();\r
        ArrayList<String> docTypes = new ArrayList<String>(); \r
        HashMap<String, ServiceBindingType> queriedServiceBindings = new HashMap<String, ServiceBindingType>(); \r
        HashMap<String, List<String>> authRefFieldsByService = new HashMap<String, List<String>>(); \r
@@ -114,8 +118,8 @@ public class RefNameServiceUtils {
                return wrapperList;\r
        String fullQuery = whereClause.toString(); // for debug\r
                // Now we have to issue the search\r
-               DocumentWrapper<DocumentModelList> docListWrapper = repoClient.findDocs(\r
-                       docTypes, whereClause.toString(), domain, pageSize, pageNum, computeTotal );\r
+               DocumentWrapper<DocumentModelList> docListWrapper = repoClient.findDocs(ctx,\r
+                       docTypes, whereClause.toString(), pageSize, pageNum, computeTotal );\r
                // Now we gather the info for each document into the list and return\r
         DocumentModelList docList = docListWrapper.getWrappedObject();\r
         Iterator<DocumentModel> iter = docList.iterator();\r
index 422569706d28f8235c2e80c743d4cb615921e247..f9f1b962bdf73c4e62e2d41f866e2d0fe9adff94 100644 (file)
@@ -20,6 +20,8 @@ package org.collectionspace.services.nuxeo.client.java;
 import java.util.UUID;
 import java.util.List;
 
+import org.collectionspace.services.common.ServiceMain;
+import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl;
 import org.collectionspace.services.common.context.ServiceContext;
 import org.collectionspace.services.common.document.BadRequestException;
 import org.collectionspace.services.common.document.DocumentException;
@@ -52,10 +54,109 @@ import org.slf4j.LoggerFactory;
  * $LastChangedRevision: $ $LastChangedDate: $
  */
 public class RepositoryJavaClientImpl implements RepositoryClient {
-
+       
+       /**
+        * The Class QueryContext.
+        */
+       private class QueryContext {
+               
+               /** The doc type. */
+               String docType;
+               
+               /** The doc filter. */
+               DocumentFilter docFilter;
+               
+               /** The where clause. */
+               String whereClause;
+               
+               /** The domain. */
+               String domain;
+               
+               /** The tenant id. */
+               String tenantId;
+               
+               /**
+                * Instantiates a new query context.
+                *
+                * @param ctx the ctx
+                * @throws DocumentNotFoundException the document not found exception
+                * @throws DocumentException the document exception
+                */
+               QueryContext(ServiceContext ctx) throws DocumentNotFoundException, DocumentException {
+               docType = ctx.getDocumentType();
+               if (docType == null) {
+                   throw new DocumentNotFoundException(
+                           "Unable to find DocumentType for service " + ctx.getServiceName());
+               }
+               domain = ctx.getRepositoryDomainName();
+               if (domain == null) {
+                   throw new DocumentNotFoundException(
+                           "Unable to find Domain for service " + ctx.getServiceName());
+               }
+               tenantId = ctx.getTenantId();
+               if (tenantId == null) {
+                   throw new IllegalArgumentException(
+                       "Service context has no Tenant ID specified.");
+               }                       
+               }
+               
+//             /**
+//              * Instantiates a new query context.
+//              *
+//              * @param whereClause the where clause
+//              * @param theDomain the the domain
+//              * @param theTenantId the the tenant id
+//              */
+//             QueryContext(String theWhereClause, String theDomain, String theTenantId) {
+//                     whereClause = theWhereClause;
+//                     domain = theDomain;
+//                     tenantId = theTenantId;
+//             }
+               
+               /**
+                * Instantiates a new query context.
+                *
+                * @param ctx the ctx
+                * @param theWhereClause the the where clause
+                * @throws DocumentNotFoundException the document not found exception
+                * @throws DocumentException the document exception
+                */
+               QueryContext(ServiceContext ctx, String theWhereClause) throws DocumentNotFoundException, DocumentException {
+                       this(ctx);
+                       whereClause = theWhereClause;
+               }               
+               
+               /**
+                * Instantiates a new query context.
+                *
+                * @param ctx the ctx
+                * @param handler the handler
+                * @throws DocumentNotFoundException the document not found exception
+                * @throws DocumentException the document exception
+                */
+               QueryContext(ServiceContext ctx, DocumentHandler handler) throws DocumentNotFoundException, DocumentException {
+                       this(ctx);
+               if (handler == null) {
+                   throw new IllegalArgumentException(
+                           "Document handler is missing.");
+               }
+               docFilter = handler.getDocumentFilter();
+               if (docFilter == null) {
+                   throw new IllegalArgumentException(
+                           "Document handler has no Filter specified.");
+               }
+               whereClause = docFilter.getWhereClause();               
+               }
+       }
+
+    /** The logger. */
     private final Logger logger = LoggerFactory.getLogger(RepositoryJavaClientImpl.class);
 
+    /**
+     * Instantiates a new repository java client impl.
+     */
     public RepositoryJavaClientImpl() {
+       //Empty constructor
     }
 
     /**
@@ -188,29 +289,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
     @Override
     public void get(ServiceContext ctx, DocumentHandler handler)
             throws DocumentNotFoundException, DocumentException {
-
-        if (handler == null) {
-            throw new IllegalArgumentException(
-                    "RepositoryJavaClient.get: handler is missing");
-        }
-        DocumentFilter docFilter = handler.getDocumentFilter();
-        if (docFilter == null) {
-            throw new IllegalArgumentException(
-                    "RepositoryJavaClient.get: handler has no Filter specified");
-        }
-        if (docFilter.getPageSize() != 1) {
-            logger.warn("RepositoryJavaClient.get: forcing docFilter pagesize to 1.");
-        }
-        String docType = ctx.getDocumentType();
-        if (docType == null) {
-            throw new DocumentNotFoundException(
-                    "Unable to find DocumentType for service " + ctx.getServiceName());
-        }
-        String domain = ctx.getRepositoryDomainName();
-        if (domain == null) {
-            throw new DocumentNotFoundException(
-                    "Unable to find Domain for service " + ctx.getServiceName());
-        }
+       QueryContext queryContext = new QueryContext(ctx, handler);
         RepositoryInstance repoSession = null;
 
         try {
@@ -219,7 +298,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
 
             DocumentModelList docList = null;
             // force limit to 1, and ignore totalSize
-            String query = buildNXQLQuery(docType, docFilter.getWhereClause(), domain);
+            String query = buildNXQLQuery(queryContext);
             docList = repoSession.query(query, null, 1, 0, false);
             if (docList.size() != 1) {
                 throw new DocumentNotFoundException("No document found matching filter params.");
@@ -294,6 +373,21 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
         return wrapDoc;
     }
 
+    /**
+     * Gets the domain.
+     *
+     * @param ctx the ctx
+     * @return the domain
+     */
+    String getDomain(ServiceContext ctx) {
+       String result = null;
+       TenantBindingConfigReaderImpl tReader =
+            ServiceMain.getInstance().getTenantBindingConfigReader();
+       result = 
+               tReader.getTenantBinding(ctx.getTenantId()).getRepositoryDomain();
+       return result;
+    }
+    
     /**
      * find wrapped documentModel from the Nuxeo repository
      * @param ctx service context under which this method is invoked
@@ -302,27 +396,22 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
      */
     @Override
     public DocumentWrapper<DocumentModel> findDoc(
-            ServiceContext ctx, String where)
+            ServiceContext ctx, String whereClause)
             throws DocumentNotFoundException, DocumentException {
         RepositoryInstance repoSession = null;
         DocumentWrapper<DocumentModel> wrapDoc = null;
 
         try {
-            String docType = ctx.getDocumentType();
-            if (docType == null) {
-                throw new DocumentNotFoundException(
-                        "Unable to find DocumentType for service " + ctx.getServiceName());
-            }
-            String domain = ctx.getRepositoryDomainName();
-            if (domain == null) {
-                throw new DocumentNotFoundException(
-                        "Unable to find Domain for service " + ctx.getServiceName());
-            }
+               QueryContext queryContext = new QueryContext(ctx, whereClause);
             repoSession = getRepositorySession();
             DocumentModelList docList = null;
             // force limit to 1, and ignore totalSize
-            String query = buildNXQLQuery(docType, where, domain);
-            docList = repoSession.query(query, null, 1, 0, false);
+            String query = buildNXQLQuery(queryContext);
+            docList = repoSession.query(query,
+                       null, //Filter
+                       1, //limit
+                       0, //offset
+                       false); //countTotal
             if (docList.size() != 1) {
                 if (logger.isDebugEnabled()) {
                     logger.debug("findDoc: Query found: " + docList.size() + " items.");
@@ -356,11 +445,11 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
      * @throws DocumentException
      */
     public String findDocCSID(
-            ServiceContext ctx, String where)
+            ServiceContext ctx, String whereClause)
             throws DocumentNotFoundException, DocumentException {
         String csid = null;
         try {
-            DocumentWrapper<DocumentModel> wrapDoc = findDoc(ctx, where);
+            DocumentWrapper<DocumentModel> wrapDoc = findDoc(ctx, whereClause);
             DocumentModel docModel = wrapDoc.getWrappedObject();
             csid = NuxeoUtils.extractId(docModel.getPathAsString());
         } catch (DocumentNotFoundException dnfe) {
@@ -387,7 +476,9 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
      */
     @Override
     public DocumentWrapper<DocumentModelList> findDocs(
-            List<String> docTypes, String where, String domain,
+               ServiceContext ctx,
+            List<String> docTypes,
+            String whereClause,
             int pageSize, int pageNum, boolean computeTotal)
             throws DocumentNotFoundException, DocumentException {
         RepositoryInstance repoSession = null;
@@ -398,13 +489,12 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
                 throw new DocumentNotFoundException(
                         "findDocs must specify at least one DocumentType.");
             }
-            if (domain == null) {
-                throw new DocumentNotFoundException("findDocs must specify Domain.");
-            }
             repoSession = getRepositorySession();
             DocumentModelList docList = null;
             // force limit to 1, and ignore totalSize
-            String query = buildNXQLQuery(docTypes, where, domain);
+            QueryContext queryContext = new QueryContext(ctx, whereClause);
+//            QueryContext queryContext = new QueryContext(where, this.getDomain(ctx), ctx.getTenantId());            
+            String query = buildNXQLQuery(docTypes, queryContext);
             docList = repoSession.query(query, null, pageSize, pageNum, computeTotal);
             wrapDoc = new DocumentWrapperImpl<DocumentModelList>(docList);
         } catch (IllegalArgumentException iae) {
@@ -422,6 +512,9 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
         return wrapDoc;
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.storage.StorageClient#get(org.collectionspace.services.common.context.ServiceContext, java.util.List, org.collectionspace.services.common.document.DocumentHandler)
+     */
     @Override
     public void get(ServiceContext ctx, List<String> csidList, DocumentHandler handler)
             throws DocumentNotFoundException, DocumentException {
@@ -511,7 +604,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
             }
         }
     }
-
+    
     /**
      * getFiltered get all documents for an entity service from the Document repository,
      * given filter parameters specified by the handler. 
@@ -522,37 +615,20 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
      */
     public void getFiltered(ServiceContext ctx, DocumentHandler handler)
             throws DocumentNotFoundException, DocumentException {
-        if (handler == null) {
-            throw new IllegalArgumentException(
-                    "RepositoryJavaClient.getFiltered: handler is missing");
-        }
-        DocumentFilter docFilter = handler.getDocumentFilter();
-        if (docFilter == null) {
-            throw new IllegalArgumentException(
-                    "RepositoryJavaClient.getFiltered: handler has no Filter specified");
-        }
-        String docType = ctx.getDocumentType();
-        if (docType == null) {
-            throw new DocumentNotFoundException(
-                    "Unable to find DocumentType for service " + ctx.getServiceName());
-        }
-        String domain = ctx.getRepositoryDomainName();
-        if (domain == null) {
-            throw new DocumentNotFoundException(
-                    "Unable to find Domain for service " + ctx.getServiceName());
-        }
+       QueryContext queryContext = new QueryContext(ctx, handler);
+               
         RepositoryInstance repoSession = null;
         try {
             handler.prepare(Action.GET_ALL);
             repoSession = getRepositorySession();
             DocumentModelList docList = null;
-            String query = buildNXQLQuery(docType, docFilter.getWhereClause(), domain);
+            String query = buildNXQLQuery(queryContext);
 
             // If we have limit and/or offset, then pass true to get totalSize
             // in returned DocumentModelList.
-            if ((docFilter.getOffset() > 0) || (docFilter.getPageSize() > 0)) {
+            if ((queryContext.docFilter.getOffset() > 0) || (queryContext.docFilter.getPageSize() > 0)) {
                 docList = repoSession.query(query, null,
-                        docFilter.getPageSize(), docFilter.getOffset(), true);
+                               queryContext.docFilter.getPageSize(), queryContext.docFilter.getOffset(), true);
             } else {
                 docList = repoSession.query(query);
             }
@@ -675,12 +751,18 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
         }
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.storage.StorageClient#delete(org.collectionspace.services.common.context.ServiceContext, java.lang.String, org.collectionspace.services.common.document.DocumentHandler)
+     */
     @Override
     public void delete(ServiceContext ctx, String id, DocumentHandler handler)
             throws DocumentNotFoundException, DocumentException {
         throw new UnsupportedOperationException();
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.repository.RepositoryClient#createWorkspace(java.lang.String, java.lang.String)
+     */
     @Override
     public String createWorkspace(String tenantDomain, String workspaceName) throws Exception {
         RepositoryInstance repoSession = null;
@@ -716,6 +798,9 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
         return workspaceId;
     }
 
+    /* (non-Javadoc)
+     * @see org.collectionspace.services.common.repository.RepositoryClient#getWorkspaceId(java.lang.String, java.lang.String)
+     */
     @Override
     public String getWorkspaceId(String tenantDomain, String workspaceName) throws Exception {
         String workspaceId = null;
@@ -743,26 +828,52 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
         return workspaceId;
     }
 
-    private final void appendNXQLWhere(StringBuilder query, String where, String domain) {
+    /**
+     * Append nxql where.
+     *
+     * @param query the query
+     * @param where the where
+     * @param domain the domain
+     */
+    private final void appendNXQLWhere(StringBuilder query, QueryContext queryContext) {
         // TODO This is a slow method for tenant-filter
         // We should make this a property that is indexed.
-        query.append(" WHERE ecm:path STARTSWITH '/" + domain + "'");
-        if ((null != where) && (where.length() > 0)) {
+        query.append(" WHERE ecm:path STARTSWITH '/" + queryContext.domain + "'");
+//        query.append(" AND collectionspace_core:tenantId = " + tenantId);//FIXME: REM - Uncomment this and add a constant for the collectionspace_core schema and tenantId element
+        String whereClause = queryContext.whereClause;
+        if (whereClause != null && whereClause.length() > 0) {
             // Due to an apparent bug/issue in how Nuxeo translates the NXQL query string
             // into SQL, we need to parenthesize our 'where' clause
-            query.append(" AND " + "(" + where + ")");
+            query.append(" AND " + "(" + whereClause + ")");
         }
         query.append(" AND ecm:isProxy = 0");
     }
 
-    private final String buildNXQLQuery(String docType, String where, String domain) {
+    /**
+     * Builds the nxql query.
+     *
+     * @param docType the doc type
+     * @param where the where
+     * @param domain the domain
+     * @param tenantId the tenant id
+     * @return the string
+     */
+    private final String buildNXQLQuery(QueryContext queryContext) {
         StringBuilder query = new StringBuilder("SELECT * FROM ");
-        query.append(docType);
-        appendNXQLWhere(query, where, domain);
+        query.append(queryContext.docType);
+        appendNXQLWhere(query, queryContext);
         return query.toString();
     }
 
-    private final String buildNXQLQuery(List<String> docTypes, String where, String domain) {
+    /**
+     * Builds the nxql query.
+     *
+     * @param docTypes the doc types
+     * @param where the where
+     * @param domain the domain
+     * @return the string
+     */
+    private final String buildNXQLQuery(List<String> docTypes, QueryContext queryContext) {
         StringBuilder query = new StringBuilder("SELECT * FROM ");
         boolean fFirst = true;
         for (String docType : docTypes) {
@@ -773,10 +884,16 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
             }
             query.append(docType);
         }
-        appendNXQLWhere(query, where, domain);
+        appendNXQLWhere(query, queryContext);
         return query.toString();
     }
 
+    /**
+     * Gets the repository session.
+     *
+     * @return the repository session
+     * @throws Exception the exception
+     */
     private RepositoryInstance getRepositorySession() throws Exception {
         // FIXME: is it possible to reuse repository session?
         // Authentication failures happen while trying to reuse the session
@@ -788,6 +905,11 @@ public class RepositoryJavaClientImpl implements RepositoryClient {
         return repoSession;
     }
 
+    /**
+     * Release repository session.
+     *
+     * @param repoSession the repo session
+     */
     private void releaseRepositorySession(RepositoryInstance repoSession) {
         try {
             NuxeoClient client = NuxeoConnector.getInstance().getClient();
index 56af0dd392d51ff3c7f229625cc28adfacc8fae3..d84bbacb756173577bc4b6d98b325f6fd1c68712 100644 (file)
@@ -396,8 +396,10 @@ public class OrgAuthorityResource extends
                DocumentModel docModel = docWrapper.getWrappedObject();
                String refName = (String)docModel.getPropertyValue(OrganizationJAXBSchema.REF_NAME);
 
-               authRefDocList = RefNameServiceUtils.getAuthorityRefDocs(repoClient, 
-                               ctx.getTenantId(), serviceType, refName,
+               authRefDocList = RefNameServiceUtils.getAuthorityRefDocs(ctx,
+                               repoClient, 
+                               serviceType,
+                               refName,
                                myFilter.getPageSize(), myFilter.getStartPage(), true );
        } catch (UnauthorizedException ue) {
                Response response = Response.status(
index a1d8a708e761af078ddeccbf1d7a5c0d1033b6f9..c177be7295b994a33f1424e8b78e26a8225508e6 100644 (file)
@@ -371,9 +371,11 @@ public class PersonAuthorityResource extends
         DocumentModel docModel = docWrapper.getWrappedObject();
         String refName = (String)docModel.getPropertyValue(PersonJAXBSchema.REF_NAME);
 
-        authRefDocList = RefNameServiceUtils.getAuthorityRefDocs(repoClient, 
-                       ctx.getTenantId(), serviceType, refName,
-                       myFilter.getPageSize(), myFilter.getStartPage(), true );
+        authRefDocList = RefNameServiceUtils.getAuthorityRefDocs(ctx,
+                       repoClient, 
+                       serviceType,
+                       refName,
+                       myFilter.getPageSize(), myFilter.getStartPage(), true /*computeTotal*/ );
     } catch (UnauthorizedException ue) {
         Response response = Response.status(
                 Response.Status.UNAUTHORIZED).entity("Get failed reason " + ue.getErrorReason()).type("text/plain").build();