001
002package ca.uhn.fhir.model.valueset;
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;
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
094                private static final long serialVersionUID = -3836039426814809083L;
095
096                @Override
097                public String toCodeString(BundleEntrySearchModeEnum theEnum) {
098                        return theEnum.getCode();
099                }
100
101                @Override
102                public String toSystemString(BundleEntrySearchModeEnum theEnum) {
103                        return theEnum.getSystem();
104                }
105                
106                @Override
107                public BundleEntrySearchModeEnum fromCodeString(String theCodeString) {
108                        return CODE_TO_ENUM.get(theCodeString);
109                }
110                
111                @Override
112                public BundleEntrySearchModeEnum fromCodeString(String theCodeString, String theSystemString) {
113                        Map<String, BundleEntrySearchModeEnum> map = SYSTEM_TO_CODE_TO_ENUM.get(theSystemString);
114                        if (map == null) {
115                                return null;
116                        }
117                        return map.get(theCodeString);
118                }
119                
120        };
121        
122        /** 
123         * Constructor
124         */
125        BundleEntrySearchModeEnum(String theCode, String theSystem) {
126                myCode = theCode;
127                mySystem = theSystem;
128        }
129
130        
131}