1
2 package ca.uhn.fhir.model.dstu.valueset;
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 import java.util.HashMap;
25 import java.util.Map;
26
27 import ca.uhn.fhir.model.api.IValueSetEnumBinder;
28
29 public enum QueryOutcomeEnum {
30
31
32
33
34
35
36 OK("ok", "http://hl7.org/fhir/query-outcome"),
37
38
39
40
41
42
43 LIMITED("limited", "http://hl7.org/fhir/query-outcome"),
44
45
46
47
48
49
50 REFUSED("refused", "http://hl7.org/fhir/query-outcome"),
51
52
53
54
55
56
57 ERROR("error", "http://hl7.org/fhir/query-outcome"),
58
59 ;
60
61
62
63
64
65 public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/query-outcome";
66
67
68
69
70
71 public static final String VALUESET_NAME = "QueryOutcome";
72
73 private static Map<String, QueryOutcomeEnum> CODE_TO_ENUM = new HashMap<String, QueryOutcomeEnum>();
74 private static Map<String, Map<String, QueryOutcomeEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, QueryOutcomeEnum>>();
75
76 private final String myCode;
77 private final String mySystem;
78
79 static {
80 for (QueryOutcomeEnum next : QueryOutcomeEnum.values()) {
81 CODE_TO_ENUM.put(next.getCode(), next);
82
83 if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) {
84 SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, QueryOutcomeEnum>());
85 }
86 SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next);
87 }
88 }
89
90
91
92
93 public String getCode() {
94 return myCode;
95 }
96
97
98
99
100 public String getSystem() {
101 return mySystem;
102 }
103
104
105
106
107 public QueryOutcomeEnum forCode(String theCode) {
108 QueryOutcomeEnum retVal = CODE_TO_ENUM.get(theCode);
109 return retVal;
110 }
111
112
113
114
115 public static final IValueSetEnumBinder<QueryOutcomeEnum> VALUESET_BINDER = new IValueSetEnumBinder<QueryOutcomeEnum>() {
116 @Override
117 public String toCodeString(QueryOutcomeEnum theEnum) {
118 return theEnum.getCode();
119 }
120
121 @Override
122 public String toSystemString(QueryOutcomeEnum theEnum) {
123 return theEnum.getSystem();
124 }
125
126 @Override
127 public QueryOutcomeEnum fromCodeString(String theCodeString) {
128 return CODE_TO_ENUM.get(theCodeString);
129 }
130
131 @Override
132 public QueryOutcomeEnum fromCodeString(String theCodeString, String theSystemString) {
133 Map<String, QueryOutcomeEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
134 if (map == null) {
135 return null;
136 }
137 return map.get(theCodeString);
138 }
139
140 };
141
142
143
144
145 QueryOutcomeEnum(String theCode, String theSystem) {
146 myCode = theCode;
147 mySystem = theSystem;
148 }
149
150
151 }