1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.xds.core.responses;
17
18 import org.openehealth.ipf.commons.ihe.xds.core.validate.ValidationMessage;
19 import org.openehealth.ipf.commons.ihe.xds.core.validate.XDSMetaDataException;
20
21 import javax.xml.bind.annotation.XmlEnum;
22 import javax.xml.bind.annotation.XmlEnumValue;
23 import javax.xml.bind.annotation.XmlType;
24
25
26
27
28 @XmlType(name = "Severity")
29 @XmlEnum(String.class)
30 public enum Severity {
31
32 @XmlEnumValue("Error") ERROR("urn:oasis:names:tc:ebxml-regrep:ErrorSeverityType:Error"),
33
34 @XmlEnumValue("Warning") WARNING("urn:oasis:names:tc:ebxml-regrep:ErrorSeverityType:Warning");
35
36 private final String opcode30;
37
38 Severity(String opcode30) {
39 this.opcode30 = opcode30;
40 }
41
42
43
44
45 public String getOpcode30() {
46 return opcode30;
47 }
48
49
50
51
52
53
54
55 public static String getOpcode30(Severity severity) {
56 return severity != null ? severity.getOpcode30() : null;
57 }
58
59
60
61
62
63
64
65
66
67 public static Severity valueOfOpcode30(String opcode30) {
68 for (Severity severity : values()) {
69 if (severity.getOpcode30().equals(opcode30)) {
70 return severity;
71 }
72 }
73
74 throw new XDSMetaDataException(ValidationMessage.INVALID_SEVERITY_IN_RESPONSE);
75 }
76
77 }