From: remillet Date: Thu, 24 Mar 2016 22:25:26 +0000 (-0700) Subject: CSPACE-6826: Added boiler plate code for Index sub-resource and added AuthZ check... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=fd6b4b4681f8383826ad922fd0a8946c132c34eb;p=tmp%2Fjakarta-migration.git CSPACE-6826: Added boiler plate code for Index sub-resource and added AuthZ check Index changes. --- diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java index 867c53c11..542d2bcc7 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResource.java @@ -80,7 +80,7 @@ import org.collectionspace.services.lifecycle.TransitionDef; import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler; import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentFilter; -import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl; +import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl; import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.collectionspace.services.workflow.WorkflowCommon; import org.jboss.resteasy.util.HttpResponseCodes; @@ -336,7 +336,7 @@ public abstract class AuthorityResource ServiceContext ctx = createServiceContext(item.inAuthority.resource); // HACK - this really must be moved to the doc handler, not here. No Nuxeo specific stuff here! - RepositoryJavaClientImpl client = (RepositoryJavaClientImpl)getRepositoryClient(ctx); + RepositoryClientImpl client = (RepositoryClientImpl)getRepositoryClient(ctx); String parentcsid = client.findDocCSID(repoSession, ctx, whereClause); String itemWhereClause = buildWhereForAuthItemByName(item.getShortIdentifier(), parentcsid); diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java index 4e78078b0..2dad57a22 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityDocumentModelHandler.java @@ -38,7 +38,7 @@ import org.collectionspace.services.common.vocabulary.AuthorityJAXBSchema; import org.collectionspace.services.config.service.ObjectPartType; import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler; import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; -import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl; +import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl; import org.nuxeo.ecm.core.api.ClientException; import org.nuxeo.ecm.core.api.DocumentModel; import org.slf4j.Logger; @@ -203,7 +203,7 @@ public abstract class AuthorityDocumentModelHandler CoreSessionInterface repoSession = null; ServiceContext ctx = this.getServiceContext(); - RepositoryJavaClientImpl nuxeoRepoClient = (RepositoryJavaClientImpl)this.getRepositoryClient(ctx); + RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl)this.getRepositoryClient(ctx); try { repoSession = nuxeoRepoClient.getRepositorySession(ctx); DocumentWrapper wrapDoc = nuxeoRepoClient.getDocFromCsid(ctx, repoSession, authCSID); diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java index 075c15624..f07dfaa9d 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java @@ -45,7 +45,7 @@ import org.collectionspace.services.config.service.ListResultField; import org.collectionspace.services.config.service.ObjectPartType; import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler; import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; -import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl; +import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl; import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.collectionspace.services.relation.RelationsCommonList; import org.collectionspace.services.vocabulary.VocabularyItemJAXBSchema; @@ -474,7 +474,7 @@ public abstract class AuthorityItemDocumentModelHandler boolean releaseRepoSession = false; try { - RepositoryJavaClientImpl repoClient = (RepositoryJavaClientImpl)this.getRepositoryClient(ctx); + RepositoryClientImpl repoClient = (RepositoryClientImpl)this.getRepositoryClient(ctx); repoSession = this.getRepositorySession(); if (repoSession == null) { repoSession = repoClient.getRepositorySession(ctx); @@ -605,8 +605,8 @@ public abstract class AuthorityItemDocumentModelHandler String filteredTerm; StringBuilder filteredTermBuilder = new StringBuilder(term); // Term contains no anchor or wildcard characters. - if ( (! term.contains(RepositoryJavaClientImpl.USER_SUPPLIED_ANCHOR_CHAR)) - && (! term.contains(RepositoryJavaClientImpl.USER_SUPPLIED_WILDCARD)) ) { + if ( (! term.contains(RepositoryClientImpl.USER_SUPPLIED_ANCHOR_CHAR)) + && (! term.contains(RepositoryClientImpl.USER_SUPPLIED_WILDCARD)) ) { filteredTerm = term; } else { // Term contains at least one such character. @@ -614,10 +614,10 @@ public abstract class AuthorityItemDocumentModelHandler // Filter the starting anchor or wildcard character, if any. String firstChar = filteredTermBuilder.substring(0,1); switch (firstChar) { - case RepositoryJavaClientImpl.USER_SUPPLIED_ANCHOR_CHAR: + case RepositoryClientImpl.USER_SUPPLIED_ANCHOR_CHAR: anchorAtStart = true; break; - case RepositoryJavaClientImpl.USER_SUPPLIED_WILDCARD: + case RepositoryClientImpl.USER_SUPPLIED_WILDCARD: filteredTermBuilder.deleteCharAt(0); break; } @@ -628,12 +628,12 @@ public abstract class AuthorityItemDocumentModelHandler int lastPos = filteredTermBuilder.length() - 1; String lastChar = filteredTermBuilder.substring(lastPos); switch (lastChar) { - case RepositoryJavaClientImpl.USER_SUPPLIED_ANCHOR_CHAR: + case RepositoryClientImpl.USER_SUPPLIED_ANCHOR_CHAR: filteredTermBuilder.deleteCharAt(lastPos); - filteredTermBuilder.insert(filteredTermBuilder.length(), RepositoryJavaClientImpl.ENDING_ANCHOR_CHAR); + filteredTermBuilder.insert(filteredTermBuilder.length(), RepositoryClientImpl.ENDING_ANCHOR_CHAR); anchorAtEnd = true; break; - case RepositoryJavaClientImpl.USER_SUPPLIED_WILDCARD: + case RepositoryClientImpl.USER_SUPPLIED_WILDCARD: filteredTermBuilder.deleteCharAt(lastPos); break; } @@ -642,7 +642,7 @@ public abstract class AuthorityItemDocumentModelHandler } filteredTerm = filteredTermBuilder.toString(); // Filter all other wildcards, if any. - filteredTerm = filteredTerm.replaceAll(RepositoryJavaClientImpl.USER_SUPPLIED_WILDCARD_REGEX, ZERO_OR_MORE_ANY_CHAR_REGEX); + filteredTerm = filteredTerm.replaceAll(RepositoryClientImpl.USER_SUPPLIED_WILDCARD_REGEX, ZERO_OR_MORE_ANY_CHAR_REGEX); if (logger.isTraceEnabled()) { logger.trace(String.format("After replacing user wildcards = %s", filteredTerm)); } @@ -835,7 +835,7 @@ public abstract class AuthorityItemDocumentModelHandler @Override public Map getJDBCQueryParams() { // FIXME: Get all of the following values from appropriate external constants. - // At present, these are duplicated in both RepositoryJavaClientImpl + // At present, these are duplicated in both RepositoryClientImpl // and in AuthorityItemDocumentModelHandler. final String TERM_GROUP_LIST_NAME = "TERM_GROUP_LIST_NAME"; final String TERM_GROUP_TABLE_NAME_PARAM = "TERM_GROUP_TABLE_NAME"; diff --git a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchDocumentModelHandler.java b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchDocumentModelHandler.java index 9f2aa7ae0..1dc994666 100644 --- a/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchDocumentModelHandler.java +++ b/services/batch/service/src/main/java/org/collectionspace/services/batch/nuxeo/BatchDocumentModelHandler.java @@ -31,7 +31,7 @@ import org.collectionspace.services.BatchJAXBSchema; import org.collectionspace.services.jaxb.InvocableJAXBSchema; import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler; import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; -import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl; +import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl; import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.collectionspace.services.batch.BatchCommon; import org.collectionspace.services.batch.BatchInvocable; @@ -79,7 +79,7 @@ public class BatchDocumentModelHandler extends NuxeoDocumentModelHandler + @@ -240,6 +241,7 @@ + @@ -259,6 +261,7 @@ + diff --git a/services/client/src/main/java/org/collectionspace/services/client/index/IndexClient.java b/services/client/src/main/java/org/collectionspace/services/client/index/IndexClient.java new file mode 100644 index 000000000..68f2570f6 --- /dev/null +++ b/services/client/src/main/java/org/collectionspace/services/client/index/IndexClient.java @@ -0,0 +1,72 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright (c) 2009 Regents of the University of California + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + */ +package org.collectionspace.services.client.index; + +import javax.ws.rs.core.Response; + +import org.collectionspace.services.client.AbstractCommonListPoxServiceClientImpl; + +/** + * IndexClient.java + * + * $LastChangedRevision: 2108 $ + * $LastChangedDate: 2010-05-17 18:25:37 -0700 (Mon, 17 May 2010) $ + * + */ +public class IndexClient extends AbstractCommonListPoxServiceClientImpl { + public static final String SERVICE_NAME = "index"; + public static final String SERVICE_PATH_COMPONENT = SERVICE_NAME; + public static final String SERVICE_PATH = "/" + SERVICE_PATH_COMPONENT; + public static final String SERVICE_PAYLOAD_NAME = SERVICE_NAME; + public static final String SERVICE_COMMONPART_NAME = SERVICE_NAME + PART_LABEL_SEPARATOR + PART_COMMON_LABEL; + public static final String SERVICE_AUTHZ_SUFFIX = "/*/" + SERVICE_PATH_COMPONENT + "/"; + public static final String INDEX_ID_PARAM = "indexid"; + + @Override + public String getServiceName() { + return SERVICE_NAME; + } + + @Override + public String getServicePathComponent() { + return SERVICE_PATH_COMPONENT; + } + + @Override + public Class getProxyClass() { + // TODO Auto-generated method stub + return IndexProxy.class; + } + + /* + * Proxied service calls + */ + + @Override + public Response readList() { + throw new UnsupportedOperationException(); + } + + /* (non-Javadoc) + * @see org.collectionspace.services.client.AbstractServiceClientImpl#delete(java.lang.String) + */ + @Override + public Response delete(String csid) { + throw new UnsupportedOperationException(); + } + +} diff --git a/services/client/src/main/java/org/collectionspace/services/client/index/IndexProxy.java b/services/client/src/main/java/org/collectionspace/services/client/index/IndexProxy.java new file mode 100644 index 000000000..64f52610e --- /dev/null +++ b/services/client/src/main/java/org/collectionspace/services/client/index/IndexProxy.java @@ -0,0 +1,16 @@ +package org.collectionspace.services.client.index; + +import javax.ws.rs.Consumes; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +import org.collectionspace.services.client.CollectionSpaceCommonListPoxProxy; + +/** + * @version $Revision: 2108 $ + */ +@Path(IndexClient.SERVICE_PATH + "/") +@Produces({"application/xml"}) +@Consumes({"application/xml"}) +public interface IndexProxy extends CollectionSpaceCommonListPoxProxy { +} diff --git a/services/common/src/main/cspace/config/services/service-config.xml b/services/common/src/main/cspace/config/services/service-config.xml index 463a4340e..7353357fd 100644 --- a/services/common/src/main/cspace/config/services/service-config.xml +++ b/services/common/src/main/cspace/config/services/service-config.xml @@ -29,7 +29,7 @@ Administrator Administrator java - org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl + org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl pageSizeDefault40 pageSizeMax2500 diff --git a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml index 00f7c8648..f599cafca 100644 --- a/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml +++ b/services/common/src/main/cspace/config/services/tenants/tenant-bindings-proto-unified.xml @@ -337,6 +337,34 @@ + + + + default-domain + org.collectionspace.services.common.index.service.nuxeo.WorkflowDocumentModelHandler + + org.collectionspace.services.index.nuxeo.WorkflowValidatorHandler + + + + + + + + + + + + + + + diff --git a/services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java b/services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java index de4c957d1..6856a80cb 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java +++ b/services/common/src/main/java/org/collectionspace/services/common/NuxeoBasedResource.java @@ -41,6 +41,7 @@ import org.collectionspace.services.common.config.ServiceConfigUtils; import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl; import org.collectionspace.services.common.context.RemoteServiceContext; import org.collectionspace.services.common.context.ServiceContext; +import org.collectionspace.services.common.document.DocumentException; import org.collectionspace.services.common.document.DocumentFilter; import org.collectionspace.services.common.document.DocumentHandler; import org.collectionspace.services.common.document.DocumentNotFoundException; @@ -55,10 +56,8 @@ import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler; import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; - import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; import org.jboss.resteasy.util.HttpResponseCodes; - import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; @@ -94,6 +93,65 @@ public abstract class NuxeoBasedResource } } + //======================= REINDEX ==================================================== + @GET + @Path("{csid}/index/{indexid}") + public Response reindex( + @Context Request request, + @Context UriInfo uriInfo, + @PathParam("csid") String csid, + @PathParam("indexid") String indexid) { + Response result = Response.noContent().build(); + boolean success = false; + + ensureCSID(csid, READ); + try { + RemoteServiceContext ctx = (RemoteServiceContext) createServiceContext(uriInfo); + DocumentHandler handler = createDocumentHandler(ctx); + success = getRepositoryClient(ctx).reindex(handler, csid); + } catch (Exception e) { + throw bigReThrow(e, ServiceMessages.REINDEX_FAILED, csid); + } + + if (success == false) { + Response response = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + ServiceMessages.REINDEX_FAILED + ServiceMessages.resourceNotReindexedMsg(csid)).type("text/plain").build(); + throw new CSWebApplicationException(response); + } + + return result; + } + + //======================= REINDEX ==================================================== + @GET + @Path("index/{indexid}") + public Response reindex( + @Context Request request, + @Context UriInfo uriInfo, + @PathParam("indexid") String indexid) { + Response result = Response.noContent().build();; + boolean success = false; + String docType = null; + + try { + RemoteServiceContext ctx = (RemoteServiceContext) createServiceContext(uriInfo); + docType = ctx.getTenantQualifiedDoctype(); // this will used in the error message if an error occurs + DocumentHandler handler = createDocumentHandler(ctx); + success = getRepositoryClient(ctx).reindex(handler, indexid); + } catch (Exception e) { + throw bigReThrow(e, ServiceMessages.REINDEX_FAILED); + } + + if (success == false) { + Response response = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity( + ServiceMessages.REINDEX_FAILED + ServiceMessages.resourceNotReindexedMsg(docType)).type("text/plain").build(); + throw new CSWebApplicationException(response); + } + + return result; + } + + //======================= CREATE ==================================================== @POST diff --git a/services/common/src/main/java/org/collectionspace/services/common/ServiceMessages.java b/services/common/src/main/java/org/collectionspace/services/common/ServiceMessages.java index 2fe4e522e..001830049 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/ServiceMessages.java +++ b/services/common/src/main/java/org/collectionspace/services/common/ServiceMessages.java @@ -42,6 +42,7 @@ public class ServiceMessages { public static final String CREATE_FAILED = "Create request " + FAILED; public static final String READ_FAILED = "Read request " + FAILED; + public static final String REINDEX_FAILED = "Reindex request " + FAILED; public static final String UPDATE_FAILED = "Update request " + FAILED; public static final String POST_UNSUPPORTED = "POST " + UNSUPPORTED; @@ -61,7 +62,15 @@ public class ServiceMessages { public static final String MISSING_INVALID_CSID = "missing/invalid csid="; public static String resourceNotFoundMsg(String csid) { - return "resource identified by CSID '" + csid + "' was not found."; + return String.format("The resource identified by CSID '%s' was not found.", csid); } + public static String resourceNotReindexedMsg(String csid) { + return String.format("The resource identified by CSID '%s' could not be reindexed. See the service logs for details.", csid); + } + + public static String resourceTypeNotReindexedMsg(String resourceType) { + return String.format("The resource types identified by '%s' could not be reindexed. See the service logs for details.", resourceType); + } + } diff --git a/services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/NuxeoBlobUtils.java b/services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/NuxeoBlobUtils.java index 77c7c52c6..2c456ffdd 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/NuxeoBlobUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/NuxeoBlobUtils.java @@ -83,7 +83,7 @@ import org.collectionspace.services.blob.MeasuredPartGroupList; import org.collectionspace.services.jaxb.BlobJAXBSchema; import org.collectionspace.services.nuxeo.client.java.CommonList; import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; -import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl; +import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl; import org.collectionspace.services.nuxeo.extension.thumbnail.ThumbnailConstants; import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.collectionspace.services.config.service.ListResultField; @@ -560,7 +560,7 @@ public class NuxeoBlobUtils { static private CoreSessionInterface getRepositorySession(ServiceContext ctx, RepositoryClient repositoryClient) { CoreSessionInterface result = null; - RepositoryJavaClientImpl nuxeoClient = (RepositoryJavaClientImpl)repositoryClient; + RepositoryClientImpl nuxeoClient = (RepositoryClientImpl)repositoryClient; try { result = nuxeoClient.getRepositorySession(ctx); @@ -574,7 +574,7 @@ public class NuxeoBlobUtils { static private void releaseRepositorySession(ServiceContext ctx, RepositoryClient repositoryClient, CoreSessionInterface repoSession) throws TransactionException { - RepositoryJavaClientImpl nuxeoClient = (RepositoryJavaClientImpl)repositoryClient; + RepositoryClientImpl nuxeoClient = (RepositoryClientImpl)repositoryClient; nuxeoClient.releaseRepositorySession(ctx, repoSession); } diff --git a/services/common/src/main/java/org/collectionspace/services/common/relation/RelationUtils.java b/services/common/src/main/java/org/collectionspace/services/common/relation/RelationUtils.java index 94110d4e5..a0a7af84b 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/relation/RelationUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/relation/RelationUtils.java @@ -15,7 +15,7 @@ import org.collectionspace.services.common.document.DocumentNotFoundException; import org.collectionspace.services.common.document.DocumentWrapper; import org.collectionspace.services.common.repository.RepositoryClient; import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; -import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl; +import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl; import org.nuxeo.ecm.core.api.ClientException; import org.nuxeo.ecm.core.api.DocumentModel; @@ -52,7 +52,7 @@ public class RelationUtils { // relations_common:subjectRefName = 'urn:cspace:core.collectionspace.org:placeauthorities:name(place):item:name(Amystan1348082103923)\'Amystan\''" String query = String.format("%s:%s = '%s'", IRelationsManager.SERVICE_COMMONPART_NAME, targetField, escapedRefName); - RepositoryJavaClientImpl nuxeoRepoClient = (RepositoryJavaClientImpl) repoClient; + RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl) repoClient; DocumentWrapper docListWrapper = nuxeoRepoClient.findDocs(ctx, repoSession, docTypes, query, orderByClause, pageSize, pageNum, computeTotal); DocumentModelList docList = docListWrapper.getWrappedObject(); diff --git a/services/common/src/main/java/org/collectionspace/services/common/repository/RepositoryClient.java b/services/common/src/main/java/org/collectionspace/services/common/repository/RepositoryClient.java index fa9cf3a53..bf6316622 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/repository/RepositoryClient.java +++ b/services/common/src/main/java/org/collectionspace/services/common/repository/RepositoryClient.java @@ -28,11 +28,11 @@ import java.util.List; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.document.DocumentException; +import org.collectionspace.services.common.document.DocumentHandler; import org.collectionspace.services.common.document.DocumentNotFoundException; import org.collectionspace.services.common.document.DocumentWrapper; import org.collectionspace.services.common.storage.StorageClient; import org.collectionspace.services.config.tenant.RepositoryDomainType; - import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; // // All of these Nuxeo specific classes should not be here. This is supposed to be @@ -155,4 +155,27 @@ public interface RepositoryClient extends StorageClient { String where, int pageSize, int pageNum, boolean computeTotal) throws DocumentNotFoundException, DocumentException; + + /** + * Reindex a single resource/document. + * + * @param ctx + * @param id + * @param handler + * @throws DocumentNotFoundException + * @throws DocumentException + */ + boolean reindex(DocumentHandler handler, String csid, String indexid) + throws DocumentNotFoundException, DocumentException; + + /** + * Reindex all resources/documents of a specified type + * + * @param ctx + * @param handler + * @throws DocumentNotFoundException + * @throws DocumentException + */ + boolean reindex(DocumentHandler handler, String indexid) + throws DocumentNotFoundException, DocumentException; } diff --git a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java index 8e907a1d1..afa8886f0 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java +++ b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityInterceptor.java @@ -32,6 +32,7 @@ import java.security.Principal; import java.util.HashMap; import java.util.Set; + //import org.jboss.resteasy.core.ResourceMethod; import org.jboss.resteasy.core.ResourceMethodInvoker; import org.jboss.resteasy.core.ServerResponse; @@ -53,6 +54,7 @@ import org.collectionspace.authentication.AuthN; import org.collectionspace.services.authorization.AuthZ; import org.collectionspace.services.authorization.CSpaceResource; import org.collectionspace.services.authorization.URIResourceImpl; +import org.collectionspace.services.client.index.IndexClient; import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.common.CSWebApplicationException; import org.collectionspace.services.common.CollectionSpaceResource; @@ -167,7 +169,7 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn } else { // // They passed the first round of security checks, so now let's check to see if they're trying - // to perform a workflow state change and make sure they are allowed to to this. + // to perform a workflow state change or fulltext reindex and make sure they are allowed to to this. // if (uriPath.contains(WorkflowClient.SERVICE_PATH) == true) { String workflowProxyResource = SecurityUtils.getWorkflowResourceName(request); @@ -179,7 +181,18 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn Response.Status.FORBIDDEN).entity(uriPath + " " + httpMethod).type("text/plain").build(); throw new CSWebApplicationException(response); } + } else if (uriPath.contains(IndexClient.SERVICE_PATH) == true) { + String indexProxyResource = SecurityUtils.getIndexResourceName(request); + res = new URIResourceImpl(AuthN.get().getCurrentTenantId(), indexProxyResource, httpMethod); + if (authZ.isAccessAllowed(res) == false) { + logger.error("Access to " + resName + ":" + res.getId() + " is NOT allowed to " + + " user=" + AuthN.get().getUserId()); + Response response = Response.status( + Response.Status.FORBIDDEN).entity(uriPath + " " + httpMethod).type("text/plain").build(); + throw new CSWebApplicationException(response); + } } + } // // Login to Nuxeo diff --git a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityUtils.java b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityUtils.java index 64ad4e5f5..42e52b11d 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityUtils.java @@ -32,6 +32,7 @@ import java.util.StringTokenizer; import org.collectionspace.services.authorization.AuthZ; import org.collectionspace.services.authorization.CSpaceResource; import org.collectionspace.services.authorization.URIResourceImpl; +import org.collectionspace.services.client.index.IndexClient; import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.config.service.ServiceBindingType; @@ -42,7 +43,6 @@ import org.collectionspace.authentication.AuthN; import org.collectionspace.authentication.spi.AuthNContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.jboss.crypto.digest.DigestCallback; import org.jboss.resteasy.spi.HttpRequest; import org.jboss.security.Base64Encoder; @@ -120,6 +120,37 @@ public class SecurityUtils { return result; } + public static String getIndexResourceName(HttpRequest request) { + String result = null; + + UriInfo uriInfo = request.getUri(); + String indexSubResName = SecurityUtils.getResourceName(uriInfo); + String resEntity = SecurityUtils.getResourceEntity(indexSubResName); + + MultivaluedMap pathParams = uriInfo.getPathParameters(); + String indexId = pathParams.getFirst(IndexClient.INDEX_ID_PARAM); + if (indexId != null && pathParams.containsKey("csid")) { + // e.g., intakes/*/index/fulltext + result = resEntity + "/*/" + IndexClient.SERVICE_NAME + "/" + indexId; + } else if (indexId != null) { + // e.g., intakes/index/fulltext + result = resEntity + IndexClient.SERVICE_NAME + "/" + indexId; + } else { + // e.g., intakes + result = resEntity; + } + + // + // Overriding the result from above. + // + // Until we build out more permissions for the index resource, + // we're just going to return the index resource name. + // + result = IndexClient.SERVICE_NAME; + + return result; + } + /** * Gets the resource name. * @@ -154,7 +185,7 @@ public class SecurityUtils { } // FIXME: REM - // Since the hjid (HyperJaxb3 generated IDs are not unique strings in URIs that also have a CSID, + // Since the hjid (HyperJaxb3 generated IDs) are not unique strings in URIs that also have a CSID, // we need to replace hjid last. We can fix this by having HyperJaxb3 generate UUID. // Assumption : path param name for csid is lowercase // diff --git a/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java index 74be6d1cd..6804ec811 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/vocabulary/RefNameServiceUtils.java @@ -68,7 +68,7 @@ import org.collectionspace.services.common.relation.RelationUtils; import org.collectionspace.services.common.repository.RepositoryClient; import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler; -import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl; +import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl; import org.collectionspace.services.common.security.SecurityUtils; import org.collectionspace.services.config.service.ServiceBindingType; import org.collectionspace.services.jaxb.AbstractCommonList; @@ -262,7 +262,7 @@ public class RefNameServiceUtils { Map queriedServiceBindings = new HashMap(); Map> authRefFieldsByService = new HashMap>(); - RepositoryJavaClientImpl nuxeoRepoClient = (RepositoryJavaClientImpl) repoClient; + RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl) repoClient; try { // Ignore any provided page size and number query parameters in // the following call, as they pertain to the list of authority @@ -419,7 +419,7 @@ public class RefNameServiceUtils { final String ORDER_BY_VALUE = CollectionSpaceClient.CORE_CREATED_AT // "collectionspace_core:createdAt"; + ", " + IQueryManager.NUXEO_UUID; // CSPACE-6333: Add secondary sort on uuid, in case records have the same createdAt timestamp. - if (repoClient instanceof RepositoryJavaClientImpl == false) { + if (repoClient instanceof RepositoryClientImpl == false) { throw new InternalError("updateAuthorityRefDocs() called with unknown repoClient type!"); } @@ -454,7 +454,7 @@ public class RefNameServiceUtils { queriedServiceBindings, authRefFieldsByService, // Perform the refName updates on the list of document models newRefName); if (nRefsFoundThisPage > 0) { - ((RepositoryJavaClientImpl) repoClient).saveDocListWithoutHandlerProcessing(ctx, repoSession, docList, true); // Flush the document model list out to Nuxeo storage + ((RepositoryClientImpl) repoClient).saveDocListWithoutHandlerProcessing(ctx, repoSession, docList, true); // Flush the document model list out to Nuxeo storage nRefsFound += nRefsFoundThisPage; } @@ -531,7 +531,7 @@ public class RefNameServiceUtils { query += " AND " + whereClauseAdditions; } // Now we have to issue the search - RepositoryJavaClientImpl nuxeoRepoClient = (RepositoryJavaClientImpl) repoClient; + RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl) repoClient; DocumentWrapper docListWrapper = nuxeoRepoClient.findDocs(ctx, repoSession, docTypes, query, orderByClause, pageSize, pageNum, computeTotal); // Now we gather the info for each document into the list and return diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CSReindexFulltextRoot.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CSReindexFulltextRoot.java new file mode 100644 index 000000000..fe2251fa5 --- /dev/null +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CSReindexFulltextRoot.java @@ -0,0 +1,60 @@ +package org.collectionspace.services.nuxeo.client.java; + +import java.io.Serializable; +import java.security.Principal; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.collectionspace.services.common.context.ServiceContext; +import org.collectionspace.services.common.document.DocumentHandler; +import org.collectionspace.services.nuxeo.util.ReindexFulltextRoot; +import org.collectionspace.services.nuxeo.util.ReindexFulltextRoot.ReindexInfo; +import org.nuxeo.ecm.core.api.IterableQueryResult; +import org.nuxeo.ecm.core.api.NuxeoException; +import org.nuxeo.ecm.core.api.NuxeoPrincipal; +import org.nuxeo.ecm.core.query.QueryFilter; +import org.nuxeo.ecm.core.query.sql.NXQL; +import org.nuxeo.ecm.core.storage.StorageException; +import org.nuxeo.runtime.transaction.TransactionHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/* + * Use the inherited reindexFulltext() method to reindex the Nuxeo full-text index. + */ +public class CSReindexFulltextRoot extends ReindexFulltextRoot { + + /** The logger. */ + private final Logger logger = LoggerFactory.getLogger(CSReindexFulltextRoot.class); + protected String repoQuery; + + public CSReindexFulltextRoot(CoreSessionInterface repoSession, String repoQuery) { + this.coreSession = repoSession.getCoreSession(); + this.repoQuery = repoQuery; + } + + + @Override + protected List getInfos() throws StorageException { + getLowLevelSession(); + List infos = new ArrayList(); +// String query = "SELECT ecm:uuid, ecm:primaryType FROM Document" +// + " WHERE ecm:isProxy = 0" +// + " AND ecm:currentLifeCycleState <> 'deleted'" +// + " ORDER BY ecm:uuid"; + IterableQueryResult it = session.queryAndFetch(this.repoQuery, NXQL.NXQL, + QueryFilter.EMPTY); + try { + for (Map map : it) { + Serializable id = map.get(NXQL.ECM_UUID); + String type = (String) map.get(NXQL.ECM_PRIMARYTYPE); + infos.add(new ReindexInfo(id, type)); + } + } finally { + it.close(); + } + return infos; + } + +} 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 d5d342499..dfce1ff4e 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 @@ -29,6 +29,7 @@ import java.util.List; import javax.ws.rs.core.MultivaluedMap; import org.apache.commons.lang.StringUtils; + import org.collectionspace.services.client.Profiler; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.IQueryManager; @@ -59,12 +60,14 @@ import org.collectionspace.services.lifecycle.StateList; import org.collectionspace.services.lifecycle.TransitionDef; import org.collectionspace.services.lifecycle.TransitionDefList; import org.collectionspace.services.lifecycle.TransitionList; + import org.nuxeo.ecm.core.NXCore; 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.model.PropertyException; import org.nuxeo.ecm.core.lifecycle.LifeCycleService; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentModelHandler.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentModelHandler.java index 830814d2e..a3e93d035 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentModelHandler.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentModelHandler.java @@ -182,7 +182,7 @@ public abstract class NuxeoDocumentModelHandler extends RemoteDocumentModelHa CommonList commonList = new CommonList(); String markRtSbj = null; CoreSessionInterface repoSession = null; - RepositoryJavaClientImpl repoClient = null; + RepositoryClientImpl repoClient = null; boolean releaseRepoSession = false; AbstractServiceContextImpl ctx = (AbstractServiceContextImpl) getServiceContext(); @@ -193,8 +193,8 @@ public abstract class NuxeoDocumentModelHandler extends RemoteDocumentModelHa try { if (markRtSbj != null) { - repoClient = (RepositoryJavaClientImpl) this.getRepositoryClient(ctx); - RepositoryJavaClientImpl nuxeoRepoClient = (RepositoryJavaClientImpl) repoClient; + repoClient = (RepositoryClientImpl) this.getRepositoryClient(ctx); + RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl) repoClient; repoSession = this.getRepositorySession(); if (repoSession == null) { repoSession = repoClient.getRepositorySession(ctx); 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 6f81c24a6..83de91744 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 @@ -547,7 +547,7 @@ public abstract class RemoteDocumentModelHandlerImpl String returnValue = null; try{ - RepositoryJavaClientImpl repoClient = (RepositoryJavaClientImpl)this.getRepositoryClient(ctx); + RepositoryClientImpl repoClient = (RepositoryClientImpl)this.getRepositoryClient(ctx); repoSession = this.getRepositorySession(); if (repoSession == null) { repoSession = repoClient.getRepositorySession(); @@ -619,7 +619,7 @@ public abstract class RemoteDocumentModelHandlerImpl boolean releaseRepoSession = false; ServiceContext ctx = this.getServiceContext(); - RepositoryJavaClientImpl repoClient = (RepositoryJavaClientImpl)this.getRepositoryClient(ctx); + RepositoryClientImpl repoClient = (RepositoryClientImpl)this.getRepositoryClient(ctx); CoreSessionInterface repoSession = this.getRepositorySession(); if (repoSession == null) { repoSession = repoClient.getRepositorySession(ctx); 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/RepositoryClientImpl.java similarity index 98% rename from services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java rename to services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryClientImpl.java index 33246138f..2ca71a3cf 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/RepositoryClientImpl.java @@ -71,7 +71,6 @@ import org.apache.chemistry.opencmis.commons.enums.CmisVersion; import org.apache.chemistry.opencmis.commons.server.CallContext; import org.apache.chemistry.opencmis.server.impl.CallContextImpl; import org.apache.chemistry.opencmis.server.shared.ThresholdOutputStreamFactory; - import org.nuxeo.common.utils.IdUtils; import org.nuxeo.ecm.core.api.ClientException; import org.nuxeo.ecm.core.api.DocumentModel; @@ -85,24 +84,23 @@ import org.nuxeo.ecm.core.api.PathRef; import org.nuxeo.runtime.transaction.TransactionRuntimeException; import org.nuxeo.ecm.core.opencmis.bindings.NuxeoCmisServiceFactory; import org.nuxeo.ecm.core.opencmis.impl.server.NuxeoCmisService; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * RepositoryJavaClient is used to perform CRUD operations on documents in Nuxeo + * RepositoryClientImpl is used to perform CRUD operations on documents in Nuxeo * repository using Remote Java APIs. It uses * * @see DocumentHandler as IOHandler with the client. * * $LastChangedRevision: $ $LastChangedDate: $ */ -public class RepositoryJavaClientImpl implements RepositoryClient { +public class RepositoryClientImpl implements RepositoryClient { /** * The logger. */ - private final Logger logger = LoggerFactory.getLogger(RepositoryJavaClientImpl.class); + private final Logger logger = LoggerFactory.getLogger(RepositoryClientImpl.class); // private final Logger profilerLogger = LoggerFactory.getLogger("remperf"); // private String foo = Profiler.createLogger(); public static final String NUXEO_CORE_TYPE_DOMAIN = "Domain"; @@ -120,7 +118,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient ctx = handler.getServiceContext(); + return result; + } + + @Override + public boolean reindex(DocumentHandler handler, String indexid) throws DocumentNotFoundException, DocumentException + { + boolean result = true; + CoreSessionInterface repoSession = null; + ServiceContext ctx = handler.getServiceContext(); + + try { + repoSession = getRepositorySession(ctx); + try { + } catch (ClientException ce) { + } + // + // Set repository session to handle the document + // + } catch (Exception e) { + if (logger.isDebugEnabled()) { + logger.debug("Caught exception ", e); + } + throw new NuxeoDocumentException(e); + } finally { + if (repoSession != null) { + releaseRepositorySession(ctx, repoSession); + } + } + + return result; + } + /** * get document from the Nuxeo repository * @@ -963,7 +999,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient infos = getInfos(); + int size = infos.size(); + int numBatches = (size + batchSize - 1) / batchSize; + if (batch < 0 || batch > numBatches) { + batch = 0; // all + } + batch--; + + log("Reindexing of %s documents, batch size: %s, number of batches: %s", + size, batchSize, numBatches); + if (batch >= 0) { + log("Reindexing limited to batch: %s", batch + 1); + } + + boolean tx = TransactionHelper.isTransactionActive(); + if (tx) { + TransactionHelper.commitOrRollbackTransaction(); + } + + int n = 0; + int errs = 0; + for (int i = 0; i < numBatches; i++) { + if (batch >= 0 && batch != i) { + continue; + } + int pos = i * batchSize; + int end = pos + batchSize; + if (end > size) { + end = size; + } + List batchInfos = infos.subList(pos, end); + log("Reindexing batch %s/%s, first id: %s", i + 1, numBatches, + batchInfos.get(0).id); + try { + doBatch(batchInfos); + } catch (NuxeoException e) { + log.error("Error processing batch " + i + 1, e); + errs++; + } + n += end - pos; + } + + log("Reindexing done"); + if (tx) { + TransactionHelper.startTransaction(); + } + return "done: " + n + " total: " + size + " batch_errors: " + errs; + } + + protected void log(String format, Object... args) { + log.warn(String.format(format, args)); + } + + /** + * This has to be called once the transaction has been started. + * @throws StorageException + */ + protected void getLowLevelSession() throws StorageException { + try { + SQLSession s = (SQLSession) ((AbstractSession) coreSession).getSession(); + Field f2 = SQLSession.class.getDeclaredField("session"); + f2.setAccessible(true); + session = (Session) f2.get(s); + fulltextConfiguration = session.getModel().getFulltextConfiguration(); + } catch (ReflectiveOperationException e) { + throw new NuxeoException(e); + } + } + + protected List getInfos() throws StorageException { + getLowLevelSession(); + List infos = new ArrayList(); + String query = "SELECT ecm:uuid, ecm:primaryType FROM Document" + + " WHERE ecm:isProxy = 0" + + " AND ecm:currentLifeCycleState <> 'deleted'" + + " ORDER BY ecm:uuid"; + IterableQueryResult it = session.queryAndFetch(query, NXQL.NXQL, + QueryFilter.EMPTY); + try { + for (Map map : it) { + Serializable id = map.get(NXQL.ECM_UUID); + String type = (String) map.get(NXQL.ECM_PRIMARYTYPE); + infos.add(new ReindexInfo(id, type)); + } + } finally { + it.close(); + } + return infos; + } + + protected void doBatch(List infos) throws StorageException { + boolean tx; + boolean ok; + + // transaction for the sync batch + tx = TransactionHelper.startTransaction(); + + getLowLevelSession(); // for fulltextInfo + List ids = new ArrayList(infos.size()); + Set asyncIds = new HashSet(); + Model model = session.getModel(); + for (ReindexInfo info : infos) { + ids.add(info.id); + if (fulltextConfiguration.isFulltextIndexable(info.type)) { + asyncIds.add(model.idToString(info.id)); + } + } + ok = false; + try { + runSyncBatch(ids, asyncIds); + ok = true; + } finally { + if (tx) { + if (!ok) { + TransactionHelper.setTransactionRollbackOnly(); + log.error("Rolling back sync"); + } + TransactionHelper.commitOrRollbackTransaction(); + } + } + + runAsyncBatch(asyncIds); + + // wait for async completion after transaction commit + Framework.getLocalService(EventService.class).waitForAsyncCompletion(); + } + + /* + * Do this at the low-level session level because we may have to modify + * things like versions which aren't usually modifiable, and it's also good + * to bypass all listeners. + */ + protected void runSyncBatch(List ids, Set asyncIds) throws StorageException { + getLowLevelSession(); + + session.getNodesByIds(ids); // batch fetch + + Map titles = new HashMap(); + for (Serializable id : ids) { + Node node = session.getNodeById(id); + if (asyncIds.contains(id)) { + node.setSimpleProperty(Model.FULLTEXT_JOBID_PROP, id); + } + SimpleProperty prop; + try { + prop = node.getSimpleProperty(DC_TITLE); + } catch (IllegalArgumentException e) { + continue; + } + String title = (String) prop.getValue(); + titles.put(id, title); + prop.setValue(title + " "); + } + session.save(); + + for (Serializable id : ids) { + Node node = session.getNodeById(id); + SimpleProperty prop; + try { + prop = node.getSimpleProperty(DC_TITLE); + } catch (IllegalArgumentException e) { + continue; + } + prop.setValue(titles.get(id)); + } + session.save(); + } + + protected void runAsyncBatch(Set asyncIds) + { + if (asyncIds.isEmpty()) { + return; + } + String repositoryName = coreSession.getRepositoryName(); + WorkManager workManager = Framework.getLocalService(WorkManager.class); + for (String id : asyncIds) { + Work work = new SQLFulltextExtractorWork(repositoryName, id); + // schedule immediately, we're outside a transaction + workManager.schedule(work, Scheduling.IF_NOT_SCHEDULED, false); + } + } + +} diff --git a/services/index/3rdparty/build.xml b/services/index/3rdparty/build.xml new file mode 100644 index 000000000..99de72c33 --- /dev/null +++ b/services/index/3rdparty/build.xml @@ -0,0 +1,127 @@ + + + + Index service to manage repository indexes. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/index/3rdparty/nuxeo-platform-cs-index/build.xml b/services/index/3rdparty/nuxeo-platform-cs-index/build.xml new file mode 100644 index 000000000..1b5efb651 --- /dev/null +++ b/services/index/3rdparty/nuxeo-platform-cs-index/build.xml @@ -0,0 +1,138 @@ + + + index nuxeo document type + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/index/3rdparty/nuxeo-platform-cs-index/pom.xml b/services/index/3rdparty/nuxeo-platform-cs-index/pom.xml new file mode 100644 index 000000000..aa5772344 --- /dev/null +++ b/services/index/3rdparty/nuxeo-platform-cs-index/pom.xml @@ -0,0 +1,42 @@ + + 4.0.0 + + org.collectionspace.services + org.collectionspace.services.index.3rdparty + 4.4-SNAPSHOT + + + org.collectionspace.services.index.3rdparty.nuxeo + services.index.3rdparty.nuxeo + jar + + Index Nuxeo Document Type + + + + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-jar-plugin + + + src/main/resources/META-INF/MANIFEST.MF + + ${eclipseVersion} + 2 + + + + + + + + diff --git a/services/index/3rdparty/nuxeo-platform-cs-index/src/main/resources/META-INF/MANIFEST.MF b/services/index/3rdparty/nuxeo-platform-cs-index/src/main/resources/META-INF/MANIFEST.MF new file mode 100644 index 000000000..5085172a6 --- /dev/null +++ b/services/index/3rdparty/nuxeo-platform-cs-index/src/main/resources/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 1 +Bundle-Name: NuxeoCS +Bundle-SymbolicName: org.collectionspace.index;singleton:=true +Bundle-Version: 1.0.0 +Bundle-Localization: plugin +Bundle-Vendor: Nuxeo +Require-Bundle: org.nuxeo.runtime, + org.nuxeo.ecm.core.api, + org.nuxeo.ecm.core, + org.nuxeo.ecm.core.api, + org.nuxeo.ecm.platform.types.api, + org.nuxeo.ecm.platform.versioning.api, + org.nuxeo.ecm.platform.ui, + org.nuxeo.ecm.platform.forms.layout.client, + org.nuxeo.ecm.platform.ws, + org.collectionspace.collectionspace_core +Provide-Package: org.collectionspace.index +Nuxeo-Component: OSGI-INF/core-types-contrib.xml + diff --git a/services/index/3rdparty/nuxeo-platform-cs-index/src/main/resources/OSGI-INF/core-types-contrib.xml b/services/index/3rdparty/nuxeo-platform-cs-index/src/main/resources/OSGI-INF/core-types-contrib.xml new file mode 100644 index 000000000..0e8f68559 --- /dev/null +++ b/services/index/3rdparty/nuxeo-platform-cs-index/src/main/resources/OSGI-INF/core-types-contrib.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/services/index/3rdparty/nuxeo-platform-cs-index/src/main/resources/OSGI-INF/deployment-fragment.xml b/services/index/3rdparty/nuxeo-platform-cs-index/src/main/resources/OSGI-INF/deployment-fragment.xml new file mode 100644 index 000000000..1d37c1b32 --- /dev/null +++ b/services/index/3rdparty/nuxeo-platform-cs-index/src/main/resources/OSGI-INF/deployment-fragment.xml @@ -0,0 +1,10 @@ + + + + + + ${bundle.fileName} + + + + \ No newline at end of file diff --git a/services/index/3rdparty/nuxeo-platform-cs-index/src/main/resources/schemas/item_common.xsd b/services/index/3rdparty/nuxeo-platform-cs-index/src/main/resources/schemas/item_common.xsd new file mode 100644 index 000000000..f8f0a563d --- /dev/null +++ b/services/index/3rdparty/nuxeo-platform-cs-index/src/main/resources/schemas/item_common.xsd @@ -0,0 +1,22 @@ + + + + + + + + diff --git a/services/index/3rdparty/pom.xml b/services/index/3rdparty/pom.xml new file mode 100644 index 000000000..909842305 --- /dev/null +++ b/services/index/3rdparty/pom.xml @@ -0,0 +1,22 @@ + + + org.collectionspace.services.index + org.collectionspace.services + 4.4-SNAPSHOT + + + 4.0.0 + org.collectionspace.services.index.3rdparty + services.index.3rdparty + pom + + + 3rd party build for index service + + + + nuxeo-platform-cs-index + + diff --git a/services/index/build.xml b/services/index/build.xml new file mode 100644 index 000000000..cd78c9847 --- /dev/null +++ b/services/index/build.xml @@ -0,0 +1,123 @@ + + + + index service + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/index/client/pom.xml b/services/index/client/pom.xml new file mode 100644 index 000000000..6d167c4c8 --- /dev/null +++ b/services/index/client/pom.xml @@ -0,0 +1,81 @@ + + + + org.collectionspace.services + org.collectionspace.services.index + 4.4-SNAPSHOT + + + 4.0.0 + org.collectionspace.services.index.client + services.index.client + + + + + org.slf4j + slf4j-api + test + + + org.slf4j + slf4j-log4j12 + test + + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.common + true + + + org.collectionspace.services + org.collectionspace.services.client + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.dimension.client + ${project.version} + + + + org.testng + testng + + + org.jboss.resteasy + resteasy-jaxrs + + + + tjws + webserver + + + + + org.jboss.resteasy + resteasy-jaxb-provider + + + org.jboss.resteasy + resteasy-multipart-provider + + + commons-httpclient + commons-httpclient + + + + + collectionspace-services-index-client + + diff --git a/services/index/client/src/test/java/org/collectionspace/services/client/test/IndexServiceTest.java b/services/index/client/src/test/java/org/collectionspace/services/client/test/IndexServiceTest.java new file mode 100644 index 000000000..98b5a62d5 --- /dev/null +++ b/services/index/client/src/test/java/org/collectionspace/services/client/test/IndexServiceTest.java @@ -0,0 +1,202 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + * + * http://www.collectionspace.org + * http://wiki.collectionspace.org + * + * Copyright © 2009 Regents of the University of California + * + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + * + * You may obtain a copy of the ECL 2.0 License at + * https://source.collectionspace.org/collection-space/LICENSE.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.client.test; + +import javax.ws.rs.core.Response; + +import org.collectionspace.services.client.CollectionSpaceClient; +import org.collectionspace.services.client.PayloadOutputPart; +import org.collectionspace.services.client.PoxPayloadIn; +import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.collectionspace.services.index.IndexCommon; +import org.collectionspace.services.client.DimensionClient; +import org.collectionspace.services.client.index.IndexClient; +import org.collectionspace.services.dimension.DimensionsCommon; +import org.jboss.resteasy.client.ClientResponse; +import org.testng.Assert; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * ObjectExitServiceTest, carries out tests against a deployed and running ObjectExit Service.

+ * $LastChangedRevision: $ + * $LastChangedDate: $ + */ +public class IndexServiceTest extends AbstractPoxServiceTestImpl { + + private final String CLASS_NAME = IndexServiceTest.class.getName(); + private final Logger logger = LoggerFactory.getLogger(CLASS_NAME); + private String knownResourceId = null; + + @Override + public String getServicePathComponent() { + return IndexClient.SERVICE_PATH_COMPONENT; + } + + @Override + protected String getServiceName() { + return IndexClient.SERVICE_NAME; + } + + @Override + protected CollectionSpaceClient getClientInstance() { + return new DimensionClient(); + } + + // + // Test overrides + // + + @Override + public void create(String testName) throws Exception { + String csid = this.createTestObject(testName); + if (this.knownResourceId == null) { + this.knownResourceId = csid; + } + } + + @Override + public void read(String testName) throws Exception { +// setupRead(); +// DimensionClient client = new DimensionClient(); +// Response res = client.getIndex(knownResourceId); +// try { +// assertStatusCode(res, testName); +// PoxPayloadIn input = new PoxPayloadIn(res.readEntity(String.class)); +// IndexCommon indexsCommon = (IndexCommon) extractPart(input, IndexClient.SERVICE_COMMONPART_NAME, IndexCommon.class); +// if (logger.isDebugEnabled() == true) { +// logger.debug("Index payload is: " + input.getXmlPayload()); +// } +// Assert.assertNotNull(indexsCommon); +// } finally { +// if (res != null) { +// res.close(); +// } +// } + } + + // + // FIXME: REM - This test should be a subclass of BaseServiceTest and *not* AbstractPoxServiceTestImpl + // + + @Override + public void update(String testName) throws Exception { + setupUpdate(); + } + + @Override + public void delete(String testName) throws Exception { + // Do nothing. N/A + } + + public void searchIndexDeleted(String testName) throws Exception { + // Do nothing. N/A + } + + @Override + public void readList(String testName) throws Exception { + // Do nothing. N/A + } + + @Override + public void readPaginatedList(String testName) throws Exception { + // Do nothing. N/A + } + + @Override + public void CRUDTests(String testName) { + // TODO Auto-generated method stub + } + + @Override + protected IndexCommon updateInstance(IndexCommon commonPartObject) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected void compareUpdatedInstances(IndexCommon original, + IndexCommon updated) throws Exception { + // TODO Auto-generated method stub + + } + + /* + * (non-Javadoc) + * @see org.collectionspace.services.client.test.AbstractServiceTestImpl#createList(java.lang.String) + */ + @Override + public void createList(String testName) throws Exception { + //empty N/A + } + + public void testSubmitRequest() { + // Do nothing. N/A + } + + // --------------------------------------------------------------- + // Utility methods used by tests above + // --------------------------------------------------------------- + + @Override + protected PoxPayloadOut createInstance(String identifier) { + String dimensionsCommonPartName = new DimensionClient().getCommonPartName(); + return createInstance(identifier, dimensionsCommonPartName); + } + + @Override + protected PoxPayloadOut createInstance(String commonPartName, + String identifier) { + return createDimensionInstance(commonPartName, identifier); + } + + /* + * We're using a DimensionsCommon instance to test the index service. + */ + private PoxPayloadOut createDimensionInstance(String dimensionValue) { + String commonPartName = new DimensionClient().getCommonPartName(); + return createDimensionInstance(commonPartName, dimensionValue); + } + + /* + * We're using a DimensionsCommon instance to test the index service. + */ + private PoxPayloadOut createDimensionInstance(String commonPartName, + String dimensionValue) { + String measurementUnit = "measurementUnit-" + dimensionValue; + DimensionsCommon dimensionsCommon = new DimensionsCommon(); + + dimensionsCommon.setMeasurementUnit(measurementUnit); + PoxPayloadOut multipart = new PoxPayloadOut(DimensionClient.SERVICE_PAYLOAD_NAME); + PayloadOutputPart commonPart = multipart.addPart(commonPartName, dimensionsCommon); + + if (logger.isDebugEnabled()) { + logger.debug("To be created, Dimensions common: " + commonPart.asXML()); + logger.debug(objectAsXmlString(dimensionsCommon, DimensionsCommon.class)); + } + + return multipart; + } + +} diff --git a/services/index/client/src/test/resources/log4j.properties b/services/index/client/src/test/resources/log4j.properties new file mode 100644 index 000000000..148a3e865 --- /dev/null +++ b/services/index/client/src/test/resources/log4j.properties @@ -0,0 +1,23 @@ +log4j.rootLogger=debug, stdout, R + +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout + +# Pattern to output the caller's file name and line number. +log4j.appender.stdout.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n + +log4j.appender.R=org.apache.log4j.RollingFileAppender +log4j.appender.R.File=target/test-client.log + +log4j.appender.R.MaxFileSize=100KB +# Keep one backup file +log4j.appender.R.MaxBackupIndex=1 + +log4j.appender.R.layout=org.apache.log4j.PatternLayout +log4j.appender.R.layout.ConversionPattern=%d %-5p [%t] [%c:%L] %m%n + +#packages +log4j.logger.org.collectionspace=DEBUG +log4j.logger.org.apache=INFO +log4j.logger.httpclient=INFO +log4j.logger.org.jboss.resteasy=INFO diff --git a/services/index/jaxb/pom.xml b/services/index/jaxb/pom.xml new file mode 100644 index 000000000..c62d31501 --- /dev/null +++ b/services/index/jaxb/pom.xml @@ -0,0 +1,35 @@ + + + + org.collectionspace.services.index + org.collectionspace.services + 4.4-SNAPSHOT + + + 4.0.0 + org.collectionspace.services + org.collectionspace.services.index.jaxb + services.index.jaxb + + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + + + collectionspace-services-index-jaxb + install + + + org.jvnet.jaxb2.maven2 + maven-jaxb2-plugin + + + + + diff --git a/services/index/pom.xml b/services/index/pom.xml new file mode 100644 index 000000000..da22a260a --- /dev/null +++ b/services/index/pom.xml @@ -0,0 +1,22 @@ + + + + + org.collectionspace.services + org.collectionspace.services.main + 4.4-SNAPSHOT + + + 4.0.0 + org.collectionspace.services.index + services.index + pom + + + 3rdparty + client + service + + + + diff --git a/services/index/service/pom.xml b/services/index/service/pom.xml new file mode 100644 index 000000000..2134dcdbc --- /dev/null +++ b/services/index/service/pom.xml @@ -0,0 +1,91 @@ + + + + + org.collectionspace.services + org.collectionspace.services.index + 4.4-SNAPSHOT + + + 4.0.0 + org.collectionspace.services.index.service + services.index.service + jar + + + + org.collectionspace.services + org.collectionspace.services.common + + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + + + junit + junit + test + + + org.testng + testng + + + + + + javax.security + jaas + 1.0.01 + provided + + + + dom4j + dom4j + 1.6.1 + provided + + + + + + org.jboss.resteasy + resteasy-jaxrs + + + tjws + webserver + + + + + org.jboss.resteasy + resteasy-jaxb-provider + + + org.jboss.resteasy + resteasy-multipart-provider + + + + + + org.nuxeo.ecm.core + nuxeo-core-api + + + jboss-remoting + jboss + + + + + + + collectionspace-services-index + + + diff --git a/services/index/service/src/main/java/org/collectionspace/services/index/IndexResource.java b/services/index/service/src/main/java/org/collectionspace/services/index/IndexResource.java new file mode 100644 index 000000000..8fad7f3ce --- /dev/null +++ b/services/index/service/src/main/java/org/collectionspace/services/index/IndexResource.java @@ -0,0 +1,108 @@ +/** + * This document is a part of the source code and related artifacts + * for CollectionSpace, an open source collections management system + * for museums and related institutions: + + * http://www.collectionspace.org + * http://wiki.collectionspace.org + + * Copyright 2009 University of California at Berkeley + + * Licensed under the Educational Community License (ECL), Version 2.0. + * You may not use this file except in compliance with this License. + + * You may obtain a copy of the ECL 2.0 License at + + * https://source.collectionspace.org/collection-space/LICENSE.txt + + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.collectionspace.services.index; + +import org.collectionspace.services.client.index.IndexClient; +import org.collectionspace.services.common.CSWebApplicationException; +import org.collectionspace.services.common.NuxeoBasedResource; +import org.collectionspace.services.common.ResourceMap; +import org.collectionspace.services.common.ServiceMessages; +import org.collectionspace.services.jaxb.AbstractCommonList; + +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriInfo; + +@Path(IndexClient.SERVICE_PATH) +@Produces({"application/xml"}) +@Consumes({"application/xml"}) +public class IndexResource extends NuxeoBasedResource { + + @Override + public String getServiceName(){ + return IndexClient.SERVICE_NAME; + } + + @Override + protected String getVersionString() { + final String lastChangeRevision = "$LastChangedRevision: 2108 $"; + return lastChangeRevision; + } + + @Override + //public Class getCommonPartClass() { + public Class getCommonPartClass() { + try { + return Class.forName("org.collectionspace.services.objectexit.IndexCommon");//.class; + } catch (ClassNotFoundException e){ + return null; + } + } + + /* + * HTTP Methods + */ + + @Override + @POST + public Response create(@Context ResourceMap resourceMap, @Context UriInfo ui, String xmlPayload) { + Response response = Response.status(Response.Status.BAD_REQUEST) + .entity(ServiceMessages.POST_UNSUPPORTED).type("text/plain").build(); + return response; + } + + @Override + @DELETE + @Path("{csid}") + public Response delete(@PathParam("csid") String csid) { + Response response = Response.status(Response.Status.BAD_REQUEST) + .entity(ServiceMessages.DELETE_UNSUPPORTED).type("text/plain") + .build(); + return response; + } + + + /* (non-Javadoc) + * @see org.collectionspace.services.common.ResourceBase#getList(javax.ws.rs.core.UriInfo, java.lang.String) + * + * The index sub-resource does not support a getList operation. + */ + @Override + @GET + public AbstractCommonList getList(@Context UriInfo ui) { + Response response = Response.status(Response.Status.BAD_REQUEST) + .entity(ServiceMessages.GET_LIST_UNSUPPORTED).type("text/plain") + .build(); + throw new CSWebApplicationException(response); + } + +} diff --git a/services/index/service/src/main/java/org/collectionspace/services/index/nuxeo/IndexValidatorHandler.java b/services/index/service/src/main/java/org/collectionspace/services/index/nuxeo/IndexValidatorHandler.java new file mode 100644 index 000000000..4c378e763 --- /dev/null +++ b/services/index/service/src/main/java/org/collectionspace/services/index/nuxeo/IndexValidatorHandler.java @@ -0,0 +1,63 @@ +package org.collectionspace.services.index.nuxeo; + +import org.collectionspace.services.client.PoxPayloadIn; +import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.common.document.InvalidDocumentException; +import org.collectionspace.services.common.document.ValidatorHandlerImpl; +import org.collectionspace.services.index.IndexCommon; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class IndexValidatorHandler extends ValidatorHandlerImpl { + + /** The logger. */ + private final Logger logger = LoggerFactory.getLogger(IndexValidatorHandler.class); + + /** Error Messages **/ + private static final String VALIDATION_ERROR = "The intake record payload was invalid. See log file for more details."; + + + @Override + protected Class getCommonPartClass() { + return IndexCommon.class; + } + + @Override + protected void handleCreate() throws InvalidDocumentException { + try { + IndexCommon intakesCommon = (IndexCommon)getCommonPart(); + assert(intakesCommon != null); + } catch (AssertionError e) { + if (logger.isErrorEnabled() == true) { + logger.error(e.getMessage(), e); + } + throw new InvalidDocumentException(VALIDATION_ERROR, e); + } + } + + @Override + protected void handleGet() throws InvalidDocumentException { + // TODO Auto-generated method stub + + } + + @Override + protected void handleGetAll() throws InvalidDocumentException { + // TODO Auto-generated method stub + + } + + @Override + protected void handleUpdate() throws InvalidDocumentException { + // TODO Auto-generated method stub + + } + + @Override + protected void handleDelete() throws InvalidDocumentException { + // TODO Auto-generated method stub + + } + +} diff --git a/services/index/service/src/test/java/org/collectionspace/services/test/IndexServiceTest.java b/services/index/service/src/test/java/org/collectionspace/services/test/IndexServiceTest.java new file mode 100644 index 000000000..aac5563dd --- /dev/null +++ b/services/index/service/src/test/java/org/collectionspace/services/test/IndexServiceTest.java @@ -0,0 +1,10 @@ +package org.collectionspace.services.test; + +/** + * Placeholder for server-side testing of Index service code. + * + * @version $Revision: 2108 $ + */ +public class IndexServiceTest { + //empty +} diff --git a/services/index/service/src/test/resources/log4j.xml b/services/index/service/src/test/resources/log4j.xml new file mode 100644 index 000000000..52121cb83 --- /dev/null +++ b/services/index/service/src/test/resources/log4j.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/services/jaxb/src/main/resources/index_common.xsd b/services/jaxb/src/main/resources/index_common.xsd new file mode 100644 index 000000000..981ea41bd --- /dev/null +++ b/services/jaxb/src/main/resources/index_common.xsd @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + diff --git a/services/pom.xml b/services/pom.xml index 50d13d1b7..9a1aae918 100644 --- a/services/pom.xml +++ b/services/pom.xml @@ -80,6 +80,7 @@ dimension contact workflow + index media publicitem 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 def69bf10..b76e574b0 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 @@ -52,7 +52,7 @@ import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.config.service.ServiceBindingType; import org.collectionspace.services.nuxeo.client.java.RemoteDocumentModelHandlerImpl; import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; -import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl; +import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl; import org.nuxeo.ecm.core.api.ClientException; import org.nuxeo.ecm.core.api.DocumentModel; @@ -387,7 +387,7 @@ public class RelationDocumentModelHandler // provided as an alternate identifier. } if (Tools.notBlank(csid)) { - RepositoryJavaClientImpl nuxeoRepoClient = (RepositoryJavaClientImpl)getRepositoryClient(ctx); + RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl)getRepositoryClient(ctx); DocumentWrapper docWrapper = nuxeoRepoClient.getDocFromCsid(ctx, repoSession, csid); docModel = docWrapper.getWrappedObject(); } else { // if (Tools.isBlank(objectCsid)) { diff --git a/services/report/service/src/main/java/org/collectionspace/services/report/nuxeo/ReportDocumentModelHandler.java b/services/report/service/src/main/java/org/collectionspace/services/report/nuxeo/ReportDocumentModelHandler.java index fd3331455..f320340d9 100644 --- a/services/report/service/src/main/java/org/collectionspace/services/report/nuxeo/ReportDocumentModelHandler.java +++ b/services/report/service/src/main/java/org/collectionspace/services/report/nuxeo/ReportDocumentModelHandler.java @@ -75,7 +75,7 @@ import org.collectionspace.services.common.storage.JDBCTools; import org.collectionspace.services.jaxb.InvocableJAXBSchema; import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler; import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; -import org.collectionspace.services.nuxeo.client.java.RepositoryJavaClientImpl; +import org.collectionspace.services.nuxeo.client.java.RepositoryClientImpl; import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.jfree.util.Log; import org.nuxeo.ecm.core.api.DocumentModel; @@ -152,7 +152,7 @@ public class ReportDocumentModelHandler extends NuxeoDocumentModelHandler queriedServiceBindings = new HashMap(); - RepositoryJavaClientImpl nuxeoRepoClient = (RepositoryJavaClientImpl)repoClient; + RepositoryClientImpl nuxeoRepoClient = (RepositoryClientImpl)repoClient; // Get the service bindings for this tenant TenantBindingConfigReaderImpl tReader = ServiceMain.getInstance().getTenantBindingConfigReader();