001package org.hl7.fhir.r4.model.codesystems;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Wed, Jan 30, 2019 16:19-0500 for FHIR v4.0.0
033
034import org.hl7.fhir.exceptions.FHIRException;
035
036public enum SearchParamType {
037
038  /**
039   * Search parameter SHALL be a number (a whole number, or a decimal).
040   */
041  NUMBER,
042  /**
043   * Search parameter is on a date/time. The date format is the standard XML
044   * format, though other formats may be supported.
045   */
046  DATE,
047  /**
048   * Search parameter is a simple string, like a name part. Search is
049   * case-insensitive and accent-insensitive. May match just the start of a
050   * string. String parameters may contain spaces.
051   */
052  STRING,
053  /**
054   * Search parameter on a coded element or identifier. May be used to search
055   * through the text, display, code and code/codesystem (for codes) and label,
056   * system and key (for identifier). Its value is either a string or a pair of
057   * namespace and value, separated by a "|", depending on the modifier used.
058   */
059  TOKEN,
060  /**
061   * A reference to another resource (Reference or canonical).
062   */
063  REFERENCE,
064  /**
065   * A composite search parameter that combines a search on two values together.
066   */
067  COMPOSITE,
068  /**
069   * A search parameter that searches on a quantity.
070   */
071  QUANTITY,
072  /**
073   * A search parameter that searches on a URI (RFC 3986).
074   */
075  URI,
076  /**
077   * Special logic applies to this parameter per the description of the search
078   * parameter.
079   */
080  SPECIAL,
081  /**
082   * added to help the parsers
083   */
084  NULL;
085
086  public static SearchParamType fromCode(String codeString) throws FHIRException {
087    if (codeString == null || "".equals(codeString))
088      return null;
089    if ("number".equals(codeString))
090      return NUMBER;
091    if ("date".equals(codeString))
092      return DATE;
093    if ("string".equals(codeString))
094      return STRING;
095    if ("token".equals(codeString))
096      return TOKEN;
097    if ("reference".equals(codeString))
098      return REFERENCE;
099    if ("composite".equals(codeString))
100      return COMPOSITE;
101    if ("quantity".equals(codeString))
102      return QUANTITY;
103    if ("uri".equals(codeString))
104      return URI;
105    if ("special".equals(codeString))
106      return SPECIAL;
107    throw new FHIRException("Unknown SearchParamType code '" + codeString + "'");
108  }
109
110  public String toCode() {
111    switch (this) {
112    case NUMBER:
113      return "number";
114    case DATE:
115      return "date";
116    case STRING:
117      return "string";
118    case TOKEN:
119      return "token";
120    case REFERENCE:
121      return "reference";
122    case COMPOSITE:
123      return "composite";
124    case QUANTITY:
125      return "quantity";
126    case URI:
127      return "uri";
128    case SPECIAL:
129      return "special";
130    case NULL:
131      return null;
132    default:
133      return "?";
134    }
135  }
136
137  public String getSystem() {
138    return "http://hl7.org/fhir/search-param-type";
139  }
140
141  public String getDefinition() {
142    switch (this) {
143    case NUMBER:
144      return "Search parameter SHALL be a number (a whole number, or a decimal).";
145    case DATE:
146      return "Search parameter is on a date/time. The date format is the standard XML format, though other formats may be supported.";
147    case STRING:
148      return "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.";
149    case TOKEN:
150      return "Search parameter on a coded element or identifier. May be used to search through the text, display, 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.";
151    case REFERENCE:
152      return "A reference to another resource (Reference or canonical).";
153    case COMPOSITE:
154      return "A composite search parameter that combines a search on two values together.";
155    case QUANTITY:
156      return "A search parameter that searches on a quantity.";
157    case URI:
158      return "A search parameter that searches on a URI (RFC 3986).";
159    case SPECIAL:
160      return "Special logic applies to this parameter per the description of the search parameter.";
161    case NULL:
162      return null;
163    default:
164      return "?";
165    }
166  }
167
168  public String getDisplay() {
169    switch (this) {
170    case NUMBER:
171      return "Number";
172    case DATE:
173      return "Date/DateTime";
174    case STRING:
175      return "String";
176    case TOKEN:
177      return "Token";
178    case REFERENCE:
179      return "Reference";
180    case COMPOSITE:
181      return "Composite";
182    case QUANTITY:
183      return "Quantity";
184    case URI:
185      return "URI";
186    case SPECIAL:
187      return "Special";
188    case NULL:
189      return null;
190    default:
191      return "?";
192    }
193  }
194
195}