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 V3Charset {
037
038  /**
039   * HL7 is indifferent to the use of this Charset.
040   */
041  EBCDIC,
042  /**
043   * Deprecated for HL7 use.
044   */
045  ISO10646UCS2,
046  /**
047   * Deprecated for HL7 use.
048   */
049  ISO10646UCS4,
050  /**
051   * HL7 is indifferent to the use of this Charset.
052   */
053  ISO88591,
054  /**
055   * HL7 is indifferent to the use of this Charset.
056   */
057  ISO88592,
058  /**
059   * HL7 is indifferent to the use of this Charset.
060   */
061  ISO88595,
062  /**
063   * HL7 is indifferent to the use of this Charset.
064   */
065  JIS2022JP,
066  /**
067   * Required for HL7 use.
068   */
069  USASCII,
070  /**
071   * HL7 is indifferent to the use of this Charset.
072   */
073  UTF7,
074  /**
075   * Required for Unicode support.
076   */
077  UTF8,
078  /**
079   * added to help the parsers
080   */
081  NULL;
082
083  public static V3Charset fromCode(String codeString) throws FHIRException {
084    if (codeString == null || "".equals(codeString))
085      return null;
086    if ("EBCDIC".equals(codeString))
087      return EBCDIC;
088    if ("ISO-10646-UCS-2".equals(codeString))
089      return ISO10646UCS2;
090    if ("ISO-10646-UCS-4".equals(codeString))
091      return ISO10646UCS4;
092    if ("ISO-8859-1".equals(codeString))
093      return ISO88591;
094    if ("ISO-8859-2".equals(codeString))
095      return ISO88592;
096    if ("ISO-8859-5".equals(codeString))
097      return ISO88595;
098    if ("JIS-2022-JP".equals(codeString))
099      return JIS2022JP;
100    if ("US-ASCII".equals(codeString))
101      return USASCII;
102    if ("UTF-7".equals(codeString))
103      return UTF7;
104    if ("UTF-8".equals(codeString))
105      return UTF8;
106    throw new FHIRException("Unknown V3Charset code '" + codeString + "'");
107  }
108
109  public String toCode() {
110    switch (this) {
111    case EBCDIC:
112      return "EBCDIC";
113    case ISO10646UCS2:
114      return "ISO-10646-UCS-2";
115    case ISO10646UCS4:
116      return "ISO-10646-UCS-4";
117    case ISO88591:
118      return "ISO-8859-1";
119    case ISO88592:
120      return "ISO-8859-2";
121    case ISO88595:
122      return "ISO-8859-5";
123    case JIS2022JP:
124      return "JIS-2022-JP";
125    case USASCII:
126      return "US-ASCII";
127    case UTF7:
128      return "UTF-7";
129    case UTF8:
130      return "UTF-8";
131    case NULL:
132      return null;
133    default:
134      return "?";
135    }
136  }
137
138  public String getSystem() {
139    return "http://terminology.hl7.org/CodeSystem/v3-Charset";
140  }
141
142  public String getDefinition() {
143    switch (this) {
144    case EBCDIC:
145      return "HL7 is indifferent to the use of this Charset.";
146    case ISO10646UCS2:
147      return "Deprecated for HL7 use.";
148    case ISO10646UCS4:
149      return "Deprecated for HL7 use.";
150    case ISO88591:
151      return "HL7 is indifferent to the use of this Charset.";
152    case ISO88592:
153      return "HL7 is indifferent to the use of this Charset.";
154    case ISO88595:
155      return "HL7 is indifferent to the use of this Charset.";
156    case JIS2022JP:
157      return "HL7 is indifferent to the use of this Charset.";
158    case USASCII:
159      return "Required for HL7 use.";
160    case UTF7:
161      return "HL7 is indifferent to the use of this Charset.";
162    case UTF8:
163      return "Required for Unicode support.";
164    case NULL:
165      return null;
166    default:
167      return "?";
168    }
169  }
170
171  public String getDisplay() {
172    switch (this) {
173    case EBCDIC:
174      return "EBCDIC";
175    case ISO10646UCS2:
176      return "ISO-10646-UCS-2";
177    case ISO10646UCS4:
178      return "ISO-10646-UCS-4";
179    case ISO88591:
180      return "ISO-8859-1";
181    case ISO88592:
182      return "ISO-8859-2";
183    case ISO88595:
184      return "ISO-8859-5";
185    case JIS2022JP:
186      return "JIS-2022-JP";
187    case USASCII:
188      return "US-ASCII";
189    case UTF7:
190      return "UTF-7";
191    case UTF8:
192      return "UTF-8";
193    case NULL:
194      return null;
195    default:
196      return "?";
197    }
198  }
199
200}