From f866507401acff16a1681d3794784de15ba89412 Mon Sep 17 00:00:00 2001 From: Dmytro Rud Date: Thu, 1 Aug 2024 20:57:37 +0200 Subject: [PATCH] #456: delete last leftovers of XDS.a --- .../xds/core/metadata/AssociationType.java | 73 ++++--------------- .../ihe/xds/core/responses/Status.java | 41 +++-------- 2 files changed, 23 insertions(+), 91 deletions(-) diff --git a/commons/ihe/xds/src/main/java/org/openehealth/ipf/commons/ihe/xds/core/metadata/AssociationType.java b/commons/ihe/xds/src/main/java/org/openehealth/ipf/commons/ihe/xds/core/metadata/AssociationType.java index fa162d05b1..c0210fffa4 100644 --- a/commons/ihe/xds/src/main/java/org/openehealth/ipf/commons/ihe/xds/core/metadata/AssociationType.java +++ b/commons/ihe/xds/src/main/java/org/openehealth/ipf/commons/ihe/xds/core/metadata/AssociationType.java @@ -15,12 +15,14 @@ */ package org.openehealth.ipf.commons.ihe.xds.core.metadata; +import lombok.Getter; import org.openehealth.ipf.commons.ihe.xds.core.validate.ValidationMessage; import org.openehealth.ipf.commons.ihe.xds.core.validate.XDSMetaDataException; import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; + /** * Lists all possible types of associations between two documents. * @@ -30,58 +32,33 @@ @XmlEnum() public enum AssociationType { /** An entry that is appended to another one. */ - @XmlEnumValue("APND") APPEND("APND", "urn:ihe:iti:2007:AssociationType:APND"), + @XmlEnumValue("APND") APPEND("urn:ihe:iti:2007:AssociationType:APND"), /** An entry that replaced another one. */ - @XmlEnumValue("RPLC") REPLACE("RPLC", "urn:ihe:iti:2007:AssociationType:RPLC"), + @XmlEnumValue("RPLC") REPLACE("urn:ihe:iti:2007:AssociationType:RPLC"), /** An entry that transforms another one. */ - @XmlEnumValue("XFRM") TRANSFORM("XFRM", "urn:ihe:iti:2007:AssociationType:XFRM"), + @XmlEnumValue("XFRM") TRANSFORM("urn:ihe:iti:2007:AssociationType:XFRM"), /** An entry that transforms and replaces another one. */ - @XmlEnumValue("XFRM_RPLC") TRANSFORM_AND_REPLACE("XFRM_RPLC", "urn:ihe:iti:2007:AssociationType:XFRM_RPLC"), + @XmlEnumValue("XFRM_RPLC") TRANSFORM_AND_REPLACE("urn:ihe:iti:2007:AssociationType:XFRM_RPLC"), /** An entry that is a member of another one. */ - @XmlEnumValue("HasMember") HAS_MEMBER("HasMember", "urn:oasis:names:tc:ebxml-regrep:AssociationType:HasMember"), + @XmlEnumValue("HasMember") HAS_MEMBER("urn:oasis:names:tc:ebxml-regrep:AssociationType:HasMember"), /** An entry that represents a signature of another one. */ - @XmlEnumValue("signs") SIGNS("signs", "urn:ihe:iti:2007:AssociationType:signs"), + @XmlEnumValue("signs") SIGNS("urn:ihe:iti:2007:AssociationType:signs"), /** An entry that represents a link to the On-Demand DocumentEntry. */ - @XmlEnumValue("IsSnapshotOf") IS_SNAPSHOT_OF("IsSnapshotOf", "urn:ihe:iti:2010:AssociationType:IsSnapshotOf"), + @XmlEnumValue("IsSnapshotOf") IS_SNAPSHOT_OF("urn:ihe:iti:2010:AssociationType:IsSnapshotOf"), /** An entry that represents an association for update availability status trigger. */ - @XmlEnumValue("UpdateAvailabilityStatus") UPDATE_AVAILABILITY_STATUS("UpdateAvailabilityStatus", "urn:ihe:iti:2010:AssociationType:UpdateAvailabilityStatus"), + @XmlEnumValue("UpdateAvailabilityStatus") UPDATE_AVAILABILITY_STATUS("urn:ihe:iti:2010:AssociationType:UpdateAvailabilityStatus"), /** An entry that represents an association for submit association trigger. */ - @XmlEnumValue("SubmitAssociation") SUBMIT_ASSOCIATION("SubmitAssociation", "urn:ihe:iti:2010:AssociationType:SubmitAssociation"), + @XmlEnumValue("SubmitAssociation") SUBMIT_ASSOCIATION("urn:ihe:iti:2010:AssociationType:SubmitAssociation"), /** An entry that represents an association which is used as a flag to avoid the versioning of an updated document. */ - @XmlEnumValue("NonVersioningUpdate") NON_VERSIONING_UPDATE("NonVersioningUpdate", "urn:elga-bes:AssociationType:NonVersioningUpdate"); + @XmlEnumValue("NonVersioningUpdate") NON_VERSIONING_UPDATE("urn:elga-bes:AssociationType:NonVersioningUpdate"); - private final String opcode21; + @Getter private final String opcode30; - AssociationType(String opcode21, String opcode30) { - this.opcode21 = opcode21; + AssociationType(String opcode30) { this.opcode30 = opcode30; } - /** - * @return a string representation in ebXML 2.1. - */ - public String getOpcode21() { - return opcode21; - } - - /** - * @return a string representation in ebXML 3.0. - */ - public String getOpcode30() { - return opcode30; - } - - /** - * null-safe version of {@link #getOpcode21()}. - * @param type - * the type for which to get the opcode. Can be null. - * @return the opcode or null if type was null. - */ - public static String getOpcode21(AssociationType type) { - return type != null ? type.getOpcode21() : null; - } - /** * null-safe version of {@link #getOpcode30()}. * @param type @@ -92,28 +69,6 @@ public static String getOpcode30(AssociationType type) { return type != null ? type.getOpcode30() : null; } - /** - * Returns the association type that is represented by the given opcode. - *

- * This method looks up the opcode via the ebXML 2.1 representations. - * @param opcode - * the string representation. Can be null. - * @return the association type or null if the opcode was null. - */ - public static AssociationType valueOfOpcode21(String opcode) { - if (opcode == null) { - return null; - } - - for (var type : AssociationType.values()) { - if (opcode.equals(type.getOpcode21())) { - return type; - } - } - - throw new XDSMetaDataException(ValidationMessage.INVALID_ASSOCIATION_TYPE); - } - /** * Returns the association type that is represented by the given opcode. *

diff --git a/commons/ihe/xds/src/main/java/org/openehealth/ipf/commons/ihe/xds/core/responses/Status.java b/commons/ihe/xds/src/main/java/org/openehealth/ipf/commons/ihe/xds/core/responses/Status.java index a35aee6b03..7c2df91aa7 100644 --- a/commons/ihe/xds/src/main/java/org/openehealth/ipf/commons/ihe/xds/core/responses/Status.java +++ b/commons/ihe/xds/src/main/java/org/openehealth/ipf/commons/ihe/xds/core/responses/Status.java @@ -15,12 +15,14 @@ */ package org.openehealth.ipf.commons.ihe.xds.core.responses; +import lombok.Getter; import org.openehealth.ipf.commons.ihe.xds.core.validate.ValidationMessage; import org.openehealth.ipf.commons.ihe.xds.core.validate.XDSMetaDataException; import jakarta.xml.bind.annotation.XmlEnum; import jakarta.xml.bind.annotation.XmlEnumValue; import jakarta.xml.bind.annotation.XmlType; + /** * Status information according to the XDS specification. * @author Jens Riemschneider @@ -29,44 +31,19 @@ @XmlEnum() public enum Status { /** The request execution failed. */ - @XmlEnumValue("Failure") FAILURE("Failure", "urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure"), + @XmlEnumValue("Failure") FAILURE("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure"), /** The request execution succeeded. */ - @XmlEnumValue("Success") SUCCESS("Success", "urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success"), + @XmlEnumValue("Success") SUCCESS("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success"), /** The request execution partially succeeded. */ - @XmlEnumValue("PartialSuccess") PARTIAL_SUCCESS("PartialSuccess", "urn:ihe:iti:2007:ResponseStatusType:PartialSuccess"); - - private final String opcode21; + @XmlEnumValue("PartialSuccess") PARTIAL_SUCCESS("urn:ihe:iti:2007:ResponseStatusType:PartialSuccess"); + + @Getter private final String opcode30; - Status(String opcode21, String opcode30) { - this.opcode21 = opcode21; + Status(String opcode30) { this.opcode30 = opcode30; } - /** - * @return a string representation in ebXML 2.1. - */ - public String getOpcode21() { - return opcode21; - } - - /** - * @return a string representation in ebXML 3.1. - */ - public String getOpcode30() { - return opcode30; - } - - /** - * null-safe version of {@link #getOpcode21()}. - * @param status - * the type for which to get the opcode. Can be null. - * @return the opcode or null if type was null. - */ - public static String getOpcode21(Status status) { - return status != null ? status.getOpcode21() : null; - } - /** * null-safe version of {@link #getOpcode30()}. * @param status @@ -91,7 +68,7 @@ public static Status valueOfOpcode(String opcode) { } for (var status : values()) { - if (opcode.equals(status.getOpcode21()) || opcode.equals(status.getOpcode30())) { + if (opcode.equals(status.getOpcode30())) { return status; } }