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 c815d4ddbc..451688298f 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; @@ -109,8 +110,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; @@ -119,6 +120,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