1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.xds.core.requests.query;
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
29 @XmlType(name = "QueryReturnType")
30 @XmlEnum(String.class)
31 public enum QueryReturnType {
32
33 @XmlEnumValue("LeafClass") LEAF_CLASS("LeafClass"),
34 @XmlEnumValue("ObjectRef") OBJECT_REF("ObjectRef"),
35
36
37 @XmlEnumValue("LeafClassWithRepositoryItem") LEAF_CLASS_WITH_REPOSITORY_ITEM("LeafClassWithRepositoryItem");
38
39 private final String code;
40
41 QueryReturnType(String code) {
42 this.code = code;
43 }
44
45 public String getCode() {
46 return code;
47 }
48
49 public static QueryReturnType valueOfCode(String code) {
50 for (QueryReturnType type : values()) {
51 if (type.getCode().equals(code)) {
52 return type;
53 }
54 }
55
56 throw new XDSMetaDataException(ValidationMessage.WRONG_QUERY_RETURN_TYPE, code);
57 }
58 }