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