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 RestfulSecurityServiceEnum {
30  
31  	/**
32  	 * Code Value: <b>OAuth</b>
33  	 *
34  	 * OAuth (see oauth.net).
35  	 */
36  	OAUTH("OAuth", "http://hl7.org/fhir/restful-security-service"),
37  	
38  	/**
39  	 * Code Value: <b>OAuth2</b>
40  	 *
41  	 * OAuth version 2 (see oauth.net).
42  	 */
43  	OAUTH2("OAuth2", "http://hl7.org/fhir/restful-security-service"),
44  	
45  	/**
46  	 * Code Value: <b>NTLM</b>
47  	 *
48  	 * Microsoft NTLM Authentication.
49  	 */
50  	NTLM("NTLM", "http://hl7.org/fhir/restful-security-service"),
51  	
52  	/**
53  	 * Code Value: <b>Basic</b>
54  	 *
55  	 * Basic authentication defined in HTTP specification.
56  	 */
57  	BASIC("Basic", "http://hl7.org/fhir/restful-security-service"),
58  	
59  	/**
60  	 * Code Value: <b>Kerberos</b>
61  	 *
62  	 * see http://www.ietf.org/rfc/rfc4120.txt.
63  	 */
64  	KERBEROS("Kerberos", "http://hl7.org/fhir/restful-security-service"),
65  	
66  	;
67  	
68  	/**
69  	 * Identifier for this Value Set:
70  	 * http://hl7.org/fhir/vs/restful-security-service
71  	 */
72  	public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/restful-security-service";
73  
74  	/**
75  	 * Name for this Value Set:
76  	 * RestfulSecurityService
77  	 */
78  	public static final String VALUESET_NAME = "RestfulSecurityService";
79  
80  	private static Map<String, RestfulSecurityServiceEnum> CODE_TO_ENUM = new HashMap<String, RestfulSecurityServiceEnum>();
81  	private static Map<String, Map<String, RestfulSecurityServiceEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, RestfulSecurityServiceEnum>>();
82  	
83  	private final String myCode;
84  	private final String mySystem;
85  	
86  	static {
87  		for (RestfulSecurityServiceEnum next : RestfulSecurityServiceEnum.values()) {
88  			CODE_TO_ENUM.put(next.getCode(), next);
89  			
90  			if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) {
91  				SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, RestfulSecurityServiceEnum>());
92  			}
93  			SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next);			
94  		}
95  	}
96  	
97  	/**
98  	 * Returns the code associated with this enumerated value
99  	 */
100 	public String getCode() {
101 		return myCode;
102 	}
103 	
104 	/**
105 	 * Returns the code system associated with this enumerated value
106 	 */
107 	public String getSystem() {
108 		return mySystem;
109 	}
110 	
111 	/**
112 	 * Returns the enumerated value associated with this code
113 	 */
114 	public RestfulSecurityServiceEnum forCode(String theCode) {
115 		RestfulSecurityServiceEnum retVal = CODE_TO_ENUM.get(theCode);
116 		return retVal;
117 	}
118 
119 	/**
120 	 * Converts codes to their respective enumerated values
121 	 */
122 	public static final IValueSetEnumBinder<RestfulSecurityServiceEnum> VALUESET_BINDER = new IValueSetEnumBinder<RestfulSecurityServiceEnum>() {
123 		@Override
124 		public String toCodeString(RestfulSecurityServiceEnum theEnum) {
125 			return theEnum.getCode();
126 		}
127 
128 		@Override
129 		public String toSystemString(RestfulSecurityServiceEnum theEnum) {
130 			return theEnum.getSystem();
131 		}
132 		
133 		@Override
134 		public RestfulSecurityServiceEnum fromCodeString(String theCodeString) {
135 			return CODE_TO_ENUM.get(theCodeString);
136 		}
137 		
138 		@Override
139 		public RestfulSecurityServiceEnum fromCodeString(String theCodeString, String theSystemString) {
140 			Map<String, RestfulSecurityServiceEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
141 			if (map == null) {
142 				return null;
143 			}
144 			return map.get(theCodeString);
145 		}
146 		
147 	};
148 	
149 	/** 
150 	 * Constructor
151 	 */
152 	RestfulSecurityServiceEnum(String theCode, String theSystem) {
153 		myCode = theCode;
154 		mySystem = theSystem;
155 	}
156 
157 	
158 }