From 39e47f968b6ec70fcfc3a432bb9335d00a0488b6 Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Tue, 24 Mar 2026 10:59:59 -0600 Subject: [PATCH 01/40] Bump 9.0.0-SNAPSHOT (#515) --- build.properties | 2 +- pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index dd3cfed77e..0ba5a75810 100644 --- a/build.properties +++ b/build.properties @@ -9,7 +9,7 @@ host=127.0.0.1 # # Release version info # -release.version=8.3.0 +release.version=9.0.0-SNAPSHOT cspace.release=${release.version} cspace.instance.id=${env.CSPACE_INSTANCE_ID} diff --git a/pom.xml b/pom.xml index 1f1cab8038..8802895a20 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ services - 8.3.0 + 9.0.0-SNAPSHOT UTF-8 ${revision} ${revision} From fd9b82663ee75519690a737859cb4f5d3fcde297 Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Thu, 23 Apr 2026 16:58:27 -0600 Subject: [PATCH 02/40] DRYD-2094: Replace ClientResponse with Response (#528) * Remove usage of ClientResponse * Update antrun plugin config to get AccountClientTest to run --- services/account/client/pom.xml | 18 +++++------------- .../client/CitationAuthorityClientUtils.java | 1 - .../services/client/ClaimProxy.java | 11 +++++------ .../CollectionSpaceCommonListPoxProxy.java | 1 - .../client/CollectionSpacePoxClient.java | 1 - .../client/AuthorityWithContactsClient.java | 3 --- .../client/AuthorityWithContactsProxy.java | 3 --- .../client/OrgAuthorityClientUtils.java | 1 - .../client/PlaceAuthorityClientUtils.java | 1 - .../client/TaxonomyAuthorityClientUtils.java | 1 - .../client/WorkAuthorityClientUtils.java | 2 -- .../client/test/WorkflowServiceTest.java | 1 - 12 files changed, 10 insertions(+), 34 deletions(-) diff --git a/services/account/client/pom.xml b/services/account/client/pom.xml index 8f5fb3ba0d..148b6c9c29 100644 --- a/services/account/client/pom.xml +++ b/services/account/client/pom.xml @@ -76,34 +76,26 @@ cspace-services-account-client + org.apache.maven.plugins maven-antrun-plugin + 3.1.0 subs-hibernate-config - generate-test-resources + process-test-resources run - + - + - - ../../../build.properties - - - - src/main/resources - true - - - diff --git a/services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityClientUtils.java b/services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityClientUtils.java index 64271a0695..37b10dbbc0 100644 --- a/services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityClientUtils.java +++ b/services/citation/client/src/main/java/org/collectionspace/services/client/CitationAuthorityClientUtils.java @@ -22,7 +22,6 @@ import org.collectionspace.services.common.api.Tools; import org.dom4j.DocumentException; -import org.jboss.resteasy.client.ClientResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/services/claim/client/src/main/java/org/collectionspace/services/client/ClaimProxy.java b/services/claim/client/src/main/java/org/collectionspace/services/client/ClaimProxy.java index 3360375412..dc48b0de50 100644 --- a/services/claim/client/src/main/java/org/collectionspace/services/client/ClaimProxy.java +++ b/services/claim/client/src/main/java/org/collectionspace/services/client/ClaimProxy.java @@ -24,15 +24,14 @@ package org.collectionspace.services.client; -import org.jboss.resteasy.client.ClientResponse; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Response; import org.collectionspace.services.client.workflow.WorkflowClient; -import org.collectionspace.services.jaxb.AbstractCommonList; /** * ClaimProxy.java @@ -48,25 +47,25 @@ public interface ClaimProxy extends CollectionSpaceCommonListPoxProxy { // Sorted list @GET @Produces({"application/xml"}) - ClientResponse readListSortedBy( + Response readListSortedBy( @QueryParam(IClientQueryParams.ORDER_BY_PARAM) String sortFieldName); @Override @GET @Produces({"application/xml"}) - ClientResponse readIncludeDeleted( + Response readIncludeDeleted( @QueryParam(WorkflowClient.WORKFLOW_QUERY_DELETED_QP) String includeDeleted); @Override @GET @Produces({"application/xml"}) - ClientResponse keywordSearchIncludeDeleted( + Response keywordSearchIncludeDeleted( @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, @QueryParam(WorkflowClient.WORKFLOW_QUERY_DELETED_QP) String includeDeleted); @GET @Produces({"application/xml"}) - ClientResponse keywordSearchSortedBy( + Response keywordSearchSortedBy( @QueryParam(IQueryManager.SEARCH_TYPE_KEYWORDS_KW) String keywords, @QueryParam(IClientQueryParams.ORDER_BY_PARAM) String sortFieldName); } diff --git a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceCommonListPoxProxy.java b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceCommonListPoxProxy.java index 0a0b3e91a6..548e94dd08 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceCommonListPoxProxy.java +++ b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceCommonListPoxProxy.java @@ -7,7 +7,6 @@ import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.jaxb.AbstractCommonList; -import org.jboss.resteasy.client.ClientResponse; public interface CollectionSpaceCommonListPoxProxy extends CollectionSpacePoxProxy { @GET diff --git a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxClient.java b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxClient.java index c3d3223cba..ca19ba67c3 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxClient.java +++ b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpacePoxClient.java @@ -3,7 +3,6 @@ import javax.ws.rs.core.Response; import org.collectionspace.services.jaxb.AbstractCommonList; -//import org.jboss.resteasy.client.ClientResponse; /* * = List type diff --git a/services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsClient.java b/services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsClient.java index 1c36c35605..a47224af30 100644 --- a/services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsClient.java +++ b/services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsClient.java @@ -2,9 +2,6 @@ import javax.ws.rs.core.Response; -import org.collectionspace.services.jaxb.AbstractCommonList; -import org.jboss.resteasy.client.ClientResponse; - /* * LT - List type * ILT - Authority item list type diff --git a/services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsProxy.java b/services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsProxy.java index 89db736db4..1b043cf8d1 100644 --- a/services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsProxy.java +++ b/services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsProxy.java @@ -9,9 +9,6 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.Response; -import org.collectionspace.services.jaxb.AbstractCommonList; -import org.jboss.resteasy.client.ClientResponse; - /* * ILT = Item list type * LT = List type diff --git a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java index dbaddb9167..5bd378a6c6 100644 --- a/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java +++ b/services/organization/client/src/main/java/org/collectionspace/services/client/OrgAuthorityClientUtils.java @@ -41,7 +41,6 @@ import org.collectionspace.services.organization.OrgTermGroup; import org.collectionspace.services.organization.OrgTermGroupList; -import org.jboss.resteasy.client.ClientResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/services/place/client/src/main/java/org/collectionspace/services/client/PlaceAuthorityClientUtils.java b/services/place/client/src/main/java/org/collectionspace/services/client/PlaceAuthorityClientUtils.java index 52410fdd10..d96652514d 100644 --- a/services/place/client/src/main/java/org/collectionspace/services/client/PlaceAuthorityClientUtils.java +++ b/services/place/client/src/main/java/org/collectionspace/services/client/PlaceAuthorityClientUtils.java @@ -21,7 +21,6 @@ import org.collectionspace.services.place.PlacesCommon; import org.dom4j.DocumentException; -import org.jboss.resteasy.client.ClientResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/services/taxonomy/client/src/main/java/org/collectionspace/services/client/TaxonomyAuthorityClientUtils.java b/services/taxonomy/client/src/main/java/org/collectionspace/services/client/TaxonomyAuthorityClientUtils.java index c0f6c63c49..1373b7755d 100644 --- a/services/taxonomy/client/src/main/java/org/collectionspace/services/client/TaxonomyAuthorityClientUtils.java +++ b/services/taxonomy/client/src/main/java/org/collectionspace/services/client/TaxonomyAuthorityClientUtils.java @@ -20,7 +20,6 @@ import org.collectionspace.services.taxonomy.TaxonTermGroupList; import org.collectionspace.services.taxonomy.TaxonomyauthorityCommon; import org.dom4j.DocumentException; -import org.jboss.resteasy.client.ClientResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/services/work/client/src/main/java/org/collectionspace/services/client/WorkAuthorityClientUtils.java b/services/work/client/src/main/java/org/collectionspace/services/client/WorkAuthorityClientUtils.java index 81ef2739fd..04531c1418 100644 --- a/services/work/client/src/main/java/org/collectionspace/services/client/WorkAuthorityClientUtils.java +++ b/services/work/client/src/main/java/org/collectionspace/services/client/WorkAuthorityClientUtils.java @@ -18,9 +18,7 @@ import org.collectionspace.services.work.WorkTermGroupList; import org.collectionspace.services.work.WorkauthoritiesCommon; import org.collectionspace.services.work.WorksCommon; - import org.dom4j.DocumentException; -import org.jboss.resteasy.client.ClientResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/services/workflow/client/src/test/java/org/collectionspace/services/client/test/WorkflowServiceTest.java b/services/workflow/client/src/test/java/org/collectionspace/services/client/test/WorkflowServiceTest.java index d81b63a4c7..52206ce34f 100644 --- a/services/workflow/client/src/test/java/org/collectionspace/services/client/test/WorkflowServiceTest.java +++ b/services/workflow/client/src/test/java/org/collectionspace/services/client/test/WorkflowServiceTest.java @@ -33,7 +33,6 @@ import org.collectionspace.services.client.DimensionClient; import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.dimension.DimensionsCommon; -import org.jboss.resteasy.client.ClientResponse; import org.testng.Assert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; From 184f50ada21180c3fa6033cdfda0d5465af753ec Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Fri, 24 Apr 2026 10:54:09 -0600 Subject: [PATCH 03/40] DRYD-2093: Replace HttpResponseCodes with JAX-RS Equivalent (#527) --- .../test/PerformanceTest.java | 3 +- .../services/account/AccountResource.java | 97 +++++++++---------- .../services/account/TenantResource.java | 8 +- .../client/test/AcquisitionAuthRefsTest.java | 3 - .../common/vocabulary/AuthorityResource.java | 7 +- .../AuthorityResourceWithContacts.java | 7 +- .../services/authorization/RoleResource.java | 7 +- .../CollectionObjectResource.java | 32 ++---- .../authorization/PermissionResource.java | 12 +-- .../services/common/NuxeoBasedResource.java | 5 +- .../common/relation/RelationResource.java | 37 +++---- .../services/media/MediaResource.java | 3 +- 12 files changed, 83 insertions(+), 138 deletions(-) diff --git a/services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/PerformanceTest.java b/services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/PerformanceTest.java index 300dac9dac..6b0041c398 100644 --- a/services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/PerformanceTest.java +++ b/services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/PerformanceTest.java @@ -29,7 +29,6 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import org.jboss.resteasy.util.HttpResponseCodes; import org.testng.Assert; import org.testng.annotations.Test; import org.slf4j.Logger; @@ -92,7 +91,7 @@ private long roundTripOverhead(int numOfCalls) throws Exception { Date startTime = new Date(); response = collectionObjectClient.roundtrip(0); try { - Assert.assertEquals(response.getStatus(), HttpResponseCodes.SC_OK); + Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); } finally { response.close(); } diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java b/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java index 27f1c6e0ef..48d3233385 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java @@ -23,7 +23,45 @@ */ package org.collectionspace.services.account; -import org.apache.chemistry.opencmis.commons.impl.UrlBuilder; +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Predicate; +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.Consumes; +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.PathSegment; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import javax.ws.rs.core.UriInfo; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import freemarker.core.ParseException; +import freemarker.template.Configuration; +import freemarker.template.MalformedTemplateNameException; +import freemarker.template.Template; +import freemarker.template.TemplateException; +import freemarker.template.TemplateNotFoundException; +import javax.xml.bind.DatatypeConverter; import org.apache.commons.lang3.StringUtils; import org.collectionspace.authentication.AuthN; import org.collectionspace.services.account.storage.AccountStorageClient; @@ -38,7 +76,6 @@ import org.collectionspace.services.client.AccountClient; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.client.RoleClient; -import org.collectionspace.services.common.CSWebApplicationException; import org.collectionspace.services.common.EmailUtil; import org.collectionspace.services.common.SecurityResourceBase; import org.collectionspace.services.common.ServiceMain; @@ -50,7 +87,6 @@ import org.collectionspace.services.common.context.RemoteServiceContextFactory; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.context.ServiceContextFactory; -import org.collectionspace.services.common.document.DocumentException; import org.collectionspace.services.common.document.DocumentNotFoundException; import org.collectionspace.services.common.query.UriInfoImpl; import org.collectionspace.services.common.storage.StorageClient; @@ -59,55 +95,10 @@ import org.collectionspace.services.config.ServiceConfig; import org.collectionspace.services.config.tenant.EmailConfig; import org.collectionspace.services.config.tenant.TenantBindingType; - -import org.jboss.resteasy.util.HttpResponseCodes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.web.csrf.CsrfToken; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import freemarker.core.ParseException; -import freemarker.template.Configuration; -import freemarker.template.MalformedTemplateNameException; -import freemarker.template.Template; -import freemarker.template.TemplateException; -import freemarker.template.TemplateNotFoundException; - -import java.io.IOException; -import java.io.StringWriter; -import java.io.Writer; -import java.net.URI; -import java.net.URISyntaxException; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Predicate; - -import javax.persistence.NoResultException; -import javax.servlet.http.HttpServletRequest; -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.PathSegment; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import javax.ws.rs.core.UriInfo; -import javax.xml.bind.DatatypeConverter; - /** AccountResource provides RESTful interface to the account service */ @Path(AccountClient.SERVICE_PATH) @@ -603,7 +594,7 @@ private Response requestPasswordReset(UriInfo ui, String targetTenantID, Account if (contains(targetTenantID, accountListItem.getTenants()) == false) { String errMsg = String.format("Could not send a password request email to user ID='%s'. That account is not associated with the targeted tenant ID = '%s'.", - accountListItem.email, targetTenantID); + accountListItem.getEmail(), targetTenantID); result = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errMsg).type("text/plain").build(); return result; } @@ -635,7 +626,7 @@ private Response requestPasswordReset(UriInfo ui, String targetTenantID, Account String status = EmailUtil.sendMessage(emailConfig, accountListItem.getEmail(), message); if (status != null) { String errMsg = String.format("Could not send email to %s: %s", - accountListItem.email, status); + accountListItem.getEmail(), status); result = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errMsg).type("text/plain").build(); } else { String okMsg = accountListItem.getEmail(); @@ -695,7 +686,7 @@ public Response deleteAccount(@Context UriInfo uriInfo, @PathParam("csid") Strin throw bigReThrow(e, ServiceMessages.DELETE_FAILED, csid); } - return Response.status(HttpResponseCodes.SC_OK).build(); + return Response.ok().build(); } @POST @@ -826,7 +817,7 @@ public Response deleteAccountRole(String accCsid, AccountRole input) { throw bigReThrow(e, ServiceMessages.DELETE_FAILED, accCsid); } - return Response.status(HttpResponseCodes.SC_OK).build(); + return Response.ok().build(); } @DELETE @@ -859,7 +850,7 @@ public Response deleteAccountRole(@Context UriInfo uriInfo, @PathParam("csid") S throw bigReThrow(e, ServiceMessages.DELETE_FAILED, accCsid); } - return Response.status(HttpResponseCodes.SC_OK).build(); + return Response.ok().build(); } } diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/TenantResource.java b/services/account/service/src/main/java/org/collectionspace/services/account/TenantResource.java index a149b21b0d..adaa750f13 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/TenantResource.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/TenantResource.java @@ -28,20 +28,16 @@ import org.collectionspace.services.account.storage.TenantDocumentHandler; import org.collectionspace.services.account.storage.TenantStorageClient; import org.collectionspace.services.account.storage.TenantValidatorHandler; -import org.collectionspace.services.client.IQueryManager; import org.collectionspace.services.client.TenantClient; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.common.SecurityResourceBase; import org.collectionspace.services.common.ServiceMessages; -import org.collectionspace.services.common.config.ServiceConfigUtils; import org.collectionspace.services.common.context.RemoteServiceContextFactory; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.context.ServiceContextFactory; import org.collectionspace.services.common.document.DocumentFilter; import org.collectionspace.services.common.document.DocumentHandler; import org.collectionspace.services.common.storage.StorageClient; -import org.collectionspace.services.common.storage.jpa.JpaStorageUtils; -import org.jboss.resteasy.util.HttpResponseCodes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -53,10 +49,8 @@ import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo; @@ -139,7 +133,7 @@ public Response deleteTenant(@Context UriInfo uriInfo, @PathParam("csid") String ServiceContext ctx = createServiceContext((Tenant) null, Tenant.class, uriInfo); getStorageClient(ctx).delete(ctx, csid); - return Response.status(HttpResponseCodes.SC_OK).build(); + return Response.ok().build(); } catch (Exception e) { throw bigReThrow(e, ServiceMessages.DELETE_FAILED, csid); } diff --git a/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java b/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java index ad6a2f950a..efd4678ba6 100644 --- a/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java +++ b/services/acquisition/client/src/test/java/org/collectionspace/services/client/test/AcquisitionAuthRefsTest.java @@ -40,13 +40,10 @@ import org.collectionspace.services.common.authorityref.AuthorityRefList; import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.acquisition.AcquisitionsCommon; -import org.collectionspace.services.acquisition.AcquisitionFunding; -import org.collectionspace.services.acquisition.AcquisitionFundingList; import org.collectionspace.services.acquisition.AcquisitionSourceList; import org.collectionspace.services.acquisition.OwnerList; import org.collectionspace.services.acquisition.StructuredDateGroup; import org.collectionspace.services.person.PersonTermGroup; -import org.jboss.resteasy.client.ClientResponse; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; 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 4b9fe58caa..738d2bd474 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 @@ -104,7 +104,6 @@ import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.collectionspace.services.workflow.WorkflowCommon; import org.jboss.resteasy.specimpl.PathSegmentImpl; -import org.jboss.resteasy.util.HttpResponseCodes; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; import org.slf4j.Logger; @@ -655,7 +654,7 @@ public Response deleteAuthorityItemList(@PathParam("csid") String specifier, repoClient.releaseRepositorySession(ctx, repoSession); } - return Response.status(HttpResponseCodes.SC_OK).build(); + return Response.ok().build(); } catch (Exception e) { throw bigReThrow(e, ServiceMessages.DELETE_FAILED, specifier); } @@ -719,7 +718,7 @@ public Response deleteAuthority( // # Delete this authority and all of it's item repoClient.releaseRepositorySession(ctx, repoSession); } - return Response.status(HttpResponseCodes.SC_OK).build(); + return Response.ok().build(); } catch (Exception e) { throw bigReThrow(e, ServiceMessages.DELETE_FAILED, specifier); } @@ -1624,7 +1623,7 @@ public Response deleteAuthorityItem( try { ServiceContext ctx = createServiceContext(getItemServiceName(), uriInfo); deleteAuthorityItem(ctx, parentIdentifier, itemIdentifier, AuthorityServiceUtils.UPDATE_REV); - result = Response.status(HttpResponseCodes.SC_OK).build(); + result = Response.ok().build(); } catch (Exception e) { throw bigReThrow(e, ServiceMessages.DELETE_FAILED + " itemcsid: " + itemIdentifier + " parentcsid:" + parentIdentifier); } diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResourceWithContacts.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResourceWithContacts.java index 4bc489c7b5..91ff411b1e 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResourceWithContacts.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/AuthorityResourceWithContacts.java @@ -35,7 +35,6 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; -import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Request; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; @@ -49,11 +48,9 @@ import org.collectionspace.services.common.UriInfoWrapper; import org.collectionspace.services.common.UriTemplateFactory; import org.collectionspace.services.common.UriTemplateRegistryKey; -import org.collectionspace.services.common.vocabulary.AuthorityResource; import org.collectionspace.services.common.context.JaxRsContext; import org.collectionspace.services.common.context.RemoteServiceContext; import org.collectionspace.services.common.context.ServiceContext; -import org.collectionspace.services.common.document.BadRequestException; import org.collectionspace.services.common.document.DocumentException; import org.collectionspace.services.common.document.DocumentFilter; import org.collectionspace.services.common.document.DocumentHandler; @@ -65,10 +62,8 @@ import org.collectionspace.services.contact.nuxeo.ContactDocumentModelHandler; import org.collectionspace.services.jaxb.AbstractCommonList; import org.collectionspace.services.jaxb.AbstractCommonList.ListItem; -import org.jboss.resteasy.util.HttpResponseCodes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.w3c.dom.Element; /** * The Class AuthorityResourceWithContacts. @@ -429,7 +424,7 @@ public Response deleteContact( ctx = createServiceContext(getContactServiceName()); DocumentHandler handler = createDocumentHandler(ctx); getRepositoryClient(ctx).delete(ctx, csid, handler); - return Response.status(HttpResponseCodes.SC_OK).build(); + return Response.ok().build(); } catch (Exception e) { throw bigReThrow(e, "DELETE failed, the requested Contact CSID:" + csid + ": or one of the specifiers for authority:" + parentspecifier diff --git a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/RoleResource.java b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/RoleResource.java index 4819fd1b67..3e5bac641c 100644 --- a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/RoleResource.java +++ b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/RoleResource.java @@ -37,7 +37,6 @@ import org.collectionspace.services.common.storage.jpa.JpaStorageClientImpl; import org.collectionspace.services.common.CSWebApplicationException; -import org.jboss.resteasy.util.HttpResponseCodes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -211,7 +210,7 @@ public Response deleteRole(@PathParam("csid") String csid, @Context UriInfo ui) ctx.closeConnection(); } - return Response.status(HttpResponseCodes.SC_OK).build(); + return Response.ok().build(); } @POST @@ -313,7 +312,7 @@ public Response deleteRolePermission(String roleCsid, PermissionRole input) { new PermissionRoleSubResource(PermissionRoleSubResource.ROLE_PERMROLE_SERVICE); //delete all relationships for a permission subResource.deletePermissionRole((ServiceContext)null, roleCsid, SubjectType.PERMISSION, input); - result = Response.status(HttpResponseCodes.SC_OK).build(); + result = Response.ok().build(); } catch (Exception e) { throw bigReThrow(e, ServiceMessages.DELETE_FAILED, roleCsid); } @@ -344,6 +343,6 @@ public Response deleteRolePermission( throw bigReThrow(e, ServiceMessages.DELETE_FAILED, roleCsid); } - return Response.status(HttpResponseCodes.SC_OK).build(); + return Response.ok().build(); } } diff --git a/services/collectionobject/service/src/main/java/org/collectionspace/services/collectionobject/CollectionObjectResource.java b/services/collectionobject/service/src/main/java/org/collectionspace/services/collectionobject/CollectionObjectResource.java index 1daca950e7..b45eaef8bc 100644 --- a/services/collectionobject/service/src/main/java/org/collectionspace/services/collectionobject/CollectionObjectResource.java +++ b/services/collectionobject/service/src/main/java/org/collectionspace/services/collectionobject/CollectionObjectResource.java @@ -25,38 +25,22 @@ */ package org.collectionspace.services.collectionobject; -import org.collectionspace.services.client.CollectionObjectClient; -import org.collectionspace.services.client.IQueryManager; -import org.collectionspace.services.client.Profiler; -import org.collectionspace.services.common.NuxeoBasedResource; -import org.collectionspace.services.jaxb.AbstractCommonList; -import org.collectionspace.services.relation.RelationsCommonList; -import org.collectionspace.services.relation.RelationshipType; -import org.jboss.resteasy.util.HttpResponseCodes; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriInfo; -import java.util.ArrayList; -import java.util.List; + +import org.collectionspace.services.client.CollectionObjectClient; +import org.collectionspace.services.client.Profiler; +import org.collectionspace.services.common.NuxeoBasedResource; @Path(CollectionObjectClient.SERVICE_PATH_COMPONENT) @Consumes("application/xml") @Produces("application/xml") public class CollectionObjectResource extends NuxeoBasedResource { - - final Logger logger = LoggerFactory.getLogger(CollectionObjectResource.class); @Override public String getVersionString() { @@ -68,7 +52,7 @@ public String getVersionString() { public String getServiceName() { return CollectionObjectClient.SERVICE_PATH_COMPONENT; } - + @Override public Class getCommonPartClass() { return CollectionobjectsCommon.class; @@ -89,12 +73,12 @@ public Class getCommonPartClass() { public Response roundtrip( @PathParam("ms") String ms) { Response result = null; - + Profiler profiler = new Profiler("roundtrip():", 1); profiler.start(); - result = Response.status(HttpResponseCodes.SC_OK).build(); + result = Response.ok().build(); profiler.stop(); - + return result; } diff --git a/services/common/src/main/java/org/collectionspace/services/authorization/PermissionResource.java b/services/common/src/main/java/org/collectionspace/services/authorization/PermissionResource.java index d137750529..6b06855005 100644 --- a/services/common/src/main/java/org/collectionspace/services/authorization/PermissionResource.java +++ b/services/common/src/main/java/org/collectionspace/services/authorization/PermissionResource.java @@ -23,9 +23,6 @@ */ package org.collectionspace.services.authorization; -import org.collectionspace.services.authorization.PermissionRole; -import org.collectionspace.services.authorization.PermissionRoleRel; -import org.collectionspace.services.authorization.SubjectType; import org.collectionspace.services.authorization.perms.Permission; import org.collectionspace.services.authorization.perms.PermissionAction; import org.collectionspace.services.authorization.perms.PermissionsList; @@ -50,12 +47,9 @@ import org.collectionspace.services.common.storage.jpa.JPATransactionContext; import org.collectionspace.services.common.storage.jpa.JpaStorageClientImpl; -import org.jboss.resteasy.util.HttpResponseCodes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.List; - import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; @@ -334,7 +328,7 @@ synchronized public Response deletePermission(ServiceContext)null, permCsid, SubjectType.ROLE, input); - return Response.status(HttpResponseCodes.SC_OK).build(); + return Response.ok().build(); } catch (Exception e) { throw bigReThrow(e, ServiceMessages.DELETE_FAILED, permCsid); } @@ -451,7 +445,7 @@ public Response deletePermissionRole( new PermissionRoleSubResource(PermissionRoleSubResource.PERMISSION_PERMROLE_SERVICE); //delete all relationships for a permission subResource.deletePermissionRole((ServiceContext)null, permCsid, SubjectType.ROLE); - return Response.status(HttpResponseCodes.SC_OK).build(); + return Response.ok().build(); } catch (Exception e) { throw bigReThrow(e, ServiceMessages.DELETE_FAILED, permCsid); } 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 ec8de6f6f0..cfcaf6b564 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 @@ -53,7 +53,6 @@ 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; @@ -98,7 +97,7 @@ public Response reindex( @PathParam("csid") String csid, @PathParam("indexid") String indexid) { uriInfo = new UriInfoWrapper(uriInfo); - Response result = Response.status(Response.Status.OK).entity("Reindex complete.").type("text/plain").build(); + Response result = Response.ok().entity("Reindex complete.").type("text/plain").build(); boolean success = false; ensureCSID(csid, READ); @@ -308,7 +307,7 @@ protected Response delete(ServiceContext ctx, Strin throws Exception { DocumentHandler handler = createDocumentHandler(ctx); getRepositoryClient(ctx).delete(ctx, csid, handler); - return Response.status(HttpResponseCodes.SC_OK).build(); + return Response.ok().build(); } public Response deleteWithParentCtx(ServiceContext parentCtx, diff --git a/services/common/src/main/java/org/collectionspace/services/common/relation/RelationResource.java b/services/common/src/main/java/org/collectionspace/services/common/relation/RelationResource.java index a371832d33..3f10e57102 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/relation/RelationResource.java +++ b/services/common/src/main/java/org/collectionspace/services/common/relation/RelationResource.java @@ -41,11 +41,8 @@ import org.collectionspace.services.relation.RelationsCommon; import org.collectionspace.services.relation.RelationsCommonList; import org.collectionspace.services.relation.RelationsCommonList.RelationListItem; -import org.jboss.resteasy.util.HttpResponseCodes; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.List; @@ -64,9 +61,8 @@ @Consumes("application/xml") @Produces("application/xml") public class RelationResource extends NuxeoBasedResource { - public final static String serviceName = "relations"; - final Logger logger = LoggerFactory.getLogger(RelationResource.class); - + public static final String serviceName = "relations"; + @Override protected String getVersionString() { final String lastChangeRevision = "$LastChangedRevision$"; @@ -80,7 +76,7 @@ public String getServiceName() { public Class getCommonPartClass() { return RelationsCommon.class; } - + @Override @GET @Produces("application/xml") @@ -91,11 +87,11 @@ public RelationsCommonList getList(@Context UriInfo uriInfo) { public RelationsCommonList getList(ServiceContext parentCtx) { return this.getList(parentCtx, parentCtx.getUriInfo()); } - + @Override public RelationsCommonList getList(ServiceContext parentCtx, UriInfo uriInfo) { MultivaluedMap queryParams = uriInfo.getQueryParameters(); - + String subjectCsid = queryParams.getFirst(IRelationsManager.SUBJECT_QP); String subjectType = queryParams.getFirst(IRelationsManager.SUBJECT_TYPE_QP); String predicate = queryParams.getFirst(IRelationsManager.PREDICATE_QP); @@ -104,7 +100,7 @@ public RelationsCommonList getList(ServiceContext p String viceVersaValue = queryParams.getFirst(IRelationsManager.RECIPROCAL_QP); RelationsCommonList resultList = this.getRelationList(parentCtx, uriInfo, subjectCsid, subjectType, predicate, objectCsid, objectType, Tools.isTrue(viceVersaValue)); - + return resultList; } @@ -125,7 +121,7 @@ private RelationsCommonList getRelationList( if (parentCtx != null && parentCtx.getCurrentRepositorySession() != null) { // If the parent context has a non-null and open repository session then use it ctx.setCurrentRepositorySession(parentCtx.getCurrentRepositorySession()); } - + DocumentHandler handler = createDocumentHandler(ctx); String relationClause = RelationsUtils.buildWhereClause(subjectCsid, subjectType, predicate, objectCsid, objectType, viceVersa); handler.getDocumentFilter().appendWhereClause(relationClause, IQueryManager.SEARCH_QUALIFIER_AND); @@ -133,11 +129,11 @@ private RelationsCommonList getRelationList( // Handle keyword clause // String keywords = uriInfo.getQueryParameters().getFirst(IQueryManager.SEARCH_TYPE_KEYWORDS_KW); - if (keywords != null && keywords.isEmpty() == false) { + if (keywords != null && !keywords.isEmpty()) { String keywordClause = QueryManager.createWhereClauseFromKeywords(keywords); handler.getDocumentFilter().appendWhereClause(keywordClause, IQueryManager.SEARCH_QUALIFIER_AND); } - + return (RelationsCommonList)finish_getList(ctx, handler); } catch (Exception e) { throw bigReThrow(e, ServiceMessages.LIST_FAILED); @@ -146,26 +142,26 @@ private RelationsCommonList getRelationList( @DELETE public Response delete(@Context UriInfo uriInfo) { - Response result = Response.status(HttpResponseCodes.SC_OK).build(); - - List csidList = new ArrayList(); + Response result = Response.ok().build(); + + List csidList = new ArrayList<>(); try { RelationsCommonList relationsList = this.getList(null, uriInfo); for (RelationListItem relation : relationsList.getRelationListItem()) { csidList.add(relation.getCsid()); } - - if (csidList.isEmpty() == false) { + + if (!csidList.isEmpty()) { ServiceContext ctx = createServiceContext(); DocumentHandler handler = createDocumentHandler(ctx); getRepositoryClient(ctx).delete(ctx, csidList, handler); } else { - result = Response.status(HttpResponseCodes.SC_NOT_FOUND).build(); + result = Response.status(Response.Status.NOT_FOUND).build(); } } catch (Exception e) { String separator = ", "; String payloadDescription = "unknown"; - if (csidList.isEmpty() == false) { + if (!csidList.isEmpty()) { StringBuffer tempStr = new StringBuffer(); for (String csid : csidList) { tempStr.append(csid); @@ -180,4 +176,3 @@ public Response delete(@Context UriInfo uriInfo) { } } - diff --git a/services/media/service/src/main/java/org/collectionspace/services/media/MediaResource.java b/services/media/service/src/main/java/org/collectionspace/services/media/MediaResource.java index 485de8dca1..80a6e7648c 100644 --- a/services/media/service/src/main/java/org/collectionspace/services/media/MediaResource.java +++ b/services/media/service/src/main/java/org/collectionspace/services/media/MediaResource.java @@ -38,7 +38,6 @@ import org.collectionspace.services.common.blob.BlobUtil; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.nuxeo.client.java.CommonList; -import org.jboss.resteasy.util.HttpResponseCodes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -425,7 +424,7 @@ public Response delete(@PathParam("csid") String csid) { if (blobCsid != null && !blobCsid.isEmpty()) { Response response = getBlobResource().delete(blobCsid); if (logger.isDebugEnabled() == true) { - if (response.getStatus() != HttpResponseCodes.SC_OK) { + if (response.getStatus() != Response.Status.OK.getStatusCode()) { logger.debug("Problem deleting related blob record of Media record: " + "Media CSID=" + csid + " " + "Blob CSID=" + blobCsid); From b72b97bc766861fd3f0e8a1d4be68bee7a940081 Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Fri, 24 Apr 2026 10:54:47 -0600 Subject: [PATCH 04/40] DRYD-2092: Make SecurityInterceptor Implement ContainerRequestFilter (#526) * Update SecurityInterceptor to use JAX-RS 2.0 APIs * Use import for plain text type * Add Priority annotation to replace SecurityPrecedence --- .../AbstractCollectionSpaceResourceImpl.java | 3 +- .../common/CollectionSpaceResource.java | 2 +- .../common/publicitem/PublicItemResource.java | 5 +- .../common/security/SecurityInterceptor.java | 336 ++++++++---------- .../common/security/SecurityUtils.java | 33 +- 5 files changed, 167 insertions(+), 212 deletions(-) diff --git a/services/common/src/main/java/org/collectionspace/services/common/AbstractCollectionSpaceResourceImpl.java b/services/common/src/main/java/org/collectionspace/services/common/AbstractCollectionSpaceResourceImpl.java index 9b016ef662..f3f455e3f6 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/AbstractCollectionSpaceResourceImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/common/AbstractCollectionSpaceResourceImpl.java @@ -579,8 +579,7 @@ protected CSWebApplicationException bigReThrow(Throwable e, String serviceMsg, S } @Override - public boolean allowAnonymousAccess(HttpRequest request, - Class resourceClass) { + public boolean allowAnonymousAccess() { return false; } diff --git a/services/common/src/main/java/org/collectionspace/services/common/CollectionSpaceResource.java b/services/common/src/main/java/org/collectionspace/services/common/CollectionSpaceResource.java index dd7b84db3e..45f714707e 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/CollectionSpaceResource.java +++ b/services/common/src/main/java/org/collectionspace/services/common/CollectionSpaceResource.java @@ -97,7 +97,7 @@ public interface CollectionSpaceResource { */ // - public boolean allowAnonymousAccess(HttpRequest request, Class resourceClass); + public boolean allowAnonymousAccess(); /** * Returns a UriRegistry entry: a map of tenant-qualified URI templates diff --git a/services/common/src/main/java/org/collectionspace/services/common/publicitem/PublicItemResource.java b/services/common/src/main/java/org/collectionspace/services/common/publicitem/PublicItemResource.java index 082cb3341a..98ce043fbf 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/publicitem/PublicItemResource.java +++ b/services/common/src/main/java/org/collectionspace/services/common/publicitem/PublicItemResource.java @@ -77,11 +77,10 @@ public Class getCommonPartClass() { } @Override - public boolean allowAnonymousAccess(HttpRequest request, - Class resourceClass) { + public boolean allowAnonymousAccess() { return true; } - + @GET @Path("/{csid}/{tenantId}/" + PublicItemClient.PUBLICITEMS_CONTENT_SUFFIX) // "content" public Response getPublishedResource( 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 bdcf75c774..d20dc90f91 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 @@ -27,25 +27,24 @@ */ package org.collectionspace.services.common.security; +import java.io.IOException; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.security.Principal; import java.util.HashMap; import java.util.Set; - -import org.jboss.resteasy.core.ResourceMethodInvoker; -import org.jboss.resteasy.core.ServerResponse; -import org.jboss.resteasy.spi.interception.PostProcessInterceptor; -import org.jboss.resteasy.spi.interception.PreProcessInterceptor; -import org.jboss.resteasy.annotations.interception.SecurityPrecedence; -import org.jboss.resteasy.annotations.interception.ServerInterceptor; -import org.jboss.resteasy.spi.Failure; -import org.jboss.resteasy.spi.HttpRequest; -import org.nuxeo.runtime.api.Framework; - +import javax.annotation.Priority; import javax.security.auth.Subject; import javax.security.auth.login.LoginContext; import javax.security.auth.login.LoginException; +import javax.ws.rs.Priorities; +import javax.ws.rs.container.ContainerRequestContext; +import javax.ws.rs.container.ContainerRequestFilter; +import javax.ws.rs.container.ContainerResponseContext; +import javax.ws.rs.container.ContainerResponseFilter; +import javax.ws.rs.container.ResourceInfo; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Request; import javax.ws.rs.core.Response; import javax.ws.rs.ext.Provider; @@ -64,6 +63,8 @@ import org.collectionspace.services.login.LoginClient; import org.collectionspace.services.logout.LogoutClient; import org.collectionspace.services.systeminfo.SystemInfoClient; +import org.jboss.resteasy.spi.Failure; +import org.nuxeo.runtime.api.Framework; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -71,10 +72,9 @@ * RESTeasy interceptor for access control * @version $Revision: 1 $ */ -@SecurityPrecedence -@ServerInterceptor +@Priority(Priorities.AUTHENTICATION) @Provider -public class SecurityInterceptor implements PreProcessInterceptor, PostProcessInterceptor { +public class SecurityInterceptor implements ContainerRequestFilter, ContainerResponseFilter { static { System.err.println("Static initialization of: " + SecurityInterceptor.class.getCanonicalName()); @@ -98,24 +98,26 @@ public class SecurityInterceptor implements PreProcessInterceptor, PostProcessIn private static final String ERROR_NUXEO_LOGOUT = "Attempt to logout when Nuxeo login context was null."; private static final String ERROR_UNBALANCED_LOGINS = "The number of Logins vs Logouts to the Nuxeo framework was unbalanced."; - private boolean isAnonymousRequest(HttpRequest request, ResourceMethodInvoker resourceMethodInvoker) { // see C:\dev\src\cspace\services\services\JaxRsServiceProvider\src\main\webapp\WEB-INF\applicationContext-security.xml + @Context + private ResourceInfo resourceInfo; + + private boolean isAnonymousRequest(ContainerRequestContext requestContext) { boolean result = false; - String resName = SecurityUtils.getResourceName(request.getUri()).toLowerCase(); - switch (resName) { - case AuthZ.PASSWORD_RESET: - case AuthZ.PROCESS_PASSWORD_RESET: - case LOGIN: - case LOGOUT: - case SYSTEM_INFO: - case "": - return true; - } + String resName = SecurityUtils.getResourceName(requestContext.getUriInfo()).toLowerCase(); + if (resName.equals(AuthZ.PASSWORD_RESET) + || resName.equals(AuthZ.PROCESS_PASSWORD_RESET) + || resName.equals(LOGIN) + || resName.equals(LOGOUT) + || resName.equals(SYSTEM_INFO) + || resName.isEmpty()) { + return true; + } - Class resourceClass = resourceMethodInvoker.getResourceClass(); + Class resourceClass = resourceInfo.getResourceClass(); try { CollectionSpaceResource resourceInstance = (CollectionSpaceResource)resourceClass.newInstance(); - result = resourceInstance.allowAnonymousAccess(request, resourceClass); + result = resourceInstance.allowAnonymousAccess(); } catch (InstantiationException e) { logger.error("isAnonymousRequest: ", e); } catch (IllegalAccessException e) { @@ -125,83 +127,83 @@ private boolean isAnonymousRequest(HttpRequest request, ResourceMethodInvoker re return result; } - /* - * Check to see if the resource required authorization to access - * - */ - private boolean requiresAuthorization(String resName) { - boolean result = true; - // - // ACCOUNT_PERMISSIONS, ACCOUNT_ROLES: All active users are allowed to see the *their* - // (we enforce this) current list of permissions and roles. If this is not the request, then - // we'll do a full AuthZ check. - // - // STRUCTURED_DATE_REQUEST: All user can request the parsing of a structured date string. - // - switch (resName) { - case AuthZ.STRUCTURED_DATE_REQUEST: - case AuthZ.ACCOUNT_PERMISSIONS: - case AuthZ.ACCOUNT_ROLES: - case AuthZ.REPORTS_MIME_OUTPUTS: - result = false; - break; - default: - result = true; - } + /* + * Check to see if the resource required authorization to access + * + */ + private boolean requiresAuthorization(String resName) { + boolean result = true; + // + // ACCOUNT_PERMISSIONS, ACCOUNT_ROLES: All active users are allowed to see the *their* + // (we enforce this) current list of permissions and roles. If this is not the request, then + // we'll do a full AuthZ check. + // + // STRUCTURED_DATE_REQUEST: All user can request the parsing of a structured date string. + // + if (resName.equals(AuthZ.STRUCTURED_DATE_REQUEST) + || resName.equals(AuthZ.ACCOUNT_PERMISSIONS) + || resName.equals(AuthZ.ACCOUNT_ROLES) + || resName.equals(AuthZ.REPORTS_MIME_OUTPUTS)) { + result = false; + } + + return result; + } - return result; + private void checkAccessAllowed(final AuthZ authZ, + final CSpaceResource resource, + final String resourceName, + final String uriPath, + final String httpMethod) throws CSWebApplicationException { + if (!authZ.isAccessAllowed(resource)) { + logger.error("Access to {}:{} is NOT allowed to user={}", resourceName, resource.getId(), + AuthN.get().getUserId()); + final Response response = Response.status(Response.Status.FORBIDDEN) + .entity(uriPath + " " + httpMethod) + .type(MediaType.TEXT_PLAIN_TYPE).build(); + throw new CSWebApplicationException(response); } + } - /* (non-Javadoc) - * @see org.jboss.resteasy.spi.interception.PreProcessInterceptor#preProcess(org.jboss.resteasy.spi.HttpRequest, org.jboss.resteasy.core.ResourceMethod) - */ @Override - public ServerResponse preProcess(HttpRequest request, ResourceMethodInvoker resourceMethodInvoker) - throws Failure, CSWebApplicationException { - - ServerResponse result = null; // A null value essentially means success for this method - Method resourceMethod = resourceMethodInvoker.getMethod(); + public void filter(ContainerRequestContext containerRequestContext) throws IOException { + Request request = containerRequestContext.getRequest(); try { - if (isAnonymousRequest(request, resourceMethodInvoker) == true) { - // We don't need to check credentials for anonymous requests. Just login to Nuxeo and - // exit - nuxeoPreProcess(request, resourceMethodInvoker); // We login to Nuxeo only after we've checked authorization - - return result; + if (isAnonymousRequest(containerRequestContext)) { + // We don't need to check credentials for anonymous requests. Just login to Nuxeo and exit + nuxeoPreProcess(); + return; } - final String servicesResource = "/cspace-services/"; // HACK - this is configured in war, get this from tomcat instead + // HACK - this is configured in war, get this from tomcat instead + final String servicesResource = "/cspace-services/"; final int servicesResourceLen = servicesResource.length(); - String httpMethod = request.getHttpMethod(); - String uriPath = request.getUri().getPath(); + String httpMethod = request.getMethod(); + String uriPath = containerRequestContext.getUriInfo().getPath(); if (logger.isDebugEnabled()) { - String fullRequest = request.getUri().getRequestUri().toString(); - int servicesResourceIdx = fullRequest.indexOf(servicesResource); - String relativeRequest = (servicesResourceIdx<=0)? fullRequest - : fullRequest.substring(servicesResourceIdx+servicesResourceLen); - logger.debug("received " + httpMethod + " on " + relativeRequest); + int servicesResourceIdx = uriPath.indexOf(servicesResource); + String relativeRequest = + (servicesResourceIdx <= 0) ? uriPath : uriPath.substring(servicesResourceIdx + servicesResourceLen); + logger.debug("received {}s on {}", httpMethod, relativeRequest); } - String resName = SecurityUtils.getResourceName(request.getUri()); + String resName = SecurityUtils.getResourceName(containerRequestContext.getUriInfo()); String resEntity = SecurityUtils.getResourceEntity(resName); // // If the resource entity is acting as a proxy then all sub-resources will map to the resource itself. // This essentially means sub-resources inherit all the authz permissions of the entity. // - if (SecurityUtils.isResourceProxied(resName) == true) { + if (SecurityUtils.isResourceProxied(resName)) { resName = resEntity; } else { // // If our resName is not proxied, we may need to tweak it. // - switch (resName) { - case AuthZ.REPORTS_INVOKE: - case AuthZ.BATCH_INVOKE: { - resName = resName.replace("/*/", "/"); - } + if (resName.equals(AuthZ.REPORTS_INVOKE) || resName.equals(AuthZ.BATCH_INVOKE)) { + resName = resName.replace("/*/", "/"); } } // @@ -209,73 +211,50 @@ public ServerResponse preProcess(HttpRequest request, ResourceMethodInvoker reso // checkActive(); - if (requiresAuthorization(resName) == true) { //see comment immediately above + if (requiresAuthorization(resName)) { AuthZ authZ = AuthZ.get(); CSpaceResource res = new URIResourceImpl(AuthN.get().getCurrentTenantId(), resName, httpMethod); - if (authZ.isAccessAllowed(res) == false) { - logger.error("Access to " + 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); - } 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 or fulltext reindex and make sure they are allowed to to this. - // - if (uriPath.contains(WorkflowClient.SERVICE_PATH) == true) { - String workflowProxyResource = SecurityUtils.getWorkflowResourceName(request); - res = new URIResourceImpl(AuthN.get().getCurrentTenantId(), workflowProxyResource, 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); - } - } 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); - } - } - - } - // + checkAccessAllowed(authZ, res, resName, uriPath, httpMethod); + + // + // 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 or fulltext reindex and make sure they are allowed to this. + // + if (uriPath.contains(WorkflowClient.SERVICE_PATH)) { + String workflowProxyResource = SecurityUtils.getWorkflowResourceName(containerRequestContext); + res = new URIResourceImpl(AuthN.get().getCurrentTenantId(), workflowProxyResource, httpMethod); + checkAccessAllowed(authZ, res, resName, uriPath, httpMethod); + } else if (uriPath.contains(IndexClient.SERVICE_PATH)) { + String indexProxyResource = SecurityUtils.getIndexResourceName(); + res = new URIResourceImpl(AuthN.get().getCurrentTenantId(), indexProxyResource, httpMethod); + checkAccessAllowed(authZ, res, resName, uriPath, httpMethod); + } + + // // Login to Nuxeo // - nuxeoPreProcess(request, resourceMethodInvoker); // We login to Nuxeo only after we've checked authorization + nuxeoPreProcess(); // // We've passed all the checks. Now just log the results // - if (logger.isTraceEnabled()) { - logger.trace("Access to " + res.getId() + " is allowed to " + - " user=" + AuthN.get().getUserId() + - " for tenant id=" + AuthN.get().getCurrentTenantName()); - } - } - } catch (Throwable t) { - if (logger.isTraceEnabled() == true) { - t.printStackTrace(); + logger.trace("Access to {} is allowed to user={} for tenant id={}", res.getId(), + AuthN.get().getUserId(), + AuthN.get().getCurrentTenantName()); } + } catch (RuntimeException t) { + logger.error("Error in SecurityInterceptor", t); throw t; } - - return result; } @Override - public void postProcess(ServerResponse arg0) { + public void filter(ContainerRequestContext containerRequestContext, + ContainerResponseContext containerResponseContext) throws IOException { // // Log out of the Nuxeo framework // - nuxeoPostProcess(arg0); + nuxeoPostProcess(); } /** @@ -291,11 +270,12 @@ private void checkActive() throws CSWebApplicationException { String tenantId = AuthN.get().getCurrentTenantId(); TenantBindingType tenantBindingType = ServiceMain.getInstance().getTenantBindingConfigReader().getTenantBinding(tenantId); boolean tenantDisabled = tenantBindingType.isCreateDisabled(); - if (tenantDisabled == true) { + if (tenantDisabled) { String errMsg = String.format("The user %s's tenant '%s' is disabled. Contact your CollectionSpace administrator.", userId, tenantBindingType.getDisplayName()); - Response response = Response.status( - Response.Status.CONFLICT).entity(errMsg).type("text/plain").build(); + Response response = Response.status(Response.Status.CONFLICT) + .entity(errMsg) + .type(MediaType.TEXT_PLAIN_TYPE).build(); throw new CSWebApplicationException(response); } } catch (IllegalStateException ise) { @@ -303,8 +283,9 @@ private void checkActive() throws CSWebApplicationException { // Note the RFC on return types: // If the request already included Authorization credentials, then the 401 response // indicates that authorization has been refused for those credentials. - Response response = Response.status( - Response.Status.UNAUTHORIZED).entity(errMsg).type("text/plain").build(); + Response response = Response.status(Response.Status.UNAUTHORIZED) + .entity(errMsg) + .type(MediaType.TEXT_PLAIN_TYPE).build(); throw new CSWebApplicationException(ise, response); } @@ -312,15 +293,16 @@ private void checkActive() throws CSWebApplicationException { //can't use JAXB here as this runs from the common jar which cannot //depend upon the account service String whereClause = "where userId = :userId"; - HashMap params = new HashMap(); + HashMap params = new HashMap<>(); params.put("userId", userId); Object account = JpaStorageUtils.getEntity( "org.collectionspace.services.account.AccountsCommon", whereClause, params); if (account == null) { String msg = "User's account not found, userId=" + userId; - Response response = Response.status( - Response.Status.FORBIDDEN).entity(msg).type("text/plain").build(); + Response response = Response.status(Response.Status.FORBIDDEN) + .entity(msg) + .type(MediaType.TEXT_PLAIN_TYPE).build(); throw new CSWebApplicationException(response); } Object status = JaxbUtils.getValue(account, "getStatus"); @@ -328,70 +310,71 @@ private void checkActive() throws CSWebApplicationException { String value = (String) JaxbUtils.getValue(status, "value"); if ("INACTIVE".equalsIgnoreCase(value)) { String msg = "User's account is inactive, userId=" + userId; - Response response = Response.status( - Response.Status.FORBIDDEN).entity(msg).type("text/plain").build(); + Response response = Response.status(Response.Status.FORBIDDEN) + .entity(msg) + .type(MediaType.TEXT_PLAIN_TYPE).build(); throw new CSWebApplicationException(response); } } } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { String msg = "User's account is in invalid state, userId=" + userId; - Response response = Response.status( - Response.Status.FORBIDDEN).entity(msg).type("text/plain").build(); + Response response = Response.status(Response.Status.FORBIDDEN) + .entity(msg) + .type(MediaType.TEXT_PLAIN_TYPE).build(); throw new CSWebApplicationException(e, response); } } // // Nuxeo login support // - public ServerResponse nuxeoPreProcess(HttpRequest request, ResourceMethodInvoker resourceMethodInvoker) - throws Failure, CSWebApplicationException { + public void nuxeoPreProcess() throws Failure, CSWebApplicationException { try { nuxeoLogin(NUXEO_ADMIN); } catch (LoginException e) { String msg = "Unable to login to the Nuxeo framework"; logger.error(msg, e); - Response response = Response.status( - Response.Status.INTERNAL_SERVER_ERROR).entity(msg).type("text/plain").build(); + Response response = Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(msg) + .type(MediaType.TEXT_PLAIN).build(); throw new CSWebApplicationException(e, response); } - - return null; } - public void nuxeoPostProcess(ServerResponse arg0) { + public void nuxeoPostProcess() { try { nuxeoLogout(); } catch (LoginException e) { - String msg = "Unable to logout of the Nuxeo framework."; - logger.error(msg, e); + logger.error("Unable to logout of the Nuxeo framework.", e); } } private void logLoginContext(LoginContext loginContext) { - if (!logger.isTraceEnabled()) return; + if (!logger.isTraceEnabled()) { + return; + } - logger.trace("CollectionSpace services now logged in to Nuxeo with LoginContext: " - + loginContext); + logger.trace("CollectionSpace services now logged in to Nuxeo with LoginContext: {}", loginContext); Subject subject = loginContext.getSubject(); Set principals = subject.getPrincipals(); logger.trace("Nuxeo login performed with principals: "); for (Principal principal : principals) { - logger.trace("[" + principal.getName() + "]"); + logger.trace("[{}]", principal.getName()); } } private void logLogoutContext(LoginContext loginContext) { - if (!logger.isTraceEnabled()) return; + if (!logger.isTraceEnabled()) { + return; + } if (loginContext != null) { - logger.trace("CollectionSpace services now logging out of Nuxeo with LoginContext: " - + loginContext); + logger.trace("CollectionSpace services now logging out of Nuxeo with LoginContext: {}", loginContext); Subject subject = loginContext.getSubject(); Set principals = subject.getPrincipals(); logger.trace("Nuxeo logout performed with principals: "); for (Principal principal : principals) { - logger.trace("[" + principal.getName() + "]"); + logger.trace("[{}]", principal.getName()); } } else { logger.trace("Logged out."); @@ -407,12 +390,10 @@ private synchronized void nuxeoLogin(String user) throws LoginException { // Use a ThreadLocal instance to keep track of the Nuxeo login context // if (threadLocalLoginContext == null) { - threadLocalLoginContext = new ThreadLocal(); - if (logger.isTraceEnabled() == true) { - logger.trace(String.format("Thread ID %s: Created new ThreadLocal instance: %s)", - Thread.currentThread(), threadLocalLoginContext)); - } - } + threadLocalLoginContext = new ThreadLocal<>(); + logger.trace("Thread ID {}: Created new ThreadLocal instance: {})", Thread.currentThread(), + threadLocalLoginContext); + } LoginContext loginContext = threadLocalLoginContext.get(); @@ -420,11 +401,9 @@ private synchronized void nuxeoLogin(String user) throws LoginException { loginContext = Framework.loginAs(user); frameworkLogins++; threadLocalLoginContext.set(loginContext); - if (logger.isTraceEnabled() == true) { - logger.trace(String.format("Thread ID %s: Logged in with ThreadLocal instance %s - %s ", - Thread.currentThread(), threadLocalLoginContext, threadLocalLoginContext.get())); - } - // + logger.trace("Thread ID {}: Logged in with ThreadLocal instance {} - {} ", Thread.currentThread(), + threadLocalLoginContext, threadLocalLoginContext.get()); + // // Debug logging // logLoginContext(loginContext); @@ -435,8 +414,8 @@ private synchronized void nuxeoLogin(String user) throws LoginException { // use the Nuxeo default "system admin" context for ever request, regardless of the CollectionSpace user making // the request. In short, there's no real security vulnerability here -just bad bookkeeping of logins. // - logger.warn(String.format(String.format("Thread ID %s: Alreadyed logged in with ThreadLocal instance %s - %s ", - Thread.currentThread(), threadLocalLoginContext, threadLocalLoginContext.get()))); + logger.warn("Thread ID {}: Already logged in with ThreadLocal instance {} - {} ", Thread.currentThread(), + threadLocalLoginContext, threadLocalLoginContext.get()); frameworkLogins++; } } @@ -446,12 +425,10 @@ private synchronized void nuxeoLogout() throws LoginException { if (loginContext != null) { logLogoutContext(loginContext); loginContext.logout(); - threadLocalLoginContext.set(null); // We need to clear the login context from this thread, so the next request on this thread has to login again. + threadLocalLoginContext.remove(); // We need to clear the login context from this thread, so the next request on this thread has to login again. logLogoutContext(null); frameworkLogins--; - if (logger.isTraceEnabled()) { - String.format("Framework logins: ", frameworkLogins); - } + logger.trace("Framework logins: {}", frameworkLogins); } else { if (frameworkLogins > 0) { logger.warn(ERROR_NUXEO_LOGOUT); // If we get here, it means our login/logout bookkeeping has failed. @@ -460,10 +437,11 @@ private synchronized void nuxeoLogout() throws LoginException { if (frameworkLogins == 0) { if (threadLocalLoginContext != null) { - logger.trace(String.format("Thread ID %s: Clearing ThreadLocal instance %s - %s ", - Thread.currentThread(), threadLocalLoginContext, threadLocalLoginContext.get())); + logger.trace("Thread ID {}: Clearing ThreadLocal instance {} - {} ", Thread.currentThread(), + threadLocalLoginContext, threadLocalLoginContext.get()); } threadLocalLoginContext = null; //Clear the ThreadLocal to void Tomcat warnings associated with thread pools. } } + } 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 9062102cd8..7ee3ed3c5a 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 @@ -43,6 +43,7 @@ import org.collectionspace.authentication.AuthN; import org.collectionspace.authentication.spring.CSpacePasswordEncoderFactory; +import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriInfo; @@ -50,7 +51,6 @@ import org.slf4j.LoggerFactory; import org.springframework.security.crypto.password.PasswordEncoder; -import org.jboss.resteasy.spi.HttpRequest; import org.opensaml.core.xml.XMLObject; import org.opensaml.core.xml.schema.XSAny; import org.opensaml.core.xml.schema.XSString; @@ -132,10 +132,10 @@ public static void validatePassword(String password) { } } - public static String getWorkflowResourceName(HttpRequest request) { + public static String getWorkflowResourceName(ContainerRequestContext requestContext) { String result = null; - UriInfo uriInfo = request.getUri(); + UriInfo uriInfo = requestContext.getUriInfo(); String workflowSubResName = SecurityUtils.getResourceName(uriInfo); String resEntity = SecurityUtils.getResourceEntity(workflowSubResName); @@ -151,35 +151,14 @@ public static String getWorkflowResourceName(HttpRequest request) { 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; - } - - // + public static String getIndexResourceName() { + // // 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; + return IndexClient.SERVICE_NAME; } /** From 557de578f346be08d87df64544ce05d6bb3b249d Mon Sep 17 00:00:00 2001 From: Spiros Dimopulos Date: Fri, 23 Jan 2026 21:57:52 +0200 Subject: [PATCH 05/40] DRYD-1979 Security > Integrate Security Vulnerability Scanners (#498) DRYD-1979: added a security vulnerabilities check step in the PR template; --- pull_request_template.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pull_request_template.md b/pull_request_template.md index 8330ee3fd8..dfa57b7128 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -13,3 +13,6 @@ **Has the application documentation been updated for these changes?** **Did someone actually run this code to verify it works?** + +**Have any new security vulnerabilities been handled?** +[Check SonarQube for IDE plugin for any security vulnerabilities introduced and describe how they have been handled] From deaa965f93316f6ecd49360be56b89f260c478b6 Mon Sep 17 00:00:00 2001 From: mglyrasis <129785358+mglyrasis@users.noreply.github.com> Date: Fri, 24 Apr 2026 13:28:47 -0600 Subject: [PATCH 06/40] DRYD-1193: Sysinfo endpoint healthcheck --- .../test/HealthEndpointIntegrationTest.java | 133 +++++++ .../CollectionSpaceJaxRsApplication.java | 2 + .../common/security/SecurityConfig.java | 3 + .../common/security/SecurityInterceptor.java | 21 +- services/systeminfo/service/pom.xml | 5 + .../services/systeminfo/HealthResource.java | 373 ++++++++++++++++++ 6 files changed, 528 insertions(+), 9 deletions(-) create mode 100644 services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/HealthEndpointIntegrationTest.java create mode 100644 services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/HealthResource.java diff --git a/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/HealthEndpointIntegrationTest.java b/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/HealthEndpointIntegrationTest.java new file mode 100644 index 0000000000..db3a12c57c --- /dev/null +++ b/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/HealthEndpointIntegrationTest.java @@ -0,0 +1,133 @@ +package org.collectionspace.services.IntegrationTests.test; + +import static org.testng.Assert.assertTrue; + +import java.io.IOException; +import java.net.ConnectException; +import java.util.Iterator; + +import org.apache.http.HttpResponse; +import org.apache.http.client.fluent.Request; +import org.apache.http.conn.HttpHostConnectException; +import org.apache.http.util.EntityUtils; +import org.testng.Assert; +import org.testng.SkipException; +import org.testng.annotations.Test; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * Integration tests for the GET /health endpoint. The endpoint is unauthenticated + * and returns JSON with overall status and component checks (database, nuxeo, elasticsearch). + * Requires a running CollectionSpace services server at {@link #BASE_URL}. If the server + * is not reachable, tests are skipped (e.g. when running in CI without a deployed server). + */ +public class HealthEndpointIntegrationTest { + + public static final String HOST = "localhost"; + public static final int PORT = 8180; + public static final String BASE_URL = "http://" + HOST + ":" + PORT + "/cspace-services/"; + public static final String HEALTH_PATH = "health"; + + private String getUrl(String path) { + return BASE_URL + path; + } + + /** + * Performs GET on the health endpoint. Skips the test if the server is not reachable + * (Connection refused), so that mvn test can pass when no server is running. + */ + private HttpResponse getHealthResponse() throws IOException { + try { + return Request.Get(getUrl(HEALTH_PATH)) + .addHeader("Accept", "application/json") + .execute() + .returnResponse(); + } catch (HttpHostConnectException e) { + Throwable cause = e.getCause(); + if (cause instanceof ConnectException && "Connection refused".equals(cause.getMessage())) { + throw new SkipException( + "CollectionSpace server not running at " + BASE_URL + " - skip integration test"); + } + throw e; + } + } + + @Test + public void testHealthReturnsOkOrServiceUnavailable() throws IOException { + HttpResponse response = getHealthResponse(); + int status = response.getStatusLine().getStatusCode(); + Assert.assertTrue(status == 200 || status == 503, + "Expected 200 or 503, got " + status); + String body = EntityUtils.toString(response.getEntity()); + JsonNode root = new ObjectMapper().readTree(body); + Assert.assertTrue(root.has("status"), "Response should have 'status' field"); + String statusVal = root.get("status").asText(); + Assert.assertTrue( + "pass".equals(statusVal) || "warn".equals(statusVal) || "fail".equals(statusVal), + "status should be pass, warn, or fail; got: " + statusVal); + } + + @Test + public void testHealthResponseStructure() throws IOException { + HttpResponse response = getHealthResponse(); + int status = response.getStatusLine().getStatusCode(); + Assert.assertTrue(status == 200 || status == 503, + "Expected 200 or 503, got " + status); + String body = EntityUtils.toString(response.getEntity()); + JsonNode root = new ObjectMapper().readTree(body); + Assert.assertTrue(root.has("status"), "Response should have 'status' field"); + Assert.assertTrue(root.has("checks"), "Response should have 'checks' object"); + JsonNode checks = root.get("checks"); + Assert.assertTrue(checks.isObject(), "checks should be an object"); + + Assert.assertTrue(checks.has("database:cspace"), + "checks should contain 'database:cspace'"); + assertValidCheckStatus(checks.get("database:cspace").get("status").asText(), "database:cspace"); + + Assert.assertTrue(checks.has("database:csadmin"), + "checks should contain 'database:csadmin'"); + assertValidCheckStatus(checks.get("database:csadmin").get("status").asText(), "database:csadmin"); + + // database:nuxeo: either single "database:nuxeo" (warn when no tenants) or "database:nuxeo:" per repo + boolean hasNuxeoCheck = checks.has("database:nuxeo"); + if (!hasNuxeoCheck) { + Iterator keys = checks.fieldNames(); + while (keys.hasNext()) { + if (keys.next().startsWith("database:nuxeo:")) { + hasNuxeoCheck = true; + break; + } + } + } + Assert.assertTrue(hasNuxeoCheck, + "checks should contain 'database:nuxeo' or at least one 'database:nuxeo:*'"); + + // Every database:* check must have status one of pass, warn, fail, disabled + Iterator keyIt = checks.fieldNames(); + while (keyIt.hasNext()) { + String key = keyIt.next(); + if (key.startsWith("database:")) { + Assert.assertTrue(checks.get(key).has("status"), + "check '" + key + "' should have 'status'"); + String checkStatus = checks.get(key).get("status").asText(); + assertValidCheckStatus(checkStatus, key); + } + } + } + + private static void assertValidCheckStatus(String status, String checkKey) { + assertTrue( + "pass".equals(status) || "warn".equals(status) || "fail".equals(status) || "disabled".equals(status), + "check " + checkKey + " status should be pass, warn, fail, or disabled; got: " + status); + } + + @Test + public void testHealthNoAuthRequired() throws IOException { + HttpResponse response = getHealthResponse(); + int status = response.getStatusLine().getStatusCode(); + Assert.assertTrue(status == 200 || status == 503, + "Health endpoint should be accessible without auth (200 or 503); got " + status); + } +} diff --git a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java index c815d4ddbc..f74fc712b2 100644 --- a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java +++ b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java @@ -67,6 +67,7 @@ import org.collectionspace.services.dimension.DimensionResource; import org.collectionspace.services.servicegroup.ServiceGroupResource; import org.collectionspace.services.structureddate.StructuredDateResource; +import org.collectionspace.services.systeminfo.HealthResource; import org.collectionspace.services.systeminfo.SystemInfoResource; import org.collectionspace.services.contact.ContactResource; import org.collectionspace.services.vocabulary.VocabularyResource; @@ -129,6 +130,7 @@ public CollectionSpaceJaxRsApplication() { singletons.add(new ExportResource()); singletons.add(new StructuredDateResource()); singletons.add(new SystemInfoResource()); + singletons.add(new HealthResource()); singletons.add(new IndexResource()); singletons.add(new LoginResource()); singletons.add(new LogoutResource()); diff --git a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityConfig.java b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityConfig.java index 88d6869a0c..d0299dc573 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityConfig.java +++ b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityConfig.java @@ -411,6 +411,9 @@ public void customize(AuthorizeHttpRequestsConfigurer.Authorizatio // Exclude the resource path to request system info. .requestMatchers("/systeminfo").permitAll() + // Exclude the resource path for health check (load balancers). + .requestMatchers("/health").permitAll() + // Handle CORS (preflight OPTIONS requests must be anonymous). .requestMatchers(HttpMethod.OPTIONS).permitAll() 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 d20dc90f91..48a5625dc3 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 @@ -86,6 +86,7 @@ public class SecurityInterceptor implements ContainerRequestFilter, ContainerRes private static final String LOGIN = LoginClient.SERVICE_NAME; private static final String LOGOUT = LogoutClient.SERVICE_NAME; private static final String SYSTEM_INFO = SystemInfoClient.SERVICE_NAME; + private static final String HEALTH = "health"; private static final String NUXEO_ADMIN = null; // // Use this thread specific member instance to hold our login context with Nuxeo @@ -104,15 +105,17 @@ public class SecurityInterceptor implements ContainerRequestFilter, ContainerRes private boolean isAnonymousRequest(ContainerRequestContext requestContext) { boolean result = false; - String resName = SecurityUtils.getResourceName(requestContext.getUriInfo()).toLowerCase(); - if (resName.equals(AuthZ.PASSWORD_RESET) - || resName.equals(AuthZ.PROCESS_PASSWORD_RESET) - || resName.equals(LOGIN) - || resName.equals(LOGOUT) - || resName.equals(SYSTEM_INFO) - || resName.isEmpty()) { - return true; - } + String resName = SecurityUtils.getResourceName(request.getUri()).toLowerCase(); + switch (resName) { + case AuthZ.PASSWORD_RESET: + case AuthZ.PROCESS_PASSWORD_RESET: + case LOGIN: + case LOGOUT: + case SYSTEM_INFO: + case HEALTH: + case "": + return true; + } Class resourceClass = resourceInfo.getResourceClass(); try { diff --git a/services/systeminfo/service/pom.xml b/services/systeminfo/service/pom.xml index af6c062f7b..5385e609ce 100644 --- a/services/systeminfo/service/pom.xml +++ b/services/systeminfo/service/pom.xml @@ -64,6 +64,11 @@ resteasy-multipart-provider + + com.fasterxml.jackson.core + jackson-databind + + diff --git a/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/HealthResource.java b/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/HealthResource.java new file mode 100644 index 0000000000..8d784dd678 --- /dev/null +++ b/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/HealthResource.java @@ -0,0 +1,373 @@ +package org.collectionspace.services.systeminfo; + +import java.io.IOException; +import java.io.InputStream; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.Callable; + +import javax.naming.NamingException; + +import javax.sql.DataSource; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.collectionspace.services.common.ServiceMain; +import org.collectionspace.services.common.config.ConfigUtils; +import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl; +import org.collectionspace.services.common.context.ServiceContext; +import org.collectionspace.services.common.storage.JDBCTools; +import org.collectionspace.services.config.tenant.TenantBindingType; +import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; +import org.collectionspace.services.nuxeo.client.java.NuxeoConnectorEmbedded; +import org.nuxeo.elasticsearch.ElasticSearchComponent; +import org.nuxeo.elasticsearch.api.ElasticSearchService; +import org.nuxeo.runtime.api.Framework; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.databind.ObjectMapper; + +/** + * JAX-RS resource for the /health endpoint. Returns JSON health status + * suitable for load balancers and Kubernetes (200/503, IETF draft health format). + */ +@Path("/health") +@Produces(MediaType.APPLICATION_JSON) +public class HealthResource { + + private static final Logger logger = LoggerFactory.getLogger(HealthResource.class); + private static final String DESCRIPTION = "CollectionSpace Services"; + + @GET + public Response get() { + Map root = new LinkedHashMap<>(); + Map checks = new LinkedHashMap<>(); + root.put("checks", checks); + + try { + root.put("description", DESCRIPTION); + root.put("version", getApplicationVersion()); + root.put("releaseId", readGitCommitId()); + root.put("serviceId", getServiceId()); + + String cspaceInstanceId = null; + try { + cspaceInstanceId = ServiceMain.getInstance().getCspaceInstanceId(); + } catch (Exception e) { + logger.debug("Could not get instance id", e); + } + + List repoNames = resolveAllRepositoryNames(); + String firstRepoName = repoNames.isEmpty() ? null : repoNames.get(0); + boolean requiredFailed = false; + boolean hasWarn = false; + + // Check: database:cspace (required) + Map cspaceCheck = checkDatabaseCspace(); + checks.put("database:cspace", cspaceCheck); + if ("fail".equals(cspaceCheck.get("status"))) { + requiredFailed = true; + } + + // Check: database:csadmin (optional) + Map csadminCheck = checkDatabaseCsadmin(); + checks.put("database:csadmin", csadminCheck); + if ("fail".equals(csadminCheck.get("status"))) { + hasWarn = true; + } + + // Check: database:nuxeo per repository (required for each) + if (repoNames.isEmpty()) { + Map warnCheck = new LinkedHashMap<>(); + warnCheck.put("status", "warn"); + warnCheck.put("output", "no tenants configured"); + checks.put("database:nuxeo", warnCheck); + hasWarn = true; + } else { + for (String repoName : repoNames) { + Map nuxeoDbCheck = checkDatabaseNuxeo(repoName, cspaceInstanceId); + checks.put("database:nuxeo:" + repoName, nuxeoDbCheck); + if ("fail".equals(nuxeoDbCheck.get("status"))) { + requiredFailed = true; + } + } + } + + // Check: nuxeo:repository (first repo only, required) + if (firstRepoName != null) { + Map repoCheck = checkNuxeoRepository(firstRepoName); + checks.put("nuxeo:repository", repoCheck); + if ("fail".equals(repoCheck.get("status"))) { + requiredFailed = true; + } + } else { + Map warnCheck = new LinkedHashMap<>(); + warnCheck.put("status", "warn"); + warnCheck.put("output", "no tenants configured"); + checks.put("nuxeo:repository", warnCheck); + hasWarn = true; + } + + // Check: database:nuxeo_reader per repository (optional) + for (String repoName : repoNames) { + Map readerCheck = checkDatabaseNuxeoReader(repoName, cspaceInstanceId); + checks.put("database:nuxeo_reader:" + repoName, readerCheck); + if ("fail".equals(readerCheck.get("status"))) { + hasWarn = true; + } + } + + // Check: database:csadmin_nuxeo per repository (optional) + for (String repoName : repoNames) { + Map csadminNuxeoCheck = checkDatabaseCsadminNuxeo(repoName, cspaceInstanceId); + checks.put("database:csadmin_nuxeo:" + repoName, csadminNuxeoCheck); + if ("fail".equals(csadminNuxeoCheck.get("status"))) { + hasWarn = true; + } + } + + // Check: elasticsearch (optional) + Map esCheck = checkElasticsearch(); + checks.put("elasticsearch", esCheck); + if ("fail".equals(esCheck.get("status"))) { + hasWarn = true; + } + + // Overall status + String overall; + if (requiredFailed) { + overall = "fail"; + root.put("output", firstFailingCheckMessage(checks)); + } else if (hasWarn) { + overall = "warn"; + } else { + overall = "pass"; + } + root.put("status", overall); + + String json = new ObjectMapper().writeValueAsString(root); + int statusCode = "fail".equals(overall) ? 503 : 200; + return Response.status(statusCode).entity(json).type(MediaType.APPLICATION_JSON).build(); + + } catch (Throwable t) { + logger.error("Error building health response", t); + Map failRoot = new LinkedHashMap<>(); + failRoot.put("status", "fail"); + failRoot.put("description", DESCRIPTION); + failRoot.put("output", t.getMessage() != null ? t.getMessage() : t.getClass().getSimpleName()); + try { + String json = new ObjectMapper().writeValueAsString(failRoot); + return Response.status(503).entity(json).type(MediaType.APPLICATION_JSON).build(); + } catch (Exception e) { + return Response.status(503).entity("{\"status\":\"fail\",\"output\":\"Error serializing response\"}") + .type(MediaType.APPLICATION_JSON).build(); + } + } + } + + private String getApplicationVersion() { + String v = SystemInfoResource.class.getPackage().getImplementationVersion(); + return v != null ? v : "unknown"; + } + + private String readGitCommitId() { + try (InputStream in = getClass().getClassLoader().getResourceAsStream("git.properties")) { + if (in == null) { + return "unknown"; + } + Properties props = new Properties(); + props.load(in); + String abbrev = props.getProperty("git.commit.id.abbrev"); + return abbrev != null ? abbrev : "unknown"; + } catch (IOException e) { + return "unknown"; + } + } + + private String getServiceId() { + try { + return ServiceMain.getInstance().getCspaceInstanceId(); + } catch (Exception e) { + return "unknown"; + } + } + + private String resolveFirstRepositoryName() { + List all = resolveAllRepositoryNames(); + return all.isEmpty() ? null : all.get(0); + } + + /** + * Returns all repository names from tenant bindings (deduplicated). + */ + private List resolveAllRepositoryNames() { + List result = new ArrayList<>(); + try { + TenantBindingConfigReaderImpl reader = ServiceMain.getInstance().getTenantBindingConfigReader(); + Hashtable bindings = reader.getTenantBindings(); + if (bindings == null || bindings.isEmpty()) { + return result; + } + for (TenantBindingType tenant : bindings.values()) { + List repoList = ConfigUtils.getRepositoryNameList(tenant); + if (repoList != null) { + for (String repoName : repoList) { + if (repoName != null && !result.contains(repoName)) { + result.add(repoName); + } + } + } + } + } catch (Exception e) { + logger.debug("Could not resolve repository names", e); + } + return result; + } + + /** + * Runs a database health check: obtains a connection via the supplier, + * executes SELECT 1, reads product/version from metadata, and returns + * a check map with status pass/fail/disabled. When {@code namingExceptionAsDisabled} + * is true, NamingException results in status "disabled" instead of "fail". + */ + private Map checkDatabase(Callable connectionSupplier, + boolean namingExceptionAsDisabled) { + Map check = new LinkedHashMap<>(); + check.put("componentType", "datastore"); + Connection conn = null; + try { + conn = connectionSupplier.call(); + try (Statement stmt = conn.createStatement()) { + stmt.executeQuery("SELECT 1"); + } + DatabaseMetaData meta = conn.getMetaData(); + String product = meta.getDatabaseProductName(); + String version = meta.getDatabaseProductVersion(); + check.put("status", "pass"); + check.put("observedValue", product + " " + version); + } catch (NamingException e) { + if (namingExceptionAsDisabled) { + check.put("status", "disabled"); + check.put("output", "datasource not configured"); + } else { + check.put("status", "fail"); + check.put("output", e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName()); + } + } catch (Exception e) { + check.put("status", "fail"); + check.put("output", e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName()); + } finally { + if (conn != null) { + try { + conn.close(); + } catch (Exception e) { + logger.trace("Error closing connection", e); + } + } + } + return check; + } + + private Map checkDatabaseCspace() { + return checkDatabase(() -> { + DataSource ds = JDBCTools.getDataSource(JDBCTools.CSPACE_DATASOURCE_NAME); + return ds.getConnection(); + }, false); + } + + private Map checkDatabaseCsadmin() { + return checkDatabase(() -> { + DataSource ds = JDBCTools.getDataSource(JDBCTools.CSADMIN_DATASOURCE_NAME); + return ds.getConnection(); + }, true); + } + + private Map checkDatabaseNuxeo(String repositoryName, String cspaceInstanceId) { + return checkDatabase( + () -> JDBCTools.getConnection(JDBCTools.NUXEO_DATASOURCE_NAME, repositoryName, cspaceInstanceId), + false); + } + + private Map checkDatabaseNuxeoReader(String repositoryName, String cspaceInstanceId) { + return checkDatabase( + () -> JDBCTools.getConnection(JDBCTools.NUXEO_READER_DATASOURCE_NAME, repositoryName, cspaceInstanceId), + true); + } + + private Map checkDatabaseCsadminNuxeo(String repositoryName, String cspaceInstanceId) { + return checkDatabase( + () -> JDBCTools.getConnection(JDBCTools.CSADMIN_NUXEO_DATASOURCE_NAME, repositoryName, cspaceInstanceId), + true); + } + + private Map checkNuxeoRepository(String repoName) { + Map check = new LinkedHashMap<>(); + check.put("componentType", "component"); + CoreSessionInterface session = null; + try { + NuxeoConnectorEmbedded connector = NuxeoConnectorEmbedded.getInstance(); + session = connector.getClient().openRepository(repoName, ServiceContext.DEFAULT_TX_TIMEOUT); + session.getRepositoryName(); + check.put("status", "pass"); + check.put("observedValue", repoName); + } catch (Exception e) { + check.put("status", "fail"); + check.put("output", e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName()); + } finally { + if (session != null) { + try { + NuxeoConnectorEmbedded.getInstance().releaseRepositorySession(session); + } catch (Exception e) { + logger.trace("Error releasing repository session", e); + } + } + } + return check; + } + + private Map checkElasticsearch() { + Map check = new LinkedHashMap<>(); + if (!Framework.isBooleanPropertyTrue("elasticsearch.enabled")) { + check.put("status", "disabled"); + return check; + } + try { + ElasticSearchComponent es = (ElasticSearchComponent) Framework.getService(ElasticSearchService.class); + Object client = es != null ? es.getClient() : null; + if (client != null) { + check.put("status", "pass"); + } else { + check.put("status", "fail"); + check.put("output", "Elasticsearch client not available"); + } + } catch (Exception e) { + check.put("status", "fail"); + check.put("output", e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName()); + } + return check; + } + + private String firstFailingCheckMessage(Map checks) { + for (Map.Entry entry : checks.entrySet()) { + if (entry.getValue() instanceof Map) { + @SuppressWarnings("unchecked") + Map c = (Map) entry.getValue(); + if ("fail".equals(c.get("status"))) { + return entry.getKey() + " check failed"; + } + } + } + return "health check failed"; + } +} From 89cf292b1a9c350559bf70057397149d3b208010 Mon Sep 17 00:00:00 2001 From: mglyrasis <129785358+mglyrasis@users.noreply.github.com> Date: Tue, 28 Apr 2026 08:25:56 -0600 Subject: [PATCH 07/40] Fix resource name retrieval in SecurityInterceptor --- .../services/common/security/SecurityInterceptor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 48a5625dc3..e89a3f34ec 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 @@ -105,7 +105,7 @@ public class SecurityInterceptor implements ContainerRequestFilter, ContainerRes private boolean isAnonymousRequest(ContainerRequestContext requestContext) { boolean result = false; - String resName = SecurityUtils.getResourceName(request.getUri()).toLowerCase(); + String resName = SecurityUtils.getResourceName(requestContext.getUriInfo()); switch (resName) { case AuthZ.PASSWORD_RESET: case AuthZ.PROCESS_PASSWORD_RESET: From 8b5a470fd19a7c838392d0f1477f7b7f3cdb9fdb Mon Sep 17 00:00:00 2001 From: mglyrasis <129785358+mglyrasis@users.noreply.github.com> Date: Tue, 28 Apr 2026 11:07:09 -0600 Subject: [PATCH 08/40] Refactor database checks --- .../common/security/SecurityInterceptor.java | 2 +- .../services/systeminfo/HealthResource.java | 68 +++++++------------ 2 files changed, 24 insertions(+), 46 deletions(-) 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 e89a3f34ec..bddc57641a 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 @@ -105,7 +105,7 @@ public class SecurityInterceptor implements ContainerRequestFilter, ContainerRes private boolean isAnonymousRequest(ContainerRequestContext requestContext) { boolean result = false; - String resName = SecurityUtils.getResourceName(requestContext.getUriInfo()); + String resName = SecurityUtils.getResourceName(requestContext.getUriInfo()).toLowerCase(); switch (resName) { case AuthZ.PASSWORD_RESET: case AuthZ.PROCESS_PASSWORD_RESET: diff --git a/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/HealthResource.java b/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/HealthResource.java index 8d784dd678..1d8f628ebf 100644 --- a/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/HealthResource.java +++ b/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/HealthResource.java @@ -56,17 +56,12 @@ public Response get() { root.put("checks", checks); try { + String cspaceInstanceId = getServiceId(); + root.put("description", DESCRIPTION); root.put("version", getApplicationVersion()); root.put("releaseId", readGitCommitId()); - root.put("serviceId", getServiceId()); - - String cspaceInstanceId = null; - try { - cspaceInstanceId = ServiceMain.getInstance().getCspaceInstanceId(); - } catch (Exception e) { - logger.debug("Could not get instance id", e); - } + root.put("serviceId", cspaceInstanceId); List repoNames = resolveAllRepositoryNames(); String firstRepoName = repoNames.isEmpty() ? null : repoNames.get(0); @@ -74,14 +69,16 @@ public Response get() { boolean hasWarn = false; // Check: database:cspace (required) - Map cspaceCheck = checkDatabaseCspace(); + Map cspaceCheck = checkDatabaseByDatasource(JDBCTools.CSPACE_DATASOURCE_NAME, false, null, + null); checks.put("database:cspace", cspaceCheck); if ("fail".equals(cspaceCheck.get("status"))) { requiredFailed = true; } // Check: database:csadmin (optional) - Map csadminCheck = checkDatabaseCsadmin(); + Map csadminCheck = checkDatabaseByDatasource(JDBCTools.CSADMIN_DATASOURCE_NAME, true, null, + null); checks.put("database:csadmin", csadminCheck); if ("fail".equals(csadminCheck.get("status"))) { hasWarn = true; @@ -96,7 +93,8 @@ public Response get() { hasWarn = true; } else { for (String repoName : repoNames) { - Map nuxeoDbCheck = checkDatabaseNuxeo(repoName, cspaceInstanceId); + Map nuxeoDbCheck = checkDatabaseByDatasource(JDBCTools.NUXEO_DATASOURCE_NAME, false, + repoName, cspaceInstanceId); checks.put("database:nuxeo:" + repoName, nuxeoDbCheck); if ("fail".equals(nuxeoDbCheck.get("status"))) { requiredFailed = true; @@ -121,7 +119,8 @@ public Response get() { // Check: database:nuxeo_reader per repository (optional) for (String repoName : repoNames) { - Map readerCheck = checkDatabaseNuxeoReader(repoName, cspaceInstanceId); + Map readerCheck = checkDatabaseByDatasource(JDBCTools.NUXEO_READER_DATASOURCE_NAME, + true, repoName, cspaceInstanceId); checks.put("database:nuxeo_reader:" + repoName, readerCheck); if ("fail".equals(readerCheck.get("status"))) { hasWarn = true; @@ -130,7 +129,8 @@ public Response get() { // Check: database:csadmin_nuxeo per repository (optional) for (String repoName : repoNames) { - Map csadminNuxeoCheck = checkDatabaseCsadminNuxeo(repoName, cspaceInstanceId); + Map csadminNuxeoCheck = checkDatabaseByDatasource( + JDBCTools.CSADMIN_NUXEO_DATASOURCE_NAME, true, repoName, cspaceInstanceId); checks.put("database:csadmin_nuxeo:" + repoName, csadminNuxeoCheck); if ("fail".equals(csadminNuxeoCheck.get("status"))) { hasWarn = true; @@ -203,11 +203,6 @@ private String getServiceId() { } } - private String resolveFirstRepositoryName() { - List all = resolveAllRepositoryNames(); - return all.isEmpty() ? null : all.get(0); - } - /** * Returns all repository names from tenant bindings (deduplicated). */ @@ -279,36 +274,19 @@ private Map checkDatabase(Callable connectionSupplie return check; } - private Map checkDatabaseCspace() { - return checkDatabase(() -> { - DataSource ds = JDBCTools.getDataSource(JDBCTools.CSPACE_DATASOURCE_NAME); - return ds.getConnection(); - }, false); + private Map checkDatabaseByDatasource(String datasourceName, boolean namingExceptionAsDisabled, + String repositoryName, String cspaceInstanceId) { + return checkDatabase(() -> getConnectionForDatasource(datasourceName, repositoryName, cspaceInstanceId), + namingExceptionAsDisabled); } - private Map checkDatabaseCsadmin() { - return checkDatabase(() -> { - DataSource ds = JDBCTools.getDataSource(JDBCTools.CSADMIN_DATASOURCE_NAME); + private Connection getConnectionForDatasource(String datasourceName, String repositoryName, String cspaceInstanceId) + throws Exception { + if (repositoryName == null || cspaceInstanceId == null) { + DataSource ds = JDBCTools.getDataSource(datasourceName); return ds.getConnection(); - }, true); - } - - private Map checkDatabaseNuxeo(String repositoryName, String cspaceInstanceId) { - return checkDatabase( - () -> JDBCTools.getConnection(JDBCTools.NUXEO_DATASOURCE_NAME, repositoryName, cspaceInstanceId), - false); - } - - private Map checkDatabaseNuxeoReader(String repositoryName, String cspaceInstanceId) { - return checkDatabase( - () -> JDBCTools.getConnection(JDBCTools.NUXEO_READER_DATASOURCE_NAME, repositoryName, cspaceInstanceId), - true); - } - - private Map checkDatabaseCsadminNuxeo(String repositoryName, String cspaceInstanceId) { - return checkDatabase( - () -> JDBCTools.getConnection(JDBCTools.CSADMIN_NUXEO_DATASOURCE_NAME, repositoryName, cspaceInstanceId), - true); + } + return JDBCTools.getConnection(datasourceName, repositoryName, cspaceInstanceId); } private Map checkNuxeoRepository(String repoName) { From 864d61c5426acd33e28f5d975f6227be7bed65a1 Mon Sep 17 00:00:00 2001 From: mglyrasis <129785358+mglyrasis@users.noreply.github.com> Date: Tue, 28 Apr 2026 11:16:44 -0600 Subject: [PATCH 09/40] Hide `observedValue` in health check behind a flag --- .../services/systeminfo/HealthResource.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/HealthResource.java b/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/HealthResource.java index 1d8f628ebf..f6ff98576c 100644 --- a/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/HealthResource.java +++ b/services/systeminfo/service/src/main/java/org/collectionspace/services/systeminfo/HealthResource.java @@ -48,6 +48,7 @@ public class HealthResource { private static final Logger logger = LoggerFactory.getLogger(HealthResource.class); private static final String DESCRIPTION = "CollectionSpace Services"; + private static final String INCLUDE_OBSERVED_VALUE_PROPERTY = "cspace.health.includeObservedValue"; @GET public Response get() { @@ -250,7 +251,7 @@ private Map checkDatabase(Callable connectionSupplie String product = meta.getDatabaseProductName(); String version = meta.getDatabaseProductVersion(); check.put("status", "pass"); - check.put("observedValue", product + " " + version); + putObservedValueIfEnabled(check, product + " " + version); } catch (NamingException e) { if (namingExceptionAsDisabled) { check.put("status", "disabled"); @@ -298,7 +299,7 @@ private Map checkNuxeoRepository(String repoName) { session = connector.getClient().openRepository(repoName, ServiceContext.DEFAULT_TX_TIMEOUT); session.getRepositoryName(); check.put("status", "pass"); - check.put("observedValue", repoName); + putObservedValueIfEnabled(check, repoName); } catch (Exception e) { check.put("status", "fail"); check.put("output", e.getMessage() != null ? e.getMessage() : e.getClass().getSimpleName()); @@ -348,4 +349,10 @@ private String firstFailingCheckMessage(Map checks) { } return "health check failed"; } + + private void putObservedValueIfEnabled(Map check, String observedValue) { + if (Framework.isBooleanPropertyTrue(INCLUDE_OBSERVED_VALUE_PROPERTY)) { + check.put("observedValue", observedValue); + } + } } From f1578b9533f4b3c93d1a303264e945dbfabb7a7f Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Mon, 18 May 2026 15:40:37 +0300 Subject: [PATCH 10/40] DRYD-2114: dropped patch version of cspace-ui.js and profile plugins; --- build.properties | 2 +- cspace-ui/anthro/build.properties | 2 +- cspace-ui/bonsai/build.properties | 2 +- cspace-ui/botgarden/build.properties | 2 +- cspace-ui/fcart/build.properties | 2 +- cspace-ui/herbarium/build.properties | 2 +- cspace-ui/lhmc/build.properties | 2 +- cspace-ui/materials/build.properties | 2 +- cspace-ui/publicart/build.properties | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build.properties b/build.properties index dd3cfed77e..4872ae4d0f 100644 --- a/build.properties +++ b/build.properties @@ -27,7 +27,7 @@ cspace.im.root= # UI settings cspace.ui.package.name=cspace-ui cspace.ui.library.name=cspaceUI -cspace.ui.version=10.2.0 +cspace.ui.version=10.2 cspace.ui.build.branch=develop cspace.ui.build.node.ver=20 service.ui.library.name=${cspace.ui.library.name}-service diff --git a/cspace-ui/anthro/build.properties b/cspace-ui/anthro/build.properties index 6918948acf..31343c863e 100644 --- a/cspace-ui/anthro/build.properties +++ b/cspace-ui/anthro/build.properties @@ -3,7 +3,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-anthro tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileAnthro -tenant.ui.profile.plugin.version=9.2.0 +tenant.ui.profile.plugin.version=9.2 tenant.ui.profile.plugin.build.branch=main # If not set, defaults to /gateway/${tenant.shortname} on the current host. diff --git a/cspace-ui/bonsai/build.properties b/cspace-ui/bonsai/build.properties index ddccc4ad7c..fceb3892b9 100644 --- a/cspace-ui/bonsai/build.properties +++ b/cspace-ui/bonsai/build.properties @@ -3,7 +3,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-bonsai tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileBonsai -tenant.ui.profile.plugin.version=7.1.0 +tenant.ui.profile.plugin.version=7.1 tenant.ui.profile.plugin.build.branch=main # If not set, defaults to /gateway/${tenant.shortname} on the current host. diff --git a/cspace-ui/botgarden/build.properties b/cspace-ui/botgarden/build.properties index 8d4f3690b8..11a4bec410 100644 --- a/cspace-ui/botgarden/build.properties +++ b/cspace-ui/botgarden/build.properties @@ -3,7 +3,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-botgarden tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileBotGarden -tenant.ui.profile.plugin.version=4.0.0 +tenant.ui.profile.plugin.version=4.0 tenant.ui.profile.plugin.build.branch=main # If not set, defaults to /gateway/${tenant.shortname} on the current host. diff --git a/cspace-ui/fcart/build.properties b/cspace-ui/fcart/build.properties index c8a03e3047..65689ca635 100644 --- a/cspace-ui/fcart/build.properties +++ b/cspace-ui/fcart/build.properties @@ -3,7 +3,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-fcart tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileFCart -tenant.ui.profile.plugin.version=8.2.0 +tenant.ui.profile.plugin.version=8.2 tenant.ui.profile.plugin.build.branch=main # If not set, defaults to /gateway/${tenant.shortname} on the current host. diff --git a/cspace-ui/herbarium/build.properties b/cspace-ui/herbarium/build.properties index 853026cb1e..09bc8d6b3c 100644 --- a/cspace-ui/herbarium/build.properties +++ b/cspace-ui/herbarium/build.properties @@ -3,7 +3,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-herbarium tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileHerbarium -tenant.ui.profile.plugin.version=3.0.0 +tenant.ui.profile.plugin.version=3.0 tenant.ui.profile.plugin.build.branch=main # If not set, defaults to /gateway/${tenant.shortname} on the current host. diff --git a/cspace-ui/lhmc/build.properties b/cspace-ui/lhmc/build.properties index 8578173070..e847b2cfaa 100644 --- a/cspace-ui/lhmc/build.properties +++ b/cspace-ui/lhmc/build.properties @@ -3,7 +3,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-lhmc tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileLHMC -tenant.ui.profile.plugin.version=8.2.0 +tenant.ui.profile.plugin.version=8.2 tenant.ui.profile.plugin.build.branch=main # If not set, defaults to /gateway/${tenant.shortname} on the current host. diff --git a/cspace-ui/materials/build.properties b/cspace-ui/materials/build.properties index b3e3d3b5db..cd5f30ca0d 100644 --- a/cspace-ui/materials/build.properties +++ b/cspace-ui/materials/build.properties @@ -3,7 +3,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-materials tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileMaterials -tenant.ui.profile.plugin.version=4.1.1 +tenant.ui.profile.plugin.version=4.1 tenant.ui.profile.plugin.build.branch=main # If not set, defaults to /gateway/${tenant.shortname} on the current host. diff --git a/cspace-ui/publicart/build.properties b/cspace-ui/publicart/build.properties index 22bf16f80b..5c829c64a6 100644 --- a/cspace-ui/publicart/build.properties +++ b/cspace-ui/publicart/build.properties @@ -3,7 +3,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-publicart tenant.ui.profile.plugin.library.name=cspaceUIPluginProfilePublicArt -tenant.ui.profile.plugin.version=7.1.0 +tenant.ui.profile.plugin.version=7.1 tenant.ui.profile.plugin.build.branch=main # If not set, defaults to /gateway/${tenant.shortname} on the current host. From ba408018d06f86c6845c5844c8ae3bdf7dd3a41e Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Mon, 18 May 2026 17:59:43 +0300 Subject: [PATCH 11/40] DRYD-2114: dropped patch version of cspace public browser; --- build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.properties b/build.properties index 4872ae4d0f..b5721cc896 100644 --- a/build.properties +++ b/build.properties @@ -35,7 +35,7 @@ service.ui.library.name=${cspace.ui.library.name}-service # Public browser settings cspace.public.browser.package.name=@collectionspace/cspace-public-browser cspace.public.browser.library.name=cspacePublicBrowser -cspace.public.browser.version=3.5.0 +cspace.public.browser.version=3.5 cspace.public.browser.build.branch=main cspace.public.browser.build.node.ver=20 From 4ed8565cd07c2d5bf44e2e87c3046e59521171e3 Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Fri, 29 May 2026 12:50:29 -0600 Subject: [PATCH 12/40] DRYD-1633: Core Dependency Updates (#535) * Update compile target to Java 17 * Update to Nuxeo 2023 * Update to RESTEasy 5 * Update to Hibernate 5.6 --------- Co-authored-by: Anthony Bucci --- 3rdparty/ant/build.xml | 23 ++ 3rdparty/ant/pom.xml | 22 ++ .../DefaultESDocumentWriter.java | 161 ++++---- .../TenantConfiguredESDocumentWriter.java | 16 +- .../anthro/AnthroESDocumentWriter.java | 2 +- .../materials/MaterialsESDocumentWriter.java | 79 ++-- .../naturalhistory/pom.xml | 5 - .../UpdateFormattedDisplayNameListener.java | 2 +- .../nuxeo/nuxeo-platform-listener/pom.xml | 11 - .../tenants/botgarden/pom.xml | 9 +- .../botgarden/UpdateAccessCodeListener.java | 2 +- .../botgarden/UpdateDeadFlagListener.java | 2 +- .../botgarden/UpdateRareFlagListener.java | 2 +- .../botgarden/UpdateStyledNameListener.java | 2 +- .../nuxeo-platform-listener/tenants/pom.xml | 11 - .../updateimagederivatives/pom.xml | 8 +- .../AbstractUpdateObjectLocationValues.java | 14 +- .../UpdateObjectLocationAndCrateOnMove.java | 6 +- .../listener/UpdateObjectLocationOnMove.java | 4 +- .../nuxeo/nuxeo-platform-quote-api/pom.xml | 2 +- .../ecm/platform/quote/api/QuoteManager.java | 26 +- .../platform/quote/api/QuoteableDocument.java | 16 +- .../quote/impl/QuoteableDocumentAdapter.java | 14 +- .../services/QuotesModerationService.java | 22 +- 3rdparty/nuxeo/nuxeo-platform-quote/pom.xml | 20 +- .../platform/quote/ejb/QuoteManagerBean.java | 42 +-- .../quote/ejb/QuotesModerationBean.java | 12 +- .../quote/impl/QuoteConverterImpl.java | 8 +- .../platform/quote/impl/QuoteManagerImpl.java | 78 ++-- .../DocumentRemovedQuoteEventListener.java | 4 +- .../listener/QuoteRemovedEventListener.java | 4 +- .../listener/test/SimpleListenerTest.java | 2 +- .../nuxeo/nuxeo-platform-thumbnail/pom.xml | 5 - .../thumbnail/AddThumbnailUnrestricted.java | 4 +- .../nuxeo/extension/thumbnail/Thumbnail.java | 4 +- .../thumbnail/ThumbnailConverter.java | 2 +- .../thumbnail/UpdateThumbListener.java | 4 +- .../org/nuxeo/platform/thumbnail/App.java | 13 - .../disable-picture-listener-config.xml | 10 + .../9.10-HF30/config/logmanager-config.xml | 8 + .../9.10-HF30/config/nuxeo.properties | 5 + .../config/proto-elasticsearch-extension.xml | 7 +- .../9.10-HF30/config/trashservice-config.xml | 12 + 3rdparty/nuxeo/nuxeo-server/pom.xml | 146 +------- 3rdparty/pom.xml | 24 +- build.xml | 47 ++- cspace-ui/build.xml | 20 +- pom.xml | 276 +++++++------- services/IntegrationTests/pom.xml | 8 +- .../test/CollectionSpaceIntegrationTest.java | 21 -- .../test/RelationIntegrationTest.java | 9 +- .../xmlreplay/vocabulary/vocabulary.xml | 2 +- services/JaxRsServiceProvider/build.xml | 2 - services/JaxRsServiceProvider/pom.xml | 43 +-- .../jaxrs/CSpaceResteasyBootstrap.java | 2 +- .../CollectionSpaceJaxRsApplication.java | 6 +- .../main/resources/META-INF/persistence.xml | 31 +- services/PerformanceTests/pom.xml | 6 +- .../test/CollectionSpacePerformanceTest.java | 36 +- services/account/client/build.xml | 14 +- services/account/client/pom.xml | 15 +- .../client/test/AccountRoleServiceTest.java | 6 +- .../account/client/test/AccountTest.java | 2 +- .../test/resources/META-INF/persistence.xml | 8 +- .../src/test/resources/hibernate.cfg.xml | 24 -- services/account/jaxb/pom.xml | 44 +-- .../services/account/AccountListItem.java | 131 +++++++ .../services/account/AccountTenant.java | 68 ++++ .../services/account/AccountsCommon.java | 290 ++++++++++++++ .../services/account/AccountsCommonList.java | 34 ++ .../services/account/RoleList.java | 31 ++ .../services/account/RoleValue.java | 67 ++++ .../services/account/Status.java | 35 ++ .../services/account/Tenant.java | 145 +++++++ .../services/account/TenantListItem.java | 45 +++ .../services/account/TenantsList.java | 35 ++ .../services/account/package-info.java | 2 + .../src/main/resources/accounts_common.xsd | 353 ------------------ .../main/resources/accounts_common_list.xsd | 118 ------ .../jaxb/src/main/resources/bindings.xml | 17 - .../jaxb/src/main/resources/instance1.xml | 43 --- .../services/account/jaxb.index | 10 + services/account/pstore/build.xml | 44 +-- services/account/pstore/pom.xml | 123 ------ .../test/resources/META-INF/persistence.xml | 20 - .../src/test/resources/hibernate.cfg.xml | 24 -- services/account/service/pom.xml | 6 +- .../services/account/AccountResource.java | 2 +- .../storage/AccountDocumentHandler.java | 2 +- .../account/storage/AccountStorageClient.java | 2 +- .../storage/TenantDocumentHandler.java | 2 +- .../account/storage/TenantStorageClient.java | 2 +- .../storage/csidp/TokenStorageClient.java | 4 +- .../storage/csidp/UserStorageClient.java | 6 +- services/acquisition/client/pom.xml | 6 +- services/acquisition/jaxb/pom.xml | 23 +- .../main/resources/acquisitions_common.xsd | 7 +- services/advancedsearch/client/pom.xml | 8 +- services/advancedsearch/jaxb/pom.xml | 4 +- .../main/resources/advanced-search_common.xsd | 4 +- services/advancedsearch/service/pom.xml | 6 +- .../advancedsearch/AdvancedSearch.java | 4 +- .../AdvancedSearchJAXBContext.java | 4 +- .../mapper/CollectionObjectMapper.java | 4 +- services/authentication/client/.gitignore | 2 - services/authentication/client/build.xml | 139 ------- services/authentication/client/pom.xml | 59 --- .../test/resources/META-INF/persistence.xml | 18 - .../src/test/resources/hibernate.cfg.xml | 24 -- services/authentication/jaxb/pom.xml | 39 +- .../authentication/Passwordreset.java | 35 ++ .../services/authentication/Token.java | 144 +++++++ .../services/authentication/User.java | 132 +++++++ .../services/authentication/package-info.java | 4 + .../authentication_identity_provider.xsd | 208 ----------- .../services/authentication/jaxb.index | 3 + .../test/resources/META-INF/persistence.xml | 17 - .../jaxb/src/test/resources/hibernate.cfg.xml | 24 -- services/authentication/pom.xml | 1 - services/authentication/pstore/build.xml | 61 --- services/authentication/pstore/pom.xml | 111 ------ .../test/resources/META-INF/persistence.xml | 18 - .../src/test/resources/hibernate.cfg.xml | 24 -- services/authority/jaxb/pom.xml | 12 +- services/authority/pom.xml | 8 +- services/authority/service/pom.xml | 39 +- .../nuxeo/AuthorityDocumentModelHandler.java | 4 +- .../AuthorityItemDocumentModelHandler.java | 7 +- services/authorization-mgt/client/pom.xml | 19 +- .../client/test/RoleServiceTest.java | 16 +- services/authorization-mgt/import/build.xml | 14 +- services/authorization-mgt/import/pom.xml | 246 +++++------- .../java/org/collectionspace/ImportAuthz.java | 10 +- .../driver/AuthorizationSeedDriver.java | 92 ++--- .../importer/AuthorizationGen.java | 43 +-- .../importer/AuthorizationSeed.java | 28 +- .../main/resources/META-INF/persistence.xml | 14 +- .../src/main/resources/hibernate.cfg.xml | 24 -- services/authorization-mgt/jaxb/pom.xml | 22 +- services/authorization-mgt/service/pom.xml | 10 +- .../authorization/PermissionResource.java.txt | 254 ------------- .../services/authorization/RoleResource.java | 2 +- .../PermissionDocumentHandler.java.txt | 1 - .../storage/PermissionValidatorHandler.java | 10 +- .../storage/RoleDocumentHandler.java | 13 +- services/authorization/jaxb/pom.xml | 78 +--- .../authorization/AccountPermission.java | 47 +++ .../services/authorization/AccountRole.java | 58 +++ .../authorization/AccountRoleRel.java | 148 ++++++++ .../services/authorization/AccountValue.java | 59 +++ .../authorization/PermissionRole.java | 58 +++ .../authorization/PermissionRoleRel.java | 148 ++++++++ .../authorization/PermissionValue.java | 70 ++++ .../authorization/PermissionsRolesList.java | 32 ++ .../services/authorization/Role.java | 215 +++++++++++ .../services/authorization/RoleValue.java | 70 ++++ .../services/authorization/RolesList.java | 80 ++++ .../services/authorization/SubjectType.java | 19 + .../services/authorization/package-info.java | 4 + .../main/resources/accounts_permissions.xsd | 45 --- .../src/main/resources/accounts_roles.xsd | 180 --------- .../main/resources/authorization_common.xsd | 89 ----- .../jaxb/src/main/resources/bindings.xjb | 29 -- .../services/authorization/jaxb.index | 12 + .../src/main/resources/permissions_roles.xsd | 158 -------- .../jaxb/src/main/resources/roles.xsd | 156 -------- .../jaxb/src/main/resources/roles_list.xsd | 60 --- services/authorization/pstore/build.xml | 53 --- services/authorization/pstore/pom.xml | 108 ------ .../test/resources/META-INF/persistence.xml | 21 -- .../src/test/resources/hibernate.cfg.xml | 24 -- services/authorization/service/pom.xml | 6 + .../applicationContext-authorization.xml | 2 +- services/batch/client/pom.xml | 6 +- services/batch/jaxb/pom.xml | 9 +- .../jaxb/src/main/resources/batch_common.xsd | 15 +- services/batch/service/pom.xml | 6 +- .../nuxeo/BatchDocumentModelHandler.java | 2 +- .../batch/nuxeo/ReindexFullTextBatchJob.java | 12 +- services/blob/jaxb/pom.xml | 4 +- services/blob/service/pom.xml | 6 +- .../blob/nuxeo/BlobDocumentModelHandler.java | 7 +- services/build.xml | 10 +- services/chronology/client/pom.xml | 6 +- services/chronology/jaxb/pom.xml | 9 +- .../src/main/resources/chronology_common.xsd | 3 +- .../resources/chronologyauthority_common.xsd | 3 +- services/chronology/service/pom.xml | 6 +- services/citation/client/pom.xml | 6 +- services/citation/jaxb/pom.xml | 14 +- .../src/main/resources/citation_common.xsd | 14 +- .../resources/citationauthority_common.xsd | 16 +- services/citation/pom.xml | 11 - services/citation/service/pom.xml | 6 +- services/claim/client/pom.xml | 6 +- services/claim/jaxb/pom.xml | 23 +- .../jaxb/src/main/resources/claims-common.xsd | 14 +- services/claim/service/pom.xml | 6 +- services/client/pom.xml | 18 +- .../client/AbstractServiceClientImpl.java | 97 ++--- .../client/CollectionSpaceClientUtils.java | 35 +- .../services/client/IQueryManager.java | 153 ++++---- .../services/client/PoxPayload.java | 66 ++-- .../services/client/test/BaseServiceTest.java | 45 +-- services/collectionobject/client/pom.xml | 6 +- services/collectionobject/jaxb/pom.xml | 20 +- .../resources/collectionobjects_common.xsd | 4 +- .../resources/collectionobjects_nagpra.xsd | 4 +- .../collectionobjects_naturalhistory.xsd | 4 +- services/collectionobject/service/pom.xml | 6 +- services/common-api/pom.xml | 11 +- .../services/common/api/FileTools.java | 37 +- services/common-http/pom.xml | 29 ++ .../common/jaxb/JAXBContextCache.java | 47 +++ .../common/provider/JakartaJAXBProvider.java | 103 +++++ services/common-test/pom.xml | 6 +- services/common/pom.xml | 77 ++-- .../anthro/anthro-tenant-bindings.delta.xml | 3 - .../bonsai/bonsai-tenant-bindings.delta.xml | 3 - .../fcart/fcart-tenant-bindings.delta.xml | 3 - .../lhmc/lhmc-tenant-bindings.delta.xml | 3 - .../materials-tenant-bindings.delta.xml | 3 - .../tenants/tenant-bindings-proto-unified.xml | 3 - ...CollectionSpaceServiceContextListener.java | 2 +- .../services/common/ServiceMain.java | 2 +- .../AuthorizationCommon.java | 23 +- .../authorization_mgt/AuthorizationStore.java | 4 +- .../common/context/ServiceBindingUtils.java | 4 +- .../common/document/DocumentUtils.java | 2 +- .../services/common/document/JaxbUtils.java | 52 +-- .../common/imaging/nuxeo/ImagePlugin.javax | 5 +- .../common/imaging/nuxeo/NuxeoBlobUtils.java | 271 ++++++++------ .../services/common/query/QueryManager.java | 28 +- .../query/nuxeo/QueryManagerNuxeoImpl.java | 39 +- .../common/relation/RelationUtils.java | 6 +- .../common/repository/RepositoryClient.java | 6 +- .../jpa/JpaRelationshipStorageClient.java | 2 +- .../storage/jpa/JpaStorageClientImpl.java | 4 +- .../common/storage/jpa/JpaStorageUtils.java | 10 +- .../vocabulary/RefNameServiceUtils.java | 130 ++++--- .../nuxeo/WorkflowDocumentModelHandler.java | 7 +- .../common/xmljson/XmlToJsonFilter.java | 4 +- .../client/handler/CSDocumentModelList.java | 6 +- .../nuxeo/client/java/CommonList.java | 8 +- .../client/java/CoreSessionInterface.java | 46 +-- .../nuxeo/client/java/CoreSessionWrapper.java | 42 +-- .../client/java/DocumentModelHandler.java | 8 +- .../client/java/NuxeoClientEmbedded.java | 38 +- .../client/java/NuxeoConnectorEmbedded.java | 4 +- .../client/java/NuxeoDocumentException.java | 6 +- .../java/NuxeoRepositoryClientImpl.java | 57 ++- .../nuxeo/client/java/ObjectFactory.java | 2 +- .../java/RemoteDocumentModelHandlerImpl.java | 29 +- .../nuxeo/client/java/package-info.java | 2 +- .../listener/AbstractCSEventListenerImpl.java | 18 +- .../services/nuxeo/util/NuxeoUtils.java | 6 +- .../nuxeo/util/ReindexFulltextRoot.java | 10 +- .../common/test/AbstractSecurityTestBase.java | 2 +- .../common/test/SecurityUtilsTest.java | 2 +- services/concept/client/pom.xml | 6 +- services/concept/jaxb/pom.xml | 14 +- .../src/main/resources/concept_common.xsd | 14 +- .../resources/conceptauthority_common.xsd | 16 +- services/concept/service/pom.xml | 6 +- services/conditioncheck/client/pom.xml | 6 +- services/conditioncheck/jaxb/pom.xml | 22 +- .../main/resources/conditionchecks-common.xsd | 6 +- services/conditioncheck/service/pom.xml | 6 +- services/config/pom.xml | 30 +- .../config/AbstractConfigReaderImpl.java | 9 +- .../config/ServicesConfigReaderImplTest.java | 2 +- services/conservation/client/pom.xml | 6 +- services/conservation/jaxb/pom.xml | 22 +- .../main/resources/conservation-common.xsd | 6 +- services/conservation/service/pom.xml | 6 +- services/consultation/client/pom.xml | 8 +- services/consultation/jaxb/pom.xml | 14 +- .../main/resources/consultations_common.xsd | 3 +- services/consultation/service/pom.xml | 6 +- services/contact/client/pom.xml | 11 +- services/contact/jaxb/pom.xml | 23 +- .../src/main/resources/contacts-common.xsd | 7 +- services/contact/service/pom.xml | 6 +- services/deaccession/client/pom.xml | 13 +- services/deaccession/jaxb/pom.xml | 16 +- .../main/resources/deaccessions_common.xsd | 3 +- services/deaccession/service/pom.xml | 6 +- services/dimension/client/pom.xml | 6 +- services/dimension/jaxb/pom.xml | 9 +- .../src/main/resources/dimensions-common.xsd | 6 +- services/dimension/service/pom.xml | 6 +- services/dutyofcare/client/pom.xml | 6 +- services/dutyofcare/jaxb/pom.xml | 14 +- .../main/resources/dutiesofcare_common.xsd | 3 +- services/dutyofcare/service/pom.xml | 6 +- services/exhibition/client/pom.xml | 6 +- services/exhibition/jaxb/pom.xml | 16 +- .../src/main/resources/exhibitions-common.xsd | 6 +- services/exhibition/service/pom.xml | 6 +- services/exit/client/pom.xml | 11 +- services/exit/jaxb/pom.xml | 14 +- .../jaxb/src/main/resources/exits_common.xsd | 4 +- services/exit/service/pom.xml | 6 +- services/export/client/pom.xml | 6 +- services/export/jaxb/pom.xml | 4 +- .../src/main/resources/exports-common.xsd | 12 +- services/export/service/pom.xml | 2 +- services/group/client/pom.xml | 6 +- services/group/jaxb/pom.xml | 16 +- .../jaxb/src/main/resources/groups_common.xsd | 7 +- services/group/service/pom.xml | 6 +- services/heldintrust/client/pom.xml | 13 +- services/heldintrust/jaxb/pom.xml | 16 +- .../main/resources/heldintrusts_common.xsd | 3 +- services/heldintrust/service/pom.xml | 6 +- services/hyperjaxb/pom.xml | 43 +-- .../authorization/perms/ActionType.java | 26 ++ .../authorization/perms/EffectType.java | 19 + .../authorization/perms/Permission.java | 247 ++++++++++++ .../authorization/perms/PermissionAction.java | 101 +++++ .../authorization/perms/PermissionsList.java | 79 ++++ .../authorization/perms/package-info.java | 4 + .../hyperjaxb/src/main/resources/bindings.xjb | 18 - .../services/authorization/perms/jaxb.index | 2 + .../src/main/resources/permissions.xsd | 219 ----------- .../src/main/resources/permissions_list.xsd | 55 --- services/id/jaxb/pom.xml | 8 +- services/imports/jaxb/pom.xml | 16 +- .../src/main/resources/imports_common.xsd | 6 +- services/imports/service/pom.xml | 16 +- services/index/client/pom.xml | 6 +- services/index/jaxb/pom.xml | 16 +- .../jaxb/src/main/resources/index-common.xsd | 7 +- services/index/service/pom.xml | 6 +- services/insurance/client/pom.xml | 6 +- services/insurance/jaxb/pom.xml | 14 +- .../src/main/resources/insurances_common.xsd | 5 +- services/insurance/service/pom.xml | 6 +- services/intake/client/pom.xml | 6 +- services/intake/jaxb/pom.xml | 16 +- .../src/main/resources/intakes-common.xsd | 4 +- services/intake/service/pom.xml | 6 +- services/iterationreport/client/pom.xml | 6 +- services/iterationreport/jaxb/pom.xml | 20 +- .../resources/iterationreports_common.xsd | 4 +- services/iterationreport/service/pom.xml | 6 +- services/jaxb/pom.xml | 13 +- .../services/jaxb/adapter/DateAdapter.java | 24 ++ .../jaxb/src/main/resources/authorityref.xsd | 4 +- .../src/main/resources/authorityrefdocs.xsd | 4 +- services/jaxb/src/main/resources/bindings.xjb | 14 + services/jaxb/src/main/resources/bindings.xml | 17 - .../jaxb/src/main/resources/blobs_common.xsd | 7 +- .../main/resources/collectionspace_core.xsd | 3 +- .../jaxb/src/main/resources/index_common.xsd | 7 +- .../src/main/resources/invocationContext.xsd | 5 +- .../src/main/resources/invocationResults.xsd | 12 +- .../jaxb/src/main/resources/lifecycle.xsd | 10 +- .../src/main/resources/relations_common.xsd | 10 +- .../main/resources/service_description.xsd | 6 +- .../src/main/resources/workflow_common.xsd | 6 +- .../jaxb/adapter/DateAdapterTest.java | 26 ++ services/loanin/client/pom.xml | 6 +- services/loanin/jaxb/pom.xml | 16 +- .../src/main/resources/loansin-common.xsd | 6 +- services/loanin/service/pom.xml | 6 +- services/loanout/client/pom.xml | 6 +- services/loanout/jaxb/pom.xml | 16 +- .../src/main/resources/loansout-common.xsd | 6 +- services/loanout/service/pom.xml | 6 +- services/location/client/pom.xml | 6 +- services/location/jaxb/pom.xml | 14 +- .../src/main/resources/location_common.xsd | 15 +- .../resources/locationauthority_common.xsd | 17 +- services/location/service/pom.xml | 6 +- services/login/service/pom.xml | 2 +- services/logout/service/pom.xml | 2 +- services/material/client/pom.xml | 6 +- services/material/jaxb/pom.xml | 28 +- .../src/main/resources/material_common.xsd | 18 +- .../resources/materialauthority_common.xsd | 17 +- services/material/service/pom.xml | 6 +- services/media/client/pom.xml | 6 +- services/media/jaxb/pom.xml | 16 +- .../jaxb/src/main/resources/media_common.xsd | 6 +- services/media/service/pom.xml | 6 +- services/movement/client/pom.xml | 6 +- services/movement/jaxb/pom.xml | 16 +- .../src/main/resources/movements-common.xsd | 6 +- services/movement/service/pom.xml | 6 +- services/nagpra-jaxb/pom.xml | 14 +- .../src/main/resources/nagpra_common.xsd | 3 +- services/nagprainventory/client/pom.xml | 13 +- services/nagprainventory/jaxb/pom.xml | 16 +- .../main/resources/nagprainventory_common.xsd | 4 +- services/nagprainventory/pom.xml | 2 +- services/nagprainventory/service/pom.xml | 6 +- services/note/client/pom.xml | 6 +- services/note/jaxb/pom.xml | 4 +- services/note/service/pom.xml | 6 +- services/objectexit/client/pom.xml | 6 +- services/objectexit/jaxb/pom.xml | 16 +- .../src/main/resources/objectexit_common.xsd | 6 +- services/objectexit/service/pom.xml | 6 +- services/organization/client/pom.xml | 6 +- services/organization/jaxb/pom.xml | 14 +- .../main/resources/organization_common.xsd | 12 +- .../main/resources/orgauthority_common.xsd | 17 +- services/organization/service/pom.xml | 6 +- services/osteology/client/pom.xml | 6 +- services/osteology/jaxb/pom.xml | 14 +- .../src/main/resources/osteology-common.xsd | 4 +- services/osteology/service/pom.xml | 6 +- services/person/client/pom.xml | 12 +- services/person/jaxb/pom.xml | 9 +- .../jaxb/src/main/resources/person_common.xsd | 15 +- .../main/resources/personauthority_common.xsd | 17 +- services/person/service/pom.xml | 6 +- services/place/client/pom.xml | 6 +- services/place/jaxb/pom.xml | 17 +- .../jaxb/src/main/resources/place_common.xsd | 15 +- .../main/resources/placeauthority_common.xsd | 17 +- services/place/service/pom.xml | 6 +- services/pom.xml | 108 +----- services/pottag/client/pom.xml | 6 +- services/pottag/jaxb/pom.xml | 16 +- .../src/main/resources/pottags-common.xsd | 6 +- services/pottag/service/pom.xml | 6 +- services/propagation/client/pom.xml | 6 +- services/propagation/jaxb/pom.xml | 16 +- .../main/resources/propagations-common.xsd | 6 +- services/propagation/service/pom.xml | 6 +- .../resources/schemas/publicitems_common.xsd | 13 +- services/publicitem/client/pom.xml | 6 +- services/publicitem/jaxb/pom.xml | 16 +- .../src/main/resources/publicitems-common.xsd | 8 +- services/publicitem/service/pom.xml | 6 +- services/query/service/pom.xml | 6 +- services/relation/client/pom.xml | 6 +- services/relation/service/pom.xml | 6 +- .../services/relation/RelationResource.txt | 3 - .../nuxeo/RelationDocumentModelHandler.java | 8 +- services/repatriationrequest/client/pom.xml | 13 +- services/repatriationrequest/jaxb/pom.xml | 11 +- .../resources/repatriationrequests_common.xsd | 4 +- services/repatriationrequest/service/pom.xml | 8 +- services/report/client/pom.xml | 6 +- services/report/jaxb/pom.xml | 4 +- .../src/main/resources/reports-common.xsd | 14 +- .../main/resources/reports-output-mime.xsd | 6 +- services/report/service/pom.xml | 6 +- .../CSpaceRepositoryService.java | 2 +- .../nuxeo/ReportDocumentModelHandler.java | 2 +- services/restrictedmedia/client/pom.xml | 6 +- services/restrictedmedia/jaxb/pom.xml | 16 +- .../main/resources/restrictedmedia_common.xsd | 3 +- services/restrictedmedia/pom.xml | 2 +- services/restrictedmedia/service/pom.xml | 6 +- services/security/client/pom.xml | 26 +- .../test/resources/META-INF/persistence.xml | 18 - .../src/test/resources/hibernate.cfg.xml | 24 -- services/servicegroup/client/pom.xml | 6 +- services/servicegroup/jaxb/pom.xml | 16 +- .../main/resources/servicegroup_common.xsd | 3 +- services/servicegroup/service/pom.xml | 6 +- services/structureddate/client/pom.xml | 6 +- services/structureddate/jaxb/pom.xml | 16 +- .../main/resources/structureddate-common.xsd | 4 +- services/structureddate/service/pom.xml | 6 +- services/summarydocumentation/client/pom.xml | 11 +- services/summarydocumentation/jaxb/pom.xml | 11 +- .../summarydocumentations_common.xsd | 3 +- services/summarydocumentation/service/pom.xml | 6 +- services/systeminfo/client/pom.xml | 6 +- services/systeminfo/jaxb/pom.xml | 16 +- .../src/main/resources/systeminfo-common.xsd | 14 +- services/systeminfo/service/pom.xml | 6 +- services/taxonomy/client/pom.xml | 6 +- services/taxonomy/jaxb/pom.xml | 13 +- .../jaxb/src/main/resources/taxon_common.xsd | 15 +- .../resources/taxonomyauthority_common.xsd | 17 +- services/taxonomy/service/pom.xml | 6 +- services/transport/client/pom.xml | 6 +- services/transport/jaxb/pom.xml | 14 +- .../src/main/resources/transports-common.xsd | 4 +- services/transport/service/pom.xml | 6 +- services/uoc/client/pom.xml | 6 +- services/uoc/jaxb/pom.xml | 16 +- .../jaxb/src/main/resources/uoc-common.xsd | 6 +- services/uoc/service/pom.xml | 6 +- services/valuationcontrol/client/pom.xml | 6 +- services/valuationcontrol/jaxb/pom.xml | 16 +- .../resources/Valuationcontrols-common.xsd | 6 +- services/valuationcontrol/service/pom.xml | 6 +- services/vocabulary/client/pom.xml | 6 +- services/vocabulary/jaxb/pom.xml | 18 +- .../src/main/resources/vocabulary_common.xsd | 17 +- .../main/resources/vocabularyitem_common.xsd | 15 +- services/vocabulary/service/pom.xml | 6 +- .../vocabulary/VocabularyResource.java | 41 +- services/work/client/pom.xml | 6 +- services/work/jaxb/pom.xml | 17 +- .../jaxb/src/main/resources/work_common.xsd | 16 +- .../main/resources/workauthority_common.xsd | 16 +- services/work/pom.xml | 9 - services/work/service/pom.xml | 6 +- services/workflow/client/pom.xml | 6 +- services/workflow/jaxb/pom.xml | 4 +- services/workflow/service/pom.xml | 6 +- 509 files changed, 5450 insertions(+), 6824 deletions(-) create mode 100644 3rdparty/ant/build.xml create mode 100644 3rdparty/ant/pom.xml delete mode 100644 3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/nuxeo/platform/thumbnail/App.java create mode 100644 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/disable-picture-listener-config.xml create mode 100644 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/logmanager-config.xml create mode 100644 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/trashservice-config.xml delete mode 100644 services/account/client/src/test/resources/hibernate.cfg.xml create mode 100644 services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountListItem.java create mode 100644 services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountTenant.java create mode 100644 services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountsCommon.java create mode 100644 services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountsCommonList.java create mode 100644 services/account/jaxb/src/main/java/org/collectionspace/services/account/RoleList.java create mode 100644 services/account/jaxb/src/main/java/org/collectionspace/services/account/RoleValue.java create mode 100644 services/account/jaxb/src/main/java/org/collectionspace/services/account/Status.java create mode 100644 services/account/jaxb/src/main/java/org/collectionspace/services/account/Tenant.java create mode 100644 services/account/jaxb/src/main/java/org/collectionspace/services/account/TenantListItem.java create mode 100644 services/account/jaxb/src/main/java/org/collectionspace/services/account/TenantsList.java create mode 100644 services/account/jaxb/src/main/java/org/collectionspace/services/account/package-info.java delete mode 100644 services/account/jaxb/src/main/resources/accounts_common.xsd delete mode 100644 services/account/jaxb/src/main/resources/accounts_common_list.xsd delete mode 100644 services/account/jaxb/src/main/resources/bindings.xml delete mode 100644 services/account/jaxb/src/main/resources/instance1.xml create mode 100644 services/account/jaxb/src/main/resources/org/collectionspace/services/account/jaxb.index delete mode 100644 services/account/pstore/src/test/resources/META-INF/persistence.xml delete mode 100644 services/account/pstore/src/test/resources/hibernate.cfg.xml delete mode 100644 services/authentication/client/.gitignore delete mode 100644 services/authentication/client/build.xml delete mode 100644 services/authentication/client/pom.xml delete mode 100644 services/authentication/client/src/test/resources/META-INF/persistence.xml delete mode 100644 services/authentication/client/src/test/resources/hibernate.cfg.xml create mode 100644 services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/Passwordreset.java create mode 100644 services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/Token.java create mode 100644 services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/User.java create mode 100644 services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/package-info.java delete mode 100644 services/authentication/jaxb/src/main/resources/authentication_identity_provider.xsd create mode 100644 services/authentication/jaxb/src/main/resources/org/collectionspace/services/authentication/jaxb.index delete mode 100644 services/authentication/jaxb/src/test/resources/META-INF/persistence.xml delete mode 100644 services/authentication/jaxb/src/test/resources/hibernate.cfg.xml delete mode 100644 services/authentication/pstore/src/test/resources/META-INF/persistence.xml delete mode 100644 services/authentication/pstore/src/test/resources/hibernate.cfg.xml delete mode 100644 services/authorization-mgt/import/src/main/resources/hibernate.cfg.xml delete mode 100644 services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/PermissionResource.java.txt delete mode 100644 services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/PermissionDocumentHandler.java.txt create mode 100644 services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountPermission.java create mode 100644 services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountRole.java create mode 100644 services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountRoleRel.java create mode 100644 services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountValue.java create mode 100644 services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionRole.java create mode 100644 services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionRoleRel.java create mode 100644 services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionValue.java create mode 100644 services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionsRolesList.java create mode 100644 services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/Role.java create mode 100644 services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/RoleValue.java create mode 100644 services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/RolesList.java create mode 100644 services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/SubjectType.java create mode 100644 services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/package-info.java delete mode 100644 services/authorization/jaxb/src/main/resources/accounts_permissions.xsd delete mode 100644 services/authorization/jaxb/src/main/resources/accounts_roles.xsd delete mode 100644 services/authorization/jaxb/src/main/resources/authorization_common.xsd delete mode 100644 services/authorization/jaxb/src/main/resources/bindings.xjb create mode 100644 services/authorization/jaxb/src/main/resources/org/collectionspace/services/authorization/jaxb.index delete mode 100644 services/authorization/jaxb/src/main/resources/permissions_roles.xsd delete mode 100644 services/authorization/jaxb/src/main/resources/roles.xsd delete mode 100644 services/authorization/jaxb/src/main/resources/roles_list.xsd delete mode 100644 services/authorization/pstore/src/test/resources/META-INF/persistence.xml delete mode 100644 services/authorization/pstore/src/test/resources/hibernate.cfg.xml create mode 100644 services/common-http/pom.xml create mode 100644 services/common-http/src/main/java/org/collectionspace/services/common/jaxb/JAXBContextCache.java create mode 100644 services/common-http/src/main/java/org/collectionspace/services/common/provider/JakartaJAXBProvider.java create mode 100644 services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/ActionType.java create mode 100644 services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/EffectType.java create mode 100644 services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/Permission.java create mode 100644 services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/PermissionAction.java create mode 100644 services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/PermissionsList.java create mode 100644 services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/package-info.java delete mode 100644 services/hyperjaxb/src/main/resources/bindings.xjb create mode 100644 services/hyperjaxb/src/main/resources/org/collectionspace/services/authorization/perms/jaxb.index delete mode 100644 services/hyperjaxb/src/main/resources/permissions.xsd delete mode 100644 services/hyperjaxb/src/main/resources/permissions_list.xsd create mode 100644 services/jaxb/src/main/java/org/collectionspace/services/jaxb/adapter/DateAdapter.java create mode 100644 services/jaxb/src/main/resources/bindings.xjb delete mode 100644 services/jaxb/src/main/resources/bindings.xml create mode 100644 services/jaxb/src/test/java/org/collectionspace/services/jaxb/adapter/DateAdapterTest.java delete mode 100644 services/relation/service/src/main/java/org/collectionspace/services/relation/RelationResource.txt delete mode 100644 services/security/client/src/test/resources/META-INF/persistence.xml delete mode 100644 services/security/client/src/test/resources/hibernate.cfg.xml diff --git a/3rdparty/ant/build.xml b/3rdparty/ant/build.xml new file mode 100644 index 0000000000..77f80a502d --- /dev/null +++ b/3rdparty/ant/build.xml @@ -0,0 +1,23 @@ + + Collectionspace Services - Ant Libs + + + + + + + + + + + + + + + + + + + + + diff --git a/3rdparty/ant/pom.xml b/3rdparty/ant/pom.xml new file mode 100644 index 0000000000..422ad4da36 --- /dev/null +++ b/3rdparty/ant/pom.xml @@ -0,0 +1,22 @@ + + + + org.collectionspace.services + org.collectionspace.services.3rdparty + ${revision} + + + 4.0.0 + org.collectionspace.services.3rdparty.ant-lib + collectionspace.3rdparty.ant-lib + pom + + + + org.openjdk.nashorn + nashorn-core + 15.7 + + + diff --git a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java index e9dea8ffed..c8c3f01382 100644 --- a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java +++ b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java @@ -12,29 +12,25 @@ import java.util.Map; import java.util.Set; -import javax.ws.rs.core.HttpHeaders; - +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.IntNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.fasterxml.jackson.databind.node.TextNode; import org.apache.commons.lang3.StringUtils; -import org.codehaus.jackson.JsonGenerator; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.node.IntNode; -import org.codehaus.jackson.node.ObjectNode; -import org.codehaus.jackson.node.TextNode; import org.collectionspace.services.common.api.RefNameUtils; -import org.nuxeo.ecm.automation.jaxrs.io.documents.JsonESDocumentWriter; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; +import org.nuxeo.elasticsearch.io.JsonESDocumentWriter; public class DefaultESDocumentWriter extends JsonESDocumentWriter { - private static ObjectMapper objectMapper = new ObjectMapper(); + private static final ObjectMapper objectMapper = new ObjectMapper(); @Override - public void writeDoc(JsonGenerator jg, DocumentModel doc, String[] schemas, - Map contextParameters, HttpHeaders headers) - throws IOException { - + public void writeESDocument(JsonGenerator jg, DocumentModel doc, String[] schemas, + Map contextParameters) throws IOException { ObjectNode denormValues = getDenormValues(doc); jg.writeStartObject(); @@ -42,7 +38,7 @@ public void writeDoc(JsonGenerator jg, DocumentModel doc, String[] schemas, writeSystemProperties(jg, doc); writeSchemas(jg, doc, schemas); writeContextParameters(jg, doc, contextParameters); - writeDenormValues(jg, doc, denormValues); + writeDenormValues(jg, denormValues); jg.writeEndObject(); jg.flush(); @@ -90,13 +86,13 @@ public ObjectNode getDenormValues(DocumentModel doc) { return denormValues; } - public void writeDenormValues(JsonGenerator jg, DocumentModel doc, ObjectNode denormValues) throws IOException { - if (denormValues != null && denormValues.size() > 0) { + public void writeDenormValues(JsonGenerator jg, ObjectNode denormValues) throws IOException { + if (denormValues != null && !denormValues.isEmpty()) { if (jg.getCodec() == null) { jg.setCodec(objectMapper); } - Iterator> entries = denormValues.getFields(); + Iterator> entries = denormValues.fields(); while (entries.hasNext()) { Map.Entry entry = entries.next(); @@ -112,29 +108,26 @@ private void denormMediaRecords(CoreSession session, String csid, String tenantI String relatedRecordQuery = String.format("SELECT * FROM Relation WHERE relations_common:subjectCsid = '%s' AND relations_common:objectDocumentType = 'Media' AND ecm:currentLifeCycleState = 'project' AND collectionspace_core:tenantId = '%s'", csid, tenantId); DocumentModelList relationDocs = session.query(relatedRecordQuery); - List mediaCsids = new ArrayList(); - List mediaAltTexts = new ArrayList(); + List mediaCsids = new ArrayList<>(); + List mediaAltTexts = new ArrayList<>(); if (relationDocs.size() > 0) { - Iterator iterator = relationDocs.iterator(); + for (DocumentModel relationDoc : relationDocs) { + String mediaCsid = (String) relationDoc.getProperty("relations_common", "objectCsid"); + DocumentModel mediaDoc = getRecordByCsid(session, tenantId, "Media", mediaCsid); - while (iterator.hasNext()) { - DocumentModel relationDoc = iterator.next(); - String mediaCsid = (String) relationDoc.getProperty("relations_common", "objectCsid"); - DocumentModel mediaDoc = getRecordByCsid(session, tenantId, "Media", mediaCsid); + if (isMediaPublished(mediaDoc)) { + mediaCsids.add(new TextNode(mediaCsid)); - if (isMediaPublished(mediaDoc)) { - mediaCsids.add(new TextNode(mediaCsid)); + String altText = (String) mediaDoc.getProperty("media_common", "altText"); - String altText = (String) mediaDoc.getProperty("media_common", "altText"); + if (altText == null) { + altText = ""; + } - if (altText == null) { - altText = ""; - } - - mediaAltTexts.add(new TextNode(altText)); - } - } + mediaAltTexts.add(new TextNode(altText)); + } + } } denormValues.putArray("mediaCsid").addAll(mediaCsids); @@ -149,19 +142,16 @@ private void denormRelatedObjects(CoreSession session, String csid, String tenan "SELECT * FROM Relation WHERE relations_common:objectCsid = '%s' AND relations_common:subjectDocumentType = 'CollectionObject' AND ecm:currentLifeCycleState = 'project' AND collectionspace_core:tenantId = '%s'", csid, tenantId); DocumentModelList relationDocs = session.query(relatedRecordQuery); - List objectCsids = new ArrayList(); + List objectCsids = new ArrayList<>(); if (relationDocs.size() > 0) { - Iterator iterator = relationDocs.iterator(); - - while (iterator.hasNext()) { - DocumentModel relationDoc = iterator.next(); - String objectCsid = (String) relationDoc.getProperty("relations_common", "subjectCsid"); + for (DocumentModel relationDoc : relationDocs) { + String objectCsid = (String) relationDoc.getProperty("relations_common", "subjectCsid"); - if (objectCsid != null) { - objectCsids.add(new TextNode(objectCsid)); - } - } + if (objectCsid != null) { + objectCsids.add(new TextNode(objectCsid)); + } + } } denormValues.putArray("objectCsid").addAll(objectCsids); @@ -172,20 +162,17 @@ private void denormAcquisitionRecords(CoreSession session, String csid, String t String relatedRecordQuery = String.format("SELECT * FROM Relation WHERE relations_common:subjectCsid = '%s' AND relations_common:objectDocumentType = 'Acquisition' AND ecm:currentLifeCycleState = 'project' AND collectionspace_core:tenantId = '%s'", csid, tenantId); DocumentModelList relationDocs = session.query(relatedRecordQuery); - List creditLines = new ArrayList(); + List creditLines = new ArrayList<>(); if (relationDocs.size() > 0) { - Iterator iterator = relationDocs.iterator(); - - while (iterator.hasNext()) { - DocumentModel relationDoc = iterator.next(); - String acquisitionCsid = (String) relationDoc.getProperty("relations_common", "objectCsid"); - String creditLine = getCreditLine(session, tenantId, acquisitionCsid); - - if (creditLine != null && creditLine.length() > 0) { - creditLines.add(new TextNode(creditLine)); - } - } + for (DocumentModel relationDoc : relationDocs) { + String acquisitionCsid = (String) relationDoc.getProperty("relations_common", "objectCsid"); + String creditLine = getCreditLine(session, tenantId, acquisitionCsid); + + if (creditLine != null && !creditLine.isEmpty()) { + creditLines.add(new TextNode(creditLine)); + } + } } denormValues.putArray("creditLine").addAll(creditLines); @@ -196,30 +183,27 @@ private void denormExhibitionRecords(CoreSession session, String csid, String te String relatedRecordQuery = String.format("SELECT * FROM Relation WHERE relations_common:subjectCsid = '%s' AND relations_common:objectDocumentType = 'Exhibition' AND ecm:currentLifeCycleState = 'project' AND collectionspace_core:tenantId = '%s'", csid, tenantId); DocumentModelList relationDocs = session.query(relatedRecordQuery); - List exhibitions = new ArrayList(); + List exhibitions = new ArrayList<>(); if (relationDocs.size() > 0) { - Iterator iterator = relationDocs.iterator(); + for (DocumentModel relationDoc : relationDocs) { + String exhibitionCsid = (String) relationDoc.getProperty("relations_common", "objectCsid"); + DocumentModel exhibitionDoc = getRecordByCsid(session, tenantId, "Exhibition", exhibitionCsid); - while (iterator.hasNext()) { - DocumentModel relationDoc = iterator.next(); - String exhibitionCsid = (String) relationDoc.getProperty("relations_common", "objectCsid"); - DocumentModel exhibitionDoc = getRecordByCsid(session, tenantId, "Exhibition", exhibitionCsid); + if (exhibitionDoc != null && isExhibitionPublished(exhibitionDoc)) { + ObjectNode exhibitionNode = objectMapper.createObjectNode(); - if (exhibitionDoc != null && isExhibitionPublished(exhibitionDoc)) { - ObjectNode exhibitionNode = objectMapper.createObjectNode(); + String title = (String) exhibitionDoc.getProperty("exhibitions_common", "title"); + String generalNote = (String) exhibitionDoc.getProperty("exhibitions_common", "generalNote"); + String curatorialNote = (String) exhibitionDoc.getProperty("exhibitions_common", "curatorialNote"); - String title = (String) exhibitionDoc.getProperty("exhibitions_common", "title"); - String generalNote = (String) exhibitionDoc.getProperty("exhibitions_common", "generalNote"); - String curatorialNote = (String) exhibitionDoc.getProperty("exhibitions_common", "curatorialNote"); + exhibitionNode.put("title", title); + exhibitionNode.put("generalNote", generalNote); + exhibitionNode.put("curatorialNote", curatorialNote); - exhibitionNode.put("title", title); - exhibitionNode.put("generalNote", generalNote); - exhibitionNode.put("curatorialNote", curatorialNote); - - exhibitions.add(exhibitionNode); - } - } + exhibitions.add(exhibitionNode); + } + } } denormValues.putArray("exhibition").addAll(exhibitions); @@ -376,15 +360,14 @@ private boolean isPublished(DocumentModel doc, String publishedFieldPart, String List publishToValues = (List) doc.getProperty(publishedFieldPart, publishedFieldName); if (publishToValues != null) { - for (int i=0; i structDateToYearNodes(Map structDate) { } protected List structDatesToYearNodes(List> structDates) { - Set years = new HashSet(); + Set years = new HashSet<>(); for (Map structDate : structDates) { if (structDate != null) { @@ -440,8 +423,8 @@ protected List structDatesToYearNodes(List> struct // Subtract one day to make it inclusive. latestCalendar.add(Calendar.DATE, -1); - Integer earliestYear = earliestCalendar.get(Calendar.YEAR); - Integer latestYear = latestCalendar.get(Calendar.YEAR);; + int earliestYear = earliestCalendar.get(Calendar.YEAR); + int latestYear = latestCalendar.get(Calendar.YEAR); for (int year = earliestYear; year <= latestYear; year++) { years.add(year); @@ -450,10 +433,10 @@ protected List structDatesToYearNodes(List> struct } } - List yearList = new ArrayList(years); + List yearList = new ArrayList<>(years); Collections.sort(yearList); - List yearNodes = new ArrayList(); + List yearNodes = new ArrayList<>(); for (Integer year : yearList) { yearNodes.add(new IntNode(year)); diff --git a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/TenantConfiguredESDocumentWriter.java b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/TenantConfiguredESDocumentWriter.java index eceecc58a2..ecb28d750f 100644 --- a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/TenantConfiguredESDocumentWriter.java +++ b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/TenantConfiguredESDocumentWriter.java @@ -3,31 +3,25 @@ import java.io.IOException; import java.util.Map; -import javax.ws.rs.core.HttpHeaders; - +import com.fasterxml.jackson.core.JsonGenerator; import org.apache.commons.lang3.StringUtils; -import org.codehaus.jackson.JsonGenerator; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.common.ServiceMain; import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl; import org.collectionspace.services.config.service.ServiceBindingType; import org.collectionspace.services.config.tenant.TenantBindingType; -import org.nuxeo.ecm.automation.jaxrs.io.documents.JsonESDocumentWriter; import org.nuxeo.ecm.core.api.DocumentModel; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.nuxeo.elasticsearch.io.JsonESDocumentWriter; /** * A JsonESDocumentWriter that delegates to the class that is specified in the * CSpace tenant binding file for the current tenant. */ public class TenantConfiguredESDocumentWriter extends JsonESDocumentWriter { - final Logger logger = LoggerFactory.getLogger(TenantConfiguredESDocumentWriter.class); @Override - public void writeDoc(JsonGenerator jg, DocumentModel doc, String[] schemas, Map contextParameters, - HttpHeaders headers) throws IOException { - + public void writeESDocument(JsonGenerator jg, DocumentModel doc, String[] schemas, + Map contextParameters) throws IOException { String tenantId = (String) doc.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA, CollectionSpaceClient.COLLECTIONSPACE_CORE_TENANTID); if (tenantId == null) { @@ -80,7 +74,7 @@ public void writeDoc(JsonGenerator jg, DocumentModel doc, String[] schemas, Map< throw new IOException(msg, e); } - documentWriter.writeDoc(jg, doc, schemas, contextParameters, headers); + documentWriter.writeESDocument(jg, doc, schemas, contextParameters); } private void writeEmptyDoc(JsonGenerator jg) throws IOException { diff --git a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/anthro/AnthroESDocumentWriter.java b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/anthro/AnthroESDocumentWriter.java index d41557eefe..bc35155bf9 100644 --- a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/anthro/AnthroESDocumentWriter.java +++ b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/anthro/AnthroESDocumentWriter.java @@ -3,8 +3,8 @@ import java.util.List; import java.util.Map; +import com.fasterxml.jackson.databind.node.ObjectNode; import org.apache.commons.lang3.StringUtils; -import org.codehaus.jackson.node.ObjectNode; import org.collectionspace.services.common.api.RefNameUtils; import org.collectionspace.services.nuxeo.elasticsearch.DefaultESDocumentWriter; import org.nuxeo.ecm.core.api.DocumentModel; diff --git a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/materials/MaterialsESDocumentWriter.java b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/materials/MaterialsESDocumentWriter.java index 9ce7b84f37..1916cc5ab3 100644 --- a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/materials/MaterialsESDocumentWriter.java +++ b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/materials/MaterialsESDocumentWriter.java @@ -2,19 +2,16 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.fasterxml.jackson.databind.node.TextNode; import org.apache.commons.lang3.StringUtils; - -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.node.ObjectNode; -import org.codehaus.jackson.node.TextNode; - import org.collectionspace.services.common.api.RefNameUtils; import org.collectionspace.services.nuxeo.elasticsearch.DefaultESDocumentWriter; import org.nuxeo.ecm.core.api.CoreSession; @@ -71,12 +68,12 @@ public ObjectNode getDenormValues(DocumentModel doc) { // Combine term creator organizations and term editor organizations into a holding // institutions field. - Set holdingInstitutions = new LinkedHashSet(); + Set holdingInstitutions = new LinkedHashSet<>(); holdingInstitutions.addAll(getTermAttributionContributors(doc)); holdingInstitutions.addAll(getTermAttributionEditors(doc)); - if (holdingInstitutions.size() > 0) { + if (!holdingInstitutions.isEmpty()) { denormValues.putArray("holdingInstitutions").addAll(jsonNodes(holdingInstitutions)); } } @@ -151,29 +148,25 @@ private void denormMediaRecords(CoreSession session, String refName, String tena String escapedRefName = refName.replace("'", "\\'"); String mediaQuery = String.format("SELECT * FROM Media WHERE media_common:coverage = '%s' AND ecm:currentLifeCycleState = 'project' AND collectionspace_core:tenantId = '%s' ORDER BY media_common:identificationNumber", escapedRefName, tenantId); DocumentModelList mediaDocs = session.query(mediaQuery); - List mediaCsids = new ArrayList(); - List mediaAltTexts = new ArrayList(); + List mediaCsids = new ArrayList<>(); + List mediaAltTexts = new ArrayList<>(); if (mediaDocs.size() > 0) { - Iterator iterator = mediaDocs.iterator(); - - while (iterator.hasNext()) { - DocumentModel mediaDoc = iterator.next(); + for (DocumentModel mediaDoc : mediaDocs) { + if (isMediaPublished(mediaDoc)) { + String mediaCsid = mediaDoc.getName(); - if (isMediaPublished(mediaDoc)) { - String mediaCsid = (String) mediaDoc.getName(); + mediaCsids.add(new TextNode(mediaCsid)); - mediaCsids.add(new TextNode(mediaCsid)); + String altText = (String) mediaDoc.getProperty("media_common", "altText"); - String altText = (String) mediaDoc.getProperty("media_common", "altText"); + if (altText == null) { + altText = ""; + } - if (altText == null) { - altText = ""; - } - - mediaAltTexts.add(new TextNode(altText)); - } - } + mediaAltTexts.add(new TextNode(altText)); + } + } } denormValues.putArray("mediaCsid").addAll(mediaCsids); @@ -194,7 +187,7 @@ protected String computeTitle(DocumentModel doc) { } private List findTermDisplayNamesWithFlag(List> termGroups, String flagShortId) { - List termDisplayNames = new ArrayList(); + List termDisplayNames = new ArrayList<>(); for (Map termGroup : termGroups) { String termFlag = (String) termGroup.get("termFlag"); @@ -212,7 +205,7 @@ private List findTermDisplayNamesWithFlag(List> term } private Set getTermAttributionContributors(DocumentModel doc) { - Set orgs = new LinkedHashSet(); + Set orgs = new LinkedHashSet<>(); List> groups = (List>) doc.getProperty("materials_common", "materialTermAttributionContributingGroupList"); @@ -228,7 +221,7 @@ private Set getTermAttributionContributors(DocumentModel doc) { } private Set getTermAttributionEditors(DocumentModel doc) { - Set orgs = new LinkedHashSet(); + Set orgs = new LinkedHashSet<>(); List> groups = (List>) doc.getProperty("materials_common", "materialTermAttributionEditingGroupList"); @@ -248,29 +241,25 @@ private boolean isMediaPublished(DocumentModel mediaDoc) { boolean isPublished = false; if (publishToValues != null) { - for (int i=0; i jsonNodes(Collection values) { - List nodes = new ArrayList(); - Iterator iterator = values.iterator(); - - while (iterator.hasNext()) { - String value = iterator.next(); + List nodes = new ArrayList<>(); - nodes.add(new TextNode(value)); - } + for (String value : values) { + nodes.add(new TextNode(value)); + } return nodes; } diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/pom.xml b/3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/pom.xml index e441c1940b..c7afb986f5 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/pom.xml +++ b/3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/pom.xml @@ -21,11 +21,6 @@ org.nuxeo.ecm.core nuxeo-core-storage-sql - - org.nuxeo.ecm.platform - nuxeo-platform-filemanager-api - ${nuxeo.platform.version} - org.collectionspace.services org.collectionspace.services.taxonomy.service diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/src/main/java/org/collectionspace/services/listener/naturalhistory/UpdateFormattedDisplayNameListener.java b/3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/src/main/java/org/collectionspace/services/listener/naturalhistory/UpdateFormattedDisplayNameListener.java index 5416b4480f..5e9b2ebb29 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/src/main/java/org/collectionspace/services/listener/naturalhistory/UpdateFormattedDisplayNameListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/naturalhistory/src/main/java/org/collectionspace/services/listener/naturalhistory/UpdateFormattedDisplayNameListener.java @@ -114,7 +114,7 @@ private void updateFormattedDisplayNames(DocumentModel doc, DocumentModel previo } /* - private Set getDisplayNames(DocumentModel doc) throws ClientException { + private Set getDisplayNames(DocumentModel doc) throws NuxeoException { Set displayNames = new HashSet(); List> termGroupList = (List>) doc.getProperty(TaxonConstants.DISPLAY_NAME_SCHEMA_NAME, TERM_GROUP_LIST_FIELD_NAME); diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/pom.xml b/3rdparty/nuxeo/nuxeo-platform-listener/pom.xml index 4d32c0ddf3..b959084a53 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/pom.xml +++ b/3rdparty/nuxeo/nuxeo-platform-listener/pom.xml @@ -31,17 +31,6 @@ org.nuxeo.ecm.core nuxeo-core-storage-sql - - org.nuxeo.ecm.platform - nuxeo-platform-filemanager-api - ${nuxeo.platform.version} - - - org.nuxeo.ecm.platform - nuxeo-platform-imaging-api - ${nuxeo.platform.version} - provided - diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/pom.xml b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/pom.xml index d632e1e604..5d2a6e2fdf 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/pom.xml +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/pom.xml @@ -21,13 +21,8 @@ org.nuxeo.ecm.core nuxeo-core-storage-sql - ${nuxeo.core.version} + ${nuxeo.general.release} - - org.nuxeo.ecm.platform - nuxeo-platform-filemanager-api - ${nuxeo.platform.version} - org.collectionspace.services org.collectionspace.services.collectionobject.service @@ -68,5 +63,5 @@ - + diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateAccessCodeListener.java b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateAccessCodeListener.java index ddd33e8e58..87d0e1688a 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateAccessCodeListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateAccessCodeListener.java @@ -364,7 +364,7 @@ private Set findAddedTaxonNames(List previousTaxonNames, List serviceContext = batchResource.createServiceContext(batchResource.getServiceName()); diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateDeadFlagListener.java b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateDeadFlagListener.java index 9106cdf761..bbe29e5c2a 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateDeadFlagListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateDeadFlagListener.java @@ -108,7 +108,7 @@ public void handleCSEvent(Event event) { } private UpdateDeadFlagBatchJob createUpdater(DocumentEventContext context) throws Exception { - ResourceMap resourceMap = ResteasyProviderFactory.getContextData(ResourceMap.class); + ResourceMap resourceMap = ResteasyProviderFactory.getInstance().getContextData(ResourceMap.class); BatchResource batchResource = (BatchResource) resourceMap.get(BatchClient.SERVICE_NAME); ServiceContext serviceContext = batchResource.createServiceContext(batchResource.getServiceName()); diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateRareFlagListener.java b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateRareFlagListener.java index 844f079040..f67b8ab91e 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateRareFlagListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateRareFlagListener.java @@ -205,7 +205,7 @@ private boolean hasRareConservationCategory(DocumentModel doc) { } private UpdateRareFlagBatchJob createUpdater(DocumentEventContext context) throws Exception { - ResourceMap resourceMap = ResteasyProviderFactory.getContextData(ResourceMap.class); + ResourceMap resourceMap = ResteasyProviderFactory.getInstance().getContextData(ResourceMap.class); BatchResource batchResource = (BatchResource) resourceMap.get(BatchClient.SERVICE_NAME); ServiceContext serviceContext = batchResource.createServiceContext(batchResource.getServiceName()); diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateStyledNameListener.java b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateStyledNameListener.java index 6b46af12d7..a3c64f032d 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateStyledNameListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/botgarden/src/main/java/org/collectionspace/services/listener/botgarden/UpdateStyledNameListener.java @@ -101,7 +101,7 @@ public void handleCSEvent(Event event) { } private FormatVoucherNameBatchJob createFormatter(DocumentEventContext context) throws Exception { - ResourceMap resourceMap = ResteasyProviderFactory.getContextData(ResourceMap.class); + ResourceMap resourceMap = ResteasyProviderFactory.getInstance().getContextData(ResourceMap.class); BatchResource batchResource = (BatchResource) resourceMap.get(BatchClient.SERVICE_NAME); ServiceContext serviceContext = batchResource.createServiceContext(batchResource.getServiceName()); diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/pom.xml b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/pom.xml index 3d7de3cda0..63f9f6fcf0 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/tenants/pom.xml +++ b/3rdparty/nuxeo/nuxeo-platform-listener/tenants/pom.xml @@ -26,17 +26,6 @@ org.nuxeo.ecm.core nuxeo-core-storage-sql - - org.nuxeo.ecm.platform - nuxeo-platform-filemanager-api - ${nuxeo.platform.version} - - - org.nuxeo.ecm.platform - nuxeo-platform-imaging-api - ${nuxeo.platform.version} - provided - diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/updateimagederivatives/pom.xml b/3rdparty/nuxeo/nuxeo-platform-listener/updateimagederivatives/pom.xml index c818a6ae24..23107f5dc9 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/updateimagederivatives/pom.xml +++ b/3rdparty/nuxeo/nuxeo-platform-listener/updateimagederivatives/pom.xml @@ -15,7 +15,7 @@ org.collectionspace.services.listener.updateimagederivatives http://maven.apache.org - + org.collectionspace.services @@ -32,8 +32,12 @@ org.collectionspace.services.client ${project.version} + + org.nuxeo.ecm.platform + nuxeo-platform-imaging-core + - + diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/AbstractUpdateObjectLocationValues.java b/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/AbstractUpdateObjectLocationValues.java index dd6874c787..ab28507041 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/AbstractUpdateObjectLocationValues.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/AbstractUpdateObjectLocationValues.java @@ -16,7 +16,7 @@ import org.collectionspace.services.nuxeo.listener.AbstractCSEventSyncListenerImpl; import org.collectionspace.services.nuxeo.util.NuxeoUtils; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; import org.nuxeo.ecm.core.api.event.DocumentEventTypes; @@ -222,13 +222,13 @@ private void persistLocationChange(CoreSessionInterface session, DocumentModel c * * @param movementCsid the CSID of a Movement record. * @param coreSession a repository session. - * @throws ClientException + * @throws NuxeoException * @return the CSIDs of the CollectionObject records, if any, which are * related to the Movement record. * @throws DocumentException */ private Set getCollectionObjectCsidsRelatedToMovement(String movementCsid, - CoreSessionInterface coreSession) throws ClientException { + CoreSessionInterface coreSession) throws NuxeoException { Set csids = new HashSet<>(); @@ -323,14 +323,14 @@ private static boolean isCreatingNewRelationship(Event event) { * deletion, or of a Movement record referenced by a Relation record slated * for deletion. This record should be filtered out, prior to returning the * most recent Movement record. - * @throws ClientException + * @throws NuxeoException * @return the most recent Movement record related to the CollectionObject * identified by the supplied CSID. * @throws DocumentException */ protected DocumentModel getMostRecentMovement(Event event, CoreSessionInterface session, String collectionObjectCsid, - boolean isAboutToBeRemovedEvent, String eventMovementCsid) throws ClientException { + boolean isAboutToBeRemovedEvent, String eventMovementCsid) throws NuxeoException { DocumentModel result = null; // @@ -568,7 +568,7 @@ private static boolean existsInResultList(DocumentModelList relationDocModelList * @param relationDocModel a document model for a Relation record. * @param desiredDocType a desired document type. * @param relatedDocType a related document type. - * @throws ClientException + * @throws NuxeoException * * @return the CSID from the desired document type in the relation. Returns * null if the Relation record does not involve both the desired @@ -600,7 +600,7 @@ protected static String getCsidForDesiredDocTypeFromRelation(DocumentModel relat * @param movementDocModel a document model for a Movement record. * @return a potentially updated document model for the CollectionObject * record. - * @throws ClientException + * @throws NuxeoException */ protected abstract boolean updateCollectionObjectLocation(DocumentModel collectionObjectDocModel, DocumentModel movementDocModel, diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/UpdateObjectLocationAndCrateOnMove.java b/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/UpdateObjectLocationAndCrateOnMove.java index af971f0556..7e71ea4850 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/UpdateObjectLocationAndCrateOnMove.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/UpdateObjectLocationAndCrateOnMove.java @@ -7,7 +7,7 @@ import org.collectionspace.services.common.api.RefNameUtils; import org.collectionspace.services.common.api.Tools; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DocumentModel; public class UpdateObjectLocationAndCrateOnMove extends UpdateObjectLocationOnMove { @@ -25,7 +25,7 @@ public class UpdateObjectLocationAndCrateOnMove extends UpdateObjectLocationOnMo @Override protected boolean updateCollectionObjectLocation(DocumentModel collectionObjectDocModel, DocumentModel movementDocModel, - DocumentModel mostRecentMovementDocumentModel) throws ClientException { + DocumentModel mostRecentMovementDocumentModel) throws NuxeoException { boolean locationChanged = super.updateCollectionObjectLocation(collectionObjectDocModel, movementDocModel, mostRecentMovementDocumentModel); boolean crateChanged = updateComputedCrateValue(collectionObjectDocModel, mostRecentMovementDocumentModel); @@ -34,7 +34,7 @@ protected boolean updateCollectionObjectLocation(DocumentModel collectionObjectD } private boolean updateComputedCrateValue(DocumentModel collectionObjectDocModel, - DocumentModel movementDocModel) throws ClientException { + DocumentModel movementDocModel) throws NuxeoException { boolean result = false; String crateRefName = null; diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/UpdateObjectLocationOnMove.java b/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/UpdateObjectLocationOnMove.java index e430447ee6..cfe6149a1f 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/UpdateObjectLocationOnMove.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/updateobjectlocationonmove/src/main/java/org/collectionspace/services/listener/UpdateObjectLocationOnMove.java @@ -6,7 +6,7 @@ import org.collectionspace.services.common.api.RefNameUtils; import org.collectionspace.services.common.api.Tools; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DocumentModel; public class UpdateObjectLocationOnMove extends AbstractUpdateObjectLocationValues { @@ -16,7 +16,7 @@ public class UpdateObjectLocationOnMove extends AbstractUpdateObjectLocationValu @Override protected boolean updateCollectionObjectLocation(DocumentModel collectionObjectDocModel, DocumentModel movementDocModel, //FIXME: Not needed? - DocumentModel mostRecentMovementDocumentModel) throws ClientException { + DocumentModel mostRecentMovementDocumentModel) throws NuxeoException { boolean result = false; // diff --git a/3rdparty/nuxeo/nuxeo-platform-quote-api/pom.xml b/3rdparty/nuxeo/nuxeo-platform-quote-api/pom.xml index a06e4511db..58d26825a6 100644 --- a/3rdparty/nuxeo/nuxeo-platform-quote-api/pom.xml +++ b/3rdparty/nuxeo/nuxeo-platform-quote-api/pom.xml @@ -19,7 +19,7 @@ org.nuxeo.ecm.core nuxeo-core-api - ${nuxeo.core.version} + ${nuxeo.general.release} diff --git a/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/api/QuoteManager.java b/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/api/QuoteManager.java index 7d4dad5f6b..485f41404c 100644 --- a/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/api/QuoteManager.java +++ b/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/api/QuoteManager.java @@ -21,7 +21,7 @@ import java.util.List; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DocumentModel; /** @@ -31,10 +31,10 @@ public interface QuoteManager { List getQuotes(DocumentModel docModel) - throws ClientException; + throws NuxeoException; List getQuotes(DocumentModel docModel, DocumentModel parent) - throws ClientException; + throws NuxeoException; /** * @deprecated CommentManager cannot find the author if invoked remotely so @@ -42,7 +42,7 @@ List getQuotes(DocumentModel docModel, DocumentModel parent) */ @Deprecated DocumentModel createQuote(DocumentModel docModel, String quote) - throws ClientException; + throws NuxeoException; /** * Creates a comment document model, filling its properties with given info @@ -52,29 +52,29 @@ DocumentModel createQuote(DocumentModel docModel, String quote) * @param comment the comment content * @param author the comment author * @return the comment document model. - * @throws ClientException + * @throws NuxeoException */ DocumentModel createQuote(DocumentModel docModel, String comment, - String author) throws ClientException; + String author) throws NuxeoException; DocumentModel createQuote(DocumentModel docModel, DocumentModel comment) - throws ClientException; + throws NuxeoException; DocumentModel createQuote(DocumentModel docModel, DocumentModel parent, - DocumentModel child) throws ClientException; + DocumentModel child) throws NuxeoException; void deleteQuote(DocumentModel docModel, DocumentModel comment) - throws ClientException; + throws NuxeoException; /** * Gets documents in relation with a particular comment. * * @param quote the comment * @return the list of documents - * @throws ClientException + * @throws NuxeoException */ List getDocumentsForQuote(DocumentModel quote) - throws ClientException; + throws NuxeoException; /** * Creates a comment document model. It gives opportunity to save the comments in a @@ -84,9 +84,9 @@ List getDocumentsForQuote(DocumentModel quote) * @param quote the comment content * @param path the location path * @return the comment document model. - * @throws ClientException + * @throws NuxeoException */ DocumentModel createLocatedQuote(DocumentModel docModel, - DocumentModel quote, String path) throws ClientException; + DocumentModel quote, String path) throws NuxeoException; } diff --git a/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/api/QuoteableDocument.java b/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/api/QuoteableDocument.java index 80e82ddd30..9a6e599948 100644 --- a/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/api/QuoteableDocument.java +++ b/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/api/QuoteableDocument.java @@ -22,7 +22,7 @@ import java.io.Serializable; import java.util.List; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DocumentModel; /** @@ -36,38 +36,38 @@ public interface QuoteableDocument extends Serializable { * * @return the list of comments */ - List getQuotes() throws ClientException; + List getQuotes() throws NuxeoException; /** * Returns the comments for this document that are replied to a parent comment. * * @param parent the parent comment * @return the comments for the parent comment - * @throws ClientException + * @throws NuxeoException */ - List getQuotes(DocumentModel parent) throws ClientException; + List getQuotes(DocumentModel parent) throws NuxeoException; /** * Removes a comment from the document comment list. * * @param comment */ - void removeQuote(DocumentModel comment) throws ClientException; + void removeQuote(DocumentModel comment) throws NuxeoException; /** * Creates a new comment. * * @param comment */ - DocumentModel addQuote(DocumentModel comment) throws ClientException; + DocumentModel addQuote(DocumentModel comment) throws NuxeoException; /** * Creates a new comment as a reply to an existing comment. * * @param parent the parent comment, which must exist * @param comment the comment to be added - * @throws ClientException + * @throws NuxeoException */ - DocumentModel addQuote(DocumentModel parent, DocumentModel comment) throws ClientException; + DocumentModel addQuote(DocumentModel parent, DocumentModel comment) throws NuxeoException; } diff --git a/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/impl/QuoteableDocumentAdapter.java b/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/impl/QuoteableDocumentAdapter.java index 9a8117d281..80212b59c0 100644 --- a/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/impl/QuoteableDocumentAdapter.java +++ b/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/impl/QuoteableDocumentAdapter.java @@ -21,7 +21,7 @@ import java.util.List; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DocumentModel; import org.collectionspace.ecm.platform.quote.api.QuoteManager; import org.collectionspace.ecm.platform.quote.api.QuoteableDocument; @@ -50,37 +50,37 @@ private static QuoteManager getQuoteManager() { } @Override - public DocumentModel addQuote(DocumentModel comment) throws ClientException { + public DocumentModel addQuote(DocumentModel comment) throws NuxeoException { QuoteManager quoteManager = getQuoteManager(); return quoteManager.createQuote(docModel, comment); } @Deprecated - public DocumentModel addQuote(String comment) throws ClientException { + public DocumentModel addQuote(String comment) throws NuxeoException { QuoteManager quoteManager = getQuoteManager(); return quoteManager.createQuote(docModel, comment); } @Override - public DocumentModel addQuote(DocumentModel parent, DocumentModel comment) throws ClientException { + public DocumentModel addQuote(DocumentModel parent, DocumentModel comment) throws NuxeoException { QuoteManager quoteManager = getQuoteManager(); return quoteManager.createQuote(docModel, parent, comment); } @Override - public void removeQuote(DocumentModel comment) throws ClientException { + public void removeQuote(DocumentModel comment) throws NuxeoException { QuoteManager quoteManager = getQuoteManager(); quoteManager.deleteQuote(docModel, comment); } @Override - public List getQuotes() throws ClientException { + public List getQuotes() throws NuxeoException { QuoteManager quoteManager = getQuoteManager(); return quoteManager.getQuotes(docModel); } @Override - public List getQuotes(DocumentModel parent) throws ClientException { + public List getQuotes(DocumentModel parent) throws NuxeoException { QuoteManager quoteManager = getQuoteManager(); return quoteManager.getQuotes(docModel, parent); } diff --git a/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/workflow/services/QuotesModerationService.java b/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/workflow/services/QuotesModerationService.java index 65953e34c5..d00ceda2c3 100644 --- a/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/workflow/services/QuotesModerationService.java +++ b/3rdparty/nuxeo/nuxeo-platform-quote-api/src/main/java/org/collectionspace/ecm/platform/quote/workflow/services/QuotesModerationService.java @@ -18,7 +18,7 @@ import java.util.ArrayList; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; @@ -30,11 +30,11 @@ public interface QuotesModerationService { * @param session the coreSession * @param document the document were the comment is posted * @param commentId the commentId - * @throws ClientException + * @throws NuxeoException */ void startModeration(CoreSession session, DocumentModel document, String commentId, ArrayList moderators) - throws ClientException; + throws NuxeoException; /** * Gets the moderation process for the given Comment posted on a documentModel. @@ -42,12 +42,12 @@ void startModeration(CoreSession session, DocumentModel document, * @param session the coreSession * @param document the document were the comment is posted * @param commentId the commentId - * @throws ClientException + * @throws NuxeoException */ /** ProcessInstance getModerationProcess(JbpmService jbpmService, CoreSessionInterface session, DocumentModel doc, String commentId) - throws ClientException; + throws NuxeoException; **/ /** @@ -56,10 +56,10 @@ ProcessInstance getModerationProcess(JbpmService jbpmService, * @param session the coreSession * @param document the document were the comment is posted * @param commentId the commentId - * @throws ClientException + * @throws NuxeoException */ void approveQuote(CoreSession session, DocumentModel document, - String commentId) throws ClientException; + String commentId) throws NuxeoException; /** * Reject the comment with the given commentId. @@ -67,19 +67,19 @@ void approveQuote(CoreSession session, DocumentModel document, * @param session the coreSession * @param document the document were the comment is posted * @param commentId the commentId - * @throws ClientException + * @throws NuxeoException */ void rejectQuote(CoreSession session, DocumentModel document, - String commentId) throws ClientException; + String commentId) throws NuxeoException; /** * Publish the given comment. * * @param session the coreSession * @param comment the comment to publish - * @throws ClientException + * @throws NuxeoException */ void publishQuote(CoreSession session, DocumentModel comment) - throws ClientException; + throws NuxeoException; } diff --git a/3rdparty/nuxeo/nuxeo-platform-quote/pom.xml b/3rdparty/nuxeo/nuxeo-platform-quote/pom.xml index 60f2b9172a..6a6decbebb 100644 --- a/3rdparty/nuxeo/nuxeo-platform-quote/pom.xml +++ b/3rdparty/nuxeo/nuxeo-platform-quote/pom.xml @@ -30,12 +30,12 @@ org.nuxeo.ecm.core nuxeo-core-api - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.ecm.core nuxeo-core-event - ${nuxeo.core.version} + ${nuxeo.general.release} org.slf4j @@ -46,22 +46,22 @@ org.nuxeo.ecm.core nuxeo-core-schema - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.ecm.platform nuxeo-platform-relations-api - ${nuxeo.platform.version} + ${nuxeo.general.release} org.nuxeo.ecm.platform nuxeo-platform-api - ${nuxeo.platform.version} + ${nuxeo.general.release} org.nuxeo.ecm.platform - nuxeo-platform-usermanager-api - ${nuxeo.platform.version} + nuxeo-platform-usermanager + ${nuxeo.general.release} @@ -106,19 +106,19 @@ org.nuxeo.ecm.platform nuxeo-platform-relations-core - ${nuxeo.platform.version} + ${nuxeo.general.release} test org.nuxeo.ecm.platform nuxeo-platform-relations-jena-plugin - ${nuxeo.platform.version} + ${nuxeo.general.release} test org.nuxeo.ecm.platform nuxeo-platform-comment-core - ${nuxeo.platform.version} + ${nuxeo.general.release} test diff --git a/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/ejb/QuoteManagerBean.java b/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/ejb/QuoteManagerBean.java index 8270fa83fc..add021b760 100644 --- a/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/ejb/QuoteManagerBean.java +++ b/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/ejb/QuoteManagerBean.java @@ -28,7 +28,7 @@ import javax.ejb.Remote; import javax.ejb.Stateless; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.ClientRuntimeException; import org.nuxeo.ecm.core.api.DocumentModel; @@ -62,22 +62,22 @@ public void remove() {} @Override public DocumentModel createQuote(DocumentModel docModel, - String quote) throws ClientException { + String quote) throws NuxeoException { try { String author = context.getCallerPrincipal().getName(); return quoteManager.createQuote(docModel, quote, author); } catch (Throwable e) { - throw ClientException.wrap(e); + throw NuxeoException.wrap(e); } } @Override public DocumentModel createQuote(DocumentModel docModel, - String quote, String author) throws ClientException { + String quote, String author) throws NuxeoException { try { return quoteManager.createQuote(docModel, quote, author); } catch (Throwable e) { - throw ClientException.wrap(e); + throw NuxeoException.wrap(e); } } @@ -85,14 +85,14 @@ private String updateAuthor(DocumentModel docModel) { String author; try { author = (String) docModel.getProperty("comment", "author"); - } catch (ClientException e) { + } catch (NuxeoException e) { author = null; } if (author == null) { author = context.getCallerPrincipal().getName(); try { docModel.setProperty("comment", "author", author); - } catch (ClientException e) { + } catch (NuxeoException e) { throw new ClientRuntimeException(e); } } @@ -101,73 +101,73 @@ private String updateAuthor(DocumentModel docModel) { @Override public DocumentModel createQuote(DocumentModel docModel, - DocumentModel quote) throws ClientException { + DocumentModel quote) throws NuxeoException { try { updateAuthor(quote); return quoteManager.createQuote(docModel, quote); } catch (Throwable e) { - throw ClientException.wrap(e); + throw NuxeoException.wrap(e); } } @Override public void deleteQuote(DocumentModel docModel, DocumentModel quote) - throws ClientException { + throws NuxeoException { try { quoteManager.deleteQuote(docModel, quote); } catch (Throwable e) { - throw ClientException.wrap(e); + throw NuxeoException.wrap(e); } } @Override public List getQuotes(DocumentModel docModel) - throws ClientException { + throws NuxeoException { try { return quoteManager.getQuotes(docModel); } catch (Throwable e) { - throw ClientException.wrap(e); + throw NuxeoException.wrap(e); } } @Override public DocumentModel createQuote(DocumentModel docModel, - DocumentModel parent, DocumentModel child) throws ClientException { + DocumentModel parent, DocumentModel child) throws NuxeoException { try { updateAuthor(child); return quoteManager.createQuote(docModel, parent, child); } catch (Throwable e) { - throw ClientException.wrap(e); + throw NuxeoException.wrap(e); } } @Override public List getQuotes(DocumentModel docModel, - DocumentModel parent) throws ClientException { + DocumentModel parent) throws NuxeoException { try { return quoteManager.getQuotes(docModel, parent); } catch (Throwable e) { - throw ClientException.wrap(e); + throw NuxeoException.wrap(e); } } @Override public List getDocumentsForQuote(DocumentModel commentDoc) - throws ClientException{ + throws NuxeoException{ try { return quoteManager.getDocumentsForQuote(commentDoc); } catch (Throwable e) { - throw ClientException.wrap(e); + throw NuxeoException.wrap(e); } } @Override public DocumentModel createLocatedQuote(DocumentModel docModel, - DocumentModel comment, String path) throws ClientException { + DocumentModel comment, String path) throws NuxeoException { try { return quoteManager.createLocatedQuote(docModel, comment, path); } catch (Throwable e) { - throw ClientException.wrap(e); + throw NuxeoException.wrap(e); } } diff --git a/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/ejb/QuotesModerationBean.java b/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/ejb/QuotesModerationBean.java index 3f8dae9d14..3251b5d5ee 100644 --- a/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/ejb/QuotesModerationBean.java +++ b/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/ejb/QuotesModerationBean.java @@ -25,7 +25,7 @@ import javax.ejb.Remote; import javax.ejb.Stateless; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.runtime.api.Framework; @@ -39,30 +39,30 @@ public class QuotesModerationBean implements QuotesModerationService { protected QuotesModerationService getQuotesModerationService() { - return Framework.getLocalService(QuotesModerationService.class); + return Framework.getService(QuotesModerationService.class); } public void approveQuote(CoreSession session, DocumentModel document, - String commentID) throws ClientException { + String commentID) throws NuxeoException { getQuotesModerationService().approveQuote(session, document, commentID); } public void publishQuote(CoreSession session, DocumentModel comment) - throws ClientException { + throws NuxeoException { getQuotesModerationService().publishQuote(session, comment); } public void rejectQuote(CoreSession session, DocumentModel document, - String commentID) throws ClientException { + String commentID) throws NuxeoException { getQuotesModerationService().rejectQuote(session, document, commentID); } public void startModeration(CoreSession session, DocumentModel document, String commentID, ArrayList moderators) - throws ClientException { + throws NuxeoException { getQuotesModerationService().startModeration(session, document, commentID, moderators); } diff --git a/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/impl/QuoteConverterImpl.java b/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/impl/QuoteConverterImpl.java index f5243f5758..66f7b18e86 100644 --- a/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/impl/QuoteConverterImpl.java +++ b/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/impl/QuoteConverterImpl.java @@ -22,7 +22,7 @@ import java.util.HashMap; import java.util.Set; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DataModel; import org.nuxeo.ecm.core.api.DataModelMap; import org.nuxeo.ecm.core.api.DocumentModel; @@ -47,7 +47,7 @@ public String getDocumentType() { return "Comment"; } - /*public Comment getComment(DocumentModel docModel) throws ClientException { + /*public Comment getComment(DocumentModel docModel) throws NuxeoException { CommentImpl comment; try { comment = (CommentImpl) getCommentClass().newInstance(); @@ -76,7 +76,7 @@ public String getDocumentType() { } } catch (Exception e) { - throw new ClientException("failed to create comment", e); + throw new NuxeoException("failed to create comment", e); } return comment; }*/ @@ -91,7 +91,7 @@ public void updateDocumentModel(DocumentModel docModel, DocumentModel comment) { String schema = dataModel.getSchema(); try { docModel.setProperties(schema, new HashMap(dataModel.getMap())); - } catch (ClientException e) { + } catch (NuxeoException e) { continue; } /*if(docModel.hasSchema(schema)) { diff --git a/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/impl/QuoteManagerImpl.java b/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/impl/QuoteManagerImpl.java index 1c35eeb07c..9fa462103f 100644 --- a/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/impl/QuoteManagerImpl.java +++ b/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/impl/QuoteManagerImpl.java @@ -33,7 +33,7 @@ import javax.security.auth.login.LoginException; import org.nuxeo.common.utils.IdUtils; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.ClientRuntimeException; import org.nuxeo.ecm.core.api.CoreInstance; import org.nuxeo.ecm.core.api.CoreSession; @@ -102,25 +102,25 @@ public QuoteManagerImpl(QuoteServiceConfig config) { } protected CoreSession openCoreSession(String repositoryName) - throws ClientException { + throws NuxeoException { CoreSession result = null; try { result = CoreInstance.openCoreSession(repositoryName); } catch (Exception e) { - throw new ClientException(e); + throw new NuxeoException(e); } return result; } protected void closeCoreSession(LoginContext loginContext, - CoreSession session) throws ClientException { + CoreSession session) throws NuxeoException { if (loginContext != null) { try { loginContext.logout(); } catch (LoginException e) { - throw new ClientException(e); + throw new NuxeoException(e); } } if (session != null) { @@ -133,19 +133,19 @@ private static RelationManager getRelationManager() throws Exception { } public List getQuotes(DocumentModel docModel) - throws ClientException { + throws NuxeoException { RelationManager relationManager; Map ctxMap = new HashMap(); ctxMap.put(ResourceAdapter.CORE_SESSION_CONTEXT_KEY, docModel.getSessionId()); try { relationManager = getRelationManager(); } catch (Exception e) { - throw new ClientException(e); + throw new NuxeoException(e); } Resource docResource = relationManager.getResource( config.documentNamespace, docModel, ctxMap); if (docResource == null) { - throw new ClientException( + throw new NuxeoException( "Could not adapt document model to relation resource ; " + "check the service relation adapters configuration"); } @@ -189,7 +189,7 @@ public List getQuotes(DocumentModel docModel) } public DocumentModel createQuote(DocumentModel docModel, String comment, - String author) throws ClientException { + String author) throws NuxeoException { LoginContext loginContext = null; CoreSession session = null; try { @@ -206,14 +206,14 @@ public DocumentModel createQuote(DocumentModel docModel, String comment, return commentDM; } catch (Exception e) { - throw new ClientException(e); + throw new NuxeoException(e); } finally { closeCoreSession(loginContext, session); } } public DocumentModel createQuote(DocumentModel docModel, String quote) - throws ClientException { + throws NuxeoException { String author = getCurrentUser(docModel); return createQuote(docModel, quote, author); } @@ -224,10 +224,10 @@ public DocumentModel createQuote(DocumentModel docModel, String quote) * * @param docModel The document model that holds the session id * @param comment The comment to update - * @throws ClientException + * @throws NuxeoException */ private static String updateAuthor(DocumentModel docModel, - DocumentModel comment) throws ClientException { + DocumentModel comment) throws NuxeoException { // update the author if not set String author = (String) comment.getProperty("comment", "author"); if (author == null) { @@ -239,7 +239,7 @@ private static String updateAuthor(DocumentModel docModel, } public DocumentModel createQuote(DocumentModel docModel, - DocumentModel comment) throws ClientException { + DocumentModel comment) throws NuxeoException { LoginContext loginContext = null; CoreSession session = null; try { @@ -249,7 +249,7 @@ public DocumentModel createQuote(DocumentModel docModel, session.save(); return doc; } catch (Exception e) { - throw new ClientException(e); + throw new NuxeoException(e); } finally { closeCoreSession(loginContext, session); } @@ -257,7 +257,7 @@ public DocumentModel createQuote(DocumentModel docModel, protected DocumentModel internalCreateQuote(CoreSession session, DocumentModel docModel, DocumentModel comment, String path) - throws ClientException { + throws NuxeoException { String author = updateAuthor(docModel, comment); DocumentModel createdComment; @@ -274,7 +274,7 @@ protected DocumentModel internalCreateQuote(CoreSession session, config.documentNamespace, docModel, null); if (commentRes == null || documentRes == null) { - throw new ClientException( + throw new NuxeoException( "Could not adapt document model to relation resource ; " + "check the service relation adapters configuration"); } @@ -286,7 +286,7 @@ protected DocumentModel internalCreateQuote(CoreSession session, statementList.add(stmt); relationManager.add(config.graphName, statementList); } catch (Exception e) { - throw new ClientException("failed to create comment", e); + throw new NuxeoException("failed to create comment", e); } NuxeoPrincipal principal = null; @@ -304,7 +304,7 @@ protected DocumentModel internalCreateQuote(CoreSession session, private DocumentModel createQuoteDocModel(CoreSession mySession, DocumentModel docModel, DocumentModel comment, String path) - throws ClientException { + throws NuxeoException { String domainPath; updateAuthor(docModel, comment); @@ -373,7 +373,7 @@ private DocumentModel createQuoteDocModel(CoreSession mySession, private static void notifyEvent(CoreSession session, DocumentModel docModel, String eventType, DocumentModel parent, DocumentModel child, NuxeoPrincipal principal) - throws ClientException { + throws NuxeoException { DocumentEventContext ctx = new DocumentEventContext(session, principal, docModel); Map props = new HashMap(); @@ -411,7 +411,7 @@ private static void setFolderPermissions(DocumentModel dm) { acp.addACL(acl); try { dm.setACP(acp, true); - } catch (ClientException e) { + } catch (NuxeoException e) { throw new ClientRuntimeException(e); } } @@ -426,7 +426,7 @@ private static void setQuotePermissions(DocumentModel dm) { acp.addACL(acl); try { dm.setACP(acp, true); - } catch (ClientException e) { + } catch (NuxeoException e) { throw new ClientRuntimeException(e); } } @@ -448,18 +448,18 @@ private static CoreSession getUserSession(String sid) { */ @Deprecated private static String getCurrentUser(DocumentModel target) - throws ClientException { + throws NuxeoException { String sid = target.getSessionId(); CoreSession userSession = getUserSession(sid); if (userSession == null) { - throw new ClientException( + throw new NuxeoException( "userSession is null, do not invoke this method when the user is not local"); } return userSession.getPrincipal().getName(); } private String getQuoteName(DocumentModel target, DocumentModel comment) - throws ClientException { + throws NuxeoException { String author = (String) comment.getProperty("comment", "author"); if (author == null) { author = getCurrentUser(target); @@ -474,7 +474,7 @@ private static Date getQuoteTimeStamp(DocumentModel comment) { try { creationDate = (Calendar) comment.getProperty("dublincore", "created"); - } catch (ClientException e) { + } catch (NuxeoException e) { creationDate = null; } if (creationDate == null) { @@ -484,7 +484,7 @@ private static Date getQuoteTimeStamp(DocumentModel comment) { } public void deleteQuote(DocumentModel docModel, DocumentModel comment) - throws ClientException { + throws NuxeoException { LoginContext loginContext = null; CoreSession session = null; try { @@ -492,13 +492,13 @@ public void deleteQuote(DocumentModel docModel, DocumentModel comment) session = openCoreSession(docModel.getRepositoryName()); if (session == null) { - throw new ClientException( + throw new NuxeoException( "Unable to acess repository for comment: " + comment.getId()); } DocumentRef ref = comment.getRef(); if (!session.exists(ref)) { - throw new ClientException("Comment Document does not exist: " + throw new NuxeoException("Comment Document does not exist: " + comment.getId()); } @@ -512,14 +512,14 @@ public void deleteQuote(DocumentModel docModel, DocumentModel comment) } catch (Throwable e) { log.error("failed to delete comment", e); - throw new ClientException("failed to delete comment", e); + throw new NuxeoException("failed to delete comment", e); } finally { closeCoreSession(loginContext, session); } } public DocumentModel createQuote(DocumentModel docModel, - DocumentModel parent, DocumentModel child) throws ClientException { + DocumentModel parent, DocumentModel child) throws NuxeoException { LoginContext loginContext = null; CoreSession session = null; try { @@ -540,7 +540,7 @@ public DocumentModel createQuote(DocumentModel docModel, return newComment; } catch (Exception e) { - throw new ClientException(e); + throw new NuxeoException(e); } finally { closeCoreSession(loginContext, session); } @@ -559,31 +559,31 @@ private static NuxeoPrincipal getAuthor(DocumentModel docModel) { } public List getQuotes(DocumentModel docModel, - DocumentModel parent) throws ClientException { + DocumentModel parent) throws NuxeoException { try { //loginContext = Framework.login(); //session = openCoreSession(docModel.getRepositoryName()); //DocumentModel parentDocModel = session.getDocument(parent.getRef()); return getQuotes(parent); } catch (Exception e) { - throw new ClientException(e); + throw new NuxeoException(e); } } public List getDocumentsForQuote(DocumentModel comment) - throws ClientException { + throws NuxeoException { RelationManager relationManager; Map ctxMap = new HashMap(); ctxMap.put(ResourceAdapter.CORE_SESSION_CONTEXT_KEY, comment.getSessionId()); try { relationManager = getRelationManager(); } catch (Exception e) { - throw new ClientException(e); + throw new NuxeoException(e); } Resource commentResource = relationManager.getResource( config.commentNamespace, comment, ctxMap); if (commentResource == null) { - throw new ClientException( + throw new NuxeoException( "Could not adapt document model to relation resource ; " + "check the service relation adapters configuration"); } @@ -621,7 +621,7 @@ public List getDocumentsForQuote(DocumentModel comment) } public DocumentModel createLocatedQuote(DocumentModel docModel, - DocumentModel comment, String path) throws ClientException { + DocumentModel comment, String path) throws NuxeoException { LoginContext loginContext = null; CoreSession session = null; DocumentModel createdComment; @@ -631,7 +631,7 @@ public DocumentModel createLocatedQuote(DocumentModel docModel, createdComment = internalCreateQuote(session, docModel, comment, path); session.save(); } catch (Exception e) { - throw new ClientException(e); + throw new NuxeoException(e); } finally { closeCoreSession(loginContext, session); } diff --git a/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/listener/DocumentRemovedQuoteEventListener.java b/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/listener/DocumentRemovedQuoteEventListener.java index b39968d7d6..d9c25d8c6c 100644 --- a/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/listener/DocumentRemovedQuoteEventListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/listener/DocumentRemovedQuoteEventListener.java @@ -25,7 +25,7 @@ import java.util.List; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.event.PostCommitEventListener; @@ -53,7 +53,7 @@ protected void doProcess(CoreSession coreSession, private static void onDocumentRemoved(CoreSession coreSession, RelationManager relationManager, QuoteServiceConfig config, - DocumentModel docMessage) throws ClientException { + DocumentModel docMessage) throws NuxeoException { Resource documentRes = relationManager.getResource( config.documentNamespace, docMessage, null); diff --git a/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/listener/QuoteRemovedEventListener.java b/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/listener/QuoteRemovedEventListener.java index 321e87a2ff..2aa4c827f5 100644 --- a/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/listener/QuoteRemovedEventListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-quote/src/main/java/org/collectionspace/ecm/platform/quote/listener/QuoteRemovedEventListener.java @@ -21,7 +21,7 @@ import java.util.List; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.event.EventListener; @@ -53,7 +53,7 @@ protected void doProcess(CoreSession coreSession, private static void onQuoteRemoved(RelationManager relationManager, QuoteServiceConfig config, DocumentModel docModel) - throws ClientException { + throws NuxeoException { Resource quoteRes = relationManager.getResource( config.commentNamespace, docModel, null); if (quoteRes == null) { diff --git a/3rdparty/nuxeo/nuxeo-platform-quote/src/test/java/org/nuxeo/ecm/platform/comment/listener/test/SimpleListenerTest.java b/3rdparty/nuxeo/nuxeo-platform-quote/src/test/java/org/nuxeo/ecm/platform/comment/listener/test/SimpleListenerTest.java index 57796aae49..2fdf881919 100644 --- a/3rdparty/nuxeo/nuxeo-platform-quote/src/test/java/org/nuxeo/ecm/platform/comment/listener/test/SimpleListenerTest.java +++ b/3rdparty/nuxeo/nuxeo-platform-quote/src/test/java/org/nuxeo/ecm/platform/comment/listener/test/SimpleListenerTest.java @@ -95,7 +95,7 @@ protected DocumentModel doCreateADocWithComments() throws Exception { } protected void waitForAsyncExec() { - Framework.getLocalService(EventService.class).waitForAsyncCompletion(); + Framework.getService(EventService.class).waitForAsyncCompletion(); } /* diff --git a/3rdparty/nuxeo/nuxeo-platform-thumbnail/pom.xml b/3rdparty/nuxeo/nuxeo-platform-thumbnail/pom.xml index 78b13e4d4a..e1b385ec94 100644 --- a/3rdparty/nuxeo/nuxeo-platform-thumbnail/pom.xml +++ b/3rdparty/nuxeo/nuxeo-platform-thumbnail/pom.xml @@ -20,11 +20,6 @@ org.nuxeo.ecm.core nuxeo-core-storage-sql - - org.nuxeo.ecm.platform - nuxeo-platform-filemanager-api - ${nuxeo.platform.version} - org.nuxeo.ecm.core nuxeo-core-convert diff --git a/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/AddThumbnailUnrestricted.java b/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/AddThumbnailUnrestricted.java index d4aaaa01bc..ba136dfe25 100644 --- a/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/AddThumbnailUnrestricted.java +++ b/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/AddThumbnailUnrestricted.java @@ -10,7 +10,7 @@ import org.collectionspace.services.nuxeo.util.ThumbnailConstants; import org.nuxeo.ecm.core.api.Blob; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.UnrestrictedSessionRunner; @@ -49,7 +49,7 @@ public AddThumbnailUnrestricted(CoreSession coreSession, DocumentModel doc, * to the document blob. */ @Override - public void run() throws ClientException { + public void run() throws NuxeoException { String errMsg = "Error while adding preview thumbnail."; String documentId = doc.getId(); diff --git a/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/Thumbnail.java b/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/Thumbnail.java index a4a40bc67f..dc9ea1c303 100644 --- a/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/Thumbnail.java +++ b/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/Thumbnail.java @@ -1,7 +1,7 @@ package org.collectionspace.services.nuxeo.extension.thumbnail; import org.collectionspace.services.nuxeo.util.ThumbnailConstants; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DocumentModel; public class Thumbnail { @@ -11,7 +11,7 @@ public Thumbnail(DocumentModel doc) { docModel = doc; } - public String getDigest() throws ClientException { + public String getDigest() throws NuxeoException { String result = null; if (docModel != null) { diff --git a/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/ThumbnailConverter.java b/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/ThumbnailConverter.java index 8446ee5c30..61ca636768 100644 --- a/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/ThumbnailConverter.java +++ b/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/ThumbnailConverter.java @@ -36,7 +36,7 @@ public BlobHolder convert(BlobHolder blobHolder, try { // Make sure the toThumbnail command is available CommandLineExecutorService cles = Framework - .getLocalService(CommandLineExecutorService.class); + .getService(CommandLineExecutorService.class); CommandAvailability commandAvailability = cles .getCommandAvailability("toThumbnail"); if (!commandAvailability.isAvailable()) { diff --git a/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/UpdateThumbListener.java b/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/UpdateThumbListener.java index 2817660883..ae7bb6cf97 100644 --- a/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/UpdateThumbListener.java +++ b/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/collectionspace/services/nuxeo/extension/thumbnail/UpdateThumbListener.java @@ -7,7 +7,7 @@ import org.collectionspace.services.nuxeo.util.ThumbnailConstants; import org.nuxeo.ecm.core.api.Blob; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.blobholder.BlobHolder; import org.nuxeo.ecm.core.api.event.DocumentEventTypes; @@ -25,7 +25,7 @@ public boolean shouldHandleEvent(Event event) { return ec instanceof DocumentEventContext; } - public void handleCSEvent(Event event) throws ClientException { + public void handleCSEvent(Event event) throws NuxeoException { EventContext ec = event.getContext(); if (ec instanceof DocumentEventContext) { DocumentEventContext context = (DocumentEventContext) ec; diff --git a/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/nuxeo/platform/thumbnail/App.java b/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/nuxeo/platform/thumbnail/App.java deleted file mode 100644 index 038e27e523..0000000000 --- a/3rdparty/nuxeo/nuxeo-platform-thumbnail/src/main/java/org/nuxeo/platform/thumbnail/App.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.nuxeo.platform.thumbnail; - -/** - * Hello world! - * - */ -public class App -{ - public static void main( String[] args ) - { - System.out.println( "Hello World!" ); - } -} diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/disable-picture-listener-config.xml b/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/disable-picture-listener-config.xml new file mode 100644 index 0000000000..c2c0dc2fa8 --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/disable-picture-listener-config.xml @@ -0,0 +1,10 @@ + + + + org.nuxeo.ecm.platform.picture.listeners + + + + + + diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/logmanager-config.xml b/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/logmanager-config.xml new file mode 100644 index 0000000000..b20ab2f72c --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/logmanager-config.xml @@ -0,0 +1,8 @@ + + + + org.nuxeo.ecm.core.bulk.config + + + + diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/nuxeo.properties b/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/nuxeo.properties index 5f72426910..fb0efa56b4 100644 --- a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/nuxeo.properties +++ b/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/nuxeo.properties @@ -24,6 +24,11 @@ nuxeo-client-jndi.java.naming.provider.url=jnp://%s:%s nuxeo-client-jndi.java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory nuxeo-client-jndi.java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces +# bulk action configs +# when recomputing views, use a single threaded approach to avoid concurrency exceptions +nuxeo.bulk.action.recomputeViews.defaultConcurrency=1 +nuxeo.bulk.action.recomputeViews.defaultPartitions=1 + # for email attachment, to decode the encoded(utf) filenames. mail.mime.decodefilename=true diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/proto-elasticsearch-extension.xml b/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/proto-elasticsearch-extension.xml index b732c6c059..444e6c3069 100644 --- a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/proto-elasticsearch-extension.xml +++ b/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/proto-elasticsearch-extension.xml @@ -56,9 +56,9 @@ "type": "path_hierarchy" }, "ngram_tokenizer": { - "type": "nGram", + "type": "ngram", "min_gram": 3, - "max_gram": 12 + "max_gram": 3 } }, "analyzer": { @@ -137,9 +137,6 @@ // index as small as possible. We may want to turn this on in the future, to support arbitrary // searches through Elasticsearch, e.g. NXQL queries for ad hoc reporting in the CSpace UI. "dynamic": false, - "_all": { - "enabled": false - }, "properties": { "all_field": { "type": "text", diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/trashservice-config.xml b/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/trashservice-config.xml new file mode 100644 index 0000000000..bac6f89e4f --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/trashservice-config.xml @@ -0,0 +1,12 @@ + + + + org.nuxeo.ecm.core.trash.service.migrator + + + + lifecycle + + + + diff --git a/3rdparty/nuxeo/nuxeo-server/pom.xml b/3rdparty/nuxeo/nuxeo-server/pom.xml index 484b6985d4..363550a33e 100644 --- a/3rdparty/nuxeo/nuxeo-server/pom.xml +++ b/3rdparty/nuxeo/nuxeo-server/pom.xml @@ -16,48 +16,14 @@ - nuxeo-public-releases - https://maven-eu.nuxeo.org/nexus/content/repositories/public-releases - - false - - - - - nuxeo-vendor-releases - https://maven-eu.nuxeo.org/nexus/content/repositories/vendor-releases + nuxeo-public-lts + https://packages.nuxeo.com/repository/maven-public-lts false - - - internal-releases - https://mavenin.nuxeo.com/nexus/content/groups/internal-releases - Nuxeo virtual release repository - - true - - - false - - - - internal-snapshots - https://mavenin.nuxeo.com/nexus/content/groups/internal-snapshots - Nuxeo virtual snapshot repository - - false - - - always - true - - - - org.nuxeo.ecm.platform nuxeo-platform-login-token @@ -313,7 +263,7 @@ runtime - org.nuxeo + org.nuxeo.ecm.platform nuxeo-platform-lang-ext ${nuxeo.general.release} runtime @@ -332,7 +282,7 @@ runtime - org.nuxeo.binary.metadata + org.nuxeo.ecm.platform nuxeo-binary-metadata ${nuxeo.general.release} runtime @@ -389,13 +339,7 @@ org.nuxeo.ecm.platform - nuxeo-platform-tag-api - ${nuxeo.general.release} - runtime - - - org.nuxeo.ecm.platform - nuxeo-platform-tag-core + nuxeo-platform-tag ${nuxeo.general.release} runtime @@ -408,13 +352,7 @@ org.nuxeo.ecm.platform - nuxeo-platform-url-api - ${nuxeo.general.release} - runtime - - - org.nuxeo.ecm.platform - nuxeo-platform-url-core + nuxeo-platform-url ${nuxeo.general.release} runtime @@ -476,20 +414,6 @@ runtime - - org.nuxeo.ecm.platform - nuxeo-platform-imaging-api - ${nuxeo.general.release} - runtime - - - - org.nuxeo.ecm.platform - nuxeo-platform-imaging-convert - ${nuxeo.general.release} - runtime - - org.nuxeo.ecm.platform nuxeo-platform-imaging-core @@ -537,7 +461,7 @@ nuxeo-core-mimetype - org.nuxeo + org.nuxeo.ecm.platform nuxeo-dmk-adaptor @@ -614,11 +538,7 @@ org.nuxeo.ecm.platform - nuxeo-platform-types-api - - - org.nuxeo.ecm.platform - nuxeo-platform-types-core + nuxeo-platform-types org.nuxeo.ecm.platform @@ -630,24 +550,12 @@ org.nuxeo.ecm.platform - nuxeo-platform-filemanager-api - - - org.nuxeo.ecm.platform - nuxeo-platform-filemanager-core - - - org.nuxeo.ecm.platform - nuxeo-platform-filemanager-core-listener + nuxeo-platform-filemanager org.nuxeo.ecm.platform nuxeo-platform-login - - org.nuxeo.ecm.platform - nuxeo-platform-login-default - org.nuxeo.ecm.platform nuxeo-platform-login-token @@ -681,7 +589,7 @@ nuxeo-platform-lang - org.nuxeo + org.nuxeo.ecm.platform nuxeo-platform-lang-ext @@ -693,7 +601,7 @@ nuxeo-automation-io - org.nuxeo.binary.metadata + org.nuxeo.ecm.platform nuxeo-binary-metadata @@ -722,19 +630,11 @@ org.nuxeo.ecm.platform - nuxeo-platform-tag-api - - - org.nuxeo.ecm.platform - nuxeo-platform-tag-core - - - org.nuxeo.ecm.platform - nuxeo-platform-url-api + nuxeo-platform-tag org.nuxeo.ecm.platform - nuxeo-platform-url-core + nuxeo-platform-url @@ -752,16 +652,6 @@ nuxeo-core-management-jtajca - - org.nuxeo.ecm.platform - nuxeo-platform-imaging-api - - - - org.nuxeo.ecm.platform - nuxeo-platform-imaging-convert - - org.nuxeo.ecm.platform nuxeo-platform-imaging-core diff --git a/3rdparty/pom.xml b/3rdparty/pom.xml index e99e6678d6..5033fc7622 100644 --- a/3rdparty/pom.xml +++ b/3rdparty/pom.xml @@ -12,29 +12,7 @@ pom + ant nuxeo - - - - - - - - - - diff --git a/build.xml b/build.xml index d026cd9117..abad494dc4 100644 --- a/build.xml +++ b/build.xml @@ -3,6 +3,7 @@ + @@ -14,14 +15,28 @@ - - - - + + + + + + + + + + + + + + + + + + @@ -226,8 +241,7 @@ - - + @@ -311,19 +325,22 @@ - - - + + + + - + - + + + diff --git a/cspace-ui/build.xml b/cspace-ui/build.xml index e4954e8019..28e70b8c8b 100644 --- a/cspace-ui/build.xml +++ b/cspace-ui/build.xml @@ -11,13 +11,6 @@ - - - - - project.setProperty(attributes.get("property"), attributes.get("string").toUpperCase()); - - @@ -142,6 +135,19 @@ + + + + + + + + + + + project.setProperty(attributes.get("property"), attributes.get("string").toUpperCase()); + + diff --git a/pom.xml b/pom.xml index 8802895a20..bf44b47ce5 100644 --- a/pom.xml +++ b/pom.xml @@ -14,26 +14,39 @@ UTF-8 ${revision} ${revision} - 8.5.40 + 17 + 9.0.99 - + + 2.0.14 + 3.0.2 + 4.0.12 + 3.4.6 + 42.3.9 + 5.0.10.Final + 3.0.1 + + 1.7.4 - 0.12.0-NX2 - 2.14.3 + 1.18.0 + 2.19.0 + 3.18.0 + 1.1.1-NX01 + 2.4.21 + 32.1.3-jre + 5.6.15.Final + 2.19.4 2.2.11 - 0.6.2 2.17.1 - 9.10-HF30 - ${nuxeo.general.release} - ${nuxeo.general.release} - ${nuxeo.general.release} - 3.4.6 - 42.3.9 - 3.0.20.Final + 2023.39 1.7.32 + 4.2.2 + + 5.3.28 5.8.4 0.4.3 + 2.10.9.2 @@ -73,22 +86,6 @@ - - - - cspace-nuxeo-public-releases @@ -126,6 +123,13 @@ true + + nuxeo-public-lts + https://packages.nuxeo.com/repository/maven-public-lts + + false + + @@ -198,8 +202,8 @@ maven-compiler-plugin 3.1 - 1.8 - 1.8 + ${java.version} + ${java.version} @@ -209,7 +213,7 @@ org.apache.maven.plugins maven-war-plugin - 2.1.1 + 3.4.0 WEB-INF/lib/*.jar @@ -461,11 +465,59 @@ + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.6.2 + + + enforce-banned-dependencies + + enforce + + + + + + + jakarta.inject:jakarta.inject-api + jakarta.mail:jakarta.mail-api + jakarta.persistence:jakarta.persistence-api + jakarta.servlet:jakarta.servlet-api + jakarta.transaction:jakarta.transaction-api + jakarta.ws.rs:jakarta.ws.rs-api + jakarta.xml.soap:jakarta.xml.soap-api + + Only jakarta activation, annotation, xml bind, and validation apis should be used + + + + javax.xml.bind:jaxb-api + + Do not use javax JAXB API + + + + + + + + org.jboss.resteasy + resteasy-bom + ${resteasy.version} + pom + import + + @@ -532,12 +584,12 @@ org.nuxeo.lib.runtime nuxeo-runtime-launcher - 9.10-HF30 + ${nuxeo.general.release} org.nuxeo.lib.runtime nuxeo-runtime-tomcat-adapter - 9.10-HF30 + ${nuxeo.general.release} provided @@ -760,12 +812,12 @@ commons-codec commons-codec - 1.10 + ${commons-codec.version} org.codehaus.woodstox stax2-api - 3.1.4 + ${stax2-api.version} org.apache.santuario @@ -809,7 +861,7 @@ org.apache.commons commons-lang3 - 3.2.1 + ${commons-lang3.version} compile @@ -835,13 +887,13 @@ org.codehaus.groovy groovy-all - 2.4.12 + ${groovy.version} compile com.google.guava guava - 20.0 + ${guava.version} compile @@ -915,7 +967,7 @@ org.nuxeo.ecm.automation nuxeo-automation-io - ${nuxeo.core.version} + ${nuxeo.general.release} com.sun.jersey @@ -943,7 +995,7 @@ org.nuxeo.ecm.core nuxeo-core - ${nuxeo.core.version} + ${nuxeo.general.release} org.slf4j @@ -963,7 +1015,7 @@ org.nuxeo.ecm.core nuxeo-core-api - ${nuxeo.core.version} + ${nuxeo.general.release} com.sun.jersey @@ -974,12 +1026,12 @@ org.nuxeo.common nuxeo-common - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.ecm.platform nuxeo-platform-imaging-core - ${nuxeo.platform.version} + ${nuxeo.general.release} provided @@ -1004,17 +1056,17 @@ org.nuxeo.runtime nuxeo-runtime - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.ecm.core nuxeo-core-schema - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.ecm.core nuxeo-core-storage-sql - ${nuxeo.core.version} + ${nuxeo.general.release} org.slf4j @@ -1025,12 +1077,12 @@ org.nuxeo.ecm.core nuxeo-core-storage-sql-ra - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.ecm.core nuxeo-core-io - ${nuxeo.core.version} + ${nuxeo.general.release} @@ -1042,7 +1094,7 @@ org.nuxeo.ecm.core nuxeo-core-convert - ${nuxeo.core.version} + ${nuxeo.general.release} com.sun.jersey @@ -1053,56 +1105,22 @@ org.nuxeo.ecm.core nuxeo-opencmis-impl - ${nuxeo.core.version} - - - com.sun.jersey - jersey-core - - - com.sun.jersey - jersey-server - - - jersey-servlet - com.sun.jersey - - - org.slf4j - slf4j-log4j12 - - - - dom4j - dom4j - - + ${nuxeo.general.release} org.nuxeo.ecm.core nuxeo-opencmis-bindings - ${nuxeo.core.version} - - - com.sun.jersey - jersey-core - - - - dom4j - dom4j - - + ${nuxeo.general.release} org.nuxeo.runtime nuxeo-runtime-jtajca - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.runtime nuxeo-runtime-datasource - ${nuxeo.core.version} + ${nuxeo.general.release} @@ -1127,25 +1145,11 @@ - net.java.dev.jaxb2-commons - jaxb-fluent-api - 2.0.2 - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${jaxb2-basics.version} - - - org.jvnet.jaxb2-commons - property-listener-injector - 1.0 - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime - ${jaxb2-basics.version} + org.jvnet.jaxb + jaxb-plugins-runtime + ${jvnet.jaxb.version} + org.jboss.resteasy resteasy-jaxrs @@ -1161,15 +1165,16 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - ${resteasy.version} - org.jboss.resteasy resteasy-multipart-provider ${resteasy.version} + + + org.jboss.resteasy + resteasy-jaxb-provider + + commons-httpclient @@ -1179,56 +1184,57 @@ commons-io commons-io - 2.7 + ${commons-io.version} commons-cli commons-cli 1.2 + - com.sun.xml.bind - jaxb-core - ${jaxb.version} + org.glassfish.jaxb + jaxb-runtime + ${jaxb-runtime.version} - com.sun.xml.bind - jaxb-impl - ${jaxb.version} + jakarta.xml.bind + jakarta.xml.bind-api + ${xml-bind.version} - javax.xml.bind - jaxb-api - ${jaxb.version} + javax.persistence + javax.persistence-api + 2.2 - javax.persistence - persistence-api - 1.0 + org.hibernate + hibernate-core + ${hibernate.version} + + + javax.xml.bind + jaxb-api + + org.hibernate hibernate-entitymanager - 3.4.0.GA + ${hibernate.version} dom4j dom4j + + javax.xml.bind + jaxb-api + - - org.hibernate - hibernate-c3p0 - 3.6.10.Final - - - org.jvnet.hyperjaxb3 - - hyperjaxb3-ejb-runtime - 0.6.0 - + org.postgresql postgresql diff --git a/services/IntegrationTests/pom.xml b/services/IntegrationTests/pom.xml index a2bef594c2..b0ef43fe82 100644 --- a/services/IntegrationTests/pom.xml +++ b/services/IntegrationTests/pom.xml @@ -79,15 +79,13 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client + test org.jboss.resteasy resteasy-multipart-provider + test javax.security diff --git a/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/CollectionSpaceIntegrationTest.java b/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/CollectionSpaceIntegrationTest.java index 1fa2515c77..1665f01836 100644 --- a/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/CollectionSpaceIntegrationTest.java +++ b/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/CollectionSpaceIntegrationTest.java @@ -31,8 +31,6 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; import org.collectionspace.services.client.PayloadInputPart; import org.collectionspace.services.client.PoxPayloadIn; @@ -187,25 +185,6 @@ void verbose(String msg) { System.out.println(msg); } - /** - * Verbose. - * - * @param msg the msg - * @param o the o - * @param clazz the clazz - */ - void verbose(String msg, Object o, Class clazz) { - try { - verbose(msg); - JAXBContext jc = JAXBContext.newInstance(clazz); - Marshaller m = jc.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - m.marshal(o, System.out); - } catch (Exception e) { - e.printStackTrace(); - } - } - /** * Verbose map. * diff --git a/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/RelationIntegrationTest.java b/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/RelationIntegrationTest.java index 6c174f5db7..be3705c3b6 100644 --- a/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/RelationIntegrationTest.java +++ b/services/IntegrationTests/src/test/java/org/collectionspace/services/IntegrationTests/test/RelationIntegrationTest.java @@ -29,9 +29,10 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.Marshaller; +import org.collectionspace.services.common.jaxb.JAXBContextCache; import org.testng.Assert; import org.testng.annotations.AfterClass; import org.testng.annotations.Test; @@ -94,10 +95,10 @@ public void cleanUp() { * @param clazz the clazz * @return the string */ - static protected String objectAsXmlString(Object o, Class clazz) { + protected static String objectAsXmlString(Object o, Class clazz) { StringWriter sw = new StringWriter(); try { - JAXBContext jc = JAXBContext.newInstance(clazz); + JAXBContext jc = JAXBContextCache.getInstance().getCachedJAXBContext(clazz); Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); diff --git a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/vocabulary.xml b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/vocabulary.xml index 399bdebed0..24f1049f79 100644 --- a/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/vocabulary.xml +++ b/services/IntegrationTests/src/test/resources/test-data/xmlreplay/vocabulary/vocabulary.xml @@ -708,7 +708,7 @@ GET - /cspace-services/vocabularies/${createShowItemsVocab.CSID}/items?as=(vocabularyitems_common:displayName+ILIKE+%22%ShowItemsItem2%25%22) + /cspace-services/vocabularies/${createShowItemsVocab.CSID}/items?as=(vocabularyitems_common:displayName+ILIKE+%22%25ShowItemsItem2%25%22) 1 diff --git a/services/JaxRsServiceProvider/build.xml b/services/JaxRsServiceProvider/build.xml index c03e19ce95..d941c99624 100644 --- a/services/JaxRsServiceProvider/build.xml +++ b/services/JaxRsServiceProvider/build.xml @@ -53,7 +53,6 @@ - @@ -78,7 +77,6 @@ - diff --git a/services/JaxRsServiceProvider/pom.xml b/services/JaxRsServiceProvider/pom.xml index 25221eaf1a..53961816a9 100644 --- a/services/JaxRsServiceProvider/pom.xml +++ b/services/JaxRsServiceProvider/pom.xml @@ -12,10 +12,6 @@ services.jaxrs.provider war - - 0.5 - - commons-collections @@ -54,7 +50,11 @@ - + + org.collectionspace.services + common-http + ${project.version} + org.collectionspace.services org.collectionspace.services.authorization.service @@ -483,17 +483,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider - - - jaxb-impl - com.sun.xml.bind - - + resteasy-core org.jboss.resteasy @@ -689,7 +679,7 @@ org.nuxeo.ecm.core nuxeo-core-query - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.ecm.core @@ -713,15 +703,10 @@ org.nuxeo.runtime nuxeo-runtime-datasource - - org.nuxeo.ecm.platform - nuxeo-platform-usermanager-api - ${nuxeo.core.version} - org.nuxeo.ecm.platform nuxeo-platform-commandline-executor - ${nuxeo.core.version} + ${nuxeo.general.release} provided @@ -733,27 +718,27 @@ org.nuxeo.ecm.platform nuxeo-platform-api - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.ecm.platform nuxeo-platform-login - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.ecm.platform nuxeo-platform-imaging-core - ${nuxeo.platform.version} + ${nuxeo.general.release} org.nuxeo.ecm.platform nuxeo-platform-audit-api - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.runtime nuxeo-runtime-osgi - ${nuxeo.core.version} + ${nuxeo.general.release} @@ -946,7 +931,7 @@ CollectionSpace Services ${project.groupId} - ${cs.release} + ${project.version diff --git a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java index 583b25d8eb..6b1b6b6653 100644 --- a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java +++ b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CSpaceResteasyBootstrap.java @@ -7,7 +7,6 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; -import org.jboss.resteasy.core.Dispatcher; import org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap; import org.jboss.resteasy.specimpl.PathSegmentImpl; import org.apache.commons.io.IOUtils; @@ -46,6 +45,7 @@ import org.collectionspace.services.jaxb.AbstractCommonList.ListItem; import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.collectionspace.services.report.ReportResource; +import org.jboss.resteasy.spi.Dispatcher; import org.nuxeo.elasticsearch.ElasticSearchComponent; import org.nuxeo.elasticsearch.api.ElasticSearchService; import org.nuxeo.runtime.api.Framework; diff --git a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java index f74fc712b2..105569ff8a 100644 --- a/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java +++ b/services/JaxRsServiceProvider/src/main/java/org/collectionspace/services/jaxrs/CollectionSpaceJaxRsApplication.java @@ -27,6 +27,7 @@ import org.collectionspace.services.blob.BlobResource; import org.collectionspace.services.chronology.ChronologyAuthorityResource; import org.collectionspace.services.collectionobject.CollectionObjectResource; +import org.collectionspace.services.common.provider.JakartaJAXBProvider; import org.collectionspace.services.consultation.ConsultationResource; import org.collectionspace.services.deaccession.DeaccessionResource; import org.collectionspace.services.dutyofcare.DutyofcareResource; @@ -110,8 +111,8 @@ */ public class CollectionSpaceJaxRsApplication extends Application implements ResourceMapHolder { - private Set singletons = new HashSet(); - private Set> empty = new HashSet>(); + private Set singletons = new HashSet<>(); + private Set> empty = new HashSet<>(); private ResourceMap resourceMap = new ResourceMapImpl(); private ServletContext servletContext = null; @@ -120,6 +121,7 @@ public CollectionSpaceJaxRsApplication() { // Instantiate all our JaxRS resources // singletons.add(new SecurityInterceptor()); + singletons.add(new JakartaJAXBProvider<>()); singletons.add(new AccountResource()); singletons.add(new TenantResource()); diff --git a/services/JaxRsServiceProvider/src/main/resources/META-INF/persistence.xml b/services/JaxRsServiceProvider/src/main/resources/META-INF/persistence.xml index a01685418c..dd8ce65267 100644 --- a/services/JaxRsServiceProvider/src/main/resources/META-INF/persistence.xml +++ b/services/JaxRsServiceProvider/src/main/resources/META-INF/persistence.xml @@ -1,9 +1,8 @@ - + org.hibernate.ejb.HibernatePersistence - - - - - - - - + + + + + + + diff --git a/services/PerformanceTests/pom.xml b/services/PerformanceTests/pom.xml index 32899a68c3..ced8d44ce1 100644 --- a/services/PerformanceTests/pom.xml +++ b/services/PerformanceTests/pom.xml @@ -59,11 +59,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/CollectionSpacePerformanceTest.java b/services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/CollectionSpacePerformanceTest.java index 77c13bdc3c..2cff17fcf6 100644 --- a/services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/CollectionSpacePerformanceTest.java +++ b/services/PerformanceTests/src/test/java/org/collectionspace/services/PerformanceTests/test/CollectionSpacePerformanceTest.java @@ -28,12 +28,9 @@ import java.util.ArrayList; import java.util.List; -import java.util.Random; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; import org.collectionspace.services.collectionobject.CollectionobjectsCommon; import org.collectionspace.services.collectionobject.TitleGroup; @@ -194,38 +191,7 @@ void verbose(String msg) { // System.out.println(msg); } - /** - * Verbose. - * - * @param msg the msg - * @param o the o - * @param clazz the clazz - */ - void verbose(String msg, Object o, Class clazz) { - try { - verbose(msg); - JAXBContext jc = JAXBContext.newInstance(clazz); - Marshaller m = jc.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); - m.marshal(o, System.out); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * Verbose map. - * - * @param map the map - */ - void verboseMap(MultivaluedMap map) { - for (Object entry : map.entrySet()) { - MultivaluedMap.Entry mentry = (MultivaluedMap.Entry) entry; - verbose(" name=" + mentry.getKey() + " value=" + mentry.getValue()); - } - } - - boolean isEnabled() { + boolean isEnabled() { return Boolean.getBoolean("cspace.perf"); } diff --git a/services/account/client/build.xml b/services/account/client/build.xml index 5d06c5c52c..e8a6d88ba5 100644 --- a/services/account/client/build.xml +++ b/services/account/client/build.xml @@ -107,20 +107,16 @@ - - - - + + + + - - - - - + postgresql test - - - org.jboss.resteasy - resteasy-jaxrs - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy @@ -89,7 +78,7 @@ - + diff --git a/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java b/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java index 967e2d9d01..7962dde883 100644 --- a/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java +++ b/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountRoleServiceTest.java @@ -207,8 +207,7 @@ public void readNoRelationship(String testName) throws Exception { assertStatusCode(res, testName); AccountRole output = res.readEntity(AccountRole.class); if(logger.isDebugEnabled()) { - org.collectionspace.services.authorization.ObjectFactory objectFactory = new org.collectionspace.services.authorization.ObjectFactory(); - String sOutput = objectAsXmlString(objectFactory.createAccountRole(output), AccountRole.class); + String sOutput = objectAsXmlString(output, AccountRole.class); logger.debug(testName + " received " + sOutput); } } finally { @@ -453,8 +452,7 @@ static public AccountRole createAccountRoleInstance(AccountValue pv, if (logger.isDebugEnabled()) { logger.debug("to be created, accRole common"); - org.collectionspace.services.authorization.ObjectFactory objectFactory = new org.collectionspace.services.authorization.ObjectFactory(); - logger.debug(objectAsXmlString(objectFactory.createAccountRole(accRole), AccountRole.class)); + logger.debug(objectAsXmlString(accRole, AccountRole.class)); } return accRole; } diff --git a/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountTest.java b/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountTest.java index 98d1b64635..358e3ac4f1 100644 --- a/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountTest.java +++ b/services/account/client/src/test/java/org/collectionspace/services/account/client/test/AccountTest.java @@ -61,7 +61,7 @@ public void create(String testName) throws Exception { account.setStatus(Status.ACTIVE); id = UUID.randomUUID().toString(); account.setCsid(id); - account.setCreatedAtItem(new Date()); + account.setCreatedAt(new Date()); AccountTenant tenant = new AccountTenant(); tenant.setTenantId("123"); List tList = new ArrayList(); diff --git a/services/account/client/src/test/resources/META-INF/persistence.xml b/services/account/client/src/test/resources/META-INF/persistence.xml index c2db6ee442..e386cdc0b5 100644 --- a/services/account/client/src/test/resources/META-INF/persistence.xml +++ b/services/account/client/src/test/resources/META-INF/persistence.xml @@ -9,7 +9,13 @@ org.collectionspace.services.account.AccountTenant org.collectionspace.services.account.Status - + + + + + + + diff --git a/services/account/client/src/test/resources/hibernate.cfg.xml b/services/account/client/src/test/resources/hibernate.cfg.xml deleted file mode 100644 index eb577d2288..0000000000 --- a/services/account/client/src/test/resources/hibernate.cfg.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - @DB_CSPACE_URL@ - @DB_DRIVER_CLASS@ - @DB_CSPACE_USER@ - @DB_CSPACE_PASSWORD@ - @DB_DIALECT@ - org.hibernate.transaction.JDBCTransactionFactory - thread - true - - diff --git a/services/account/jaxb/pom.xml b/services/account/jaxb/pom.xml index 9e5bcc4d40..7b8c460408 100644 --- a/services/account/jaxb/pom.xml +++ b/services/account/jaxb/pom.xml @@ -13,54 +13,30 @@ services.account.jaxb - - - com.sun.xml.bind - jaxb-core - - - org.jvnet.jaxb2-commons - property-listener-injector - javax.persistence - persistence-api + javax.persistence-api - org.hibernate - hibernate-entitymanager - - - - org.dom4j - dom4j - - - org.jvnet.hyperjaxb3 - hyperjaxb3-ejb-runtime + jakarta.xml.bind + jakarta.xml.bind-api + - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} - org.collectionspace.services - org.collectionspace.services.hyperjaxb - ${project.version} + org.jspecify + jspecify + 1.0.0 collectionspace-services-account-jaxb install - - - - org.jvnet.hyperjaxb3 - maven-hyperjaxb3-plugin - - diff --git a/services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountListItem.java b/services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountListItem.java new file mode 100644 index 0000000000..a657564175 --- /dev/null +++ b/services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountListItem.java @@ -0,0 +1,131 @@ +package org.collectionspace.services.account; + +import java.util.ArrayList; +import java.util.List; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlSchemaType; +import jakarta.xml.bind.annotation.XmlType; +import org.jspecify.annotations.NonNull; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +public class AccountListItem { + + @XmlElement(required = true) + private String screenName; + + @XmlElement(required = true) + private String userid; + + @XmlElement(required = true) + private String tenantid; + + @XmlElement(required = true) + private List tenants; + + @XmlElement(required = true) + private String personRefName; + + @XmlElement(required = true) + private String email; + + private Boolean requireSSO; + + @XmlElement(required = true) + private Status status; + + @XmlElement(required = true) + @XmlSchemaType(name = "anyURI") + private String uri; + + @XmlElement(required = true) + private String csid; + + public String getScreenName() { + return screenName; + } + + public void setScreenName(String screenName) { + this.screenName = screenName; + } + + public String getUserid() { + return userid; + } + + public void setUserid(String userId) { + this.userid = userId; + } + + public String getTenantid() { + return tenantid; + } + + public void setTenantid(String tenantId) { + this.tenantid = tenantId; + } + + @NonNull + public List getTenants() { + if (tenants == null) { + tenants = new ArrayList<>(); + } + return this.tenants; + } + + public void setTenants(List tenants) { + this.tenants = tenants; + } + + public String getPersonRefName() { + return personRefName; + } + + public void setPersonRefName(String personRefName) { + this.personRefName = personRefName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public Boolean isRequireSSO() { + return requireSSO; + } + + public void setRequireSSO(Boolean requireSSO) { + this.requireSSO = requireSSO; + } + + public Status getStatus() { + return status; + } + + public void setStatus(Status status) { + this.status = status; + } + + public String getUri() { + return uri; + } + + public void setUri(String uri) { + this.uri = uri; + } + + public String getCsid() { + return csid; + } + + public void setCsid(String csid) { + this.csid = csid; + } + +} diff --git a/services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountTenant.java b/services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountTenant.java new file mode 100644 index 0000000000..991774644f --- /dev/null +++ b/services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountTenant.java @@ -0,0 +1,68 @@ +package org.collectionspace.services.account; + +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.Table; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlType; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "account_tenant") +@Entity(name = "AccountTenant") +@Table(name = "accounts_tenants") +@Inheritance(strategy = InheritanceType.JOINED) +public class AccountTenant { + + @Id + @Column(name = "HJID") + @GeneratedValue(strategy = GenerationType.AUTO) + @XmlAttribute(name = "Hjid") + private Long hjid; + + @Basic + @Column(name = "tenant_id", nullable = false, length = 128) + @XmlElement(name = "tenant_id", required = true) + private String tenantId; + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public Long getHjid() { + return hjid; + } + + public void setHjid(Long hjid) { + this.hjid = hjid; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountTenant that = (AccountTenant) o; + return Objects.equals(tenantId, that.tenantId); + } + + @Override + public int hashCode() { + return Objects.hashCode(tenantId); + } +} diff --git a/services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountsCommon.java b/services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountsCommon.java new file mode 100644 index 0000000000..3da327dfa6 --- /dev/null +++ b/services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountsCommon.java @@ -0,0 +1,290 @@ +package org.collectionspace.services.account; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import javax.persistence.UniqueConstraint; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlSchemaType; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.collectionspace.services.jaxb.adapter.DateAdapter; +import org.jspecify.annotations.NonNull; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "accounts_common") +@Entity(name = "AccountsCommon") +@Table(name = "accounts_common", uniqueConstraints = { + @UniqueConstraint(columnNames = { + "userid" + }) +}) +@Inheritance(strategy = InheritanceType.JOINED) +public class AccountsCommon { + + @Id + @Column(name = "csid", nullable = false, length = 128) + @XmlAttribute(name = "csid") + private String csid; + + @Basic + @Column(name = "screen_name", nullable = false, length = 128) + @XmlElement(required = true) + private String screenName; + + @Basic + @Column(name = "person_ref_name") + private String personRefName; + + @Basic + @Column(name = "email", nullable = false) + @XmlElement(required = true) + private String email; + + @Basic + @Column(name = "phone") + @XmlElement(required = true) + private String phone; + + @Basic + @Column(name = "mobile") + @XmlElement(required = true) + private String mobile; + + @Basic + @Column(name = "userid", nullable = false, length = 128) + @XmlElement(required = true) + private String userId; + + @Transient + private byte[] password; + + @Basic + @Column(name = "require_sso") + private Boolean requireSSO; + + @OneToMany(targetEntity = AccountTenant.class, cascade = { + CascadeType.ALL + }) + @JoinColumn(name = "TENANTS_ACCOUNTS_COMMON_CSID") + @XmlElement(required = true) + private List tenants; + + @Basic + @Column(name = "status", nullable = false, length = 15) + @Enumerated(EnumType.STRING) + @XmlElement(required = true) + private Status status; + + @Basic + @Column(name = "metadata_protection") + private String metadataProtection; + + @Basic + @Column(name = "roles_protection") + private String rolesProtection; + + @Column(name = "created_at", nullable = false) + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + private Date createdAt; + + @Column(name = "updated_at") + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + private Date updatedAt; + + @Transient + private RoleList roleList; + + public String getScreenName() { + return screenName; + } + + public void setScreenName(String screenName) { + this.screenName = screenName; + } + + public String getPersonRefName() { + return personRefName; + } + + public void setPersonRefName(String personRefName) { + this.personRefName = personRefName; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getMobile() { + return mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public byte[] getPassword() { + return password; + } + + public void setPassword(byte[] password) { + this.password = password; + } + + public Boolean isRequireSSO() { + return requireSSO; + } + + public void setRequireSSO(Boolean requireSSO) { + this.requireSSO = requireSSO; + } + + @NonNull + public List getTenants() { + if (tenants == null) { + tenants = new ArrayList<>(); + } + return this.tenants; + } + + public void setTenants(List tenants) { + this.tenants = tenants; + } + + public Status getStatus() { + return status; + } + + public void setStatus(Status status) { + this.status = status; + } + + public String getMetadataProtection() { + return metadataProtection; + } + + public void setMetadataProtection(String metadataProtection) { + this.metadataProtection = metadataProtection; + } + + public String getRolesProtection() { + return rolesProtection; + } + + public void setRolesProtection(String rolesProtection) { + this.rolesProtection = rolesProtection; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public RoleList getRoleList() { + return roleList; + } + + public void setRoleList(RoleList roleList) { + this.roleList = roleList; + } + + public String getCsid() { + return csid; + } + + public void setCsid(String csid) { + this.csid = csid; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountsCommon that = (AccountsCommon) o; + return Objects.equals(screenName, that.screenName) + && Objects.equals(personRefName, that.personRefName) + && Objects.equals(email, that.email) + && Objects.equals(phone, that.phone) + && Objects.equals(mobile, that.mobile) + && Objects.equals(userId, that.userId) + && Objects.deepEquals(password, that.password) + && Objects.equals(requireSSO, that.requireSSO) + && Objects.equals(tenants, that.tenants) + && status == that.status + && Objects.equals(metadataProtection, that.metadataProtection) + && Objects.equals(rolesProtection, that.rolesProtection) + && Objects.equals(createdAt, that.createdAt) + && Objects.equals(updatedAt, that.updatedAt) + && Objects.equals(roleList, that.roleList) + && Objects.equals(csid, that.csid); + } + + @Override + public int hashCode() { + return Objects.hash(screenName, personRefName, email, phone, mobile, userId, Arrays.hashCode(password), + requireSSO, tenants, status, metadataProtection, rolesProtection, createdAt, updatedAt, + roleList, csid); + } +} diff --git a/services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountsCommonList.java b/services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountsCommonList.java new file mode 100644 index 0000000000..1921fdc056 --- /dev/null +++ b/services/account/jaxb/src/main/java/org/collectionspace/services/account/AccountsCommonList.java @@ -0,0 +1,34 @@ +package org.collectionspace.services.account; + +import java.util.ArrayList; +import java.util.List; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.jspecify.annotations.NonNull; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "accounts-common-list") +public class AccountsCommonList extends AbstractCommonList { + + @XmlElement(name = "account-list-item", required = true) + private List accountListItem; + + @NonNull + public List getAccountListItem() { + if (accountListItem == null) { + accountListItem = new ArrayList<>(); + } + return this.accountListItem; + } + + public void setAccountListItem(List accountListItem) { + this.accountListItem = accountListItem; + } + +} diff --git a/services/account/jaxb/src/main/java/org/collectionspace/services/account/RoleList.java b/services/account/jaxb/src/main/java/org/collectionspace/services/account/RoleList.java new file mode 100644 index 0000000000..1609f91bbb --- /dev/null +++ b/services/account/jaxb/src/main/java/org/collectionspace/services/account/RoleList.java @@ -0,0 +1,31 @@ +package org.collectionspace.services.account; + +import java.util.ArrayList; +import java.util.List; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlType; +import org.jspecify.annotations.NonNull; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "roleList") +public class RoleList { + + @XmlElement(required = true) + private List role; + + @NonNull + public List getRole() { + if (role == null) { + role = new ArrayList<>(); + } + return this.role; + } + + public void setRole(List role) { + this.role = role; + } + +} diff --git a/services/account/jaxb/src/main/java/org/collectionspace/services/account/RoleValue.java b/services/account/jaxb/src/main/java/org/collectionspace/services/account/RoleValue.java new file mode 100644 index 0000000000..ad39121e6d --- /dev/null +++ b/services/account/jaxb/src/main/java/org/collectionspace/services/account/RoleValue.java @@ -0,0 +1,67 @@ +package org.collectionspace.services.account; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlType; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "role_value") +public class RoleValue { + + private String roleRelationshipId; + + @XmlElement(required = true) + private String roleId; + + @XmlElement(required = true) + private String roleName; + + @XmlElement(required = true) + private String displayName; + + @XmlElement(required = true) + private String tenantId; + + public String getRoleRelationshipId() { + return roleRelationshipId; + } + + public void setRoleRelationshipId(String roleRelationshipId) { + this.roleRelationshipId = roleRelationshipId; + } + + public String getRoleId() { + return roleId; + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + +} diff --git a/services/account/jaxb/src/main/java/org/collectionspace/services/account/Status.java b/services/account/jaxb/src/main/java/org/collectionspace/services/account/Status.java new file mode 100644 index 0000000000..852b0c3a96 --- /dev/null +++ b/services/account/jaxb/src/main/java/org/collectionspace/services/account/Status.java @@ -0,0 +1,35 @@ +package org.collectionspace.services.account; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlEnumValue; +import jakarta.xml.bind.annotation.XmlType; + +@XmlType(name = "status") +@XmlEnum +public enum Status { + + @XmlEnumValue("active") + ACTIVE("active"), + @XmlEnumValue("inactive") + INACTIVE("inactive"); + + private final String value; + + Status(String v) { + value = v; + } + + public String value() { + return value; + } + + public static Status fromValue(String v) { + for (Status c: Status.values()) { + if (c.value.equals(v)) { + return c; + } + } + throw new IllegalArgumentException(v); + } + +} diff --git a/services/account/jaxb/src/main/java/org/collectionspace/services/account/Tenant.java b/services/account/jaxb/src/main/java/org/collectionspace/services/account/Tenant.java new file mode 100644 index 0000000000..f482bd1204 --- /dev/null +++ b/services/account/jaxb/src/main/java/org/collectionspace/services/account/Tenant.java @@ -0,0 +1,145 @@ +package org.collectionspace.services.account; + +import java.util.Date; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlSchemaType; +import jakarta.xml.bind.annotation.XmlType; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.collectionspace.services.jaxb.adapter.DateAdapter; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "tenant") +@Entity(name = "Tenant") +@Table(name = "tenants") +@Inheritance(strategy = InheritanceType.JOINED) +public class Tenant { + + @Id + @Column(name = "id", nullable = false, length = 128) + @XmlElement(required = true) + private String id; + + @Basic + @Column(name = "name", nullable = false) + @XmlElement(required = true) + private String name; + + @Basic + @Column(name = "config_md5hash") + @XmlElement(required = true) + private String configMD5Hash; + + @Basic + @Column(name = "authorities_initialized", nullable = false) + private boolean authoritiesInitialized; + + @Basic + @Column(name = "disabled", nullable = false) + private boolean disabled; + + @Column(name = "created_at", nullable = false) + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + private Date createdAt; + + @Column(name = "updated_at") + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + private Date updatedAt; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getConfigMD5Hash() { + return configMD5Hash; + } + + public void setConfigMD5Hash(String configMD5Hash) { + this.configMD5Hash = configMD5Hash; + } + + public boolean isAuthoritiesInitialized() { + return authoritiesInitialized; + } + + public void setAuthoritiesInitialized(boolean authoritiesInitialized) { + this.authoritiesInitialized = authoritiesInitialized; + } + + public boolean isDisabled() { + return disabled; + } + + public void setDisabled(boolean disabled) { + this.disabled = disabled; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) { + return false; + } + Tenant tenant = (Tenant) o; + return authoritiesInitialized == tenant.authoritiesInitialized + && disabled == tenant.disabled + && Objects.equals(id, tenant.id) + && Objects.equals(name, tenant.name) + && Objects.equals(configMD5Hash, tenant.configMD5Hash) + && Objects.equals(createdAt, tenant.createdAt) + && Objects.equals(updatedAt, tenant.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, name, configMD5Hash, authoritiesInitialized, disabled, createdAt, updatedAt); + } +} diff --git a/services/account/jaxb/src/main/java/org/collectionspace/services/account/TenantListItem.java b/services/account/jaxb/src/main/java/org/collectionspace/services/account/TenantListItem.java new file mode 100644 index 0000000000..118b9c7ded --- /dev/null +++ b/services/account/jaxb/src/main/java/org/collectionspace/services/account/TenantListItem.java @@ -0,0 +1,45 @@ +package org.collectionspace.services.account; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlType; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +public class TenantListItem { + + @XmlElement(required = true) + private String id; + + @XmlElement(required = true) + private String name; + + private boolean disabled; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isDisabled() { + return disabled; + } + + public void setDisabled(boolean disabled) { + this.disabled = disabled; + } + +} diff --git a/services/account/jaxb/src/main/java/org/collectionspace/services/account/TenantsList.java b/services/account/jaxb/src/main/java/org/collectionspace/services/account/TenantsList.java new file mode 100644 index 0000000000..06204c37ef --- /dev/null +++ b/services/account/jaxb/src/main/java/org/collectionspace/services/account/TenantsList.java @@ -0,0 +1,35 @@ +package org.collectionspace.services.account; + +import java.util.ArrayList; +import java.util.List; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import org.collectionspace.services.jaxb.AbstractCommonList; +import org.jspecify.annotations.NonNull; + + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "") +@XmlRootElement(name = "tenants-list") +public class TenantsList extends AbstractCommonList { + + @XmlElement(name = "tenant-list-item", required = true) + private List tenantListItem; + + @NonNull + public List getTenantListItem() { + if (tenantListItem == null) { + tenantListItem = new ArrayList<>(); + } + return this.tenantListItem; + } + + public void setTenantListItem(List tenantListItem) { + this.tenantListItem = tenantListItem; + } + +} diff --git a/services/account/jaxb/src/main/java/org/collectionspace/services/account/package-info.java b/services/account/jaxb/src/main/java/org/collectionspace/services/account/package-info.java new file mode 100644 index 0000000000..0094929bc9 --- /dev/null +++ b/services/account/jaxb/src/main/java/org/collectionspace/services/account/package-info.java @@ -0,0 +1,2 @@ +@jakarta.xml.bind.annotation.XmlSchema(namespace = "http://collectionspace.org/services/account") +package org.collectionspace.services.account; diff --git a/services/account/jaxb/src/main/resources/accounts_common.xsd b/services/account/jaxb/src/main/resources/accounts_common.xsd deleted file mode 100644 index 7caba18ecc..0000000000 --- a/services/account/jaxb/src/main/resources/accounts_common.xsd +++ /dev/null @@ -1,353 +0,0 @@ - - - - - - - - - - - - - - - - - - - - AccountsCommon is the account definition in CollectionSpace - - userId is unique across all realms and across all tenants in CollectionSpace - - password should be >8 and <24 chars in length - - tenant association is usually not required to be provided by the - service consumer. only in cases where a user in CollectionSpace - has access to the spaces of multiple tenants, this is used - to associate that user with more than one tenants - - - - - - userid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - userId is unique across all tenants in CollectionSpace - - - - - - - - - - - - - password should be >8 and <24 chars in length - - - - - - - - - - If true, login through an SSO identity provider is required. - - - - - - - - - - - - tenant association is usually not required to be provided by the - service consumer. only in cases where a user in CollectionSpace - has access to the spaces of multiple tenants, this is used - to associate that user with more than one tenants - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RoleList is used relationships - - - - - - - - - - - - - - RoleValue is used in relationships - - - - - - - - - - - - - - - - - - Status of the account in CollectionSpace - - - - - - - - - - - - AccountTenant defines the relationship between an account and a tenant - - - - - - - - - - - - - - - - - - - - - - - - - - - Tenant defines the tenant in CollectionSpace - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/account/jaxb/src/main/resources/accounts_common_list.xsd b/services/account/jaxb/src/main/resources/accounts_common_list.xsd deleted file mode 100644 index 02131abe13..0000000000 --- a/services/account/jaxb/src/main/resources/accounts_common_list.xsd +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - AccountsCommonList contains information about one or more - accounts. An instance of this type could be returned on - index and search operations. - - - - - - - - - - - - - - - - - - - - - - - tenant association is usually not required to be provided by the - service consumer. only in cases where a user in CollectionSpace - has access to the spaces of multiple tenants, this is used - to associate that user with more than one tenants - - - - - - - - - - - - - - - - - - - - - - - - TenantsList contains information about one or more - tenants. An instance of this type could be returned on - index and search operations. - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/account/jaxb/src/main/resources/bindings.xml b/services/account/jaxb/src/main/resources/bindings.xml deleted file mode 100644 index 72e1e094ba..0000000000 --- a/services/account/jaxb/src/main/resources/bindings.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/services/account/jaxb/src/main/resources/instance1.xml b/services/account/jaxb/src/main/resources/instance1.xml deleted file mode 100644 index 90c47c8eb4..0000000000 --- a/services/account/jaxb/src/main/resources/instance1.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - screenName0 - personRefName0 - email0 - phone0 - mobile0 - userId0 - ZGVmYXVsdA== - - tenant_id0 - - - tenant_id1 - - active - metadataProtection0 - rolesProtection0 - 2006-05-04T18:13:51.0 - 2006-05-04T18:13:51.0 - - - roleRelationshipId0 - roleId0 - roleName0 - displayName0 - tenantId0 - - - roleRelationshipId1 - roleId1 - roleName1 - displayName1 - tenantId1 - - - diff --git a/services/account/jaxb/src/main/resources/org/collectionspace/services/account/jaxb.index b/services/account/jaxb/src/main/resources/org/collectionspace/services/account/jaxb.index new file mode 100644 index 0000000000..c666eac228 --- /dev/null +++ b/services/account/jaxb/src/main/resources/org/collectionspace/services/account/jaxb.index @@ -0,0 +1,10 @@ +AccountListItem +AccountTenant +AccountsCommon +AccountsCommonList +RoleList +RoleValue +Status +Tenant +TenantListItem +TenantsList diff --git a/services/account/pstore/build.xml b/services/account/pstore/build.xml index bb75b1b62c..dec8478621 100644 --- a/services/account/pstore/build.xml +++ b/services/account/pstore/build.xml @@ -108,48 +108,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + org.collectionspace.services.account.pstore services.account.pstore - - account.sql - ${basedir}/src/main/resources/db - - - - - com.sun.xml.bind - jaxb-core - - - org.jvnet.jaxb2-commons - property-listener-injector - - - - org.postgresql - postgresql - ${postgres.driver.version} - - - - org.collectionspace.services - org.collectionspace.services.account.jaxb - ${project.version} - - - collectionspace-services-account-pstore - - - maven-antrun-plugin - - - subs-hibernate-config - generate-test-resources - - run - - - - - - - - - - - - - - - - ddl - - - - org.codehaus.mojo - properties-maven-plugin - - - ../../../build.properties - - - - - org.codehaus.mojo - hibernate3-maven-plugin - 2.2 - - - process-test-resources - - hbm2ddl - - - - - - - hbm2ddl - - - - ${sql.file} - jpaconfiguration - true - true - true - true - false - org.collectionspace.services.account - - - - - org.postgresql - postgresql - ${postgres.driver.version} - - - - - maven-antrun-plugin - - - process-test-resources - - - - - - - run - - - - - - - - - diff --git a/services/account/pstore/src/test/resources/META-INF/persistence.xml b/services/account/pstore/src/test/resources/META-INF/persistence.xml deleted file mode 100644 index f6e45ccfef..0000000000 --- a/services/account/pstore/src/test/resources/META-INF/persistence.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - org.collectionspace.services.account.AccountsCommon - org.collectionspace.services.account.Tenant - org.collectionspace.services.account.AccountTenant - org.collectionspace.services.account.Status - - - - - - - diff --git a/services/account/pstore/src/test/resources/hibernate.cfg.xml b/services/account/pstore/src/test/resources/hibernate.cfg.xml deleted file mode 100644 index eb577d2288..0000000000 --- a/services/account/pstore/src/test/resources/hibernate.cfg.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - @DB_CSPACE_URL@ - @DB_DRIVER_CLASS@ - @DB_CSPACE_USER@ - @DB_CSPACE_PASSWORD@ - @DB_DIALECT@ - org.hibernate.transaction.JDBCTransactionFactory - thread - true - - diff --git a/services/account/service/pom.xml b/services/account/service/pom.xml index 9d1465b1ac..70f272ce7a 100644 --- a/services/account/service/pom.xml +++ b/services/account/service/pom.xml @@ -89,11 +89,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java b/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java index 48d3233385..ad1e4415f9 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java @@ -61,7 +61,7 @@ import freemarker.template.Template; import freemarker.template.TemplateException; import freemarker.template.TemplateNotFoundException; -import javax.xml.bind.DatatypeConverter; +import jakarta.xml.bind.DatatypeConverter; import org.apache.commons.lang3.StringUtils; import org.collectionspace.authentication.AuthN; import org.collectionspace.services.account.storage.AccountStorageClient; diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountDocumentHandler.java b/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountDocumentHandler.java index 938a7629a1..400c5a5281 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountDocumentHandler.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountDocumentHandler.java @@ -142,7 +142,7 @@ public void handleUpdate(DocumentWrapper wrapDoc) throws Excepti */ private AccountsCommon merge(AccountsCommon from, AccountsCommon to) { Date now = new Date(); - to.setUpdatedAtItem(now); + to.setUpdatedAt(now); if (from.getEmail() != null) { to.setEmail(from.getEmail()); } diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java b/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java index b42977406e..e1326b8c25 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java @@ -86,7 +86,7 @@ public String create(ServiceContext ctx, // // Now add the account to the CSpace list of accounts // - account.setCreatedAtItem(new Date()); + account.setCreatedAt(new Date()); jpaConnectionContext.persist(account); // // Finish creating related resources -e.g., account-role relationships diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/storage/TenantDocumentHandler.java b/services/account/service/src/main/java/org/collectionspace/services/account/storage/TenantDocumentHandler.java index cad4454293..5c4bad626b 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/storage/TenantDocumentHandler.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/storage/TenantDocumentHandler.java @@ -76,7 +76,7 @@ public void handleUpdate(DocumentWrapper wrapDoc) throws Exception { */ private Tenant merge(Tenant from, Tenant to) { Date now = new Date(); - to.setUpdatedAtItem(now); + to.setUpdatedAt(now); // The only thing we allow changing at this point are the 'disabled' and 'authoritiesInitialized' flags to.setDisabled(from.isDisabled()); to.setAuthoritiesInitialized(from.isAuthoritiesInitialized()); diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/storage/TenantStorageClient.java b/services/account/service/src/main/java/org/collectionspace/services/account/storage/TenantStorageClient.java index da43ba6940..9754e54bb8 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/storage/TenantStorageClient.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/storage/TenantStorageClient.java @@ -73,7 +73,7 @@ public String create(ServiceContext ctx, new DocumentWrapperImpl(tenant); handler.handle(Action.CREATE, wrapDoc); jpaConnectionContext.beginTransaction(); - tenant.setCreatedAtItem(new Date()); + tenant.setCreatedAt(new Date()); jpaConnectionContext.persist(tenant); handler.complete(Action.CREATE, wrapDoc); jpaConnectionContext.commitTransaction(); diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/TokenStorageClient.java b/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/TokenStorageClient.java index 226abe67ea..5479046460 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/TokenStorageClient.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/TokenStorageClient.java @@ -71,7 +71,7 @@ static public Token create(String accountCsid, String tenantId, BigInteger expir token.setTenantId(tenantId); token.setExpireSeconds(expireSeconds); token.setEnabled(true); - token.setCreatedAtItem(new Date()); + token.setCreatedAt(new Date()); em.getTransaction().begin(); em.persist(token); @@ -98,7 +98,7 @@ static public void update(TransactionContext transactionContext, String id, bool tokenFound = get((JPATransactionContext)transactionContext, id); if (tokenFound != null) { tokenFound.setEnabled(enabledFlag); - tokenFound.setUpdatedAtItem(new Date()); + tokenFound.setUpdatedAt(new Date()); if (logger.isDebugEnabled()) { logger.debug("Updated token=" + JaxbUtils.toString(tokenFound, Token.class)); } diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/UserStorageClient.java b/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/UserStorageClient.java index 4c337433bd..3352c03b29 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/UserStorageClient.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/UserStorageClient.java @@ -66,7 +66,7 @@ public User create(String userId, byte[] password) throws Exception { String salt = UUID.randomUUID().toString(); user.setPasswd(getEncPassword(userId, password, salt)); user.setSalt(salt); - user.setCreatedAtItem(new Date()); + user.setCreatedAt(new Date()); return user; } @@ -112,13 +112,13 @@ public User get(ServiceContext ctx, String userId) throws DocumentNotFoundExcept * @param password */ public void update(JPATransactionContext jpaTransactionContext, String userId, byte[] password) - throws DocumentNotFoundException, Exception { + throws DocumentNotFoundException, BadRequestException { User userFound = get(jpaTransactionContext, userId); if (userFound != null) { String salt = UUID.randomUUID().toString(); userFound.setPasswd(getEncPassword(userId, password, salt)); userFound.setSalt(salt); - userFound.setUpdatedAtItem(new Date()); + userFound.setUpdatedAt(new Date()); if (logger.isDebugEnabled()) { logger.debug("updated user=" + JaxbUtils.toString(userFound, User.class)); } diff --git a/services/acquisition/client/pom.xml b/services/acquisition/client/pom.xml index 622359253c..2c85caf637 100644 --- a/services/acquisition/client/pom.xml +++ b/services/acquisition/client/pom.xml @@ -48,11 +48,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/acquisition/jaxb/pom.xml b/services/acquisition/jaxb/pom.xml index 6cfb2412d2..48a3bf02b0 100644 --- a/services/acquisition/jaxb/pom.xml +++ b/services/acquisition/jaxb/pom.xml @@ -7,26 +7,30 @@ org.collectionspace.services ${revision} - + 4.0.0 org.collectionspace.services.acquisition.jaxb services.acquisition.jaxb - + - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + - + collectionspace-services-acquisition-jaxb install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo @@ -35,4 +39,3 @@ - diff --git a/services/acquisition/jaxb/src/main/resources/acquisitions_common.xsd b/services/acquisition/jaxb/src/main/resources/acquisitions_common.xsd index 76587655f2..a975b0065c 100644 --- a/services/acquisition/jaxb/src/main/resources/acquisitions_common.xsd +++ b/services/acquisition/jaxb/src/main/resources/acquisitions_common.xsd @@ -11,11 +11,10 @@ $LastChangedDate$ --> - diff --git a/services/advancedsearch/client/pom.xml b/services/advancedsearch/client/pom.xml index 6b3226169e..8ebd6ab394 100644 --- a/services/advancedsearch/client/pom.xml +++ b/services/advancedsearch/client/pom.xml @@ -32,7 +32,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client @@ -41,10 +41,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider @@ -58,4 +54,4 @@ collectionspace-services-advancedsearch-client - \ No newline at end of file + diff --git a/services/advancedsearch/jaxb/pom.xml b/services/advancedsearch/jaxb/pom.xml index 110fcc0bb6..7c8174b48e 100644 --- a/services/advancedsearch/jaxb/pom.xml +++ b/services/advancedsearch/jaxb/pom.xml @@ -35,8 +35,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin diff --git a/services/advancedsearch/jaxb/src/main/resources/advanced-search_common.xsd b/services/advancedsearch/jaxb/src/main/resources/advanced-search_common.xsd index f6b28889f9..8c81557dc3 100644 --- a/services/advancedsearch/jaxb/src/main/resources/advanced-search_common.xsd +++ b/services/advancedsearch/jaxb/src/main/resources/advanced-search_common.xsd @@ -10,8 +10,8 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -82,10 +82,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java index 13042ca62a..6104dc5bc9 100644 --- a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java +++ b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java @@ -12,8 +12,8 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Request; import javax.ws.rs.core.UriInfo; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Unmarshaller; import org.collectionspace.services.MediaJAXBSchema; import org.collectionspace.services.advancedsearch.AdvancedsearchCommonList.AdvancedsearchListItem; diff --git a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearchJAXBContext.java b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearchJAXBContext.java index 9a1bb24d94..9f565566e3 100644 --- a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearchJAXBContext.java +++ b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearchJAXBContext.java @@ -1,7 +1,7 @@ package org.collectionspace.services.advancedsearch; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; import org.collectionspace.collectionspace_core.CollectionSpaceCore; import org.collectionspace.services.collectionobject.CollectionobjectsCommon; diff --git a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/mapper/CollectionObjectMapper.java b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/mapper/CollectionObjectMapper.java index 08c0311f9a..b0d99b3aa7 100644 --- a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/mapper/CollectionObjectMapper.java +++ b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/mapper/CollectionObjectMapper.java @@ -7,8 +7,8 @@ import static org.collectionspace.services.client.CollectionSpaceClient.PART_LABEL_SEPARATOR; import java.util.Map; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Unmarshaller; import org.collectionspace.collectionspace_core.CollectionSpaceCore; import org.collectionspace.services.MediaJAXBSchema; import org.collectionspace.services.advancedsearch.AdvancedsearchCommonList.AdvancedsearchListItem; diff --git a/services/authentication/client/.gitignore b/services/authentication/client/.gitignore deleted file mode 100644 index 1dd3331081..0000000000 --- a/services/authentication/client/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/target/ -/target/ diff --git a/services/authentication/client/build.xml b/services/authentication/client/build.xml deleted file mode 100644 index 7e9e27052e..0000000000 --- a/services/authentication/client/build.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - collectionspace authentication service - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/authentication/client/pom.xml b/services/authentication/client/pom.xml deleted file mode 100644 index 34cbe284d0..0000000000 --- a/services/authentication/client/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - org.collectionspace.services - org.collectionspace.services.authentication - ${revision} - - - 4.0.0 - org.collectionspace.services.authentication.client - services.authentication.client - - - - - org.collectionspace.services - org.collectionspace.services.authentication.jaxb - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.authorization.jaxb - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.client - ${project.version} - - - - - cspace-services-authentication-client - - - maven-antrun-plugin - - - subs-hibernate-config - generate-test-resources - - run - - - - - - - - - - - - - - diff --git a/services/authentication/client/src/test/resources/META-INF/persistence.xml b/services/authentication/client/src/test/resources/META-INF/persistence.xml deleted file mode 100644 index 9577e73190..0000000000 --- a/services/authentication/client/src/test/resources/META-INF/persistence.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - org.collectionspace.services.authentication.User - org.collectionspace.services.authorization.Role - - - - - - - diff --git a/services/authentication/client/src/test/resources/hibernate.cfg.xml b/services/authentication/client/src/test/resources/hibernate.cfg.xml deleted file mode 100644 index eb577d2288..0000000000 --- a/services/authentication/client/src/test/resources/hibernate.cfg.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - @DB_CSPACE_URL@ - @DB_DRIVER_CLASS@ - @DB_CSPACE_USER@ - @DB_CSPACE_PASSWORD@ - @DB_DIALECT@ - org.hibernate.transaction.JDBCTransactionFactory - thread - true - - diff --git a/services/authentication/jaxb/pom.xml b/services/authentication/jaxb/pom.xml index 0bb200657e..696bce1bfd 100644 --- a/services/authentication/jaxb/pom.xml +++ b/services/authentication/jaxb/pom.xml @@ -13,52 +13,25 @@ org.collectionspace.services.authentication.jaxb services.authentication.jaxb - - authentication.sql - src/main/resources/db/mysql - - - com.sun.xml.bind - jaxb-core - - - org.jvnet.jaxb2-commons - property-listener-injector + jakarta.xml.bind + jakarta.xml.bind-api javax.persistence - persistence-api - - - org.hibernate - hibernate-entitymanager + javax.persistence-api - - org.dom4j - dom4j + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} - - org.jvnet.hyperjaxb3 - hyperjaxb3-ejb-runtime - - collectionspace-services-authentication-jaxb install - - - - org.jvnet.hyperjaxb3 - maven-hyperjaxb3-plugin - - - - diff --git a/services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/Passwordreset.java b/services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/Passwordreset.java new file mode 100644 index 0000000000..c9e7a4b226 --- /dev/null +++ b/services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/Passwordreset.java @@ -0,0 +1,35 @@ +package org.collectionspace.services.authentication; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "passwordreset") +public class Passwordreset { + + @XmlElement(required = true) + protected String token; + + @XmlElement(required = true) + protected String password; + + public String getToken() { + return token; + } + + public Passwordreset setToken(String token) { + this.token = token; + return this; + } + + public String getPassword() { + return password; + } + + public Passwordreset setPassword(String password) { + this.password = password; + return this; + } +} diff --git a/services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/Token.java b/services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/Token.java new file mode 100644 index 0000000000..f87eaed8a6 --- /dev/null +++ b/services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/Token.java @@ -0,0 +1,144 @@ +package org.collectionspace.services.authentication; + +import java.math.BigInteger; +import java.util.Date; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlSchemaType; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.collectionspace.services.jaxb.adapter.DateAdapter; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "token") +@Entity(name = "Token") +@Table(name = "tokens") +@Inheritance(strategy = InheritanceType.JOINED) +public class Token { + + @Id + @Column(name = "id", nullable = false, length = 128) + @XmlElement(required = true) + protected String id; + + @Basic + @Column(name = "account_csid", nullable = false, length = 128) + @XmlElement(required = true) + protected String accountCsid; + + @Basic + @Column(name = "tenant_id", nullable = false, length = 128) + @XmlElement(required = true) + protected String tenantId; + + @Basic + @Column(name = "expire_seconds", nullable = false, precision = 20, scale = 0) + @XmlElement(required = true) + protected BigInteger expireSeconds; + + @Basic + @Column(name = "enabled", nullable = false) + protected boolean enabled; + + @Column(name = "created_at", nullable = false) + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + protected Date createdAt; + + @Column(name = "updated_at") + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + protected Date updatedAt; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getAccountCsid() { + return accountCsid; + } + + public void setAccountCsid(String accountCsid) { + this.accountCsid = accountCsid; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public BigInteger getExpireSeconds() { + return expireSeconds; + } + + public void setExpireSeconds(BigInteger expireSeconds) { + this.expireSeconds = expireSeconds; + } + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) { + return false; + } + Token token = (Token) o; + return enabled == token.enabled + && Objects.equals(id, token.id) + && Objects.equals(accountCsid, token.accountCsid) + && Objects.equals(tenantId, token.tenantId) + && Objects.equals(expireSeconds, token.expireSeconds) + && Objects.equals(createdAt, token.createdAt) + && Objects.equals(updatedAt, token.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash(id, accountCsid, tenantId, expireSeconds, enabled, createdAt, updatedAt); + } +} diff --git a/services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/User.java b/services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/User.java new file mode 100644 index 0000000000..b27ead0c65 --- /dev/null +++ b/services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/User.java @@ -0,0 +1,132 @@ +package org.collectionspace.services.authentication; + +import java.util.Date; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlSchemaType; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.collectionspace.services.jaxb.adapter.DateAdapter; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "user") +@Entity(name = "User") +@Table(name = "users") +@Inheritance(strategy = InheritanceType.JOINED) +public class User { + + @Id + @Column(name = "username", nullable = false, length = 128) + @XmlElement(required = true) + protected String username; + + @Basic + @Column(name = "passwd", nullable = false, length = 128) + @XmlElement(required = true) + protected String passwd; + + @Basic + @Column(name = "salt", nullable = false, length = 128) + @XmlElement(required = true) + protected String salt; + + @Column(name = "created_at", nullable = false) + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + protected Date createdAt; + + @Column(name = "updated_at") + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + protected Date updatedAt; + + @Column(name = "lastLogin") + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + protected Date lastLogin; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPasswd() { + return passwd; + } + + public void setPasswd(String passwd) { + this.passwd = passwd; + } + + public String getSalt() { + return salt; + } + + public void setSalt(String salt) { + this.salt = salt; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + public Date getLastLogin() { + return lastLogin; + } + + public void setLastLogin(Date lastLogin) { + this.lastLogin = lastLogin; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(username, user.username) + && Objects.equals(passwd, user.passwd) + && Objects.equals(salt, user.salt) + && Objects.equals(createdAt, user.createdAt) + && Objects.equals(updatedAt, user.updatedAt) + && Objects.equals(lastLogin, user.lastLogin); + } + + @Override + public int hashCode() { + return Objects.hash(username, passwd, salt, createdAt, updatedAt, lastLogin); + } +} diff --git a/services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/package-info.java b/services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/package-info.java new file mode 100644 index 0000000000..50126239ee --- /dev/null +++ b/services/authentication/jaxb/src/main/java/org/collectionspace/services/authentication/package-info.java @@ -0,0 +1,4 @@ +@XmlSchema(namespace = "http://collectionspace.org/services/authentication") +package org.collectionspace.services.authentication; + +import jakarta.xml.bind.annotation.XmlSchema; \ No newline at end of file diff --git a/services/authentication/jaxb/src/main/resources/authentication_identity_provider.xsd b/services/authentication/jaxb/src/main/resources/authentication_identity_provider.xsd deleted file mode 100644 index 6971c27157..0000000000 --- a/services/authentication/jaxb/src/main/resources/authentication_identity_provider.xsd +++ /dev/null @@ -1,208 +0,0 @@ - - - - - - - - - - - - - User definition of CollectionSpace Identity Provider (CSIP) - - username is unique within all the realms in CollectionSpace - including the one managed by CSIP - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The payload for a password reset request - - - - - - - - - - - - Definition for creating password reset tockens. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/authentication/jaxb/src/main/resources/org/collectionspace/services/authentication/jaxb.index b/services/authentication/jaxb/src/main/resources/org/collectionspace/services/authentication/jaxb.index new file mode 100644 index 0000000000..3d69c33e3d --- /dev/null +++ b/services/authentication/jaxb/src/main/resources/org/collectionspace/services/authentication/jaxb.index @@ -0,0 +1,3 @@ +Passwordreset +Token +User diff --git a/services/authentication/jaxb/src/test/resources/META-INF/persistence.xml b/services/authentication/jaxb/src/test/resources/META-INF/persistence.xml deleted file mode 100644 index a9564d02da..0000000000 --- a/services/authentication/jaxb/src/test/resources/META-INF/persistence.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - org.collectionspace.services.authentication.User - - - - - - - diff --git a/services/authentication/jaxb/src/test/resources/hibernate.cfg.xml b/services/authentication/jaxb/src/test/resources/hibernate.cfg.xml deleted file mode 100644 index d416bb08af..0000000000 --- a/services/authentication/jaxb/src/test/resources/hibernate.cfg.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - @DB_CSPACE_URL@ - @DB_DRIVER_CLASS@ - @DB_CSPACE_USER@ - @DB_CSPACE_PASSWORD@ - @DB_DIALECT@ - org.hibernate.transaction.JDBCTransactionFactory - thread - true - - diff --git a/services/authentication/pom.xml b/services/authentication/pom.xml index cbeea2588c..b186fdf918 100644 --- a/services/authentication/pom.xml +++ b/services/authentication/pom.xml @@ -18,7 +18,6 @@ jaxb pstore service - client diff --git a/services/authentication/pstore/build.xml b/services/authentication/pstore/build.xml index 372d052e8c..82941c5fe6 100644 --- a/services/authentication/pstore/build.xml +++ b/services/authentication/pstore/build.xml @@ -107,48 +107,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Creating users table in the cspace database using user ${db.cspace.user} @@ -161,25 +119,6 @@ - org.collectionspace.services.authentication.pstore services.authentication.pstore - - authentication.sql - ${basedir}/src/main/resources/db - - - - - org.postgresql - postgresql - - - - org.collectionspace.services - org.collectionspace.services.authentication.jaxb - ${project.version} - - - cspace-services-authentication-pstore - - - maven-antrun-plugin - - - subs-hibernate-config - generate-test-resources - - run - - - - - - - - - - - - - - - ddl - - - - org.codehaus.mojo - properties-maven-plugin - - - ../../../build.properties - - - - - org.codehaus.mojo - hibernate3-maven-plugin - 2.2 - - - process-test-resources - - hbm2ddl - - - - - - - hbm2ddl - - - - ${sql.file} - jpaconfiguration - true - true - true - true - false - org.collectionspace.services.authentication - - - - - org.postgresql - postgresql - ${postgres.driver.version} - - - - - maven-antrun-plugin - - - process-test-resources - - - - - - - run - - - - - - - - - diff --git a/services/authentication/pstore/src/test/resources/META-INF/persistence.xml b/services/authentication/pstore/src/test/resources/META-INF/persistence.xml deleted file mode 100644 index 2844198043..0000000000 --- a/services/authentication/pstore/src/test/resources/META-INF/persistence.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - org.collectionspace.services.authentication.User - org.collectionspace.services.authentication.Token - - - - - - - diff --git a/services/authentication/pstore/src/test/resources/hibernate.cfg.xml b/services/authentication/pstore/src/test/resources/hibernate.cfg.xml deleted file mode 100644 index eb577d2288..0000000000 --- a/services/authentication/pstore/src/test/resources/hibernate.cfg.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - @DB_CSPACE_URL@ - @DB_DRIVER_CLASS@ - @DB_CSPACE_USER@ - @DB_CSPACE_PASSWORD@ - @DB_DIALECT@ - org.hibernate.transaction.JDBCTransactionFactory - thread - true - - diff --git a/services/authority/jaxb/pom.xml b/services/authority/jaxb/pom.xml index cd38021b2f..05ada4cfb0 100644 --- a/services/authority/jaxb/pom.xml +++ b/services/authority/jaxb/pom.xml @@ -13,18 +13,12 @@ services.authority.jaxb - - com.sun.xml.bind - jaxb-core - - - org.jvnet.jaxb2-commons - property-listener-injector - + + org.collectionspace.services org.collectionspace.services.jaxb ${project.version} - + \ No newline at end of file diff --git a/services/authority/pom.xml b/services/authority/pom.xml index 62f9ec0bb8..ed0b2d782b 100644 --- a/services/authority/pom.xml +++ b/services/authority/pom.xml @@ -51,17 +51,13 @@ javax.persistence - persistence-api + javax.persistence-api org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/authority/service/pom.xml b/services/authority/service/pom.xml index d0ec4e86ba..759d54f54e 100644 --- a/services/authority/service/pom.xml +++ b/services/authority/service/pom.xml @@ -142,26 +142,14 @@ javax.persistence - persistence-api + javax.persistence-api - - com.sun.xml.bind - jaxb-core - - - org.jvnet.jaxb2-commons - property-listener-injector - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy @@ -194,18 +182,7 @@ org.nuxeo.ecm.platform nuxeo-platform-imaging-core - ${nuxeo.platform.version} - - - org.nuxeo.ecm.platform - nuxeo-platform-imaging-api - ${nuxeo.platform.version} - provided - - - org.nuxeo.ecm.platform - nuxeo-platform-filemanager-api - ${nuxeo.platform.version} + ${nuxeo.general.release} org.nuxeo.common @@ -223,7 +200,7 @@ org.nuxeo.ecm.core nuxeo-core-query - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.ecm.core @@ -233,16 +210,10 @@ org.nuxeo.ecm.core nuxeo-core-storage-sql - org.nuxeo.runtime nuxeo-runtime-osgi - ${nuxeo.core.version} + ${nuxeo.general.release} org.osgi 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 3b73cf3a1f..a6b4844386 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 @@ -71,7 +71,7 @@ import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl; import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.dom4j.Element; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DocumentModel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -757,7 +757,7 @@ public String getShortIdentifier(ServiceContext ctx, String authCSID, String sch throw new DocumentNotFoundException(String.format("Could not find authority resource with CSID='%s'.", authCSID)); } shortIdentifier = (String) docModel.getProperty(schemaName, AuthorityJAXBSchema.SHORT_IDENTIFIER); - } catch (ClientException ce) { + } catch (NuxeoException ce) { throw new RuntimeException("AuthorityDocHandler Internal Error: cannot get shortId!", ce); } finally { if (repoSession != null) { 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 30616a1cdc..66facc603d 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 @@ -66,13 +66,12 @@ import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.collectionspace.services.relation.RelationsCommonList; import org.collectionspace.services.vocabulary.VocabularyItemJAXBSchema; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DocumentModel; -import org.nuxeo.ecm.core.api.model.PropertyException; +import org.nuxeo.ecm.core.api.PropertyException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -//import org.collectionspace.services.common.authority.AuthorityItemRelations; /** * AuthorityItemDocumentModelHandler * @@ -253,7 +252,7 @@ public String getUri(DocumentModel docModel) { try { inAuthority = (String) docModel.getProperty(authorityItemCommonSchemaName, AuthorityItemJAXBSchema.IN_AUTHORITY); - } catch (ClientException pe) { + } catch (NuxeoException pe) { throw new RuntimeException("Could not get parent specifier for item!"); } } diff --git a/services/authorization-mgt/client/pom.xml b/services/authorization-mgt/client/pom.xml index 3bfc04abb6..aa2c82491d 100644 --- a/services/authorization-mgt/client/pom.xml +++ b/services/authorization-mgt/client/pom.xml @@ -44,31 +44,14 @@ - org.testng testng org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider - - commons-httpclient commons-httpclient diff --git a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java index 18a65b3b0e..87faeaf62c 100644 --- a/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java +++ b/services/authorization-mgt/client/src/test/java/org/collectionspace/services/authorization/client/test/RoleServiceTest.java @@ -751,9 +751,7 @@ public void update(String testName) throws Exception { roleToUpdate.setDescription("updated role description"); if (logger.isDebugEnabled()) { logger.debug("updated object"); - org.collectionspace.services.authorization.ObjectFactory objectFactory = new org.collectionspace.services.authorization.ObjectFactory(); - logger.debug(objectAsXmlString(objectFactory.createRole(roleToUpdate), - Role.class)); + logger.debug(objectAsXmlString(roleToUpdate, Role.class)); } RoleClient client = new RoleClient(); // Submit the request to the service and store the response. @@ -859,9 +857,7 @@ public void verifyProtectionReadOnly(String testName) throws Exception { Assert.assertNotNull(roleUpdated); if (logger.isDebugEnabled()) { logger.debug(testName + "Updated role: "); - org.collectionspace.services.authorization.ObjectFactory objectFactory = new org.collectionspace.services.authorization.ObjectFactory(); - logger.debug(objectAsXmlString(objectFactory.createRole(roleUpdated), - Role.class)); + logger.debug(objectAsXmlString(roleUpdated, Role.class)); } Assert.assertFalse(RoleClient.IMMUTABLE.equalsIgnoreCase(roleUpdated.getMetadataProtection()), @@ -887,9 +883,7 @@ public void updateNotAllowed(String testName) throws Exception { roleToUpdate.setDisplayName("UPDATED-ROLE_USERS_TEST"); if (logger.isDebugEnabled()) { logger.debug("updated object"); - org.collectionspace.services.authorization.ObjectFactory objectFactory = new org.collectionspace.services.authorization.ObjectFactory(); - logger.debug(objectAsXmlString(objectFactory.createRole(roleToUpdate), - Role.class)); + logger.debug(objectAsXmlString(roleToUpdate, Role.class)); } RoleClient client = new RoleClient(); // Submit the request to the service and store the response. @@ -1063,9 +1057,7 @@ public Role createRoleInstance(String roleName, if (logger.isDebugEnabled()) { logger.debug("to be created, role"); - org.collectionspace.services.authorization.ObjectFactory objectFactory = new org.collectionspace.services.authorization.ObjectFactory(); - logger.debug(objectAsXmlString(objectFactory.createRole(role), - Role.class)); + logger.debug(objectAsXmlString(role, Role.class)); } return role; diff --git a/services/authorization-mgt/import/build.xml b/services/authorization-mgt/import/build.xml index 80ea02a208..317041b16c 100644 --- a/services/authorization-mgt/import/build.xml +++ b/services/authorization-mgt/import/build.xml @@ -110,7 +110,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -133,12 +133,12 @@ - - - + + + - + @@ -147,7 +147,7 @@ - + diff --git a/services/authorization-mgt/import/pom.xml b/services/authorization-mgt/import/pom.xml index 74e88e9590..842cd0b5a8 100644 --- a/services/authorization-mgt/import/pom.xml +++ b/services/authorization-mgt/import/pom.xml @@ -15,27 +15,51 @@ - + org.collectionspace.services - org.collectionspace.services.authentication.service + org.collectionspace.services.common ${project.version} - provided + + + org.nuxeo.binary.metadata + * + + + org.nuxeo.lib.runtime + * + + + org.nuxeo.ecm.platform + * + + + org.nuxeo.runtime + * + + + org.nuxeo.ecm.core + * + + + javax.xml.bind + jaxb-api + + org.collectionspace.services - org.collectionspace.services.authorization.service + org.collectionspace.services.authorization.jaxb ${project.version} - provided org.collectionspace.services - org.collectionspace.services.authorization.jaxb + org.collectionspace.services.hyperjaxb ${project.version} org.collectionspace.services - org.collectionspace.services.config + org.collectionspace.services.authentication.service ${project.version} @@ -47,205 +71,121 @@ commons-codec commons-codec + + org.jboss.resteasy + * + org.collectionspace.services - org.collectionspace.services.authorization-mgt.client + org.collectionspace.services.config ${project.version} - - - commons-codec - commons-codec - 1.4 - + + + - org.testng - testng + org.slf4j + slf4j-api + compile commons-cli commons-cli - org.springframework.security - spring-security-core - ${spring.security.version} - provided - - - org.springframework.security - spring-security-config - ${spring.security.version} - provided - - - org.springframework.security - spring-security-acl - ${spring.security.version} - provided + org.hibernate + hibernate-core + 5.6.15.Final + + + javax.xml.bind + jaxb-api + + - org.springframework.security - spring-security-web - ${spring.security.version} - provided + org.springframework + spring-beans + ${spring.version} + compile org.springframework spring-context ${spring.version} - provided + compile org.springframework - spring-context-support + spring-core ${spring.version} - provided + compile org.springframework - spring-aop + spring-jdbc ${spring.version} - provided + compile org.springframework - spring-beans + spring-tx ${spring.version} - provided + compile - aopalliance - aopalliance - 1.0 - provided + org.springframework.security + spring-security-core + ${spring.security.version} + compile - + + - org.jboss.security - jbosssx - 2.0.3.SP1 - provided + org.springframework.security + spring-security-acl + ${spring.security.version} + runtime + + + org.springframework + spring-context-support + ${spring.version} + runtime + + + org.springframework + spring-expression + ${spring.version} + runtime net.sf.ehcache ehcache - 2.10.2 + 2.10.9.2 + runtime org.postgresql postgresql + runtime ch.elca.el4j.modules module-xml_merge-common - - - commons-codec - commons-codec - - - xml-apis - xml-apis - - + runtime - org.collectionspace.services - - org.collectionspace.services.authorization-mgt.service - - ${project.version} - - - nuxeo-core-query - org.nuxeo.ecm.core - - - nuxeo-opencmis-bindings - org.nuxeo.ecm.core - - - nuxeo-runtime - org.nuxeo.runtime - - - nuxeo-core-api - org.nuxeo.ecm.core - - - nuxeo-platform-types-core - org.nuxeo.ecm.platform - - - - nuxeo-platform-filemanager-api - - org.nuxeo.ecm.platform - - - nuxeo-core-schema - org.nuxeo.ecm.core - - - nuxeo-platform-mimetype-api - org.nuxeo.ecm.platform - - - nuxeo-core-io - org.nuxeo.ecm.core - - - nuxeo-platform-types-api - org.nuxeo.ecm.platform - - - nuxeo-runtime-launcher - org.nuxeo.lib.runtime - - - nuxeo-core-storage-sql-ra - org.nuxeo.ecm.core - - - nuxeo-platform-imaging-core - org.nuxeo.ecm.platform - - - nuxeo-runtime-osgi - org.nuxeo.runtime - - - nuxeo-platform-imaging-api - org.nuxeo.ecm.platform - - - nuxeo-core-convert - org.nuxeo.ecm.core - - - - nuxeo-platform-mimetype-core - - org.nuxeo.ecm.platform - - - nuxeo-core-storage-sql - org.nuxeo.ecm.core - - - commons-codec - commons-codec - - + org.hibernate + hibernate-entitymanager + runtime - cspace-services-authorization-mgt-import @@ -298,8 +238,6 @@ - org.postgresql postgresql diff --git a/services/authorization-mgt/import/src/main/java/org/collectionspace/ImportAuthz.java b/services/authorization-mgt/import/src/main/java/org/collectionspace/ImportAuthz.java index af8445eed7..d52a96cdef 100644 --- a/services/authorization-mgt/import/src/main/java/org/collectionspace/ImportAuthz.java +++ b/services/authorization-mgt/import/src/main/java/org/collectionspace/ImportAuthz.java @@ -37,6 +37,7 @@ import org.collectionspace.services.authorization.driver.AuthorizationSeedDriver; import org.collectionspace.services.common.document.TransactionException; import org.collectionspace.services.common.storage.jpa.JPATransactionContext; +import org.collectionspace.services.common.storage.jpa.JpaStorageUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -140,9 +141,9 @@ private static Options createOptions() { // Create our AuthZ metadata // public static void main(String[] args) throws TransactionException { - Options options = createOptions(); + AuthorizationSeedDriver driver = null; CommandLineParser parser = new GnuParser(); JPATransactionContext jpaTransactionContext = new JPATransactionContext(); try { @@ -161,8 +162,7 @@ public static void main(String[] args) throws TransactionException { // // Instantiate an AuthZ seed driver and ask it to generate our AuthZ metadata // - AuthorizationSeedDriver driver = new AuthorizationSeedDriver( - user, password, tenantBinding, exportDir); + driver = new AuthorizationSeedDriver(user, password, tenantBinding, exportDir); jpaTransactionContext.beginTransaction(); driver.generate(jpaTransactionContext); logger.info("Finished processing all tenant bindings files and generating all AuthN/AuthZ metadata."); @@ -190,6 +190,10 @@ public static void main(String[] args) throws TransactionException { System.exit(1); } finally { jpaTransactionContext.close(); + JpaStorageUtils.releaseEntityManagerFactories(); + if (driver != null) { + driver.close(); + } } } } diff --git a/services/authorization-mgt/import/src/main/java/org/collectionspace/services/authorization/driver/AuthorizationSeedDriver.java b/services/authorization-mgt/import/src/main/java/org/collectionspace/services/authorization/driver/AuthorizationSeedDriver.java index 7b9a3d5092..179a22677b 100644 --- a/services/authorization-mgt/import/src/main/java/org/collectionspace/services/authorization/driver/AuthorizationSeedDriver.java +++ b/services/authorization-mgt/import/src/main/java/org/collectionspace/services/authorization/driver/AuthorizationSeedDriver.java @@ -28,31 +28,22 @@ import java.util.HashSet; import java.util.List; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; - import org.collectionspace.authentication.AuthN; -import org.collectionspace.services.authorization.AuthZ; -import org.collectionspace.services.authorization.perms.Permission; import org.collectionspace.services.authorization.PermissionRole; import org.collectionspace.services.authorization.PermissionRoleRel; import org.collectionspace.services.authorization.Role; import org.collectionspace.services.authorization.SubjectType; import org.collectionspace.services.authorization.importer.AuthorizationGen; import org.collectionspace.services.authorization.importer.AuthorizationSeed; -import org.collectionspace.services.common.authorization_mgt.AuthorizationCommon; +import org.collectionspace.services.authorization.perms.Permission; import org.collectionspace.services.common.authorization_mgt.AuthorizationStore; import org.collectionspace.services.common.authorization_mgt.PermissionRoleUtil; -import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.storage.jpa.JPATransactionContext; -import org.collectionspace.services.common.storage.jpa.JpaStorageUtils; - import org.hibernate.exception.ConstraintViolationException; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import org.springframework.context.support.ClassPathXmlApplicationContext; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; @@ -69,16 +60,17 @@ public class AuthorizationSeedDriver { final Logger logger = LoggerFactory.getLogger(AuthorizationSeedDriver.class); - final static private String SPRING_SECURITY_METADATA = "applicationContext-authorization-test.xml"; - final static private String ROLE_FILE = "import-roles.xml"; - final static private String PERMISSION_FILE = "import-permissions.xml"; - final static private String PERMISSION_ROLE_FILE = "import-permissions-roles.xml"; + private static final String SPRING_SECURITY_METADATA = "applicationContext-authorization-test.xml"; + private static final String ROLE_FILE = "import-roles.xml"; + private static final String PERMISSION_FILE = "import-permissions.xml"; + private static final String PERMISSION_ROLE_FILE = "import-permissions-roles.xml"; private String user; private String password; private String tenantBindingFile; private String exportDir; private AuthorizationGen authzGen; - private org.springframework.jdbc.datasource.DataSourceTransactionManager txManager; + private DataSourceTransactionManager txManager; + private ClassPathXmlApplicationContext appContext; /** * AuthorizationSeedDriver @@ -101,7 +93,7 @@ public AuthorizationSeedDriver(String user, String password, throw new IllegalArgumentException("password required."); } this.password = password; - + if (tenantBindingFile == null || tenantBindingFile.isEmpty()) { throw new IllegalArgumentException("tenantbinding file are required."); } @@ -143,14 +135,11 @@ public void seed(JPATransactionContext jpaTransactionContext) { // Push all the authz info into the cspace DB tables -this include default roles, permissions, and permroles // store(); - setupSpringSecurity(); status = beginTransaction("seedData"); AuthorizationSeed authzSeed = new AuthorizationSeed(); authzSeed.seedPermissions(jpaTransactionContext, authzGen.getDefaultPermissions(), authzGen.getDefaultPermissionRoles()); - if (logger.isDebugEnabled()) { - logger.debug("Authorization seeding completed."); - } + logger.debug("Authorization seeding completed."); } catch (Exception ex) { if (status != null) { rollbackTransaction(status); @@ -167,51 +156,45 @@ public void seed(JPATransactionContext jpaTransactionContext) { } } + /** + * Close the application context to allow for a clean shutdown of the ImportAuthz application. + */ + public void close() { + if (appContext != null && appContext.isActive()) { + appContext.close(); + } + } + /** * Setup of Spring Security context */ private void setupSpringSecurity() { - ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext( - new String[]{SPRING_SECURITY_METADATA}); + appContext = new ClassPathXmlApplicationContext(SPRING_SECURITY_METADATA); System.setProperty("spring-beans-config", SPRING_SECURITY_METADATA); - // - // authZ local not used but call to AuthZ.get() has side-effect of initializing our Spring Security context - // - AuthZ authZ = AuthZ.get(); - txManager = (org.springframework.jdbc.datasource.DataSourceTransactionManager) appContext.getBean("transactionManager"); - // - // debug - // - if (logger.isDebugEnabled()) { - logger.debug("Spring Security setup complete."); - } + txManager = (DataSourceTransactionManager) appContext.getBean("transactionManager"); + logger.debug("Spring Security setup complete."); } private void login() { - //GrantedAuthority cspace_admin = new SimpleGrantedAuthority("ROLE_ADMINISTRATOR"); - GrantedAuthority spring_security_admin = new SimpleGrantedAuthority(AuthN.ROLE_SPRING_ADMIN_NAME); //NOTE: Must match with value in applicationContext-authorization-test.xml (aka SPRING_SECURITY_METADATA) - HashSet gauths = new HashSet(); - //gauths.add(cspace_admin); - gauths.add(spring_security_admin); + //NOTE: Must match with value in applicationContext-authorization-test.xml (aka SPRING_SECURITY_METADATA) + GrantedAuthority springSecurityAdmin = new SimpleGrantedAuthority(AuthN.ROLE_SPRING_ADMIN_NAME); + HashSet gauths = new HashSet<>(); + gauths.add(springSecurityAdmin); Authentication authRequest = new UsernamePasswordAuthenticationToken(user, password, gauths); SecurityContextHolder.getContext().setAuthentication(authRequest); - if (logger.isDebugEnabled()) { - logger.debug("Spring Security login successful for user=" + user); - } + logger.debug("Spring Security login successful for user={}", user); } private void logout() { SecurityContextHolder.getContext().setAuthentication(null); - if (logger.isDebugEnabled()) { - logger.debug("Spring Security logged out user=" + user); - } + logger.debug("Spring Security logged out user={}", user); } private void store() throws Exception { - JPATransactionContext jpaTransactionContext = new JPATransactionContext((ServiceContext)null); + JPATransactionContext jpaTransactionContext = new JPATransactionContext(null); try { jpaTransactionContext.beginTransaction(); - + AuthorizationStore authzStore = new AuthorizationStore(); logger.info("Seeding Roles metadata to database."); for (Role role : authzGen.getDefaultRoles()) { @@ -229,14 +212,16 @@ private void store() throws Exception { } } } - + logger.info("Seeding Permissions metadata to database."); - for (Permission perm : authzGen.getDefaultPermissions()) { //FIXME: REM - 3/27/2012 - If we change the CSID of permissions to something like a refname, then we need to check for existing perms just like we did above for roles + //FIXME: REM - 3/27/2012 - If we change the CSID of permissions to something like a refname, then we need + // to check for existing perms just like we did above for roles + for (Permission perm : authzGen.getDefaultPermissions()) { authzStore.store(jpaTransactionContext, perm); } - + logger.info("Seeding Permissions/Roles relationships metadata to database."); - List permRoleRels = new ArrayList(); + List permRoleRels = new ArrayList<>(); for (PermissionRole pr : authzGen.getDefaultPermissionRoles()) { String tenantId = getTenantId(pr); PermissionRoleUtil.buildPermissionRoleRel(jpaTransactionContext, pr, SubjectType.ROLE, permRoleRels, false /*not for delete*/, tenantId); @@ -244,7 +229,7 @@ private void store() throws Exception { for (PermissionRoleRel permRoleRel : permRoleRels) { authzStore.store(jpaTransactionContext, permRoleRel); } - + jpaTransactionContext.commitTransaction(); if (logger.isInfoEnabled()) { logger.info("All Authorization metadata persisted."); @@ -265,11 +250,10 @@ private void store() throws Exception { */ private String getTenantId(PermissionRole pr) { String result = null; - + // Since all the role and permission values in a PermissionRole instance *must* have the same tenant ID, we // can just get the tenant ID from the 0th (first) role. result = pr.getRole().get(0).getTenantId(); - return result; } diff --git a/services/authorization-mgt/import/src/main/java/org/collectionspace/services/authorization/importer/AuthorizationGen.java b/services/authorization-mgt/import/src/main/java/org/collectionspace/services/authorization/importer/AuthorizationGen.java index 51c722f65e..d712f2eb16 100644 --- a/services/authorization-mgt/import/src/main/java/org/collectionspace/services/authorization/importer/AuthorizationGen.java +++ b/services/authorization-mgt/import/src/main/java/org/collectionspace/services/authorization/importer/AuthorizationGen.java @@ -24,38 +24,33 @@ package org.collectionspace.services.authorization.importer; import java.io.File; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import java.util.ArrayList; import java.util.Hashtable; import java.util.List; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import org.collectionspace.services.client.TenantClient; -import org.collectionspace.authentication.AuthN; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.Marshaller; import org.collectionspace.authentication.AuthN; - -import org.collectionspace.services.authorization.perms.Permission; import org.collectionspace.services.authorization.PermissionRole; import org.collectionspace.services.authorization.PermissionValue; -import org.collectionspace.services.authorization.perms.PermissionsList; import org.collectionspace.services.authorization.PermissionsRolesList; - import org.collectionspace.services.authorization.Role; import org.collectionspace.services.authorization.RoleValue; import org.collectionspace.services.authorization.RolesList; import org.collectionspace.services.authorization.SubjectType; - +import org.collectionspace.services.authorization.perms.Permission; +import org.collectionspace.services.authorization.perms.PermissionsList; +import org.collectionspace.services.client.TenantClient; import org.collectionspace.services.common.authorization_mgt.AuthorizationCommon; import org.collectionspace.services.common.config.ServicesConfigReaderImpl; import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl; +import org.collectionspace.services.common.jaxb.JAXBContextCache; import org.collectionspace.services.common.security.SecurityUtils; import org.collectionspace.services.common.storage.jpa.JPATransactionContext; - import org.collectionspace.services.config.service.ServiceBindingType; import org.collectionspace.services.config.tenant.TenantBindingType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * AuthorizationGen generates authorizations (permissions and roles) @@ -478,13 +473,7 @@ private Role buildTenantMgmntRole() { public void exportDefaultRoles(String fileName) { RolesList rList = new RolesList(); rList.setRole(this.getDefaultRoles()); - // - // Since it is missing the @XMLRootElement annotation, create a JAXBElement wrapper for the RoleList instance - // so we can have it marshalled it correctly. - // - org.collectionspace.services.authorization.ObjectFactory objectFactory = new org.collectionspace.services.authorization.ObjectFactory(); - toFile(objectFactory.createRolesList(rList), RolesList.class, - fileName); + toFile(rList, RolesList.class, fileName); if (logger.isDebugEnabled()) { logger.debug("exported roles to " + fileName); } @@ -493,11 +482,7 @@ public void exportDefaultRoles(String fileName) { public void exportDefaultPermissions(String fileName) { PermissionsList pcList = new PermissionsList(); pcList.setPermission(this.getDefaultPermissions()); - org.collectionspace.services.authorization.ObjectFactory objectFactory = - new org.collectionspace.services.authorization.ObjectFactory(); - toFile(pcList, PermissionsList.class, -// toFile(objectFactory.createPermissionsList(pcList), PermissionsList.class, - fileName); + toFile(pcList, PermissionsList.class, fileName); if (logger.isDebugEnabled()) { logger.debug("exported permissions to " + fileName); } @@ -506,8 +491,7 @@ public void exportDefaultPermissions(String fileName) { public void exportDefaultPermissionRoles(String fileName) { PermissionsRolesList psrsl = new PermissionsRolesList(); psrsl.setPermissionRole(this.getDefaultAdminPermissionRoles()); - toFile(psrsl, PermissionsRolesList.class, - fileName); + toFile(psrsl, PermissionsRolesList.class, fileName); if (logger.isDebugEnabled()) { logger.debug("exported permissions-roles to " + fileName); } @@ -516,10 +500,9 @@ public void exportDefaultPermissionRoles(String fileName) { private void toFile(Object o, Class jaxbClass, String fileName) { File f = new File(fileName); try { - JAXBContext jc = JAXBContext.newInstance(jaxbClass); + JAXBContext jc = JAXBContextCache.getInstance().getCachedJAXBContext(jaxbClass); Marshaller m = jc.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, - Boolean.TRUE); + m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(o, f); } catch (Exception e) { e.printStackTrace(); diff --git a/services/authorization-mgt/import/src/main/java/org/collectionspace/services/authorization/importer/AuthorizationSeed.java b/services/authorization-mgt/import/src/main/java/org/collectionspace/services/authorization/importer/AuthorizationSeed.java index 7ac92c8192..64e57c76ea 100644 --- a/services/authorization-mgt/import/src/main/java/org/collectionspace/services/authorization/importer/AuthorizationSeed.java +++ b/services/authorization-mgt/import/src/main/java/org/collectionspace/services/authorization/importer/AuthorizationSeed.java @@ -25,21 +25,19 @@ import java.io.FileInputStream; import java.io.InputStream; - import java.util.List; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Unmarshaller; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.collectionspace.services.authorization.perms.Permission; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.Unmarshaller; import org.collectionspace.services.authorization.PermissionRole; -import org.collectionspace.services.authorization.perms.PermissionsList; import org.collectionspace.services.authorization.PermissionsRolesList; +import org.collectionspace.services.authorization.perms.Permission; +import org.collectionspace.services.authorization.perms.PermissionsList; import org.collectionspace.services.common.authorization_mgt.AuthorizationCommon; +import org.collectionspace.services.common.jaxb.JAXBContextCache; import org.collectionspace.services.common.storage.jpa.JPATransactionContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * AuthorizationSeed seeds authorizations (permission, role) into authz provider database @@ -145,20 +143,12 @@ private CSpaceAction getAction(ActionType action) { */ static Object fromFile(Class jaxbClass, String fileName) throws Exception { - InputStream is = new FileInputStream(fileName); - try { - JAXBContext context = JAXBContext.newInstance(jaxbClass); + try (InputStream is = new FileInputStream(fileName)) { + JAXBContext context = JAXBContextCache.getInstance().getCachedJAXBContext(jaxbClass); Unmarshaller unmarshaller = context.createUnmarshaller(); //note: setting schema to null will turn validator off unmarshaller.setSchema(null); return jaxbClass.cast(unmarshaller.unmarshal(is)); - } finally { - if (is != null) { - try { - is.close(); - } catch (Exception e) { - } - } } } } diff --git a/services/authorization-mgt/import/src/main/resources/META-INF/persistence.xml b/services/authorization-mgt/import/src/main/resources/META-INF/persistence.xml index b694ab8554..7435d5ab75 100644 --- a/services/authorization-mgt/import/src/main/resources/META-INF/persistence.xml +++ b/services/authorization-mgt/import/src/main/resources/META-INF/persistence.xml @@ -1,6 +1,8 @@ - + org.collectionspace.services.authorization.perms.Permission org.collectionspace.services.authorization.perms.PermissionAction @@ -8,7 +10,13 @@ org.collectionspace.services.authorization.Role org.collectionspace.services.authorization.AccountRoleRel - + + + + + + + diff --git a/services/authorization-mgt/import/src/main/resources/hibernate.cfg.xml b/services/authorization-mgt/import/src/main/resources/hibernate.cfg.xml deleted file mode 100644 index 0d9143787c..0000000000 --- a/services/authorization-mgt/import/src/main/resources/hibernate.cfg.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - @DB_CSPACE_URL@ - @DB_DRIVER_CLASS@ - @DB_CSPACE_USER@ - @DB_CSPACE_PASSWORD@ - @DB_DIALECT@ - org.hibernate.transaction.JDBCTransactionFactory - thread - false - - diff --git a/services/authorization-mgt/jaxb/pom.xml b/services/authorization-mgt/jaxb/pom.xml index 866b1c95c8..44bc2c9589 100644 --- a/services/authorization-mgt/jaxb/pom.xml +++ b/services/authorization-mgt/jaxb/pom.xml @@ -14,14 +14,8 @@ - - com.sun.xml.bind - jaxb-core - - - org.jvnet.jaxb2-commons - property-listener-injector - + + javax.persistence persistence-api @@ -35,10 +29,7 @@ org.dom4j dom4j - - org.jvnet.hyperjaxb3 - hyperjaxb3-ejb-runtime - + org.collectionspace.services org.collectionspace.services.jaxb @@ -55,11 +46,12 @@ collectionspace-services-authorization-mgt-jaxb install + - org.jvnet.hyperjaxb3 - maven-hyperjaxb3-plugin + org.jvnet.jaxb + hyperjaxb3-ejb-plugin + --> diff --git a/services/authorization-mgt/service/pom.xml b/services/authorization-mgt/service/pom.xml index 2cd2f08866..a6e4194e02 100644 --- a/services/authorization-mgt/service/pom.xml +++ b/services/authorization-mgt/service/pom.xml @@ -53,11 +53,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy @@ -133,8 +129,8 @@ provided - javax.xml.bind - jaxb-api + jakarta.xml.bind + jakarta.xml.bind-api org.collectionspace.services diff --git a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/PermissionResource.java.txt b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/PermissionResource.java.txt deleted file mode 100644 index 22ac5c5034..0000000000 --- a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/PermissionResource.java.txt +++ /dev/null @@ -1,254 +0,0 @@ -/** - * 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.authorization; - -import org.collectionspace.services.authorization.perms.Permission; -import org.collectionspace.services.authorization.perms.PermissionsList; -import org.collectionspace.services.authorization.storage.AuthorizationDelegate; -import org.collectionspace.services.client.CollectionSpaceClientUtils; -import org.collectionspace.services.client.PayloadOutputPart; -import org.collectionspace.services.client.PermissionClient; -import org.collectionspace.services.common.SecurityResourceBase; -import org.collectionspace.services.common.ServiceMessages; -import org.collectionspace.services.common.context.RemoteServiceContextFactory; -import org.collectionspace.services.common.context.ServiceContext; -import org.collectionspace.services.common.context.ServiceContextFactory; -import org.collectionspace.services.common.storage.StorageClient; -import org.collectionspace.services.common.storage.jpa.JpaStorageClientImpl; -import org.jboss.resteasy.util.HttpResponseCodes; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.Produces; -import javax.ws.rs.QueryParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import javax.ws.rs.core.UriInfo; - -@Path(PermissionClient.SERVICE_PATH) -@Consumes("application/xml") -@Produces("application/xml") -public class PermissionResource extends SecurityResourceBase { - - final Logger logger = LoggerFactory.getLogger(PermissionResource.class); - final StorageClient storageClient = new JpaStorageClientImpl(); - - @Override - protected String getVersionString() { - return "$LastChangedRevision: 1165 $"; - } - - @Override - public String getServiceName() { - return PermissionClient.SERVICE_NAME; - } - - @Override - public Class getCommonPartClass() { - return Permission.class; - } - - @Override - public ServiceContextFactory getServiceContextFactory() { - return RemoteServiceContextFactory.get(); - } - - @Override - public StorageClient getStorageClient(ServiceContext ctx) { - //FIXME use ctx to identify storage client - return storageClient; - } - - @POST - public Response createPermission(Permission input) { - return create(input); - } - - public Permission createPermissionFromInstance(Permission input) { - Permission result = null; - - String permCsid = null; - Response response = createPermission(input); - if (response.getStatus() == Response.Status.CREATED.getStatusCode()) { - permCsid = CollectionSpaceClientUtils.extractId(response); - result = getPermission(permCsid); - } - - return result; - } - - @GET - @Path("{csid}") - public Permission getPermission(@PathParam("csid") String csid) { - return (Permission)get(csid, Permission.class); - } - - @GET - @Produces("application/xml") - public PermissionsList getPermissionList(@Context UriInfo ui) { - PermissionsList result = (PermissionsList)getList(ui, Permission.class); - if(logger.isTraceEnabled()) { - PayloadOutputPart ppo = new PayloadOutputPart(PermissionsList.class.getName(), result); - System.out.println(ppo.asXML()); - } - - return result; - } - - @PUT - @Path("{csid}") - public Permission updatePermission(@PathParam("csid") String csid,Permission theUpdate) { - return (Permission)update(csid, theUpdate, Permission.class); - } - - @DELETE - @Path("{csid}") - public Response deletePermission(@PathParam("csid") String csid) { - logger.debug("deletePermission with csid=" + csid); - ensureCSID(csid, ServiceMessages.DELETE_FAILED + "permission "); - try { - //FIXME ideally the following two ops should be in the same tx CSPACE-658 - //delete all relationships for this permission - PermissionRoleSubResource subResource = - new PermissionRoleSubResource(PermissionRoleSubResource.PERMISSION_PERMROLE_SERVICE); - subResource.deletePermissionRole(csid, SubjectType.ROLE); - //NOTE for delete permissions in the authz provider - //at the PermissionRoleSubResource/DocHandler level, there is no visibility - //if permission is deleted, so do it here, however, - //this is a very dangerous operation as it deletes the Spring ACL instead of ACE(s) - //the ACL might be needed for other ACEs roles... - AuthorizationDelegate.deletePermissions(csid); - - ServiceContext ctx = createServiceContext((Permission) null, Permission.class); - getStorageClient(ctx).delete(ctx, csid); - return Response.status(HttpResponseCodes.SC_OK).build(); - } catch (Exception e) { - throw bigReThrow(e, ServiceMessages.DELETE_FAILED, csid); - } - } - - @POST - @Path("{csid}/permroles") - public Response createPermissionRole(@QueryParam("_method") String method, - @PathParam("csid") String permCsid, - PermissionRole input) { - if (method != null) { - if ("delete".equalsIgnoreCase(method)) { - return deletePermissionRole(permCsid, input); - } - } - logger.debug("createPermissionRole with permCsid=" + permCsid); - ensureCSID(permCsid, ServiceMessages.POST_FAILED + "permroles permission "); - try { - PermissionRoleSubResource subResource = - new PermissionRoleSubResource(PermissionRoleSubResource.PERMISSION_PERMROLE_SERVICE); - String permrolecsid = subResource.createPermissionRole(input, SubjectType.ROLE); - UriBuilder path = UriBuilder.fromResource(PermissionResource.class); - path.path(permCsid + "/permroles/" + permrolecsid); - Response response = Response.created(path.build()).build(); - return response; - } catch (Exception e) { - throw bigReThrow(e, ServiceMessages.POST_FAILED, permCsid); - } - } - - @GET - @Path("{csid}/permroles/{id}") - public PermissionRoleRel getPermissionRole( - @PathParam("csid") String permCsid, - @PathParam("id") String permrolecsid) { - logger.debug("getPermissionRole with permCsid=" + permCsid); - ensureCSID(permCsid, ServiceMessages.GET_FAILED + "permroles permission "); - PermissionRoleRel result = null; - try { - PermissionRoleSubResource subResource = - new PermissionRoleSubResource(PermissionRoleSubResource.PERMISSION_PERMROLE_SERVICE); - //get relationships for a permission - result = subResource.getPermissionRoleRel(permCsid, SubjectType.ROLE, permrolecsid); - } catch (Exception e) { - throw bigReThrow(e, ServiceMessages.GET_FAILED, permCsid); - } - checkResult(result, permCsid, ServiceMessages.GET_FAILED); - return result; - } - - @GET - @Path("{csid}/permroles") - public PermissionRole getPermissionRole( - @PathParam("csid") String permCsid) { - logger.debug("getPermissionRole with permCsid=" + permCsid); - ensureCSID(permCsid, ServiceMessages.GET_FAILED + "permroles permission "); - PermissionRole result = null; - try { - PermissionRoleSubResource subResource = - new PermissionRoleSubResource(PermissionRoleSubResource.PERMISSION_PERMROLE_SERVICE); - //get relationships for a permission - result = subResource.getPermissionRole(permCsid, SubjectType.ROLE); - } catch (Exception e) { - throw bigReThrow(e, ServiceMessages.GET_FAILED, permCsid); - } - checkResult(result, permCsid, ServiceMessages.GET_FAILED); - return result; - } - - public Response deletePermissionRole(String permCsid, PermissionRole input) { - logger.debug("Delete payload of permrole relationships with permission permCsid=" + permCsid); - ensureCSID(permCsid, ServiceMessages.DELETE_FAILED + "permroles permission "); - try { - PermissionRoleSubResource subResource = - new PermissionRoleSubResource(PermissionRoleSubResource.PERMISSION_PERMROLE_SERVICE); - //delete all relationships for a permission - subResource.deletePermissionRole(permCsid, SubjectType.ROLE, input); - return Response.status(HttpResponseCodes.SC_OK).build(); - } catch (Exception e) { - throw bigReThrow(e, ServiceMessages.DELETE_FAILED, permCsid); - } - } - - @DELETE - @Path("{csid}/permroles") - public Response deletePermissionRole( - @PathParam("csid") String permCsid) { - logger.debug("Delete all the role relationships of the permissions with permCsid=" + permCsid); - ensureCSID(permCsid, ServiceMessages.DELETE_FAILED + "permroles permission "); - try { - PermissionRoleSubResource subResource = - new PermissionRoleSubResource(PermissionRoleSubResource.PERMISSION_PERMROLE_SERVICE); - //delete all relationships for a permission - subResource.deletePermissionRole(permCsid, SubjectType.ROLE); - return Response.status(HttpResponseCodes.SC_OK).build(); - } catch (Exception e) { - throw bigReThrow(e, ServiceMessages.DELETE_FAILED, permCsid); - } - } - -} diff --git a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/RoleResource.java b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/RoleResource.java index 3e5bac641c..b14bb39bea 100644 --- a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/RoleResource.java +++ b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/RoleResource.java @@ -100,7 +100,7 @@ public Response createRole(Role input) { // // Replace the generic error message with a Role-specific error message // - String msg = String.format("There is already a role with the name '%s'. Please choose a different name.", input.displayName); + String msg = String.format("There is already a role with the name '%s'. Please choose a different name.", input.getDisplayName()); throw bigReThrow(new DocumentException(msg, de, de.getErrorCode()), msg); } } diff --git a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/PermissionDocumentHandler.java.txt b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/PermissionDocumentHandler.java.txt deleted file mode 100644 index 9be3c7b6e2..0000000000 --- a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/PermissionDocumentHandler.java.txt +++ /dev/null @@ -1 +0,0 @@ -The PermissionDocumentHandler.java file has been move to the "org.collectionspace.services.common" module. \ No newline at end of file diff --git a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/PermissionValidatorHandler.java b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/PermissionValidatorHandler.java index 0e45348138..a810bda645 100644 --- a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/PermissionValidatorHandler.java +++ b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/PermissionValidatorHandler.java @@ -26,7 +26,7 @@ import java.util.List; -import javax.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBElement; import org.collectionspace.services.authorization.perms.Permission; import org.collectionspace.services.authorization.perms.PermissionAction; @@ -117,12 +117,8 @@ private boolean validateActionFields(Action action, Permission permission) { } else { if (action.equals(Action.CREATE)) { result = false; - org.collectionspace.services.authorization.perms.ObjectFactory objectFactory = - new org.collectionspace.services.authorization.perms.ObjectFactory(); - JAXBElement permJaxbElement = objectFactory.createPermission(permission); - String msg = String.format("Either (or both) the 'action' or 'actiongroup' element needs to be set: %s", - JaxbUtils.toString(permJaxbElement, Permission.class)); - logger.error(msg); + logger.error("Either (or both) the 'action' or 'actiongroup' element needs to be set: {}", + JaxbUtils.toString(permission, Permission.class)); } } diff --git a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/RoleDocumentHandler.java b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/RoleDocumentHandler.java index 0d7ee53b87..88154ac297 100644 --- a/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/RoleDocumentHandler.java +++ b/services/authorization-mgt/service/src/main/java/org/collectionspace/services/authorization/storage/RoleDocumentHandler.java @@ -154,9 +154,7 @@ private Role merge(Role from, Role to) throws Exception { } if (logger.isDebugEnabled()) { - org.collectionspace.services.authorization.ObjectFactory objectFactory = - new org.collectionspace.services.authorization.ObjectFactory(); - logger.debug("Merged role on update=" + JaxbUtils.toString(objectFactory.createRole(to), Role.class)); + logger.debug("Merged role on update= {}", JaxbUtils.toString(to, Role.class)); } return to; @@ -259,19 +257,19 @@ protected RolesList extractPagingInfoForRoles(RolesList roleList, DocumentWrappe return roleList; } - + @Override public RolesList extractCommonPartList( DocumentWrapper> wrapDoc) throws Exception { - RolesList rolesList = extractPagingInfoForRoles(new RolesList(), wrapDoc); + RolesList rolesList = extractPagingInfoForRoles(new RolesList(), wrapDoc); List list = new ArrayList(); rolesList.setRole(list); for (Role role : wrapDoc.getWrappedObject()) { sanitize(role); list.add(role); } - + return rolesList; } @@ -296,8 +294,7 @@ public void setCommonPartList(RolesList rolesList) { } @Override - public String getQProperty( - String prop) { + public String getQProperty(String prop) { return null; } diff --git a/services/authorization/jaxb/pom.xml b/services/authorization/jaxb/pom.xml index f6d0963189..ddd7e64afa 100644 --- a/services/authorization/jaxb/pom.xml +++ b/services/authorization/jaxb/pom.xml @@ -10,87 +10,31 @@ 4.0.0 org.collectionspace.services.authorization.jaxb services.authorization.jaxb - - + - - com.sun.xml.bind - jaxb-core - - - com.sun.xml.bind - jaxb-impl - - - org.jvnet.jaxb2-commons - property-listener-injector - - - javax.persistence - persistence-api - - - org.hibernate - hibernate-entitymanager - - - - org.dom4j - dom4j - - - org.hibernate - hibernate-c3p0 - - - org.jvnet.hyperjaxb3 - hyperjaxb3-ejb-runtime - - - org.collectionspace.services - org.collectionspace.services.hyperjaxb - ${project.version} - - - javax.xml.bind - jaxb-api - - collectionspace-services-authorization-jaxb install - - - org.jvnet.hyperjaxb3 - maven-hyperjaxb3-plugin - - - + diff --git a/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountPermission.java b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountPermission.java new file mode 100644 index 0000000000..5e4099852b --- /dev/null +++ b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountPermission.java @@ -0,0 +1,47 @@ +package org.collectionspace.services.authorization; + +import java.util.ArrayList; +import java.util.List; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import org.jspecify.annotations.NonNull; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "account_permission") +public class AccountPermission { + + @XmlElement(required = true) + private List account; + + @XmlElement(required = true) + private List permission; + + @NonNull + public List getAccount() { + if (account == null) { + account = new ArrayList<>(); + } + return account; + } + + public AccountPermission setAccount(List account) { + this.account = account; + return this; + } + + @NonNull + public List getPermission() { + if (permission == null) { + permission = new ArrayList<>(); + } + return permission; + } + + public AccountPermission setPermission(List permission) { + this.permission = permission; + return this; + } +} diff --git a/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountRole.java b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountRole.java new file mode 100644 index 0000000000..bec5515e6a --- /dev/null +++ b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountRole.java @@ -0,0 +1,58 @@ +package org.collectionspace.services.authorization; + +import java.util.ArrayList; +import java.util.List; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import org.jspecify.annotations.NonNull; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "account_role") +public class AccountRole { + + private SubjectType subject; + + @XmlElement(required = true) + private List account; + + @XmlElement(required = true) + private List role; + + public SubjectType getSubject() { + return subject; + } + + public AccountRole setSubject(SubjectType subject) { + this.subject = subject; + return this; + } + + @NonNull + public List getAccount() { + if (account == null) { + account = new ArrayList<>(); + } + return account; + } + + public AccountRole setAccount(List account) { + this.account = account; + return this; + } + + @NonNull + public List getRole() { + if (role == null) { + role = new ArrayList<>(); + } + return role; + } + + public AccountRole setRole(List role) { + this.role = role; + return this; + } +} diff --git a/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountRoleRel.java b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountRoleRel.java new file mode 100644 index 0000000000..54133869b1 --- /dev/null +++ b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountRoleRel.java @@ -0,0 +1,148 @@ +package org.collectionspace.services.authorization; + +import java.util.Date; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.UniqueConstraint; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlSchemaType; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.collectionspace.services.jaxb.adapter.DateAdapter; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "account_role_rel") +@Entity(name = "AccountRoleRel") +@Table(name = "accounts_roles", uniqueConstraints = { + @UniqueConstraint(columnNames = { + "account_id", + "role_id" + }) +}) +@Inheritance(strategy = InheritanceType.JOINED) +public class AccountRoleRel { + + @Id + @Column(name = "HJID") + @GeneratedValue(strategy = GenerationType.AUTO) + @XmlAttribute(name = "Hjid") + private Long hjid; + + @Basic + @Column(name = "account_id", nullable = false, length = 128) + private String accountId; + + @Basic + @Column(name = "screen_name") + private String screenName; + + @Basic + @Column(name = "user_id", nullable = false, length = 128) + @XmlElement(required = true) + private String userId; + + @Basic + @Column(name = "role_id", nullable = false, length = 128) + @XmlElement(required = true) + private String roleId; + + @Basic + @Column(name = "role_name") + private String roleName; + + @Column(name = "created_at", nullable = false) + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + private Date createdAt; + + public String getAccountId() { + return accountId; + } + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public String getScreenName() { + return screenName; + } + + public void setScreenName(String screenName) { + this.screenName = screenName; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getRoleId() { + return roleId; + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Long getHjid() { + return hjid; + } + + public void setHjid(Long hjid) { + this.hjid = hjid; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) { + return false; + } + AccountRoleRel that = (AccountRoleRel) o; + return Objects.equals(accountId, that.accountId) + && Objects.equals(screenName, that.screenName) + && Objects.equals(userId, that.userId) + && Objects.equals(roleId, that.roleId) + && Objects.equals(roleName, that.roleName) + && Objects.equals(createdAt, that.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(accountId, screenName, userId, roleId, roleName, createdAt); + } +} diff --git a/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountValue.java b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountValue.java new file mode 100644 index 0000000000..348de4169b --- /dev/null +++ b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/AccountValue.java @@ -0,0 +1,59 @@ +package org.collectionspace.services.authorization; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "account_value") +public class AccountValue { + + @XmlElement(required = true) + private String accountId; + + @XmlElement(required = true) + private String screenName; + + @XmlElement(required = true) + private String userId; + + @XmlElement(required = true) + private String tenantId; + + public String getAccountId() { + return accountId; + } + + public AccountValue setAccountId(String accountId) { + this.accountId = accountId; + return this; + } + + public String getScreenName() { + return screenName; + } + + public AccountValue setScreenName(String screenName) { + this.screenName = screenName; + return this; + } + + public String getUserId() { + return userId; + } + + public AccountValue setUserId(String userId) { + this.userId = userId; + return this; + } + + public String getTenantId() { + return tenantId; + } + + public AccountValue setTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } +} diff --git a/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionRole.java b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionRole.java new file mode 100644 index 0000000000..009cfe9654 --- /dev/null +++ b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionRole.java @@ -0,0 +1,58 @@ +package org.collectionspace.services.authorization; + +import java.util.ArrayList; +import java.util.List; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import org.jspecify.annotations.NonNull; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "permission_role") +public class PermissionRole { + + private SubjectType subject; + + @XmlElement(required = true) + private List permission; + + @XmlElement(required = true) + private List role; + + public SubjectType getSubject() { + return subject; + } + + public PermissionRole setSubject(SubjectType subject) { + this.subject = subject; + return this; + } + + @NonNull + public List getPermission() { + if (permission == null) { + permission = new ArrayList<>(); + } + return permission; + } + + public PermissionRole setPermission(List permission) { + this.permission = permission; + return this; + } + + @NonNull + public List getRole() { + if (role == null) { + role = new ArrayList<>(); + } + return role; + } + + public PermissionRole setRole(List role) { + this.role = role; + return this; + } +} diff --git a/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionRoleRel.java b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionRoleRel.java new file mode 100644 index 0000000000..e743739bb5 --- /dev/null +++ b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionRoleRel.java @@ -0,0 +1,148 @@ +package org.collectionspace.services.authorization; + +import java.util.Date; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.UniqueConstraint; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlSchemaType; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.collectionspace.services.jaxb.adapter.DateAdapter; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "permission_role_rel") +@Entity(name = "PermissionRoleRel") +@Table(name = "permissions_roles", uniqueConstraints = { + @UniqueConstraint(columnNames = { + "permission_id", + "role_id" + }) +}) +@Inheritance(strategy = InheritanceType.JOINED) +public class PermissionRoleRel { + + @Id + @Column(name = "HJID") + @GeneratedValue(strategy = GenerationType.AUTO) + @XmlAttribute(name = "Hjid") + private Long hjid; + + @Basic + @Column(name = "permission_id", nullable = false, length = 128) + @XmlElement(required = true) + private String permissionId; + + @Basic + @Column(name = "permission_resource") + private String permissionResource; + + @Basic + @Column(name = "actionGroup") + private String actionGroup; + + @Basic + @Column(name = "role_id", nullable = false, length = 128) + @XmlElement(required = true) + private String roleId; + + @Basic + @Column(name = "role_name") + private String roleName; + + @Column(name = "created_at", nullable = false) + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + private Date createdAt; + + public String getPermissionId() { + return permissionId; + } + + public void setPermissionId(String permissionId) { + this.permissionId = permissionId; + } + + public String getPermissionResource() { + return permissionResource; + } + + public void setPermissionResource(String permissionResource) { + this.permissionResource = permissionResource; + } + + public String getActionGroup() { + return actionGroup; + } + + public void setActionGroup(String actionGroup) { + this.actionGroup = actionGroup; + } + + public String getRoleId() { + return roleId; + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Long getHjid() { + return hjid; + } + + public void setHjid(Long hjid) { + this.hjid = hjid; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) { + return false; + } + PermissionRoleRel that = (PermissionRoleRel) o; + return Objects.equals(permissionId, that.permissionId) + && Objects.equals(permissionResource, that.permissionResource) + && Objects.equals(actionGroup, that.actionGroup) + && Objects.equals(roleId, that.roleId) + && Objects.equals(roleName, that.roleName) + && Objects.equals(createdAt, that.createdAt); + } + + @Override + public int hashCode() { + return Objects.hash(permissionId, permissionResource, actionGroup, roleId, roleName, createdAt); + } +} diff --git a/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionValue.java b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionValue.java new file mode 100644 index 0000000000..16d80c1b2c --- /dev/null +++ b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionValue.java @@ -0,0 +1,70 @@ +package org.collectionspace.services.authorization; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "permission_value") +public class PermissionValue { + + private String permRelationshipId; + + @XmlElement(required = true) + private String permissionId; + + @XmlElement(required = true) + private String resourceName; + + @XmlElement(required = true) + private String actionGroup; + + @XmlElement(required = true) + private String tenantId; + + public String getPermRelationshipId() { + return permRelationshipId; + } + + public PermissionValue setPermRelationshipId(String permRelationshipId) { + this.permRelationshipId = permRelationshipId; + return this; + } + + public String getPermissionId() { + return permissionId; + } + + public PermissionValue setPermissionId(String permissionId) { + this.permissionId = permissionId; + return this; + } + + public String getResourceName() { + return resourceName; + } + + public PermissionValue setResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + public String getActionGroup() { + return actionGroup; + } + + public PermissionValue setActionGroup(String actionGroup) { + this.actionGroup = actionGroup; + return this; + } + + public String getTenantId() { + return tenantId; + } + + public PermissionValue setTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } +} diff --git a/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionsRolesList.java b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionsRolesList.java new file mode 100644 index 0000000000..ad9ce5b3ab --- /dev/null +++ b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/PermissionsRolesList.java @@ -0,0 +1,32 @@ +package org.collectionspace.services.authorization; + + +import java.util.ArrayList; +import java.util.List; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import org.jspecify.annotations.NonNull; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "permissions_roles_list") +public class PermissionsRolesList { + + @XmlElement(required = true) + private List permissionRole; + + @NonNull + public List getPermissionRole() { + if (permissionRole == null) { + permissionRole = new ArrayList<>(); + } + return this.permissionRole; + } + + public void setPermissionRole(List permissionRole) { + this.permissionRole = permissionRole; + } + +} diff --git a/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/Role.java b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/Role.java new file mode 100644 index 0000000000..053c7efc8b --- /dev/null +++ b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/Role.java @@ -0,0 +1,215 @@ +package org.collectionspace.services.authorization; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; +import javax.persistence.UniqueConstraint; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlSchemaType; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.collectionspace.services.jaxb.adapter.DateAdapter; +import org.jspecify.annotations.NonNull; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "role") +@Entity(name = "Role") +@Table(name = "roles", uniqueConstraints = { + @UniqueConstraint(columnNames = { + "rolename", + "tenant_id" + }), + @UniqueConstraint(columnNames = { + "displayname", + "tenant_id" + }) +}) +@Inheritance(strategy = InheritanceType.JOINED) +public class Role { + + @Id + @Column(name = "csid", nullable = false, length = 128) + @XmlAttribute(name = "csid") + private String csid; + + @Basic + @Column(name = "displayname", nullable = false, length = 200) + @XmlElement(required = true) + private String displayName; + + @Basic + @Column(name = "rolename", nullable = false, length = 200) + @XmlElement(required = true) + private String roleName; + + @Basic + @Column(name = "description") + private String description; + + @Basic + @Column(name = "rolegroup") + private String roleGroup; + + @Basic + @Column(name = "tenant_id", nullable = false, length = 128) + @XmlElement(name = "tenant_id", required = true) + private String tenantId; + + @Basic + @Column(name = "metadata_protection") + private String metadataProtection; + + @Basic + @Column(name = "perms_protection") + private String permsProtection; + + @Column(name = "created_at", nullable = false) + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + private Date createdAt; + + @Column(name = "updated_at") + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + private Date updatedAt; + + @Transient + @XmlElement(required = true) + private List permission; + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getRoleGroup() { + return roleGroup; + } + + public void setRoleGroup(String roleGroup) { + this.roleGroup = roleGroup; + } + + public String getTenantId() { + return tenantId; + } + + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + public String getMetadataProtection() { + return metadataProtection; + } + + public void setMetadataProtection(String metadataProtection) { + this.metadataProtection = metadataProtection; + } + + public String getPermsProtection() { + return permsProtection; + } + + public void setPermsProtection(String permsProtection) { + this.permsProtection = permsProtection; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public void setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + } + + @NonNull + public List getPermission() { + if (permission == null) { + permission = new ArrayList<>(); + } + return this.permission; + } + + public void setPermission(List permission) { + this.permission = permission; + } + + public String getCsid() { + return csid; + } + + public void setCsid(String csid) { + this.csid = csid; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) { + return false; + } + Role role = (Role) o; + return Objects.equals(displayName, role.displayName) + && Objects.equals(roleName, role.roleName) + && Objects.equals(description, role.description) + && Objects.equals(roleGroup, role.roleGroup) + && Objects.equals(tenantId, role.tenantId) + && Objects.equals(metadataProtection, role.metadataProtection) + && Objects.equals(permsProtection, role.permsProtection) + && Objects.equals(createdAt, role.createdAt) + && Objects.equals(updatedAt, role.updatedAt) + && Objects.equals(permission, role.permission) + && Objects.equals(csid, role.csid); + } + + @Override + public int hashCode() { + return Objects.hash(displayName, roleName, description, roleGroup, tenantId, metadataProtection, + permsProtection, createdAt, updatedAt, permission, csid); + } +} diff --git a/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/RoleValue.java b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/RoleValue.java new file mode 100644 index 0000000000..8902f10d1d --- /dev/null +++ b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/RoleValue.java @@ -0,0 +1,70 @@ +package org.collectionspace.services.authorization; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlType; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "role_value") +public class RoleValue { + + private String roleRelationshipId; + + @XmlElement(required = true) + private String roleId; + + @XmlElement(required = true) + private String roleName; + + @XmlElement(required = true) + private String displayName; + + @XmlElement(required = true) + private String tenantId; + + public String getRoleRelationshipId() { + return roleRelationshipId; + } + + public RoleValue setRoleRelationshipId(String roleRelationshipId) { + this.roleRelationshipId = roleRelationshipId; + return this; + } + + public String getRoleId() { + return roleId; + } + + public RoleValue setRoleId(String roleId) { + this.roleId = roleId; + return this; + } + + public String getRoleName() { + return roleName; + } + + public RoleValue setRoleName(String roleName) { + this.roleName = roleName; + return this; + } + + public String getDisplayName() { + return displayName; + } + + public RoleValue setDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + public String getTenantId() { + return tenantId; + } + + public RoleValue setTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } +} diff --git a/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/RolesList.java b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/RolesList.java new file mode 100644 index 0000000000..e1757a2939 --- /dev/null +++ b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/RolesList.java @@ -0,0 +1,80 @@ +package org.collectionspace.services.authorization; + +import java.util.ArrayList; +import java.util.List; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlSchemaType; +import org.jspecify.annotations.NonNull; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "roles_list") +public class RolesList { + + @XmlSchemaType(name = "unsignedInt") + private long pageNum; + + @XmlSchemaType(name = "unsignedInt") + private long pageSize; + + @XmlSchemaType(name = "unsignedInt") + private long itemsInPage; + + @XmlSchemaType(name = "unsignedInt") + private long totalItems; + + @XmlElement(required = true) + private List role; + + public long getPageNum() { + return pageNum; + } + + public RolesList setPageNum(long pageNum) { + this.pageNum = pageNum; + return this; + } + + public long getPageSize() { + return pageSize; + } + + public RolesList setPageSize(long pageSize) { + this.pageSize = pageSize; + return this; + } + + public long getItemsInPage() { + return itemsInPage; + } + + public RolesList setItemsInPage(long itemsInPage) { + this.itemsInPage = itemsInPage; + return this; + } + + public long getTotalItems() { + return totalItems; + } + + public RolesList setTotalItems(long totalItems) { + this.totalItems = totalItems; + return this; + } + + @NonNull + public List getRole() { + if (role == null) { + role = new ArrayList<>(); + } + return role; + } + + public RolesList setRole(List role) { + this.role = role; + return this; + } +} diff --git a/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/SubjectType.java b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/SubjectType.java new file mode 100644 index 0000000000..d37fffdcd8 --- /dev/null +++ b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/SubjectType.java @@ -0,0 +1,19 @@ +package org.collectionspace.services.authorization; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlType; + +@XmlEnum +@XmlType(name = "subject_type") +public enum SubjectType { + + ACCOUNT, PERMISSION, ROLE; + + public String value() { + return name(); + } + + public static SubjectType fromValue(String v) { + return valueOf(v); + } +} diff --git a/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/package-info.java b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/package-info.java new file mode 100644 index 0000000000..5fe4f81301 --- /dev/null +++ b/services/authorization/jaxb/src/main/java/org/collectionspace/services/authorization/package-info.java @@ -0,0 +1,4 @@ +@XmlSchema(namespace = "http://collectionspace.org/services/authorization") +package org.collectionspace.services.authorization; + +import jakarta.xml.bind.annotation.XmlSchema; \ No newline at end of file diff --git a/services/authorization/jaxb/src/main/resources/accounts_permissions.xsd b/services/authorization/jaxb/src/main/resources/accounts_permissions.xsd deleted file mode 100644 index 9617f08278..0000000000 --- a/services/authorization/jaxb/src/main/resources/accounts_permissions.xsd +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - AccountPermission defines 1-n association between - an account and its corresponding permissions. - - - - - - - - - - - - - - diff --git a/services/authorization/jaxb/src/main/resources/accounts_roles.xsd b/services/authorization/jaxb/src/main/resources/accounts_roles.xsd deleted file mode 100644 index 58af0e53d0..0000000000 --- a/services/authorization/jaxb/src/main/resources/accounts_roles.xsd +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - - - - - - - - AccountRole defines 1-n association between - either account and role or role and account - - - - - - - - - - - - - - - - - - - - - - - - - - - AccountRole defines association between account and role in CollectionSpace - - - - - - account_id - role_id - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - AccountRoleList defines 1-n association between - either account and role or role and account. - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/authorization/jaxb/src/main/resources/authorization_common.xsd b/services/authorization/jaxb/src/main/resources/authorization_common.xsd deleted file mode 100644 index 9eb30df733..0000000000 --- a/services/authorization/jaxb/src/main/resources/authorization_common.xsd +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - - AccountValue is used relationships - - - - - - - - - - - - - - - - - RoleValue is used relationships - - - - - - - - - - - - - - - - - - PermissionValue is used relationships - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/authorization/jaxb/src/main/resources/bindings.xjb b/services/authorization/jaxb/src/main/resources/bindings.xjb deleted file mode 100644 index 8dbc3efffb..0000000000 --- a/services/authorization/jaxb/src/main/resources/bindings.xjb +++ /dev/null @@ -1,29 +0,0 @@ - - - \ No newline at end of file diff --git a/services/authorization/jaxb/src/main/resources/org/collectionspace/services/authorization/jaxb.index b/services/authorization/jaxb/src/main/resources/org/collectionspace/services/authorization/jaxb.index new file mode 100644 index 0000000000..87777afd24 --- /dev/null +++ b/services/authorization/jaxb/src/main/resources/org/collectionspace/services/authorization/jaxb.index @@ -0,0 +1,12 @@ +AccountPermission +AccountRole +AccountRoleRel +AccountValue +PermissionRole +PermissionRoleRel +PermissionValue +PermissionsRolesList +Role +RoleValue +RolesList +SubjectType diff --git a/services/authorization/jaxb/src/main/resources/permissions_roles.xsd b/services/authorization/jaxb/src/main/resources/permissions_roles.xsd deleted file mode 100644 index 00a7e96461..0000000000 --- a/services/authorization/jaxb/src/main/resources/permissions_roles.xsd +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - - PermissionRole defines 1-n association between - either permission and role or role and permission - - - - - - - - - - - - - - - - - - - PermissionRoleRel defines 1-1 association between - permission and role in CollectionSpace. - Note that this relation is defined exclusively for service-side - use only. - - - - - - - permission_id - role_id - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - A list of permission_role association for a permission or a role (for test only) - - - - - - - - permission role list - - - - - - - - diff --git a/services/authorization/jaxb/src/main/resources/roles.xsd b/services/authorization/jaxb/src/main/resources/roles.xsd deleted file mode 100644 index ee8cc7caf3..0000000000 --- a/services/authorization/jaxb/src/main/resources/roles.xsd +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - Role definition in CollectionSpace - - - - - rolename - tenant_id - - - displayname - tenant_id - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/authorization/jaxb/src/main/resources/roles_list.xsd b/services/authorization/jaxb/src/main/resources/roles_list.xsd deleted file mode 100644 index b83b3dcb98..0000000000 --- a/services/authorization/jaxb/src/main/resources/roles_list.xsd +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - role list - - - - - - - - - - - - diff --git a/services/authorization/pstore/build.xml b/services/authorization/pstore/build.xml index ec73e8f9c2..c94dd05fa9 100644 --- a/services/authorization/pstore/build.xml +++ b/services/authorization/pstore/build.xml @@ -108,48 +108,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 4.0.0 org.collectionspace.services.authorization.pstore services.authorization.pstore - - authorization.sql - ${basedir}/src/main/resources/db - - - - org.collectionspace.services - org.collectionspace.services.authorization.jaxb - ${project.version} - - - org.postgresql - postgresql - - cspace-services-authorization-pstore - - - maven-antrun-plugin - - - subs-hibernate-config - generate-test-resources - - run - - - - - - - - - - - - - - - ddl - - - - org.codehaus.mojo - properties-maven-plugin - - - ../../../build.properties - - - - - org.codehaus.mojo - hibernate3-maven-plugin - 2.2 - - - process-test-resources - - hbm2ddl - - - - - - - hbm2ddl - - - - ${sql.file} - jpaconfiguration - true - true - true - true - false - org.collectionspace.services.authorization - - - - - org.postgresql - postgresql - ${postgres.driver.version} - - - - - maven-antrun-plugin - - - process-test-resources - - - - - - - run - - - - - - - - - diff --git a/services/authorization/pstore/src/test/resources/META-INF/persistence.xml b/services/authorization/pstore/src/test/resources/META-INF/persistence.xml deleted file mode 100644 index 52fe747e86..0000000000 --- a/services/authorization/pstore/src/test/resources/META-INF/persistence.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - org.collectionspace.services.authorization.perms.Permission - org.collectionspace.services.authorization.perms.PermissionAction - org.collectionspace.services.authorization.PermissionRoleRel - org.collectionspace.services.authorization.Role - org.collectionspace.services.authorization.AccountRoleRel - - - - - - - diff --git a/services/authorization/pstore/src/test/resources/hibernate.cfg.xml b/services/authorization/pstore/src/test/resources/hibernate.cfg.xml deleted file mode 100644 index eb577d2288..0000000000 --- a/services/authorization/pstore/src/test/resources/hibernate.cfg.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - @DB_CSPACE_URL@ - @DB_DRIVER_CLASS@ - @DB_CSPACE_USER@ - @DB_CSPACE_PASSWORD@ - @DB_DIALECT@ - org.hibernate.transaction.JDBCTransactionFactory - thread - true - - diff --git a/services/authorization/service/pom.xml b/services/authorization/service/pom.xml index 1f2146fc15..dd20f5adb4 100644 --- a/services/authorization/service/pom.xml +++ b/services/authorization/service/pom.xml @@ -125,6 +125,12 @@ ${project.version} provided + + org.collectionspace.services + org.collectionspace.services.hyperjaxb + ${project.version} + provided + diff --git a/services/authorization/service/src/main/resources/applicationContext-authorization.xml b/services/authorization/service/src/main/resources/applicationContext-authorization.xml index 745d7422b7..d361d0149b 100644 --- a/services/authorization/service/src/main/resources/applicationContext-authorization.xml +++ b/services/authorization/service/src/main/resources/applicationContext-authorization.xml @@ -41,7 +41,7 @@ --> - + diff --git a/services/batch/client/pom.xml b/services/batch/client/pom.xml index 8e977d900d..494e9066b7 100644 --- a/services/batch/client/pom.xml +++ b/services/batch/client/pom.xml @@ -52,11 +52,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/batch/jaxb/pom.xml b/services/batch/jaxb/pom.xml index 2fa0df460c..e7a73900f9 100644 --- a/services/batch/jaxb/pom.xml +++ b/services/batch/jaxb/pom.xml @@ -18,11 +18,6 @@ org.collectionspace.services.jaxb ${project.version} - - org.collectionspace.services - org.collectionspace.services.hyperjaxb - ${project.version} - @@ -30,8 +25,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/batch/jaxb/src/main/resources/batch_common.xsd b/services/batch/jaxb/src/main/resources/batch_common.xsd index dd1437fa59..eadb721dff 100644 --- a/services/batch/jaxb/src/main/resources/batch_common.xsd +++ b/services/batch/jaxb/src/main/resources/batch_common.xsd @@ -1,13 +1,11 @@ - @@ -200,8 +202,10 @@ - - + + + + diff --git a/services/chronology/client/pom.xml b/services/chronology/client/pom.xml index cd1f6f748b..eb06c53690 100644 --- a/services/chronology/client/pom.xml +++ b/services/chronology/client/pom.xml @@ -52,7 +52,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client @@ -61,10 +61,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/chronology/jaxb/pom.xml b/services/chronology/jaxb/pom.xml index 18f1d76d1d..da6a1df69a 100644 --- a/services/chronology/jaxb/pom.xml +++ b/services/chronology/jaxb/pom.xml @@ -13,11 +13,6 @@ services.chronology.jaxb - - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - org.collectionspace.services org.collectionspace.services.authority.jaxb @@ -31,8 +26,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin diff --git a/services/chronology/jaxb/src/main/resources/chronology_common.xsd b/services/chronology/jaxb/src/main/resources/chronology_common.xsd index 20c3d4d740..5862560870 100644 --- a/services/chronology/jaxb/src/main/resources/chronology_common.xsd +++ b/services/chronology/jaxb/src/main/resources/chronology_common.xsd @@ -10,8 +10,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -67,10 +67,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/citation/client/pom.xml b/services/citation/client/pom.xml index 2ab4202a17..25a608f5b2 100644 --- a/services/citation/client/pom.xml +++ b/services/citation/client/pom.xml @@ -47,11 +47,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/citation/jaxb/pom.xml b/services/citation/jaxb/pom.xml index 52784c552b..e374d1327b 100644 --- a/services/citation/jaxb/pom.xml +++ b/services/citation/jaxb/pom.xml @@ -13,19 +13,9 @@ services.citation.jaxb - - org.collectionspace.services - org.collectionspace.services.common - - - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - org.collectionspace.services org.collectionspace.services.authority.jaxb - true ${project.version} @@ -35,8 +25,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/citation/jaxb/src/main/resources/citation_common.xsd b/services/citation/jaxb/src/main/resources/citation_common.xsd index 056629752e..ab1731682a 100644 --- a/services/citation/jaxb/src/main/resources/citation_common.xsd +++ b/services/citation/jaxb/src/main/resources/citation_common.xsd @@ -8,14 +8,12 @@ Used for: JAXB binding between XML and Java objects --> - diff --git a/services/citation/jaxb/src/main/resources/citationauthority_common.xsd b/services/citation/jaxb/src/main/resources/citationauthority_common.xsd index 0c7b36d666..b836cdd8d5 100644 --- a/services/citation/jaxb/src/main/resources/citationauthority_common.xsd +++ b/services/citation/jaxb/src/main/resources/citationauthority_common.xsd @@ -9,15 +9,13 @@ --> - + - - jaxb service diff --git a/services/citation/service/pom.xml b/services/citation/service/pom.xml index 7fa5c5a40d..6c240598e6 100644 --- a/services/citation/service/pom.xml +++ b/services/citation/service/pom.xml @@ -63,11 +63,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/claim/client/pom.xml b/services/claim/client/pom.xml index f380bdf383..ffdf7b26a2 100644 --- a/services/claim/client/pom.xml +++ b/services/claim/client/pom.xml @@ -55,11 +55,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/claim/jaxb/pom.xml b/services/claim/jaxb/pom.xml index eb8396a4a1..08b90c4a33 100644 --- a/services/claim/jaxb/pom.xml +++ b/services/claim/jaxb/pom.xml @@ -7,27 +7,31 @@ org.collectionspace.services ${revision} - + 4.0.0 org.collectionspace.services org.collectionspace.services.claim.jaxb services.claim.jaxb - + - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + - + collectionspace-services-claim-jaxb install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo @@ -36,4 +40,3 @@ - diff --git a/services/claim/jaxb/src/main/resources/claims-common.xsd b/services/claim/jaxb/src/main/resources/claims-common.xsd index 41577046ec..7c502d96df 100644 --- a/services/claim/jaxb/src/main/resources/claims-common.xsd +++ b/services/claim/jaxb/src/main/resources/claims-common.xsd @@ -11,14 +11,12 @@ $LastChangedDate: 2011-07-22 12:44:36 -0700 (Fri, 22 Jul 2011) $ --> - + + org.collectionspace.services + common-http + ${project.version} + org.collectionspace.services @@ -53,11 +58,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy @@ -78,12 +79,7 @@ 1.0.01 provided - - com.sun.xml.bind - jaxb-core - jar - compile - + org.dom4j dom4j diff --git a/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java b/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java index e2adcb7da9..0be7dd36c5 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java +++ b/services/client/src/main/java/org/collectionspace/services/client/AbstractServiceClientImpl.java @@ -28,61 +28,25 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Properties; - +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; import javax.ws.rs.client.ClientRequestContext; import javax.ws.rs.client.ClientRequestFilter; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; -import javax.xml.bind.DatatypeConverter; +import jakarta.xml.bind.DatatypeConverter; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; +import org.apache.http.impl.client.DefaultHttpClient; import org.collectionspace.services.common.api.Tools; +import org.collectionspace.services.common.provider.JakartaJAXBProvider; import org.collectionspace.services.jaxb.AbstractCommonList; -import org.jboss.resteasy.client.jaxrs.ResteasyClient; -import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; -import org.jboss.resteasy.client.jaxrs.engines.URLConnectionEngine; -import org.jboss.resteasy.client.core.executors.ApacheHttpClient4Executor; -import org.jboss.resteasy.plugins.providers.RegisterBuiltin; -import org.jboss.resteasy.spi.ResteasyProviderFactory; +import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -// FIXME: Deprecated classes that need to be updated -import org.jboss.resteasy.client.ProxyFactory; -import org.apache.http.impl.client.DefaultHttpClient; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; - -import javax.net.ssl.X509TrustManager; - -/** - * Private class for SSL support - */ -class HttpsTrustManager implements X509TrustManager { - - @Override - public void checkClientTrusted(X509Certificate[] arg0, String arg1) - throws CertificateException { - // TODO Auto-generated method stub - - } - - @Override - public void checkServerTrusted(X509Certificate[] arg0, String arg1) - throws CertificateException { - // TODO Auto-generated method stub - - } - - @Override - public X509Certificate[] getAcceptedIssuers() { - return new X509Certificate[]{}; - } - -} - /** * Private class for JAX-RS authentication */ @@ -112,7 +76,7 @@ private String getBasicAuthentication() { } catch (UnsupportedEncodingException ex) { throw new IllegalStateException("Cannot encode with UTF-8", ex); } - + return result; } } @@ -195,9 +159,7 @@ private void init() throws Exception { throw new RuntimeException(e.getMessage()); } - ResteasyProviderFactory factory = ResteasyProviderFactory.getInstance(); - RegisterBuiltin.register(factory); - setProxy(); + setProxy(); } /** @@ -524,43 +486,25 @@ public P getProxy() { * allow to reset proxy as per security needs */ @Override - public void setProxy() throws Exception { - ResteasyClient client = null; + public void setProxy() { + Client client = null; String urlString = url.toString(); Class

proxyClass = this.getProxyClass(); - -// if (useSSL()) { -// SSLContext sslcontext = SSLContexts.custom().useSSL().build(); -// sslcontext.init(null, new X509TrustManager[]{new HttpsTrustManager()}, new SecureRandom()); -// client = (ResteasyClient)ClientBuilder.newBuilder().sslContext(sslcontext).build(); -// } else { -// client = (ResteasyClient)ClientBuilder.newClient(); -// } - - client = new ResteasyClientBuilder().httpEngine(new URLConnectionEngine()).build(); - + + if (useAuth()) { String user = properties.getProperty(USER_PROPERTY); String password = properties.getProperty(PASSWORD_PROPERTY); - client = client.register(new Authenticator(user, password)); - } - - proxy = client.target(urlString).proxy(proxyClass); - } - - /** - * allow to reset proxy as per security needs - */ - @Deprecated - public void _setProxy() { - Class

proxyClass = this.getProxyClass(); - if (useAuth()) { - proxy = ProxyFactory.create(proxyClass, - getBaseURL(), new ApacheHttpClient4Executor(getHttpClient4())); + client = ClientBuilder.newBuilder() + .register(new Authenticator(user, password)) + .register(new JakartaJAXBProvider<>()) + .build(); } else { - proxy = ProxyFactory.create(proxyClass, - getBaseURL()); + client = ClientBuilder.newBuilder().register(new JakartaJAXBProvider<>()).build(); } + + ResteasyWebTarget target = (ResteasyWebTarget) client.target(urlString); + proxy = target.proxy(proxyClass); } @Override @@ -586,6 +530,7 @@ public void setAuth(boolean useAuth, } try { + // TODO: Why does this get set twice? setupHttpClient(); setupHttpClient(); // temp fix for CSPACE-6281 } catch (Exception e) { diff --git a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClientUtils.java b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClientUtils.java index 7202e56542..fee21c5487 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClientUtils.java +++ b/services/client/src/main/java/org/collectionspace/services/client/CollectionSpaceClientUtils.java @@ -31,13 +31,14 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.Unmarshaller; import javax.xml.parsers.DocumentBuilderFactory; import org.apache.commons.io.FileUtils; +import org.collectionspace.services.common.jaxb.JAXBContextCache; import org.jboss.resteasy.plugins.providers.multipart.InputPart; import org.jboss.resteasy.plugins.providers.multipart.MultipartInput; import org.slf4j.Logger; @@ -76,12 +77,12 @@ public class CollectionSpaceClientUtils { * @param res the res * @return the string */ - static public String extractId(Response res) { + public static String extractId(Response res) { MultivaluedMap mvm = res.getMetadata(); return extractIdFromResponseMetadata(mvm); } - static protected String extractIdFromResponseMetadata(MultivaluedMap mvm) { + protected static String extractIdFromResponseMetadata(MultivaluedMap mvm) { // mvm may return a java.net.URI which complains about casting to String... String uri = ((List) mvm.get("Location")).get(0).toString(); if (logger.isDebugEnabled()) { @@ -104,7 +105,7 @@ static protected String extractIdFromResponseMetadata(MultivaluedMap clazz) + protected static Object extractPart(PoxPayloadIn input, String label, Class clazz) throws Exception { Object result = null; PayloadInputPart payloadInputPart = input.getPart(label); @@ -127,7 +128,7 @@ static protected Object extractPart(PoxPayloadIn input, String label, Class c * @throws Exception the exception */ @Deprecated - static public Object extractPart(MultipartInput input, String label, Class clazz) + public static Object extractPart(MultipartInput input, String label, Class clazz) throws Exception { Object obj = null; String partLabel = ""; @@ -186,9 +187,9 @@ static public Object extractPart(MultipartInput input, String label, Class cl * @return the part object * @throws JAXBException the jAXB exception */ - static public Object getPartObject(String partStr, Class clazz) + public static Object getPartObject(String partStr, Class clazz) throws JAXBException { - JAXBContext jc = JAXBContext.newInstance(clazz); + JAXBContext jc = JAXBContextCache.getInstance().getCachedJAXBContext(clazz); ByteArrayInputStream bais = null; Object obj = null; try { @@ -216,10 +217,10 @@ static public Object getPartObject(String partStr, Class clazz) * @param clazz the clazz * @return the string */ - static public String objectAsXmlString(Object o, Class clazz) { + public static String objectAsXmlString(Object o, Class clazz) { StringWriter sw = new StringWriter(); try { - JAXBContext jc = JAXBContext.newInstance(clazz); + JAXBContext jc = JAXBContextCache.getInstance().getCachedJAXBContext(clazz); Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); @@ -237,7 +238,7 @@ static public String objectAsXmlString(Object o, Class clazz) { * @return * @throws Exception */ - static public Object getObjectFromFile(Class jaxbClass, String fileName) + public static Object getObjectFromFile(Class jaxbClass, String fileName) throws Exception { ClassLoader tccl = Thread.currentThread().getContextClassLoader(); InputStream is = tccl.getResourceAsStream(fileName); @@ -251,7 +252,7 @@ static public Object getObjectFromFile(Class jaxbClass, String fileName) * @return the xml document * @throws Exception the exception */ - static public Document getXmlDocument(String fileName) throws Exception { + public static Document getXmlDocument(String fileName) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); File f = new File(fileName); if (!f.exists()) { @@ -268,7 +269,7 @@ static public Document getXmlDocument(String fileName) throws Exception { * @return the xml document as string * @throws Exception the exception */ - static public String getXmlDocumentAsString(String fileName) throws Exception { + public static String getXmlDocumentAsString(String fileName) throws Exception { byte[] b = FileUtils.readFileToByteArray(new File(fileName)); return new String(b); } @@ -280,8 +281,8 @@ static public String getXmlDocumentAsString(String fileName) throws Exception { * @return * @throws Exception */ - static public Object getObjectFromStream(Class jaxbClass, InputStream is) throws Exception { - JAXBContext context = JAXBContext.newInstance(jaxbClass); + public static Object getObjectFromStream(Class jaxbClass, InputStream is) throws Exception { + JAXBContext context = JAXBContextCache.getInstance().getCachedJAXBContext(jaxbClass); Unmarshaller unmarshaller = context.createUnmarshaller(); //note: setting schema to null will turn validator off unmarshaller.setSchema(null); diff --git a/services/client/src/main/java/org/collectionspace/services/client/IQueryManager.java b/services/client/src/main/java/org/collectionspace/services/client/IQueryManager.java index dd4194c7c9..e70c7e7ea6 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/IQueryManager.java +++ b/services/client/src/main/java/org/collectionspace/services/client/IQueryManager.java @@ -30,107 +30,106 @@ public interface IQueryManager { - final static String SEARCH_COMBINE_QUERY_PARAM = "combine"; - final static String SEARCH_COMBINE_AND = "and"; - final static String SEARCH_COMBINE_OR = "or"; - final static String SEARCH_GROUP_OPEN = "("; - final static String SEARCH_GROUP_CLOSE = ")"; - final static String SEARCH_TERM_SEPARATOR = " "; - final static String SEARCH_LIKE = " LIKE "; - final static String SEARCH_ILIKE = " ILIKE "; - final static String SEARCH_TYPE_KEYWORDS = "keywords"; - final static String SEARCH_TYPE_KEYWORDS_KW = "kw"; - final static String SEARCH_TYPE_KEYWORDS_AS = "as"; - final static String SEARCH_TYPE_PARTIALTERM = "pt"; - final static String SEARCH_TYPE_DOCTYPE = "doctype"; - final static String SEARCH_TYPE_FILENAME = "filename"; - final static String SEARCH_TYPE_CLASS_NAME = "classname"; - final static String SEARCH_TYPE_INVOCATION_MODE = "mode"; - final static String SEARCH_TYPE_INVOCATION = "inv"; - final static String SEARCH_QUALIFIER_AND = SEARCH_TERM_SEPARATOR + "AND" + SEARCH_TERM_SEPARATOR; - final static String SEARCH_QUALIFIER_OR = SEARCH_TERM_SEPARATOR + "OR" + SEARCH_TERM_SEPARATOR; - final static String DEFAULT_SELECT_CLAUSE = "SELECT * FROM "; - final static String CSID_QUERY_PARAM = "csid"; - final static String TAG_QUERY_PARAM = "servicetag"; + String SEARCH_COMBINE_QUERY_PARAM = "combine"; + String SEARCH_COMBINE_AND = "and"; + String SEARCH_COMBINE_OR = "or"; + String SEARCH_GROUP_OPEN = "("; + String SEARCH_GROUP_CLOSE = ")"; + String SEARCH_TERM_SEPARATOR = " "; + String SEARCH_LIKE = " LIKE "; + String SEARCH_ILIKE = " ILIKE "; + String SEARCH_TYPE_KEYWORDS = "keywords"; + String SEARCH_TYPE_KEYWORDS_KW = "kw"; + String SEARCH_TYPE_KEYWORDS_AS = "as"; + String SEARCH_TYPE_PARTIALTERM = "pt"; + String SEARCH_TYPE_DOCTYPE = "doctype"; + String SEARCH_TYPE_FILENAME = "filename"; + String SEARCH_TYPE_CLASS_NAME = "classname"; + String SEARCH_TYPE_INVOCATION_MODE = "mode"; + String SEARCH_TYPE_INVOCATION = "inv"; + String SEARCH_QUALIFIER_AND = SEARCH_TERM_SEPARATOR + "AND" + SEARCH_TERM_SEPARATOR; + String SEARCH_QUALIFIER_OR = SEARCH_TERM_SEPARATOR + "OR" + SEARCH_TERM_SEPARATOR; + String DEFAULT_SELECT_CLAUSE = "SELECT * FROM "; + String CSID_QUERY_PARAM = "csid"; + String TAG_QUERY_PARAM = "servicetag"; // // Nuxeo pseudo-values (and filters) for special document properties. // - final static String NUXEO_UUID = "ecm:uuid"; - final static String NUXEO_IS_PROXY = "ecm:isProxy"; - final static String NUXEO_IS_PROXY_FILTER = NUXEO_IS_PROXY + " = 0"; - final static String NUXEO_IS_VERSION = "ecm:isCheckedInVersion"; - final static String NUXEO_IS_VERSION_FILTER = NUXEO_IS_VERSION + " = 0"; + String NUXEO_UUID = "ecm:uuid"; + String NUXEO_IS_PROXY = "ecm:isProxy"; + String NUXEO_IS_PROXY_FILTER = NUXEO_IS_PROXY + " = 0"; + String NUXEO_IS_VERSION = "ecm:isCheckedInVersion"; + String NUXEO_IS_VERSION_FILTER = NUXEO_IS_VERSION + " = 0"; // In the CMIS context, the prefix is nuxeo, not ecm - final static String NUXEO_CMIS_IS_VERSION = "nuxeo:isVersion"; - final static String NUXEO_CMIS_IS_VERSION_FILTER = NUXEO_CMIS_IS_VERSION + " = false"; + String NUXEO_CMIS_IS_VERSION = "nuxeo:isVersion"; + String NUXEO_CMIS_IS_VERSION_FILTER = NUXEO_CMIS_IS_VERSION + " = false"; // // Query params for CMIS queries on the relationship (Relation) table. // - final static String SEARCH_RELATED_TO_CSID_AS_SUBJECT = "rtSbj"; - final static String SEARCH_RELATED_TO_CSID_AS_OBJECT = "rtObj"; - final static String SEARCH_RELATED_PREDICATE = "rtPredicate"; + String SEARCH_RELATED_TO_CSID_AS_SUBJECT = "rtSbj"; + String SEARCH_RELATED_TO_CSID_AS_OBJECT = "rtObj"; + String SEARCH_RELATED_PREDICATE = "rtPredicate"; - final static String SEARCH_RELATED_TO_CSID_AS_EITHER = "rtSbjOrObj"; - final static String SEARCH_RELATED_MATCH_OBJ_DOCTYPES = "rtObjDocTypes"; - final static String SELECT_DOC_TYPE_FIELD = "selectDocType"; + String SEARCH_RELATED_TO_CSID_AS_EITHER = "rtSbjOrObj"; + String SEARCH_RELATED_MATCH_OBJ_DOCTYPES = "rtObjDocTypes"; + String SELECT_DOC_TYPE_FIELD = "selectDocType"; - final static String MARK_RELATED_TO_CSID_AS_SUBJECT = "mkRtSbj"; - final static String MARK_RELATED_TO_CSID_AS_EITHER = "mkRtSbjOrObj"; + String MARK_RELATED_TO_CSID_AS_SUBJECT = "mkRtSbj"; + String MARK_RELATED_TO_CSID_AS_EITHER = "mkRtSbjOrObj"; // // Generic CMIS property mapping constants // - final static String CMIS_OBJECT_ID = "cmis:objectId"; - final static String CMIS_NUXEO_PATHSEGMENT = "nuxeo:pathSegment"; + String CMIS_OBJECT_ID = "cmis:objectId"; + String CMIS_NUXEO_PATHSEGMENT = "nuxeo:pathSegment"; // // Nuxeo related CMIS property mapping constants - final static String CMIS_NUXEO_ID = CMIS_OBJECT_ID; - final static String CMIS_NUXEO_NAME = CMIS_NUXEO_PATHSEGMENT; - final static String CMIS_NUXEO_TITLE = "dc:title"; - final static String CMIS_CS_UPDATED_AT = CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA + ":" + - CollectionSpaceClient.COLLECTIONSPACE_CORE_UPDATED_AT; + String CMIS_NUXEO_ID = CMIS_OBJECT_ID; + String CMIS_NUXEO_NAME = CMIS_NUXEO_PATHSEGMENT; + String CMIS_NUXEO_TITLE = "dc:title"; + String CMIS_CS_UPDATED_AT = CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA + ":" + + CollectionSpaceClient.COLLECTIONSPACE_CORE_UPDATED_AT; // CollectionSpace CMIS property mapping constants - final static String CMIS_TARGET_PREFIX = "DOC"; - final static String CMIS_CORESCHEMA_PREFIX = "CORE"; + String CMIS_TARGET_PREFIX = "DOC"; + String CMIS_CORESCHEMA_PREFIX = "CORE"; // Relations CMIS property mapping constants - final static String CMIS_RELATIONS_PREFIX = "REL"; + String CMIS_RELATIONS_PREFIX = "REL"; - final static String CMIS_JOIN_NUXEO_IS_VERSION_FILTER = + String CMIS_JOIN_NUXEO_IS_VERSION_FILTER = IQueryManager.CMIS_TARGET_PREFIX + "." + IQueryManager.NUXEO_CMIS_IS_VERSION_FILTER; - final static String CMIS_JOIN_TENANT_ID_FILTER = + String CMIS_JOIN_TENANT_ID_FILTER = IQueryManager.CMIS_RELATIONS_PREFIX + "." + CollectionSpaceClient.CORE_TENANTID; - final static String CMIS_TARGET_NUXEO_ID = CMIS_TARGET_PREFIX + "." + CMIS_NUXEO_ID; - final static String CMIS_TARGET_CSID = CMIS_TARGET_PREFIX + "." + CMIS_NUXEO_NAME; - final static String CMIS_TARGET_TITLE = CMIS_TARGET_PREFIX + "." + CMIS_NUXEO_TITLE; - final static String CMIS_TARGET_NAME = CMIS_TARGET_PREFIX + "." + CMIS_NUXEO_NAME; - final static String CMIS_TARGET_UPDATED_AT = CMIS_TARGET_PREFIX + "." + CMIS_CS_UPDATED_AT; + String CMIS_TARGET_NUXEO_ID = CMIS_TARGET_PREFIX + "." + CMIS_NUXEO_ID; + String CMIS_TARGET_CSID = CMIS_TARGET_PREFIX + "." + CMIS_NUXEO_NAME; + String CMIS_TARGET_TITLE = CMIS_TARGET_PREFIX + "." + CMIS_NUXEO_TITLE; + String CMIS_TARGET_NAME = CMIS_TARGET_PREFIX + "." + CMIS_NUXEO_NAME; + String CMIS_TARGET_UPDATED_AT = CMIS_TARGET_PREFIX + "." + CMIS_CS_UPDATED_AT; - final static String TENANT_USES_STARTING_WILDCARD_FOR_PARTIAL_TERM = "ptStartingWildcard"; - final static String MAX_LIST_ITEMS_RETURNED_LIMIT_ON_JDBC_QUERIES = "maxListItemsReturnedLimitOnJdbcQueries"; - final static String JDBC_QUERIES_ARE_TENANT_ID_RESTRICTED = "jdbcQueriesAreTenantIdRestricted"; + String TENANT_USES_STARTING_WILDCARD_FOR_PARTIAL_TERM = "ptStartingWildcard"; + String MAX_LIST_ITEMS_RETURNED_LIMIT_ON_JDBC_QUERIES = "maxListItemsReturnedLimitOnJdbcQueries"; + String JDBC_QUERIES_ARE_TENANT_ID_RESTRICTED = "jdbcQueriesAreTenantIdRestricted"; - public void execQuery(String queryString); - - public String getDatasourceName(); + String getDatasourceName(); /** * Creates the where clause from keywords. * * @param keywords the keywords + * @param clean if punctuation should be removed from the keywords * * @return the string */ - public String createWhereClauseFromKeywords(String keywords); + String createWhereClauseFromKeywords(String keywords, boolean clean); - public String createWhereClauseFromAdvancedSearch(String advancedSearch); + String createWhereClauseFromAdvancedSearch(String advancedSearch); - final static boolean FILTER_EXCLUDE = true; - final static boolean FILTER_INCLUDE = false; + boolean FILTER_EXCLUDE = true; + boolean FILTER_INCLUDE = false; /** * Creates a query to filter a qualified (string) field according to a list of string values. @@ -140,7 +139,7 @@ public interface IQueryManager { * If false, will require qualifiedField does match one of the filters strings. * @return queryString */ - public String createWhereClauseToFilterFromStringList(String qualifiedField, String[] filterTerms, boolean fExclude); + String createWhereClauseToFilterFromStringList(String qualifiedField, String[] filterTerms, boolean fExclude); /** * Creates the where clause for partial term match. @@ -150,12 +149,12 @@ public interface IQueryManager { * * @return the string */ - public String createWhereClauseForPartialMatch(String dataSourceName, - String repositoryName, - String cspaceInstanceId, - String field, - boolean startingWildcard, - String partialTerm); + String createWhereClauseForPartialMatch(String dataSourceName, + String repositoryName, + String cspaceInstanceId, + String field, + boolean startingWildcard, + String partialTerm); /** * Creates a filtering where clause from docType, for invocables. @@ -165,7 +164,7 @@ public String createWhereClauseForPartialMatch(String dataSourceName, * * @return the string */ - public String createWhereClauseForInvocableByDocType(String schema, String docType); + String createWhereClauseForInvocableByDocType(String schema, String docType); /** @@ -175,7 +174,7 @@ public String createWhereClauseForPartialMatch(String dataSourceName, * @param docType the filename * @return the where clause */ - public String createWhereClauseForInvocableByFilename(String schema, String filename); + String createWhereClauseForInvocableByFilename(String schema, String filename); /** * Creates a filtering where clause from class name, for invocables. @@ -184,7 +183,7 @@ public String createWhereClauseForPartialMatch(String dataSourceName, * @param docType the class name * @return the where clause */ - public String createWhereClauseForInvocableByClassName(String schema, String className); + String createWhereClauseForInvocableByClassName(String schema, String className); /** * Creates a filtering where clause from invocation mode, for invocables. @@ -194,13 +193,13 @@ public String createWhereClauseForPartialMatch(String dataSourceName, * * @return the string */ - public String createWhereClauseForInvocableByMode(String schema, String mode); + String createWhereClauseForInvocableByMode(String schema, String mode); - public String createWhereClauseForInvocableByMode(String schema, List modes); + String createWhereClauseForInvocableByMode(String schema, List modes); /* * */ - public String createWhereClauseFromCsid(String csid); + String createWhereClauseFromCsid(String csid); } diff --git a/services/client/src/main/java/org/collectionspace/services/client/PoxPayload.java b/services/client/src/main/java/org/collectionspace/services/client/PoxPayload.java index 609c12430d..b384b20822 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/PoxPayload.java +++ b/services/client/src/main/java/org/collectionspace/services/client/PoxPayload.java @@ -4,6 +4,7 @@ import java.io.File; import java.io.IOException; import java.io.StringReader; +import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; @@ -11,26 +12,29 @@ import java.util.List; import java.util.Set; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.transform.stream.StreamSource; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBElement; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.Unmarshaller; -import com.sun.xml.bind.api.impl.NameConverter; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamReader; +import javax.xml.transform.stream.StreamSource; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.StringUtils; +import org.collectionspace.services.common.jaxb.JAXBContextCache; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.dom4j.Namespace; import org.dom4j.io.SAXReader; +import org.glassfish.jaxb.core.api.impl.NameConverter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.xml.sax.SAXException; -// TODO: Auto-generated Javadoc /** * The Class PoxPayload. * @@ -81,8 +85,19 @@ public Set getValidRootElementLables() { return validRootElementLabels; } - private void setDomDocument(Document dom) throws DocumentException { - this.domDocument = dom; + private void setDomDocument(final String xmlPayload) throws DocumentException { + SAXReader reader = new SAXReader(); + try { + reader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); + reader.setFeature("http://xml.org/sax/features/external-general-entities", false); + reader.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + } catch (SAXException saxException) { + final var error = "Unable to disable Doctype features, aborting document read"; + logger.error(error, saxException); + throw new DocumentException(error); + } + + this.domDocument = reader.read(new StringReader(xmlPayload)); this.parts = null; String label = domDocument.getRootElement().getName().toLowerCase(); @@ -141,13 +156,11 @@ protected Document createDOMFromParts() { * Instantiates a new PoxPayload by parsing the payload into a DOM4j * Document instance * - * @param payloadName the payload name + * @param xmlPayload the payload */ protected PoxPayload(String xmlPayload) throws DocumentException { this.xmlPayload = xmlPayload; - SAXReader reader = new SAXReader(); - Document dom = reader.read(new StringReader(xmlPayload)); - setDomDocument(dom); + setDomDocument(xmlPayload); } /** @@ -158,10 +171,8 @@ protected PoxPayload(String xmlPayload) throws DocumentException { * @throws IOException Signals that an I/O exception has occurred. */ protected PoxPayload(File file) throws DocumentException, IOException { - this.xmlPayload = FileUtils.readFileToString(file); - SAXReader reader = new SAXReader(); - Document dom = reader.read(file); - setDomDocument(dom); + this.xmlPayload = FileUtils.readFileToString(file, Charset.defaultCharset()); + setDomDocument(xmlPayload); } /** @@ -365,21 +376,24 @@ private static String getPackage(Namespace namespace) { public static Object toObject(Element elementInput) { Object result = null; + try { + final XMLInputFactory xmlInputFactory = XMLInputFactory.newFactory(); + xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false); + xmlInputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); Namespace namespace = elementInput.getNamespace(); if (StringUtils.isNotEmpty(namespace.getURI())) { String thePackage = getPackage(namespace); - JAXBContext jc = JAXBContext.newInstance(thePackage); + JAXBContext jc = JAXBContextCache.getInstance().getCachedJAXBContext(thePackage); Unmarshaller um = jc.createUnmarshaller(); - result = um.unmarshal(new StreamSource(new StringReader(elementInput.asXML()))); + XMLStreamReader xmlStream = xmlInputFactory.createXMLStreamReader( + new StreamSource(new StringReader(elementInput.asXML()))); + result = um.unmarshal(xmlStream); } } catch (Exception e) { - if (logger.isInfoEnabled()) { - String msg = String.format("Could not unmarshal XML element '%s' into a JAXB object.", elementInput.getName()); - logger.info(msg); - } + logger.error("Could not unmarshal XML element '{}' into a JAXB object.", elementInput.getName(), e); } return result; @@ -401,7 +415,7 @@ public static Element toElement(Object jaxbObject) { JAXBElement jaxbElement = (JAXBElement)jaxbObject; thePackage = jaxbElement.getValue().getClass().getPackage().getName(); } - JAXBContext jc = JAXBContext.newInstance(thePackage); + JAXBContext jc = JAXBContextCache.getInstance().getCachedJAXBContext(thePackage); //Create marshaller Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, false); @@ -412,9 +426,7 @@ public static Element toElement(Object jaxbObject) { Document doc = DocumentHelper.parseText(text); result = doc.getRootElement(); //FIXME: REM - call .detach() to free the element } catch (Exception e) { - String msg = String.format("Could not marshal JAXB object '%s' to an XML element.", - jaxbObject.toString()); - logger.error(msg); + logger.error("Could not marshal JAXB object '{}' to an XML element.", jaxbObject, e); } return result; diff --git a/services/client/src/main/java/org/collectionspace/services/client/test/BaseServiceTest.java b/services/client/src/main/java/org/collectionspace/services/client/test/BaseServiceTest.java index 035f164cf5..1964fd08f5 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/test/BaseServiceTest.java +++ b/services/client/src/main/java/org/collectionspace/services/client/test/BaseServiceTest.java @@ -36,12 +36,12 @@ import javax.activation.MimetypesFileTypeMap; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.MarshalException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.MarshalException; +import jakarta.xml.bind.Marshaller; +import jakarta.xml.bind.Unmarshaller; import javax.xml.namespace.QName; import javax.xml.parsers.DocumentBuilderFactory; @@ -53,6 +53,7 @@ import org.apache.commons.httpclient.methods.PutMethod; import org.apache.commons.httpclient.methods.StringRequestEntity; import org.apache.commons.io.FileUtils; +import org.collectionspace.services.common.jaxb.JAXBContextCache; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.Assert; @@ -88,7 +89,7 @@ @SuppressWarnings("rawtypes") public abstract class BaseServiceTest { //A default MIME type result - static protected final String DEFAULT_MIME = "application/octet-stream; charset=ISO-8859-1"; + protected static final String DEFAULT_MIME = "application/octet-stream; charset=ISO-8859-1"; //Maven's base directory -i.e., the one containing the current pom.xml protected static final String MAVEN_BASEDIR_PROPERTY = "maven.basedir"; /** The Constant logger. */ @@ -114,7 +115,7 @@ public abstract class BaseServiceTest { /* Use this to track authority items */ protected Map allResourceItemIdsCreated = new HashMap(); /* itemCsid, parentCsid */ /* A runtime/command-line parameter to indicate if we should delete all the test related resource objects */ - static private final String NO_TEST_CLEANUP = "noTestCleanup"; + private static final String NO_TEST_CLEANUP = "noTestCleanup"; /* A random number generator */ protected static final Random random = new Random(System.currentTimeMillis()); @@ -153,7 +154,7 @@ public abstract class BaseServiceTest { // Ж : Cyrillic capital letter Zhe with breve (U+04C1) // Ŵ : Latin capital letter W with circumflex (U+0174) // Ω : Greek capital letter Omega (U+03A9) - private final static String UTF8_DATA_FRAGMENT = "utf-8-data-fragment:" + private static final String UTF8_DATA_FRAGMENT = "utf-8-data-fragment:" + '\u0394' + '\u04C1' + '\u0174' +'\u03A9'; // // Status constants @@ -222,7 +223,7 @@ protected void beforeMethod(Method m) { * @return the client * @throws Exception */ - abstract protected CollectionSpaceClient getClientInstance() throws Exception; + protected abstract CollectionSpaceClient getClientInstance() throws Exception; /** * Gets the client. @@ -230,7 +231,7 @@ protected void beforeMethod(Method m) { * @return the client * @throws Exception */ - abstract protected CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception; + protected abstract CollectionSpaceClient getClientInstance(String clientPropertiesFilename) throws Exception; /* * Subclasses can override this method to return their AbstractCommonList subclass @@ -460,7 +461,7 @@ protected int submitRequest(String method, String url, String mediaType, String * @param res the res * @return the string */ - static protected String extractId(Response res) { + protected static String extractId(Response res) { return CollectionSpaceClientUtils.extractId(res); } @@ -509,7 +510,7 @@ protected String createNonExistentIdentifier() { * @return the object * @throws Exception the exception */ - static protected Object extractPart(PoxPayloadIn input, String label, Class clazz) throws Exception { + protected static Object extractPart(PoxPayloadIn input, String label, Class clazz) throws Exception { Object result = null; PayloadInputPart payloadInputPart = input.getPart(label); @@ -522,7 +523,7 @@ static protected Object extractPart(PoxPayloadIn input, String label, Class c return result; } - static protected Object extractPart(PoxPayloadOut output, String label, Class clazz) throws Exception { + protected static Object extractPart(PoxPayloadOut output, String label, Class clazz) throws Exception { Object result = null; PayloadOutputPart payloadOutPart = output.getPart(label); @@ -545,9 +546,9 @@ static protected Object extractPart(PoxPayloadOut output, String label, Class * @throws JAXBException the jAXB exception */ @Deprecated - static protected Object getPartObject(String partStr, Class clazz) + protected static Object getPartObject(String partStr, Class clazz) throws JAXBException { - JAXBContext jc = JAXBContext.newInstance(clazz); + JAXBContext jc = JAXBContextCache.getInstance().getCachedJAXBContext(clazz); ByteArrayInputStream bais = null; Object obj = null; try { @@ -575,11 +576,11 @@ static protected Object getPartObject(String partStr, Class clazz) * @param clazz the clazz * @return the string */ - static protected String objectAsXmlString(Object o, Class clazz) { + protected static String objectAsXmlString(Object o, Class clazz) { StringWriter sw = new StringWriter(); JAXBContext jc; try { - jc = JAXBContext.newInstance(clazz); + jc = JAXBContextCache.getInstance().getCachedJAXBContext(clazz); Marshaller m = jc.createMarshaller(); try { m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); @@ -599,7 +600,7 @@ static protected String objectAsXmlString(Object o, Class clazz) { return sw.toString(); } - static protected String objectAsXmlString(Object o) { + protected static String objectAsXmlString(Object o) { return objectAsXmlString(o, o.getClass()); } @@ -610,7 +611,7 @@ static protected String objectAsXmlString(Object o) { * @return * @throws Exception */ - static protected Object getObjectFromFile(Class jaxbClass, String fileName) + protected static Object getObjectFromFile(Class jaxbClass, String fileName) throws Exception { Object result = null; @@ -626,7 +627,7 @@ static protected Object getObjectFromFile(Class jaxbClass, String fileName) * @return the xml document * @throws Exception the exception */ - static protected Document getXmlDocument(String fileName) throws Exception { + protected static Document getXmlDocument(String fileName) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); File f = new File(fileName); if (!f.exists()) { @@ -643,7 +644,7 @@ static protected Document getXmlDocument(String fileName) throws Exception { * @return the xml document as string * @throws Exception the exception */ - static protected String getXmlDocumentAsString(String fileName) throws Exception { + protected static String getXmlDocumentAsString(String fileName) throws Exception { String result = FileUtils.readFileToString(new File(fileName), "UTF8"); return result; } diff --git a/services/collectionobject/client/pom.xml b/services/collectionobject/client/pom.xml index d31cfc5987..3e667ce46e 100644 --- a/services/collectionobject/client/pom.xml +++ b/services/collectionobject/client/pom.xml @@ -53,11 +53,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/collectionobject/jaxb/pom.xml b/services/collectionobject/jaxb/pom.xml index c6a6292eee..65a414bd38 100644 --- a/services/collectionobject/jaxb/pom.xml +++ b/services/collectionobject/jaxb/pom.xml @@ -7,17 +7,21 @@ org.collectionspace.services.collectionobject ${revision} - + 4.0.0 org.collectionspace.services.collectionobject.jaxb services.collectionobject.jaxb - + - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/collectionobject/jaxb/src/main/resources/collectionobjects_common.xsd b/services/collectionobject/jaxb/src/main/resources/collectionobjects_common.xsd index 818ea1ace4..11d81b177c 100644 --- a/services/collectionobject/jaxb/src/main/resources/collectionobjects_common.xsd +++ b/services/collectionobject/jaxb/src/main/resources/collectionobjects_common.xsd @@ -13,8 +13,8 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/common-api/pom.xml b/services/common-api/pom.xml index 38741f2089..c94418ae0c 100644 --- a/services/common-api/pom.xml +++ b/services/common-api/pom.xml @@ -11,10 +11,19 @@ services.common-api jar + + jakarta.xml.bind + jakarta.xml.bind-api + + + org.collectionspace.services + common-http + ${revision} + org.apache.commons commons-lang3 - 3.2.1 + ${commons-lang3.version} provided diff --git a/services/common-api/src/main/java/org/collectionspace/services/common/api/FileTools.java b/services/common-api/src/main/java/org/collectionspace/services/common/api/FileTools.java index 95fa0a83b0..8070300461 100644 --- a/services/common-api/src/main/java/org/collectionspace/services/common/api/FileTools.java +++ b/services/common-api/src/main/java/org/collectionspace/services/common/api/FileTools.java @@ -23,12 +23,16 @@ */ package org.collectionspace.services.common.api; -// This class is designed to avoid dependencies, so it does not include logging, or apache commons. -// There is another cspace utility class, called -// org.collectionspace.services.common.FileUtils -// albeit with different functions, which does have dependencies. - -import java.io.*; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.Reader; +import java.io.StringWriter; +import java.io.Writer; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; @@ -36,15 +40,19 @@ import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.List; -import java.util.UUID; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Unmarshaller; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.Unmarshaller; +import org.collectionspace.services.common.jaxb.JAXBContextCache; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** + * + * This class is designed to avoid dependencies, so it does not include logging, or apache commons. + * There is another cspace utility class, called org.collectionspace.services.common.FileUtils + * albeit with different functions, which does have dependencies. + * * @author Laramie Crocker * $LastChangedRevision: $ * $LastChangedDate: $ @@ -64,18 +72,17 @@ public class FileTools { * @return * @throws Exception */ - static protected Object getObjectFromStream(Class jaxbClass, InputStream is) throws Exception { - JAXBContext context = JAXBContext.newInstance(jaxbClass); + protected static Object getObjectFromStream(Class jaxbClass, InputStream is) throws Exception { + JAXBContext context = JAXBContextCache.getInstance().getCachedJAXBContext(jaxbClass); Unmarshaller unmarshaller = context.createUnmarshaller(); //note: setting schema to null will turn validator off unmarshaller.setSchema(null); return jaxbClass.cast(unmarshaller.unmarshal(is)); } - static public Object getJaxbObjectFromFile(Class jaxbClass, String fileName) + public static Object getJaxbObjectFromFile(Class jaxbClass, String fileName) throws Exception { - - JAXBContext context = JAXBContext.newInstance(jaxbClass); + JAXBContext context = JAXBContextCache.getInstance().getCachedJAXBContext(jaxbClass); Unmarshaller unmarshaller = context.createUnmarshaller(); //note: setting schema to null will turn validator off unmarshaller.setSchema(null); diff --git a/services/common-http/pom.xml b/services/common-http/pom.xml new file mode 100644 index 0000000000..4e1e90ba7f --- /dev/null +++ b/services/common-http/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + + org.collectionspace.services + org.collectionspace.services.main + ${revision} + + + + common-http + ${revision} + + + + jakarta.xml.bind + jakarta.xml.bind-api + + + + javax.ws.rs + javax.ws.rs-api + 2.1 + + + + \ No newline at end of file diff --git a/services/common-http/src/main/java/org/collectionspace/services/common/jaxb/JAXBContextCache.java b/services/common-http/src/main/java/org/collectionspace/services/common/jaxb/JAXBContextCache.java new file mode 100644 index 0000000000..92c290d78d --- /dev/null +++ b/services/common-http/src/main/java/org/collectionspace/services/common/jaxb/JAXBContextCache.java @@ -0,0 +1,47 @@ +package org.collectionspace.services.common.jaxb; + +import java.util.concurrent.ConcurrentHashMap; + +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; + +/** + * Store our JAXBContexts so we don't need to reinitialize all the time. Note that we have to store a single context per + * class so that we don't pollute the namespace when marshalling XML. + *

+ * Might be worth exploring if this should be a ContextResolver instead of a singleton. + * + * @since 9.0.0 + */ +public class JAXBContextCache { + private static final JAXBContextCache INSTANCE = new JAXBContextCache(); + + /** + * Store a cache of JAXBContexts so that the namespace does not get polluted when marshalling + * + * TODO: Class or String? String gets us support for package based JAXBContext, which means fewer instances total + */ + ConcurrentHashMap contextCache = new ConcurrentHashMap<>(); + + private JAXBContextCache() { + } + + public static JAXBContextCache getInstance() { + return INSTANCE; + } + + public JAXBContext getCachedJAXBContext(final Class type) throws JAXBException { + final var packageName = type.getPackageName(); + return getCachedJAXBContext(packageName); + } + + public JAXBContext getCachedJAXBContext(final String packageName) throws JAXBException { + // avoid computeIfAbsent b/c newInstance can throw an exception + JAXBContext context = contextCache.get(packageName); + if (context == null) { + context = JAXBContext.newInstance(packageName); + contextCache.putIfAbsent(packageName, context); + } + return context; + } +} diff --git a/services/common-http/src/main/java/org/collectionspace/services/common/provider/JakartaJAXBProvider.java b/services/common-http/src/main/java/org/collectionspace/services/common/provider/JakartaJAXBProvider.java new file mode 100644 index 0000000000..af328de192 --- /dev/null +++ b/services/common-http/src/main/java/org/collectionspace/services/common/provider/JakartaJAXBProvider.java @@ -0,0 +1,103 @@ +package org.collectionspace.services.common.provider; + +import static javax.ws.rs.core.Response.Status.INTERNAL_SERVER_ERROR; + +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.nio.charset.StandardCharsets; +import javax.ws.rs.Produces; +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Response; +import javax.ws.rs.ext.MessageBodyReader; +import javax.ws.rs.ext.MessageBodyWriter; +import javax.ws.rs.ext.Provider; +import javax.xml.stream.XMLInputFactory; +import javax.xml.stream.XMLStreamException; +import javax.xml.stream.XMLStreamReader; +import javax.xml.transform.stream.StreamSource; + +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlType; +import org.collectionspace.services.common.jaxb.JAXBContextCache; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * A MessageBodyWriter which can use the Jakarta XML bindings. This should only be necessary while we are on RESTEasy 5; + * once we move to 6 and have other Jakarta specs available we can use the provided writers. + *

+ * Additionally, this only supports marshalling {@link XmlRootElement}. We only have a few JAXB classes to support, and + * while some were previously annotated with {@link XmlType} I'm not really sure why. Supporting XmlTypes requires some + * reflection, instantiating the ObjectFactory, and wrapping the provided object T in a JAXBElement. If we do end up + * needing additional support, it would be better to have a separate provider which is created. + * + * @param The class type for the JAXB object + * @since 9.0.0 + */ +@Provider +@Produces({ "application/xml", "application/*+xml", "text/xml", "text/*+xml" }) +public class JakartaJAXBProvider implements MessageBodyWriter, MessageBodyReader { + + private static final Logger logger = LoggerFactory.getLogger(JakartaJAXBProvider.class); + + @Override + public boolean isWriteable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return type.isAnnotationPresent(XmlRootElement.class); + } + + @Override + public boolean isReadable(Class type, Type genericType, Annotation[] annotations, MediaType mediaType) { + return type.isAnnotationPresent(XmlRootElement.class); + } + + @Override + public void writeTo(T t, Class type, Type genericType, Annotation[] annotations, MediaType mediaType, + MultivaluedMap multivaluedMap, OutputStream outputStream) + throws WebApplicationException { + try { + final var context = JAXBContextCache.getInstance().getCachedJAXBContext(type); + final var marshaller = context.createMarshaller(); + marshaller.marshal(t, outputStream); + } catch (JAXBException e) { + logger.error("Unable to marshal JAXB Object {}", type.getSimpleName(), e); + final var response = Response.status(INTERNAL_SERVER_ERROR).build(); + throw new WebApplicationException(response); + } + } + + @Override + public T readFrom(Class type, Type genericType, Annotation[] annotations, MediaType mediaType, + MultivaluedMap httpHeaders, InputStream entityStream) + throws WebApplicationException { + try { + final var xmlInputFactory = XMLInputFactory.newFactory(); + xmlInputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false); + xmlInputFactory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false); + + final XMLStreamReader xmlStream; + final var context = JAXBContextCache.getInstance().getCachedJAXBContext(type); + final var unmarshaller = context.createUnmarshaller(); + if (mediaType != null && mediaType.getParameters().get("charset") == null) { + xmlStream = xmlInputFactory.createXMLStreamReader(new StreamSource( + new InputStreamReader(entityStream, StandardCharsets.UTF_8))); + } else { + xmlStream = xmlInputFactory.createXMLStreamReader(new StreamSource(entityStream)); + } + return (T) unmarshaller.unmarshal(xmlStream); + } catch (JAXBException e) { + logger.error("Unable to unmarshal JAXB Object {}", type.getSimpleName(), e); + final var response = Response.status(INTERNAL_SERVER_ERROR).build(); + throw new WebApplicationException(response); + } catch (XMLStreamException e) { + logger.error("Unable to create XMLStreamReader for JAXB Object {}", type.getSimpleName(), e); + final var response = Response.status(INTERNAL_SERVER_ERROR).build(); + throw new WebApplicationException(response); + } + } +} diff --git a/services/common-test/pom.xml b/services/common-test/pom.xml index 61cd855172..eb4a1a2176 100644 --- a/services/common-test/pom.xml +++ b/services/common-test/pom.xml @@ -31,11 +31,7 @@
org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/common/pom.xml b/services/common/pom.xml index 7dc3204024..11cb0b1495 100644 --- a/services/common/pom.xml +++ b/services/common/pom.xml @@ -64,8 +64,6 @@ org.collectionspace.services.publicitem.jaxb ${project.version} - org.collectionspace.services org.collectionspace.services.jaxb @@ -140,10 +138,16 @@ 2.0.1 - commons-dbcp - commons-dbcp - 1.3-RC1 + org.apache.commons + commons-dbcp2 + 2.13.0 provided + + + jakarta.transaction + jakarta.transaction-api + + commons-codec @@ -173,8 +177,8 @@ provided - javax.xml.bind - jaxb-api + jakarta.xml.bind + jakarta.xml.bind-api javax.security @@ -195,17 +199,13 @@ javax.persistence - persistence-api + javax.persistence-api org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy @@ -230,40 +230,24 @@ - org.nuxeo.binary.metadata + org.nuxeo.ecm.platform nuxeo-binary-metadata - ${nuxeo.platform.version} + ${nuxeo.general.release} org.nuxeo.lib.runtime nuxeo-runtime-launcher - ${nuxeo.platform.version} - - - org.nuxeo.ecm.platform - nuxeo-platform-types-api - ${nuxeo.platform.version} + ${nuxeo.general.release} org.nuxeo.ecm.platform - nuxeo-platform-types-core - ${nuxeo.platform.version} + nuxeo-platform-types + ${nuxeo.general.release} org.nuxeo.ecm.platform nuxeo-platform-imaging-core - ${nuxeo.platform.version} - - - org.nuxeo.ecm.platform - nuxeo-platform-imaging-api - ${nuxeo.platform.version} - provided - - - org.nuxeo.ecm.platform - nuxeo-platform-filemanager-api - ${nuxeo.platform.version} + ${nuxeo.general.release} org.nuxeo.common @@ -281,7 +265,7 @@ org.nuxeo.ecm.core nuxeo-core-query - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.ecm.core @@ -291,12 +275,6 @@ org.nuxeo.ecm.core nuxeo-core-storage-sql - org.nuxeo.ecm.core nuxeo-core-convert @@ -304,7 +282,7 @@ org.nuxeo.runtime nuxeo-runtime-osgi - ${nuxeo.core.version} + ${nuxeo.general.release} org.nuxeo.ecm.core @@ -329,6 +307,15 @@ com.sun.xml.ws jaxws-rt + + javax.xml.bind + jaxb-api + + + + org.codehaus.woodstox + woodstox-core-asl + @@ -419,8 +406,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/common/src/main/cspace/config/services/tenants/anthro/anthro-tenant-bindings.delta.xml b/services/common/src/main/cspace/config/services/tenants/anthro/anthro-tenant-bindings.delta.xml index 5d2b1c2844..e2510418d3 100644 --- a/services/common/src/main/cspace/config/services/tenants/anthro/anthro-tenant-bindings.delta.xml +++ b/services/common/src/main/cspace/config/services/tenants/anthro/anthro-tenant-bindings.delta.xml @@ -44,9 +44,6 @@ // index as small as possible. We may want to turn this on in the future, to support arbitrary // searches through Elasticsearch, e.g. NXQL queries for ad hoc reporting in the CSpace UI. "dynamic": false, - "_all" : { - "enabled": false - }, "_source": { "includes": [ "collectionobjects_common:briefDescriptions", diff --git a/services/common/src/main/cspace/config/services/tenants/bonsai/bonsai-tenant-bindings.delta.xml b/services/common/src/main/cspace/config/services/tenants/bonsai/bonsai-tenant-bindings.delta.xml index 2f12109df3..976c9ef2c0 100644 --- a/services/common/src/main/cspace/config/services/tenants/bonsai/bonsai-tenant-bindings.delta.xml +++ b/services/common/src/main/cspace/config/services/tenants/bonsai/bonsai-tenant-bindings.delta.xml @@ -15,9 +15,6 @@ // index as small as possible. We may want to turn this on in the future, to support arbitrary // searches through Elasticsearch, e.g. NXQL queries for ad hoc reporting in the CSpace UI. "dynamic": false, - "_all" : { - "enabled": false - }, "_source": { "includes": [ "collectionobjects_common:briefDescriptions", diff --git a/services/common/src/main/cspace/config/services/tenants/fcart/fcart-tenant-bindings.delta.xml b/services/common/src/main/cspace/config/services/tenants/fcart/fcart-tenant-bindings.delta.xml index 0045ce0287..a449679117 100644 --- a/services/common/src/main/cspace/config/services/tenants/fcart/fcart-tenant-bindings.delta.xml +++ b/services/common/src/main/cspace/config/services/tenants/fcart/fcart-tenant-bindings.delta.xml @@ -24,9 +24,6 @@ // index as small as possible. We may want to turn this on in the future, to support arbitrary // searches through Elasticsearch, e.g. NXQL queries for ad hoc reporting in the CSpace UI. "dynamic": false, - "_all" : { - "enabled": false - }, "_source": { "includes": [ "collectionobjects_common:briefDescriptions", diff --git a/services/common/src/main/cspace/config/services/tenants/lhmc/lhmc-tenant-bindings.delta.xml b/services/common/src/main/cspace/config/services/tenants/lhmc/lhmc-tenant-bindings.delta.xml index f836218cc5..71b91a369f 100644 --- a/services/common/src/main/cspace/config/services/tenants/lhmc/lhmc-tenant-bindings.delta.xml +++ b/services/common/src/main/cspace/config/services/tenants/lhmc/lhmc-tenant-bindings.delta.xml @@ -15,9 +15,6 @@ // index as small as possible. We may want to turn this on in the future, to support arbitrary // searches through Elasticsearch, e.g. NXQL queries for ad hoc reporting in the CSpace UI. "dynamic": false, - "_all" : { - "enabled": false - }, "_source": { "includes": [ "collectionobjects_common:briefDescriptions", diff --git a/services/common/src/main/cspace/config/services/tenants/materials/materials-tenant-bindings.delta.xml b/services/common/src/main/cspace/config/services/tenants/materials/materials-tenant-bindings.delta.xml index 64e57db8e8..771e303a78 100644 --- a/services/common/src/main/cspace/config/services/tenants/materials/materials-tenant-bindings.delta.xml +++ b/services/common/src/main/cspace/config/services/tenants/materials/materials-tenant-bindings.delta.xml @@ -19,9 +19,6 @@ // index as small as possible. We may want to turn this on in the future, to support arbitrary // searches through Elasticsearch, e.g. NXQL queries for ad hoc reporting in the CSpace UI. "dynamic": false, - "_all" : { - "enabled": false - }, "_source": { "includes": [ "collectionspace_denorm:*", 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 91411631c4..42834cb08d 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 @@ -1174,9 +1174,6 @@ // index as small as possible. We may want to turn this on in the future, to support arbitrary // searches through Elasticsearch, e.g. NXQL queries for ad hoc reporting in the CSpace UI. "dynamic": false, - "_all" : { - "enabled": false - }, "_source": { "includes": [ "collectionobjects_common:briefDescriptions", diff --git a/services/common/src/main/java/org/collectionspace/services/common/CollectionSpaceServiceContextListener.java b/services/common/src/main/java/org/collectionspace/services/common/CollectionSpaceServiceContextListener.java index dd2ce05e51..9d6d91e9dd 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/CollectionSpaceServiceContextListener.java +++ b/services/common/src/main/java/org/collectionspace/services/common/CollectionSpaceServiceContextListener.java @@ -56,7 +56,7 @@ public void contextDestroyed(ServletContextEvent event) { ServiceMain instance = null; try { - ServiceMain.getInstance(); + instance = ServiceMain.getInstance(); } catch (Throwable t) { // Do nothing. Error already logged by the Services layer } finally { diff --git a/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java b/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java index fd0803b46c..65d47cbd8a 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java +++ b/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java @@ -1219,7 +1219,7 @@ public TenantBindingConfigReaderImpl getTenantBindingConfigReader() { public ResourceMap getJaxRSResourceMap() { ResourceMap result; - result = ResteasyProviderFactory.getContextData(ResourceMap.class); + result = ResteasyProviderFactory.getInstance().getContextData(ResourceMap.class); return result; } diff --git a/services/common/src/main/java/org/collectionspace/services/common/authorization_mgt/AuthorizationCommon.java b/services/common/src/main/java/org/collectionspace/services/common/authorization_mgt/AuthorizationCommon.java index 91c920708e..ca9ff6342f 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/authorization_mgt/AuthorizationCommon.java +++ b/services/common/src/main/java/org/collectionspace/services/common/authorization_mgt/AuthorizationCommon.java @@ -1,6 +1,5 @@ package org.collectionspace.services.common.authorization_mgt; -import java.security.NoSuchAlgorithmException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -19,7 +18,6 @@ import org.collectionspace.authentication.AuthN; import org.collectionspace.services.account.AccountListItem; - import org.collectionspace.services.authentication.Token; import org.collectionspace.services.authorization.AuthZ; import org.collectionspace.services.authorization.CSpaceAction; @@ -41,7 +39,6 @@ import org.collectionspace.services.client.Profiler; import org.collectionspace.services.client.RoleClient; import org.collectionspace.services.client.workflow.WorkflowClient; - import org.collectionspace.services.common.config.ServiceConfigUtils; import org.collectionspace.services.common.config.TenantBindingConfigReaderImpl; import org.collectionspace.services.common.context.ServiceBindingUtils; @@ -52,17 +49,13 @@ import org.collectionspace.services.common.storage.JDBCTools; import org.collectionspace.services.common.storage.jpa.JPATransactionContext; import org.collectionspace.services.common.storage.jpa.JpaStorageUtils; - import org.collectionspace.services.config.service.ServiceBindingType; import org.collectionspace.services.config.tenant.EmailConfig; import org.collectionspace.services.config.tenant.PasswordResetConfig; import org.collectionspace.services.config.tenant.TenantBindingType; - import org.collectionspace.services.lifecycle.Lifecycle; import org.collectionspace.services.lifecycle.TransitionDef; import org.collectionspace.services.lifecycle.TransitionDefList; - -//import org.mortbay.log.Log; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -189,7 +182,7 @@ public static Role getRole(JPATransactionContext jpaTransactionContext, String t public static Role createRole(String tenantId, String name, String description, boolean immutable) { Role role = new Role(); - role.setCreatedAtItem(new Date()); + role.setCreatedAt(new Date()); role.setDisplayName(name); String roleName = AuthorizationCommon.getQualifiedRoleName(tenantId, name); role.setRoleName(roleName); @@ -298,7 +291,7 @@ private static Permission createPermission(String tenantId, Permission perm = new Permission(); perm.setCsid(id); perm.setDescription(description); - perm.setCreatedAtItem(new Date()); + perm.setCreatedAt(new Date()); perm.setResourceName(resourceName.toLowerCase().trim()); perm.setEffect(EffectType.PERMIT); perm.setTenantId(tenantId); @@ -1105,7 +1098,7 @@ public static void createDefaultWorkflowPermissions( Role readonlyRole = AuthorizationCommon.getRole(jpaTransactionContext, tenantBinding.getId(), ROLE_TENANT_READER); if (adminRole == null || readonlyRole == null) { - String msg = String.format("One or more of the required default CollectionSpace administrator roles is missing or was never created. If you're setting up a new instance of CollectionSpace, shutdown the Tomcat server and run the 'ant import' command from the root/top level CollectionSpace 'Services' source directory. Then try restarting Tomcat."); + String msg = "One or more of the required default CollectionSpace administrator roles is missing or was never created. If you're setting up a new instance of CollectionSpace, shutdown the Tomcat server and run the 'ant import' command from the root/top level CollectionSpace 'Services' source directory. Then try restarting Tomcat."; logger.info(msg); throw new RuntimeException("One or more of the required default CollectionSpace administrator roles is missing or was never created."); } @@ -1265,17 +1258,17 @@ private static void persist(JPATransactionContext jpaTransactionContext, Permiss } - public static boolean hasTokenExpired(EmailConfig emailConfig, Token token) throws NoSuchAlgorithmException { + public static boolean hasTokenExpired(EmailConfig emailConfig, Token token) { boolean result = false; int maxConfigSeconds = emailConfig.getPasswordResetConfig().getTokenExpirationSeconds().intValue(); int maxTokenSeconds = token.getExpireSeconds().intValue(); - long createdTime = token.getCreatedAtItem().getTime(); - long configExpirationTime = createdTime + maxConfigSeconds * 1000; // the current tenant config for how long a token stays valid - long tokenDefinedExirationTime = createdTime + maxTokenSeconds * 1000; // the tenant config for how long a token stays valid when the token was created. + long createdTime = token.getCreatedAt().getTime(); + long configExpirationTime = createdTime + maxConfigSeconds * 1000L; // the current tenant config for how long a token stays valid + long tokenDefinedExpirationTime = createdTime + maxTokenSeconds * 1000L; // the tenant config for how long a token stays valid when the token was created. - if (configExpirationTime != tokenDefinedExirationTime) { + if (configExpirationTime != tokenDefinedExpirationTime) { String msg = String.format("The configured expiration time for the token = '%s' changed from when the token was created.", token.getId()); logger.warn(msg); diff --git a/services/common/src/main/java/org/collectionspace/services/common/authorization_mgt/AuthorizationStore.java b/services/common/src/main/java/org/collectionspace/services/common/authorization_mgt/AuthorizationStore.java index 6a4b72ac02..64211d4960 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/authorization_mgt/AuthorizationStore.java +++ b/services/common/src/main/java/org/collectionspace/services/common/authorization_mgt/AuthorizationStore.java @@ -118,7 +118,7 @@ public String store(Object entity) throws Exception { //by the caller em.getTransaction().begin(); if (JaxbUtils.getValue(entity, "getCreatedAt") == null) { - JaxbUtils.setValue(entity, "setCreatedAtItem", Date.class, new Date()); + JaxbUtils.setValue(entity, "setCreatedAt", Date.class, new Date()); } em.persist(entity); em.getTransaction().commit(); @@ -201,7 +201,7 @@ public String store(JPATransactionContext jpaTransactionContext, Object entity) } */ if (JaxbUtils.getValue(entity, "getCreatedAt") == null) { - JaxbUtils.setValue(entity, "setCreatedAtItem", Date.class, new Date()); + JaxbUtils.setValue(entity, "setCreatedAt", Date.class, new Date()); } if (entityExists == true) { diff --git a/services/common/src/main/java/org/collectionspace/services/common/context/ServiceBindingUtils.java b/services/common/src/main/java/org/collectionspace/services/common/context/ServiceBindingUtils.java index 9404590b19..c05f57f237 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/context/ServiceBindingUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/context/ServiceBindingUtils.java @@ -15,7 +15,7 @@ import org.collectionspace.services.config.types.PropertyItemType; import org.collectionspace.services.config.types.PropertyType; import org.collectionspace.services.nuxeo.util.NuxeoUtils; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DocumentModel; import java.lang.IndexOutOfBoundsException; @@ -218,7 +218,7 @@ public static String getMappedFieldInDoc(ServiceBindingType sb, logger.trace("SBUtils.getMappedField caught OOB exc, for Prop: " + propName + " in: " + docModel.getDocumentType().getName() + " csid: " + NuxeoUtils.getCsid(docModel)); - } catch (ClientException ce) { + } catch (NuxeoException ce) { throw new RuntimeException( "getMappedFieldInDoc: Problem fetching: " + propName + " logicalfieldName: " + logicalFieldName diff --git a/services/common/src/main/java/org/collectionspace/services/common/document/DocumentUtils.java b/services/common/src/main/java/org/collectionspace/services/common/document/DocumentUtils.java index c1b7ab430a..e9252e7198 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/document/DocumentUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/document/DocumentUtils.java @@ -753,7 +753,7 @@ private static void buildList(Document document, Element element, */ public static Schema getSchemaFromName(String schemaName) { SchemaManager schemaManager = Framework - .getLocalService(SchemaManager.class); + .getService(SchemaManager.class); return schemaManager.getSchema(schemaName); } diff --git a/services/common/src/main/java/org/collectionspace/services/common/document/JaxbUtils.java b/services/common/src/main/java/org/collectionspace/services/common/document/JaxbUtils.java index 366634d278..d62a368f3d 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/document/JaxbUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/document/JaxbUtils.java @@ -27,17 +27,17 @@ */ package org.collectionspace.services.common.document; -import java.io.InputStream; import java.io.StringWriter; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Marshaller; + import javax.xml.namespace.QName; +import org.collectionspace.services.common.jaxb.JAXBContextCache; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -59,11 +59,11 @@ public static String toString(Object o, Class clazz) { StringWriter sw = new StringWriter(); try { - JAXBContext jc = JAXBContext.newInstance(clazz); + JAXBContext jc = JAXBContextCache.getInstance().getCachedJAXBContext(clazz); Marshaller m = jc.createMarshaller(); m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); m.marshal(o, sw); - } catch (javax.xml.bind.MarshalException e) { + } catch (jakarta.xml.bind.MarshalException e) { // // If the JAX-B object we're trying to marshal doesn't have an @XmlRootElement, then we need another // approach. @@ -83,7 +83,7 @@ private static String marshalWithoutRoot(Object o, Class clazz) { StringWriter sw = new StringWriter(); try { - JAXBContext jc = JAXBContext.newInstance(clazz); + JAXBContext jc = JAXBContextCache.getInstance().getCachedJAXBContext(clazz); Marshaller marshaller = jc.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); marshaller.marshal(new JAXBElement(new QName("uri","local"), clazz, o), sw); @@ -94,40 +94,6 @@ private static String marshalWithoutRoot(Object o, Class clazz) { return sw.toString(); } - /** - * fromFile retrieves object of given class from given file (in classpath) - * @param jaxbClass - * @param fileName of the file to read to construct the object - * @return - * @throws Exception - */ - public static Object fromFile(Class jaxbClass, String fileName) - throws Exception { - - JAXBContext context = JAXBContext.newInstance(jaxbClass); - Unmarshaller unmarshaller = context.createUnmarshaller(); - //note: setting schema to null will turn validator off - unmarshaller.setSchema(null); - ClassLoader tccl = Thread.currentThread().getContextClassLoader(); - InputStream is = tccl.getResourceAsStream(fileName); - return fromStream(jaxbClass, is); - } - - /** - * fromStream retrieves object of given class from given inputstream - * @param jaxbClass - * @param is stream to read to construct the object - * @return - * @throws Exception - */ - public static Object fromStream(Class jaxbClass, InputStream is) throws Exception { - JAXBContext context = JAXBContext.newInstance(jaxbClass); - Unmarshaller unmarshaller = context.createUnmarshaller(); - //note: setting schema to null will turn validator off - unmarshaller.setSchema(null); - return jaxbClass.cast(unmarshaller.unmarshal(is)); - } - /** * getValue gets invokes specified accessor method on given object. Assumption * is that this is used for JavaBean pattern getXXX methods only. diff --git a/services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/ImagePlugin.javax b/services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/ImagePlugin.javax index 2d7d8dbff9..845ceaa0b7 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/ImagePlugin.javax +++ b/services/common/src/main/java/org/collectionspace/services/common/imaging/nuxeo/ImagePlugin.javax @@ -24,7 +24,7 @@ import java.util.Map; import org.nuxeo.common.utils.IdUtils; import org.nuxeo.ecm.core.api.Blob; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentRef; @@ -39,6 +39,7 @@ import org.nuxeo.ecm.platform.types.TypeManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +// TODO: This file is named incorrectly. What was it supposed to be for? public class ImagePlugin extends AbstractFileImporter { private static final long serialVersionUID = 5850210255138418118L; @@ -47,7 +48,7 @@ public class ImagePlugin extends AbstractFileImporter { public DocumentModel create(CoreSession documentManager, Blob content, String path, boolean overwrite, String fullname, - TypeManager typeService) throws ClientException, IOException { + TypeManager typeService) throws NuxeoException, IOException { path = getNearestContainerPath(documentManager, path); doSecurityCheck(documentManager, path, ImagingDocumentConstants.PICTURE_TYPE_NAME, typeService); 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 2b638550da..f4fe2f3a3b 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 @@ -29,9 +29,12 @@ import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileNotFoundException; +import java.io.IOException; import java.io.InputStream; +import java.io.Serializable; import java.math.BigDecimal; import java.math.BigInteger; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.HashSet; @@ -40,63 +43,61 @@ import java.util.Set; import java.util.UUID; -import org.nuxeo.runtime.api.Framework; -import org.nuxeo.ecm.platform.picture.api.ImageInfo; -import org.nuxeo.ecm.platform.picture.api.ImagingDocumentConstants; -import org.nuxeo.ecm.platform.picture.api.ImagingService; -import org.nuxeo.ecm.platform.picture.api.PictureView; -import org.nuxeo.ecm.platform.mimetype.MimetypeDetectionException; -import org.nuxeo.ecm.platform.mimetype.interfaces.MimetypeRegistry; -import org.nuxeo.ecm.platform.picture.api.adapters.PictureBlobHolder; -import org.nuxeo.ecm.platform.filemanager.api.FileManager; -import org.nuxeo.ecm.platform.filemanager.service.FileManagerService; -import org.nuxeo.ecm.platform.filemanager.service.extension.FileImporter; -import org.nuxeo.ecm.platform.filemanager.utils.FileManagerUtils; -import org.nuxeo.ecm.platform.types.TypeManager; -import org.nuxeo.ecm.core.api.IdRef; -import org.nuxeo.ecm.core.api.NuxeoException; -import org.nuxeo.ecm.core.api.blobholder.BlobHolder; -import org.nuxeo.ecm.core.api.blobholder.DocumentBlobHolder; -import org.nuxeo.ecm.core.api.impl.blob.FileBlob; -import org.nuxeo.ecm.core.api.model.Property; -import org.nuxeo.binary.metadata.api.BinaryMetadataService; -import org.nuxeo.ecm.core.api.Blob; -import org.nuxeo.ecm.core.api.ClientException; -import org.nuxeo.ecm.core.api.DocumentModel; -import org.nuxeo.ecm.core.api.DocumentRef; -import org.nuxeo.ecm.core.api.PropertyException; -import org.nuxeo.ecm.core.blob.BlobManager; -import org.nuxeo.ecm.core.blob.BlobProvider; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.apache.commons.io.IOUtils; - +import org.collectionspace.services.blob.BlobsCommon; +import org.collectionspace.services.blob.DimensionSubGroup; +import org.collectionspace.services.blob.DimensionSubGroupList; +import org.collectionspace.services.blob.MeasuredPartGroup; +import org.collectionspace.services.blob.MeasuredPartGroupList; import org.collectionspace.services.client.PoxPayloadIn; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.common.FileUtilities; import org.collectionspace.services.common.ServiceMain; +import org.collectionspace.services.common.api.CommonAPI; +import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils; import org.collectionspace.services.common.blob.BlobInput; +import org.collectionspace.services.common.blob.BlobOutput; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.document.DocumentException; import org.collectionspace.services.common.document.DocumentNotFoundException; import org.collectionspace.services.common.document.TransactionException; import org.collectionspace.services.common.repository.RepositoryClient; -import org.collectionspace.services.common.api.CommonAPI; -import org.collectionspace.services.common.api.GregorianCalendarDateTimeUtils; -import org.collectionspace.services.common.blob.BlobOutput; -import org.collectionspace.services.blob.BlobsCommon; -import org.collectionspace.services.blob.DimensionSubGroup; -import org.collectionspace.services.blob.DimensionSubGroupList; -import org.collectionspace.services.blob.MeasuredPartGroup; -import org.collectionspace.services.blob.MeasuredPartGroupList; +import org.collectionspace.services.config.service.ListResultField; 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.NuxeoRepositoryClientImpl; import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.collectionspace.services.nuxeo.util.ThumbnailConstants; -import org.collectionspace.services.config.service.ListResultField; +import org.nuxeo.binary.metadata.api.BinaryMetadataService; +import org.nuxeo.ecm.core.api.Blob; +import org.nuxeo.ecm.core.api.DocumentModel; +import org.nuxeo.ecm.core.api.DocumentRef; +import org.nuxeo.ecm.core.api.IdRef; +import org.nuxeo.ecm.core.api.NuxeoException; +import org.nuxeo.ecm.core.api.PropertyException; +import org.nuxeo.ecm.core.api.blobholder.BlobHolder; +import org.nuxeo.ecm.core.api.blobholder.DocumentBlobHolder; +import org.nuxeo.ecm.core.api.impl.blob.FileBlob; +import org.nuxeo.ecm.core.api.model.Property; +import org.nuxeo.ecm.core.blob.BlobManager; +import org.nuxeo.ecm.core.blob.BlobProvider; +import org.nuxeo.ecm.platform.filemanager.api.FileImporterContext; +import org.nuxeo.ecm.platform.filemanager.api.FileManager; +import org.nuxeo.ecm.platform.filemanager.service.FileManagerService; +import org.nuxeo.ecm.platform.filemanager.service.extension.FileImporter; +import org.nuxeo.ecm.platform.filemanager.utils.FileManagerUtils; +import org.nuxeo.ecm.platform.mimetype.MimetypeDetectionException; +import org.nuxeo.ecm.platform.mimetype.interfaces.MimetypeRegistry; +import org.nuxeo.ecm.platform.picture.api.ImageInfo; +import org.nuxeo.ecm.platform.picture.api.ImagingDocumentConstants; +import org.nuxeo.ecm.platform.picture.api.ImagingService; +import org.nuxeo.ecm.platform.picture.api.PictureView; +import org.nuxeo.ecm.platform.picture.api.adapters.PictureBlobHolder; +import org.nuxeo.ecm.platform.types.TypeManager; +import org.nuxeo.runtime.api.Framework; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Use Nuxeo's FileBlob class to create a temporary file that Nuxeo manages. @@ -227,13 +228,13 @@ private static String toStringPictureView(PictureView pictureView) { return strBuffer.toString(); } - static private String getDerivativeUri(String uri, String derivativeName) { + private static String getDerivativeUri(String uri, String derivativeName) { return uri + derivativeName + "/" + BlobInput.URI_CONTENT_PATH; } - static private HashMap createBlobListItem(Blob blob, - String uri, - String derivativeName) { + private static HashMap createBlobListItem(Blob blob, + String uri, + String derivativeName) { HashMap item = new HashMap(); String value = getDerivativeUri(uri, derivativeName); @@ -263,14 +264,14 @@ static private HashMap createBlobListItem(Blob blob, return item; } - static public String getSanizitedFilename(File srcFile) throws Exception { + public static String getSanizitedFilename(File srcFile) throws Exception { return getSanizitedFilename(srcFile.getName()); } /* * Valid Nuxeo file names are a subset of *nix and Windows filenames, so we need to check. */ - static public String getSanizitedFilename(String fileName) throws Exception { + public static String getSanizitedFilename(String fileName) throws Exception { String result = fileName; if (fileName != null && fileName.matches(NUXEO_FILENAME_VALID_STRING) == false) { @@ -285,7 +286,7 @@ static public String getSanizitedFilename(String fileName) throws Exception { if (result != null && logger.isDebugEnabled() == true) { if (result.equals(fileName) == false) { - logger.debug(String.format("The file name '%s' was sanizitized to '%s'.", fileName, result)); + logger.debug("The file name '{}' was sanizitized to '{}'.", fileName, result); } } @@ -337,8 +338,8 @@ private static void handlePictureViewBlobs(PictureBlobHolder pictureBlobHolder, commonList.setItemsInPage(total); } - static public CommonList getBlobDerivatives(CoreSessionInterface repoSession, - String repositoryId, List resultsFields, String uri) + public static CommonList getBlobDerivatives(CoreSessionInterface repoSession, + String repositoryId, List resultsFields, String uri) throws Exception { CommonList commonList = new CommonList(); int nFields = resultsFields.size() + 2; @@ -383,7 +384,7 @@ private static Map getMetadata(Blob nuxeoBlob) throws Exception return binaryMetadataService.readMetadata(nuxeoBlob, false); } - static private MeasuredPartGroupList getDimensions( + private static MeasuredPartGroupList getDimensions( DocumentModel documentModel, Blob nuxeoBlob) { MeasuredPartGroupList result = null; @@ -456,19 +457,19 @@ static private MeasuredPartGroupList getDimensions( // FIXME: Add error checking here, as none of these calls return an // Exception - static private BigDecimal intToBigDecimal(int i) { + private static BigDecimal intToBigDecimal(int i) { BigInteger bigint = BigInteger.valueOf(i); BigDecimal bigdec = new BigDecimal(bigint); return bigdec; } - static private BlobsCommon createBlobsCommon(ServiceContext ctx, DocumentModel documentModel, - Blob nuxeoBlob) { + private static BlobsCommon createBlobsCommon(ServiceContext ctx, DocumentModel documentModel, + Blob nuxeoBlob) { return createBlobsCommon(ctx, documentModel, nuxeoBlob, false); } - static private BlobsCommon createBlobsCommon(ServiceContext ctx, DocumentModel documentModel, - Blob nuxeoBlob, Boolean getContentFlag) { + private static BlobsCommon createBlobsCommon(ServiceContext ctx, DocumentModel documentModel, + Blob nuxeoBlob, Boolean getContentFlag) { BlobsCommon result = new BlobsCommon(); if (documentModel != null && nuxeoBlob != null) { @@ -484,7 +485,7 @@ static private BlobsCommon createBlobsCommon(ServiceContext ctx, DocumentModel d BlobProvider bp = blobManager.getBlobProvider(ctx.getRepositoryName()); digest = bp.getBinaryManager().getBinary(nuxeoBlob).getDigest(); } catch (Exception e) { - logger.warn(String.format("Could not compute digest value for uploaded media '%s'.", nuxeoBlob.getFilename())); + logger.warn("Could not compute digest value for uploaded media '{}'.", nuxeoBlob.getFilename()); } } result.setDigest(digest); @@ -511,7 +512,7 @@ static private BlobsCommon createBlobsCommon(ServiceContext ctx, DocumentModel d ThumbnailConstants.THUMBNAIL_FILENAME_PROPERTY_NAME); Blob thumbnailBlob = (Blob)documentModel.getProperty(ThumbnailConstants.THUMBNAIL_SCHEMA_NAME, ThumbnailConstants.THUMBNAIL_PROPERTY_NAME); - } catch (ClientException e) { + } catch (NuxeoException e) { errorMsg = "Could not extract the name of the thumbnail preview image file."; if (logger.isDebugEnabled()) { logger.debug(errorMsg, e); @@ -529,8 +530,8 @@ static private BlobsCommon createBlobsCommon(ServiceContext ctx, DocumentModel d return result; } - static private Blob checkMimeType(Blob blob, String fullname) - throws ClientException { + private static Blob checkMimeType(Blob blob, String fullname) + throws NuxeoException { final String mimeType = blob.getMimeType(); if (mimeType != null && !mimeType.equals("application/octet-stream") && !mimeType.equals("application/octetstream")) { @@ -540,7 +541,7 @@ static private Blob checkMimeType(Blob blob, String fullname) try { blob = getMimeService().updateMimetype(blob, filename); } catch (MimetypeDetectionException e) { - throw new ClientException(e); + throw new NuxeoException(e); } return blob; } @@ -549,16 +550,16 @@ static private Blob checkMimeType(Blob blob, String fullname) * Gets the type service. Not in use, but please keep for future reference * * @return the type service - * @throws ClientException + * @throws NuxeoException * the client exception */ - private static TypeManager getTypeService() throws ClientException { + private static TypeManager getTypeService() throws NuxeoException { TypeManager typeService = null; try { typeService = Framework.getService(TypeManager.class); } catch (Exception e) { - throw new ClientException(e); + throw new NuxeoException(e); } return typeService; @@ -579,10 +580,10 @@ private static Blob createFileBlob(File file, boolean isTemporary) throws Except * Gets Nuxeo's file manager service. * * @return the file manager service - * @throws ClientException + * @throws NuxeoException * the client exception */ - private static FileManager getFileManager() throws ClientException { + private static FileManager getFileManager() throws NuxeoException { FileManager result = null; try { @@ -590,7 +591,7 @@ private static FileManager getFileManager() throws ClientException { } catch (Exception e) { String msg = "Unable to get Nuxeo's FileManager service."; logger.error(msg, e); - throw new ClientException("msg", e); + throw new NuxeoException("msg", e); } return result; @@ -600,10 +601,10 @@ private static FileManager getFileManager() throws ClientException { * Gets Nuxeo's file manager service. * * @return the file manager service - * @throws ClientException + * @throws NuxeoException * the client exception */ - private static FileManagerService getFileManagerService() throws ClientException { + private static FileManagerService getFileManagerService() throws NuxeoException { FileManagerService result = null; try { @@ -611,15 +612,15 @@ private static FileManagerService getFileManagerService() throws ClientException } catch (Exception e) { String msg = "Unable to get Nuxeo's FileManager service."; logger.error(msg, e); - throw new ClientException("msg", e); + throw new NuxeoException("msg", e); } return result; } - static private CoreSessionInterface getRepositorySession(ServiceContext ctx, - RepositoryClient repositoryClient) { + private static CoreSessionInterface getRepositorySession(ServiceContext ctx, + RepositoryClient repositoryClient) { CoreSessionInterface result = null; NuxeoRepositoryClientImpl nuxeoClient = (NuxeoRepositoryClientImpl)repositoryClient; @@ -632,20 +633,20 @@ static private CoreSessionInterface getRepositorySession(ServiceContext ctx, - RepositoryClient repositoryClient, - CoreSessionInterface repoSession) throws TransactionException { + private static void releaseRepositorySession(ServiceContext ctx, + RepositoryClient repositoryClient, + CoreSessionInterface repoSession) throws TransactionException { NuxeoRepositoryClientImpl nuxeoClient = (NuxeoRepositoryClientImpl)repositoryClient; nuxeoClient.releaseRepositorySession(ctx, repoSession); } - static private MimetypeRegistry getMimeService() throws ClientException { + private static MimetypeRegistry getMimeService() throws NuxeoException { MimetypeRegistry result = null; try { result = Framework.getService(MimetypeRegistry.class); } catch (Exception e) { - throw new ClientException(e); + throw new NuxeoException(e); } return result; @@ -660,40 +661,63 @@ private static DocumentModel createDocumentFromBlob( boolean useNuxeoAdaptors) throws Exception { DocumentModel result = null; - boolean createdFromAdaptor = false; - if (useNuxeoAdaptors == true) try { - // - // Use Nuxeo's high-level create method which looks for plugin adapters that match the MIME type. For example, - // for image blobs, Nuxeo's file manager will pick a special image plugin that will automatically generate - // image derivatives. - // - result = getFileManager().createDocumentFromBlob( - repoSession.getCoreSession(), inputStreamBlob, blobLocation, overwrite, blobName); - createdFromAdaptor = true; - } catch (NuxeoException ne) { - logger.warn(String.format("Tried but failed to use Nuxeo import adaptor to download '%s'. Falling back to generic file importer", - blobName)); + // useNuxeoAdaptors is kind of a misnomer because we always use Nuxeo to create the Blob document + // instead now it's more used to show where the call has come from (PublicItem vs BlobDocumentModelHandler) + // and to determine if we want to generate derivatives or not + if (!useNuxeoAdaptors) { + inputStreamBlob = checkMimeType(inputStreamBlob, blobName); } - if (createdFromAdaptor == false) { - // - // User Nuxeo's default file importer/adapter explicitly. This avoids specialized functionality from happening like - // image derivative creation. - // - String digestAlgorithm = getFileManager().getDigestAlgorithm(); // Only call this because we seem to need some way of initializing Nuxeo's FileManager with a call. - - FileManagerService fileManagerService = getFileManagerService(); - inputStreamBlob = checkMimeType(inputStreamBlob, blobName); + final var context = FileImporterContext.builder(repoSession.getCoreSession(), inputStreamBlob, blobLocation) + .overwrite(overwrite) + .fileName(blobName) + .build(); + result = getFileManager().createOrUpdateDocument(context); - FileImporter defaultFileImporter = fileManagerService.getPluginByName("DefaultFileImporter"); - result = defaultFileImporter.create( - repoSession.getCoreSession(), inputStreamBlob, blobLocation, overwrite, blobName, getTypeService()); + // Compute the views now instead of relying on Nuxeo to populate them + if (result != null && isBlobAnImage(inputStreamBlob) && useNuxeoAdaptors) { + computeViews(result, inputStreamBlob); } return result; } - static public BlobsCommon createBlobInRepository( + /** + * Compute the derivative views and add them to our document. This assumes the view list is not populated and in the + * future we might need to clear existing views before setting the value. + * + * @param doc The Blob's document + * @param blob The Blob + */ + private static void computeViews(DocumentModel doc, Blob blob) { + final var convert = true; + final var imagingService = Framework.getService(ImagingService.class); + if (imagingService == null) { + logger.warn("Unable to compute views for {}, ImagingService not found", blob.getFilename()); + return; + } + + final var views = new ArrayList>(); + final var imageInfo = imagingService.getImageInfo(blob); + if (imageInfo == null) { + logger.warn("Unable to generate imageInfo for {}, skipping derivative generation", blob.getFilename()); + return; + } + + try { + final var computedViews = imagingService.computeViewsFor(doc, blob, imageInfo, convert); + for (var view : computedViews) { + views.add(view.asMap()); + } + doc.setPropertyValue(VIEWS_PROPERTY, views); + } catch (PropertyException e) { + logger.error("Unable to set view property for document {}", blob.getFilename(), e); + } catch (IOException e) { + logger.error("Unable to compute views for document {}", blob.getFilename(), e); + } + } + + public static BlobsCommon createBlobInRepository( ServiceContext ctx, RepositoryClient repositoryClient, InputStream inputStream, @@ -768,8 +792,9 @@ public static BlobsCommon createBlobInRepository( if (sanitizedName.equals(originalFile.getName()) == false) { targetFile = FileUtilities.createTmpFile(originalFile, sanitizedName); if (logger.isDebugEnabled() == true) { - logger.debug(String.format("The file '%s''s name has characters that Nuxeo can't deal with. Rather than renaming the file, we created a new temp file at '%s'", - originalFile.getName(), targetFile.getAbsolutePath())); + logger.debug( + "The file '{}''s name has characters that Nuxeo can't deal with. Rather than renaming the file, we created a new temp file at '{}'", + originalFile.getName(), targetFile.getAbsolutePath()); } } @@ -802,7 +827,7 @@ public static BlobsCommon createBlobInRepository( // if (targetFile.equals(originalFile) == false) { if (targetFile.delete() == false) { - logger.warn(String.format("Attempt to delete temporary file '%s' failed.", targetFile.getAbsolutePath())); + logger.warn("Attempt to delete temporary file '{}' failed.", targetFile.getAbsolutePath()); } } } @@ -814,7 +839,7 @@ public static BlobsCommon createBlobInRepository( * Find out if this document's blob/file-contents are allowed to be purged. For instance, we currently * only want to allow the purging the contents of Nuxeo "Picture" documents. */ - static private boolean isPurgeAllowed(DocumentModel docModel) { + private static boolean isPurgeAllowed(DocumentModel docModel) { boolean result = false; if (docModel.hasFacet(ImagingDocumentConstants.PICTURE_FACET) == true) { @@ -839,7 +864,7 @@ static private boolean isPurgeAllowed(DocumentModel docModel) { * the mime type * @return the string */ - static private BlobsCommon createBlobInRepository(ServiceContext ctx, + private static BlobsCommon createBlobInRepository(ServiceContext ctx, CoreSessionInterface nuxeoSession, DocumentModel blobLocation, boolean purgeOriginal, @@ -877,8 +902,9 @@ static private BlobsCommon createBlobInRepository(ServiceContext ctx, String source = (String)documentModel.getProperty(CommonAPI.NUXEO_DUBLINCORE_SCHEMANAME, CommonAPI.NUXEO_DUBLINCORE_SOURCE); if (source != null) { - logger.warn(String.format("The Nuxeo dublin core property '%s' is set to '%s'. We expected it to be empty. See JIRA issue CSPACE-6679 for details.", - CommonAPI.NUXEO_DUBLINCORE_SOURCE, source)); + logger.warn( + "The Nuxeo dublin core property '{}' is set to '{}'. We expected it to be empty. See JIRA issue CSPACE-6679 for details.", + CommonAPI.NUXEO_DUBLINCORE_SOURCE, source); } documentModel.setProperty(CommonAPI.NUXEO_DUBLINCORE_SCHEMANAME, CommonAPI.NUXEO_DUBLINCORE_SOURCE, CommonAPI.URL_SOURCED_PICTURE); @@ -948,10 +974,10 @@ public static InputStream getResource(String resourceName) { return result; } - static public BlobOutput getBlobOutput(ServiceContext ctx, - RepositoryClient repositoryClient, - String repositoryId, - StringBuffer outMimeType) throws TransactionException, DocumentNotFoundException { + public static BlobOutput getBlobOutput(ServiceContext ctx, + RepositoryClient repositoryClient, + String repositoryId, + StringBuffer outMimeType) throws TransactionException, DocumentNotFoundException { BlobOutput result = null; boolean repoSessionCleanup = false; @@ -987,7 +1013,7 @@ static public BlobOutput getBlobOutput(ServiceContext getPictureViewNameSet(CoreSessionInterface repoSession, String repositoryId) throws PropertyException { + public static Set getPictureViewNameSet(CoreSessionInterface repoSession, String repositoryId) throws PropertyException { Set result = null; DocumentModel docModel = repoSession.getDocument(new IdRef(repositoryId)); @@ -1044,7 +1071,7 @@ static public Set getPictureViewNameSet(CoreSessionInterface repoSession * @return the image * @throws DocumentNotFoundException */ - static public BlobOutput getBlobOutput(ServiceContext ctx, + public static BlobOutput getBlobOutput(ServiceContext ctx, CoreSessionInterface repoSession, String repositoryId, String derivativeTerm, @@ -1204,11 +1231,11 @@ static public BlobOutput getBlobOutput(ServiceContext modes) { + public static String createWhereClauseForInvocableByMode(String schema, List modes) { return queryManager.createWhereClauseForInvocableByMode(schema, modes); } } diff --git a/services/common/src/main/java/org/collectionspace/services/common/query/nuxeo/QueryManagerNuxeoImpl.java b/services/common/src/main/java/org/collectionspace/services/common/query/nuxeo/QueryManagerNuxeoImpl.java index 0058c73b1c..f3ba49ed92 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/query/nuxeo/QueryManagerNuxeoImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/common/query/nuxeo/QueryManagerNuxeoImpl.java @@ -46,8 +46,7 @@ public class QueryManagerNuxeoImpl implements IQueryManager { - private static String ECM_FULLTEXT_LIKE = "ecm:fulltext" - + SEARCH_TERM_SEPARATOR + IQueryManager.SEARCH_LIKE; + private static String ECM_FULLTEXT_LIKE = "ecm:fulltext" + SEARCH_TERM_SEPARATOR + IQueryManager.SEARCH_LIKE; private static String SEARCH_LIKE_FORM = null; private final Logger logger = LoggerFactory @@ -82,22 +81,6 @@ public String getDatasourceName() { return JDBCTools.NUXEO_DATASOURCE_NAME; } - // TODO: This is currently just an example fixed query. This should - // eventually be - // removed or replaced with a more generic method. - /* - * (non-Javadoc) - * - * @see - * org.collectionspace.services.common.query.IQueryManager#execQuery(java - * .lang.String) - */ - @Override - @Deprecated - public void execQuery(String queryString) { - // Intentionally left blank - } - @Override public String createWhereClauseFromAdvancedSearch(String advancedSearch) { String result = null; @@ -105,14 +88,12 @@ public String createWhereClauseFromAdvancedSearch(String advancedSearch) { // Process search term. FIXME: REM - Do we need to perform any string filtering here? // if (advancedSearch != null && !advancedSearch.isEmpty()) { - // Filtering of advanced searches on a single '%' char, per CSPACE-5828 - Matcher regexMatcher = advSearchSqlWildcard.matcher(advancedSearch.trim()); - if (regexMatcher.matches()) { - return ""; - } - StringBuffer advancedSearchWhereClause = new StringBuffer( - advancedSearch); - result = advancedSearchWhereClause.toString(); + // Filtering of advanced searches on a single '%' char, per CSPACE-5828 + Matcher regexMatcher = advSearchSqlWildcard.matcher(advancedSearch.trim()); + if (regexMatcher.matches()) { + return ""; + } + result = advancedSearch; } return result; @@ -125,10 +106,10 @@ public String createWhereClauseFromAdvancedSearch(String advancedSearch) { * createWhereClauseFromKeywords(java.lang.String) */ @Override - public String createWhereClauseFromKeywords(String keywords) { - StringBuffer fullTextWhereClause = new StringBuffer(); + public String createWhereClauseFromKeywords(String keywords, boolean clean) { + StringBuilder fullTextWhereClause = new StringBuilder(); - String cleanKeywords = kwdSearchProblemChars.matcher(keywords).replaceAll(" ").trim(); + String cleanKeywords = clean ? kwdSearchProblemChars.matcher(keywords).replaceAll(" ").trim() : keywords; Matcher regexMatcher = kwdTokenizer.matcher(cleanKeywords); boolean addNOT = false; 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 bb3ee993fb..29bbffed6f 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 @@ -17,7 +17,7 @@ import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl; -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; @@ -118,7 +118,7 @@ public static void updateRefNamesInRelations( try { docModel.setProperty(IRelationsManager.SERVICE_COMMONPART_NAME, targetField, newRefName); repoSession.saveDocument(docModel); - } catch (ClientException e) { + } catch (NuxeoException e) { logger.error(String.format("Could not update field '%s' with updated refName '%s' for relations record CSID=%s", targetField, newRefName, docModel.getName())); } @@ -142,7 +142,7 @@ public static void updateRefNamesInRelations( // try { repoSession.save(); - } catch (ClientException e) { + } catch (NuxeoException e) { // TODO Auto-generated catch block logger.error("Could not flush results of relation-refName payload updates to Nuxeo repository"); } 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 5cce0ca2d9..fc1f734d0b 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 @@ -26,8 +26,6 @@ import java.util.Hashtable; import java.util.List; -import org.collectionspace.services.client.PoxPayloadIn; -import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.document.DocumentException; import org.collectionspace.services.common.document.DocumentHandler; @@ -41,7 +39,7 @@ // All of these Nuxeo specific classes should not be here. This is supposed to be // a repository-neutral interface. // -import org.nuxeo.ecm.core.api.ClientException; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; @@ -115,7 +113,7 @@ public DocumentWrapper getDocFromCsid(ServiceContext ctx, String csid) throws Exception; - public String getDocURI(DocumentWrapper wrappedDoc) throws ClientException; + public String getDocURI(DocumentWrapper wrappedDoc) throws NuxeoException; /** * Find wrapped documentModel from the Nuxeo repository diff --git a/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaRelationshipStorageClient.java b/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaRelationshipStorageClient.java index 63b0547c64..7491ff48a5 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaRelationshipStorageClient.java +++ b/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaRelationshipStorageClient.java @@ -95,7 +95,7 @@ public String create(ServiceContext ctx, DocumentWrapper> wrapDoc = new DocumentWrapperImpl>(relationshipList); handler.handle(Action.CREATE, wrapDoc); for (T relationship : relationshipList) { - JaxbUtils.setValue(relationship, "setCreatedAtItem", Date.class, new Date()); + JaxbUtils.setValue(relationship, "setCreatedAt", Date.class, new Date()); jpaTransactionContext.persist(relationship); } handler.complete(Action.CREATE, wrapDoc); diff --git a/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java b/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java index b963929a3b..6803d78cea 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageClientImpl.java @@ -117,7 +117,7 @@ public String create(ServiceContext ctx, jpaConnectionContext.beginTransaction(); try { handler.handle(Action.CREATE, wrapDoc); - JaxbUtils.setValue(entity, "setCreatedAtItem", Date.class, new Date()); + JaxbUtils.setValue(entity, "setCreatedAt", Date.class, new Date()); jpaConnectionContext.persist(entity); } catch (EntityExistsException ee) { // FIXME: No, don't allow duplicates // @@ -312,7 +312,7 @@ public void update(ServiceContext ctx, String id, DocumentHandler handler) Object entityFound = getEntity(ctx, id, entityReceived.getClass()); DocumentWrapper wrapDoc = new DocumentWrapperImpl(entityFound); handler.handle(Action.UPDATE, wrapDoc); - JaxbUtils.setValue(entityFound, "setUpdatedAtItem", Date.class, new Date()); + JaxbUtils.setValue(entityFound, "setUpdatedAt", Date.class, new Date()); handler.complete(Action.UPDATE, wrapDoc); jpaConnectionContext.commitTransaction(); diff --git a/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageUtils.java b/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageUtils.java index 111b4e69f2..1040751da6 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/common/storage/jpa/JpaStorageUtils.java @@ -23,18 +23,16 @@ */ package org.collectionspace.services.common.storage.jpa; -import java.util.List; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; - -import javax.persistence.PersistenceException; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; -import javax.persistence.EntityNotFoundException; import javax.persistence.NoResultException; import javax.persistence.Persistence; +import javax.persistence.PersistenceException; import javax.persistence.Query; import org.collectionspace.authentication.AuthN; @@ -50,13 +48,12 @@ import org.collectionspace.services.authorization.URIResourceImpl; import org.collectionspace.services.common.api.Tools; import org.collectionspace.services.common.authorization_mgt.AuthorizationRoleRel; -import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.document.DocumentFilter; import org.collectionspace.services.common.document.DocumentNotFoundException; -import org.collectionspace.services.common.security.UnauthorizedException; import org.collectionspace.services.common.document.JaxbUtils; import org.collectionspace.services.common.document.TransactionException; import org.collectionspace.services.common.security.SecurityUtils; +import org.collectionspace.services.common.security.UnauthorizedException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -64,7 +61,6 @@ * Utilities for JpaStorage * @author */ -@SuppressWarnings({"rawtypes", "unchecked"}) public class JpaStorageUtils { final private static Logger logger = LoggerFactory.getLogger(JpaStorageUtils.class); 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 5233aadf06..eaf1d9f00d 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 @@ -31,11 +31,11 @@ import javax.ws.rs.core.Response; -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.NuxeoException; import org.nuxeo.ecm.core.api.model.Property; -import org.nuxeo.ecm.core.api.model.PropertyException; +import org.nuxeo.ecm.core.api.PropertyException; import org.nuxeo.ecm.core.api.model.PropertyNotFoundException; import org.nuxeo.ecm.core.api.model.impl.primitives.StringProperty; import org.slf4j.Logger; @@ -48,7 +48,6 @@ import org.collectionspace.services.client.Profiler; import org.collectionspace.services.common.CSWebApplicationException; import org.collectionspace.services.common.ServiceMain; -import org.collectionspace.services.common.ServletTools; import org.collectionspace.services.common.StoredValuesUriTemplate; import org.collectionspace.services.common.UriTemplateFactory; import org.collectionspace.services.common.UriTemplateRegistry; @@ -85,20 +84,20 @@ */ public class RefNameServiceUtils { - public static enum SpecifierForm { + public enum SpecifierForm { CSID, URN_NAME // Either a CSID or a short ID - }; + } public static class Specifier { // // URN statics for things like urn:cspace:name(grover) // - final static String URN_PREFIX = "urn:cspace:"; - final static int URN_PREFIX_LEN = URN_PREFIX.length(); - final static String URN_PREFIX_NAME = "name("; - final static int URN_NAME_PREFIX_LEN = URN_PREFIX_LEN + URN_PREFIX_NAME.length(); - final static String URN_PREFIX_ID = "id("; - final static int URN_ID_PREFIX_LEN = URN_PREFIX_LEN + URN_PREFIX_ID.length(); + static final String URN_PREFIX = "urn:cspace:"; + static final int URN_PREFIX_LEN = URN_PREFIX.length(); + static final String URN_PREFIX_NAME = "name("; + static final int URN_NAME_PREFIX_LEN = URN_PREFIX_LEN + URN_PREFIX_NAME.length(); + static final String URN_PREFIX_ID = "id("; + static final int URN_ID_PREFIX_LEN = URN_PREFIX_LEN + URN_PREFIX_ID.length(); public SpecifierForm form; public String value; @@ -141,7 +140,7 @@ public static Specifier getSpecifier(String identifier, String method, String op identifier.substring(URN_ID_PREFIX_LEN, closeParen)); } } else { - logger.error(method + ": bad or missing specifier!"); + logger.error("{}: bad or missing specifier!", method); Response response = Response.status(Response.Status.BAD_REQUEST).entity( op + " failed on bad or missing Authority specifier").type( "text/plain").build(); @@ -380,7 +379,7 @@ public static void updateRefNamesInRelations( public static List getConfiguredAuthorityRefs(ServiceContext ctx) { List authRefFields = ((AbstractServiceContextImpl) ctx).getAllPartsPropertyValues( ServiceBindingUtils.AUTH_REF_PROP, ServiceBindingUtils.QUALIFIED_PROP_NAMES); - ArrayList authRefsInfo = new ArrayList(authRefFields.size()); + ArrayList authRefsInfo = new ArrayList<>(authRefFields.size()); for (String spec : authRefFields) { AuthRefConfigInfo arci = new AuthRefConfigInfo(spec); authRefsInfo.add(arci); @@ -406,8 +405,8 @@ public static AuthorityRefDocList getAuthorityRefDocs( List list = wrapperList.getAuthorityRefDocItem(); - Map queriedServiceBindings = new HashMap(); - Map> authRefFieldsByService = new HashMap>(); + Map queriedServiceBindings = new HashMap<>(); + Map> authRefFieldsByService = new HashMap<>(); NuxeoRepositoryClientImpl nuxeoRepoClient = (NuxeoRepositoryClientImpl) repoClient; try { @@ -486,7 +485,7 @@ public static AuthorityRefDocList getAuthorityRefDocs( private static ArrayList getRefNameServiceTypes() { if (refNameServiceTypes == null) { - refNameServiceTypes = new ArrayList(); + refNameServiceTypes = new ArrayList<>(); refNameServiceTypes.add(ServiceBindingUtils.SERVICE_TYPE_AUTHORITY); refNameServiceTypes.add(ServiceBindingUtils.SERVICE_TYPE_OBJECT); refNameServiceTypes.add(ServiceBindingUtils.SERVICE_TYPE_PROCEDURE); @@ -505,8 +504,8 @@ public static int updateAuthorityRefDocs( String oldRefName, String newRefName, String refPropName) throws Exception { - Map queriedServiceBindings = new HashMap(); - Map> authRefFieldsByService = new HashMap>(); + Map queriedServiceBindings = new HashMap<>(); + Map> authRefFieldsByService = new HashMap<>(); int docsScanned = 0; int nRefsFound = 0; @@ -546,7 +545,8 @@ public static int updateAuthorityRefDocs( break; } docsInCurrentPage = docList.size(); - logger.debug("updateAuthorityRefDocs: current page=" + currentPage + " documents included in page=" + docsInCurrentPage); + logger.debug("updateAuthorityRefDocs: current page={} documents included in page={}", currentPage, + docsInCurrentPage); if (docsInCurrentPage == 0) { logger.debug("updateAuthorityRefDocs: no more documents requiring refName updates could be found"); break; @@ -575,11 +575,13 @@ public static int updateAuthorityRefDocs( } } catch (Exception e) { - logger.error("Internal error updating the AuthorityRefDocs: " + e.getLocalizedMessage()); + logger.error("Internal error updating the AuthorityRefDocs: {}", e.getLocalizedMessage()); logger.debug(Tools.errorToString(e, true)); throw e; } - logger.debug("updateAuthorityRefDocs replaced a total of " + nRefsFound + " authority references, within as many as " + docsScanned + " scanned document(s)"); + logger.debug( + "updateAuthorityRefDocs replaced a total of {} authority references, within as many as {} scanned document(s)", + nRefsFound, docsScanned); return nRefsFound; } @@ -640,7 +642,7 @@ protected static DocumentModelList findAuthorityRefDocs( // Filter the list for current user rights servicebindings = SecurityUtils.getReadableServiceBindingsForCurrentUser(servicebindings); - ArrayList docTypes = new ArrayList(); + ArrayList docTypes = new ArrayList<>(); String query = computeWhereClauseForAuthorityRefDocs(refName, refPropName, docTypes, servicebindings, // REM - Side effect that docTypes, authRefFieldsByService, and queriedServiceBindings get set/change. Any others? queriedServiceBindings, authRefFieldsByService); @@ -669,7 +671,7 @@ protected static DocumentModelList findAuthorityRefDocs( return docList; } - private static final DocumentModelList findDocs( + private static DocumentModelList findDocs( RepositoryClient repoClient, ServiceContext ctx, CoreSessionInterface repoSession, @@ -753,7 +755,7 @@ private static String computeWhereClauseForAuthorityRefDocs( if (authRefFieldPaths.isEmpty()) { continue; } - ArrayList authRefsInfo = new ArrayList(); + ArrayList authRefsInfo = new ArrayList<>(); for (String spec : authRefFieldPaths) { AuthRefConfigInfo arci = new AuthRefConfigInfo(spec); authRefsInfo.add(arci); @@ -773,28 +775,27 @@ private static String computeWhereClauseForAuthorityRefDocs( // we compute actual matches. AuthorityTermInfo authTermInfo = RefNameUtils.parseAuthorityTermInfo(refName); - // Example refname: urn:cspace:pahma.cspace.berkeley.edu:personauthorities:name(person):item:name(ReneRichie1586477168934) - // Corresponding phrase: "urn cspace pahma cspace berkeley edu personauthorities name person item name ReneRichie1586477168934 - - String refnamePhrase = String.format("urn cspace %s %s name %s item name %s", - RefNameUtils.domainToPhrase(authTermInfo.inAuthority.domain), - authTermInfo.inAuthority.resource, - authTermInfo.inAuthority.name, - authTermInfo.name - ); - refnamePhrase = String.format("\"%s\"", refnamePhrase); // surround the phase in double quotes to indicate this is a NXQL phrase search + // As of Nuxeo LTS 2019, fulltext no longer has punctuation removed and as such when looking for authority + // references we want to provide a search string with the authority name, authority vocabulary name, and the + // short ID of the authority + // e.g. + // urn:cspace:pahma.cspace.berkeley.edu:personauthorities:name(person):item:name(ReneRichie1586477168934) + // becomes + // personauthorities person ReneRichie1586477168934 + // We also no longer need a phrase search because we would be required to retain punctuation + final var refnameQuery = authTermInfo.inAuthority.resource + + " " + authTermInfo.inAuthority.name + + " " + authTermInfo.name; - String whereClauseStr = QueryManager.createWhereClauseFromKeywords(refnamePhrase); + String whereClauseStr = QueryManager.createWhereClauseFromKeywords(refnameQuery, false); - if (logger.isTraceEnabled()) { - logger.trace("The 'where' clause to find refObjs is: ", refnamePhrase); - } + logger.trace("The 'where' clause to find refObjs is: {}", refnameQuery); return whereClauseStr; } // TODO there are multiple copies of this that should be put somewhere common. - protected static String getRefname(DocumentModel docModel) throws ClientException { + protected static String getRefname(DocumentModel docModel) throws NuxeoException { String result = (String)docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA, CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME); return result; @@ -903,7 +904,7 @@ private static long processRefObjsDocList( try { String itemRefName = getRefname(docModel); ilistItem.setRefName(itemRefName); - } catch (ClientException ce) { + } catch (NuxeoException ce) { throw new RuntimeException( "processRefObjsDocList: Problem fetching refName from item Object: " + ce.getLocalizedMessage()); @@ -913,7 +914,7 @@ private static long processRefObjsDocList( UriTemplateRegistryKey key = new UriTemplateRegistryKey(tenantId, docType); StoredValuesUriTemplate template = registry.get(key); if (template != null) { - Map additionalValues = new HashMap(); + Map additionalValues = new HashMap<>(); if (template.getUriTemplateType() == UriTemplateFactory.RESOURCE) { additionalValues.put(UriTemplateFactory.IDENTIFIER_VAR, csid); uri = template.buildUri(additionalValues); @@ -924,19 +925,20 @@ private static long processRefObjsDocList( additionalValues.put(UriTemplateFactory.ITEM_IDENTIFIER_VAR, csid); uri = template.buildUri(additionalValues); } catch (Exception e) { - logger.warn("Could not extract inAuthority property from authority item record: " + e.getMessage()); + logger.warn("Could not extract inAuthority property from authority item record: {}", + e.getMessage()); } } else if (template.getUriTemplateType() == UriTemplateFactory.CONTACT) { // FIXME: Generating contact sub-resource URIs requires additional work, // as a follow-on to CSPACE-5271 - ADR 2012-08-16 // Sets the default (empty string) value for uri, for now } else { - logger.warn("Unrecognized URI template type = " + template.getUriTemplateType()); + logger.warn("Unrecognized URI template type = {}", template.getUriTemplateType()); // Sets the default (empty string) value for uri } } else { // (if template == null) - logger.warn("Could not retrieve URI template from registry via tenant ID " - + tenantId + " and docType " + docType); + logger.warn("Could not retrieve URI template from registry via tenant ID {} and docType {}", + tenantId, docType); // Sets the default (empty string) value for uri } ilistItem.setUri(uri); @@ -944,7 +946,7 @@ private static long processRefObjsDocList( ilistItem.setWorkflowState(docModel.getCurrentLifeCycleState()); ilistItem.setUpdatedAt(NuxeoDocumentModelHandler.getUpdatedAtAsString(docModel)); } catch (Exception e) { - logger.error("Error getting core values for doc [" + csid + "]: " + e.getLocalizedMessage()); + logger.error("Error getting core values for doc [{}]: {}", csid, e.getLocalizedMessage()); } ilistItem.setDocType(docType); ilistItem.setDocNumber( @@ -960,7 +962,7 @@ private static long processRefObjsDocList( "getAuthorityRefDocs: internal logic error: can't fetch authRefFields for DocType."); } - ArrayList foundProps = new ArrayList(); + ArrayList foundProps = new ArrayList<>(); try { findAuthRefPropertiesInDoc(docModel, matchingAuthRefFields, refName, matchBaseOnly, foundProps); // REM - side effect that foundProps is set if(!foundProps.isEmpty()) { @@ -991,19 +993,15 @@ private static long processRefObjsDocList( :refName.equals(docRefName)) { // We found the self for an item foundSelf = true; - logger.trace("getAuthorityRefDocs: Result: " - + docType + " [" + NuxeoUtils.getCsid(docModel) - + "] appears to be self for: [" - + refName + "]"); + logger.trace("getAuthorityRefDocs: Result: {} [{}] appears to be self for: [{}]", docType, + NuxeoUtils.getCsid(docModel), refName); } else { nRefsFalsePositives++; - logger.trace("getAuthorityRefDocs: Result: " - + docType + " [" + NuxeoUtils.getCsid(docModel) - + "] does not reference [" - + refName + "]"); + logger.trace("getAuthorityRefDocs: Result: {} [{}] does not reference [{}]", docType, + NuxeoUtils.getCsid(docModel), refName); } } - } catch (ClientException ce) { + } catch (NuxeoException ce) { throw new RuntimeException( "getAuthorityRefDocs: Problem fetching values from repo: " + ce.getLocalizedMessage()); } @@ -1094,7 +1092,7 @@ public static List findAuthRefPropertiesInDoc( Property prop = docModel.getProperty(arci.pathEls[0]); findAuthRefPropertiesInProperty(authRefInfoList, prop, arci, 0, refNameToMatch, matchBaseOnly); } catch (Exception e) { - logger.error("Problem fetching property: " + arci.pathEls[0]); + logger.error("Problem fetching property: {}", arci.pathEls[0]); } } return authRefInfoList; @@ -1124,8 +1122,8 @@ private static List findAuthRefPropertiesInProperty( for (Property listItemProp : propList) { if (listItemProp instanceof StringProperty) { if (arci.pathEls.length - pathStartIndex != 1) { - logger.error("Configuration for authRefs does not match schema structure: " - + arci.pathEls.toString()); + logger.error("Configuration for authRefs does not match schema structure: {}", + arci.pathEls.toString()); break; } else { addARIifMatches(refNameToMatch, matchBaseOnly, arci, listItemProp, authRefInfoList); @@ -1136,8 +1134,8 @@ private static List findAuthRefPropertiesInProperty( findAuthRefPropertiesInProperty(authRefInfoList, listItemProp, arci, pathStartIndex + 2, refNameToMatch, matchBaseOnly); } else { - logger.error("Configuration for authRefs does not match schema structure: " - + arci.pathEls.toString()); + logger.error("Configuration for authRefs does not match schema structure: {}", + arci.pathEls.toString()); break; } } @@ -1149,13 +1147,11 @@ private static List findAuthRefPropertiesInProperty( findAuthRefPropertiesInProperty(authRefInfoList, localProp, arci, pathStartIndex, refNameToMatch, matchBaseOnly); } catch (PropertyNotFoundException pnfe) { - logger.error("Could not find property: [" + localPropName + "] in path: " - + arci.getFullPath()); + logger.error("Could not find property: [{}] in path: {}", localPropName, arci.getFullPath()); // Fall through - ari will be null and we will continue... } } else { - logger.error("Configuration for authRefs does not match schema structure: " - + arci.pathEls.toString()); + logger.error("Configuration for authRefs does not match schema structure: {}", arci.pathEls.toString()); } if (ari != null) { @@ -1181,12 +1177,12 @@ private static void addARIifMatches( :refNameToMatch.equals(value))) || ((refNameToMatch == null) && Tools.notBlank(value))) { // Found a match - logger.debug("Found a match on property: " + prop.getPath() + " with value: [" + value + "]"); + logger.debug("Found a match on property: {} with value: [{}]", prop.getXPath(), value); AuthRefInfo ari = new AuthRefInfo(arci, prop); authRefInfoList.add(ari); } } catch (PropertyException pe) { - logger.debug("PropertyException on: " + prop.getPath() + pe.getLocalizedMessage()); + logger.debug("PropertyException on: {}{}", prop.getXPath(), pe.getLocalizedMessage()); } } diff --git a/services/common/src/main/java/org/collectionspace/services/common/workflow/service/nuxeo/WorkflowDocumentModelHandler.java b/services/common/src/main/java/org/collectionspace/services/common/workflow/service/nuxeo/WorkflowDocumentModelHandler.java index 0842347f8a..bc76307873 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/workflow/service/nuxeo/WorkflowDocumentModelHandler.java +++ b/services/common/src/main/java/org/collectionspace/services/common/workflow/service/nuxeo/WorkflowDocumentModelHandler.java @@ -39,8 +39,8 @@ import org.collectionspace.services.nuxeo.client.java.NuxeoDocumentModelHandler; import org.collectionspace.services.nuxeo.client.java.DocumentModelHandler; import org.collectionspace.services.workflow.WorkflowCommon; -import org.nuxeo.ecm.core.api.ClientException; import org.nuxeo.ecm.core.api.DocumentModel; +import org.nuxeo.ecm.core.api.NuxeoException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -83,7 +83,7 @@ public void handleUpdate(DocumentWrapper wrapDoc) throws Exceptio } @Override - protected void handleRefNameChanges(ServiceContext ctx, DocumentModel docModel) throws ClientException { + protected void handleRefNameChanges(ServiceContext ctx, DocumentModel docModel) throws NuxeoException { // // We are intentionally overriding this method to do nothing since the Workflow resource is a meta-resource without a refname // @@ -172,8 +172,7 @@ public void fillAllParts(DocumentWrapper wrapDoc, Action action) String msg = "Unable to follow workflow transition to state = " + transitionToFollow; logger.error(msg, e); - ClientException ce = new ClientException("Unable to follow workflow transition: " + transitionToFollow); - throw ce; + throw new NuxeoException("Unable to follow workflow transition: " + transitionToFollow); } } diff --git a/services/common/src/main/java/org/collectionspace/services/common/xmljson/XmlToJsonFilter.java b/services/common/src/main/java/org/collectionspace/services/common/xmljson/XmlToJsonFilter.java index d415f0acc8..bb8edf7b17 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/xmljson/XmlToJsonFilter.java +++ b/services/common/src/main/java/org/collectionspace/services/common/xmljson/XmlToJsonFilter.java @@ -28,7 +28,6 @@ import org.apache.commons.io.IOUtils; import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.lang.NotImplementedException; -import org.apache.commons.lang3.StringUtils; /** *

@@ -77,7 +76,8 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha chain.doFilter(requestWrapper, responseWrapper); - if (StringUtils.equals(responseWrapper.getContentType(), MediaType.APPLICATION_XML)) { + final var contentType = response.getContentType(); + if (contentType != null && contentType.startsWith(MediaType.APPLICATION_XML)) { // Got an XML response. Translate it to JSON. response.setContentType(MediaType.APPLICATION_JSON); diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/handler/CSDocumentModelList.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/handler/CSDocumentModelList.java index 65e18063cd..c6bbc4ee51 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/handler/CSDocumentModelList.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/handler/CSDocumentModelList.java @@ -3,9 +3,9 @@ import java.util.ArrayList; import java.util.List; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; import org.collectionspace.services.client.PoxPayloadOut; import org.collectionspace.services.jaxb.AbstractCommonList; diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CommonList.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CommonList.java index b096964a91..db034c0eba 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CommonList.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CommonList.java @@ -37,10 +37,10 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlTransient; +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlTransient; /** * This class allows us to generically represent and marshall a set of list diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionInterface.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionInterface.java index 1c45a4805a..c3243ff5b2 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionInterface.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionInterface.java @@ -3,13 +3,13 @@ import java.security.Principal; import org.collectionspace.services.common.document.DocumentException; -import org.nuxeo.ecm.core.api.ClientException; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; import org.nuxeo.ecm.core.api.DocumentRef; import org.nuxeo.ecm.core.api.Filter; import org.nuxeo.ecm.core.api.IterableQueryResult; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.event.DocumentEventTypes; import org.nuxeo.ecm.core.api.impl.LifeCycleFilter; @@ -25,10 +25,10 @@ public interface CoreSessionInterface { * Gets the root document of this repository. * * @return the root document. cannot be null - * @throws ClientException + * @throws NuxeoException * @throws SecurityException */ - public DocumentModel getRootDocument() throws ClientException; + public DocumentModel getRootDocument() throws NuxeoException; /** * Gets the current session id. @@ -60,12 +60,12 @@ public interface CoreSessionInterface { public Principal getPrincipal(); public IterableQueryResult queryAndFetch(String query, String queryType, - Object... params) throws ClientException, DocumentException; + Object... params) throws NuxeoException, DocumentException; public DocumentModelList query(String query, Filter filter, long limit, - long offset, boolean countTotal) throws ClientException, DocumentException; + long offset, boolean countTotal) throws NuxeoException, DocumentException; - public DocumentModelList query(String query) throws ClientException, DocumentException; + public DocumentModelList query(String query) throws NuxeoException, DocumentException; /** * Executes the given NXQL query an returns the result. @@ -73,10 +73,10 @@ public DocumentModelList query(String query, Filter filter, long limit, * @param query the query to execute * @param max number of document to retrieve * @return the query result - * @throws ClientException + * @throws NuxeoException * @throws DocumentException */ - public DocumentModelList query(String query, int max) throws ClientException, DocumentException; + public DocumentModelList query(String query, int max) throws NuxeoException, DocumentException; /** * Executes the given NXQL query and returns the result that matches the @@ -86,7 +86,7 @@ public DocumentModelList query(String query, Filter filter, long limit, * @param filter the filter to apply to result * @return the query result * @throws DocumentException - * @throws ClientException + * @throws NuxeoException */ public DocumentModelList query(String query, LifeCycleFilter workflowStateFilter) throws DocumentException; @@ -101,30 +101,30 @@ public DocumentModelList query(String query, Filter filter, long limit, * * @param docRef the document reference * @return the document - * @throws ClientException + * @throws NuxeoException * @throws SecurityException */ - public DocumentModel getDocument(DocumentRef docRef) throws ClientException; + public DocumentModel getDocument(DocumentRef docRef) throws NuxeoException; - public DocumentModel saveDocument(DocumentModel docModel) throws ClientException; + public DocumentModel saveDocument(DocumentModel docModel) throws NuxeoException; - public void save() throws ClientException; + public void save() throws NuxeoException; /** * Bulk document saving. * * @param docModels the document models that needs to be saved - * @throws ClientException + * @throws NuxeoException */ - public void saveDocuments(DocumentModel[] docModels) throws ClientException; + public void saveDocuments(DocumentModel[] docModels) throws NuxeoException; /** * Removes this document and all its children, if any. * * @param docRef the reference to the document to remove - * @throws ClientException + * @throws NuxeoException */ - public void removeDocument(DocumentRef docRef) throws ClientException; + public void removeDocument(DocumentRef docRef) throws NuxeoException; /** * Creates a document model using required information. @@ -139,10 +139,10 @@ public DocumentModelList query(String query, Filter filter, long limit, * @param id * @param typeName * @return the initial document model - * @throws ClientException + * @throws NuxeoException */ public DocumentModel createDocumentModel(String parentPath, String id, - String typeName) throws ClientException; + String typeName) throws NuxeoException; /** * Creates a document using given document model for initialization. @@ -153,9 +153,9 @@ public DocumentModel createDocumentModel(String parentPath, String id, * * @param model the document model to use for initialization * @return the created document - * @throws ClientException + * @throws NuxeoException */ - public DocumentModel createDocument(DocumentModel model) throws ClientException; + public DocumentModel createDocument(DocumentModel model) throws NuxeoException; /** * Gets the children of the given parent. @@ -163,9 +163,9 @@ public DocumentModel createDocumentModel(String parentPath, String id, * @param parent the parent reference * @return the children if any, an empty list if no children or null if the * specified parent document is not a folder - * @throws ClientException + * @throws NuxeoException */ - public DocumentModelList getChildren(DocumentRef parent) throws ClientException; + public DocumentModelList getChildren(DocumentRef parent) throws NuxeoException; } diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionWrapper.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionWrapper.java index 14459dfdf0..953e9ed5ca 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionWrapper.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionWrapper.java @@ -14,12 +14,12 @@ import java.util.regex.Pattern; import org.collectionspace.services.common.document.DocumentException; -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.DocumentRef; import org.nuxeo.ecm.core.api.Filter; import org.nuxeo.ecm.core.api.IterableQueryResult; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.event.DocumentEventTypes; import org.nuxeo.ecm.core.api.impl.LifeCycleFilter; import org.nuxeo.ecm.core.api.CoreSession; @@ -96,11 +96,11 @@ public void close() throws Exception { * Gets the root document of this repository. * * @return the root document. cannot be null - * @throws ClientException + * @throws NuxeoException * @throws SecurityException */ @Override - public DocumentModel getRootDocument() throws ClientException { + public DocumentModel getRootDocument() throws NuxeoException { return repoSession.getRootDocument(); } @@ -171,7 +171,7 @@ private String localizeTimestamps(String query) throws DocumentException { @Override public IterableQueryResult queryAndFetch(String query, String queryType, - Object... params) throws ClientException, DocumentException { + Object... params) throws NuxeoException, DocumentException { query = localizeTimestamps(query); logQuery(query, queryType); return repoSession.queryAndFetch(query, queryType, params); @@ -179,21 +179,21 @@ public IterableQueryResult queryAndFetch(String query, String queryType, @Override public DocumentModelList query(String query, Filter filter, long limit, - long offset, boolean countTotal) throws ClientException, DocumentException { + long offset, boolean countTotal) throws NuxeoException, DocumentException { query = localizeTimestamps(query); logQuery(query, filter, limit, offset, countTotal); return repoSession.query(query, filter, limit, offset, countTotal); } @Override - public DocumentModelList query(String query, int max) throws ClientException, DocumentException { + public DocumentModelList query(String query, int max) throws NuxeoException, DocumentException { query = localizeTimestamps(query); logQuery(query); return repoSession.query(query, max); } @Override - public DocumentModelList query(String query) throws ClientException, DocumentException { + public DocumentModelList query(String query) throws NuxeoException, DocumentException { query = localizeTimestamps(query); logQuery(query); return repoSession.query(query); @@ -216,16 +216,16 @@ public DocumentModelList query(String query, LifeCycleFilter workflowStateFilter * * @param docRef the document reference * @return the document - * @throws ClientException + * @throws NuxeoException * @throws SecurityException */ @Override - public DocumentModel getDocument(DocumentRef docRef) throws ClientException { + public DocumentModel getDocument(DocumentRef docRef) throws NuxeoException { return repoSession.getDocument(docRef); } @Override - public DocumentModel saveDocument(DocumentModel docModel) throws ClientException { + public DocumentModel saveDocument(DocumentModel docModel) throws NuxeoException { DocumentModel result = null; try { @@ -244,7 +244,7 @@ public DocumentModel saveDocument(DocumentModel docModel) throws ClientException } @Override - public void save() throws ClientException { + public void save() throws NuxeoException { try { if (isTransactionMarkedForRollbackOnly() == false) { repoSession.save(); @@ -262,10 +262,10 @@ public void save() throws ClientException { * Bulk document saving. * * @param docModels the document models that needs to be saved - * @throws ClientException + * @throws NuxeoException */ @Override - public void saveDocuments(DocumentModel[] docModels) throws ClientException { + public void saveDocuments(DocumentModel[] docModels) throws NuxeoException { try { if (isTransactionMarkedForRollbackOnly() == false) { repoSession.saveDocuments(docModels); @@ -283,10 +283,10 @@ public void saveDocuments(DocumentModel[] docModels) throws ClientException { * Removes this document and all its children, if any. * * @param docRef the reference to the document to remove - * @throws ClientException + * @throws NuxeoException */ @Override - public void removeDocument(DocumentRef docRef) throws ClientException { + public void removeDocument(DocumentRef docRef) throws NuxeoException { repoSession.removeDocument(docRef); } @@ -303,11 +303,11 @@ public void removeDocument(DocumentRef docRef) throws ClientException { * @param id * @param typeName * @return the initial document model - * @throws ClientException + * @throws NuxeoException */ @Override public DocumentModel createDocumentModel(String parentPath, String id, - String typeName) throws ClientException { + String typeName) throws NuxeoException { return repoSession.createDocumentModel(parentPath, id, typeName); } @@ -320,10 +320,10 @@ public DocumentModel createDocumentModel(String parentPath, String id, * * @param model the document model to use for initialization * @return the created document - * @throws ClientException + * @throws NuxeoException */ @Override - public DocumentModel createDocument(DocumentModel model) throws ClientException { + public DocumentModel createDocument(DocumentModel model) throws NuxeoException { return repoSession.createDocument(model); } @@ -333,10 +333,10 @@ public DocumentModel createDocument(DocumentModel model) throws ClientException * @param parent the parent reference * @return the children if any, an empty list if no children or null if the * specified parent document is not a folder - * @throws ClientException + * @throws NuxeoException */ @Override - public DocumentModelList getChildren(DocumentRef parent) throws ClientException { + public DocumentModelList getChildren(DocumentRef parent) throws NuxeoException { return repoSession.getChildren(parent); } 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 828260d44a..083a28250a 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 @@ -54,10 +54,10 @@ import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.AuthRefConfigInfo; import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier; import org.collectionspace.services.lifecycle.Lifecycle; -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.api.NuxeoException; +import org.nuxeo.ecm.core.api.PropertyException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -264,7 +264,7 @@ protected RefName.RefNameInterface getRefName(DocumentWrapper doc } private void handleCoreValues(DocumentWrapper docWrapper, - Action action) throws ClientException { + Action action) throws NuxeoException { DocumentModel documentModel = docWrapper.getWrappedObject(); String now = GregorianCalendarDateTimeUtils.timestampUTC(); ServiceContext ctx = getServiceContext(); @@ -352,7 +352,7 @@ protected boolean hasRefNameUpdate() { return result; } - protected void handleRefNameChanges(ServiceContext ctx, DocumentModel docModel) throws ClientException { + protected void handleRefNameChanges(ServiceContext ctx, DocumentModel docModel) throws NuxeoException { // First get the old refName this.oldRefNameOnUpdate = (String)docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA, CollectionSpaceClient.COLLECTIONSPACE_CORE_REFNAME); diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoClientEmbedded.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoClientEmbedded.java index 559e3ccf49..38b05736c6 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoClientEmbedded.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoClientEmbedded.java @@ -23,24 +23,20 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map.Entry; -import java.security.Principal; +import javax.transaction.TransactionManager; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.repository.RepositoryInstanceWrapperAdvice; import org.collectionspace.services.config.tenant.RepositoryDomainType; -import org.nuxeo.ecm.core.api.repository.Repository; import org.nuxeo.ecm.core.api.CoreInstance; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.NuxeoPrincipal; import org.nuxeo.ecm.core.api.SystemPrincipal; +import org.nuxeo.ecm.core.api.repository.Repository; import org.nuxeo.ecm.core.api.repository.RepositoryManager; import org.nuxeo.runtime.api.Framework; import org.nuxeo.runtime.jtajca.NuxeoContainer; import org.nuxeo.runtime.transaction.TransactionHelper; - -import javax.transaction.TransactionManager; -import javax.transaction.UserTransaction; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.aop.framework.ProxyFactory; @@ -278,9 +274,8 @@ private CoreSessionInterface getAOPProxy(CoreSession repositoryInstance) { return result; } - private Principal getSystemPrincipal() { - NuxeoPrincipal principal = new SystemPrincipal(null); - return principal; + private NuxeoPrincipal getSystemPrincipal() { + return new SystemPrincipal(null); } /* @@ -291,31 +286,30 @@ private Principal getSystemPrincipal() { */ private CoreSessionInterface getCoreSessionWrapper(Repository repository) { CoreSessionInterface result = null; - + CoreSession coreSession = null; try { - coreSession = CoreInstance.openCoreSession(repository.getName(), getSystemPrincipal()); // A Nuxeo repo instance handler proxy + // A Nuxeo repo instance handler proxy + coreSession = CoreInstance.getCoreSession(repository.getName(), getSystemPrincipal()); } catch (Exception e) { - logger.warn(String.format("Could not open a session to the '%s' repository. The current request to the CollectionSpace services API will fail.", - repository != null ? repository.getName() : "not specified"), e); + logger.warn( + "Could not open a session to the '{}' repository. The current request to the CollectionSpace services API will fail.", + repository != null ? repository.getName() : "not specified", e); } - + if (coreSession != null) { result = this.getAOPProxy(coreSession); // This is our AOP proxy if (result != null) { String key = result.getSessionId(); repositoryInstances.put(key, result); } else { - // - // Since we couldn't get an AOP proxy, we need to close the core session. - // - CoreInstance.closeCoreSession(coreSession); - String errMsg = String.format("Could not instantiate a Spring AOP proxy for class '%s'.", - CoreSessionWrapper.class.getName()); - logger.error(errMsg); + // This is now a no-op and probably isn't necessary + coreSession.close(); + logger.error("Could not instantiate a Spring AOP proxy for class '{}'.", + CoreSessionWrapper.class.getName()); } } - + return result; } diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoConnectorEmbedded.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoConnectorEmbedded.java index 0fca95e1c8..61f41379ef 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoConnectorEmbedded.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoConnectorEmbedded.java @@ -139,13 +139,13 @@ private void startNuxeoEP(String serverRootPath) throws Exception { try { Repository defaultRepo = Framework.getService(RepositoryManager.class).getDefaultRepository(); - coreSession = CoreInstance.openCoreSession(defaultRepo.getName(), new SystemPrincipal(null)); + coreSession = CoreInstance.getCoreSession(defaultRepo.getName(), new SystemPrincipal(null)); } catch (Throwable t) { logger.error(t.getMessage()); throw new RuntimeException("Could not start the Nuxeo EP Framework", t); } finally { if (coreSession != null) { - CoreInstance.closeCoreSession(coreSession); + coreSession.close(); } if (transactionStarted) { diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentException.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentException.java index 1ed3cfe00d..b96b95ce51 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentException.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoDocumentException.java @@ -5,7 +5,6 @@ import org.apache.http.HttpStatus; import org.nuxeo.ecm.core.api.ConcurrentUpdateException; -import org.nuxeo.ecm.core.api.WrappedException; public class NuxeoDocumentException extends DocumentException { @@ -50,11 +49,8 @@ private static String getExceptionClassName(Throwable exception) { if (exception != null) { result = exception.getClass().getCanonicalName(); - if (exception instanceof WrappedException) { - result = ((WrappedException)exception).getClassName(); // Nuxeo wraps the original exception, so we need to get the name of it. - } } - + return result; } diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoRepositoryClientImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoRepositoryClientImpl.java index 537cba57ae..a9cf5d8233 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoRepositoryClientImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/NuxeoRepositoryClientImpl.java @@ -28,17 +28,13 @@ import java.util.Map; import java.util.Set; import java.util.UUID; - import javax.sql.rowset.CachedRowSet; import javax.ws.rs.core.MultivaluedMap; -// -// CSPACE-5036 - How to make CMISQL queries from Nuxeo -// 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.apache.chemistry.opencmis.server.shared.TempStoreOutputStreamFactory; import org.collectionspace.services.client.CollectionSpaceClient; import org.collectionspace.services.client.IQueryManager; import org.collectionspace.services.client.PoxPayloadIn; @@ -75,12 +71,12 @@ import org.collectionspace.services.nuxeo.util.CSReindexFulltextRoot; import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.nuxeo.common.utils.IdUtils; -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.DocumentRef; import org.nuxeo.ecm.core.api.IdRef; import org.nuxeo.ecm.core.api.IterableQueryResult; +import org.nuxeo.ecm.core.api.NuxeoException; import org.nuxeo.ecm.core.api.PathRef; import org.nuxeo.ecm.core.api.VersioningOption; import org.nuxeo.ecm.core.api.impl.DocumentModelListImpl; @@ -104,12 +100,8 @@ */ public class NuxeoRepositoryClientImpl implements RepositoryClient { - /** - * The logger. - */ private final Logger logger = LoggerFactory.getLogger(NuxeoRepositoryClientImpl.class); -// private final Logger profilerLogger = LoggerFactory.getLogger("remperf"); -// private String foo = Profiler.createLogger(); + public static final String NUXEO_CORE_TYPE_DOMAIN = "Domain"; public static final String NUXEO_CORE_TYPE_WORKSPACEROOT = "WorkspaceRoot"; // FIXME: Get this value from an existing constant, if available @@ -129,7 +121,8 @@ public NuxeoRepositoryClientImpl() { //Empty constructor } - public void assertWorkflowState(ServiceContext ctx, DocumentModel docModel) throws DocumentNotFoundException, ClientException { + public void assertWorkflowState(ServiceContext ctx, DocumentModel docModel) throws DocumentNotFoundException, + NuxeoException { MultivaluedMap queryParams = ctx.getQueryParams(); if (queryParams != null) { // @@ -389,7 +382,7 @@ private boolean reindexElasticsearch(DocumentHandler handler, String csid, Strin @Override public boolean synchronize(ServiceContext ctx, Object specifier, DocumentHandler handler) - throws DocumentNotFoundException, TransactionException, DocumentException { + throws DocumentNotFoundException, DocumentException { boolean result = false; if (handler == null) { @@ -592,7 +585,7 @@ public void get(ServiceContext ctx, DocumentHandler handler) public DocumentWrapper getDoc( CoreSessionInterface repoSession, ServiceContext ctx, - String csid) throws DocumentNotFoundException, DocumentException { + String csid) throws DocumentNotFoundException { DocumentWrapper wrapDoc = null; try { @@ -600,15 +593,15 @@ public DocumentWrapper getDoc( DocumentModel doc = null; try { doc = repoSession.getDocument(docRef); - } catch (ClientException ce) { + } catch (NuxeoException ce) { String msg = logException(ce, "Could not find document with CSID=" + csid); throw new DocumentNotFoundException(msg, ce); } wrapDoc = new DocumentWrapperImpl(doc); } catch (IllegalArgumentException iae) { throw iae; - } catch (DocumentException de) { - throw de; + } catch (NuxeoException ne) { + throw ne; } return wrapDoc; @@ -1185,11 +1178,11 @@ public DocumentWrapper getDocFromCsid(ServiceContext wrappedDoc) throws ClientException { + public String getDocURI(DocumentWrapper wrappedDoc) throws NuxeoException { DocumentModel docModel = wrappedDoc.getWrappedObject(); String uri = (String) docModel.getProperty(CollectionSpaceClient.COLLECTIONSPACE_CORE_SCHEMA, CollectionSpaceClient.COLLECTIONSPACE_CORE_URI); @@ -1208,7 +1201,7 @@ private IterableQueryResult makeCMISQLQuery(CoreSessionInterface repoSession, St logger.debug(String.format("Performing a CMIS query on Nuxeo repository named %s", repoSession.getRepositoryName())); - ThresholdOutputStreamFactory streamFactory = ThresholdOutputStreamFactory.newInstance( + TempStoreOutputStreamFactory streamFactory = TempStoreOutputStreamFactory.newInstance( null, THRESHOLD, -1, false); CallContextImpl callContext = new CallContextImpl( CallContext.BINDING_LOCAL, @@ -1223,7 +1216,7 @@ private IterableQueryResult makeCMISQLQuery(CoreSessionInterface repoSession, St NuxeoCmisService cmisService = new NuxeoCmisService(repoSession.getCoreSession()); result = repoSession.queryAndFetch(query, "CMISQL", cmisService); - } catch (ClientException e) { + } catch (NuxeoException e) { // TODO Auto-generated catch block logger.error("Encounter trouble making the following CMIS query: " + query, e); throw new NuxeoDocumentException(e); @@ -1300,7 +1293,7 @@ public void getFiltered(ServiceContext ctx, DocumentHandler handler) throw de; } catch (Exception e) { if (logger.isDebugEnabled()) { - logger.debug("Caught exception ", e); // REM - 1/17/2014: Check for org.nuxeo.ecm.core.api.ClientException and re-attempt + logger.debug("Caught exception ", e); // REM - 1/17/2014: Check for org.nuxeo.ecm.core.api.NuxeoException and re-attempt } throw new NuxeoDocumentException(e); } finally { @@ -1791,7 +1784,7 @@ public void update(ServiceContext ctx, String csid, DocumentHandler handler) * @param docModel the document to save * @param fSaveSession if TRUE, will call CoreSessionInterface.save() to save * accumulated changes. - * @throws ClientException + * @throws NuxeoException * @throws DocumentException */ @Deprecated @@ -1800,14 +1793,14 @@ public void saveDocWithoutHandlerProcessing( CoreSessionInterface repoSession, DocumentModel docModel, boolean fSaveSession) - throws ClientException, DocumentException { + throws NuxeoException, DocumentException { try { repoSession.saveDocument(docModel); if (fSaveSession) { repoSession.save(); } - } catch (ClientException ce) { + } catch (NuxeoException ce) { throw ce; } catch (Exception e) { if (logger.isDebugEnabled()) { @@ -1825,7 +1818,7 @@ public void saveDocWithoutHandlerProcessing( * @param docModelList a list of document models * @param fSaveSession if TRUE, will call CoreSessionInterface.save() to save * accumulated changes. - * @throws ClientException + * @throws NuxeoException * @throws DocumentException */ public void saveDocListWithoutHandlerProcessing( @@ -1833,14 +1826,14 @@ public void saveDocListWithoutHandlerProcessing( CoreSessionInterface repoSession, DocumentModelList docList, boolean fSaveSession) - throws ClientException, DocumentException { + throws NuxeoException, DocumentException { try { DocumentModel[] docModelArray = new DocumentModel[docList.size()]; repoSession.saveDocuments(docList.toArray(docModelArray)); if (fSaveSession) { repoSession.save(); } - } catch (ClientException ce) { + } catch (NuxeoException ce) { throw ce; } catch (Exception e) { logger.error("Caught exception ", e); @@ -2084,7 +2077,7 @@ private DocumentModel getWorkspacesRoot(CoreSessionInterface repoSession, } if (result == null) { - throw new ClientException("Could not find workspace root directory in: " + throw new NuxeoException("Could not find workspace root directory in: " + domainPath); } @@ -2283,9 +2276,7 @@ public void releaseRepositorySession(ServiceContext @Override public void doWorkflowTransition(ServiceContext ctx, String id, - DocumentHandler handler, TransitionDef transitionDef) - throws BadRequestException, DocumentNotFoundException, - DocumentException { + DocumentHandler handler, TransitionDef transitionDef) { // This is a placeholder for when we change the StorageClient interface to treat workflow transitions as 1st class operations like 'get', 'create', 'update, 'delete', etc } @@ -2399,7 +2390,7 @@ private void rollbackTransaction(CoreSessionInterface repoSession) { */ @Override public boolean delete(ServiceContext ctx, Object entityFound, DocumentHandler handler) - throws DocumentNotFoundException, DocumentException { + throws DocumentException { throw new UnsupportedOperationException(); } } diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/ObjectFactory.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/ObjectFactory.java index ec1d553bae..3d35a61674 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/ObjectFactory.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/ObjectFactory.java @@ -23,7 +23,7 @@ */ package org.collectionspace.services.nuxeo.client.java; -import javax.xml.bind.annotation.XmlRegistry; +import jakarta.xml.bind.annotation.XmlRegistry; /** * ObjectFactory for CommonList 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 eb6b0158ca..b1f961c8c7 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 @@ -37,7 +37,7 @@ import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; -import javax.xml.bind.JAXBElement; +import jakarta.xml.bind.JAXBElement; import org.collectionspace.authentication.AuthN; import org.collectionspace.services.authorization.AccountPermission; @@ -91,7 +91,7 @@ import org.nuxeo.ecm.core.api.impl.DataModelImpl; import org.nuxeo.ecm.core.api.model.DocumentPart; import org.nuxeo.ecm.core.api.model.Property; -import org.nuxeo.ecm.core.api.model.PropertyException; +import org.nuxeo.ecm.core.api.PropertyException; import org.nuxeo.ecm.core.api.model.impl.ScalarProperty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -251,7 +251,7 @@ public boolean handleDelete(DocumentWrapper wrapDoc) throws Excep public void completeUpdate(DocumentWrapper wrapDoc) throws Exception { DocumentModel docModel = wrapDoc.getWrappedObject(); - String[] schemas = docModel.getDeclaredSchemas(); + String[] schemas = docModel.getSchemas(); Map partsMetaMap = getServiceContext().getPartsMetadata(); for (String schema : schemas) { ObjectPartType partMeta = partsMetaMap.get(schema); @@ -353,7 +353,7 @@ public void extractAllParts(DocumentWrapper wrapDoc) throws Exception { DocumentModel docModel = wrapDoc.getWrappedObject(); - String[] schemas = docModel.getDeclaredSchemas(); + String[] schemas = docModel.getSchemas(); Map partsMetaMap = getServiceContext().getPartsMetadata(); for (String schema : schemas) { ObjectPartType partMeta = partsMetaMap.get(schema); @@ -404,7 +404,7 @@ private void addExtraCoreValues(DocumentModel docModel, Map unQO private void addAccountPermissionsPart() throws Exception { Profiler profiler = new Profiler("addAccountPermissionsPart():", 1); profiler.start(); - + MultipartServiceContext ctx = (MultipartServiceContext) getServiceContext(); String currentServiceName = ctx.getServiceName(); String workflowSubResource = "/"; @@ -417,12 +417,9 @@ private void addAccountPermissionsPart() throws Exception { } AccountPermission accountPermission = JpaStorageUtils.getAccountPermissions(JpaStorageUtils.CS_CURRENT_USER, currentServiceName, workflowSubResource); - org.collectionspace.services.authorization.ObjectFactory objectFactory = - new org.collectionspace.services.authorization.ObjectFactory(); - JAXBElement ap = objectFactory.createAccountPermission(accountPermission); - PayloadOutputPart accountPermissionPart = new PayloadOutputPart("account_permission", ap); // REM - "account_permission" should be using a constant and not a literal + PayloadOutputPart accountPermissionPart = new PayloadOutputPart("account_permission", accountPermission); ctx.addOutputPart(accountPermissionPart); - + profiler.stop(); } @@ -768,9 +765,8 @@ public AuthorityRefList getAuthorityRefs( return authRefList; } - private boolean appendToAuthRefsList(RefNameServiceUtils.AuthRefInfo ari, - List list) - throws Exception { + private boolean appendToAuthRefsList(RefNameServiceUtils.AuthRefInfo ari, + List list) { String fieldName = ari.getQualifiedDisplayName(); try { String refNameValue = (String)ari.getProperty().getValue(); @@ -780,12 +776,7 @@ private boolean appendToAuthRefsList(RefNameServiceUtils.AuthRefInfo ari, return true; } } catch(PropertyException pe) { - String msg = "PropertyException on: "+ari.getProperty().getPath()+pe.getLocalizedMessage(); - if (logger.isDebugEnabled()) { - logger.debug(msg, pe); - } else { - logger.error(msg); - } + logger.error("PropertyException on: {} {}", ari.getProperty().getXPath(), pe.getLocalizedMessage(), pe); } return false; } diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/package-info.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/package-info.java index 648de4f715..5b29334bd0 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/package-info.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/package-info.java @@ -1,3 +1,3 @@ // We make the CommonList act like an AbstractCommonList, by setting its namespace -@javax.xml.bind.annotation.XmlSchema(namespace = "http://collectionspace.org/services/jaxb") +@jakarta.xml.bind.annotation.XmlSchema(namespace = "http://collectionspace.org/services/jaxb") package org.collectionspace.services.nuxeo.client.java; diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/listener/AbstractCSEventListenerImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/listener/AbstractCSEventListenerImpl.java index 3d7ad65e30..0d326769ab 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/listener/AbstractCSEventListenerImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/listener/AbstractCSEventListenerImpl.java @@ -14,8 +14,6 @@ import org.collectionspace.services.config.tenant.Param; import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; import org.collectionspace.services.nuxeo.util.NuxeoUtils; -import org.nuxeo.common.collections.ScopeType; -import org.nuxeo.common.collections.ScopedMap; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; import org.nuxeo.ecm.core.event.Event; @@ -23,9 +21,9 @@ import org.nuxeo.ecm.core.event.impl.DocumentEventContext; public abstract class AbstractCSEventListenerImpl implements CSEventListener { - private static Map> mapOfrepositoryNames = new HashMap>(); // - private static Map>> eventListenerParamsMap = new HashMap>>(); // >> - private static Map nameMap = new HashMap(); + private static Map> mapOfrepositoryNames = new HashMap<>(); // + private static Map>> eventListenerParamsMap = new HashMap<>(); // >> + private static Map nameMap = new HashMap<>(); // SQL clauses private final static String NONVERSIONED_NONPROXY_DOCUMENT_WHERE_CLAUSE_FRAGMENT = @@ -34,7 +32,7 @@ public abstract class AbstractCSEventListenerImpl implements CSEventListener { protected final static String ACTIVE_DOCUMENT_WHERE_CLAUSE_FRAGMENT = "AND (ecm:currentLifeCycleState <> 'deleted') " + NONVERSIONED_NONPROXY_DOCUMENT_WHERE_CLAUSE_FRAGMENT; - static final String DOCMODEL_CONTEXT_PROPERTY_PREFIX = ScopeType.DEFAULT.getScopePrefix(); + private static final String DOCMODEL_CONTEXT_PROPERTY_PREFIX = "default/"; private String currentRepositoryName; public AbstractCSEventListenerImpl() { @@ -228,8 +226,8 @@ protected Serializable getContextPropertyValue(DocumentEventContext docEventCont // @Override public void setDocModelContextProperty(DocumentModel collectionObjectDocModel, String key, Serializable value) { - ScopedMap contextData = collectionObjectDocModel.getContextData(); - contextData.putIfAbsent(DOCMODEL_CONTEXT_PROPERTY_PREFIX + key, value); + Map contextData = collectionObjectDocModel.getContextData(); + contextData.putIfAbsent(DOCMODEL_CONTEXT_PROPERTY_PREFIX + key, value); } // @@ -237,8 +235,8 @@ public void setDocModelContextProperty(DocumentModel collectionObjectDocModel, S // @Override public void clearDocModelContextProperty(DocumentModel docModel, String key) { - ScopedMap contextData = docModel.getContextData(); - contextData.remove(DOCMODEL_CONTEXT_PROPERTY_PREFIX + key); + Map contextData = docModel.getContextData(); + contextData.remove(DOCMODEL_CONTEXT_PROPERTY_PREFIX + key); } // diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java index e036d7f41f..727160e060 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/util/NuxeoUtils.java @@ -50,7 +50,6 @@ import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.AuthorityItemSpecifier; import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.Specifier; import org.collectionspace.services.common.vocabulary.RefNameServiceUtils.SpecifierForm; -import org.collectionspace.services.config.tenant.RepositoryDomainType; import org.collectionspace.services.lifecycle.Lifecycle; import org.collectionspace.services.lifecycle.State; import org.collectionspace.services.lifecycle.StateList; @@ -66,7 +65,6 @@ import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.DocumentModelList; import org.nuxeo.ecm.core.api.Blob; -import org.nuxeo.ecm.core.api.ClientException; import org.nuxeo.ecm.core.api.CoreSession; import org.nuxeo.ecm.core.api.DocumentRef; import org.nuxeo.ecm.core.api.IdRef; @@ -493,7 +491,7 @@ public static Document getDocument(CoreSessionInterface repoSession, String csid * * @throws DocumentException the document exception * @throws IOException Signals that an I/O exception has occurred. - * @throws ClientException the client exception + * @throws NuxeoException the client exception */ public static DocumentModel getWorkspaceModel( CoreSessionInterface repoSession, String workspaceName) @@ -955,7 +953,7 @@ public static String prepareStringLiteral(String s) { } public static boolean documentExists(CoreSessionInterface repoSession, - String csid) throws ClientException, DocumentException { + String csid) throws NuxeoException, DocumentException { boolean result = false; String statement = String.format( diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/util/ReindexFulltextRoot.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/util/ReindexFulltextRoot.java index 2458da6089..eb86ceae9c 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/util/ReindexFulltextRoot.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/util/ReindexFulltextRoot.java @@ -44,15 +44,15 @@ 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.api.repository.FulltextConfiguration; import org.nuxeo.ecm.core.event.EventService; import org.nuxeo.ecm.core.query.QueryFilter; import org.nuxeo.ecm.core.query.sql.NXQL; -import org.nuxeo.ecm.core.storage.FulltextConfiguration; +import org.nuxeo.ecm.core.storage.FulltextExtractorWork; import org.nuxeo.ecm.core.storage.sql.Model; import org.nuxeo.ecm.core.storage.sql.Node; import org.nuxeo.ecm.core.storage.sql.Session; import org.nuxeo.ecm.core.storage.sql.SimpleProperty; -import org.nuxeo.ecm.core.storage.sql.coremodel.SQLFulltextExtractorWork; import org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession; import org.nuxeo.ecm.core.work.api.Work; import org.nuxeo.ecm.core.work.api.WorkManager; @@ -263,7 +263,7 @@ protected void doBatch(List infos) throws NuxeoException { runAsyncBatch(asyncIds); // wait for async completion after transaction commit - Framework.getLocalService(EventService.class).waitForAsyncCompletion(); + Framework.getService(EventService.class).waitForAsyncCompletion(); } /* @@ -312,9 +312,9 @@ protected void runAsyncBatch(Set asyncIds) { return; } String repositoryName = coreSession.getRepositoryName(); - WorkManager workManager = Framework.getLocalService(WorkManager.class); + WorkManager workManager = Framework.getService(WorkManager.class); for (String id : asyncIds) { - Work work = new SQLFulltextExtractorWork(repositoryName, id); + Work work = new FulltextExtractorWork(repositoryName, id, false, true, false); // schedule immediately, we're outside a transaction workManager.schedule(work, Scheduling.IF_NOT_SCHEDULED, false); } diff --git a/services/common/src/test/java/org/collectionspace/services/common/test/AbstractSecurityTestBase.java b/services/common/src/test/java/org/collectionspace/services/common/test/AbstractSecurityTestBase.java index 2fdd5da6ed..2ec195f5a9 100644 --- a/services/common/src/test/java/org/collectionspace/services/common/test/AbstractSecurityTestBase.java +++ b/services/common/src/test/java/org/collectionspace/services/common/test/AbstractSecurityTestBase.java @@ -2,7 +2,7 @@ import java.io.ByteArrayInputStream; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBException; import javax.xml.namespace.QName; import org.collectionspace.services.common.config.ServicesConfigReaderImpl; diff --git a/services/common/src/test/java/org/collectionspace/services/common/test/SecurityUtilsTest.java b/services/common/src/test/java/org/collectionspace/services/common/test/SecurityUtilsTest.java index 22b6fc62b7..debac3a76e 100644 --- a/services/common/src/test/java/org/collectionspace/services/common/test/SecurityUtilsTest.java +++ b/services/common/src/test/java/org/collectionspace/services/common/test/SecurityUtilsTest.java @@ -2,7 +2,7 @@ import java.util.Set; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBException; import org.collectionspace.services.common.security.SecurityUtils; import org.collectionspace.services.config.AssertionProbesType; diff --git a/services/concept/client/pom.xml b/services/concept/client/pom.xml index 9525e09204..9f9d250518 100644 --- a/services/concept/client/pom.xml +++ b/services/concept/client/pom.xml @@ -51,11 +51,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/concept/jaxb/pom.xml b/services/concept/jaxb/pom.xml index af24038e3b..2516ddc1e7 100644 --- a/services/concept/jaxb/pom.xml +++ b/services/concept/jaxb/pom.xml @@ -13,19 +13,9 @@ services.concept.jaxb - - org.collectionspace.services - org.collectionspace.services.common - - - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - org.collectionspace.services org.collectionspace.services.authority.jaxb - true ${project.version} @@ -35,8 +25,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/concept/jaxb/src/main/resources/concept_common.xsd b/services/concept/jaxb/src/main/resources/concept_common.xsd index 505f955bbd..1f0c485b0f 100644 --- a/services/concept/jaxb/src/main/resources/concept_common.xsd +++ b/services/concept/jaxb/src/main/resources/concept_common.xsd @@ -8,14 +8,12 @@ Used for: JAXB binding between XML and Java objects --> - diff --git a/services/concept/jaxb/src/main/resources/conceptauthority_common.xsd b/services/concept/jaxb/src/main/resources/conceptauthority_common.xsd index c319b93fcb..9ce44f12d7 100644 --- a/services/concept/jaxb/src/main/resources/conceptauthority_common.xsd +++ b/services/concept/jaxb/src/main/resources/conceptauthority_common.xsd @@ -9,15 +9,13 @@ --> - + - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/config/pom.xml b/services/config/pom.xml index 71136d8951..3955bacda6 100644 --- a/services/config/pom.xml +++ b/services/config/pom.xml @@ -27,14 +27,9 @@ commons-io - javax.xml.bind - jaxb-api + jakarta.xml.bind + jakarta.xml.bind-api - - com.sun.xml.bind - jaxb-core - test - xerces xercesImpl @@ -42,22 +37,19 @@ test - org.jvnet.jaxb2_commons - jaxb2-basics - - - org.jvnet.jaxb2-commons - property-listener-injector - - - org.jvnet.jaxb2_commons - jaxb2-basics-runtime + org.jvnet.jaxb + jaxb-plugins-runtime org.collectionspace.services org.collectionspace.services.common-api ${project.version} + + org.glassfish.jaxb + jaxb-runtime + test + @@ -65,8 +57,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/config/src/main/java/org/collectionspace/services/common/config/AbstractConfigReaderImpl.java b/services/config/src/main/java/org/collectionspace/services/common/config/AbstractConfigReaderImpl.java index a03e118f35..4fc64ed05a 100644 --- a/services/config/src/main/java/org/collectionspace/services/common/config/AbstractConfigReaderImpl.java +++ b/services/config/src/main/java/org/collectionspace/services/common/config/AbstractConfigReaderImpl.java @@ -31,11 +31,12 @@ import java.util.ArrayList; import java.util.List; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; +import jakarta.xml.bind.JAXBContext; +import jakarta.xml.bind.JAXBException; +import jakarta.xml.bind.Unmarshaller; import org.collectionspace.services.common.api.JEEServerDeployment; +import org.collectionspace.services.common.jaxb.JAXBContextCache; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -148,7 +149,7 @@ public Object parse(InputStream configFileStream, Class clazz) throws JAXBException { Object result = null; - JAXBContext jc = JAXBContext.newInstance(clazz); + JAXBContext jc = JAXBContextCache.getInstance().getCachedJAXBContext(clazz); Unmarshaller um = jc.createUnmarshaller(); result = um.unmarshal(configFileStream); diff --git a/services/config/src/test/java/org/collectionspace/services/common/config/ServicesConfigReaderImplTest.java b/services/config/src/test/java/org/collectionspace/services/common/config/ServicesConfigReaderImplTest.java index 73c612ccf0..6f9b858e57 100644 --- a/services/config/src/test/java/org/collectionspace/services/common/config/ServicesConfigReaderImplTest.java +++ b/services/config/src/test/java/org/collectionspace/services/common/config/ServicesConfigReaderImplTest.java @@ -4,7 +4,7 @@ import java.util.ArrayList; import java.util.List; -import javax.xml.bind.JAXBException; +import jakarta.xml.bind.JAXBException; import org.collectionspace.services.config.AssertionAttributeProbeType; import org.collectionspace.services.config.SAMLRelyingPartyType; diff --git a/services/conservation/client/pom.xml b/services/conservation/client/pom.xml index 2f3b35173d..de38d72d00 100644 --- a/services/conservation/client/pom.xml +++ b/services/conservation/client/pom.xml @@ -51,11 +51,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/conservation/jaxb/pom.xml b/services/conservation/jaxb/pom.xml index 22d256ddd2..5dead3adb1 100644 --- a/services/conservation/jaxb/pom.xml +++ b/services/conservation/jaxb/pom.xml @@ -7,26 +7,30 @@ org.collectionspace.services ${revision} - + 4.0.0 org.collectionspace.services.conservation.jaxb services.conservation.jaxb - + - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + - + collectionspace-services-conservation-jaxb install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/conservation/jaxb/src/main/resources/conservation-common.xsd b/services/conservation/jaxb/src/main/resources/conservation-common.xsd index cc9a996c6a..62aab79ede 100644 --- a/services/conservation/jaxb/src/main/resources/conservation-common.xsd +++ b/services/conservation/jaxb/src/main/resources/conservation-common.xsd @@ -11,11 +11,9 @@ $LastChangedDate$ --> - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/consultation/client/pom.xml b/services/consultation/client/pom.xml index 848d86dcae..df28c42ba8 100644 --- a/services/consultation/client/pom.xml +++ b/services/consultation/client/pom.xml @@ -32,7 +32,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client @@ -41,10 +41,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider @@ -58,4 +54,4 @@ collectionspace-services-consultation-client - \ No newline at end of file + diff --git a/services/consultation/jaxb/pom.xml b/services/consultation/jaxb/pom.xml index 98cc855583..80579927b0 100644 --- a/services/consultation/jaxb/pom.xml +++ b/services/consultation/jaxb/pom.xml @@ -14,9 +14,13 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin diff --git a/services/consultation/jaxb/src/main/resources/consultations_common.xsd b/services/consultation/jaxb/src/main/resources/consultations_common.xsd index 0f1af8bb80..97e6d95c11 100644 --- a/services/consultation/jaxb/src/main/resources/consultations_common.xsd +++ b/services/consultation/jaxb/src/main/resources/consultations_common.xsd @@ -10,8 +10,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -61,10 +61,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/contact/client/pom.xml b/services/contact/client/pom.xml index bb18c23027..444867b187 100644 --- a/services/contact/client/pom.xml +++ b/services/contact/client/pom.xml @@ -45,11 +45,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy @@ -59,6 +55,11 @@ commons-httpclient commons-httpclient + + org.glassfish.jaxb + jaxb-runtime + test + diff --git a/services/contact/jaxb/pom.xml b/services/contact/jaxb/pom.xml index 8e1b6f9503..ab1b1fad64 100644 --- a/services/contact/jaxb/pom.xml +++ b/services/contact/jaxb/pom.xml @@ -7,26 +7,30 @@ org.collectionspace.services.contact ${revision} - + 4.0.0 org.collectionspace.services.contact.jaxb services.contact.jaxb - + - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + - + collectionspace-services-contact-jaxb install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo @@ -35,4 +39,3 @@ - diff --git a/services/contact/jaxb/src/main/resources/contacts-common.xsd b/services/contact/jaxb/src/main/resources/contacts-common.xsd index 81ca550088..df76462433 100644 --- a/services/contact/jaxb/src/main/resources/contacts-common.xsd +++ b/services/contact/jaxb/src/main/resources/contacts-common.xsd @@ -11,11 +11,9 @@ $LastChangedDate$ --> - - diff --git a/services/contact/service/pom.xml b/services/contact/service/pom.xml index e0484bcbf2..9edad6f47f 100644 --- a/services/contact/service/pom.xml +++ b/services/contact/service/pom.xml @@ -56,11 +56,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/deaccession/client/pom.xml b/services/deaccession/client/pom.xml index fd8fa06172..0018558b11 100644 --- a/services/deaccession/client/pom.xml +++ b/services/deaccession/client/pom.xml @@ -32,7 +32,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client @@ -41,10 +41,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider @@ -53,9 +49,14 @@ commons-httpclient commons-httpclient + + org.glassfish.jaxb + jaxb-runtime + test + collectionspace-services-deaccession-client - \ No newline at end of file + diff --git a/services/deaccession/jaxb/pom.xml b/services/deaccession/jaxb/pom.xml index 610d5f0388..ac300e78d5 100644 --- a/services/deaccession/jaxb/pom.xml +++ b/services/deaccession/jaxb/pom.xml @@ -14,9 +14,13 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime @@ -25,9 +29,9 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin - \ No newline at end of file + diff --git a/services/deaccession/jaxb/src/main/resources/deaccessions_common.xsd b/services/deaccession/jaxb/src/main/resources/deaccessions_common.xsd index 0515b12769..08542df130 100644 --- a/services/deaccession/jaxb/src/main/resources/deaccessions_common.xsd +++ b/services/deaccession/jaxb/src/main/resources/deaccessions_common.xsd @@ -9,8 +9,7 @@ --> org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -61,10 +61,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/dimension/client/pom.xml b/services/dimension/client/pom.xml index 57e8dcc42c..1e7b4832b0 100644 --- a/services/dimension/client/pom.xml +++ b/services/dimension/client/pom.xml @@ -45,11 +45,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/dimension/jaxb/pom.xml b/services/dimension/jaxb/pom.xml index 50d13aa8ba..d7768a1c3e 100644 --- a/services/dimension/jaxb/pom.xml +++ b/services/dimension/jaxb/pom.xml @@ -19,11 +19,6 @@ org.collectionspace.services.jaxb ${project.version} - - org.collectionspace.services - org.collectionspace.services.hyperjaxb - ${project.version} - @@ -31,8 +26,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/dimension/jaxb/src/main/resources/dimensions-common.xsd b/services/dimension/jaxb/src/main/resources/dimensions-common.xsd index 40fd310b68..83e1c561a3 100644 --- a/services/dimension/jaxb/src/main/resources/dimensions-common.xsd +++ b/services/dimension/jaxb/src/main/resources/dimensions-common.xsd @@ -11,11 +11,9 @@ $LastChangedDate: 2009-10-14 14:48:05 -0700 (Wed, 14 Oct 2009) $ --> - diff --git a/services/dimension/service/pom.xml b/services/dimension/service/pom.xml index 43c341c546..0dd3eba750 100644 --- a/services/dimension/service/pom.xml +++ b/services/dimension/service/pom.xml @@ -57,11 +57,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/dutyofcare/client/pom.xml b/services/dutyofcare/client/pom.xml index c5275152ac..22d1fbcc3f 100644 --- a/services/dutyofcare/client/pom.xml +++ b/services/dutyofcare/client/pom.xml @@ -52,7 +52,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client @@ -61,10 +61,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/dutyofcare/jaxb/pom.xml b/services/dutyofcare/jaxb/pom.xml index 1b85ef8b85..a4b9700b60 100644 --- a/services/dutyofcare/jaxb/pom.xml +++ b/services/dutyofcare/jaxb/pom.xml @@ -14,9 +14,13 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin diff --git a/services/dutyofcare/jaxb/src/main/resources/dutiesofcare_common.xsd b/services/dutyofcare/jaxb/src/main/resources/dutiesofcare_common.xsd index 46517dc65b..ecacd06c81 100644 --- a/services/dutyofcare/jaxb/src/main/resources/dutiesofcare_common.xsd +++ b/services/dutyofcare/jaxb/src/main/resources/dutiesofcare_common.xsd @@ -9,8 +9,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -63,10 +63,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/exhibition/client/pom.xml b/services/exhibition/client/pom.xml index 7921ae8995..8fd3ca5b92 100644 --- a/services/exhibition/client/pom.xml +++ b/services/exhibition/client/pom.xml @@ -54,11 +54,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/exhibition/jaxb/pom.xml b/services/exhibition/jaxb/pom.xml index 93624fd486..5d14720ca5 100644 --- a/services/exhibition/jaxb/pom.xml +++ b/services/exhibition/jaxb/pom.xml @@ -15,10 +15,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -26,8 +30,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/exhibition/jaxb/src/main/resources/exhibitions-common.xsd b/services/exhibition/jaxb/src/main/resources/exhibitions-common.xsd index f1a7bed01e..c25779abe5 100644 --- a/services/exhibition/jaxb/src/main/resources/exhibitions-common.xsd +++ b/services/exhibition/jaxb/src/main/resources/exhibitions-common.xsd @@ -8,11 +8,9 @@ Used for: JAXB binding between XML and Java objects --> - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/exit/client/pom.xml b/services/exit/client/pom.xml index d9ed912c9b..8846323656 100644 --- a/services/exit/client/pom.xml +++ b/services/exit/client/pom.xml @@ -32,7 +32,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client @@ -41,10 +41,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider @@ -53,6 +49,11 @@ commons-httpclient commons-httpclient + + org.glassfish.jaxb + jaxb-runtime + test + diff --git a/services/exit/jaxb/pom.xml b/services/exit/jaxb/pom.xml index e61c843374..a2a2ce1be6 100644 --- a/services/exit/jaxb/pom.xml +++ b/services/exit/jaxb/pom.xml @@ -14,9 +14,13 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin diff --git a/services/exit/jaxb/src/main/resources/exits_common.xsd b/services/exit/jaxb/src/main/resources/exits_common.xsd index 3dd9096e00..a50981da7e 100644 --- a/services/exit/jaxb/src/main/resources/exits_common.xsd +++ b/services/exit/jaxb/src/main/resources/exits_common.xsd @@ -10,9 +10,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -61,10 +61,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/export/client/pom.xml b/services/export/client/pom.xml index 3b257b2cab..0edcbea446 100644 --- a/services/export/client/pom.xml +++ b/services/export/client/pom.xml @@ -61,11 +61,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/export/jaxb/pom.xml b/services/export/jaxb/pom.xml index b5cea75ccf..f83692326a 100644 --- a/services/export/jaxb/pom.xml +++ b/services/export/jaxb/pom.xml @@ -25,8 +25,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin diff --git a/services/export/jaxb/src/main/resources/exports-common.xsd b/services/export/jaxb/src/main/resources/exports-common.xsd index 95e981c61c..44e3ceccf7 100644 --- a/services/export/jaxb/src/main/resources/exports-common.xsd +++ b/services/export/jaxb/src/main/resources/exports-common.xsd @@ -12,13 +12,11 @@ --> org.jboss.resteasy - resteasy-jaxrs + resteasy-client diff --git a/services/group/client/pom.xml b/services/group/client/pom.xml index cb6bc5ce95..6afd946198 100644 --- a/services/group/client/pom.xml +++ b/services/group/client/pom.xml @@ -52,11 +52,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/group/jaxb/pom.xml b/services/group/jaxb/pom.xml index 5ac3e2e1fc..1ba2c23463 100644 --- a/services/group/jaxb/pom.xml +++ b/services/group/jaxb/pom.xml @@ -14,10 +14,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/group/jaxb/src/main/resources/groups_common.xsd b/services/group/jaxb/src/main/resources/groups_common.xsd index 5e23c3e08f..c15703b514 100644 --- a/services/group/jaxb/src/main/resources/groups_common.xsd +++ b/services/group/jaxb/src/main/resources/groups_common.xsd @@ -11,11 +11,9 @@ $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $ --> - - diff --git a/services/group/service/pom.xml b/services/group/service/pom.xml index f9345a581c..9cae3e1b9e 100644 --- a/services/group/service/pom.xml +++ b/services/group/service/pom.xml @@ -56,11 +56,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/heldintrust/client/pom.xml b/services/heldintrust/client/pom.xml index c79bc4e623..217a1952ff 100644 --- a/services/heldintrust/client/pom.xml +++ b/services/heldintrust/client/pom.xml @@ -32,7 +32,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client @@ -41,10 +41,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider @@ -53,9 +49,14 @@ commons-httpclient commons-httpclient + + org.glassfish.jaxb + jaxb-runtime + test + collectionspace-services-heldintrust-client - \ No newline at end of file + diff --git a/services/heldintrust/jaxb/pom.xml b/services/heldintrust/jaxb/pom.xml index f68d6c04f0..a8f659b2f6 100644 --- a/services/heldintrust/jaxb/pom.xml +++ b/services/heldintrust/jaxb/pom.xml @@ -14,9 +14,13 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime @@ -25,9 +29,9 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin - \ No newline at end of file + diff --git a/services/heldintrust/jaxb/src/main/resources/heldintrusts_common.xsd b/services/heldintrust/jaxb/src/main/resources/heldintrusts_common.xsd index 85065a41a5..8f89eba62e 100644 --- a/services/heldintrust/jaxb/src/main/resources/heldintrusts_common.xsd +++ b/services/heldintrust/jaxb/src/main/resources/heldintrusts_common.xsd @@ -9,8 +9,7 @@ --> org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -61,10 +61,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/hyperjaxb/pom.xml b/services/hyperjaxb/pom.xml index e5da60c0cf..c9e4fc4ef0 100644 --- a/services/hyperjaxb/pom.xml +++ b/services/hyperjaxb/pom.xml @@ -34,28 +34,19 @@ services.hyperjaxb - + + org.collectionspace.services + org.collectionspace.services.jaxb + ${project.version} + + - javax.xml.bind - jaxb-api + jakarta.xml.bind + jakarta.xml.bind-api - javax.persistence - persistence-api + javax.persistence-api org.hibernate @@ -66,22 +57,16 @@ org.dom4j dom4j - - org.jvnet.hyperjaxb3 - hyperjaxb3-ejb-runtime - + + org.jspecify + jspecify + 1.0.0 + collectionspace-services-hyperjaxb install - - - - org.jvnet.hyperjaxb3 - maven-hyperjaxb3-plugin - - diff --git a/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/ActionType.java b/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/ActionType.java new file mode 100644 index 0000000000..fd67add3cc --- /dev/null +++ b/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/ActionType.java @@ -0,0 +1,26 @@ +package org.collectionspace.services.authorization.perms; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlType; + +@XmlEnum +@XmlType(name = "action_type") +public enum ActionType { + CREATE, + READ, + UPDATE, + DELETE, + SEARCH, + START, + STOP, + RUN, + ADMIN; + + public String value() { + return name(); + } + + public static ActionType fromValue(String v) { + return valueOf(v); + } +} diff --git a/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/EffectType.java b/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/EffectType.java new file mode 100644 index 0000000000..ad396acfd7 --- /dev/null +++ b/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/EffectType.java @@ -0,0 +1,19 @@ +package org.collectionspace.services.authorization.perms; + +import jakarta.xml.bind.annotation.XmlEnum; +import jakarta.xml.bind.annotation.XmlType; + +@XmlEnum +@XmlType(name = "effect_type") +public enum EffectType { + PERMIT, + DENY; + + public String value() { + return name(); + } + + public static EffectType fromValue(String v) { + return valueOf(v); + } +} diff --git a/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/Permission.java b/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/Permission.java new file mode 100644 index 0000000000..04591b8e3a --- /dev/null +++ b/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/Permission.java @@ -0,0 +1,247 @@ +package org.collectionspace.services.authorization.perms; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.CascadeType; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlSchemaType; +import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import org.collectionspace.services.jaxb.adapter.DateAdapter; +import org.jspecify.annotations.NonNull; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "permission") +@Entity(name = "Permission") +@Table(name = "permissions") +@Inheritance(strategy = InheritanceType.JOINED) +public class Permission { + + @Id + @Column(name = "csid", nullable = false, length = 128) + @XmlAttribute(name = "csid") + private String csid; + + @Basic + @Column(name = "description") + private String description; + + @Basic + @Column(name = "resource_name", nullable = false, length = 128) + @XmlElement(required = true) + private String resourceName; + + @Basic + @Column(name = "attribute_name", length = 128) + private String attributeName; + + @Basic + @Column(name = "action_group", length = 128) + private String actionGroup; + + @OneToMany( + targetEntity = PermissionAction.class, + cascade = {CascadeType.ALL}) + @JoinColumn(name = "ACTION__PERMISSION_CSID") + @XmlElement(required = true) + private List action; + + @Basic + @Column(name = "effect", nullable = false, length = 32) + @Enumerated(EnumType.STRING) + @XmlElement(required = true) + private EffectType effect; + + @Basic + @Column(name = "metadata_protection") + private String metadataProtection; + + @Basic + @Column(name = "actions_protection") + private String actionsProtection; + + @Basic + @Column(name = "tenant_id", nullable = false, length = 128) + @XmlElement(name = "tenant_id", required = true) + private String tenantId; + + @Column(name = "created_at", nullable = false) + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + private Date createdAt; + + @Column(name = "updated_at") + @Temporal(TemporalType.TIMESTAMP) + @XmlElement(required = true) + @XmlSchemaType(name = "dateTime") + @XmlJavaTypeAdapter(DateAdapter.class) + private Date updatedAt; + + public String getDescription() { + return description; + } + + public Permission setDescription(String description) { + this.description = description; + return this; + } + + public String getResourceName() { + return resourceName; + } + + public Permission setResourceName(String resourceName) { + this.resourceName = resourceName; + return this; + } + + public String getAttributeName() { + return attributeName; + } + + public Permission setAttributeName(String attributeName) { + this.attributeName = attributeName; + return this; + } + + public String getActionGroup() { + return actionGroup; + } + + public Permission setActionGroup(String actionGroup) { + this.actionGroup = actionGroup; + return this; + } + + @NonNull + public List getAction() { + if (action == null) { + action = new ArrayList<>(); + } + return action; + } + + public Permission setAction(List action) { + this.action = action; + return this; + } + + public EffectType getEffect() { + return effect; + } + + public Permission setEffect(EffectType effect) { + this.effect = effect; + return this; + } + + public String getMetadataProtection() { + return metadataProtection; + } + + public Permission setMetadataProtection(String metadataProtection) { + this.metadataProtection = metadataProtection; + return this; + } + + public String getActionsProtection() { + return actionsProtection; + } + + public Permission setActionsProtection(String actionsProtection) { + this.actionsProtection = actionsProtection; + return this; + } + + public String getTenantId() { + return tenantId; + } + + public Permission setTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + public Date getCreatedAt() { + return createdAt; + } + + public Permission setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + return this; + } + + public Date getUpdatedAt() { + return updatedAt; + } + + public Permission setUpdatedAt(Date updatedAt) { + this.updatedAt = updatedAt; + return this; + } + + public String getCsid() { + return csid; + } + + public Permission setCsid(String csid) { + this.csid = csid; + return this; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) { + return false; + } + Permission that = (Permission) o; + return Objects.equals(description, that.description) + && Objects.equals(resourceName, that.resourceName) + && Objects.equals(attributeName, that.attributeName) + && Objects.equals(actionGroup, that.actionGroup) + && effect == that.effect + && Objects.equals(metadataProtection, that.metadataProtection) + && Objects.equals(actionsProtection, that.actionsProtection) + && Objects.equals(tenantId, that.tenantId) + && Objects.equals(createdAt, that.createdAt) + && Objects.equals(updatedAt, that.updatedAt) + && Objects.equals(csid, that.csid); + } + + @Override + public int hashCode() { + return Objects.hash( + description, + resourceName, + attributeName, + actionGroup, + effect, + metadataProtection, + actionsProtection, + tenantId, + createdAt, + updatedAt, + csid); + } +} diff --git a/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/PermissionAction.java b/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/PermissionAction.java new file mode 100644 index 0000000000..aa9f289a8a --- /dev/null +++ b/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/PermissionAction.java @@ -0,0 +1,101 @@ +package org.collectionspace.services.authorization.perms; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlAttribute; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlType; +import java.util.Objects; +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.Table; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "permission_action") +@Entity(name = "PermissionAction") +@Table(name = "permissions_actions") +@Inheritance(strategy = InheritanceType.JOINED) +public class PermissionAction { + + @Basic + @Column(name = "name", nullable = false, length = 128) + @Enumerated(EnumType.STRING) + @XmlElement(required = true) + private ActionType name; + + @Basic + @Column(name = "objectIdentity", nullable = false, length = 128) + @XmlElement(required = true) + private String objectIdentity; + + @Basic + @Column(name = "objectIdentityResource", nullable = false, length = 128) + @XmlElement(required = true) + private String objectIdentityResource; + + @Id + @Column(name = "HJID") + @GeneratedValue(strategy = GenerationType.AUTO) + @XmlAttribute(name = "Hjid") + private Long hjid; + + public ActionType getName() { + return name; + } + + public PermissionAction setName(ActionType name) { + this.name = name; + return this; + } + + public String getObjectIdentity() { + return objectIdentity; + } + + public PermissionAction setObjectIdentity(String objectIdentity) { + this.objectIdentity = objectIdentity; + return this; + } + + public String getObjectIdentityResource() { + return objectIdentityResource; + } + + public PermissionAction setObjectIdentityResource(String objectIdentityResource) { + this.objectIdentityResource = objectIdentityResource; + return this; + } + + public Long getHjid() { + return hjid; + } + + public PermissionAction setHjid(Long hjid) { + this.hjid = hjid; + return this; + } + + @Override + public boolean equals(Object o) { + if (o == null || getClass() != o.getClass()) { + return false; + } + PermissionAction that = (PermissionAction) o; + return name == that.name + && Objects.equals(objectIdentity, that.objectIdentity) + && Objects.equals(objectIdentityResource, that.objectIdentityResource); + } + + @Override + public int hashCode() { + return Objects.hash(name, objectIdentity, objectIdentityResource); + } +} diff --git a/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/PermissionsList.java b/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/PermissionsList.java new file mode 100644 index 0000000000..762f6ddfc4 --- /dev/null +++ b/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/PermissionsList.java @@ -0,0 +1,79 @@ +package org.collectionspace.services.authorization.perms; + +import jakarta.xml.bind.annotation.XmlAccessType; +import jakarta.xml.bind.annotation.XmlAccessorType; +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; +import jakarta.xml.bind.annotation.XmlSchemaType; +import java.util.ArrayList; +import java.util.List; +import org.jspecify.annotations.NonNull; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlRootElement(name = "permissions_list") +public class PermissionsList { + + @XmlSchemaType(name = "unsignedInt") + private long pageNum; + + @XmlSchemaType(name = "unsignedInt") + private long pageSize; + + @XmlSchemaType(name = "unsignedInt") + private long itemsInPage; + + @XmlSchemaType(name = "unsignedInt") + private long totalItems; + + @XmlElement(required = true) + private List permission; + + public long getPageNum() { + return pageNum; + } + + public PermissionsList setPageNum(long pageNum) { + this.pageNum = pageNum; + return this; + } + + public long getPageSize() { + return pageSize; + } + + public PermissionsList setPageSize(long pageSize) { + this.pageSize = pageSize; + return this; + } + + public long getItemsInPage() { + return itemsInPage; + } + + public PermissionsList setItemsInPage(long itemsInPage) { + this.itemsInPage = itemsInPage; + return this; + } + + public long getTotalItems() { + return totalItems; + } + + public PermissionsList setTotalItems(long totalItems) { + this.totalItems = totalItems; + return this; + } + + @NonNull + public List getPermission() { + if (permission == null) { + permission = new ArrayList<>(); + } + return permission; + } + + public PermissionsList setPermission(List permission) { + this.permission = permission; + return this; + } +} diff --git a/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/package-info.java b/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/package-info.java new file mode 100644 index 0000000000..e7e54891fe --- /dev/null +++ b/services/hyperjaxb/src/main/java/org/collectionspace/services/authorization/perms/package-info.java @@ -0,0 +1,4 @@ +@XmlSchema(namespace = "http://collectionspace.org/services/authorization/perms") +package org.collectionspace.services.authorization.perms; + +import jakarta.xml.bind.annotation.XmlSchema; \ No newline at end of file diff --git a/services/hyperjaxb/src/main/resources/bindings.xjb b/services/hyperjaxb/src/main/resources/bindings.xjb deleted file mode 100644 index ce5cc40c49..0000000000 --- a/services/hyperjaxb/src/main/resources/bindings.xjb +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/services/hyperjaxb/src/main/resources/org/collectionspace/services/authorization/perms/jaxb.index b/services/hyperjaxb/src/main/resources/org/collectionspace/services/authorization/perms/jaxb.index new file mode 100644 index 0000000000..512f6a8a26 --- /dev/null +++ b/services/hyperjaxb/src/main/resources/org/collectionspace/services/authorization/perms/jaxb.index @@ -0,0 +1,2 @@ +Permission +PermissionsList diff --git a/services/hyperjaxb/src/main/resources/permissions.xsd b/services/hyperjaxb/src/main/resources/permissions.xsd deleted file mode 100644 index 1bb5fd50fe..0000000000 --- a/services/hyperjaxb/src/main/resources/permissions.xsd +++ /dev/null @@ -1,219 +0,0 @@ - - - - - - - - - - - CspacePermissionConfig describes permission in CollectionSpace - - resourceName could be a service path, e.g. collectionobjects or - intakes - no need to give slash at the beginning or end - - attributeName could be an attribute of the service schema - e.g. distinguishingFeatures from collectionobjects_common - - actionGroup is label that can be used by a client to "group" sets - of actions for operations - like searching for permissions by a specific actionGroup label. - - action describes the actions that could be taken on given resource - (and attribute) - - effect describes the effect of the access control for the action - performed on the given resource (and attribute) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/services/hyperjaxb/src/main/resources/permissions_list.xsd b/services/hyperjaxb/src/main/resources/permissions_list.xsd deleted file mode 100644 index f45fe2c535..0000000000 --- a/services/hyperjaxb/src/main/resources/permissions_list.xsd +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - permission configuration list - - - - - - - - - - - - - diff --git a/services/id/jaxb/pom.xml b/services/id/jaxb/pom.xml index 0f1712e467..ef68404a83 100644 --- a/services/id/jaxb/pom.xml +++ b/services/id/jaxb/pom.xml @@ -35,8 +35,8 @@ - org.jvnet.jaxb2_commons - jaxb2-basics-runtime + org.jvnet.jaxb + jaxb-plugins-runtime @@ -45,8 +45,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/imports/jaxb/pom.xml b/services/imports/jaxb/pom.xml index 358d9efd84..54eea34174 100644 --- a/services/imports/jaxb/pom.xml +++ b/services/imports/jaxb/pom.xml @@ -14,10 +14,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/imports/jaxb/src/main/resources/imports_common.xsd b/services/imports/jaxb/src/main/resources/imports_common.xsd index c9008afff2..cc925d1184 100644 --- a/services/imports/jaxb/src/main/resources/imports_common.xsd +++ b/services/imports/jaxb/src/main/resources/imports_common.xsd @@ -11,11 +11,9 @@ $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $ --> - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy @@ -85,16 +81,10 @@ - - - org.nuxeo.shell - nuxeo-shell-core - ${nuxeo.shell.version} - org.nuxeo.ecm.platform nuxeo-importer-core - ${nuxeo.platform.version} + ${nuxeo.general.release} org.slf4j @@ -109,7 +99,7 @@ org.nuxeo.ecm.platform nuxeo-importer-xml-parser - ${nuxeo.platform.version} + ${nuxeo.general.release} dom4j diff --git a/services/index/client/pom.xml b/services/index/client/pom.xml index 08ea979cdc..5bf949817d 100644 --- a/services/index/client/pom.xml +++ b/services/index/client/pom.xml @@ -41,11 +41,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/index/jaxb/pom.xml b/services/index/jaxb/pom.xml index 932d01f50c..851342e3df 100644 --- a/services/index/jaxb/pom.xml +++ b/services/index/jaxb/pom.xml @@ -14,10 +14,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/index/jaxb/src/main/resources/index-common.xsd b/services/index/jaxb/src/main/resources/index-common.xsd index ef50d16a95..51699fa94c 100644 --- a/services/index/jaxb/src/main/resources/index-common.xsd +++ b/services/index/jaxb/src/main/resources/index-common.xsd @@ -11,11 +11,9 @@ $LastChangedDate$ --> - - diff --git a/services/index/service/pom.xml b/services/index/service/pom.xml index d728467728..352687326f 100644 --- a/services/index/service/pom.xml +++ b/services/index/service/pom.xml @@ -46,11 +46,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/insurance/client/pom.xml b/services/insurance/client/pom.xml index 180b9d413f..e4e5e0b27e 100644 --- a/services/insurance/client/pom.xml +++ b/services/insurance/client/pom.xml @@ -52,7 +52,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client @@ -61,10 +61,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/insurance/jaxb/pom.xml b/services/insurance/jaxb/pom.xml index b28112b95c..3019713fd0 100644 --- a/services/insurance/jaxb/pom.xml +++ b/services/insurance/jaxb/pom.xml @@ -14,9 +14,13 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin diff --git a/services/insurance/jaxb/src/main/resources/insurances_common.xsd b/services/insurance/jaxb/src/main/resources/insurances_common.xsd index fc43a34cc2..d242006e65 100644 --- a/services/insurance/jaxb/src/main/resources/insurances_common.xsd +++ b/services/insurance/jaxb/src/main/resources/insurances_common.xsd @@ -10,9 +10,7 @@ + diff --git a/services/insurance/service/pom.xml b/services/insurance/service/pom.xml index e8d4299f7c..bb5490f29a 100644 --- a/services/insurance/service/pom.xml +++ b/services/insurance/service/pom.xml @@ -56,7 +56,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -64,10 +64,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/intake/client/pom.xml b/services/intake/client/pom.xml index e066409ce6..ebbb40b90a 100644 --- a/services/intake/client/pom.xml +++ b/services/intake/client/pom.xml @@ -57,11 +57,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/intake/jaxb/pom.xml b/services/intake/jaxb/pom.xml index d79d575ef6..b2e6b8f95d 100644 --- a/services/intake/jaxb/pom.xml +++ b/services/intake/jaxb/pom.xml @@ -14,10 +14,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/intake/jaxb/src/main/resources/intakes-common.xsd b/services/intake/jaxb/src/main/resources/intakes-common.xsd index cde240b546..f51c9e3703 100644 --- a/services/intake/jaxb/src/main/resources/intakes-common.xsd +++ b/services/intake/jaxb/src/main/resources/intakes-common.xsd @@ -13,9 +13,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/iterationreport/client/pom.xml b/services/iterationreport/client/pom.xml index 07d00e9d18..2010ea0788 100644 --- a/services/iterationreport/client/pom.xml +++ b/services/iterationreport/client/pom.xml @@ -52,7 +52,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client @@ -61,10 +61,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/iterationreport/jaxb/pom.xml b/services/iterationreport/jaxb/pom.xml index 9a38c72b9f..807e0e5294 100644 --- a/services/iterationreport/jaxb/pom.xml +++ b/services/iterationreport/jaxb/pom.xml @@ -1,7 +1,5 @@ - - + + org.collectionspace.services.iterationreport org.collectionspace.services @@ -14,9 +12,13 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime @@ -25,8 +27,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin diff --git a/services/iterationreport/jaxb/src/main/resources/iterationreports_common.xsd b/services/iterationreport/jaxb/src/main/resources/iterationreports_common.xsd index d41204cc83..0fa2b8498a 100644 --- a/services/iterationreport/jaxb/src/main/resources/iterationreports_common.xsd +++ b/services/iterationreport/jaxb/src/main/resources/iterationreports_common.xsd @@ -10,9 +10,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -64,10 +64,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/jaxb/pom.xml b/services/jaxb/pom.xml index 8905e189e4..e438958a78 100644 --- a/services/jaxb/pom.xml +++ b/services/jaxb/pom.xml @@ -23,12 +23,13 @@ - com.sun.xml.bind - jaxb-core + jakarta.xml.bind + jakarta.xml.bind-api + - org.jvnet.jaxb2_commons - jaxb2-basics + org.jvnet.jaxb + jaxb-plugins-runtime @@ -37,8 +38,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/jaxb/src/main/java/org/collectionspace/services/jaxb/adapter/DateAdapter.java b/services/jaxb/src/main/java/org/collectionspace/services/jaxb/adapter/DateAdapter.java new file mode 100644 index 0000000000..6d79288393 --- /dev/null +++ b/services/jaxb/src/main/java/org/collectionspace/services/jaxb/adapter/DateAdapter.java @@ -0,0 +1,24 @@ +package org.collectionspace.services.jaxb.adapter; + +import java.time.Instant; +import java.time.format.DateTimeFormatter; +import java.util.Date; + +import jakarta.xml.bind.annotation.adapters.XmlAdapter; + +/** + * Adapter to convert {@link Date} to an ISO-8601 String at UTC-0 + * + * @since 9.0.0 + */ +public class DateAdapter extends XmlAdapter { + @Override + public Date unmarshal(String s) { + return Date.from(Instant.parse(s)); + } + + @Override + public String marshal(Date date) { + return DateTimeFormatter.ISO_INSTANT.format(date.toInstant()); + } +} diff --git a/services/jaxb/src/main/resources/authorityref.xsd b/services/jaxb/src/main/resources/authorityref.xsd index 68c1d4dcd6..0399bda5df 100644 --- a/services/jaxb/src/main/resources/authorityref.xsd +++ b/services/jaxb/src/main/resources/authorityref.xsd @@ -17,8 +17,8 @@ --> + + + + + + + + + + diff --git a/services/jaxb/src/main/resources/bindings.xml b/services/jaxb/src/main/resources/bindings.xml deleted file mode 100644 index 76f7b6ad0f..0000000000 --- a/services/jaxb/src/main/resources/bindings.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/services/jaxb/src/main/resources/blobs_common.xsd b/services/jaxb/src/main/resources/blobs_common.xsd index 5b973959df..4e8015d67a 100644 --- a/services/jaxb/src/main/resources/blobs_common.xsd +++ b/services/jaxb/src/main/resources/blobs_common.xsd @@ -11,11 +11,10 @@ $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $ --> - diff --git a/services/jaxb/src/main/resources/index_common.xsd b/services/jaxb/src/main/resources/index_common.xsd index e250df2d12..d270eaaa86 100644 --- a/services/jaxb/src/main/resources/index_common.xsd +++ b/services/jaxb/src/main/resources/index_common.xsd @@ -11,11 +11,10 @@ $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $ --> - diff --git a/services/jaxb/src/main/resources/invocationContext.xsd b/services/jaxb/src/main/resources/invocationContext.xsd index 3f7a85bc0e..112b499174 100644 --- a/services/jaxb/src/main/resources/invocationContext.xsd +++ b/services/jaxb/src/main/resources/invocationContext.xsd @@ -8,7 +8,10 @@ $LastChangedRevision: 2316 $ $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $ --> - + diff --git a/services/jaxb/src/main/resources/invocationResults.xsd b/services/jaxb/src/main/resources/invocationResults.xsd index 7f7b732c09..4524ee7c0c 100644 --- a/services/jaxb/src/main/resources/invocationResults.xsd +++ b/services/jaxb/src/main/resources/invocationResults.xsd @@ -8,13 +8,11 @@ $LastChangedRevision: 2316 $ $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $ --> - + diff --git a/services/jaxb/src/main/resources/lifecycle.xsd b/services/jaxb/src/main/resources/lifecycle.xsd index b7a41ea674..934d8d71f5 100644 --- a/services/jaxb/src/main/resources/lifecycle.xsd +++ b/services/jaxb/src/main/resources/lifecycle.xsd @@ -1,9 +1,9 @@ - + diff --git a/services/jaxb/src/main/resources/relations_common.xsd b/services/jaxb/src/main/resources/relations_common.xsd index 923d1d3fd5..21991ce129 100644 --- a/services/jaxb/src/main/resources/relations_common.xsd +++ b/services/jaxb/src/main/resources/relations_common.xsd @@ -12,12 +12,10 @@ --> + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" jaxb:version="3.0" + xmlns="http://collectionspace.org/services/relation" + targetNamespace="http://collectionspace.org/services/relation"> diff --git a/services/jaxb/src/main/resources/service_description.xsd b/services/jaxb/src/main/resources/service_description.xsd index c586bb3788..c3bfa7fa3d 100644 --- a/services/jaxb/src/main/resources/service_description.xsd +++ b/services/jaxb/src/main/resources/service_description.xsd @@ -7,11 +7,9 @@ Used for: JAXB binding between XML and Java objects --> - diff --git a/services/jaxb/src/main/resources/workflow_common.xsd b/services/jaxb/src/main/resources/workflow_common.xsd index 3ba78d7d4f..9d4a5ca778 100644 --- a/services/jaxb/src/main/resources/workflow_common.xsd +++ b/services/jaxb/src/main/resources/workflow_common.xsd @@ -11,11 +11,9 @@ $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $ --> - diff --git a/services/jaxb/src/test/java/org/collectionspace/services/jaxb/adapter/DateAdapterTest.java b/services/jaxb/src/test/java/org/collectionspace/services/jaxb/adapter/DateAdapterTest.java new file mode 100644 index 0000000000..9710573f89 --- /dev/null +++ b/services/jaxb/src/test/java/org/collectionspace/services/jaxb/adapter/DateAdapterTest.java @@ -0,0 +1,26 @@ +package org.collectionspace.services.jaxb.adapter; + +import java.time.Instant; +import java.util.Date; + +import org.testng.Assert; +import org.testng.annotations.Test; + +public class DateAdapterTest { + + private static final String STRING_EPOCH = "1970-01-01T00:00:00Z"; + private static final Date DATE_EPOCH = Date.from(Instant.EPOCH); + private final DateAdapter adapter = new DateAdapter(); + + @Test + public void testUnmarshal() { + Date unmarshalled = adapter.unmarshal(STRING_EPOCH); + Assert.assertEquals(unmarshalled, DATE_EPOCH); + } + + @Test + public void testMarshal() { + String marshalled = adapter.marshal(DATE_EPOCH); + Assert.assertEquals(marshalled, STRING_EPOCH); + } +} \ No newline at end of file diff --git a/services/loanin/client/pom.xml b/services/loanin/client/pom.xml index 494d55510e..3ca33c8452 100644 --- a/services/loanin/client/pom.xml +++ b/services/loanin/client/pom.xml @@ -51,11 +51,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/loanin/jaxb/pom.xml b/services/loanin/jaxb/pom.xml index 764068b5db..cc0fd629d4 100644 --- a/services/loanin/jaxb/pom.xml +++ b/services/loanin/jaxb/pom.xml @@ -14,10 +14,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/loanin/jaxb/src/main/resources/loansin-common.xsd b/services/loanin/jaxb/src/main/resources/loansin-common.xsd index 65c9e6df8a..e146410e0c 100644 --- a/services/loanin/jaxb/src/main/resources/loansin-common.xsd +++ b/services/loanin/jaxb/src/main/resources/loansin-common.xsd @@ -11,11 +11,9 @@ $LastChangedDate$ --> - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/loanout/client/pom.xml b/services/loanout/client/pom.xml index 53875c5b46..a490e0f2b9 100644 --- a/services/loanout/client/pom.xml +++ b/services/loanout/client/pom.xml @@ -52,11 +52,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/loanout/jaxb/pom.xml b/services/loanout/jaxb/pom.xml index 99f53bbfcb..a5c02e2c0a 100644 --- a/services/loanout/jaxb/pom.xml +++ b/services/loanout/jaxb/pom.xml @@ -14,10 +14,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/loanout/jaxb/src/main/resources/loansout-common.xsd b/services/loanout/jaxb/src/main/resources/loansout-common.xsd index 0bbb9b50e2..a32abeba88 100644 --- a/services/loanout/jaxb/src/main/resources/loansout-common.xsd +++ b/services/loanout/jaxb/src/main/resources/loansout-common.xsd @@ -11,11 +11,9 @@ $LastChangedDate$ --> - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/location/client/pom.xml b/services/location/client/pom.xml index 966fb25490..55afa6e31f 100644 --- a/services/location/client/pom.xml +++ b/services/location/client/pom.xml @@ -51,11 +51,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/location/jaxb/pom.xml b/services/location/jaxb/pom.xml index 94bc73f7f3..1210ce8753 100644 --- a/services/location/jaxb/pom.xml +++ b/services/location/jaxb/pom.xml @@ -13,19 +13,9 @@ services.location.jaxb - - org.collectionspace.services - org.collectionspace.services.common - - - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - org.collectionspace.services org.collectionspace.services.authority.jaxb - true ${project.version} @@ -35,8 +25,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/location/jaxb/src/main/resources/location_common.xsd b/services/location/jaxb/src/main/resources/location_common.xsd index c2b6115e7c..d970443f7f 100644 --- a/services/location/jaxb/src/main/resources/location_common.xsd +++ b/services/location/jaxb/src/main/resources/location_common.xsd @@ -8,14 +8,12 @@ Used for: JAXB binding between XML and Java objects --> - @@ -88,4 +86,3 @@ - diff --git a/services/location/jaxb/src/main/resources/locationauthority_common.xsd b/services/location/jaxb/src/main/resources/locationauthority_common.xsd index 513788fc55..275371561a 100644 --- a/services/location/jaxb/src/main/resources/locationauthority_common.xsd +++ b/services/location/jaxb/src/main/resources/locationauthority_common.xsd @@ -9,15 +9,13 @@ --> - + - - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - org.collectionspace.services org.collectionspace.services.authority.jaxb - true ${project.version} @@ -49,8 +25,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/material/jaxb/src/main/resources/material_common.xsd b/services/material/jaxb/src/main/resources/material_common.xsd index 1a3448ba68..f133c6e21a 100644 --- a/services/material/jaxb/src/main/resources/material_common.xsd +++ b/services/material/jaxb/src/main/resources/material_common.xsd @@ -8,15 +8,13 @@ Used for: JAXB binding between XML and Java objects --> - + @@ -478,4 +476,4 @@ - \ No newline at end of file + diff --git a/services/material/jaxb/src/main/resources/materialauthority_common.xsd b/services/material/jaxb/src/main/resources/materialauthority_common.xsd index 2c54d79e66..631a8a0418 100644 --- a/services/material/jaxb/src/main/resources/materialauthority_common.xsd +++ b/services/material/jaxb/src/main/resources/materialauthority_common.xsd @@ -9,15 +9,13 @@ --> - + - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/movement/client/pom.xml b/services/movement/client/pom.xml index 9bbb016ea4..9ca0891569 100644 --- a/services/movement/client/pom.xml +++ b/services/movement/client/pom.xml @@ -53,11 +53,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/movement/jaxb/pom.xml b/services/movement/jaxb/pom.xml index 5c87d32935..1735fa1a0a 100644 --- a/services/movement/jaxb/pom.xml +++ b/services/movement/jaxb/pom.xml @@ -14,10 +14,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/movement/jaxb/src/main/resources/movements-common.xsd b/services/movement/jaxb/src/main/resources/movements-common.xsd index ea729d27be..3975f7a6c5 100644 --- a/services/movement/jaxb/src/main/resources/movements-common.xsd +++ b/services/movement/jaxb/src/main/resources/movements-common.xsd @@ -11,11 +11,9 @@ $LastChangedDate$ --> - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/nagpra-jaxb/pom.xml b/services/nagpra-jaxb/pom.xml index 86f1003d1e..08aa2c416b 100644 --- a/services/nagpra-jaxb/pom.xml +++ b/services/nagpra-jaxb/pom.xml @@ -16,9 +16,13 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime @@ -27,8 +31,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin diff --git a/services/nagpra-jaxb/src/main/resources/nagpra_common.xsd b/services/nagpra-jaxb/src/main/resources/nagpra_common.xsd index 0f0a775ddd..a1103aea0c 100644 --- a/services/nagpra-jaxb/src/main/resources/nagpra_common.xsd +++ b/services/nagpra-jaxb/src/main/resources/nagpra_common.xsd @@ -5,8 +5,7 @@ --> org.jboss.resteasy - resteasy-jaxrs + resteasy-client @@ -41,10 +41,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider @@ -53,9 +49,14 @@ commons-httpclient commons-httpclient + + org.glassfish.jaxb + jaxb-runtime + test + collectionspace-services-nagprainventory-client - \ No newline at end of file + diff --git a/services/nagprainventory/jaxb/pom.xml b/services/nagprainventory/jaxb/pom.xml index c8606bcbef..101bca4598 100644 --- a/services/nagprainventory/jaxb/pom.xml +++ b/services/nagprainventory/jaxb/pom.xml @@ -14,9 +14,13 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime @@ -25,9 +29,9 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin - \ No newline at end of file + diff --git a/services/nagprainventory/jaxb/src/main/resources/nagprainventory_common.xsd b/services/nagprainventory/jaxb/src/main/resources/nagprainventory_common.xsd index c17f9b9ade..447534ac08 100644 --- a/services/nagprainventory/jaxb/src/main/resources/nagprainventory_common.xsd +++ b/services/nagprainventory/jaxb/src/main/resources/nagprainventory_common.xsd @@ -10,9 +10,7 @@ - + diff --git a/services/nagprainventory/service/pom.xml b/services/nagprainventory/service/pom.xml index 931497ebf9..662e1e9334 100644 --- a/services/nagprainventory/service/pom.xml +++ b/services/nagprainventory/service/pom.xml @@ -53,7 +53,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -61,10 +61,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/note/client/pom.xml b/services/note/client/pom.xml index ada93e07a4..9528e2c7e0 100644 --- a/services/note/client/pom.xml +++ b/services/note/client/pom.xml @@ -39,11 +39,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/note/jaxb/pom.xml b/services/note/jaxb/pom.xml index f05f71e18f..d8598e0bb6 100644 --- a/services/note/jaxb/pom.xml +++ b/services/note/jaxb/pom.xml @@ -30,8 +30,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/note/service/pom.xml b/services/note/service/pom.xml index 82f9573096..051bf1f41a 100644 --- a/services/note/service/pom.xml +++ b/services/note/service/pom.xml @@ -47,11 +47,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/objectexit/client/pom.xml b/services/objectexit/client/pom.xml index d4b5c625f7..292526f5e4 100644 --- a/services/objectexit/client/pom.xml +++ b/services/objectexit/client/pom.xml @@ -52,11 +52,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/objectexit/jaxb/pom.xml b/services/objectexit/jaxb/pom.xml index 20ace344de..b59a9b9b5d 100644 --- a/services/objectexit/jaxb/pom.xml +++ b/services/objectexit/jaxb/pom.xml @@ -14,10 +14,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/objectexit/jaxb/src/main/resources/objectexit_common.xsd b/services/objectexit/jaxb/src/main/resources/objectexit_common.xsd index f6aad8a48c..ce401a8988 100644 --- a/services/objectexit/jaxb/src/main/resources/objectexit_common.xsd +++ b/services/objectexit/jaxb/src/main/resources/objectexit_common.xsd @@ -11,11 +11,9 @@ $LastChangedDate: 2010-06-02 16:03:51 -0700 (Wed, 02 Jun 2010) $ --> - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/organization/client/pom.xml b/services/organization/client/pom.xml index 9bb8676521..e254e64bc8 100644 --- a/services/organization/client/pom.xml +++ b/services/organization/client/pom.xml @@ -46,11 +46,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/organization/jaxb/pom.xml b/services/organization/jaxb/pom.xml index db829b4bd9..b26dcfdd8c 100644 --- a/services/organization/jaxb/pom.xml +++ b/services/organization/jaxb/pom.xml @@ -13,15 +13,6 @@ services.organization.jaxb - - org.collectionspace.services - org.collectionspace.services.common - - - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - org.collectionspace.services org.collectionspace.services.authority.jaxb @@ -34,8 +25,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo @@ -44,3 +35,4 @@ + diff --git a/services/organization/jaxb/src/main/resources/organization_common.xsd b/services/organization/jaxb/src/main/resources/organization_common.xsd index 37976cefdf..77665852cb 100644 --- a/services/organization/jaxb/src/main/resources/organization_common.xsd +++ b/services/organization/jaxb/src/main/resources/organization_common.xsd @@ -9,13 +9,11 @@ --> + xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" jaxb:version="3.0" + xmlns="http://collectionspace.org/services/organization" + targetNamespace="http://collectionspace.org/services/organization" + version="0.1"> diff --git a/services/organization/jaxb/src/main/resources/orgauthority_common.xsd b/services/organization/jaxb/src/main/resources/orgauthority_common.xsd index cb0a797ad4..070a381fd0 100644 --- a/services/organization/jaxb/src/main/resources/orgauthority_common.xsd +++ b/services/organization/jaxb/src/main/resources/orgauthority_common.xsd @@ -9,15 +9,13 @@ --> - + @@ -61,10 +61,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/osteology/jaxb/pom.xml b/services/osteology/jaxb/pom.xml index cad2f68a47..f2a022eb48 100644 --- a/services/osteology/jaxb/pom.xml +++ b/services/osteology/jaxb/pom.xml @@ -14,9 +14,13 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/osteology/jaxb/src/main/resources/osteology-common.xsd b/services/osteology/jaxb/src/main/resources/osteology-common.xsd index 5f6ca87d84..aef8da2c5e 100644 --- a/services/osteology/jaxb/src/main/resources/osteology-common.xsd +++ b/services/osteology/jaxb/src/main/resources/osteology-common.xsd @@ -10,9 +10,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -64,10 +64,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/person/client/pom.xml b/services/person/client/pom.xml index 4b423940fa..8d14ffc94e 100644 --- a/services/person/client/pom.xml +++ b/services/person/client/pom.xml @@ -39,6 +39,12 @@ org.collectionspace.services.contact.client ${project.version} + + org.collectionspace.services + org.collectionspace.services.authorization.jaxb + ${project.version} + test + org.testng @@ -47,11 +53,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/person/jaxb/pom.xml b/services/person/jaxb/pom.xml index e1e10aa17e..59b3cf1ecd 100644 --- a/services/person/jaxb/pom.xml +++ b/services/person/jaxb/pom.xml @@ -13,11 +13,6 @@ services.person.jaxb - - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - org.collectionspace.services org.collectionspace.services.authority.jaxb @@ -31,8 +26,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/person/jaxb/src/main/resources/person_common.xsd b/services/person/jaxb/src/main/resources/person_common.xsd index 11941acbb1..870c9e7d25 100644 --- a/services/person/jaxb/src/main/resources/person_common.xsd +++ b/services/person/jaxb/src/main/resources/person_common.xsd @@ -11,14 +11,12 @@ $LastChangedDate: $ --> - @@ -146,4 +144,3 @@ - diff --git a/services/person/jaxb/src/main/resources/personauthority_common.xsd b/services/person/jaxb/src/main/resources/personauthority_common.xsd index ec44739074..797612c129 100644 --- a/services/person/jaxb/src/main/resources/personauthority_common.xsd +++ b/services/person/jaxb/src/main/resources/personauthority_common.xsd @@ -9,15 +9,13 @@ --> - + @@ -161,4 +159,3 @@ - diff --git a/services/place/jaxb/src/main/resources/placeauthority_common.xsd b/services/place/jaxb/src/main/resources/placeauthority_common.xsd index c9a4971220..bdc64a6d48 100644 --- a/services/place/jaxb/src/main/resources/placeauthority_common.xsd +++ b/services/place/jaxb/src/main/resources/placeauthority_common.xsd @@ -9,15 +9,13 @@ --> - + cs_default generate-sources @@ -29,6 +29,7 @@ --> config + common-http common-api authentication authorization-common @@ -183,33 +184,9 @@ - org.jvnet.hyperjaxb3 - maven-hyperjaxb3-plugin - 0.6.0 - - - - generate - - - - - - bindings.xjb - - - -Xannotate - - true - true - false - garbage - - - - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin - ${maven-jaxb2-plugin.version} + org.jvnet.jaxb + jaxb-maven-plugin + ${jvnet.jaxb.version} jaxb-codegen @@ -218,57 +195,27 @@ generate - true - src/main/resources - - *.xsd - - src/main/resources - - bindings.xml - - -extension - -Xnamespace-prefix - -Xannotate - -verbose - + -XtoString -Xequals -XhashCode - + -Xnamespace-prefix - javax.xml.bind - jaxb-api - ${jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics-annotate - ${jaxb2-basics.version} - - - org.jvnet.jaxb2_commons - jaxb2-basics - ${jaxb2-basics.version} + org.jvnet.jaxb + jaxb-plugins + ${jvnet.jaxb.version} - - - org.jvnet.jaxb2_commons - jaxb2-namespace-prefix - 1.4-SNAPSHOT - - org.codehaus.mojo exec-maven-plugin - 1.1 + 3.6.3 @@ -301,39 +248,7 @@ org.apache.maven.plugins maven-javadoc-plugin - - - - - - @@ -358,7 +273,6 @@ - diff --git a/services/pottag/client/pom.xml b/services/pottag/client/pom.xml index 18cc3e5548..0fb83b1c2c 100644 --- a/services/pottag/client/pom.xml +++ b/services/pottag/client/pom.xml @@ -53,11 +53,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/pottag/jaxb/pom.xml b/services/pottag/jaxb/pom.xml index 6e23a40544..ed1dd78755 100644 --- a/services/pottag/jaxb/pom.xml +++ b/services/pottag/jaxb/pom.xml @@ -15,10 +15,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -26,8 +30,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/pottag/jaxb/src/main/resources/pottags-common.xsd b/services/pottag/jaxb/src/main/resources/pottags-common.xsd index 711ddc27da..14c9178f8b 100644 --- a/services/pottag/jaxb/src/main/resources/pottags-common.xsd +++ b/services/pottag/jaxb/src/main/resources/pottags-common.xsd @@ -11,11 +11,9 @@ $LastChangedDate$ --> - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/propagation/client/pom.xml b/services/propagation/client/pom.xml index 802774a859..20098e6196 100644 --- a/services/propagation/client/pom.xml +++ b/services/propagation/client/pom.xml @@ -51,11 +51,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/propagation/jaxb/pom.xml b/services/propagation/jaxb/pom.xml index b55be2de8b..9ec225841e 100644 --- a/services/propagation/jaxb/pom.xml +++ b/services/propagation/jaxb/pom.xml @@ -14,10 +14,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/propagation/jaxb/src/main/resources/propagations-common.xsd b/services/propagation/jaxb/src/main/resources/propagations-common.xsd index 2b98fec5ef..cf0273a07d 100644 --- a/services/propagation/jaxb/src/main/resources/propagations-common.xsd +++ b/services/propagation/jaxb/src/main/resources/propagations-common.xsd @@ -11,11 +11,9 @@ $LastChangedDate$ --> - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/publicitem/3rdparty/nuxeo-platform-cs-publicitem/src/main/resources/schemas/publicitems_common.xsd b/services/publicitem/3rdparty/nuxeo-platform-cs-publicitem/src/main/resources/schemas/publicitems_common.xsd index ecbcd3014b..4b7f816adc 100644 --- a/services/publicitem/3rdparty/nuxeo-platform-cs-publicitem/src/main/resources/schemas/publicitems_common.xsd +++ b/services/publicitem/3rdparty/nuxeo-platform-cs-publicitem/src/main/resources/schemas/publicitems_common.xsd @@ -9,13 +9,12 @@ $LastChangedDate$ --> - - + + diff --git a/services/publicitem/client/pom.xml b/services/publicitem/client/pom.xml index 5eef9a3656..20102aac25 100644 --- a/services/publicitem/client/pom.xml +++ b/services/publicitem/client/pom.xml @@ -46,11 +46,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/publicitem/jaxb/pom.xml b/services/publicitem/jaxb/pom.xml index ab3f7d5e05..a7726a9693 100644 --- a/services/publicitem/jaxb/pom.xml +++ b/services/publicitem/jaxb/pom.xml @@ -14,10 +14,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/publicitem/jaxb/src/main/resources/publicitems-common.xsd b/services/publicitem/jaxb/src/main/resources/publicitems-common.xsd index c6d874b7a1..7528cfd9e1 100644 --- a/services/publicitem/jaxb/src/main/resources/publicitems-common.xsd +++ b/services/publicitem/jaxb/src/main/resources/publicitems-common.xsd @@ -4,10 +4,10 @@ binding between XML and Java objects $LastChangedRevision$ $LastChangedDate$ --> + xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" jaxb:version="3.0" + xmlns="http://collectionspace.org/services/publicitem" + targetNamespace="http://collectionspace.org/services/publicitem" + version="0.1"> diff --git a/services/publicitem/service/pom.xml b/services/publicitem/service/pom.xml index 0538d5db7c..c043450f6a 100644 --- a/services/publicitem/service/pom.xml +++ b/services/publicitem/service/pom.xml @@ -56,11 +56,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/query/service/pom.xml b/services/query/service/pom.xml index 116181ec58..f739ff3a2c 100644 --- a/services/query/service/pom.xml +++ b/services/query/service/pom.xml @@ -32,11 +32,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/relation/client/pom.xml b/services/relation/client/pom.xml index 96e89ab949..c85a18e729 100644 --- a/services/relation/client/pom.xml +++ b/services/relation/client/pom.xml @@ -46,11 +46,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/relation/service/pom.xml b/services/relation/service/pom.xml index 5477f11faa..f02d595847 100644 --- a/services/relation/service/pom.xml +++ b/services/relation/service/pom.xml @@ -88,11 +88,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/relation/service/src/main/java/org/collectionspace/services/relation/RelationResource.txt b/services/relation/service/src/main/java/org/collectionspace/services/relation/RelationResource.txt deleted file mode 100644 index d3a70a756a..0000000000 --- a/services/relation/service/src/main/java/org/collectionspace/services/relation/RelationResource.txt +++ /dev/null @@ -1,3 +0,0 @@ -Because of a dependency cycle with the "Common" module, the RelationResource class was moved to the "Common" module at: - -..\services\common\src\main\java\org\collectionspace\services\common\relation \ No newline at end of file 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 f512f27714..fa296be087 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 @@ -58,10 +58,10 @@ import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; import org.collectionspace.services.nuxeo.client.java.NuxeoRepositoryClientImpl; -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.api.NuxeoException; +import org.nuxeo.ecm.core.api.PropertyException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -514,7 +514,7 @@ private void populateSubjectOrObjectValues( RelationJAXBSchema.SUBJECT_REFNAME :RelationJAXBSchema.OBJECT_REFNAME), refname); - } catch (ClientException ce) { + } catch (NuxeoException ce) { throw new RuntimeException( "populateSubjectOrObjectValues: Problem fetching field " + ce.getLocalizedMessage()); } @@ -523,7 +523,7 @@ private void populateSubjectOrObjectValues( // property values in the target document model. try { relationDocModel.setProperties(ctx.getCommonPartLabel(), properties); - } catch (ClientException ce) { + } catch (NuxeoException ce) { throw new RuntimeException( "populateSubjectValues: Problem setting fields " + ce.getLocalizedMessage()); } diff --git a/services/repatriationrequest/client/pom.xml b/services/repatriationrequest/client/pom.xml index aa3b731c34..c1719269c0 100644 --- a/services/repatriationrequest/client/pom.xml +++ b/services/repatriationrequest/client/pom.xml @@ -32,7 +32,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client @@ -41,10 +41,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider @@ -53,9 +49,14 @@ commons-httpclient commons-httpclient + + org.glassfish.jaxb + jaxb-runtime + test + collectionspace-services-repatriationrequest-client - \ No newline at end of file + diff --git a/services/repatriationrequest/jaxb/pom.xml b/services/repatriationrequest/jaxb/pom.xml index d61ef620da..f7435d2b78 100644 --- a/services/repatriationrequest/jaxb/pom.xml +++ b/services/repatriationrequest/jaxb/pom.xml @@ -13,11 +13,6 @@ services.repatriationrequest.jaxb - - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - org.collectionspace.services org.collectionspace.services.nagpra-jaxb @@ -30,9 +25,9 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin - \ No newline at end of file + diff --git a/services/repatriationrequest/jaxb/src/main/resources/repatriationrequests_common.xsd b/services/repatriationrequest/jaxb/src/main/resources/repatriationrequests_common.xsd index 58c864617e..7c116c8254 100644 --- a/services/repatriationrequest/jaxb/src/main/resources/repatriationrequests_common.xsd +++ b/services/repatriationrequest/jaxb/src/main/resources/repatriationrequests_common.xsd @@ -10,10 +10,8 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -65,10 +65,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider @@ -90,4 +86,4 @@ collectionspace-services-repatriationrequest - \ No newline at end of file + diff --git a/services/report/client/pom.xml b/services/report/client/pom.xml index c14b8d6353..53de0cf1d8 100644 --- a/services/report/client/pom.xml +++ b/services/report/client/pom.xml @@ -61,11 +61,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/report/jaxb/pom.xml b/services/report/jaxb/pom.xml index 6ee0189ac4..06bebdfeeb 100644 --- a/services/report/jaxb/pom.xml +++ b/services/report/jaxb/pom.xml @@ -25,8 +25,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/report/jaxb/src/main/resources/reports-common.xsd b/services/report/jaxb/src/main/resources/reports-common.xsd index c3ee01df5b..9b09ba5c86 100644 --- a/services/report/jaxb/src/main/resources/reports-common.xsd +++ b/services/report/jaxb/src/main/resources/reports-common.xsd @@ -11,14 +11,12 @@ $LastChangedDate: 2010-06-16 14:47:45 -0700 (Wed, 16 Jun 2010) $ --> - - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/report/service/src/main/java/org/collectionspace/services/report/jasperreports/CSpaceRepositoryService.java b/services/report/service/src/main/java/org/collectionspace/services/report/jasperreports/CSpaceRepositoryService.java index bb29da9826..6dd6c02e13 100644 --- a/services/report/service/src/main/java/org/collectionspace/services/report/jasperreports/CSpaceRepositoryService.java +++ b/services/report/service/src/main/java/org/collectionspace/services/report/jasperreports/CSpaceRepositoryService.java @@ -59,7 +59,7 @@ private InputStreamResource getCSpaceResource(String resourcePath) { private InputStreamResource getMediaContentResource(String mediaCsid, String derivative) { if (StringUtils.isNotEmpty(mediaCsid) && StringUtils.isNotEmpty(derivative)) { - ResourceMap resourceMap = ResteasyProviderFactory.getContextData(ResourceMap.class); + ResourceMap resourceMap = ResteasyProviderFactory.getInstance().getContextData(ResourceMap.class); MediaResource mediaResource = (MediaResource) resourceMap.get(MediaClient.SERVICE_NAME); InputStream contentStream = null; 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 b4fe5bc0e2..d93ed0e715 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 @@ -104,7 +104,7 @@ import org.collectionspace.services.report.ResourceActionGroup; import org.collectionspace.services.report.ResourceActionGroupList; import org.nuxeo.ecm.core.api.DocumentModel; -import org.nuxeo.ecm.core.api.model.PropertyException; +import org.nuxeo.ecm.core.api.PropertyException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/services/restrictedmedia/client/pom.xml b/services/restrictedmedia/client/pom.xml index 2ccb0db6f1..ff91c09f5b 100644 --- a/services/restrictedmedia/client/pom.xml +++ b/services/restrictedmedia/client/pom.xml @@ -54,7 +54,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -62,10 +62,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/restrictedmedia/jaxb/pom.xml b/services/restrictedmedia/jaxb/pom.xml index b0acaec097..9278b974f4 100644 --- a/services/restrictedmedia/jaxb/pom.xml +++ b/services/restrictedmedia/jaxb/pom.xml @@ -14,9 +14,13 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime @@ -25,9 +29,9 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin - \ No newline at end of file + diff --git a/services/restrictedmedia/jaxb/src/main/resources/restrictedmedia_common.xsd b/services/restrictedmedia/jaxb/src/main/resources/restrictedmedia_common.xsd index aed21ba74f..7dc3517f4b 100644 --- a/services/restrictedmedia/jaxb/src/main/resources/restrictedmedia_common.xsd +++ b/services/restrictedmedia/jaxb/src/main/resources/restrictedmedia_common.xsd @@ -9,8 +9,7 @@ --> - + diff --git a/services/restrictedmedia/service/pom.xml b/services/restrictedmedia/service/pom.xml index 6a6530f22d..0775b6a11d 100644 --- a/services/restrictedmedia/service/pom.xml +++ b/services/restrictedmedia/service/pom.xml @@ -68,7 +68,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -76,10 +76,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/security/client/pom.xml b/services/security/client/pom.xml index e7dee9f82c..fcbd881339 100644 --- a/services/security/client/pom.xml +++ b/services/security/client/pom.xml @@ -57,11 +57,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy @@ -81,25 +77,5 @@ cspace-services-security-client - - - maven-antrun-plugin - - - subs-hibernate-config - generate-test-resources - - run - - - - - - - - - - - diff --git a/services/security/client/src/test/resources/META-INF/persistence.xml b/services/security/client/src/test/resources/META-INF/persistence.xml deleted file mode 100644 index 9577e73190..0000000000 --- a/services/security/client/src/test/resources/META-INF/persistence.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - org.collectionspace.services.authentication.User - org.collectionspace.services.authorization.Role - - - - - - - diff --git a/services/security/client/src/test/resources/hibernate.cfg.xml b/services/security/client/src/test/resources/hibernate.cfg.xml deleted file mode 100644 index eb577d2288..0000000000 --- a/services/security/client/src/test/resources/hibernate.cfg.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - @DB_CSPACE_URL@ - @DB_DRIVER_CLASS@ - @DB_CSPACE_USER@ - @DB_CSPACE_PASSWORD@ - @DB_DIALECT@ - org.hibernate.transaction.JDBCTransactionFactory - thread - true - - diff --git a/services/servicegroup/client/pom.xml b/services/servicegroup/client/pom.xml index 14f5d3db5a..d5ab5d5477 100644 --- a/services/servicegroup/client/pom.xml +++ b/services/servicegroup/client/pom.xml @@ -41,11 +41,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/servicegroup/jaxb/pom.xml b/services/servicegroup/jaxb/pom.xml index cc8e9c51a0..49e0761563 100644 --- a/services/servicegroup/jaxb/pom.xml +++ b/services/servicegroup/jaxb/pom.xml @@ -15,10 +15,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -26,8 +30,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/servicegroup/jaxb/src/main/resources/servicegroup_common.xsd b/services/servicegroup/jaxb/src/main/resources/servicegroup_common.xsd index 42a6695514..92e00dcbe6 100644 --- a/services/servicegroup/jaxb/src/main/resources/servicegroup_common.xsd +++ b/services/servicegroup/jaxb/src/main/resources/servicegroup_common.xsd @@ -13,8 +13,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/structureddate/client/pom.xml b/services/structureddate/client/pom.xml index 278020446e..fc768741a5 100644 --- a/services/structureddate/client/pom.xml +++ b/services/structureddate/client/pom.xml @@ -39,11 +39,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client diff --git a/services/structureddate/jaxb/pom.xml b/services/structureddate/jaxb/pom.xml index 2518f5bc22..56627f5e2c 100644 --- a/services/structureddate/jaxb/pom.xml +++ b/services/structureddate/jaxb/pom.xml @@ -14,10 +14,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/structureddate/jaxb/src/main/resources/structureddate-common.xsd b/services/structureddate/jaxb/src/main/resources/structureddate-common.xsd index 7d05df2e9c..212e08a981 100644 --- a/services/structureddate/jaxb/src/main/resources/structureddate-common.xsd +++ b/services/structureddate/jaxb/src/main/resources/structureddate-common.xsd @@ -10,9 +10,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/summarydocumentation/client/pom.xml b/services/summarydocumentation/client/pom.xml index ed83674252..906798179e 100644 --- a/services/summarydocumentation/client/pom.xml +++ b/services/summarydocumentation/client/pom.xml @@ -32,7 +32,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client @@ -43,15 +43,16 @@ org.jboss.resteasy - resteasy-jaxb-provider + resteasy-multipart-provider - org.jboss.resteasy - resteasy-multipart-provider + org.glassfish.jaxb + jaxb-runtime + test collectionspace-services-summarydocumentation-client - \ No newline at end of file + diff --git a/services/summarydocumentation/jaxb/pom.xml b/services/summarydocumentation/jaxb/pom.xml index 1e27981d80..7130c3928b 100644 --- a/services/summarydocumentation/jaxb/pom.xml +++ b/services/summarydocumentation/jaxb/pom.xml @@ -13,11 +13,6 @@ services.summarydocumentation.jaxb - - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - org.collectionspace.services org.collectionspace.services.nagpra-jaxb @@ -30,9 +25,9 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin - \ No newline at end of file + diff --git a/services/summarydocumentation/jaxb/src/main/resources/summarydocumentations_common.xsd b/services/summarydocumentation/jaxb/src/main/resources/summarydocumentations_common.xsd index 0855f2e30b..ec8c57b0d5 100644 --- a/services/summarydocumentation/jaxb/src/main/resources/summarydocumentations_common.xsd +++ b/services/summarydocumentation/jaxb/src/main/resources/summarydocumentations_common.xsd @@ -10,8 +10,7 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -60,10 +60,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/systeminfo/client/pom.xml b/services/systeminfo/client/pom.xml index 8d200e0fbd..c625004a8b 100644 --- a/services/systeminfo/client/pom.xml +++ b/services/systeminfo/client/pom.xml @@ -34,11 +34,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client diff --git a/services/systeminfo/jaxb/pom.xml b/services/systeminfo/jaxb/pom.xml index 8b91cc996a..a70bd83495 100644 --- a/services/systeminfo/jaxb/pom.xml +++ b/services/systeminfo/jaxb/pom.xml @@ -14,10 +14,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/systeminfo/jaxb/src/main/resources/systeminfo-common.xsd b/services/systeminfo/jaxb/src/main/resources/systeminfo-common.xsd index d35336f9e0..489eaa2b76 100644 --- a/services/systeminfo/jaxb/src/main/resources/systeminfo-common.xsd +++ b/services/systeminfo/jaxb/src/main/resources/systeminfo-common.xsd @@ -9,14 +9,12 @@ --> - @@ -104,4 +102,3 @@ - diff --git a/services/taxonomy/jaxb/src/main/resources/taxonomyauthority_common.xsd b/services/taxonomy/jaxb/src/main/resources/taxonomyauthority_common.xsd index 7417bedd4d..6f123c3229 100644 --- a/services/taxonomy/jaxb/src/main/resources/taxonomyauthority_common.xsd +++ b/services/taxonomy/jaxb/src/main/resources/taxonomyauthority_common.xsd @@ -9,15 +9,13 @@ --> - + @@ -61,10 +61,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/transport/jaxb/pom.xml b/services/transport/jaxb/pom.xml index ba80ae541c..32affaf66b 100644 --- a/services/transport/jaxb/pom.xml +++ b/services/transport/jaxb/pom.xml @@ -14,9 +14,13 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin diff --git a/services/transport/jaxb/src/main/resources/transports-common.xsd b/services/transport/jaxb/src/main/resources/transports-common.xsd index 5084ed8c5b..9bbd4f85cb 100644 --- a/services/transport/jaxb/src/main/resources/transports-common.xsd +++ b/services/transport/jaxb/src/main/resources/transports-common.xsd @@ -10,8 +10,8 @@ org.jboss.resteasy - resteasy-jaxrs + resteasy-client tjws @@ -66,10 +66,6 @@ - - org.jboss.resteasy - resteasy-jaxb-provider - org.jboss.resteasy resteasy-multipart-provider diff --git a/services/uoc/client/pom.xml b/services/uoc/client/pom.xml index 05e8bd37a1..98c8f22b9a 100644 --- a/services/uoc/client/pom.xml +++ b/services/uoc/client/pom.xml @@ -51,11 +51,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/uoc/jaxb/pom.xml b/services/uoc/jaxb/pom.xml index 7da14c652a..de61702f48 100644 --- a/services/uoc/jaxb/pom.xml +++ b/services/uoc/jaxb/pom.xml @@ -14,10 +14,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -25,8 +29,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/uoc/jaxb/src/main/resources/uoc-common.xsd b/services/uoc/jaxb/src/main/resources/uoc-common.xsd index e82423553b..8b00cbad66 100644 --- a/services/uoc/jaxb/src/main/resources/uoc-common.xsd +++ b/services/uoc/jaxb/src/main/resources/uoc-common.xsd @@ -11,11 +11,9 @@ $LastChangedDate: 2018-05-02 16:03:51 -0700 (Wed, 02 Jun 2010) $ --> - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/valuationcontrol/client/pom.xml b/services/valuationcontrol/client/pom.xml index 55372ae4b0..ea93fc2b85 100644 --- a/services/valuationcontrol/client/pom.xml +++ b/services/valuationcontrol/client/pom.xml @@ -52,11 +52,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/valuationcontrol/jaxb/pom.xml b/services/valuationcontrol/jaxb/pom.xml index 8aacc9883d..ff6abd9317 100644 --- a/services/valuationcontrol/jaxb/pom.xml +++ b/services/valuationcontrol/jaxb/pom.xml @@ -15,10 +15,14 @@ - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + jakarta.xml.bind + jakarta.xml.bind-api + + + + org.jvnet.jaxb + jaxb-plugins-runtime + @@ -26,8 +30,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/valuationcontrol/jaxb/src/main/resources/Valuationcontrols-common.xsd b/services/valuationcontrol/jaxb/src/main/resources/Valuationcontrols-common.xsd index 71764e02cd..1c0ae2e9df 100644 --- a/services/valuationcontrol/jaxb/src/main/resources/Valuationcontrols-common.xsd +++ b/services/valuationcontrol/jaxb/src/main/resources/Valuationcontrols-common.xsd @@ -8,11 +8,9 @@ Used for: JAXB binding between XML and Java objects --> - org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/vocabulary/client/pom.xml b/services/vocabulary/client/pom.xml index 88bfddf698..8db995c3ef 100644 --- a/services/vocabulary/client/pom.xml +++ b/services/vocabulary/client/pom.xml @@ -43,11 +43,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/vocabulary/jaxb/pom.xml b/services/vocabulary/jaxb/pom.xml index 7f96d589c2..0fc4b4fca1 100644 --- a/services/vocabulary/jaxb/pom.xml +++ b/services/vocabulary/jaxb/pom.xml @@ -13,25 +13,23 @@ services.vocabulary.jaxb - - org.collectionspace.services - org.collectionspace.services.common + jakarta.xml.bind + jakarta.xml.bind-api - + - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - + org.jvnet.jaxb + jaxb-plugins-runtime + collectionspace-services-vocabulary-jaxb install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/vocabulary/jaxb/src/main/resources/vocabulary_common.xsd b/services/vocabulary/jaxb/src/main/resources/vocabulary_common.xsd index 48b5433284..0cbffef362 100644 --- a/services/vocabulary/jaxb/src/main/resources/vocabulary_common.xsd +++ b/services/vocabulary/jaxb/src/main/resources/vocabulary_common.xsd @@ -9,15 +9,13 @@ --> - + @@ -35,4 +33,3 @@ - diff --git a/services/vocabulary/service/pom.xml b/services/vocabulary/service/pom.xml index 6b13d244df..7df3feda03 100644 --- a/services/vocabulary/service/pom.xml +++ b/services/vocabulary/service/pom.xml @@ -69,11 +69,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java b/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java index ae371b36a1..30f2ad5ff9 100644 --- a/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java +++ b/services/vocabulary/service/src/main/java/org/collectionspace/services/vocabulary/VocabularyResource.java @@ -23,6 +23,21 @@ */ package org.collectionspace.services.vocabulary; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MultivaluedMap; +import javax.ws.rs.core.Request; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import javax.ws.rs.core.UriInfo; + import org.collectionspace.services.client.IClientQueryParams; import org.collectionspace.services.client.PayloadInputPart; import org.collectionspace.services.client.PoxPayload; @@ -60,24 +75,6 @@ import org.slf4j.LoggerFactory; import org.w3c.dom.Element; -import java.util.ArrayList; -import java.util.Base64; -import java.util.HashSet; -import java.util.Set; - -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; -import javax.ws.rs.core.Context; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.Request; -import javax.ws.rs.core.Response; -import javax.ws.rs.core.UriBuilder; -import javax.ws.rs.core.UriInfo; -import javax.xml.bind.DatatypeConverter; - @Path("/" + VocabularyClient.SERVICE_PATH_COMPONENT) public class VocabularyResource extends AuthorityResource { @@ -86,12 +83,12 @@ private enum Method { POST, PUT; } - private final static String vocabularyServiceName = VocabularyClient.SERVICE_PATH_COMPONENT; + private static final String vocabularyServiceName = VocabularyClient.SERVICE_PATH_COMPONENT; - private final static String VOCABULARIES_COMMON = "vocabularies_common"; + private static final String VOCABULARIES_COMMON = "vocabularies_common"; - private final static String vocabularyItemServiceName = "vocabularyitems"; - private final static String VOCABULARYITEMS_COMMON = "vocabularyitems_common"; + private static final String vocabularyItemServiceName = "vocabularyitems"; + private static final String VOCABULARYITEMS_COMMON = "vocabularyitems_common"; final Logger logger = LoggerFactory.getLogger(VocabularyResource.class); diff --git a/services/work/client/pom.xml b/services/work/client/pom.xml index 1755a5ff05..c790d5a582 100644 --- a/services/work/client/pom.xml +++ b/services/work/client/pom.xml @@ -47,11 +47,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/work/jaxb/pom.xml b/services/work/jaxb/pom.xml index 487c989c23..ce12cbd47b 100644 --- a/services/work/jaxb/pom.xml +++ b/services/work/jaxb/pom.xml @@ -13,19 +13,6 @@ services.work.jaxb - - org.collectionspace.services - org.collectionspace.services.common - - - com.sun.xml.bind - jaxb-core - - - org.collectionspace.services - org.collectionspace.services.jaxb - ${project.version} - org.collectionspace.services org.collectionspace.services.authority.jaxb @@ -39,8 +26,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/work/jaxb/src/main/resources/work_common.xsd b/services/work/jaxb/src/main/resources/work_common.xsd index cfa95363b0..dbfc7e49f3 100644 --- a/services/work/jaxb/src/main/resources/work_common.xsd +++ b/services/work/jaxb/src/main/resources/work_common.xsd @@ -1,13 +1,11 @@ - + diff --git a/services/work/jaxb/src/main/resources/workauthority_common.xsd b/services/work/jaxb/src/main/resources/workauthority_common.xsd index ce4beadad8..0f1e458784 100644 --- a/services/work/jaxb/src/main/resources/workauthority_common.xsd +++ b/services/work/jaxb/src/main/resources/workauthority_common.xsd @@ -9,15 +9,13 @@ --> - + - - jaxb service diff --git a/services/work/service/pom.xml b/services/work/service/pom.xml index 6f43e809b1..7150914ee6 100644 --- a/services/work/service/pom.xml +++ b/services/work/service/pom.xml @@ -64,11 +64,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/workflow/client/pom.xml b/services/workflow/client/pom.xml index e4c171da45..701ea63f5f 100644 --- a/services/workflow/client/pom.xml +++ b/services/workflow/client/pom.xml @@ -41,11 +41,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy diff --git a/services/workflow/jaxb/pom.xml b/services/workflow/jaxb/pom.xml index a477e6518a..61e70f3501 100644 --- a/services/workflow/jaxb/pom.xml +++ b/services/workflow/jaxb/pom.xml @@ -25,8 +25,8 @@ install - org.jvnet.jaxb2.maven2 - maven-jaxb2-plugin + org.jvnet.jaxb + jaxb-maven-plugin org.codehaus.mojo diff --git a/services/workflow/service/pom.xml b/services/workflow/service/pom.xml index 41065d72dd..627496a374 100644 --- a/services/workflow/service/pom.xml +++ b/services/workflow/service/pom.xml @@ -50,11 +50,7 @@ org.jboss.resteasy - resteasy-jaxrs - - - org.jboss.resteasy - resteasy-jaxb-provider + resteasy-client org.jboss.resteasy From 558b858a5614a70abcace98ac2433f6de53099ec Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Mon, 8 Jun 2026 11:59:54 +0300 Subject: [PATCH 13/40] DRYD-2073: Add home location to collectionobject schema and advanced search; --- .../model/HomeLocationListModel.java | 32 +++++++++++++++++++ .../main/resources/advanced-search_common.xsd | 7 ++++ .../advancedsearch/AdvancedSearch.java | 2 +- .../mapper/CollectionObjectMapper.java | 2 ++ .../resources/collectionobjects_common.xsd | 14 ++++++++ 5 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 services/advancedsearch/jaxb/src/main/java/org/collectionspace/services/advancedsearch/model/HomeLocationListModel.java diff --git a/services/advancedsearch/jaxb/src/main/java/org/collectionspace/services/advancedsearch/model/HomeLocationListModel.java b/services/advancedsearch/jaxb/src/main/java/org/collectionspace/services/advancedsearch/model/HomeLocationListModel.java new file mode 100644 index 0000000000..93e75d5b2b --- /dev/null +++ b/services/advancedsearch/jaxb/src/main/java/org/collectionspace/services/advancedsearch/model/HomeLocationListModel.java @@ -0,0 +1,32 @@ +package org.collectionspace.services.advancedsearch.model; + +import java.util.List; +import java.util.stream.Collectors; + +import org.collectionspace.services.advancedsearch.HomeLocations; +import org.collectionspace.services.advancedsearch.ObjectFactory; +import org.collectionspace.services.collectionobject.CollectionobjectsCommon; +import org.collectionspace.services.collectionobject.HomeLocationGroup; + +public class HomeLocationListModel { + + public static HomeLocations homeLocationList(CollectionobjectsCommon collectionObject) { + HomeLocations homeLocations = null; + final ObjectFactory objectFactory = new ObjectFactory(); + + if (collectionObject != null && collectionObject.getHomeLocationGroupList() != null) { + List locations = collectionObject.getHomeLocationGroupList().getHomeLocationGroup().stream() + .filter(group -> group != null && group.getHomeLocation() != null + && !group.getHomeLocation().isEmpty()) + .map(HomeLocationGroup::getHomeLocation) + .collect(Collectors.toList()); + + if (!locations.isEmpty()) { + homeLocations = objectFactory.createHomeLocations(); + homeLocations.getHomeLocation().addAll(locations); + } + } + + return homeLocations; + } +} diff --git a/services/advancedsearch/jaxb/src/main/resources/advanced-search_common.xsd b/services/advancedsearch/jaxb/src/main/resources/advanced-search_common.xsd index 8c81557dc3..5260e948bf 100644 --- a/services/advancedsearch/jaxb/src/main/resources/advanced-search_common.xsd +++ b/services/advancedsearch/jaxb/src/main/resources/advanced-search_common.xsd @@ -37,6 +37,12 @@ + + + + + + @@ -55,6 +61,7 @@ + diff --git a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java index 6104dc5bc9..f1e5f84474 100644 --- a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java +++ b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java @@ -45,7 +45,7 @@ public class AdvancedSearch extends AbstractCollectionSpaceResourceImpl { // FIXME: it's not great to hardcode either of these - private static final String FIELDS_RETURNED = "uri|csid|refName|blobCsid|updatedAt|objectId|objectNumber|objectName|title|computedCurrentLocation|responsibleDepartments|responsibleDepartment|contentConcepts|briefDescription"; + private static final String FIELDS_RETURNED = "uri|csid|refName|blobCsid|updatedAt|objectId|objectNumber|objectName|title|computedCurrentLocation|homeLocationGroupList|homeLocations|responsibleDepartments|responsibleDepartment|contentConcepts|briefDescription"; private final Logger logger = LoggerFactory.getLogger(AdvancedSearch.class); private final CollectionObjectResource cor = new CollectionObjectResource(); diff --git a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/mapper/CollectionObjectMapper.java b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/mapper/CollectionObjectMapper.java index b0d99b3aa7..70d6e9df4a 100644 --- a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/mapper/CollectionObjectMapper.java +++ b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/mapper/CollectionObjectMapper.java @@ -17,6 +17,7 @@ import org.collectionspace.services.advancedsearch.model.BriefDescriptionListModel; import org.collectionspace.services.advancedsearch.model.ContentConceptListModel; import org.collectionspace.services.advancedsearch.model.FieldCollectionModel; +import org.collectionspace.services.advancedsearch.model.HomeLocationListModel; import org.collectionspace.services.advancedsearch.model.MaterialModel; import org.collectionspace.services.advancedsearch.model.NAGPRACategoryModel; import org.collectionspace.services.advancedsearch.model.ObjectNameListModel; @@ -111,6 +112,7 @@ public AdvancedsearchListItem asListItem(final CSDocumentModelResponse response, item.setBriefDescription(BriefDescriptionListModel.briefDescriptionListToDisplayString( collectionObject.getBriefDescriptions())); item.setComputedCurrentLocation(collectionObject.getComputedCurrentLocation()); + item.setHomeLocations(HomeLocationListModel.homeLocationList(collectionObject)); item.setTitle(TitleGroupListModel.titleGroupListToDisplayString(collectionObject.getTitleGroupList())); item.setResponsibleDepartment( diff --git a/services/collectionobject/jaxb/src/main/resources/collectionobjects_common.xsd b/services/collectionobject/jaxb/src/main/resources/collectionobjects_common.xsd index 11d81b177c..a79ed9b0dc 100644 --- a/services/collectionobject/jaxb/src/main/resources/collectionobjects_common.xsd +++ b/services/collectionobject/jaxb/src/main/resources/collectionobjects_common.xsd @@ -49,6 +49,7 @@ + @@ -463,6 +464,19 @@ + + + + + + + + + + + + Date: Mon, 8 Jun 2026 12:05:02 +0300 Subject: [PATCH 14/40] DRYD-2073: Updated Changelog; --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d93ac4ddb7..0c9e4f676d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CollectionSpace Services Changelog +## 9.0.0 +* Add home location to collectionobject schema and advanced search + ## 8.3.0 * Add new endpoint for returning search results From 30dc2ff40a787b0aaf7371c5f5e9ee7cd7a557a6 Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Mon, 8 Jun 2026 15:47:22 +0300 Subject: [PATCH 15/40] DRYD-2073: code cosmetic; --- .../collectionspace/services/advancedsearch/AdvancedSearch.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java index f1e5f84474..edfd735f14 100644 --- a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java +++ b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java @@ -45,7 +45,7 @@ public class AdvancedSearch extends AbstractCollectionSpaceResourceImpl { // FIXME: it's not great to hardcode either of these - private static final String FIELDS_RETURNED = "uri|csid|refName|blobCsid|updatedAt|objectId|objectNumber|objectName|title|computedCurrentLocation|homeLocationGroupList|homeLocations|responsibleDepartments|responsibleDepartment|contentConcepts|briefDescription"; + private static final String FIELDS_RETURNED = "uri|csid|refName|blobCsid|updatedAt|objectId|objectNumber|objectName|title|computedCurrentLocation|homeLocations|responsibleDepartments|responsibleDepartment|contentConcepts|briefDescription"; private final Logger logger = LoggerFactory.getLogger(AdvancedSearch.class); private final CollectionObjectResource cor = new CollectionObjectResource(); From 438d272dedf39f5ae9602093c254b8e5b909cabd Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Thu, 11 Jun 2026 21:55:05 +0300 Subject: [PATCH 16/40] NO-ISSUE: Exclude itext's legacy BouncyCastle jars to fix WAR deployment --- services/report/pom.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/services/report/pom.xml b/services/report/pom.xml index d0f4baa21b..a4ba172548 100644 --- a/services/report/pom.xml +++ b/services/report/pom.xml @@ -59,6 +59,16 @@ com.lowagie itext 2.1.7 + + + bouncycastle + * + + + org.bouncycastle + * + + From eb384369c76f6e85176aaaffacc5adaf33afcf9e Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Thu, 18 Jun 2026 16:16:50 -0600 Subject: [PATCH 17/40] DRYD-2090: Updates to Nuxeo Deployment (#539) * Move nuxeo config to 2023 folder * Add Nuxeo Mail Service Config * Remove login config * Update build properties --- .../config/convert-config.xml | 0 .../config/default-smtp-sender-config.xml | 20 +++++++++ .../disable-picture-listener-config.xml | 0 .../elasticsearch-classreplacer-config.xml | 0 .../config/logmanager-config.xml | 0 .../config/nuxeo-container.properties | 0 .../config/nuxeo.properties | 0 .../config/proto-datasource-config.xml | 0 .../config/proto-elasticsearch-config.xml | 0 .../config/proto-elasticsearch-extension.xml | 0 .../config/proto-repo-config.xml | 0 .../config/s3binarymanager.properties | 0 .../config/trashservice-config.xml | 0 .../config/vcsconfig.sql.txt | 0 .../{9.10-HF30 => 2023}/launcher.properties | 0 .../{9.10-HF30 => 2023}/system.properties | 0 .../9.10-HF30/config/login-config.xml | 45 ------------------- build.properties | 16 +------ 18 files changed, 22 insertions(+), 59 deletions(-) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/config/convert-config.xml (100%) create mode 100644 3rdparty/nuxeo/nuxeo-server/2023/config/default-smtp-sender-config.xml rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/config/disable-picture-listener-config.xml (100%) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/config/elasticsearch-classreplacer-config.xml (100%) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/config/logmanager-config.xml (100%) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/config/nuxeo-container.properties (100%) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/config/nuxeo.properties (100%) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/config/proto-datasource-config.xml (100%) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/config/proto-elasticsearch-config.xml (100%) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/config/proto-elasticsearch-extension.xml (100%) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/config/proto-repo-config.xml (100%) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/config/s3binarymanager.properties (100%) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/config/trashservice-config.xml (100%) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/config/vcsconfig.sql.txt (100%) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/launcher.properties (100%) rename 3rdparty/nuxeo/nuxeo-server/{9.10-HF30 => 2023}/system.properties (100%) delete mode 100644 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/login-config.xml diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/convert-config.xml b/3rdparty/nuxeo/nuxeo-server/2023/config/convert-config.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/convert-config.xml rename to 3rdparty/nuxeo/nuxeo-server/2023/config/convert-config.xml diff --git a/3rdparty/nuxeo/nuxeo-server/2023/config/default-smtp-sender-config.xml b/3rdparty/nuxeo/nuxeo-server/2023/config/default-smtp-sender-config.xml new file mode 100644 index 0000000000..b111a392bd --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-server/2023/config/default-smtp-sender-config.xml @@ -0,0 +1,20 @@ + + + org.nuxeo.mail.MailServiceComponent + + + + + java:comp/env/Mail + + + + + + noreply@collectionspace.org + + + + diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/disable-picture-listener-config.xml b/3rdparty/nuxeo/nuxeo-server/2023/config/disable-picture-listener-config.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/disable-picture-listener-config.xml rename to 3rdparty/nuxeo/nuxeo-server/2023/config/disable-picture-listener-config.xml diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/elasticsearch-classreplacer-config.xml b/3rdparty/nuxeo/nuxeo-server/2023/config/elasticsearch-classreplacer-config.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/elasticsearch-classreplacer-config.xml rename to 3rdparty/nuxeo/nuxeo-server/2023/config/elasticsearch-classreplacer-config.xml diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/logmanager-config.xml b/3rdparty/nuxeo/nuxeo-server/2023/config/logmanager-config.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/logmanager-config.xml rename to 3rdparty/nuxeo/nuxeo-server/2023/config/logmanager-config.xml diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/nuxeo-container.properties b/3rdparty/nuxeo/nuxeo-server/2023/config/nuxeo-container.properties similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/nuxeo-container.properties rename to 3rdparty/nuxeo/nuxeo-server/2023/config/nuxeo-container.properties diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/nuxeo.properties b/3rdparty/nuxeo/nuxeo-server/2023/config/nuxeo.properties similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/nuxeo.properties rename to 3rdparty/nuxeo/nuxeo-server/2023/config/nuxeo.properties diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/proto-datasource-config.xml b/3rdparty/nuxeo/nuxeo-server/2023/config/proto-datasource-config.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/proto-datasource-config.xml rename to 3rdparty/nuxeo/nuxeo-server/2023/config/proto-datasource-config.xml diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/proto-elasticsearch-config.xml b/3rdparty/nuxeo/nuxeo-server/2023/config/proto-elasticsearch-config.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/proto-elasticsearch-config.xml rename to 3rdparty/nuxeo/nuxeo-server/2023/config/proto-elasticsearch-config.xml diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/proto-elasticsearch-extension.xml b/3rdparty/nuxeo/nuxeo-server/2023/config/proto-elasticsearch-extension.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/proto-elasticsearch-extension.xml rename to 3rdparty/nuxeo/nuxeo-server/2023/config/proto-elasticsearch-extension.xml diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/proto-repo-config.xml b/3rdparty/nuxeo/nuxeo-server/2023/config/proto-repo-config.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/proto-repo-config.xml rename to 3rdparty/nuxeo/nuxeo-server/2023/config/proto-repo-config.xml diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/s3binarymanager.properties b/3rdparty/nuxeo/nuxeo-server/2023/config/s3binarymanager.properties similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/s3binarymanager.properties rename to 3rdparty/nuxeo/nuxeo-server/2023/config/s3binarymanager.properties diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/trashservice-config.xml b/3rdparty/nuxeo/nuxeo-server/2023/config/trashservice-config.xml similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/trashservice-config.xml rename to 3rdparty/nuxeo/nuxeo-server/2023/config/trashservice-config.xml diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/vcsconfig.sql.txt b/3rdparty/nuxeo/nuxeo-server/2023/config/vcsconfig.sql.txt similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/vcsconfig.sql.txt rename to 3rdparty/nuxeo/nuxeo-server/2023/config/vcsconfig.sql.txt diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/launcher.properties b/3rdparty/nuxeo/nuxeo-server/2023/launcher.properties similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/launcher.properties rename to 3rdparty/nuxeo/nuxeo-server/2023/launcher.properties diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/system.properties b/3rdparty/nuxeo/nuxeo-server/2023/system.properties similarity index 100% rename from 3rdparty/nuxeo/nuxeo-server/9.10-HF30/system.properties rename to 3rdparty/nuxeo/nuxeo-server/2023/system.properties diff --git a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/login-config.xml b/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/login-config.xml deleted file mode 100644 index d63b7330b7..0000000000 --- a/3rdparty/nuxeo/nuxeo-server/9.10-HF30/config/login-config.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - Login modules used on JBoss - @author Bogdan Stefanescu (bs@nuxeo.com) - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build.properties b/build.properties index a8a452b9eb..d878994037 100644 --- a/build.properties +++ b/build.properties @@ -40,16 +40,10 @@ cspace.public.browser.build.branch=main cspace.public.browser.build.node.ver=20 #nuxeo -nuxeo.release=9.10-HF30 -nuxeo.ear=nuxeo.ear +nuxeo.release=2023 nuxeo.system=bundles - -## #old# nuxeo.plugins=${nuxeo.ear}/plugins nuxeo.plugins=plugins -## #old# -nuxeo.templates=templates - ## #old# distribution dist=dist dist.cspace=${dist}/cspace @@ -72,7 +66,7 @@ dist.deploy.nuxeo.system=${dist.deploy.nuxeo}/${nuxeo.system} dist.deploy.nuxeo.plugins=${dist.deploy.nuxeo}/${nuxeo.plugins} #JEE Application Server -jee.release=apache-tomcat-8.5.51 +jee.release=apache-tomcat-9.0.118 jee.dir=${env.CSPACE_JEESERVER_HOME} jee.home=${jee.dir} jee.bin=${jee.home}/bin @@ -89,7 +83,6 @@ jee.deploy.cspace.ui.shared=${jee.deploy.cspace}/cspace-ui #JEE Application Server nuxeo domain jee.domain.nuxeo=${domain.nuxeo} -##old# #jee.domain.nuxeo.port=8080 jee.server.nuxeo=${jee.home}/${jee.domain.nuxeo} jee.deploy.nuxeo=${jee.server.nuxeo} jee.lib.nuxeo=${jee.server.nuxeo}/lib @@ -102,13 +95,8 @@ catalina.hostname=localhost catalina.base=${jee.dir} catalina.context.cspace=${jee.dir}/conf/${catalina.engine}/${catalina.hostname}/${cspace.services.context}.xml -#nuxeo database templates directory -##old# nuxeo.templates.dir=${jboss.home}/${nuxeo.templates} - #nuxeo main config file nuxeo.main.config.file=${jee.bin}/nuxeo.conf -#nuxeo database templates directory -nuxeo.templates.dir=${jee.home}/${nuxeo.templates} db.base.dir=${jee.server.cspace}/cspace/services/db From 858d016ba4be2ec1dad9a5960d127a5a6bc36d36 Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Mon, 22 Jun 2026 10:51:00 +0300 Subject: [PATCH 18/40] no-jira: changed tenant.ui.profile.plugin build branch to develop; --- cspace-ui/anthro/build.properties | 2 +- cspace-ui/bonsai/build.properties | 2 +- cspace-ui/botgarden/build.properties | 2 +- cspace-ui/fcart/build.properties | 2 +- cspace-ui/herbarium/build.properties | 2 +- cspace-ui/lhmc/build.properties | 2 +- cspace-ui/materials/build.properties | 2 +- cspace-ui/publicart/build.properties | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cspace-ui/anthro/build.properties b/cspace-ui/anthro/build.properties index 31343c863e..9e2c0a4613 100644 --- a/cspace-ui/anthro/build.properties +++ b/cspace-ui/anthro/build.properties @@ -4,7 +4,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-anthro tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileAnthro tenant.ui.profile.plugin.version=9.2 -tenant.ui.profile.plugin.build.branch=main +tenant.ui.profile.plugin.build.branch=develop # If not set, defaults to /gateway/${tenant.shortname} on the current host. # tenant.public.browser.gateway.url=https://core.dev.collectionspace.org/gateway/${tenant.shortname} diff --git a/cspace-ui/bonsai/build.properties b/cspace-ui/bonsai/build.properties index fceb3892b9..5306b564ad 100644 --- a/cspace-ui/bonsai/build.properties +++ b/cspace-ui/bonsai/build.properties @@ -4,7 +4,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-bonsai tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileBonsai tenant.ui.profile.plugin.version=7.1 -tenant.ui.profile.plugin.build.branch=main +tenant.ui.profile.plugin.build.branch=develop # If not set, defaults to /gateway/${tenant.shortname} on the current host. # tenant.public.browser.gateway.url=https://core.dev.collectionspace.org/gateway/${tenant.shortname} diff --git a/cspace-ui/botgarden/build.properties b/cspace-ui/botgarden/build.properties index 11a4bec410..3d6262709d 100644 --- a/cspace-ui/botgarden/build.properties +++ b/cspace-ui/botgarden/build.properties @@ -4,7 +4,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-botgarden tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileBotGarden tenant.ui.profile.plugin.version=4.0 -tenant.ui.profile.plugin.build.branch=main +tenant.ui.profile.plugin.build.branch=develop # If not set, defaults to /gateway/${tenant.shortname} on the current host. # tenant.public.browser.gateway.url=https://core.dev.collectionspace.org/gateway/${tenant.shortname} diff --git a/cspace-ui/fcart/build.properties b/cspace-ui/fcart/build.properties index 65689ca635..ed768fed68 100644 --- a/cspace-ui/fcart/build.properties +++ b/cspace-ui/fcart/build.properties @@ -4,7 +4,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-fcart tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileFCart tenant.ui.profile.plugin.version=8.2 -tenant.ui.profile.plugin.build.branch=main +tenant.ui.profile.plugin.build.branch=develop # If not set, defaults to /gateway/${tenant.shortname} on the current host. # tenant.public.browser.gateway.url=https://core.dev.collectionspace.org/gateway/${tenant.shortname} diff --git a/cspace-ui/herbarium/build.properties b/cspace-ui/herbarium/build.properties index 09bc8d6b3c..1efa7aefe3 100644 --- a/cspace-ui/herbarium/build.properties +++ b/cspace-ui/herbarium/build.properties @@ -4,7 +4,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-herbarium tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileHerbarium tenant.ui.profile.plugin.version=3.0 -tenant.ui.profile.plugin.build.branch=main +tenant.ui.profile.plugin.build.branch=develop # If not set, defaults to /gateway/${tenant.shortname} on the current host. # tenant.public.browser.gateway.url=https://core.dev.collectionspace.org/gateway/${tenant.shortname} diff --git a/cspace-ui/lhmc/build.properties b/cspace-ui/lhmc/build.properties index e847b2cfaa..cfa260b1cf 100644 --- a/cspace-ui/lhmc/build.properties +++ b/cspace-ui/lhmc/build.properties @@ -4,7 +4,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-lhmc tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileLHMC tenant.ui.profile.plugin.version=8.2 -tenant.ui.profile.plugin.build.branch=main +tenant.ui.profile.plugin.build.branch=develop # If not set, defaults to /gateway/${tenant.shortname} on the current host. # tenant.public.browser.gateway.url=https://core.dev.collectionspace.org/gateway/${tenant.shortname} diff --git a/cspace-ui/materials/build.properties b/cspace-ui/materials/build.properties index cd5f30ca0d..b7a3b16177 100644 --- a/cspace-ui/materials/build.properties +++ b/cspace-ui/materials/build.properties @@ -4,7 +4,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-materials tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileMaterials tenant.ui.profile.plugin.version=4.1 -tenant.ui.profile.plugin.build.branch=main +tenant.ui.profile.plugin.build.branch=develop # If not set, defaults to /gateway/${tenant.shortname} on the current host. # tenant.public.browser.gateway.url=https://core.dev.collectionspace.org/gateway/${tenant.shortname} diff --git a/cspace-ui/publicart/build.properties b/cspace-ui/publicart/build.properties index 5c829c64a6..913ed68926 100644 --- a/cspace-ui/publicart/build.properties +++ b/cspace-ui/publicart/build.properties @@ -4,7 +4,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-publicart tenant.ui.profile.plugin.library.name=cspaceUIPluginProfilePublicArt tenant.ui.profile.plugin.version=7.1 -tenant.ui.profile.plugin.build.branch=main +tenant.ui.profile.plugin.build.branch=develop # If not set, defaults to /gateway/${tenant.shortname} on the current host. # tenant.public.browser.gateway.url=https://core.dev.collectionspace.org/gateway/${tenant.shortname} From 2eaecebc332358b4b43b26ebc6687fcbfffb9776 Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Wed, 1 Jul 2026 18:15:54 +0300 Subject: [PATCH 19/40] DRYD-2117: added denormPriorityImageList --- .../DefaultESDocumentWriter.java | 51 +++++++++++++++++++ .../tenants/tenant-bindings-proto-unified.xml | 30 +++++++++++ 2 files changed, 81 insertions(+) diff --git a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java index c8c3f01382..149e39cf74 100644 --- a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java +++ b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java @@ -59,6 +59,7 @@ public ObjectNode getDenormValues(DocumentModel doc) { denormConceptFields(doc, denormValues); denormMaterialFields(doc, denormValues); denormObjectNameFields(doc, denormValues); + denormPriorityImageList(doc, session, tenantId, denormValues); // Compute the title of the record for the public browser, and store it so that it can // be used for sorting ES query results. @@ -209,6 +210,56 @@ private void denormExhibitionRecords(CoreSession session, String csid, String te denormValues.putArray("exhibition").addAll(exhibitions); } + /** + * Denormalize the csid, blob csid, title, and alt text of each media record referenced by + * the priorityImageList field of a collectionobject, so that the priority/sort + * order set by the user can be displayed and searched. + * + * @param doc the collectionobject document + * @param session the current session + * @param tenantId the tenant id + * @param denormValues the json node for denormalized fields + */ + private void denormPriorityImageList(DocumentModel doc, CoreSession session, String tenantId, ObjectNode denormValues) { + List priorityImageList = (List) doc.getProperty("collectionobjects_common", "priorityImageList"); + List priorityImages = new ArrayList<>(); + + if (priorityImageList != null) { + for (String priorityImage : priorityImageList) { + if (StringUtils.isNotEmpty(priorityImage)) { + String mediaCsid = null; + + try { + mediaCsid = RefNameUtils.parseAuthorityInfo(priorityImage).csid; + } catch (IllegalArgumentException e) { + // Not a parseable refName; nothing to denormalize for this entry. + } + + if (mediaCsid != null) { + DocumentModel mediaDoc = getRecordByCsid(session, tenantId, "Media", mediaCsid); + + if (mediaDoc != null && isMediaPublished(mediaDoc)) { + String blobCsid = (String) mediaDoc.getProperty("media_common", "blobCsid"); + String title = (String) mediaDoc.getProperty("media_common", "title"); + String altText = (String) mediaDoc.getProperty("media_common", "altText"); + + ObjectNode priorityImageNode = objectMapper.createObjectNode(); + + priorityImageNode.put("csid", mediaCsid); + priorityImageNode.put("blobCsid", blobCsid); + priorityImageNode.put("title", title); + priorityImageNode.put("altText", altText); + + priorityImages.add(priorityImageNode); + } + } + } + } + } + + denormValues.putArray("priorityImageList").addAll(priorityImages); + } + /** * Denormalize the material group list for a collectionobject in order to index the controlled or uncontrolled term * 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 42834cb08d..5e3011030c 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 @@ -1201,6 +1201,7 @@ "collectionobjects_common:objectStatusList", "collectionobjects_common:otherNumberList", "collectionobjects_common:ownersContributionNote", + "collectionobjects_common:priorityImageList", "collectionobjects_common:publishedRelatedLinkGroupList", "collectionobjects_common:publishToList", "collectionobjects_common:responsibleDepartments", @@ -1417,6 +1418,35 @@ "type": "keyword", "copy_to": "all_field" }, + "collectionobjects_common:priorityImageList": { + "type": "keyword", + "copy_to": "all_field", + "fields": { + "displayName": { + "type": "keyword", + "normalizer": "refname_displayname_normalizer" + } + } + }, + "collectionspace_denorm:priorityImageList": { + "type": "object", + "properties": { + "csid": { + "type": "keyword" + }, + "blobCsid": { + "type": "keyword" + }, + "title": { + "type": "text", + "copy_to": "all_field" + }, + "altText": { + "type": "text", + "copy_to": "all_field" + } + } + }, "collectionobjects_common:contentConcepts": { "type": "keyword", "copy_to": "all_field", From a67bde8b0b76317644388ca5353d8e7a046c7042 Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Wed, 1 Jul 2026 18:29:41 +0300 Subject: [PATCH 20/40] DRYD-2117: updated changelog; --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c9e4f676d..6b13ba1ad3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 9.0.0 * Add home location to collectionobject schema and advanced search +* Denormalize priority image list ## 8.3.0 From 88e1a229047d5d2769c575c01cb52758f3a7cfc5 Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Tue, 7 Jul 2026 15:43:36 +0300 Subject: [PATCH 21/40] DRYD-2123: added maven.config with --strict-checksums --- .gitignore | 3 ++- .mvn/maven.config | 1 + CHANGELOG.md | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .mvn/maven.config diff --git a/.gitignore b/.gitignore index f1b47dc39f..5b39f205bb 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,5 @@ bin *.diff logged_schemas logs -.mvn +.mvn/* +!.mvn/maven.config diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 0000000000..7fa4242245 --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1 @@ +--strict-checksums diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c9e4f676d..fedd4b3e3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 9.0.0 * Add home location to collectionobject schema and advanced search +* Enable strict checksum verification so that builds fail on corrupted Maven artifact downloads ## 8.3.0 From aea7e29fce69735d2901e4fd76fdd32ac5bd6e3b Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Tue, 7 Jul 2026 10:04:56 -0600 Subject: [PATCH 22/40] DRYD-2124: Set Release to JDK 21 (#547) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bf44b47ce5..51e2436c69 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ UTF-8 ${revision} ${revision} - 17 + 21 9.0.99 From 17d59376a047e96171db6e0285e8137b4f813100 Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Fri, 10 Jul 2026 12:28:33 -0600 Subject: [PATCH 23/40] DRYD-2122: SSO CORS Settings into dev (#546) --- .../common/security/SecurityConfig.java | 28 ++++++------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityConfig.java b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityConfig.java index d0299dc573..460a3c3d32 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/security/SecurityConfig.java +++ b/services/common/src/main/java/org/collectionspace/services/common/security/SecurityConfig.java @@ -192,7 +192,7 @@ private void initializeCorsConfigurations(RelyingPartyRegistrationRepository rel if (relyingPartyRegistrationRepository != null && this.samlCorsConfigurations == null) { // Automatically add SAML providers as allowed origins for SAML response endpoints. - this.samlCorsConfigurations = samlCorsConfigurations(relyingPartyRegistrationRepository, allowedOrigins, maxAge); + this.samlCorsConfigurations = samlCorsConfigurations(relyingPartyRegistrationRepository, maxAge); } } @@ -254,7 +254,6 @@ private CorsConfiguration oauthServerCorsConfiguration(List allowedOrigi */ private Map samlCorsConfigurations( RelyingPartyRegistrationRepository relyingPartyRegistrationRepository, - List allowedOrigins, Duration maxAge) { ServiceConfig serviceConfig = ServiceMain.getInstance().getServiceConfig(); @@ -262,8 +261,6 @@ private Map samlCorsConfigurations( Map corsConfigurations = new LinkedHashMap<>(); if (relyingPartiesConfig != null) { - List providerOrigins = new ArrayList<>(); - for (final SAMLRelyingPartyType relyingPartyConfig : relyingPartiesConfig) { String id = relyingPartyConfig.getId(); RelyingPartyRegistration registration = relyingPartyRegistrationRepository.findByRegistrationId(id); @@ -282,20 +279,16 @@ private Map samlCorsConfigurations( if (providerUrl != null) { CorsConfiguration configuration = new CorsConfiguration(); String responseUrl = "/login/saml2/sso/" + id; - String providerOrigin = providerUrl.getProtocol() + "://" + providerUrl.getAuthority(); - - providerOrigins.add(providerOrigin); - configuration.setAllowedOrigins(allowedOrigins); - configuration.addAllowedOrigin(providerOrigin); + // allow all origins for the sso login in order to let the idp control the cors settings + // and send a different origin if it is configured to + configuration.addAllowedOrigin("*"); if (maxAge != null) { configuration.setMaxAge(maxAge); } - configuration.setAllowedMethods(Arrays.asList( - HttpMethod.POST.toString() - )); + configuration.setAllowedMethods(Arrays.asList(HttpMethod.POST.toString())); corsConfigurations.put(responseUrl, configuration); } @@ -305,19 +298,14 @@ private Map samlCorsConfigurations( CorsConfiguration configuration = new CorsConfiguration(); String responseUrl = "/logout/saml2/slo"; - configuration.setAllowedOrigins(allowedOrigins); - - for (String providerOrigin : providerOrigins) { - configuration.addAllowedOrigin(providerOrigin); - } + // same as for login + configuration.addAllowedOrigin("*"); if (maxAge != null) { configuration.setMaxAge(maxAge); } - configuration.setAllowedMethods(Arrays.asList( - HttpMethod.POST.toString() - )); + configuration.setAllowedMethods(Arrays.asList(HttpMethod.POST.toString())); corsConfigurations.put(responseUrl, configuration); } From 52d1d2de7b16d0ff6b03130123dc20c8650d1832 Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Tue, 14 Jul 2026 19:01:35 +0300 Subject: [PATCH 24/40] DRYD-2117: renamed priority image to media priority; --- .../DefaultESDocumentWriter.java | 32 +++++++++---------- CHANGELOG.md | 2 +- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java index 149e39cf74..0440304854 100644 --- a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java +++ b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java @@ -59,7 +59,7 @@ public ObjectNode getDenormValues(DocumentModel doc) { denormConceptFields(doc, denormValues); denormMaterialFields(doc, denormValues); denormObjectNameFields(doc, denormValues); - denormPriorityImageList(doc, session, tenantId, denormValues); + denormMediaPriorityList(doc, session, tenantId, denormValues); // Compute the title of the record for the public browser, and store it so that it can // be used for sorting ES query results. @@ -212,7 +212,7 @@ private void denormExhibitionRecords(CoreSession session, String csid, String te /** * Denormalize the csid, blob csid, title, and alt text of each media record referenced by - * the priorityImageList field of a collectionobject, so that the priority/sort + * the mediaPriorityList field of a collectionobject, so that the priority/sort * order set by the user can be displayed and searched. * * @param doc the collectionobject document @@ -220,17 +220,17 @@ private void denormExhibitionRecords(CoreSession session, String csid, String te * @param tenantId the tenant id * @param denormValues the json node for denormalized fields */ - private void denormPriorityImageList(DocumentModel doc, CoreSession session, String tenantId, ObjectNode denormValues) { - List priorityImageList = (List) doc.getProperty("collectionobjects_common", "priorityImageList"); - List priorityImages = new ArrayList<>(); + private void denormMediaPriorityList(DocumentModel doc, CoreSession session, String tenantId, ObjectNode denormValues) { + List mediaPriorityList = (List) doc.getProperty("collectionobjects_common", "mediaPriorityList"); + List mediaPriorityNodes = new ArrayList<>(); - if (priorityImageList != null) { - for (String priorityImage : priorityImageList) { - if (StringUtils.isNotEmpty(priorityImage)) { + if (mediaPriorityList != null) { + for (String mediaPriority : mediaPriorityList) { + if (StringUtils.isNotEmpty(mediaPriority)) { String mediaCsid = null; try { - mediaCsid = RefNameUtils.parseAuthorityInfo(priorityImage).csid; + mediaCsid = RefNameUtils.parseAuthorityInfo(mediaPriority).csid; } catch (IllegalArgumentException e) { // Not a parseable refName; nothing to denormalize for this entry. } @@ -243,21 +243,21 @@ private void denormPriorityImageList(DocumentModel doc, CoreSession session, Str String title = (String) mediaDoc.getProperty("media_common", "title"); String altText = (String) mediaDoc.getProperty("media_common", "altText"); - ObjectNode priorityImageNode = objectMapper.createObjectNode(); + ObjectNode mediaPriorityNode = objectMapper.createObjectNode(); - priorityImageNode.put("csid", mediaCsid); - priorityImageNode.put("blobCsid", blobCsid); - priorityImageNode.put("title", title); - priorityImageNode.put("altText", altText); + mediaPriorityNode.put("csid", mediaCsid); + mediaPriorityNode.put("blobCsid", blobCsid); + mediaPriorityNode.put("title", title); + mediaPriorityNode.put("altText", altText); - priorityImages.add(priorityImageNode); + mediaPriorityNodes.add(mediaPriorityNode); } } } } } - denormValues.putArray("priorityImageList").addAll(priorityImages); + denormValues.putArray("mediaPriorityList").addAll(mediaPriorityNodes); } /** diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b13ba1ad3..d8d372e293 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 9.0.0 * Add home location to collectionobject schema and advanced search -* Denormalize priority image list +* Denormalize media priority list ## 8.3.0 From b4d1d323e5ff46b3dd067abb7828e0509d3229b2 Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Tue, 14 Jul 2026 19:01:35 +0300 Subject: [PATCH 25/40] DRYD-2117: renamed priority image to media priority; --- .../DefaultESDocumentWriter.java | 32 +++++++++---------- CHANGELOG.md | 2 +- .../tenants/tenant-bindings-proto-unified.xml | 6 ++-- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java index 149e39cf74..0440304854 100644 --- a/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java +++ b/3rdparty/nuxeo/nuxeo-platform-elasticsearch/src/main/java/org/collectionspace/services/nuxeo/elasticsearch/DefaultESDocumentWriter.java @@ -59,7 +59,7 @@ public ObjectNode getDenormValues(DocumentModel doc) { denormConceptFields(doc, denormValues); denormMaterialFields(doc, denormValues); denormObjectNameFields(doc, denormValues); - denormPriorityImageList(doc, session, tenantId, denormValues); + denormMediaPriorityList(doc, session, tenantId, denormValues); // Compute the title of the record for the public browser, and store it so that it can // be used for sorting ES query results. @@ -212,7 +212,7 @@ private void denormExhibitionRecords(CoreSession session, String csid, String te /** * Denormalize the csid, blob csid, title, and alt text of each media record referenced by - * the priorityImageList field of a collectionobject, so that the priority/sort + * the mediaPriorityList field of a collectionobject, so that the priority/sort * order set by the user can be displayed and searched. * * @param doc the collectionobject document @@ -220,17 +220,17 @@ private void denormExhibitionRecords(CoreSession session, String csid, String te * @param tenantId the tenant id * @param denormValues the json node for denormalized fields */ - private void denormPriorityImageList(DocumentModel doc, CoreSession session, String tenantId, ObjectNode denormValues) { - List priorityImageList = (List) doc.getProperty("collectionobjects_common", "priorityImageList"); - List priorityImages = new ArrayList<>(); + private void denormMediaPriorityList(DocumentModel doc, CoreSession session, String tenantId, ObjectNode denormValues) { + List mediaPriorityList = (List) doc.getProperty("collectionobjects_common", "mediaPriorityList"); + List mediaPriorityNodes = new ArrayList<>(); - if (priorityImageList != null) { - for (String priorityImage : priorityImageList) { - if (StringUtils.isNotEmpty(priorityImage)) { + if (mediaPriorityList != null) { + for (String mediaPriority : mediaPriorityList) { + if (StringUtils.isNotEmpty(mediaPriority)) { String mediaCsid = null; try { - mediaCsid = RefNameUtils.parseAuthorityInfo(priorityImage).csid; + mediaCsid = RefNameUtils.parseAuthorityInfo(mediaPriority).csid; } catch (IllegalArgumentException e) { // Not a parseable refName; nothing to denormalize for this entry. } @@ -243,21 +243,21 @@ private void denormPriorityImageList(DocumentModel doc, CoreSession session, Str String title = (String) mediaDoc.getProperty("media_common", "title"); String altText = (String) mediaDoc.getProperty("media_common", "altText"); - ObjectNode priorityImageNode = objectMapper.createObjectNode(); + ObjectNode mediaPriorityNode = objectMapper.createObjectNode(); - priorityImageNode.put("csid", mediaCsid); - priorityImageNode.put("blobCsid", blobCsid); - priorityImageNode.put("title", title); - priorityImageNode.put("altText", altText); + mediaPriorityNode.put("csid", mediaCsid); + mediaPriorityNode.put("blobCsid", blobCsid); + mediaPriorityNode.put("title", title); + mediaPriorityNode.put("altText", altText); - priorityImages.add(priorityImageNode); + mediaPriorityNodes.add(mediaPriorityNode); } } } } } - denormValues.putArray("priorityImageList").addAll(priorityImages); + denormValues.putArray("mediaPriorityList").addAll(mediaPriorityNodes); } /** diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b13ba1ad3..d8d372e293 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 9.0.0 * Add home location to collectionobject schema and advanced search -* Denormalize priority image list +* Denormalize media priority list ## 8.3.0 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 5e3011030c..307cae9477 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 @@ -1201,7 +1201,7 @@ "collectionobjects_common:objectStatusList", "collectionobjects_common:otherNumberList", "collectionobjects_common:ownersContributionNote", - "collectionobjects_common:priorityImageList", + "collectionobjects_common:mediaPriorityList", "collectionobjects_common:publishedRelatedLinkGroupList", "collectionobjects_common:publishToList", "collectionobjects_common:responsibleDepartments", @@ -1418,7 +1418,7 @@ "type": "keyword", "copy_to": "all_field" }, - "collectionobjects_common:priorityImageList": { + "collectionobjects_common:mediaPriorityList": { "type": "keyword", "copy_to": "all_field", "fields": { @@ -1428,7 +1428,7 @@ } } }, - "collectionspace_denorm:priorityImageList": { + "collectionspace_denorm:mediaPriorityList": { "type": "object", "properties": { "csid": { From ee2b56520f353ceabb085da5dcec3926aa32145e Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Wed, 15 Jul 2026 19:34:13 +0300 Subject: [PATCH 26/40] NO-JIRA: reindex media on relation; --- .../services/listener/Reindex.java | 39 +++++++++++++++++++ .../services/listener/ReindexSupport.java | 16 ++++++++ 2 files changed, 55 insertions(+) diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/reindex/src/main/java/org/collectionspace/services/listener/Reindex.java b/3rdparty/nuxeo/nuxeo-platform-listener/reindex/src/main/java/org/collectionspace/services/listener/Reindex.java index 106c0e4b27..145f9b0e1f 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/reindex/src/main/java/org/collectionspace/services/listener/Reindex.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/reindex/src/main/java/org/collectionspace/services/listener/Reindex.java @@ -43,6 +43,7 @@ public class Reindex extends AbstractCSEventPostCommitListenerImpl { public static final String PREV_EXH_CURATORIAL_NOTE_KEY = "Reindex.PREV_EXH_CURATORIAL_NOTE"; public static final String PREV_EXH_PUBLISH_TO_KEY = "Reindex.PREV_EXH_PUBLISH_TO"; public static final String PREV_RELATED_COLLECTION_OBJECT_CSID_KEY = "Reindex.PREV_RELATED_COLLECTION_OBJECT_CSID"; + public static final String PREV_RELATED_MEDIA_CSID_KEY = "Reindex.PREV_RELATED_MEDIA_CSID"; public static final String ELASTICSEARCH_ENABLED_PROP = "elasticsearch.enabled"; @Override @@ -200,10 +201,27 @@ else if (docType.startsWith("Relation")) { String collectionObjectCsid = (String) doc.getProperty("relations_common", "objectCsid"); reindexCollectionObject(doc.getRepositoryName(), collectionObjectCsid); + + if (subjectDocumentType.equals("Media")) { + String mediaCsid = (String) doc.getProperty("relations_common", "subjectCsid"); + + reindexMedia(doc.getRepositoryName(), mediaCsid); + } + } + else if ( + subjectDocumentType.equals("CollectionObject") + && objectDocumentType.equals("Media") + ) { + String collectionObjectCsid = (String) doc.getProperty("relations_common", "subjectCsid"); + String mediaCsid = (String) doc.getProperty("relations_common", "objectCsid"); + + reindexCollectionObject(doc.getRepositoryName(), collectionObjectCsid); + reindexMedia(doc.getRepositoryName(), mediaCsid); } } else if (eventName.equals(DocumentEventTypes.DOCUMENT_REMOVED)) { reindexPrevRelatedCollectionObjects(eventContext); + reindexPrevRelatedMedia(eventContext); } } } @@ -261,6 +279,16 @@ private void reindexRelatedCollectionObjects(DocumentModel doc) { } } + private void reindexPrevRelatedMedia(DocumentEventContext eventContext) { + List prevRelatedMediaCsids = (List) eventContext.getProperty(PREV_RELATED_MEDIA_CSID_KEY); + + if (prevRelatedMediaCsids != null) { + for (String prevRelatedMediaCsid : prevRelatedMediaCsids) { + reindexMedia(eventContext.getRepositoryName(), prevRelatedMediaCsid); + } + } + } + private void reindexCollectionObject(String repositoryName, String csid) { if (StringUtils.isEmpty(csid)) { return; @@ -271,4 +299,15 @@ private void reindexCollectionObject(String repositoryName, String csid) { ElasticSearchComponent es = (ElasticSearchComponent) Framework.getService(ElasticSearchService.class); es.runReindexingWorker(repositoryName, query); } + + private void reindexMedia(String repositoryName, String csid) { + if (StringUtils.isEmpty(csid)) { + return; + } + + String query = String.format("SELECT ecm:uuid FROM Media WHERE ecm:name = '%s'", csid); + + ElasticSearchComponent es = (ElasticSearchComponent) Framework.getService(ElasticSearchService.class); + es.runReindexingWorker(repositoryName, query); + } } diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/reindex/src/main/java/org/collectionspace/services/listener/ReindexSupport.java b/3rdparty/nuxeo/nuxeo-platform-listener/reindex/src/main/java/org/collectionspace/services/listener/ReindexSupport.java index 11caed8838..8e09c43749 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/reindex/src/main/java/org/collectionspace/services/listener/ReindexSupport.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/reindex/src/main/java/org/collectionspace/services/listener/ReindexSupport.java @@ -146,6 +146,22 @@ else if (docType.startsWith("Relation")) { String collectionObjectCsid = (String) doc.getProperty("relations_common", "objectCsid"); eventContext.setProperty(Reindex.PREV_RELATED_COLLECTION_OBJECT_CSID_KEY, (Serializable) Arrays.asList(collectionObjectCsid)); + + if (subjectDocumentType.equals("Media")) { + String mediaCsid = (String) doc.getProperty("relations_common", "subjectCsid"); + + eventContext.setProperty(Reindex.PREV_RELATED_MEDIA_CSID_KEY, (Serializable) Arrays.asList(mediaCsid)); + } + } + else if ( + subjectDocumentType.equals("CollectionObject") + && objectDocumentType.equals("Media") + ) { + String collectionObjectCsid = (String) doc.getProperty("relations_common", "subjectCsid"); + String mediaCsid = (String) doc.getProperty("relations_common", "objectCsid"); + + eventContext.setProperty(Reindex.PREV_RELATED_COLLECTION_OBJECT_CSID_KEY, (Serializable) Arrays.asList(collectionObjectCsid)); + eventContext.setProperty(Reindex.PREV_RELATED_MEDIA_CSID_KEY, (Serializable) Arrays.asList(mediaCsid)); } } } From 786bdc9380e5bd025431e8e48358315063736933 Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Wed, 15 Jul 2026 19:44:29 +0300 Subject: [PATCH 27/40] NO-JIRA: updated changelog; --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c9e4f676d..895b636f41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ ## 9.0.0 * Add home location to collectionobject schema and advanced search +### Bug Fixes + +* Fix es indexing of Media records when relating/unrelating to Collection Objects + ## 8.3.0 * Add new endpoint for returning search results From 294d406e43d7a8a7f0e4c80ebac1fd8ce2f4a7bf Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Thu, 16 Jul 2026 15:05:38 -0600 Subject: [PATCH 28/40] DRYD-2002: Password Complexity Requirements (#550) * Create password requirement settings for tenant bindings * Create initial set of password validators for: max length, min length, uppercase, lowercase, digits, and special characters * Add endpoint for password requirement config * Add password requirements to process password reset page * Add password requirements to create/update account n.b. the max length validator uses the byte size of the String to account for Unicode characters which might truncate if only counting codepoints. Currently this is set to 72 bytes to match the maximum length supported by bcrypt. --- CHANGELOG.md | 3 + .../services/client/AccountClient.java | 1 + services/account/service/pom.xml | 185 +++++++++--------- .../services/account/AccountResource.java | 164 +++++++++++----- .../account/storage/AccountStorageClient.java | 48 +++-- .../storage/csidp/TokenStorageClient.java | 27 +-- .../storage/csidp/UserStorageClient.java | 16 +- .../validator/CSpacePasswordValidator.java | 58 ++++++ .../account/validator/MaxLengthValidator.java | 21 ++ .../account/validator/MinLengthValidator.java | 23 +++ .../account/validator/PasswordValidator.java | 9 + .../account/validator/RegexValidator.java | 45 +++++ .../validator/ValidationErrorCode.java | 13 ++ .../account/validator/ValidationResult.java | 37 ++++ .../CSpacePasswordValidatorTest.java | 134 +++++++++++++ .../services/authorization/AuthZ.java | 3 +- .../common/security/SecurityInterceptor.java | 21 +- .../common/security/SecurityUtils.java | 21 -- services/config/src/main/resources/tenant.xsd | 27 +++ 19 files changed, 633 insertions(+), 223 deletions(-) create mode 100644 services/account/service/src/main/java/org/collectionspace/services/account/validator/CSpacePasswordValidator.java create mode 100644 services/account/service/src/main/java/org/collectionspace/services/account/validator/MaxLengthValidator.java create mode 100644 services/account/service/src/main/java/org/collectionspace/services/account/validator/MinLengthValidator.java create mode 100644 services/account/service/src/main/java/org/collectionspace/services/account/validator/PasswordValidator.java create mode 100644 services/account/service/src/main/java/org/collectionspace/services/account/validator/RegexValidator.java create mode 100644 services/account/service/src/main/java/org/collectionspace/services/account/validator/ValidationErrorCode.java create mode 100644 services/account/service/src/main/java/org/collectionspace/services/account/validator/ValidationResult.java create mode 100644 services/account/service/src/test/java/org/collectionspace/services/account/validator/CSpacePasswordValidatorTest.java diff --git a/CHANGELOG.md b/CHANGELOG.md index fedd4b3e3d..5c5274d245 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,10 @@ # CollectionSpace Services Changelog ## 9.0.0 + * Add home location to collectionobject schema and advanced search +* Add password complexity requirements to tenant bindings +* Add password validators which verify passwords meet requirements set by tenants * Enable strict checksum verification so that builds fail on corrupted Maven artifact downloads ## 8.3.0 diff --git a/services/account/client/src/main/java/org/collectionspace/services/client/AccountClient.java b/services/account/client/src/main/java/org/collectionspace/services/client/AccountClient.java index 950d301ef9..86f40de157 100644 --- a/services/account/client/src/main/java/org/collectionspace/services/client/AccountClient.java +++ b/services/account/client/src/main/java/org/collectionspace/services/client/AccountClient.java @@ -49,6 +49,7 @@ public class AccountClient extends AbstractServiceClientImpl - - - org.collectionspace.services.account - org.collectionspace.services - ${revision} - + + + org.collectionspace.services.account + org.collectionspace.services + ${revision} + - 4.0.0 - org.collectionspace.services.account.service - services.account.service - jar + 4.0.0 + org.collectionspace.services.account.service + services.account.service + jar - - + + + + org.collectionspace.services + org.collectionspace.services.common + + + org.collectionspace.services + org.collectionspace.services.authentication.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.authorization.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.account.jaxb + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.account.client + ${project.version} + + + org.collectionspace.services + org.collectionspace.services.authentication.service + ${project.version} + provided + - - org.collectionspace.services - org.collectionspace.services.common - - - org.collectionspace.services - org.collectionspace.services.authentication.jaxb - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.authorization.jaxb - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.account.jaxb - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.account.client - ${project.version} - - - org.collectionspace.services - org.collectionspace.services.authentication.service - ${project.version} - provided - + - + + junit + junit + test + + + org.testng + testng + + + org.springframework.security + spring-security-web + ${spring.security.version} + provided + + + org.apache.tomcat + tomcat-servlet-api + ${tomcat.version} + provided + - - junit - junit - test - - - org.testng - testng - - - org.springframework.security - spring-security-web - ${spring.security.version} - provided - - - org.apache.tomcat - tomcat-servlet-api - ${tomcat.version} - provided - + + + commons-beanutils + commons-beanutils + 1.9.4 + - - - commons-beanutils - commons-beanutils - 1.9.4 - + - + + javax.security + jaas + 1.0.01 + provided + - - javax.security - jaas - 1.0.01 - provided - + - + + org.jboss.resteasy + resteasy-client + + + org.jboss.resteasy + resteasy-multipart-provider + + - - org.jboss.resteasy - resteasy-client - - - org.jboss.resteasy - resteasy-multipart-provider - - - - - collectionspace-services-account - - - - + + collectionspace-services-account + diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java b/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java index ad1e4415f9..492ff9c377 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/AccountResource.java @@ -48,24 +48,22 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.PathSegment; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import freemarker.core.ParseException; import freemarker.template.Configuration; -import freemarker.template.MalformedTemplateNameException; import freemarker.template.Template; import freemarker.template.TemplateException; -import freemarker.template.TemplateNotFoundException; import jakarta.xml.bind.DatatypeConverter; import org.apache.commons.lang3.StringUtils; import org.collectionspace.authentication.AuthN; import org.collectionspace.services.account.storage.AccountStorageClient; import org.collectionspace.services.account.storage.csidp.TokenStorageClient; +import org.collectionspace.services.account.validator.CSpacePasswordValidator; +import org.collectionspace.services.account.validator.ValidationResult; import org.collectionspace.services.authentication.Passwordreset; import org.collectionspace.services.authentication.Token; import org.collectionspace.services.authorization.AccountPermission; @@ -76,6 +74,7 @@ import org.collectionspace.services.client.AccountClient; import org.collectionspace.services.client.PayloadOutputPart; import org.collectionspace.services.client.RoleClient; +import org.collectionspace.services.common.CSWebApplicationException; import org.collectionspace.services.common.EmailUtil; import org.collectionspace.services.common.SecurityResourceBase; import org.collectionspace.services.common.ServiceMain; @@ -94,6 +93,7 @@ import org.collectionspace.services.common.storage.jpa.JpaStorageUtils; import org.collectionspace.services.config.ServiceConfig; import org.collectionspace.services.config.tenant.EmailConfig; +import org.collectionspace.services.config.tenant.PasswordRequirementConfig; import org.collectionspace.services.config.tenant.TenantBindingType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -160,11 +160,28 @@ public AccountsCommonList getAccountList(@Context UriInfo ui) { if(logger.isTraceEnabled()) { PayloadOutputPart ppo = new PayloadOutputPart(AccountsCommonList.class.getSimpleName(), result); - System.out.println(ppo.asXML()); + logger.trace("{}", ppo.asXML()); } return result; } + @GET + @Produces("application/xml") + @Path(AccountClient.PASSWORD_REQUIREMENT_PATH) + public PasswordRequirementConfig getPasswordRequirementConfig(@Context UriInfo uriInfo) { + ServiceContext ctx; + try { + ctx = createServiceContext(null, AccountsCommon.class, uriInfo); + } catch (Exception e) { + throw new CSWebApplicationException(e); + } + + final var tenantBindingConfigReader = ServiceMain.getInstance().getTenantBindingConfigReader(); + final var tenantBinding = tenantBindingConfigReader.getTenantBinding(ctx.getTenantId()); + + return tenantBinding.getPasswordRequirementConfig(); + } + protected UriInfo createUriInfo() throws URISyntaxException { return createUriInfo(""); } @@ -172,7 +189,7 @@ protected UriInfo createUriInfo() throws URISyntaxException { private UriInfo createUriInfo(String queryString) throws URISyntaxException { URI absolutePath = new URI(""); URI baseUri = new URI(""); - return new UriInfoImpl(absolutePath, baseUri, "", queryString, Collections.emptyList()); + return new UriInfoImpl(absolutePath, baseUri, "", queryString, Collections.emptyList()); } /** @@ -216,7 +233,7 @@ public List getAccountRoleDisplayNames(String userId, String tenantId) { AccountRole accountRole = getAccountRole(accountCsid); if (accountRole != null && accountRole.getRole() != null) { List roleValueList = accountRole.getRole(); - if (roleValueList.isEmpty() == false) { + if (!roleValueList.isEmpty()) { result = new ArrayList(); for (RoleValue roleValue: roleValueList) { if (roleValue != null) { @@ -250,7 +267,8 @@ private AccountsCommon updateAccountPassword(ServiceContext requirements = new HashMap<>(); + requirements.put("requireLowerCase", passwordRequirementConfig.isRequireLowerCase()); + requirements.put("requireUpperCase", passwordRequirementConfig.isRequireUpperCase()); + requirements.put("requireDigit", passwordRequirementConfig.isRequireDigit()); + requirements.put("requireSpecial", passwordRequirementConfig.isRequireSpecial()); + if (passwordRequirementConfig.getMinLength() != null) { + requirements.put("minLength", passwordRequirementConfig.getMinLength()); + } + uiConfig.put("passwordRequirements", requirements); + } else { + uiConfig.put("passwordRequirements", Map.of()); + } + String uiConfigJS; try { @@ -324,7 +358,7 @@ public String processPasswordResetForm(@Context HttpServletRequest request) thro */ @POST @Path(AccountClient.PROCESS_PASSWORD_RESET_PATH_COMPONENT) - synchronized public Response processPasswordReset(Passwordreset passwordreset, @Context UriInfo ui) { + public synchronized Response processPasswordReset(Passwordreset passwordreset, @Context UriInfo ui) { Response response = null; // @@ -338,15 +372,19 @@ synchronized public Response processPasswordReset(Passwordreset passwordreset, @ // String tokenId = passwordreset.getToken(); if (tokenId == null || tokenId.trim().isEmpty()) { - response = Response.status(Response.Status.BAD_REQUEST).entity( - "The query parameter 'token' is missing or contains no value.").type("text/plain").build(); + response = Response.status(Response.Status.BAD_REQUEST) + .entity("The query parameter 'token' is missing or contains no value.") + .type(MediaType.TEXT_PLAIN) + .build(); return response; } String base64EncodedPassword = passwordreset.getPassword(); if (base64EncodedPassword == null || base64EncodedPassword.trim().isEmpty()) { - response = Response.status(Response.Status.BAD_REQUEST).entity( - "The query parameter 'password' is missing or contains no value.").type("text/plain").build(); + response = Response.status(Response.Status.BAD_REQUEST) + .entity("The query parameter 'password' is missing or contains no value.") + .type(MediaType.TEXT_PLAIN) + .build(); return response; } String password = new String(DatatypeConverter.parseBase64Binary(base64EncodedPassword), StandardCharsets.UTF_8); @@ -357,13 +395,15 @@ synchronized public Response processPasswordReset(Passwordreset passwordreset, @ Token token; try { token = TokenStorageClient.get(tokenId); - if (token != null && token.isEnabled() == false) { + if (token != null && !token.isEnabled()) { throw new DocumentNotFoundException(); } } catch (DocumentNotFoundException e1) { - String errMsg = String.format("The token '%s' is not valid or does not exist.", - tokenId); - response = Response.status(Response.Status.BAD_REQUEST).entity(errMsg).type("text/plain").build(); + String errMsg = String.format("The token '%s' is not valid or does not exist.", tokenId); + response = Response.status(Response.Status.BAD_REQUEST) + .entity(errMsg) + .type(MediaType.TEXT_PLAIN) + .build(); return response; } @@ -371,9 +411,11 @@ synchronized public Response processPasswordReset(Passwordreset passwordreset, @ // Make sure the token is not null // if (token == null) { - String errMsg = String.format("The token '%s' is not valid.", - tokenId); - response = Response.status(Response.Status.BAD_REQUEST).entity(errMsg).type("text/plain").build(); + String errMsg = String.format("The token '%s' is not valid.", tokenId); + response = Response.status(Response.Status.BAD_REQUEST) + .entity(errMsg) + .type(MediaType.TEXT_PLAIN) + .build(); return response; } @@ -385,21 +427,41 @@ synchronized public Response processPasswordReset(Passwordreset passwordreset, @ if (targetAccount == null) { String errMsg = String.format("The token '%s' is not valid. The account it was created for no longer exists.", tokenId); - response = Response.status(Response.Status.BAD_REQUEST).entity(errMsg).type("text/plain").build(); + response = Response.status(Response.Status.BAD_REQUEST) + .entity(errMsg) + .type(MediaType.TEXT_PLAIN) + .build(); return response; } + + final String tenantId = token.getTenantId(); + TenantBindingType tenantBindingType = ServiceMain.getInstance() + .getTenantBindingConfigReader() + .getTenantBinding(tenantId); + + // Validate that the password meets any complexity requirements + final ValidationResult validationResult = + CSpacePasswordValidator.validatePasswordForTenant(tenantBindingType, password); + + if (!validationResult.isValid()) { + StringBuilder error = new StringBuilder("The password does not meet complexity requirements: "); + validationResult.errors().forEach(errorCode -> error.append(errorCode).append("\n")); + return Response.status(Response.Status.BAD_REQUEST) + .entity(error.toString()) + .type(MediaType.TEXT_PLAIN) + .build(); + } + // // Finally, try to update the account with the new password. // - String tenantId = token.getTenantId(); - TenantBindingType tenantBindingType = ServiceMain.getInstance().getTenantBindingConfigReader().getTenantBinding(tenantId); EmailConfig emailConfig = tenantBindingType.getEmailConfig(); if (emailConfig != null) { try { - ServiceContext ctx = createServiceContext((AccountsCommon) null, AccountsCommon.class, ui); + ServiceContext ctx = createServiceContext(null, AccountsCommon.class, ui); TransactionContext transactionCtx = ctx.openConnection(); try { - if (AuthorizationCommon.hasTokenExpired(emailConfig, token) == false) { + if (!AuthorizationCommon.hasTokenExpired(emailConfig, token)) { transactionCtx.beginTransaction(); AccountsCommon accountUpdate = new AccountsCommon(); accountUpdate.setUserId(targetAccount.getUserId()); @@ -411,30 +473,32 @@ synchronized public Response processPasswordReset(Passwordreset passwordreset, @ // Success! // String msg = String.format("Successfully reset password using token ID='%s'.", token.getId()); - response = Response.status(Response.Status.OK).entity(msg).type("text/plain").build(); + response = Response.status(Response.Status.OK).entity(msg).type(MediaType.TEXT_PLAIN).build(); } else { String errMsg = String.format("Could not reset password using token with ID='%s'. Password reset token has expired.", token.getId()); - response = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errMsg).type("text/plain").build(); + response = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errMsg).type(MediaType.TEXT_PLAIN).build(); } } catch (Throwable t) { transactionCtx.markForRollback(); transactionCtx.close(); // https://jira.ets.berkeley.edu/jira/browse/CC-241 - String errMsg = String.format("Could not reset password using token ID='%s'. Error: '%s'", - t.getMessage(), token.getId()); - response = Response.status(Response.Status.BAD_REQUEST).entity(errMsg).type("text/plain").build(); + String errMsg = String.format( + "Could not reset password using token ID='%s'. Error: '%s'", + t.getMessage(), + token.getId()); + response = Response.status(Response.Status.BAD_REQUEST).entity(errMsg).type(MediaType.TEXT_PLAIN).build(); } finally { ctx.closeConnection(); } } catch (Exception e) { String errMsg = String.format("Could not reset password using token ID='%s'. Error: '%s'", e.getMessage(), token.getId()); - response = Response.status(Response.Status.BAD_REQUEST).entity(errMsg).type("text/plain").build(); + response = Response.status(Response.Status.BAD_REQUEST).entity(errMsg).type(MediaType.TEXT_PLAIN).build(); } } else { String errMsg = String.format("The email configuration for tenant ID='%s' is missing. Please ask your CollectionSpace administrator to check the configuration.", tenantId); - response = Response.status(Response.Status.BAD_REQUEST).entity(errMsg).type("text/plain").build(); + response = Response.status(Response.Status.BAD_REQUEST).entity(errMsg).type(MediaType.TEXT_PLAIN).build(); } return response; @@ -443,7 +507,7 @@ synchronized public Response processPasswordReset(Passwordreset passwordreset, @ @GET @Path(AccountClient.PASSWORD_RESET_PATH_COMPONENT) @Produces(MediaType.TEXT_HTML) - public String requestPasswordResetForm(@Context HttpServletRequest request) throws TemplateNotFoundException, MalformedTemplateNameException, ParseException, IOException, TemplateException { + public String requestPasswordResetForm(@Context HttpServletRequest request) throws IOException, TemplateException { Map uiConfig = new HashMap<>(); CsrfToken csrfToken = (CsrfToken) request.getAttribute(CsrfToken.class.getName()); @@ -592,10 +656,13 @@ private boolean contains(String targetTenantID, List accountTenan private Response requestPasswordReset(UriInfo ui, String targetTenantID, AccountListItem accountListItem) throws Exception { Response result = null; - if (contains(targetTenantID, accountListItem.getTenants()) == false) { + if (!contains(targetTenantID, accountListItem.getTenants())) { String errMsg = String.format("Could not send a password request email to user ID='%s'. That account is not associated with the targeted tenant ID = '%s'.", accountListItem.getEmail(), targetTenantID); - result = Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errMsg).type("text/plain").build(); + result = Response.status(Response.Status.INTERNAL_SERVER_ERROR) + .entity(errMsg) + .type(MediaType.TEXT_PLAIN) + .build(); return result; } @@ -612,15 +679,12 @@ private Response requestPasswordReset(UriInfo ui, String targetTenantID, Account // // Configuring (via config files) the base URL is not supported as of CSpace v5.0. Log a warning if we find config for it. // - if (deprecatedConfigBaseUrl != null) { - if (deprecatedConfigBaseUrl.equalsIgnoreCase(baseUrl) == false) { - String warnMsg = String.format("Ignoring deprecated 'baseurl' email config value '%s'. Using '%s' instead.", - deprecatedConfigBaseUrl, baseUrl); - logger.warn(warnMsg); - } - } - - Token token = TokenStorageClient.create(accountListItem.getCsid(), targetTenantID, + if (deprecatedConfigBaseUrl != null && !deprecatedConfigBaseUrl.equalsIgnoreCase(baseUrl)) { + logger.warn("Ignoring deprecated 'baseurl' email config value '{}'. Using '{}' instead.", + deprecatedConfigBaseUrl, baseUrl); + } + + Token token = TokenStorageClient.create(accountListItem.getCsid(), targetTenantID, emailConfig.getPasswordResetConfig().getTokenExpirationSeconds()); String message = AuthorizationCommon.generatePasswordResetEmailMessage(emailConfig, accountListItem, token); String status = EmailUtil.sendMessage(emailConfig, accountListItem.getEmail(), message); @@ -661,8 +725,8 @@ public Response deleteAccount(@Context UriInfo uriInfo, @PathParam("csid") Strin // We need to delete the account and the account/role relationships in a // single transaction // - ServiceContext ctx = createServiceContext((AccountsCommon) null, - AccountsCommon.class, uriInfo); + ServiceContext ctx = createServiceContext(null, + AccountsCommon.class, uriInfo); TransactionContext transactionContext = ctx.openConnection(); try { transactionContext.beginTransaction(); @@ -713,7 +777,7 @@ public Response createAccountRole( return response; } - ServiceContext ctx = createServiceContext((AccountsCommon) null, AccountsCommon.class, uriInfo); + ServiceContext ctx = createServiceContext(null, AccountsCommon.class, uriInfo); ctx.openConnection(); try { AccountRoleSubResource subResource = @@ -802,8 +866,8 @@ public Response deleteAccountRole(String accCsid, AccountRole input) { return response; } - ServiceContext ctx = createServiceContext((AccountsCommon) null, - AccountsCommon.class, (UriInfo) null); + ServiceContext ctx = createServiceContext(null, + AccountsCommon.class, null); ctx.openConnection(); try { AccountRoleSubResource subResource = @@ -836,7 +900,7 @@ public Response deleteAccountRole(@Context UriInfo uriInfo, @PathParam("csid") S return response; } - ServiceContext ctx = createServiceContext((AccountsCommon) null, AccountsCommon.class, uriInfo); + ServiceContext ctx = createServiceContext(null, AccountsCommon.class, uriInfo); ctx.openConnection(); try { AccountRoleSubResource subResource = diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java b/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java index e1326b8c25..ff923520e4 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/storage/AccountStorageClient.java @@ -27,8 +27,10 @@ import java.util.HashMap; import org.collectionspace.services.account.AccountsCommon; +import org.collectionspace.services.account.validator.CSpacePasswordValidator; import org.collectionspace.services.account.storage.csidp.UserStorageClient; import org.collectionspace.services.authentication.User; +import org.collectionspace.services.common.ServiceMain; import org.collectionspace.services.common.context.ServiceContext; import org.collectionspace.services.common.document.BadRequestException; import org.collectionspace.services.common.document.DocumentException; @@ -42,7 +44,6 @@ import org.collectionspace.services.common.storage.jpa.JPATransactionContext; import org.collectionspace.services.common.storage.jpa.JpaStorageClientImpl; import org.collectionspace.services.common.storage.jpa.JpaStorageUtils; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -67,19 +68,25 @@ public String create(ServiceContext ctx, DocumentHandler handler) throws BadRequestException, DocumentException { String result = null; - + AccountsCommon account = null; - JPATransactionContext jpaConnectionContext = (JPATransactionContext)ctx.openConnection(); + JPATransactionContext jpaConnectionContext = (JPATransactionContext)ctx.openConnection(); try { account = (AccountsCommon) handler.getCommonPart(); + // Set a boolean here to indicate we need to validate password requirements because we want to skip + // when an account is being set up for sso and will have a generated password + boolean requiresValidation = account.getPassword() != null; handler.prepare(Action.CREATE); - DocumentWrapper wrapDoc = new DocumentWrapperImpl(account); + DocumentWrapper wrapDoc = new DocumentWrapperImpl<>(account); handler.handle(Action.CREATE, wrapDoc); jpaConnectionContext.beginTransaction(); // // If userid and password are given, add to default ID provider -i.e., add it to the Spring Security account list // if (account.getUserId() != null && isForCSpaceIdentityProvider(account.getPassword())) { + if (requiresValidation) { + validatePasswordRequirements(ctx, new String(account.getPassword())); + } User user = userStorageClient.create(account.getUserId(), account.getPassword()); jpaConnectionContext.persist(user); } @@ -87,7 +94,7 @@ public String create(ServiceContext ctx, // Now add the account to the CSpace list of accounts // account.setCreatedAt(new Date()); - jpaConnectionContext.persist(account); + jpaConnectionContext.persist(account); // // Finish creating related resources -e.g., account-role relationships // @@ -164,10 +171,8 @@ public void get(ServiceContext ctx, String id, DocumentHandler handler) @Override public void update(ServiceContext ctx, String id, DocumentHandler handler) - throws BadRequestException, DocumentNotFoundException, - DocumentException { - - JPATransactionContext jpaConnectionContext = (JPATransactionContext)ctx.openConnection(); + throws BadRequestException, DocumentException { + JPATransactionContext jpaConnectionContext = (JPATransactionContext)ctx.openConnection(); try { jpaConnectionContext.beginTransaction(); @@ -179,21 +184,18 @@ public void update(ServiceContext ctx, String id, DocumentHandler handler) // Note that this ignores the immutable flag, as we allow // password changes. if (accountReceived.getUserId() != null && isForCSpaceIdentityProvider(accountReceived.getPassword())) { + validatePasswordRequirements(ctx, new String(accountReceived.getPassword())); userStorageClient.update(jpaConnectionContext, accountReceived.getUserId(), accountReceived.getPassword()); } - DocumentWrapper wrapDoc = - new DocumentWrapperImpl(accountFound); + DocumentWrapper wrapDoc = new DocumentWrapperImpl<>(accountFound); handler.handle(Action.UPDATE, wrapDoc); handler.complete(Action.UPDATE, wrapDoc); jpaConnectionContext.commitTransaction(); - } catch (BadRequestException bre) { + } catch (BadRequestException | DocumentException bre) { jpaConnectionContext.markForRollback(); throw bre; - } catch (DocumentException de) { - jpaConnectionContext.markForRollback(); - throw de; } catch (Exception e) { jpaConnectionContext.markForRollback(); throw new DocumentException(e); @@ -202,6 +204,20 @@ public void update(ServiceContext ctx, String id, DocumentHandler handler) } } + private void validatePasswordRequirements(final ServiceContext ctx, String password) throws BadRequestException { + final var tenantId = ctx.getTenantId(); + final var tenantBindingConfigReader = ServiceMain.getInstance().getTenantBindingConfigReader(); + final var tenantBinding = tenantBindingConfigReader.getTenantBinding(tenantId); + + final var result = CSpacePasswordValidator.validatePasswordForTenant(tenantBinding, password); + + if (!result.isValid()) { + StringBuilder error = new StringBuilder("The password does not meet complexity requirements: "); + result.errors().forEach(errorCode -> error.append(errorCode).append("\n")); + throw new BadRequestException(error.toString()); + } + } + @Override public void delete(ServiceContext ctx, String id) throws DocumentNotFoundException, @@ -260,7 +276,7 @@ private boolean checkAllowedUpdates(AccountsCommon toAccount, AccountsCommon fro } /** - * isForCSIdP deteremines if the create/update is also needed for CS IdP + * isForCSIdP determines if the create/update is also needed for CS IdP * @param bpass * @return */ diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/TokenStorageClient.java b/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/TokenStorageClient.java index 5479046460..6b8fbe9816 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/TokenStorageClient.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/TokenStorageClient.java @@ -36,12 +36,9 @@ import javax.persistence.Query; import org.collectionspace.services.authentication.Token; -import org.collectionspace.services.common.document.BadRequestException; -import org.collectionspace.services.common.document.DocumentException; import org.collectionspace.services.common.document.DocumentNotFoundException; import org.collectionspace.services.common.document.JaxbUtils; import org.collectionspace.services.common.document.TransactionException; -import org.collectionspace.services.common.security.SecurityUtils; import org.collectionspace.services.common.storage.TransactionContext; import org.collectionspace.services.common.storage.jpa.JPATransactionContext; import org.collectionspace.services.common.storage.jpa.JpaStorageUtils; @@ -49,9 +46,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +/** + * This class manages db access for Token associated with a password reset request + */ public class TokenStorageClient { - static private final Logger logger = LoggerFactory.getLogger(TokenStorageClient.class); + private static final Logger logger = LoggerFactory.getLogger(TokenStorageClient.class); /** * create user with given userId and password @@ -59,7 +59,7 @@ public class TokenStorageClient { * @param password * @return user */ - static public Token create(String accountCsid, String tenantId, BigInteger expireSeconds) { + public static Token create(String accountCsid, String tenantId, BigInteger expireSeconds) { EntityManagerFactory emf = JpaStorageUtils.getEntityManagerFactory(); Token token = new Token(); @@ -92,7 +92,7 @@ static public Token create(String accountCsid, String tenantId, BigInteger expir * @param enabledFlag * @throws TransactionException */ - static public void update(TransactionContext transactionContext, String id, boolean enabledFlag) throws DocumentNotFoundException, TransactionException { + public static void update(TransactionContext transactionContext, String id, boolean enabledFlag) throws DocumentNotFoundException, TransactionException { Token tokenFound = null; tokenFound = get((JPATransactionContext)transactionContext, id); @@ -126,7 +126,7 @@ public static Token get(JPATransactionContext jpaTransactionContext, String id) return tokenFound; } - static public Token get(String id) throws DocumentNotFoundException { + public static Token get(String id) throws DocumentNotFoundException { Token tokenFound = null; EntityManagerFactory emf = JpaStorageUtils.getEntityManagerFactory(); @@ -152,7 +152,7 @@ static public Token get(String id) throws DocumentNotFoundException { * @param id * @throws Exception if user for given userId not found */ - static public void delete(String id) throws DocumentNotFoundException { + public static void delete(String id) throws DocumentNotFoundException { EntityManagerFactory emf = JpaStorageUtils.getEntityManagerFactory(); try { @@ -177,15 +177,4 @@ static public void delete(String id) throws DocumentNotFoundException { } } - private String getEncPassword(String userId, byte[] password) throws BadRequestException { - //jaxb unmarshaller already unmarshal xs:base64Binary, no need to b64 decode - //byte[] bpass = Base64.decodeBase64(accountReceived.getPassword()); - try { - SecurityUtils.validatePassword(new String(password)); - } catch (Exception e) { - throw new BadRequestException(e.getMessage()); - } - String secEncPasswd = SecurityUtils.createPasswordHash(new String(password)); - return secEncPasswd; - } } diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/UserStorageClient.java b/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/UserStorageClient.java index 3352c03b29..2ff77e15a7 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/UserStorageClient.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/storage/csidp/UserStorageClient.java @@ -64,7 +64,7 @@ public User create(String userId, byte[] password) throws Exception { User user = new User(); user.setUsername(userId); String salt = UUID.randomUUID().toString(); - user.setPasswd(getEncPassword(userId, password, salt)); + user.setPasswd(getEncPassword(password)); user.setSalt(salt); user.setCreatedAt(new Date()); return user; @@ -116,7 +116,7 @@ public void update(JPATransactionContext jpaTransactionContext, String userId, b User userFound = get(jpaTransactionContext, userId); if (userFound != null) { String salt = UUID.randomUUID().toString(); - userFound.setPasswd(getEncPassword(userId, password, salt)); + userFound.setPasswd(getEncPassword(password)); userFound.setSalt(salt); userFound.setUpdatedAt(new Date()); if (logger.isDebugEnabled()) { @@ -150,15 +150,7 @@ public void delete(JPATransactionContext jpaTransactionContext, String userId) } } - private String getEncPassword(String userId, byte[] password, String salt) throws BadRequestException { - //jaxb unmarshaller already unmarshal xs:base64Binary, no need to b64 decode - //byte[] bpass = Base64.decodeBase64(accountReceived.getPassword()); - try { - SecurityUtils.validatePassword(new String(password)); - } catch (Exception e) { - throw new BadRequestException(e.getMessage()); - } - String secEncPasswd = SecurityUtils.createPasswordHash(new String(password)); - return secEncPasswd; + private String getEncPassword(byte[] password) { + return SecurityUtils.createPasswordHash(new String(password)); } } diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/validator/CSpacePasswordValidator.java b/services/account/service/src/main/java/org/collectionspace/services/account/validator/CSpacePasswordValidator.java new file mode 100644 index 0000000000..119362ef18 --- /dev/null +++ b/services/account/service/src/main/java/org/collectionspace/services/account/validator/CSpacePasswordValidator.java @@ -0,0 +1,58 @@ +package org.collectionspace.services.account.validator; + +import java.util.ArrayList; +import java.util.List; + +import org.collectionspace.services.config.tenant.TenantBindingType; + +/** + * @since 9.0.0 + */ +public class CSpacePasswordValidator { + private CSpacePasswordValidator() {} + + /** + * Validate a password for a given tenant. + * @param binding The tenant binding which contains the password requirements + * @param password The password being validated + * @return The aggregate result from the validators created using the tenant binding + */ + public static ValidationResult validatePasswordForTenant(final TenantBindingType binding, final String password) { + final var validators = initializeForTenant(binding); + return validators.stream() + .map(validator -> validator.validate(password)) + .reduce(new ValidationResult(), ValidationResult::merge); + } + + private static List initializeForTenant(final TenantBindingType binding) { + final var config = binding.getPasswordRequirementConfig(); + + final var validators = new ArrayList(); + validators.add(new MaxLengthValidator()); + if (config != null && config.isEnabled()) { + final var minLength = config.getMinLength(); + if (minLength != null) { + validators.add(new MinLengthValidator(minLength)); + } + + if (config.isRequireLowerCase()) { + validators.add(RegexValidator.LOWER_CASE_VALIDATOR); + } + + if (config.isRequireUpperCase()) { + validators.add(RegexValidator.UPPER_CASE_VALIDATOR); + } + + if (config.isRequireDigit()) { + validators.add(RegexValidator.DIGIT_CASE_VALIDATOR); + } + + if (config.isRequireSpecial()) { + validators.add(RegexValidator.SPECIAL_CASE_VALIDATOR); + } + } + + return validators; + } + +} diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/validator/MaxLengthValidator.java b/services/account/service/src/main/java/org/collectionspace/services/account/validator/MaxLengthValidator.java new file mode 100644 index 0000000000..d7f6b19a66 --- /dev/null +++ b/services/account/service/src/main/java/org/collectionspace/services/account/validator/MaxLengthValidator.java @@ -0,0 +1,21 @@ +package org.collectionspace.services.account.validator; + +import java.nio.charset.StandardCharsets; + +/** + * Max Length validation check to ensure that the password is not greater than 72 bytes to conform with bcrypt. + * + * @since 9.0.0 + */ +public class MaxLengthValidator implements PasswordValidator { + public static final int MAX_LENGTH = 72; + + @Override + public ValidationResult validate(final String password) { + if (password != null && password.getBytes(StandardCharsets.UTF_8).length > MAX_LENGTH) { + return new ValidationResult(ValidationErrorCode.ERR_TOO_LONG); + } + + return new ValidationResult(); + } +} diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/validator/MinLengthValidator.java b/services/account/service/src/main/java/org/collectionspace/services/account/validator/MinLengthValidator.java new file mode 100644 index 0000000000..c5567fd4c1 --- /dev/null +++ b/services/account/service/src/main/java/org/collectionspace/services/account/validator/MinLengthValidator.java @@ -0,0 +1,23 @@ +package org.collectionspace.services.account.validator; + +/** + * Validator that checks the length of a password is greater than a given minimum length + * @since 9.0.0 + */ +public class MinLengthValidator implements PasswordValidator { + + private final int minLength; + + public MinLengthValidator(final int minLength) { + this.minLength = minLength; + } + + @Override + public ValidationResult validate(final String password) { + if (password.length() < minLength) { + return new ValidationResult(ValidationErrorCode.ERR_TOO_SHORT); + } + + return new ValidationResult(); + } +} diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/validator/PasswordValidator.java b/services/account/service/src/main/java/org/collectionspace/services/account/validator/PasswordValidator.java new file mode 100644 index 0000000000..109f624ff7 --- /dev/null +++ b/services/account/service/src/main/java/org/collectionspace/services/account/validator/PasswordValidator.java @@ -0,0 +1,9 @@ +package org.collectionspace.services.account.validator; + +/** + * @since 9.0.0 + */ +@FunctionalInterface +public interface PasswordValidator { + ValidationResult validate(String password); +} diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/validator/RegexValidator.java b/services/account/service/src/main/java/org/collectionspace/services/account/validator/RegexValidator.java new file mode 100644 index 0000000000..7ee9fa04e1 --- /dev/null +++ b/services/account/service/src/main/java/org/collectionspace/services/account/validator/RegexValidator.java @@ -0,0 +1,45 @@ +package org.collectionspace.services.account.validator; + +import java.util.regex.Pattern; + +/** + * Validator that looks for a regular expression in a password. + * + * Four default validators are provided for: + * - lower case ([a-z]) + * - upper case ([A-Z]) + * - digits (\d) + * - special characters (Punct) + * @since 9.0.0 + */ +public class RegexValidator implements PasswordValidator { + public static final RegexValidator LOWER_CASE_VALIDATOR = + new RegexValidator(Pattern.compile("[a-z]"), ValidationErrorCode.ERR_MISSING_LOWERCASE); + + public static final RegexValidator UPPER_CASE_VALIDATOR = + new RegexValidator(Pattern.compile("[A-Z]"), ValidationErrorCode.ERR_MISSING_UPPERCASE); + + public static final RegexValidator DIGIT_CASE_VALIDATOR = + new RegexValidator(Pattern.compile("\\d"), ValidationErrorCode.ERR_MISSING_DIGIT); + + public static final RegexValidator SPECIAL_CASE_VALIDATOR = + new RegexValidator(Pattern.compile("\\p{Punct}"), ValidationErrorCode.ERR_MISSING_SPECIAL); + + private final Pattern pattern; + private final ValidationErrorCode errorCode; + + public RegexValidator(final Pattern pattern, final ValidationErrorCode errorCode) { + this.pattern = pattern; + this.errorCode = errorCode; + } + + @Override + public ValidationResult validate(final String password) { + final var matcher = pattern.matcher(password); + if (!matcher.find()) { + return new ValidationResult(errorCode); + } + + return new ValidationResult(); + } +} diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/validator/ValidationErrorCode.java b/services/account/service/src/main/java/org/collectionspace/services/account/validator/ValidationErrorCode.java new file mode 100644 index 0000000000..3e71732ef1 --- /dev/null +++ b/services/account/service/src/main/java/org/collectionspace/services/account/validator/ValidationErrorCode.java @@ -0,0 +1,13 @@ +package org.collectionspace.services.account.validator; + +/** + * @since 9.0.0 + */ +public enum ValidationErrorCode { + ERR_TOO_LONG, + ERR_TOO_SHORT, + ERR_MISSING_LOWERCASE, + ERR_MISSING_UPPERCASE, + ERR_MISSING_DIGIT, + ERR_MISSING_SPECIAL; +} diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/validator/ValidationResult.java b/services/account/service/src/main/java/org/collectionspace/services/account/validator/ValidationResult.java new file mode 100644 index 0000000000..e9d1007283 --- /dev/null +++ b/services/account/service/src/main/java/org/collectionspace/services/account/validator/ValidationResult.java @@ -0,0 +1,37 @@ +package org.collectionspace.services.account.validator; + +import java.util.ArrayList; +import java.util.List; + +/** + * Result of a Password Validation. Success is inferred by checking that the errors tracked are empty. Multiple results + * can be merged to form an aggregation of multiple validators (non-deduplicated). + * + * See {@link CSpacePasswordValidator} for usage and how multiple results are + * aggregated. + * @since 9.0.0 + */ +public final class ValidationResult { + private final List errors = new ArrayList<>(); + + public ValidationResult() { + } + + public ValidationResult(final ValidationErrorCode errorCode) { + errors.add(errorCode); + } + + public boolean isValid() { + return errors.isEmpty(); + } + + public ValidationResult merge(final ValidationResult rhs) { + errors().addAll(rhs.errors()); + return this; + } + + public List errors() { + return errors; + } + +} diff --git a/services/account/service/src/test/java/org/collectionspace/services/account/validator/CSpacePasswordValidatorTest.java b/services/account/service/src/test/java/org/collectionspace/services/account/validator/CSpacePasswordValidatorTest.java new file mode 100644 index 0000000000..42d77aface --- /dev/null +++ b/services/account/service/src/test/java/org/collectionspace/services/account/validator/CSpacePasswordValidatorTest.java @@ -0,0 +1,134 @@ +package org.collectionspace.services.account.validator; + +import static org.collectionspace.services.account.validator.CSpacePasswordValidator.validatePasswordForTenant; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + +import java.util.List; + +import org.apache.commons.lang3.RandomStringUtils; +import org.collectionspace.services.config.tenant.PasswordRequirementConfig; +import org.collectionspace.services.config.tenant.TenantBindingType; +import org.testng.annotations.Test; + +public class CSpacePasswordValidatorTest { + + private static final String SHORT_PASS = "few"; + private static final String LONG_PASS = "AStringWithLength>10"; + private static final String LOWER_CASE_PASS = "alowercasepassword"; + private static final String UPPER_CASE_PASS = "ANUPPERCASEPASSWORD"; + private static final String DIGIT_PASS = "0123456789"; + private static final String SPECIAL_PASS = "another!"; + + @Test + public void testNoConfig() { + final var binding = genBinding(false); + assertTrue(validatePasswordForTenant(binding, SHORT_PASS).isValid()); + assertTrue(validatePasswordForTenant(binding, LOWER_CASE_PASS).isValid()); + assertTrue(validatePasswordForTenant(binding, UPPER_CASE_PASS).isValid()); + assertTrue(validatePasswordForTenant(binding, DIGIT_PASS).isValid()); + assertTrue(validatePasswordForTenant(binding, SPECIAL_PASS).isValid()); + } + + @Test + public void testMinLength() { + final var binding = genBinding(true); + binding.getPasswordRequirementConfig().setMinLength(10); + + assertTrue(validatePasswordForTenant(binding, LONG_PASS).isValid()); + runInvalidCheck(SHORT_PASS, List.of(ValidationErrorCode.ERR_TOO_SHORT), binding); + } + + @Test + public void testMaxLength() { + final var binding = genBinding(true); + + final var validAscii = RandomStringUtils.insecure().nextAscii(MaxLengthValidator.MAX_LENGTH); + final var invalidAscii = RandomStringUtils.insecure().nextAscii(MaxLengthValidator.MAX_LENGTH + 1); + assertTrue(validatePasswordForTenant(binding, validAscii).isValid()); + runInvalidCheck(invalidAscii, List.of(ValidationErrorCode.ERR_TOO_LONG), binding); + + // test Unicode passwords using a 4 byte character + int maxReps = (MaxLengthValidator.MAX_LENGTH / 4); + final var unicode = "\uD801\uDC5C"; + assertTrue(validatePasswordForTenant(binding, unicode.repeat(maxReps)).isValid()); + runInvalidCheck(unicode.repeat(maxReps + 1), List.of(ValidationErrorCode.ERR_TOO_LONG), binding); + } + + @Test + public void testLowerCase() { + final var binding = genBinding(true); + binding.getPasswordRequirementConfig().setRequireLowerCase(true); + + assertTrue(validatePasswordForTenant(binding, LOWER_CASE_PASS).isValid()); + + runInvalidCheck(UPPER_CASE_PASS, List.of(ValidationErrorCode.ERR_MISSING_LOWERCASE), binding); + runInvalidCheck(DIGIT_PASS, List.of(ValidationErrorCode.ERR_MISSING_LOWERCASE), binding); + } + + @Test + public void testUpperCase() { + final var binding = genBinding(true); + binding.getPasswordRequirementConfig().setRequireUpperCase(true); + + assertTrue(validatePasswordForTenant(binding, UPPER_CASE_PASS).isValid()); + + runInvalidCheck(LOWER_CASE_PASS, List.of(ValidationErrorCode.ERR_MISSING_UPPERCASE), binding); + runInvalidCheck(DIGIT_PASS, List.of(ValidationErrorCode.ERR_MISSING_UPPERCASE), binding); + runInvalidCheck(SPECIAL_PASS, List.of(ValidationErrorCode.ERR_MISSING_UPPERCASE), binding); + } + + @Test + public void testDigits() { + final var binding = genBinding(true); + binding.getPasswordRequirementConfig().setRequireDigit(true); + + assertTrue(validatePasswordForTenant(binding, DIGIT_PASS).isValid()); + + runInvalidCheck(LOWER_CASE_PASS, List.of(ValidationErrorCode.ERR_MISSING_DIGIT), binding); + runInvalidCheck(UPPER_CASE_PASS, List.of(ValidationErrorCode.ERR_MISSING_DIGIT), binding); + runInvalidCheck(SPECIAL_PASS, List.of(ValidationErrorCode.ERR_MISSING_DIGIT), binding); + } + + @Test + public void testSpecialChars() { + final var binding = genBinding(true); + binding.getPasswordRequirementConfig().setRequireSpecial(true); + + assertTrue(validatePasswordForTenant(binding, SPECIAL_PASS).isValid()); + + runInvalidCheck(LOWER_CASE_PASS, List.of(ValidationErrorCode.ERR_MISSING_SPECIAL), binding); + runInvalidCheck(UPPER_CASE_PASS, List.of(ValidationErrorCode.ERR_MISSING_SPECIAL), binding); + runInvalidCheck(DIGIT_PASS, List.of(ValidationErrorCode.ERR_MISSING_SPECIAL), binding); + } + + @Test + public void testMultipleConstraints() { + final var binding = genBinding(true); + binding.getPasswordRequirementConfig().setRequireLowerCase(true); + binding.getPasswordRequirementConfig().setRequireSpecial(true); + + assertTrue(validatePasswordForTenant(binding, SPECIAL_PASS).isValid()); + + final var expected = List.of(ValidationErrorCode.ERR_MISSING_LOWERCASE, + ValidationErrorCode.ERR_MISSING_SPECIAL); + runInvalidCheck(UPPER_CASE_PASS, expected, binding); + runInvalidCheck(DIGIT_PASS, expected, binding); + } + + private void runInvalidCheck(final String invalidPassword, + final List errorCodes, + final TenantBindingType binding) { + final var invalidResult = validatePasswordForTenant(binding, invalidPassword); + assertFalse(invalidResult.isValid()); + assertTrue(invalidResult.errors().containsAll(errorCodes)); + } + + private TenantBindingType genBinding(final boolean enabled) { + final var complexityConfig = new PasswordRequirementConfig(); + complexityConfig.setEnabled(enabled); + final var binding = new TenantBindingType(); + binding.setPasswordRequirementConfig(complexityConfig); + return binding; + } +} \ No newline at end of file diff --git a/services/authorization/service/src/main/java/org/collectionspace/services/authorization/AuthZ.java b/services/authorization/service/src/main/java/org/collectionspace/services/authorization/AuthZ.java index 1062611348..ed1ea01eb5 100644 --- a/services/authorization/service/src/main/java/org/collectionspace/services/authorization/AuthZ.java +++ b/services/authorization/service/src/main/java/org/collectionspace/services/authorization/AuthZ.java @@ -68,6 +68,7 @@ private AuthZ() { public static final String ACCOUNT_ROLES = "accounts/*/accountroles"; public static final String STRUCTURED_DATE_REQUEST = "structureddate"; public static final String PASSWORD_RESET = "accounts/requestpasswordreset"; + public static final String PASSWORD_COMPLEXITY_REQS = "accounts/passwordrequirements"; public static final String PROCESS_PASSWORD_RESET = "accounts/processpasswordreset"; public static final String REPORTS_INVOKE = "reports/*/invoke"; public static final String BATCH_INVOKE = "batch/*/invoke"; @@ -76,7 +77,7 @@ private AuthZ() { * * @return */ - public final static AuthZ get() { + public static AuthZ get() { return self; } 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 bddc57641a..afee199087 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 @@ -88,6 +88,14 @@ public class SecurityInterceptor implements ContainerRequestFilter, ContainerRes private static final String SYSTEM_INFO = SystemInfoClient.SERVICE_NAME; private static final String HEALTH = "health"; private static final String NUXEO_ADMIN = null; + + private static final Set ANONYMOUS_RESOURCES = Set.of( + AuthZ.PASSWORD_RESET, + AuthZ.PROCESS_PASSWORD_RESET, + AuthZ.PASSWORD_COMPLEXITY_REQS, + LOGIN, LOGOUT, + SYSTEM_INFO, HEALTH); + // // Use this thread specific member instance to hold our login context with Nuxeo // @@ -106,16 +114,9 @@ private boolean isAnonymousRequest(ContainerRequestContext requestContext) { boolean result = false; String resName = SecurityUtils.getResourceName(requestContext.getUriInfo()).toLowerCase(); - switch (resName) { - case AuthZ.PASSWORD_RESET: - case AuthZ.PROCESS_PASSWORD_RESET: - case LOGIN: - case LOGOUT: - case SYSTEM_INFO: - case HEALTH: - case "": - return true; - } + if (ANONYMOUS_RESOURCES.contains(resName) || resName.isEmpty()) { + return true; + } Class resourceClass = resourceInfo.getResourceClass(); try { 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 7ee3ed3c5a..078e0d80af 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 @@ -67,8 +67,6 @@ public class SecurityUtils { private static final Logger logger = LoggerFactory.getLogger(SecurityUtils.class); public static final String URI_PATH_SEPARATOR = "/"; - public static final int MIN_PASSWORD_LENGTH = 8; - public static final int MAX_PASSWORD_LENGTH = 24; public static final String BASE64_ENCODING = "BASE64"; public static final String BASE16_ENCODING = "HEX"; @@ -113,25 +111,6 @@ public static String createPasswordHash(String password) { return encoder.encode(password); } - /** - * validatePassword validates password per configured password policy - * @param password - */ - public static void validatePassword(String password) { - if (password == null) { - String msg = "Password missing "; - logger.error(msg); - throw new IllegalArgumentException(msg); - } - if (password.length() < MIN_PASSWORD_LENGTH - || password.length() > MAX_PASSWORD_LENGTH) { - String msg = "Bad password: '"+password+"': length should be >= " - + MIN_PASSWORD_LENGTH + " and <= " + MAX_PASSWORD_LENGTH; - logger.error(msg); - throw new IllegalArgumentException(msg); - } - } - public static String getWorkflowResourceName(ContainerRequestContext requestContext) { String result = null; diff --git a/services/config/src/main/resources/tenant.xsd b/services/config/src/main/resources/tenant.xsd index 6f40187085..940e847ec5 100644 --- a/services/config/src/main/resources/tenant.xsd +++ b/services/config/src/main/resources/tenant.xsd @@ -51,6 +51,7 @@ + @@ -250,4 +251,30 @@ + + + + + + Configuration for how password restriction in a tenant + + + + + + + + + + + + From 6fcc23bfc3fbef399efe159985fb22f069ff9198 Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Tue, 21 Jul 2026 15:30:22 +0300 Subject: [PATCH 29/40] DRYD-2131: normalize NXQL timestamp literals to UTC instead of server-local time; --- .../nuxeo/client/java/CoreSessionWrapper.java | 84 +++++++++---------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionWrapper.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionWrapper.java index 953e9ed5ca..ba76816bad 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionWrapper.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/CoreSessionWrapper.java @@ -4,10 +4,9 @@ import java.net.URLDecoder; import java.net.URLEncoder; import java.security.Principal; -import java.time.Instant; import java.time.LocalDateTime; +import java.time.OffsetDateTime; import java.time.ZoneId; -import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; import java.util.regex.Matcher; @@ -32,24 +31,24 @@ public class CoreSessionWrapper implements CoreSessionInterface { private CoreSession repoSession; private boolean transactionSetForRollback = false; - + /** The logger. */ private static Logger logger = LoggerFactory.getLogger(CoreSessionWrapper.class); - + private void logQuery(String query) { logger.debug(String.format("NXQL: %s", query)); } - + private void logQuery(String query, String queryType) { logger.debug(String.format("Query Type: '%s' NXQL: %s", queryType, query)); } - + private void logQuery(String query, Filter filter, long limit, long offset, boolean countTotal) { logger.debug(String.format("Filter: '%s', Limit: '%d', Offset: '%d', Count Total?: %b, NXQL: %s", filter != null ? filter.toString() : "none", limit, offset, countTotal, query)); } - + public CoreSessionWrapper(CoreSession repoSession) { this.repoSession = repoSession; } @@ -62,7 +61,7 @@ public void setTransactionRollbackOnly() { TransactionHelper.setTransactionRollbackOnly(); transactionSetForRollback = true; } - + @Override public boolean isTransactionMarkedForRollbackOnly() { if (transactionSetForRollback != TransactionHelper.isTransactionMarkedRollback()) { @@ -71,17 +70,17 @@ public boolean isTransactionMarkedForRollbackOnly() { } return transactionSetForRollback; } - + @Override public CoreSession getCoreSession() { return repoSession; } - + @Override public String getSessionId() { return repoSession.getSessionId(); } - + @Override public void close() throws Exception { try { @@ -103,7 +102,7 @@ public void close() throws Exception { public DocumentModel getRootDocument() throws NuxeoException { return repoSession.getRootDocument(); } - + /** * Returns the repository name against which this core session is bound. * @@ -113,7 +112,7 @@ public DocumentModel getRootDocument() throws NuxeoException { public String getRepositoryName() { return repoSession.getRepositoryName(); } - + /** * Gets the principal that created the client session. * @@ -123,56 +122,57 @@ public String getRepositoryName() { public Principal getPrincipal() { return repoSession.getPrincipal(); } - - private String toLocalTimestamp(String utcTime, boolean base64Encoded) throws DocumentException { + + private String toUtcTimestamp(String time, boolean base64Encoded) throws DocumentException { String result = null; try { if (base64Encoded == true) { - utcTime = URLDecoder.decode(utcTime, java.nio.charset.StandardCharsets.UTF_8.name()); + time = URLDecoder.decode(time, java.nio.charset.StandardCharsets.UTF_8.name()); } - LocalDateTime localTime; + String utcTime; try { - Instant instant = Instant.parse(utcTime); - ZonedDateTime localInstant = instant.atZone(ZoneId.systemDefault()); // DateTimeFormatter.ISO_LOCAL_DATE_TIME - localTime = localInstant.toLocalDateTime(); + // Zone-qualified values (Zulu formatted or with an explicit offset) + utcTime = OffsetDateTime.parse(time).toInstant().toString(); } catch (DateTimeParseException e) { - localTime = LocalDateTime.parse(utcTime, DateTimeFormatter.ISO_LOCAL_DATE_TIME); + // Unqualified values are in server local time + utcTime = LocalDateTime.parse(time, DateTimeFormatter.ISO_LOCAL_DATE_TIME) + .atZone(ZoneId.systemDefault()).toInstant().toString(); } - result = localTime.toString(); + result = utcTime; if (base64Encoded == true) { result = URLEncoder.encode(result, java.nio.charset.StandardCharsets.UTF_8.name()); } } catch (UnsupportedEncodingException e) { throw new DocumentException(e); } - + return result; } - - private String localizeTimestamps(String query) throws DocumentException { + + private String normalizeTimestampsToUtc(String query) throws DocumentException { String result = query; - + if (query.contains("TIMESTAMP")) { StringBuffer stringBuffer = new StringBuffer(); Pattern pattern = Pattern.compile("\\sTIMESTAMP\\s\"(.+?)\""); Matcher matcher = pattern.matcher(query); while (matcher.find()) { String time = matcher.group(1); - String localizedTime = toLocalTimestamp(time, false); - matcher.appendReplacement(stringBuffer, String.format(" TIMESTAMP \"%s\"", localizedTime)); + String normalizedTime = toUtcTimestamp(time, false); + matcher.appendReplacement(stringBuffer, String.format(" TIMESTAMP \"%s\"", normalizedTime)); } matcher.appendTail(stringBuffer); result = stringBuffer.toString(); } - + return result; } @Override public IterableQueryResult queryAndFetch(String query, String queryType, Object... params) throws NuxeoException, DocumentException { - query = localizeTimestamps(query); + query = normalizeTimestampsToUtc(query); logQuery(query, queryType); return repoSession.queryAndFetch(query, queryType, params); } @@ -180,28 +180,28 @@ public IterableQueryResult queryAndFetch(String query, String queryType, @Override public DocumentModelList query(String query, Filter filter, long limit, long offset, boolean countTotal) throws NuxeoException, DocumentException { - query = localizeTimestamps(query); + query = normalizeTimestampsToUtc(query); logQuery(query, filter, limit, offset, countTotal); return repoSession.query(query, filter, limit, offset, countTotal); } @Override public DocumentModelList query(String query, int max) throws NuxeoException, DocumentException { - query = localizeTimestamps(query); + query = normalizeTimestampsToUtc(query); logQuery(query); return repoSession.query(query, max); } - + @Override public DocumentModelList query(String query) throws NuxeoException, DocumentException { - query = localizeTimestamps(query); + query = normalizeTimestampsToUtc(query); logQuery(query); return repoSession.query(query); } - + @Override public DocumentModelList query(String query, LifeCycleFilter workflowStateFilter) throws DocumentException { - query = localizeTimestamps(query); + query = normalizeTimestampsToUtc(query); return repoSession.query(query, workflowStateFilter); } @@ -227,7 +227,7 @@ public DocumentModel getDocument(DocumentRef docRef) throws NuxeoException { @Override public DocumentModel saveDocument(DocumentModel docModel) throws NuxeoException { DocumentModel result = null; - + try { if (isTransactionMarkedForRollbackOnly() == false) { result = repoSession.saveDocument(docModel); @@ -239,7 +239,7 @@ public DocumentModel saveDocument(DocumentModel docModel) throws NuxeoException setTransactionRollbackOnly(); throw t; } - + return result; } @@ -310,7 +310,7 @@ public DocumentModel createDocumentModel(String parentPath, String id, String typeName) throws NuxeoException { return repoSession.createDocumentModel(parentPath, id, typeName); } - + /** * Creates a document using given document model for initialization. *

@@ -326,7 +326,7 @@ public DocumentModel createDocumentModel(String parentPath, String id, public DocumentModel createDocument(DocumentModel model) throws NuxeoException { return repoSession.createDocument(model); } - + /** * Gets the children of the given parent. * @@ -340,6 +340,6 @@ public DocumentModelList getChildren(DocumentRef parent) throws NuxeoException { return repoSession.getChildren(parent); } - - + + } From f9f30c0afd9519e53d03751a98a32118ffe959d1 Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Tue, 21 Jul 2026 13:40:07 -0600 Subject: [PATCH 30/40] DRYD-2138: Avoid DeURNing of ObjectNameControlleed (#553) --- CHANGELOG.md | 1 + .../advancedsearch/model/ObjectNameListModel.java | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d451debcaf..18ce1949eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Add password complexity requirements to tenant bindings * Add password validators which verify passwords meet requirements set by tenants * Enable strict checksum verification so that builds fail on corrupted Maven artifact downloads +* Remove de-urning of objectNameControlled refname in the AdvancedSearch API ## 8.3.0 diff --git a/services/advancedsearch/jaxb/src/main/java/org/collectionspace/services/advancedsearch/model/ObjectNameListModel.java b/services/advancedsearch/jaxb/src/main/java/org/collectionspace/services/advancedsearch/model/ObjectNameListModel.java index 09024828d2..0eed159785 100644 --- a/services/advancedsearch/jaxb/src/main/java/org/collectionspace/services/advancedsearch/model/ObjectNameListModel.java +++ b/services/advancedsearch/jaxb/src/main/java/org/collectionspace/services/advancedsearch/model/ObjectNameListModel.java @@ -4,9 +4,9 @@ import org.collectionspace.services.collectionobject.CollectionobjectsCommon; import org.collectionspace.services.collectionobject.ObjectNameGroup; -import org.collectionspace.services.common.api.RefNameUtils; public class ObjectNameListModel { + private ObjectNameListModel() {} /** * @param collectionObject The CollectionObject Common part @@ -18,11 +18,8 @@ public static String objectNameControlled(final CollectionobjectsCommon collecti if (collectionObject != null && collectionObject.getObjectNameList() != null) { final List objectNameGroups = collectionObject.getObjectNameList().getObjectNameGroup(); if (!objectNameGroups.isEmpty()) { - final ObjectNameGroup objectNameGroup = objectNameGroups.get(0); - try { - objectNameControlled = RefNameUtils.getDisplayName(objectNameGroup.getObjectNameControlled()); - } catch (IllegalArgumentException ignored) { - } + final ObjectNameGroup objectNameGroup = objectNameGroups.getFirst(); + objectNameControlled = objectNameGroup.getObjectNameControlled(); } } @@ -38,7 +35,7 @@ public static String objectName(final CollectionobjectsCommon collectionObject) if (collectionObject!= null && collectionObject.getObjectNameList() != null) { final List objectNameGroups = collectionObject.getObjectNameList().getObjectNameGroup(); if (!objectNameGroups.isEmpty()) { - final ObjectNameGroup objectNameGroup = objectNameGroups.get(0); + final ObjectNameGroup objectNameGroup = objectNameGroups.getFirst(); objectName = objectNameGroup.getObjectName(); } } From c8de349555dac513342a4fcd2645db83d6d529dc Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Tue, 21 Jul 2026 13:40:58 -0600 Subject: [PATCH 31/40] No Jira: Fix Failing AccountServiceTest (#554) Always create a min length validator. This uses a default value of 8 in the event no configuration is provided which matches the previous default. --- .../validator/CSpacePasswordValidator.java | 6 +----- .../account/validator/MinLengthValidator.java | 13 +++++++++++-- .../validator/CSpacePasswordValidatorTest.java | 18 ++++++++++++++++-- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/validator/CSpacePasswordValidator.java b/services/account/service/src/main/java/org/collectionspace/services/account/validator/CSpacePasswordValidator.java index 119362ef18..377e3999b0 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/validator/CSpacePasswordValidator.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/validator/CSpacePasswordValidator.java @@ -29,12 +29,8 @@ private static List initializeForTenant(final TenantBindingTy final var validators = new ArrayList(); validators.add(new MaxLengthValidator()); + validators.add(new MinLengthValidator(config)); if (config != null && config.isEnabled()) { - final var minLength = config.getMinLength(); - if (minLength != null) { - validators.add(new MinLengthValidator(minLength)); - } - if (config.isRequireLowerCase()) { validators.add(RegexValidator.LOWER_CASE_VALIDATOR); } diff --git a/services/account/service/src/main/java/org/collectionspace/services/account/validator/MinLengthValidator.java b/services/account/service/src/main/java/org/collectionspace/services/account/validator/MinLengthValidator.java index c5567fd4c1..4420479a08 100644 --- a/services/account/service/src/main/java/org/collectionspace/services/account/validator/MinLengthValidator.java +++ b/services/account/service/src/main/java/org/collectionspace/services/account/validator/MinLengthValidator.java @@ -1,15 +1,24 @@ package org.collectionspace.services.account.validator; +import java.util.Optional; + +import org.collectionspace.services.config.tenant.PasswordRequirementConfig; + /** * Validator that checks the length of a password is greater than a given minimum length * @since 9.0.0 */ public class MinLengthValidator implements PasswordValidator { + public static final int DEFAULT_MIN_LENGTH = 8; + private final int minLength; - public MinLengthValidator(final int minLength) { - this.minLength = minLength; + public MinLengthValidator(final PasswordRequirementConfig config) { + this.minLength = Optional.ofNullable(config) + .filter(PasswordRequirementConfig::isEnabled) + .map(PasswordRequirementConfig::getMinLength) + .orElse(DEFAULT_MIN_LENGTH); } @Override diff --git a/services/account/service/src/test/java/org/collectionspace/services/account/validator/CSpacePasswordValidatorTest.java b/services/account/service/src/test/java/org/collectionspace/services/account/validator/CSpacePasswordValidatorTest.java index 42d77aface..6286bed75d 100644 --- a/services/account/service/src/test/java/org/collectionspace/services/account/validator/CSpacePasswordValidatorTest.java +++ b/services/account/service/src/test/java/org/collectionspace/services/account/validator/CSpacePasswordValidatorTest.java @@ -23,18 +23,32 @@ public class CSpacePasswordValidatorTest { @Test public void testNoConfig() { final var binding = genBinding(false); - assertTrue(validatePasswordForTenant(binding, SHORT_PASS).isValid()); + assertTrue(validatePasswordForTenant(binding, LONG_PASS).isValid()); assertTrue(validatePasswordForTenant(binding, LOWER_CASE_PASS).isValid()); assertTrue(validatePasswordForTenant(binding, UPPER_CASE_PASS).isValid()); assertTrue(validatePasswordForTenant(binding, DIGIT_PASS).isValid()); assertTrue(validatePasswordForTenant(binding, SPECIAL_PASS).isValid()); + + // Min and Max length checks are enabled by default, just check minimum here + runInvalidCheck(SHORT_PASS, List.of(ValidationErrorCode.ERR_TOO_SHORT), binding); } @Test public void testMinLength() { final var binding = genBinding(true); - binding.getPasswordRequirementConfig().setMinLength(10); + // short passwords can be allowed + binding.getPasswordRequirementConfig().setMinLength(3); + assertTrue(validatePasswordForTenant(binding, SHORT_PASS).isValid()); + assertTrue(validatePasswordForTenant(binding, LONG_PASS).isValid()); + + // short passwords can be disallowed + binding.getPasswordRequirementConfig().setMinLength(LONG_PASS.length() + 1); + runInvalidCheck(LONG_PASS, List.of(ValidationErrorCode.ERR_TOO_SHORT), binding); + runInvalidCheck(SHORT_PASS, List.of(ValidationErrorCode.ERR_TOO_SHORT), binding); + + // validate null values do not cause exceptions + binding.getPasswordRequirementConfig().setMinLength(null); assertTrue(validatePasswordForTenant(binding, LONG_PASS).isValid()); runInvalidCheck(SHORT_PASS, List.of(ValidationErrorCode.ERR_TOO_SHORT), binding); } From 01c9876706b9b6b0a82855453e705df6181ebaea Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Wed, 22 Jul 2026 17:30:59 +0300 Subject: [PATCH 32/40] DRYD-2117: use the top media priority record for the search results thumbnail; --- CHANGELOG.md | 1 + .../advancedsearch/AdvancedSearch.java | 121 ++++++++++++++++-- 2 files changed, 112 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d451debcaf..ca12917e02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Add home location to collectionobject schema and advanced search * Denormalize media priority list +* Use the top media priority record for the thumbnail in advanced search results * Add password complexity requirements to tenant bindings * Add password validators which verify passwords meet requirements set by tenants * Enable strict checksum verification so that builds fail on corrupted Maven artifact downloads diff --git a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java index edfd735f14..890664cc94 100644 --- a/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java +++ b/services/advancedsearch/service/src/main/java/org/collectionspace/services/advancedsearch/AdvancedSearch.java @@ -1,6 +1,11 @@ package org.collectionspace.services.advancedsearch; +import static org.collectionspace.services.client.CollectionSpaceClient.PART_COMMON_LABEL; +import static org.collectionspace.services.client.CollectionSpaceClient.PART_LABEL_SEPARATOR; + +import java.util.ArrayList; import java.util.Collections; +import java.util.List; import java.util.Map; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -18,11 +23,16 @@ import org.collectionspace.services.MediaJAXBSchema; import org.collectionspace.services.advancedsearch.AdvancedsearchCommonList.AdvancedsearchListItem; import org.collectionspace.services.advancedsearch.mapper.CollectionObjectMapper; +import org.collectionspace.services.client.CollectionObjectClient; import org.collectionspace.services.client.IClientQueryParams; import org.collectionspace.services.client.IQueryManager; +import org.collectionspace.services.client.PayloadOutputPart; +import org.collectionspace.services.client.PoxPayloadOut; +import org.collectionspace.services.client.workflow.WorkflowClient; import org.collectionspace.services.collectionobject.CollectionObjectResource; import org.collectionspace.services.common.AbstractCollectionSpaceResourceImpl; import org.collectionspace.services.common.UriInfoWrapper; +import org.collectionspace.services.common.api.RefNameUtils; import org.collectionspace.services.common.context.RemoteServiceContextFactory; import org.collectionspace.services.common.context.ServiceContextFactory; import org.collectionspace.services.common.relation.RelationResource; @@ -34,7 +44,9 @@ import org.collectionspace.services.relation.RelationsCommonList; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.w3c.dom.NodeList; /** * This class defines the advanced search endpoints. @@ -56,14 +68,18 @@ public class AdvancedSearch private static final String PAGE_NUM = "0"; private static final String MEDIA_SORT_BY = "media_common:title"; + private static final String COLLECTIONOBJECT_COMMON_PART_NAME = + CollectionObjectClient.SERVICE_NAME + PART_LABEL_SEPARATOR + PART_COMMON_LABEL; + private static final String MEDIA_PRIORITY_FIELD = "mediaPriority"; + public AdvancedSearch() { super(); } /** * Primary advanced search API endpoint. - * - * @param request The incoming request. Injected. + * + * @param request The incoming request. Injected. * @param uriInfo The URI info of the incoming request, including query parameters and other search control parameters. Injected. * @return A possibly-empty AbstractCommonList of the advanced search results corresponding to the query */ @@ -96,8 +112,12 @@ public AbstractCommonList getList(@Context Request request, @Context UriInfo uri final UriInfoWrapper relUriInfo = relationUriInfo(uriInfo); for (CSDocumentModelResponse response : collectionObjectList.getResponseList()) { String csid = response.getCsid(); - UriInfoWrapper blobUriInfo = new UriInfoWrapper(uriInfo); - Map blobInfo = findBlobInfo(csid, blobUriInfo); + Map blobInfo = findPriorityBlobInfo(uriInfo, response); + + if (blobInfo.isEmpty()) { + UriInfoWrapper blobUriInfo = new UriInfoWrapper(uriInfo); + blobInfo = findBlobInfo(csid, blobUriInfo); + } AdvancedsearchListItem listItem = responseMapper.asListItem(response, blobInfo); if (listItem != null) { @@ -127,9 +147,9 @@ private UriInfoWrapper relationUriInfo(final UriInfo uriInfo) { return wrapper; } - /** + /** * Retrieves the blob CSIDs associated with a given object's CSID - * + * * @param csid The CSID of an object whose associated blobs (thumbnails) is desired * @param wrappedUriInfo The wrapped (mutable) UriInfo of the incoming query that ultimately triggered this call * @return A possibly-empty list of strings of the blob CSIDs associated with CSID @@ -141,8 +161,17 @@ private Map findBlobInfo(String csid, UriInfoWrapper wrappedUriI wrappedQueryParams.add(IClientQueryParams.PAGE_SIZE_PARAM, PAGE_SIZE); wrappedQueryParams.add(IClientQueryParams.START_PAGE_PARAM, PAGE_NUM); wrappedQueryParams.add(IClientQueryParams.ORDER_BY_PARAM, MEDIA_SORT_BY); - AbstractCommonList associatedMedia = mr.getList(wrappedUriInfo); - if (associatedMedia == null || associatedMedia.getListItem() == null) { + return blobInfoFromList(mr.getList(wrappedUriInfo)); + } + + /** + * Extracts the blob info (blob CSID and alt text) from the first item of a media list. + * + * @param mediaList The media list to extract from + * @return A possibly-empty map of the blob info of the first media list item + */ + private Map blobInfoFromList(AbstractCommonList mediaList) { + if (mediaList == null || mediaList.getListItem() == null) { return Collections.emptyMap(); } @@ -151,13 +180,85 @@ private Map findBlobInfo(String csid, UriInfoWrapper wrappedUriI Predicate tagNotEmpty = (element -> element.getTextContent() != null && !element.getTextContent().isEmpty()); - return associatedMedia.getListItem().stream() + return mediaList.getListItem().stream() .filter(item -> item != null && item.getAny() != null) .flatMap(li -> li.getAny().stream()) .filter(tagFilter.and(tagNotEmpty)) .collect(Collectors.toMap(Element::getTagName, Element::getTextContent)); } + /** + * Retrieves the blob info (blob CSID and alt text) for the top entry of an object's media priority list, + * + * @param uriInfo The URI info of the incoming request that triggered the search + * @param response The response from the CollectionObjectResource for a single object + * @return A possibly-empty map of the top media priority record's blob info. + */ + private Map findPriorityBlobInfo(UriInfo uriInfo, CSDocumentModelResponse response) { + PoxPayloadOut payload = response.getPayload(); + + if (payload == null) { + return Collections.emptyMap(); + } + + PayloadOutputPart commonPart = payload.getPart(COLLECTIONOBJECT_COMMON_PART_NAME); + List refNames = elementTextValues(commonPart, MEDIA_PRIORITY_FIELD); + + if (refNames.isEmpty()) { + return Collections.emptyMap(); + } + + String mediaCsid = RefNameUtils.parseAuthorityInfo(refNames.get(0)).csid; + + return findMediaBlobInfo(mediaCsid, new UriInfoWrapper(uriInfo)); + } + + /** + * Retrieves the blob info (blob CSID and alt text) of a single media record. + * + * @param mediaCsid The CSID of the media record + * @param wrappedUriInfo The wrapped (mutable) UriInfo of the incoming query that ultimately triggered this call + * @return A possibly-empty map of the media record's blob info. + */ + private Map findMediaBlobInfo(String mediaCsid, UriInfoWrapper wrappedUriInfo) { + MultivaluedMap wrappedQueryParams = wrappedUriInfo.getQueryParameters(); + wrappedQueryParams.clear(); + wrappedQueryParams.add(IQueryManager.SEARCH_TYPE_KEYWORDS_AS, "ecm:name=\"" + mediaCsid + "\""); + wrappedQueryParams.add(WorkflowClient.WORKFLOW_QUERY_DELETED_QP, Boolean.FALSE.toString()); + wrappedQueryParams.add(IClientQueryParams.PAGE_SIZE_PARAM, PAGE_SIZE); + wrappedQueryParams.add(IClientQueryParams.START_PAGE_PARAM, PAGE_NUM); + + return blobInfoFromList(mr.getList(wrappedUriInfo)); + } + + /** + * Retrieves the non-empty text values of all elements with a given local name within a payload part. + * + * @param part The payload part to search, which may be null + * @param localName The local name of the elements to find + * @return A possibly-empty list of the non-empty text values, in document order + */ + private List elementTextValues(PayloadOutputPart part, String localName) { + List values = new ArrayList<>(); + + if (part == null) { + return values; + } + + Document doc = (Document) part.getBody(); + NodeList nodes = doc.getDocumentElement().getElementsByTagName(localName); + + for (int i = 0; i < nodes.getLength(); i++) { + String text = nodes.item(i).getTextContent(); + + if (text != null && !text.isEmpty()) { + values.add(text); + } + } + + return values; + } + @Override public Class getCommonPartClass() { return null; @@ -178,4 +279,4 @@ public String getServiceName() { protected String getVersionString() { return "0.01"; } -} \ No newline at end of file +} From 467202461fc695d782ab7042a8178c3d0fc58bc4 Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Wed, 22 Jul 2026 18:33:27 +0300 Subject: [PATCH 33/40] DRYD-2117: added listener to remove deleted or unrelated media from the media priority list; --- .../listener/UpdateMediaPriorityOnDelete.java | 116 ++++++++++++++++++ .../resources/OSGI-INF/ecm-types-contrib.xml | 10 +- .../tenants/tenant-bindings-proto-unified.xml | 3 + 3 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/java/org/collectionspace/services/listener/UpdateMediaPriorityOnDelete.java diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/java/org/collectionspace/services/listener/UpdateMediaPriorityOnDelete.java b/3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/java/org/collectionspace/services/listener/UpdateMediaPriorityOnDelete.java new file mode 100644 index 0000000000..3577564a68 --- /dev/null +++ b/3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/java/org/collectionspace/services/listener/UpdateMediaPriorityOnDelete.java @@ -0,0 +1,116 @@ +package org.collectionspace.services.listener; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.collectionspace.services.common.api.RefNameUtils; +import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; +import org.collectionspace.services.nuxeo.client.java.CoreSessionWrapper; +import org.collectionspace.services.nuxeo.listener.AbstractCSEventSyncListenerImpl; +import org.collectionspace.services.nuxeo.util.NuxeoUtils; + +import org.nuxeo.ecm.core.api.DocumentModel; +import org.nuxeo.ecm.core.api.event.DocumentEventTypes; +import org.nuxeo.ecm.core.event.Event; +import org.nuxeo.ecm.core.event.EventContext; +import org.nuxeo.ecm.core.event.impl.DocumentEventContext; + +/** + * Event listener that removes entries from a collectionobject's media priority list when the + * media record an entry refers to is unrelated from the collectionobject, or deleted. + */ +public class UpdateMediaPriorityOnDelete extends AbstractCSEventSyncListenerImpl { + + private static final Logger logger = LoggerFactory.getLogger(UpdateMediaPriorityOnDelete.class); + + // FIXME: Get these constant values from external sources rather than redeclaring here + final static String RELATION_DOCTYPE = "Relation"; + final static String MEDIA_DOCTYPE = "Media"; + final static String COLLECTIONOBJECT_DOCTYPE = "CollectionObject"; + final static String RELATIONS_COMMON_SCHEMA = "relations_common"; + final static String COLLECTIONOBJECTS_COMMON_SCHEMA = "collectionobjects_common"; + final static String SUBJECT_CSID_PROPERTY = "subjectCsid"; + final static String OBJECT_CSID_PROPERTY = "objectCsid"; + final static String SUBJECT_DOCTYPE_PROPERTY = "subjectDocumentType"; + final static String OBJECT_DOCTYPE_PROPERTY = "objectDocumentType"; + final static String MEDIA_PRIORITY_LIST_FIELD = "mediaPriorityList"; + + @Override + public boolean shouldHandleEvent(Event event) { + EventContext eventContext = event.getContext(); + + if (!(eventContext instanceof DocumentEventContext)) { + return false; + } + + DocumentModel docModel = ((DocumentEventContext) eventContext).getSourceDocument(); + + if (!documentMatchesType(docModel, RELATION_DOCTYPE)) { + return false; + } + + return DocumentEventTypes.ABOUT_TO_REMOVE.equals(event.getName()) + || isDocumentSoftDeletedEvent(eventContext); + } + + @Override + public void handleCSEvent(Event event) { + DocumentEventContext docContext = (DocumentEventContext) event.getContext(); + DocumentModel relationDocModel = docContext.getSourceDocument(); + + String subjectDocType = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, SUBJECT_DOCTYPE_PROPERTY); + String objectDocType = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, OBJECT_DOCTYPE_PROPERTY); + + String mediaCsid; + String collectionObjectCsid; + + if (MEDIA_DOCTYPE.equals(subjectDocType) && COLLECTIONOBJECT_DOCTYPE.equals(objectDocType)) { + mediaCsid = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, SUBJECT_CSID_PROPERTY); + collectionObjectCsid = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, OBJECT_CSID_PROPERTY); + } else if (MEDIA_DOCTYPE.equals(objectDocType) && COLLECTIONOBJECT_DOCTYPE.equals(subjectDocType)) { + mediaCsid = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, OBJECT_CSID_PROPERTY); + collectionObjectCsid = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, SUBJECT_CSID_PROPERTY); + } else { + // Not a media/collectionobject relation. + return; + } + + CoreSessionInterface session = new CoreSessionWrapper(docContext.getCoreSession()); + DocumentModel collectionObjectDocModel = getCurrentDocModelFromCsid(session, collectionObjectCsid); + + if (collectionObjectDocModel == null || !isActiveDocument(collectionObjectDocModel)) { + return; + } + + @SuppressWarnings("unchecked") + List mediaPriorityList = (List) collectionObjectDocModel.getProperty( + COLLECTIONOBJECTS_COMMON_SCHEMA, MEDIA_PRIORITY_LIST_FIELD); + + if (mediaPriorityList == null) { + return; + } + + List updatedList = new ArrayList<>(mediaPriorityList); + + if (!updatedList.removeIf(refName -> mediaCsid.equals(RefNameUtils.parseAuthorityInfo(refName).csid))) { + // The media record was not in the priority list. + return; + } + + collectionObjectDocModel.setProperty(COLLECTIONOBJECTS_COMMON_SCHEMA, MEDIA_PRIORITY_LIST_FIELD, + (Serializable) updatedList); + session.saveDocument(collectionObjectDocModel); + + logger.info("Removed media record {} from the media priority list of collectionobject {}", + mediaCsid, NuxeoUtils.getCsid(collectionObjectDocModel)); + } + + @Override + public Logger getLogger() { + return this.logger; + } +} diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/resources/OSGI-INF/ecm-types-contrib.xml b/3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/resources/OSGI-INF/ecm-types-contrib.xml index ee5fa883bd..94e5606963 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/resources/OSGI-INF/ecm-types-contrib.xml +++ b/3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/resources/OSGI-INF/ecm-types-contrib.xml @@ -7,5 +7,13 @@ lifecycle_transition_event - + + + + aboutToRemove + lifecycle_transition_event + + + 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 307cae9477..6db4b7ea79 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 @@ -29,6 +29,9 @@ org.collectionspace.services.listener.UpdateRelationsOnDelete + + org.collectionspace.services.listener.UpdateMediaPriorityOnDelete + org.collectionspace.services.listener.ReindexSupport From ee779a4baff2595f704f1aaa878bba9c712adda0 Mon Sep 17 00:00:00 2001 From: spiros dimopulos Date: Thu, 23 Jul 2026 07:33:32 +0300 Subject: [PATCH 34/40] DRYD-2117: PR code optimization feedback --- .../listener/UpdateMediaPriorityOnDelete.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/java/org/collectionspace/services/listener/UpdateMediaPriorityOnDelete.java b/3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/java/org/collectionspace/services/listener/UpdateMediaPriorityOnDelete.java index 3577564a68..b40034ff08 100644 --- a/3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/java/org/collectionspace/services/listener/UpdateMediaPriorityOnDelete.java +++ b/3rdparty/nuxeo/nuxeo-platform-listener/updaterelationsondelete/src/main/java/org/collectionspace/services/listener/UpdateMediaPriorityOnDelete.java @@ -7,11 +7,9 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.collectionspace.services.common.api.RefNameUtils; import org.collectionspace.services.nuxeo.client.java.CoreSessionInterface; import org.collectionspace.services.nuxeo.client.java.CoreSessionWrapper; import org.collectionspace.services.nuxeo.listener.AbstractCSEventSyncListenerImpl; -import org.collectionspace.services.nuxeo.util.NuxeoUtils; import org.nuxeo.ecm.core.api.DocumentModel; import org.nuxeo.ecm.core.api.event.DocumentEventTypes; @@ -35,6 +33,8 @@ public class UpdateMediaPriorityOnDelete extends AbstractCSEventSyncListenerImpl final static String COLLECTIONOBJECTS_COMMON_SCHEMA = "collectionobjects_common"; final static String SUBJECT_CSID_PROPERTY = "subjectCsid"; final static String OBJECT_CSID_PROPERTY = "objectCsid"; + final static String SUBJECT_REFNAME_PROPERTY = "subjectRefName"; + final static String OBJECT_REFNAME_PROPERTY = "objectRefName"; final static String SUBJECT_DOCTYPE_PROPERTY = "subjectDocumentType"; final static String OBJECT_DOCTYPE_PROPERTY = "objectDocumentType"; final static String MEDIA_PRIORITY_LIST_FIELD = "mediaPriorityList"; @@ -65,14 +65,14 @@ public void handleCSEvent(Event event) { String subjectDocType = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, SUBJECT_DOCTYPE_PROPERTY); String objectDocType = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, OBJECT_DOCTYPE_PROPERTY); - String mediaCsid; + String mediaRefName; String collectionObjectCsid; if (MEDIA_DOCTYPE.equals(subjectDocType) && COLLECTIONOBJECT_DOCTYPE.equals(objectDocType)) { - mediaCsid = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, SUBJECT_CSID_PROPERTY); + mediaRefName = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, SUBJECT_REFNAME_PROPERTY); collectionObjectCsid = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, OBJECT_CSID_PROPERTY); } else if (MEDIA_DOCTYPE.equals(objectDocType) && COLLECTIONOBJECT_DOCTYPE.equals(subjectDocType)) { - mediaCsid = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, OBJECT_CSID_PROPERTY); + mediaRefName = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, OBJECT_REFNAME_PROPERTY); collectionObjectCsid = (String) relationDocModel.getProperty(RELATIONS_COMMON_SCHEMA, SUBJECT_CSID_PROPERTY); } else { // Not a media/collectionobject relation. @@ -96,7 +96,7 @@ public void handleCSEvent(Event event) { List updatedList = new ArrayList<>(mediaPriorityList); - if (!updatedList.removeIf(refName -> mediaCsid.equals(RefNameUtils.parseAuthorityInfo(refName).csid))) { + if (!updatedList.removeAll(List.of(mediaRefName))) { // The media record was not in the priority list. return; } @@ -106,7 +106,7 @@ public void handleCSEvent(Event event) { session.saveDocument(collectionObjectDocModel); logger.info("Removed media record {} from the media priority list of collectionobject {}", - mediaCsid, NuxeoUtils.getCsid(collectionObjectDocModel)); + mediaRefName, collectionObjectCsid); } @Override From afa98150cbd87c1520c6df6cecb2d51d23a585de Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Mon, 27 Jul 2026 11:47:22 -0600 Subject: [PATCH 35/40] No Jira: Adjust Logging Output (#557) * Suppress hibernate sql output in ant db tasks * Change log level for XML marshalling exceptions to debug * Adjust logging for datasource config generation --- .../src/main/resources/META-INF/persistence.xml | 2 +- .../services/client/PoxPayload.java | 4 ++-- .../services/common/ServiceMain.java | 15 +++++++-------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/services/authorization-mgt/import/src/main/resources/META-INF/persistence.xml b/services/authorization-mgt/import/src/main/resources/META-INF/persistence.xml index 7435d5ab75..435c102d94 100644 --- a/services/authorization-mgt/import/src/main/resources/META-INF/persistence.xml +++ b/services/authorization-mgt/import/src/main/resources/META-INF/persistence.xml @@ -14,7 +14,7 @@ - + diff --git a/services/client/src/main/java/org/collectionspace/services/client/PoxPayload.java b/services/client/src/main/java/org/collectionspace/services/client/PoxPayload.java index b384b20822..7b5b1278de 100644 --- a/services/client/src/main/java/org/collectionspace/services/client/PoxPayload.java +++ b/services/client/src/main/java/org/collectionspace/services/client/PoxPayload.java @@ -393,7 +393,7 @@ public static Object toObject(Element elementInput) { result = um.unmarshal(xmlStream); } } catch (Exception e) { - logger.error("Could not unmarshal XML element '{}' into a JAXB object.", elementInput.getName(), e); + logger.debug("Could not unmarshal XML element '{}' into a JAXB object.", elementInput.getName(), e); } return result; @@ -426,7 +426,7 @@ public static Element toElement(Object jaxbObject) { Document doc = DocumentHelper.parseText(text); result = doc.getRootElement(); //FIXME: REM - call .detach() to free the element } catch (Exception e) { - logger.error("Could not marshal JAXB object '{}' to an XML element.", jaxbObject, e); + logger.debug("Could not marshal JAXB object '{}' to an XML element.", jaxbObject, e); } return result; diff --git a/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java b/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java index 65d47cbd8a..10d44a39fb 100644 --- a/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java +++ b/services/common/src/main/java/org/collectionspace/services/common/ServiceMain.java @@ -1293,18 +1293,17 @@ private void createOrUpdateNuxeoDatasourceConfigFiles() throws Exception { Hashtable tenantBindingTypeMap = tenantBindingConfigReader.getTenantBindings(); for (TenantBindingType tbt : tenantBindingTypeMap.values()) { List repositoryNameList = ConfigUtils.getRepositoryNameList(tbt); - logger.debug("Getting repository name(s) for tenant " + tbt.getName()); + logger.debug("Getting repository name(s) for tenant {}", tbt.getName()); - if (repositoryNameList == null || repositoryNameList.isEmpty() == true) { - logger.error(String.format("Could not get repository name(s) for tenant %s", tbt.getName())); - continue; // break out of loop and go to the next tenant binding + if (repositoryNameList == null || repositoryNameList.isEmpty()) { + logger.error("Could not get repository name(s) for tenant {}", tbt.getName()); } else { for (String repositoryName : repositoryNameList) { if (Tools.isBlank(repositoryName)) { - logger.error(String.format("Repository name(s) for tenant %s was empty.", tbt.getName())); + logger.error("Repository name(s) for tenant {} was empty", tbt.getName()); continue; } - logger.debug(String.format("Repository name is %s", repositoryName)); + logger.trace("Repository name is {}", repositoryName); // // Clone the prototype copy of the Nuxeo datasource config file, // thus creating a separate config file for the current repository. @@ -1313,12 +1312,12 @@ private void createOrUpdateNuxeoDatasourceConfigFiles() throws Exception { // Update this config file by inserting values pertinent to the // current repository. datasourceConfigDoc = updateRepositoryDatasourceDoc(datasourceConfigDoc, repositoryName, tbt.getRepositoryDomain(), this.getCspaceInstanceId()); - logger.debug("Updated Nuxeo datasource config file contents=\n" + datasourceConfigDoc.asXML()); // Write this config file to the Nuxeo server config directory. File repofile = new File(getNuxeoConfigDir() + File.separator + repositoryName + JEEServerDeployment.NUXEO_DATASOURCE_CONFIG_FILENAME_SUFFIX); - logger.debug(String.format("Attempting to write Nuxeo datasource config file to %s", repofile.getAbsolutePath())); + logger.debug("Writing Nuxeo datasource config for repository {} into {}", repositoryName, + repofile.getAbsolutePath()); XmlTools.xmlDocumentToFile(datasourceConfigDoc, repofile); } } From b71df053118bc4ef68db277f7c782a8a826830a2 Mon Sep 17 00:00:00 2001 From: Spiros Dimopulos Date: Tue, 28 Jul 2026 01:26:36 +0300 Subject: [PATCH 36/40] Prepare 9.0.0-RC.1 (#558) --- build.properties | 6 +++--- cspace-ui/fcart/build.properties | 2 +- cspace-ui/lhmc/build.properties | 2 +- cspace-ui/materials/build.properties | 2 +- cspace-ui/publicart/build.properties | 2 +- pom.xml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/build.properties b/build.properties index d878994037..e7d2190f6e 100644 --- a/build.properties +++ b/build.properties @@ -9,7 +9,7 @@ host=127.0.0.1 # # Release version info # -release.version=9.0.0-SNAPSHOT +release.version=9.0.0-RC.1 cspace.release=${release.version} cspace.instance.id=${env.CSPACE_INSTANCE_ID} @@ -27,7 +27,7 @@ cspace.im.root= # UI settings cspace.ui.package.name=cspace-ui cspace.ui.library.name=cspaceUI -cspace.ui.version=10.2 +cspace.ui.version=11.0.0-rc.0 cspace.ui.build.branch=develop cspace.ui.build.node.ver=20 service.ui.library.name=${cspace.ui.library.name}-service @@ -35,7 +35,7 @@ service.ui.library.name=${cspace.ui.library.name}-service # Public browser settings cspace.public.browser.package.name=@collectionspace/cspace-public-browser cspace.public.browser.library.name=cspacePublicBrowser -cspace.public.browser.version=3.5 +cspace.public.browser.version=4.0.0-rc.0 cspace.public.browser.build.branch=main cspace.public.browser.build.node.ver=20 diff --git a/cspace-ui/fcart/build.properties b/cspace-ui/fcart/build.properties index ed768fed68..6527bfd057 100644 --- a/cspace-ui/fcart/build.properties +++ b/cspace-ui/fcart/build.properties @@ -3,7 +3,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-fcart tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileFCart -tenant.ui.profile.plugin.version=8.2 +tenant.ui.profile.plugin.version=9.0.0-rc.0 tenant.ui.profile.plugin.build.branch=develop # If not set, defaults to /gateway/${tenant.shortname} on the current host. diff --git a/cspace-ui/lhmc/build.properties b/cspace-ui/lhmc/build.properties index cfa260b1cf..9c94c86933 100644 --- a/cspace-ui/lhmc/build.properties +++ b/cspace-ui/lhmc/build.properties @@ -3,7 +3,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-lhmc tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileLHMC -tenant.ui.profile.plugin.version=8.2 +tenant.ui.profile.plugin.version=9.0.0-rc.0 tenant.ui.profile.plugin.build.branch=develop # If not set, defaults to /gateway/${tenant.shortname} on the current host. diff --git a/cspace-ui/materials/build.properties b/cspace-ui/materials/build.properties index b7a3b16177..75e69bba67 100644 --- a/cspace-ui/materials/build.properties +++ b/cspace-ui/materials/build.properties @@ -3,7 +3,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-materials tenant.ui.profile.plugin.library.name=cspaceUIPluginProfileMaterials -tenant.ui.profile.plugin.version=4.1 +tenant.ui.profile.plugin.version=5.0.0-rc.0 tenant.ui.profile.plugin.build.branch=develop # If not set, defaults to /gateway/${tenant.shortname} on the current host. diff --git a/cspace-ui/publicart/build.properties b/cspace-ui/publicart/build.properties index 913ed68926..d01f0e427a 100644 --- a/cspace-ui/publicart/build.properties +++ b/cspace-ui/publicart/build.properties @@ -3,7 +3,7 @@ tenant.ui.basename=/cspace/${tenant.shortname} tenant.ui.profile.plugin.package.name=cspace-ui-plugin-profile-publicart tenant.ui.profile.plugin.library.name=cspaceUIPluginProfilePublicArt -tenant.ui.profile.plugin.version=7.1 +tenant.ui.profile.plugin.version=8.0.0-rc.0 tenant.ui.profile.plugin.build.branch=develop # If not set, defaults to /gateway/${tenant.shortname} on the current host. diff --git a/pom.xml b/pom.xml index 51e2436c69..a385e591e6 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ services - 9.0.0-SNAPSHOT + 9.0.0-RC.1 UTF-8 ${revision} ${revision} From 4280c7d88b8d513ee6e8468914f1625e1ee548ac Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Thu, 13 Aug 2026 11:53:38 -0600 Subject: [PATCH 37/40] DRYD-2162: Remove Punctuation From Fulltext Index (#562) Add db trigger to strip punctuation from fulltext columns Refine fulltext indexing - Exclude system types - Exclude collectionspace_core fields - Exclude dublin core fields --- .../2023/config/proto-repo-config.xml | 36 +++++++++++++------ CHANGELOG.md | 3 +- .../tenants/tenant-bindings-proto-unified.xml | 4 +++ .../db/postgresql/fulltext_triggers.sql | 15 ++++++++ 4 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 services/common/src/main/resources/db/postgresql/fulltext_triggers.sql diff --git a/3rdparty/nuxeo/nuxeo-server/2023/config/proto-repo-config.xml b/3rdparty/nuxeo/nuxeo-server/2023/config/proto-repo-config.xml index 2606719b1d..7d26038999 100644 --- a/3rdparty/nuxeo/nuxeo-server/2023/config/proto-repo-config.xml +++ b/3rdparty/nuxeo/nuxeo-server/2023/config/proto-repo-config.xml @@ -37,17 +37,31 @@ varchar - - - - - - dc:title - - - dc:description - - + + Root + Workspace + WorkspaceRoot + AdministrativeStatus + AdministrativeStatusContainer + Domain + + + + + collectionspace_core:uri + collectionspace_core:refName + collectionspace_core:tenantId + collectionspace_core:createdAt + collectionspace_core:updatedAt + collectionspace_core:createdBy + collectionspace_core:updatedBy + + dc:title + dc:creator + dc:contributors + dc:lastContributor + + @DB_SERVER_HOSTNAME@ diff --git a/CHANGELOG.md b/CHANGELOG.md index ac50127872..5891c1829f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,11 +8,12 @@ * Add password complexity requirements to tenant bindings * Add password validators which verify passwords meet requirements set by tenants * Enable strict checksum verification so that builds fail on corrupted Maven artifact downloads -* Remove de-urning of objectNameControlled refname in the AdvancedSearch API +* Add database trigger for the fulltext index to strip punctuation ### Bug Fixes * Fix es indexing of Media records when relating/unrelating to Collection Objects +* Remove de-urning of objectNameControlled refname in the AdvancedSearch API ## 8.3.0 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 6db4b7ea79..01160c8165 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 @@ -82,6 +82,10 @@ sqlScriptName deurn_function.sql + + sqlScriptName + fulltext_triggers.sql + diff --git a/services/common/src/main/resources/db/postgresql/fulltext_triggers.sql b/services/common/src/main/resources/db/postgresql/fulltext_triggers.sql new file mode 100644 index 0000000000..208b8b6e28 --- /dev/null +++ b/services/common/src/main/resources/db/postgresql/fulltext_triggers.sql @@ -0,0 +1,15 @@ +-- Remove punctuation from fulltext columns +-- Note: There is a nuxeo trigger which sets the fulltext.fulltext column by coalescing the simpletext and binarytext. +CREATE OR REPLACE FUNCTION fulltext_normalize() RETURNS TRIGGER AS $$ +BEGIN + NEW.simpletext = regexp_replace(NEW.simpletext, '[^\w]+', ' ', 'gi'); + NEW.binarytext = regexp_replace(NEW.binarytext, '[^\w]+', ' ', 'gi'); + RETURN NEW; +END +$$ LANGUAGE plpgsql; + +DROP TRIGGER IF EXISTS fulltext_normalize_trigger ON fulltext; +CREATE TRIGGER fulltext_normalize_trigger +BEFORE INSERT OR UPDATE ON fulltext +FOR EACH ROW +EXECUTE FUNCTION fulltext_normalize(); From 83fe4e2940c8f98aca2ac506cfe05391c7a48786 Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Thu, 13 Aug 2026 12:57:43 -0600 Subject: [PATCH 38/40] No Jira: Update Maven Enforcer Configuration (#564) * Exec enforcer plugin only on jaxrs provider, cspace nuxeo deployment, and common-lib --- 3rdparty/nuxeo/nuxeo-server/pom.xml | 9 +++ common-lib/pom.xml | 9 +++ pom.xml | 79 ++++++++++++++------------- services/JaxRsServiceProvider/pom.xml | 6 +- 4 files changed, 63 insertions(+), 40 deletions(-) diff --git a/3rdparty/nuxeo/nuxeo-server/pom.xml b/3rdparty/nuxeo/nuxeo-server/pom.xml index 363550a33e..cfe7c8aa86 100644 --- a/3rdparty/nuxeo/nuxeo-server/pom.xml +++ b/3rdparty/nuxeo/nuxeo-server/pom.xml @@ -667,4 +667,13 @@ provided + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + diff --git a/common-lib/pom.xml b/common-lib/pom.xml index 873ec16fa6..145cab25c3 100644 --- a/common-lib/pom.xml +++ b/common-lib/pom.xml @@ -320,4 +320,13 @@ 1.25 + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + diff --git a/pom.xml b/pom.xml index a385e591e6..527052fea9 100644 --- a/pom.xml +++ b/pom.xml @@ -379,6 +379,46 @@ maven-remote-resources-plugin 3.3.0 + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.6.2 + + + enforce-banned-dependencies + + enforce + + + + + + + jakarta.inject:jakarta.inject-api + jakarta.mail:jakarta.mail-api + jakarta.persistence:jakarta.persistence-api + jakarta.servlet:jakarta.servlet-api + jakarta.transaction:jakarta.transaction-api + jakarta.ws.rs:jakarta.ws.rs-api + jakarta.xml.soap:jakarta.xml.soap-api + + Only jakarta activation, annotation, xml bind, and validation apis should be used + + + + javax.xml.bind:jaxb-api + + Do not use javax JAXB API + + + + + + @@ -466,45 +506,6 @@ - - org.apache.maven.plugins - maven-enforcer-plugin - 3.6.2 - - - enforce-banned-dependencies - - enforce - - - - - - - jakarta.inject:jakarta.inject-api - jakarta.mail:jakarta.mail-api - jakarta.persistence:jakarta.persistence-api - jakarta.servlet:jakarta.servlet-api - jakarta.transaction:jakarta.transaction-api - jakarta.ws.rs:jakarta.ws.rs-api - jakarta.xml.soap:jakarta.xml.soap-api - - Only jakarta activation, annotation, xml bind, and validation apis should be used - - - - javax.xml.bind:jaxb-api - - Do not use javax JAXB API - - - - - - diff --git a/services/JaxRsServiceProvider/pom.xml b/services/JaxRsServiceProvider/pom.xml index 53961816a9..43db2b47b7 100644 --- a/services/JaxRsServiceProvider/pom.xml +++ b/services/JaxRsServiceProvider/pom.xml @@ -931,11 +931,15 @@ CollectionSpace Services ${project.groupId} - ${project.version + ${project.version} + + org.apache.maven.plugins + maven-enforcer-plugin + From 13193d1baa65115522fa4df6d77e0d6f00cc0b2a Mon Sep 17 00:00:00 2001 From: Michael Ritter Date: Thu, 13 Aug 2026 15:40:41 -0600 Subject: [PATCH 39/40] No Jira: Use CollectionSpace Maven Repo (#565) * Replace nuxeo maven repository with our own cspace repository * Remove non-string fields from repo config --- .../2023/config/proto-repo-config.xml | 4 +--- 3rdparty/nuxeo/nuxeo-server/pom.xml | 22 +++++++++++++------ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/3rdparty/nuxeo/nuxeo-server/2023/config/proto-repo-config.xml b/3rdparty/nuxeo/nuxeo-server/2023/config/proto-repo-config.xml index 7d26038999..fcd8826114 100644 --- a/3rdparty/nuxeo/nuxeo-server/2023/config/proto-repo-config.xml +++ b/3rdparty/nuxeo/nuxeo-server/2023/config/proto-repo-config.xml @@ -51,8 +51,6 @@ collectionspace_core:uri collectionspace_core:refName collectionspace_core:tenantId - collectionspace_core:createdAt - collectionspace_core:updatedAt collectionspace_core:createdBy collectionspace_core:updatedBy @@ -72,4 +70,4 @@ @NUXEO_PW@ - \ No newline at end of file + diff --git a/3rdparty/nuxeo/nuxeo-server/pom.xml b/3rdparty/nuxeo/nuxeo-server/pom.xml index cfe7c8aa86..b50af04c5b 100644 --- a/3rdparty/nuxeo/nuxeo-server/pom.xml +++ b/3rdparty/nuxeo/nuxeo-server/pom.xml @@ -15,13 +15,21 @@ pom - - nuxeo-public-lts - https://packages.nuxeo.com/repository/maven-public-lts - - false - - + + cspace-nuxeo-public-releases + https://cspace-maven.collectionspace.org/nuxeo/public-releases + + false + + + + + cspace-nuxeo-vendor-releases + https://cspace-maven.collectionspace.org/nuxeo/vendor-releases + + false + +