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 IssueTypeEnumFactory implements EnumFactory<IssueType> {
041
042  public IssueType fromCode(String codeString) throws IllegalArgumentException {
043    if (codeString == null || "".equals(codeString))
044      return null;
045    if ("invalid".equals(codeString))
046      return IssueType.INVALID;
047    if ("structure".equals(codeString))
048      return IssueType.STRUCTURE;
049    if ("required".equals(codeString))
050      return IssueType.REQUIRED;
051    if ("value".equals(codeString))
052      return IssueType.VALUE;
053    if ("invariant".equals(codeString))
054      return IssueType.INVARIANT;
055    if ("security".equals(codeString))
056      return IssueType.SECURITY;
057    if ("login".equals(codeString))
058      return IssueType.LOGIN;
059    if ("unknown".equals(codeString))
060      return IssueType.UNKNOWN;
061    if ("expired".equals(codeString))
062      return IssueType.EXPIRED;
063    if ("forbidden".equals(codeString))
064      return IssueType.FORBIDDEN;
065    if ("suppressed".equals(codeString))
066      return IssueType.SUPPRESSED;
067    if ("processing".equals(codeString))
068      return IssueType.PROCESSING;
069    if ("not-supported".equals(codeString))
070      return IssueType.NOTSUPPORTED;
071    if ("duplicate".equals(codeString))
072      return IssueType.DUPLICATE;
073    if ("not-found".equals(codeString))
074      return IssueType.NOTFOUND;
075    if ("too-long".equals(codeString))
076      return IssueType.TOOLONG;
077    if ("code-invalid".equals(codeString))
078      return IssueType.CODEINVALID;
079    if ("extension".equals(codeString))
080      return IssueType.EXTENSION;
081    if ("too-costly".equals(codeString))
082      return IssueType.TOOCOSTLY;
083    if ("business-rule".equals(codeString))
084      return IssueType.BUSINESSRULE;
085    if ("conflict".equals(codeString))
086      return IssueType.CONFLICT;
087    if ("incomplete".equals(codeString))
088      return IssueType.INCOMPLETE;
089    if ("transient".equals(codeString))
090      return IssueType.TRANSIENT;
091    if ("lock-error".equals(codeString))
092      return IssueType.LOCKERROR;
093    if ("no-store".equals(codeString))
094      return IssueType.NOSTORE;
095    if ("exception".equals(codeString))
096      return IssueType.EXCEPTION;
097    if ("timeout".equals(codeString))
098      return IssueType.TIMEOUT;
099    if ("throttled".equals(codeString))
100      return IssueType.THROTTLED;
101    if ("informational".equals(codeString))
102      return IssueType.INFORMATIONAL;
103    throw new IllegalArgumentException("Unknown IssueType code '"+codeString+"'");
104  }
105
106  public String toCode(IssueType code) {
107       if (code == IssueType.NULL)
108           return null;
109       if (code == IssueType.INVALID)
110      return "invalid";
111    if (code == IssueType.STRUCTURE)
112      return "structure";
113    if (code == IssueType.REQUIRED)
114      return "required";
115    if (code == IssueType.VALUE)
116      return "value";
117    if (code == IssueType.INVARIANT)
118      return "invariant";
119    if (code == IssueType.SECURITY)
120      return "security";
121    if (code == IssueType.LOGIN)
122      return "login";
123    if (code == IssueType.UNKNOWN)
124      return "unknown";
125    if (code == IssueType.EXPIRED)
126      return "expired";
127    if (code == IssueType.FORBIDDEN)
128      return "forbidden";
129    if (code == IssueType.SUPPRESSED)
130      return "suppressed";
131    if (code == IssueType.PROCESSING)
132      return "processing";
133    if (code == IssueType.NOTSUPPORTED)
134      return "not-supported";
135    if (code == IssueType.DUPLICATE)
136      return "duplicate";
137    if (code == IssueType.NOTFOUND)
138      return "not-found";
139    if (code == IssueType.TOOLONG)
140      return "too-long";
141    if (code == IssueType.CODEINVALID)
142      return "code-invalid";
143    if (code == IssueType.EXTENSION)
144      return "extension";
145    if (code == IssueType.TOOCOSTLY)
146      return "too-costly";
147    if (code == IssueType.BUSINESSRULE)
148      return "business-rule";
149    if (code == IssueType.CONFLICT)
150      return "conflict";
151    if (code == IssueType.INCOMPLETE)
152      return "incomplete";
153    if (code == IssueType.TRANSIENT)
154      return "transient";
155    if (code == IssueType.LOCKERROR)
156      return "lock-error";
157    if (code == IssueType.NOSTORE)
158      return "no-store";
159    if (code == IssueType.EXCEPTION)
160      return "exception";
161    if (code == IssueType.TIMEOUT)
162      return "timeout";
163    if (code == IssueType.THROTTLED)
164      return "throttled";
165    if (code == IssueType.INFORMATIONAL)
166      return "informational";
167    return "?";
168   }
169
170    public String toSystem(IssueType code) {
171      return code.getSystem();
172      }
173
174}