001
002package ca.uhn.fhir.model.dstu2.valueset;
003
004import ca.uhn.fhir.model.api.*;
005import java.util.HashMap;
006import java.util.Map;
007
008public enum SearchParamTypeEnum {
009
010        /**
011         * Display: <b>Number</b><br>
012         * Code Value: <b>number</b>
013         *
014         * Search parameter SHALL be a number (a whole number, or a decimal).
015         */
016        NUMBER("number", "http://hl7.org/fhir/search-param-type"),
017        
018        /**
019         * Display: <b>Date/DateTime</b><br>
020         * Code Value: <b>date</b>
021         *
022         * Search parameter is on a date/time. The date format is the standard XML format, though other formats may be supported.
023         */
024        DATE_DATETIME("date", "http://hl7.org/fhir/search-param-type"),
025        
026        /**
027         * Display: <b>String</b><br>
028         * Code Value: <b>string</b>
029         *
030         * 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.
031         */
032        STRING("string", "http://hl7.org/fhir/search-param-type"),
033        
034        /**
035         * Display: <b>Token</b><br>
036         * Code Value: <b>token</b>
037         *
038         * 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.
039         */
040        TOKEN("token", "http://hl7.org/fhir/search-param-type"),
041        
042        /**
043         * Display: <b>Reference</b><br>
044         * Code Value: <b>reference</b>
045         *
046         * A reference to another resource.
047         */
048        REFERENCE("reference", "http://hl7.org/fhir/search-param-type"),
049        
050        /**
051         * Display: <b>Composite</b><br>
052         * Code Value: <b>composite</b>
053         *
054         * A composite search parameter that combines a search on two values together.
055         */
056        COMPOSITE("composite", "http://hl7.org/fhir/search-param-type"),
057        
058        /**
059         * Display: <b>Quantity</b><br>
060         * Code Value: <b>quantity</b>
061         *
062         * A search parameter that searches on a quantity.
063         */
064        QUANTITY("quantity", "http://hl7.org/fhir/search-param-type"),
065        
066        /**
067         * Display: <b>URI</b><br>
068         * Code Value: <b>uri</b>
069         *
070         * A search parameter that searches on a URI (RFC 3986).
071         */
072        URI("uri", "http://hl7.org/fhir/search-param-type"),
073        
074        ;
075        
076        /**
077         * Identifier for this Value Set:
078         * 
079         */
080        public static final String VALUESET_IDENTIFIER = "";
081
082        /**
083         * Name for this Value Set:
084         * SearchParamType
085         */
086        public static final String VALUESET_NAME = "SearchParamType";
087
088        private static Map<String, SearchParamTypeEnum> CODE_TO_ENUM = new HashMap<String, SearchParamTypeEnum>();
089        private static Map<String, Map<String, SearchParamTypeEnum>> SYSTEM_TO_CODE_TO_ENUM = new HashMap<String, Map<String, SearchParamTypeEnum>>();
090        
091        private final String myCode;
092        private final String mySystem;
093        
094        static {
095                for (SearchParamTypeEnum next : SearchParamTypeEnum.values()) {
096                        CODE_TO_ENUM.put(next.getCode(), next);
097                        
098                        if (!SYSTEM_TO_CODE_TO_ENUM.containsKey(next.getSystem())) {
099                                SYSTEM_TO_CODE_TO_ENUM.put(next.getSystem(), new HashMap<String, SearchParamTypeEnum>());
100                        }
101                        SYSTEM_TO_CODE_TO_ENUM.get(next.getSystem()).put(next.getCode(), next);                 
102                }
103        }
104        
105        /**
106         * Returns the code associated with this enumerated value
107         */
108        public String getCode() {
109                return myCode;
110        }
111        
112        /**
113         * Returns the code system associated with this enumerated value
114         */
115        public String getSystem() {
116                return mySystem;
117        }
118        
119        /**
120         * Returns the enumerated value associated with this code
121         */
122        public static SearchParamTypeEnum forCode(String theCode) {
123                SearchParamTypeEnum retVal = CODE_TO_ENUM.get(theCode);
124                return retVal;
125        }
126
127        /**
128         * Converts codes to their respective enumerated values
129         */
130        public static final IValueSetEnumBinder<SearchParamTypeEnum> VALUESET_BINDER = new IValueSetEnumBinder<SearchParamTypeEnum>() {
131                @Override
132                public String toCodeString(SearchParamTypeEnum theEnum) {
133                        return theEnum.getCode();
134                }
135
136                @Override
137                public String toSystemString(SearchParamTypeEnum theEnum) {
138                        return theEnum.getSystem();
139                }
140                
141                @Override
142                public SearchParamTypeEnum fromCodeString(String theCodeString) {
143                        return CODE_TO_ENUM.get(theCodeString);
144                }
145                
146                @Override
147                public SearchParamTypeEnum fromCodeString(String theCodeString, String theSystemString) {
148                        Map<String, SearchParamTypeEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
149                        if (map == null) {
150                                return null;
151                        }
152                        return map.get(theCodeString);
153                }
154                
155        };
156        
157        /** 
158         * Constructor
159         */
160        SearchParamTypeEnum(String theCode, String theSystem) {
161                myCode = theCode;
162                mySystem = theSystem;
163        }
164
165        
166}