001package org.hl7.fhir.r5.model.codesystems;
002
003/*
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Oct 17, 2019 09:42+1100 for FHIR v4.1.0
053
054
055import org.hl7.fhir.r5.model.EnumFactory;
056
057public class OperationOutcomeEnumFactory implements EnumFactory<OperationOutcome> {
058
059  public OperationOutcome fromCode(String codeString) throws IllegalArgumentException {
060    if (codeString == null || "".equals(codeString))
061      return null;
062    if ("DELETE_MULTIPLE_MATCHES".equals(codeString))
063      return OperationOutcome.DELETEMULTIPLEMATCHES;
064    if ("MSG_AUTH_REQUIRED".equals(codeString))
065      return OperationOutcome.MSGAUTHREQUIRED;
066    if ("MSG_BAD_FORMAT".equals(codeString))
067      return OperationOutcome.MSGBADFORMAT;
068    if ("MSG_BAD_SYNTAX".equals(codeString))
069      return OperationOutcome.MSGBADSYNTAX;
070    if ("MSG_CANT_PARSE_CONTENT".equals(codeString))
071      return OperationOutcome.MSGCANTPARSECONTENT;
072    if ("MSG_CANT_PARSE_ROOT".equals(codeString))
073      return OperationOutcome.MSGCANTPARSEROOT;
074    if ("MSG_CREATED".equals(codeString))
075      return OperationOutcome.MSGCREATED;
076    if ("MSG_DATE_FORMAT".equals(codeString))
077      return OperationOutcome.MSGDATEFORMAT;
078    if ("MSG_DELETED".equals(codeString))
079      return OperationOutcome.MSGDELETED;
080    if ("MSG_DELETED_DONE".equals(codeString))
081      return OperationOutcome.MSGDELETEDDONE;
082    if ("MSG_DELETED_ID".equals(codeString))
083      return OperationOutcome.MSGDELETEDID;
084    if ("MSG_DUPLICATE_ID".equals(codeString))
085      return OperationOutcome.MSGDUPLICATEID;
086    if ("MSG_ERROR_PARSING".equals(codeString))
087      return OperationOutcome.MSGERRORPARSING;
088    if ("MSG_ID_INVALID".equals(codeString))
089      return OperationOutcome.MSGIDINVALID;
090    if ("MSG_ID_TOO_LONG".equals(codeString))
091      return OperationOutcome.MSGIDTOOLONG;
092    if ("MSG_INVALID_ID".equals(codeString))
093      return OperationOutcome.MSGINVALIDID;
094    if ("MSG_JSON_OBJECT".equals(codeString))
095      return OperationOutcome.MSGJSONOBJECT;
096    if ("MSG_LOCAL_FAIL".equals(codeString))
097      return OperationOutcome.MSGLOCALFAIL;
098    if ("MSG_NO_EXIST".equals(codeString))
099      return OperationOutcome.MSGNOEXIST;
100    if ("MSG_NO_MATCH".equals(codeString))
101      return OperationOutcome.MSGNOMATCH;
102    if ("MSG_NO_MODULE".equals(codeString))
103      return OperationOutcome.MSGNOMODULE;
104    if ("MSG_NO_SUMMARY".equals(codeString))
105      return OperationOutcome.MSGNOSUMMARY;
106    if ("MSG_OP_NOT_ALLOWED".equals(codeString))
107      return OperationOutcome.MSGOPNOTALLOWED;
108    if ("MSG_PARAM_CHAINED".equals(codeString))
109      return OperationOutcome.MSGPARAMCHAINED;
110    if ("MSG_PARAM_INVALID".equals(codeString))
111      return OperationOutcome.MSGPARAMINVALID;
112    if ("MSG_PARAM_MODIFIER_INVALID".equals(codeString))
113      return OperationOutcome.MSGPARAMMODIFIERINVALID;
114    if ("MSG_PARAM_NO_REPEAT".equals(codeString))
115      return OperationOutcome.MSGPARAMNOREPEAT;
116    if ("MSG_PARAM_UNKNOWN".equals(codeString))
117      return OperationOutcome.MSGPARAMUNKNOWN;
118    if ("MSG_RESOURCE_EXAMPLE_PROTECTED".equals(codeString))
119      return OperationOutcome.MSGRESOURCEEXAMPLEPROTECTED;
120    if ("MSG_RESOURCE_ID_FAIL".equals(codeString))
121      return OperationOutcome.MSGRESOURCEIDFAIL;
122    if ("MSG_RESOURCE_ID_MISMATCH".equals(codeString))
123      return OperationOutcome.MSGRESOURCEIDMISMATCH;
124    if ("MSG_RESOURCE_ID_MISSING".equals(codeString))
125      return OperationOutcome.MSGRESOURCEIDMISSING;
126    if ("MSG_RESOURCE_NOT_ALLOWED".equals(codeString))
127      return OperationOutcome.MSGRESOURCENOTALLOWED;
128    if ("MSG_RESOURCE_REQUIRED".equals(codeString))
129      return OperationOutcome.MSGRESOURCEREQUIRED;
130    if ("MSG_RESOURCE_TYPE_MISMATCH".equals(codeString))
131      return OperationOutcome.MSGRESOURCETYPEMISMATCH;
132    if ("MSG_SORT_UNKNOWN".equals(codeString))
133      return OperationOutcome.MSGSORTUNKNOWN;
134    if ("MSG_TRANSACTION_DUPLICATE_ID".equals(codeString))
135      return OperationOutcome.MSGTRANSACTIONDUPLICATEID;
136    if ("MSG_TRANSACTION_MISSING_ID".equals(codeString))
137      return OperationOutcome.MSGTRANSACTIONMISSINGID;
138    if ("MSG_UNHANDLED_NODE_TYPE".equals(codeString))
139      return OperationOutcome.MSGUNHANDLEDNODETYPE;
140    if ("MSG_UNKNOWN_CONTENT".equals(codeString))
141      return OperationOutcome.MSGUNKNOWNCONTENT;
142    if ("MSG_UNKNOWN_OPERATION".equals(codeString))
143      return OperationOutcome.MSGUNKNOWNOPERATION;
144    if ("MSG_UNKNOWN_TYPE".equals(codeString))
145      return OperationOutcome.MSGUNKNOWNTYPE;
146    if ("MSG_UPDATED".equals(codeString))
147      return OperationOutcome.MSGUPDATED;
148    if ("MSG_VERSION_AWARE".equals(codeString))
149      return OperationOutcome.MSGVERSIONAWARE;
150    if ("MSG_VERSION_AWARE_CONFLICT".equals(codeString))
151      return OperationOutcome.MSGVERSIONAWARECONFLICT;
152    if ("MSG_VERSION_AWARE_URL".equals(codeString))
153      return OperationOutcome.MSGVERSIONAWAREURL;
154    if ("MSG_WRONG_NS".equals(codeString))
155      return OperationOutcome.MSGWRONGNS;
156    if ("SEARCH_MULTIPLE".equals(codeString))
157      return OperationOutcome.SEARCHMULTIPLE;
158    if ("SEARCH_NONE".equals(codeString))
159      return OperationOutcome.SEARCHNONE;
160    if ("UPDATE_MULTIPLE_MATCHES".equals(codeString))
161      return OperationOutcome.UPDATEMULTIPLEMATCHES;
162    throw new IllegalArgumentException("Unknown OperationOutcome code '"+codeString+"'");
163  }
164
165  public String toCode(OperationOutcome code) {
166    if (code == OperationOutcome.DELETEMULTIPLEMATCHES)
167      return "DELETE_MULTIPLE_MATCHES";
168    if (code == OperationOutcome.MSGAUTHREQUIRED)
169      return "MSG_AUTH_REQUIRED";
170    if (code == OperationOutcome.MSGBADFORMAT)
171      return "MSG_BAD_FORMAT";
172    if (code == OperationOutcome.MSGBADSYNTAX)
173      return "MSG_BAD_SYNTAX";
174    if (code == OperationOutcome.MSGCANTPARSECONTENT)
175      return "MSG_CANT_PARSE_CONTENT";
176    if (code == OperationOutcome.MSGCANTPARSEROOT)
177      return "MSG_CANT_PARSE_ROOT";
178    if (code == OperationOutcome.MSGCREATED)
179      return "MSG_CREATED";
180    if (code == OperationOutcome.MSGDATEFORMAT)
181      return "MSG_DATE_FORMAT";
182    if (code == OperationOutcome.MSGDELETED)
183      return "MSG_DELETED";
184    if (code == OperationOutcome.MSGDELETEDDONE)
185      return "MSG_DELETED_DONE";
186    if (code == OperationOutcome.MSGDELETEDID)
187      return "MSG_DELETED_ID";
188    if (code == OperationOutcome.MSGDUPLICATEID)
189      return "MSG_DUPLICATE_ID";
190    if (code == OperationOutcome.MSGERRORPARSING)
191      return "MSG_ERROR_PARSING";
192    if (code == OperationOutcome.MSGIDINVALID)
193      return "MSG_ID_INVALID";
194    if (code == OperationOutcome.MSGIDTOOLONG)
195      return "MSG_ID_TOO_LONG";
196    if (code == OperationOutcome.MSGINVALIDID)
197      return "MSG_INVALID_ID";
198    if (code == OperationOutcome.MSGJSONOBJECT)
199      return "MSG_JSON_OBJECT";
200    if (code == OperationOutcome.MSGLOCALFAIL)
201      return "MSG_LOCAL_FAIL";
202    if (code == OperationOutcome.MSGNOEXIST)
203      return "MSG_NO_EXIST";
204    if (code == OperationOutcome.MSGNOMATCH)
205      return "MSG_NO_MATCH";
206    if (code == OperationOutcome.MSGNOMODULE)
207      return "MSG_NO_MODULE";
208    if (code == OperationOutcome.MSGNOSUMMARY)
209      return "MSG_NO_SUMMARY";
210    if (code == OperationOutcome.MSGOPNOTALLOWED)
211      return "MSG_OP_NOT_ALLOWED";
212    if (code == OperationOutcome.MSGPARAMCHAINED)
213      return "MSG_PARAM_CHAINED";
214    if (code == OperationOutcome.MSGPARAMINVALID)
215      return "MSG_PARAM_INVALID";
216    if (code == OperationOutcome.MSGPARAMMODIFIERINVALID)
217      return "MSG_PARAM_MODIFIER_INVALID";
218    if (code == OperationOutcome.MSGPARAMNOREPEAT)
219      return "MSG_PARAM_NO_REPEAT";
220    if (code == OperationOutcome.MSGPARAMUNKNOWN)
221      return "MSG_PARAM_UNKNOWN";
222    if (code == OperationOutcome.MSGRESOURCEEXAMPLEPROTECTED)
223      return "MSG_RESOURCE_EXAMPLE_PROTECTED";
224    if (code == OperationOutcome.MSGRESOURCEIDFAIL)
225      return "MSG_RESOURCE_ID_FAIL";
226    if (code == OperationOutcome.MSGRESOURCEIDMISMATCH)
227      return "MSG_RESOURCE_ID_MISMATCH";
228    if (code == OperationOutcome.MSGRESOURCEIDMISSING)
229      return "MSG_RESOURCE_ID_MISSING";
230    if (code == OperationOutcome.MSGRESOURCENOTALLOWED)
231      return "MSG_RESOURCE_NOT_ALLOWED";
232    if (code == OperationOutcome.MSGRESOURCEREQUIRED)
233      return "MSG_RESOURCE_REQUIRED";
234    if (code == OperationOutcome.MSGRESOURCETYPEMISMATCH)
235      return "MSG_RESOURCE_TYPE_MISMATCH";
236    if (code == OperationOutcome.MSGSORTUNKNOWN)
237      return "MSG_SORT_UNKNOWN";
238    if (code == OperationOutcome.MSGTRANSACTIONDUPLICATEID)
239      return "MSG_TRANSACTION_DUPLICATE_ID";
240    if (code == OperationOutcome.MSGTRANSACTIONMISSINGID)
241      return "MSG_TRANSACTION_MISSING_ID";
242    if (code == OperationOutcome.MSGUNHANDLEDNODETYPE)
243      return "MSG_UNHANDLED_NODE_TYPE";
244    if (code == OperationOutcome.MSGUNKNOWNCONTENT)
245      return "MSG_UNKNOWN_CONTENT";
246    if (code == OperationOutcome.MSGUNKNOWNOPERATION)
247      return "MSG_UNKNOWN_OPERATION";
248    if (code == OperationOutcome.MSGUNKNOWNTYPE)
249      return "MSG_UNKNOWN_TYPE";
250    if (code == OperationOutcome.MSGUPDATED)
251      return "MSG_UPDATED";
252    if (code == OperationOutcome.MSGVERSIONAWARE)
253      return "MSG_VERSION_AWARE";
254    if (code == OperationOutcome.MSGVERSIONAWARECONFLICT)
255      return "MSG_VERSION_AWARE_CONFLICT";
256    if (code == OperationOutcome.MSGVERSIONAWAREURL)
257      return "MSG_VERSION_AWARE_URL";
258    if (code == OperationOutcome.MSGWRONGNS)
259      return "MSG_WRONG_NS";
260    if (code == OperationOutcome.SEARCHMULTIPLE)
261      return "SEARCH_MULTIPLE";
262    if (code == OperationOutcome.SEARCHNONE)
263      return "SEARCH_NONE";
264    if (code == OperationOutcome.UPDATEMULTIPLEMATCHES)
265      return "UPDATE_MULTIPLE_MATCHES";
266    return "?";
267  }
268
269    public String toSystem(OperationOutcome code) {
270      return code.getSystem();
271      }
272
273}
274