View Javadoc
1   
2   package ca.uhn.fhir.model.dstu.valueset;
3   
4   /*
5    * #%L
6    * HAPI FHIR - Core Library
7    * %%
8    * Copyright (C) 2014 University Health Network
9    * %%
10   * Licensed under the Apache License, Version 2.0 (the "License");
11   * you may not use this file except in compliance with the License.
12   * You may obtain a copy of the License at
13   * 
14   *      http://www.apache.org/licenses/LICENSE-2.0
15   * 
16   * Unless required by applicable law or agreed to in writing, software
17   * distributed under the License is distributed on an "AS IS" BASIS,
18   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19   * See the License for the specific language governing permissions and
20   * limitations under the License.
21   * #L%
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  	 * Code Value: <b>transaction</b>
33  	 */
34  	TRANSACTION("transaction", "http://hl7.org/fhir/restful-operation"),
35  	
36  	/**
37  	 * Code Value: <b>search-system</b>
38  	 */
39  	SEARCH_SYSTEM("search-system", "http://hl7.org/fhir/restful-operation"),
40  	
41  	/**
42  	 * Code Value: <b>history-system</b>
43  	 */
44  	HISTORY_SYSTEM("history-system", "http://hl7.org/fhir/restful-operation"),
45  	
46  	;
47  	
48  	/**
49  	 * Identifier for this Value Set:
50  	 * http://hl7.org/fhir/vs/system-restful-operation
51  	 */
52  	public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/system-restful-operation";
53  
54  	/**
55  	 * Name for this Value Set:
56  	 * RestfulOperationSystem
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  	 * Returns the code associated with this enumerated value
79  	 */
80  	public String getCode() {
81  		return myCode;
82  	}
83  	
84  	/**
85  	 * Returns the code system associated with this enumerated value
86  	 */
87  	public String getSystem() {
88  		return mySystem;
89  	}
90  	
91  	/**
92  	 * Returns the enumerated value associated with this code
93  	 */
94  	public RestfulOperationSystemEnum forCode(String theCode) {
95  		RestfulOperationSystemEnum retVal = CODE_TO_ENUM.get(theCode);
96  		return retVal;
97  	}
98  
99  	/**
100 	 * Converts codes to their respective enumerated values
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 	 * Constructor
131 	 */
132 	RestfulOperationSystemEnum(String theCode, String theSystem) {
133 		myCode = theCode;
134 		mySystem = theSystem;
135 	}
136 
137 	
138 }