
001 002package ca.uhn.fhir.rest.api; 003 004/* 005 * #%L 006 * HAPI FHIR - Core Library 007 * %% 008 * Copyright (C) 2014 - 2023 Smile CDR, Inc. 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; 028 029public enum RestSearchParameterTypeEnum { 030 031 /** 032 * Code Value: <b>number</b> 033 * 034 * Search parameter SHALL be a number (a whole number, or a decimal). 035 */ 036 NUMBER("number", "http://hl7.org/fhir/search-param-type"), 037 038 /** 039 * Code Value: <b>date</b> 040 * 041 * Search parameter is on a date/time. The date format is the standard XML format, though other formats may be supported. 042 */ 043 DATE("date", "http://hl7.org/fhir/search-param-type"), 044 045 /** 046 * Code Value: <b>string</b> 047 * 048 * Search parameter is a simple string, like a name part. Search is case-insensitive and accent-insensitive. May match just the start of a string. String parameters may contain spaces. 049 */ 050 STRING("string", "http://hl7.org/fhir/search-param-type"), 051 052 /** 053 * Code Value: <b>token</b> 054 * 055 * Search parameter on a coded element or identifier. May be used to search through the text, displayname, code and code/codesystem (for codes) and label, system and key (for identifier). Its value is either a string or a pair of namespace and value, separated by a "|", depending on the modifier used. 056 */ 057 TOKEN("token", "http://hl7.org/fhir/search-param-type"), 058 059 /** 060 * Code Value: <b>reference</b> 061 * 062 * A reference to another resource. 063 */ 064 REFERENCE("reference", "http://hl7.org/fhir/search-param-type"), 065 066 /** 067 * Code Value: <b>composite</b> 068 * 069 * A composite search parameter that combines a search on two values together. 070 */ 071 COMPOSITE("composite", "http://hl7.org/fhir/search-param-type"), 072 073 /** 074 * Code Value: <b>quantity</b> 075 * 076 * A search parameter that searches on a quantity. 077 */ 078 QUANTITY("quantity", "http://hl7.org/fhir/search-param-type"), 079 080 /** 081 * Code Value: <b>quantity</b> 082 * 083 * A search parameter that searches on a quantity. 084 */ 085 URI("uri", "http://hl7.org/fhir/search-param-type"), 086 087 /** 088 * _has parameter 089 */ 090 HAS("string", "http://hl7.org/fhir/search-param-type"), 091 092 /** 093 * Code Value: <b>number</b> 094 * 095 * Search parameter SHALL be a number (a whole number, or a decimal). 096 */ 097 SPECIAL("special", "http://hl7.org/fhir/search-param-type"), 098 099 ; 100 101 102 /** 103 * Identifier for this Value Set: 104 * http://hl7.org/fhir/vs/search-param-type 105 */ 106 public static final String VALUESET_IDENTIFIER = "http://hl7.org/fhir/vs/search-param-type"; 107 108 /** 109 * Name for this Value Set: 110 * SearchParamType 111 */ 112 public static final String VALUESET_NAME = "SearchParamType"; 113 114 private static Map<String, RestSearchParameterTypeEnum> CODE_TO_ENUM = new HashMap<String, RestSearchParameterTypeEnum>(); 115 private static Map<String, Map<String, RestSearchParameterTypeEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, RestSearchParameterTypeEnum>>(); 116 117 private final String myCode; 118 private final String mySystem; 119 120 static { 121 for (RestSearchParameterTypeEnum next : RestSearchParameterTypeEnum.values()) { 122 if (next == HAS) { 123 continue; 124 } 125 126 CODE_TO_ENUM.put(next.getCode(), next); 127 128 if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) { 129 SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, RestSearchParameterTypeEnum>()); 130 } 131 SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next); 132 } 133 } 134 135 /** 136 * Returns the code associated with this enumerated value 137 */ 138 public String getCode() { 139 return myCode; 140 } 141 142 /** 143 * Returns the code system associated with this enumerated value 144 */ 145 public String getSystem() { 146 return mySystem; 147 } 148 149 /** 150 * Returns the enumerated value associated with this code 151 */ 152 public static RestSearchParameterTypeEnum forCode(String theCode) { 153 RestSearchParameterTypeEnum retVal = CODE_TO_ENUM.get(theCode); 154 return retVal; 155 } 156 157 /** 158 * Converts codes to their respective enumerated values 159 */ 160 public static final IValueSetEnumBinder<RestSearchParameterTypeEnum> VALUESET_BINDER = new IValueSetEnumBinder<RestSearchParameterTypeEnum>() { 161 private static final long serialVersionUID = 1L; 162 163 @Override 164 public String toCodeString(RestSearchParameterTypeEnum theEnum) { 165 return theEnum.getCode(); 166 } 167 168 @Override 169 public String toSystemString(RestSearchParameterTypeEnum theEnum) { 170 return theEnum.getSystem(); 171 } 172 173 @Override 174 public RestSearchParameterTypeEnum fromCodeString(String theCodeString) { 175 return CODE_TO_ENUM.get(theCodeString); 176 } 177 178 @Override 179 public RestSearchParameterTypeEnum fromCodeString(String theCodeString, String theSystemString) { 180 Map<String, RestSearchParameterTypeEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString); 181 if (map == null) { 182 return null; 183 } 184 return map.get(theCodeString); 185 } 186 187 }; 188 189 /** 190 * Constructor 191 */ 192 RestSearchParameterTypeEnum(String theCode, String theSystem) { 193 myCode = theCode; 194 mySystem = theSystem; 195 } 196 197 198}