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 RestfulOperationSystemEnum {
30
31
32
33
34 TRANSACTION("transaction", "http://hl7.org/fhir/restful-operation"),
35
36
37
38
39 SEARCH_SYSTEM("search-system", "http://hl7.org/fhir/restful-operation"),
40
41
42
43
44 HISTORY_SYSTEM("history-system", "http://hl7.org/fhir/restful-operation"),
45
46 ;
47
48
49
50
51
52 public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/system-restful-operation";
53
54
55
56
57
58 public static final String VALUESET_NAME = "RestfulOperationSystem";
59
60 private static Map<String, RestfulOperationSystemEnum> CODE_TO_ENUM = new HashMap<String, RestfulOperationSystemEnum>();
61 private static Map<String, Map<String, RestfulOperationSystemEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, RestfulOperationSystemEnum>>();
62
63 private final String myCode;
64 private final String mySystem;
65
66 static {
67 for (RestfulOperationSystemEnum next : RestfulOperationSystemEnum.values()) {
68 CODE_TO_ENUM.put(next.getCode(), next);
69
70 if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) {
71 SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, RestfulOperationSystemEnum>());
72 }
73 SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next);
74 }
75 }
76
77
78
79
80 public String getCode() {
81 return myCode;
82 }
83
84
85
86
87 public String getSystem() {
88 return mySystem;
89 }
90
91
92
93
94 public RestfulOperationSystemEnum forCode(String theCode) {
95 RestfulOperationSystemEnum retVal = CODE_TO_ENUM.get(theCode);
96 return retVal;
97 }
98
99
100
101
102 public static final IValueSetEnumBinder<RestfulOperationSystemEnum> VALUESET_BINDER = new IValueSetEnumBinder<RestfulOperationSystemEnum>() {
103 @Override
104 public String toCodeString(RestfulOperationSystemEnum theEnum) {
105 return theEnum.getCode();
106 }
107
108 @Override
109 public String toSystemString(RestfulOperationSystemEnum theEnum) {
110 return theEnum.getSystem();
111 }
112
113 @Override
114 public RestfulOperationSystemEnum fromCodeString(String theCodeString) {
115 return CODE_TO_ENUM.get(theCodeString);
116 }
117
118 @Override
119 public RestfulOperationSystemEnum fromCodeString(String theCodeString, String theSystemString) {
120 Map<String, RestfulOperationSystemEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
121 if (map == null) {
122 return null;
123 }
124 return map.get(theCodeString);
125 }
126
127 };
128
129
130
131
132 RestfulOperationSystemEnum(String theCode, String theSystem) {
133 myCode = theCode;
134 mySystem = theSystem;
135 }
136
137
138 }