View Javadoc
1   package ca.uhn.fhir.validation;
2   
3   /*
4    * #%L
5    * HAPI FHIR - Core Library
6    * %%
7    * Copyright (C) 2014 - 2018 University Health Network
8    * %%
9    * Licensed under the Apache License, Version 2.0 (the "License");
10   * you may not use this file except in compliance with the License.
11   * You may obtain a copy of the License at
12   * 
13   *      http://www.apache.org/licenses/LICENSE-2.0
14   * 
15   * Unless required by applicable law or agreed to in writing, software
16   * distributed under the License is distributed on an "AS IS" BASIS,
17   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18   * See the License for the specific language governing permissions and
19   * limitations under the License.
20   * #L%
21   */
22  
23  import java.util.Collections;
24  import java.util.HashMap;
25  import java.util.Map;
26  
27  public enum ResultSeverityEnum {
28  
29  	/**
30  	 * The issue has no relation to the degree of success of the action
31  	 */
32  	INFORMATION("information"),
33  	
34  	/**
35  	 * The issue is not important enough to cause the action to fail, but may cause it to be performed suboptimally or in a way that is not as desired
36  	 */
37  	WARNING("warning"),
38  	
39  	/**
40  	 * The issue is sufficiently important to cause the action to fail
41  	 */
42  	ERROR("error"),
43  
44  	/**
45  	 * The issue caused the action to fail, and no further checking could be performed
46  	 */
47  	FATAL("fatal");
48  
49  	private static Map<String, ResultSeverityEnum> ourValues;
50  	private String myCode;
51  
52  	private ResultSeverityEnum(String theCode) {
53  		myCode = theCode;
54  	}
55  
56  	public String getCode() {
57  		return myCode;
58  	}
59  
60  	public static ResultSeverityEnum fromCode(String theCode) {
61  		if (ourValues == null) {
62  			HashMap<String, ResultSeverityEnum> values = new HashMap<String, ResultSeverityEnum>();
63  			for (ResultSeverityEnum next : values()) {
64  				values.put(next.getCode(), next);
65  			}
66  			ourValues = Collections.unmodifiableMap(values);
67  		}
68  		return ourValues.get(theCode);
69  	}
70  
71  	/**
72  	 * Convert from Enum ordinal to Enum type.
73  	 *
74  	 * Usage:
75  	 *
76  	 * <code>ResultSeverityEnum resultSeverityEnum = ResultSeverityEnum.values[ordinal];</code>
77  	 */
78  	public static final ResultSeverityEnum values[] = values();
79  }