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 MessageSignificanceCategoryEnum {
30  
31  	/**
32  	 * Code Value: <b>Consequence</b>
33  	 *
34  	 * The message represents/requests a change that should not be processed more than once. E.g. Making a booking for an appointment.
35  	 */
36  	CONSEQUENCE("Consequence", "http://hl7.org/fhir/message-significance-category"),
37  	
38  	/**
39  	 * Code Value: <b>Currency</b>
40  	 *
41  	 * The message represents a response to query for current information. Retrospective processing is wrong and/or wasteful.
42  	 */
43  	CURRENCY("Currency", "http://hl7.org/fhir/message-significance-category"),
44  	
45  	/**
46  	 * Code Value: <b>Notification</b>
47  	 *
48  	 * The content is not necessarily intended to be current, and it can be reprocessed, though there may be version issues created by processing old notifications.
49  	 */
50  	NOTIFICATION("Notification", "http://hl7.org/fhir/message-significance-category"),
51  	
52  	;
53  	
54  	/**
55  	 * Identifier for this Value Set:
56  	 * http://hl7.org/fhir/vs/message-significance-category
57  	 */
58  	public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/message-significance-category";
59  
60  	/**
61  	 * Name for this Value Set:
62  	 * MessageSignificanceCategory
63  	 */
64  	public static final String VALUESET_NAME = "MessageSignificanceCategory";
65  
66  	private static Map<String, MessageSignificanceCategoryEnum> CODE_TO_ENUM = new HashMap<String, MessageSignificanceCategoryEnum>();
67  	private static Map<String, Map<String, MessageSignificanceCategoryEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, MessageSignificanceCategoryEnum>>();
68  	
69  	private final String myCode;
70  	private final String mySystem;
71  	
72  	static {
73  		for (MessageSignificanceCategoryEnum next : MessageSignificanceCategoryEnum.values()) {
74  			CODE_TO_ENUM.put(next.getCode(), next);
75  			
76  			if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) {
77  				SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, MessageSignificanceCategoryEnum>());
78  			}
79  			SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next);			
80  		}
81  	}
82  	
83  	/**
84  	 * Returns the code associated with this enumerated value
85  	 */
86  	public String getCode() {
87  		return myCode;
88  	}
89  	
90  	/**
91  	 * Returns the code system associated with this enumerated value
92  	 */
93  	public String getSystem() {
94  		return mySystem;
95  	}
96  	
97  	/**
98  	 * Returns the enumerated value associated with this code
99  	 */
100 	public MessageSignificanceCategoryEnum forCode(String theCode) {
101 		MessageSignificanceCategoryEnum retVal = CODE_TO_ENUM.get(theCode);
102 		return retVal;
103 	}
104 
105 	/**
106 	 * Converts codes to their respective enumerated values
107 	 */
108 	public static final IValueSetEnumBinder<MessageSignificanceCategoryEnum> VALUESET_BINDER = new IValueSetEnumBinder<MessageSignificanceCategoryEnum>() {
109 		@Override
110 		public String toCodeString(MessageSignificanceCategoryEnum theEnum) {
111 			return theEnum.getCode();
112 		}
113 
114 		@Override
115 		public String toSystemString(MessageSignificanceCategoryEnum theEnum) {
116 			return theEnum.getSystem();
117 		}
118 		
119 		@Override
120 		public MessageSignificanceCategoryEnum fromCodeString(String theCodeString) {
121 			return CODE_TO_ENUM.get(theCodeString);
122 		}
123 		
124 		@Override
125 		public MessageSignificanceCategoryEnum fromCodeString(String theCodeString, String theSystemString) {
126 			Map<String, MessageSignificanceCategoryEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
127 			if (map == null) {
128 				return null;
129 			}
130 			return map.get(theCodeString);
131 		}
132 		
133 	};
134 	
135 	/** 
136 	 * Constructor
137 	 */
138 	MessageSignificanceCategoryEnum(String theCode, String theSystem) {
139 		myCode = theCode;
140 		mySystem = theSystem;
141 	}
142 
143 	
144 }