001 002package ca.uhn.fhir.model.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 BundleEntrySearchModeEnum { 032 033 MATCH("match", "http://hl7.org/fhir/search-entry-mode"), 034 INCLUDE("include", "http://hl7.org/fhir/search-entry-mode"), 035 036 ; 037 038 /** 039 * Identifier for this Value Set: 040 * http://hl7.org/fhir/vs/address-use 041 */ 042 public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/bundle-entry-status"; 043 044 /** 045 * Name for this Value Set: 046 * AddressUse 047 */ 048 public static final String VALUESET_NAME = "BundleEntryStatus"; 049 050 private static Map<String, BundleEntrySearchModeEnum> CODE_TO_ENUM = new HashMap<String, BundleEntrySearchModeEnum>(); 051 private static Map<String, Map<String, BundleEntrySearchModeEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, BundleEntrySearchModeEnum>>(); 052 053 private final String myCode; 054 private final String mySystem; 055 056 static { 057 for (BundleEntrySearchModeEnum next : BundleEntrySearchModeEnum.values()) { 058 CODE_TO_ENUM.put(next.getCode(), next); 059 060 if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) { 061 SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, BundleEntrySearchModeEnum>()); 062 } 063 SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next); 064 } 065 } 066 067 /** 068 * Returns the code associated with this enumerated value 069 */ 070 public String getCode() { 071 return myCode; 072 } 073 074 /** 075 * Returns the code system associated with this enumerated value 076 */ 077 public String getSystem() { 078 return mySystem; 079 } 080 081 /** 082 * Returns the enumerated value associated with this code 083 */ 084 public BundleEntrySearchModeEnum forCode(String theCode) { 085 BundleEntrySearchModeEnum retVal = CODE_TO_ENUM.get(theCode); 086 return retVal; 087 } 088 089 /** 090 * Converts codes to their respective enumerated values 091 */ 092 public static final IValueSetEnumBinder<BundleEntrySearchModeEnum> VALUESET_BINDER = new IValueSetEnumBinder<BundleEntrySearchModeEnum>() { 093 @Override 094 public String toCodeString(BundleEntrySearchModeEnum theEnum) { 095 return theEnum.getCode(); 096 } 097 098 @Override 099 public String toSystemString(BundleEntrySearchModeEnum theEnum) { 100 return theEnum.getSystem(); 101 } 102 103 @Override 104 public BundleEntrySearchModeEnum fromCodeString(String theCodeString) { 105 return CODE_TO_ENUM.get(theCodeString); 106 } 107 108 @Override 109 public BundleEntrySearchModeEnum fromCodeString(String theCodeString, String theSystemString) { 110 Map<String, BundleEntrySearchModeEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString); 111 if (map == null) { 112 return null; 113 } 114 return map.get(theCodeString); 115 } 116 117 }; 118 119 /** 120 * Constructor 121 */ 122 BundleEntrySearchModeEnum(String theCode, String theSystem) { 123 myCode = theCode; 124 mySystem = theSystem; 125 } 126 127 128}