Skip to content

Commit

Permalink
#456: delete last leftovers of XDS.a
Browse files Browse the repository at this point in the history
  • Loading branch information
unixoid committed Aug 1, 2024
1 parent 8614f46 commit f866507
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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;
}

/**
* <code>null</code>-safe version of {@link #getOpcode21()}.
* @param type
* the type for which to get the opcode. Can be <code>null</code>.
* @return the opcode or <code>null</code> if type was <code>null</code>.
*/
public static String getOpcode21(AssociationType type) {
return type != null ? type.getOpcode21() : null;
}

/**
* <code>null</code>-safe version of {@link #getOpcode30()}.
* @param type
Expand All @@ -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.
* <p>
* This method looks up the opcode via the ebXML 2.1 representations.
* @param opcode
* the string representation. Can be <code>null</code>.
* @return the association type or <code>null</code> if the opcode was <code>null</code>.
*/
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.
* <p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}

/**
* <code>null</code>-safe version of {@link #getOpcode21()}.
* @param status
* the type for which to get the opcode. Can be <code>null</code>.
* @return the opcode or <code>null</code> if type was <code>null</code>.
*/
public static String getOpcode21(Status status) {
return status != null ? status.getOpcode21() : null;
}

/**
* <code>null</code>-safe version of {@link #getOpcode30()}.
* @param status
Expand All @@ -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;
}
}
Expand Down

0 comments on commit f866507

Please sign in to comment.