001 002package ca.uhn.fhir.model.dstu.valueset; 003 004/* 005 * #%L 006 * HAPI FHIR - Core Library 007 * %% 008 * Copyright (C) 2014 - 2016 University Health Network 009 * %% 010 * Licensed under the Apache License, Version 2.0 (the "License"); 011 * you may not use this file except in compliance with the License. 012 * You may obtain a copy of the License at 013 * 014 * http://www.apache.org/licenses/LICENSE-2.0 015 * 016 * Unless required by applicable law or agreed to in writing, software 017 * distributed under the License is distributed on an "AS IS" BASIS, 018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 019 * See the License for the specific language governing permissions and 020 * limitations under the License. 021 * #L% 022 */ 023 024import java.util.HashMap; 025import java.util.Map; 026 027import ca.uhn.fhir.model.api.IValueSetEnumBinder; 028import ca.uhn.fhir.util.CoverageIgnore; 029 030@CoverageIgnore 031public enum SecurityEventObjectSensitivityEnum { 032 033 ; 034 035 /** 036 * Identifier for this Value Set: 037 * http://hl7.org/fhir/vs/security-event-sensitivity 038 */ 039 public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/security-event-sensitivity"; 040 041 /** 042 * Name for this Value Set: 043 * Security Event Object Sensitivity 044 */ 045 public static final String VALUESET_NAME = "Security Event Object Sensitivity"; 046 047 private static Map<String, SecurityEventObjectSensitivityEnum> CODE_TO_ENUM = new HashMap<String, SecurityEventObjectSensitivityEnum>(); 048 private static Map<String, Map<String, SecurityEventObjectSensitivityEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, SecurityEventObjectSensitivityEnum>>(); 049 050 private final String myCode; 051 private final String mySystem; 052 053 static { 054 for (SecurityEventObjectSensitivityEnum next : SecurityEventObjectSensitivityEnum.values()) { 055 CODE_TO_ENUM.put(next.getCode(), next); 056 057 if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) { 058 SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, SecurityEventObjectSensitivityEnum>()); 059 } 060 SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next); 061 } 062 } 063 064 /** 065 * Returns the code associated with this enumerated value 066 */ 067 public String getCode() { 068 return myCode; 069 } 070 071 /** 072 * Returns the code system associated with this enumerated value 073 */ 074 public String getSystem() { 075 return mySystem; 076 } 077 078 /** 079 * Returns the enumerated value associated with this code 080 */ 081 public SecurityEventObjectSensitivityEnum forCode(String theCode) { 082 SecurityEventObjectSensitivityEnum retVal = CODE_TO_ENUM.get(theCode); 083 return retVal; 084 } 085 086 /** 087 * Converts codes to their respective enumerated values 088 */ 089 public static final IValueSetEnumBinder<SecurityEventObjectSensitivityEnum> VALUESET_BINDER = new IValueSetEnumBinder<SecurityEventObjectSensitivityEnum>() { 090 @Override 091 public String toCodeString(SecurityEventObjectSensitivityEnum theEnum) { 092 return theEnum.getCode(); 093 } 094 095 @Override 096 public String toSystemString(SecurityEventObjectSensitivityEnum theEnum) { 097 return theEnum.getSystem(); 098 } 099 100 @Override 101 public SecurityEventObjectSensitivityEnum fromCodeString(String theCodeString) { 102 return CODE_TO_ENUM.get(theCodeString); 103 } 104 105 @Override 106 public SecurityEventObjectSensitivityEnum fromCodeString(String theCodeString, String theSystemString) { 107 Map<String, SecurityEventObjectSensitivityEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString); 108 if (map == null) { 109 return null; 110 } 111 return map.get(theCodeString); 112 } 113 114 }; 115 116 /** 117 * Constructor 118 */ 119 SecurityEventObjectSensitivityEnum(String theCode, String theSystem) { 120 myCode = theCode; 121 mySystem = theSystem; 122 } 123 124 125}