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 NarrativeStatusEnum {
30  
31  	/**
32  	 * generated
33  	 * 
34  	 *
35  	 * The contents of the narrative are entirely generated from the structured data in the resource.
36  	 */
37  	GENERATED("generated","http://hl7.org/fhir/narrative-status"),
38  	
39  	/**
40  	 * extensions
41  	 * 
42  	 *
43  	 * The contents of the narrative are entirely generated from the structured data in the resource and some of the content is generated from extensions.
44  	 */
45  	EXTENSIONS("extensions","http://hl7.org/fhir/narrative-status"),
46  	
47  	/**
48  	 * additional
49  	 * 
50  	 *
51  	 * The contents of the narrative contain additional information not found in the structured data.
52  	 */
53  	ADDITIONAL("additional","http://hl7.org/fhir/narrative-status"),
54  	
55  	/**
56  	 * empty
57  	 * 
58  	 *
59  	 * the contents of the narrative are some equivalent of "No human-readable text provided for this resource".
60  	 */
61  	EMPTY("empty","http://hl7.org/fhir/narrative-status"),
62  	
63  	;
64  	
65  	/**
66  	 * Identifier for this Value Set:
67  	 * http://hl7.org/fhir/vs/narrative-status
68  	 */
69  	public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/narrative-status";
70  
71  	/**
72  	 * Name for this Value Set:
73  	 * NarrativeStatus
74  	 */
75  	public static final String VALUESET_NAME = "NarrativeStatus";
76  
77  	private static Map<String, NarrativeStatusEnum> CODE_TO_ENUM = new HashMap<String, NarrativeStatusEnum>();
78  	private static Map<String, Map<String, NarrativeStatusEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, NarrativeStatusEnum>>();
79  	
80  	private final String myCode;
81  	private final String mySystem;
82  	
83  	static {
84  		for (NarrativeStatusEnum next : NarrativeStatusEnum.values()) {
85  			CODE_TO_ENUM.put(next.getCode(), next);
86  			
87  			if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) {
88  				SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, NarrativeStatusEnum>());
89  			}
90  			SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next);			
91  		}
92  	}
93  	
94  	/**
95  	 * Returns the code associated with this enumerated value
96  	 */
97  	public String getCode() {
98  		return myCode;
99  	}
100 	
101 	/**
102 	 * Returns the code system associated with this enumerated value
103 	 */
104 	public String getSystem() {
105 		return mySystem;
106 	}
107 	
108 	/**
109 	 * Returns the enumerated value associated with this code
110 	 */
111 	public NarrativeStatusEnum forCode(String theCode) {
112 		NarrativeStatusEnum retVal = CODE_TO_ENUM.get(theCode);
113 		return retVal;
114 	}
115 
116 	/**
117 	 * Converts codes to their respective enumerated values
118 	 */
119 	public static final IValueSetEnumBinder<NarrativeStatusEnum> VALUESET_BINDER = new IValueSetEnumBinder<NarrativeStatusEnum>() {
120 		@Override
121 		public String toCodeString(NarrativeStatusEnum theEnum) {
122 			return theEnum.getCode();
123 		}
124 
125 		@Override
126 		public String toSystemString(NarrativeStatusEnum theEnum) {
127 			return theEnum.getSystem();
128 		}
129 		
130 		@Override
131 		public NarrativeStatusEnum fromCodeString(String theCodeString) {
132 			return CODE_TO_ENUM.get(theCodeString);
133 		}
134 		
135 		@Override
136 		public NarrativeStatusEnum fromCodeString(String theCodeString, String theSystemString) {
137 			Map<String, NarrativeStatusEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
138 			if (map == null) {
139 				return null;
140 			}
141 			return map.get(theCodeString);
142 		}
143 		
144 	};
145 	
146 	/** 
147 	 * Constructor
148 	 */
149 	NarrativeStatusEnum(String theCode, String theSystem) {
150 		myCode = theCode;
151 		mySystem = theSystem;
152 	}
153 	
154 }