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