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 SecurityEventObjectTypeEnum { 032 033 /** 034 * Code Value: <b>1</b> 035 * 036 * Person. 037 */ 038 PERSON("1", "http://hl7.org/fhir/object-type"), 039 040 /** 041 * Code Value: <b>2</b> 042 * 043 * System Object. 044 */ 045 SYSTEM_OBJECT("2", "http://hl7.org/fhir/object-type"), 046 047 /** 048 * Code Value: <b>3</b> 049 * 050 * Organization. 051 */ 052 ORGANIZATION("3", "http://hl7.org/fhir/object-type"), 053 054 /** 055 * Code Value: <b>4</b> 056 * 057 * Other. 058 */ 059 OTHER("4", "http://hl7.org/fhir/object-type"), 060 061 ; 062 063 /** 064 * Identifier for this Value Set: 065 * http://hl7.org/fhir/vs/object-type 066 */ 067 public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/object-type"; 068 069 /** 070 * Name for this Value Set: 071 * SecurityEventObjectType 072 */ 073 public static final String VALUESET_NAME = "SecurityEventObjectType"; 074 075 private static Map<String, SecurityEventObjectTypeEnum> CODE_TO_ENUM = new HashMap<String, SecurityEventObjectTypeEnum>(); 076 private static Map<String, Map<String, SecurityEventObjectTypeEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, SecurityEventObjectTypeEnum>>(); 077 078 private final String myCode; 079 private final String mySystem; 080 081 static { 082 for (SecurityEventObjectTypeEnum next : SecurityEventObjectTypeEnum.values()) { 083 CODE_TO_ENUM.put(next.getCode(), next); 084 085 if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) { 086 SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, SecurityEventObjectTypeEnum>()); 087 } 088 SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next); 089 } 090 } 091 092 /** 093 * Returns the code associated with this enumerated value 094 */ 095 public String getCode() { 096 return myCode; 097 } 098 099 /** 100 * Returns the code system associated with this enumerated value 101 */ 102 public String getSystem() { 103 return mySystem; 104 } 105 106 /** 107 * Returns the enumerated value associated with this code 108 */ 109 public SecurityEventObjectTypeEnum forCode(String theCode) { 110 SecurityEventObjectTypeEnum retVal = CODE_TO_ENUM.get(theCode); 111 return retVal; 112 } 113 114 /** 115 * Converts codes to their respective enumerated values 116 */ 117 public static final IValueSetEnumBinder<SecurityEventObjectTypeEnum> VALUESET_BINDER = new IValueSetEnumBinder<SecurityEventObjectTypeEnum>() { 118 @Override 119 public String toCodeString(SecurityEventObjectTypeEnum theEnum) { 120 return theEnum.getCode(); 121 } 122 123 @Override 124 public String toSystemString(SecurityEventObjectTypeEnum theEnum) { 125 return theEnum.getSystem(); 126 } 127 128 @Override 129 public SecurityEventObjectTypeEnum fromCodeString(String theCodeString) { 130 return CODE_TO_ENUM.get(theCodeString); 131 } 132 133 @Override 134 public SecurityEventObjectTypeEnum fromCodeString(String theCodeString, String theSystemString) { 135 Map<String, SecurityEventObjectTypeEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString); 136 if (map == null) { 137 return null; 138 } 139 return map.get(theCodeString); 140 } 141 142 }; 143 144 /** 145 * Constructor 146 */ 147 SecurityEventObjectTypeEnum(String theCode, String theSystem) { 148 myCode = theCode; 149 mySystem = theSystem; 150 } 151 152 153}