001package org.hl7.fhir.r4.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 Wed, Jan 30, 2019 16:19-0500 for FHIR v4.0.0
036
037
038import org.hl7.fhir.r4.model.EnumFactory;
039
040public class ResourceStatusEnumFactory implements EnumFactory<ResourceStatus> {
041
042  public ResourceStatus fromCode(String codeString) throws IllegalArgumentException {
043    if (codeString == null || "".equals(codeString))
044      return null;
045    if ("error".equals(codeString))
046      return ResourceStatus.ERROR;
047    if ("proposed".equals(codeString))
048      return ResourceStatus.PROPOSED;
049    if ("planned".equals(codeString))
050      return ResourceStatus.PLANNED;
051    if ("draft".equals(codeString))
052      return ResourceStatus.DRAFT;
053    if ("requested".equals(codeString))
054      return ResourceStatus.REQUESTED;
055    if ("received".equals(codeString))
056      return ResourceStatus.RECEIVED;
057    if ("declined".equals(codeString))
058      return ResourceStatus.DECLINED;
059    if ("accepted".equals(codeString))
060      return ResourceStatus.ACCEPTED;
061    if ("arrived".equals(codeString))
062      return ResourceStatus.ARRIVED;
063    if ("active".equals(codeString))
064      return ResourceStatus.ACTIVE;
065    if ("suspended".equals(codeString))
066      return ResourceStatus.SUSPENDED;
067    if ("failed".equals(codeString))
068      return ResourceStatus.FAILED;
069    if ("replaced".equals(codeString))
070      return ResourceStatus.REPLACED;
071    if ("complete".equals(codeString))
072      return ResourceStatus.COMPLETE;
073    if ("inactive".equals(codeString))
074      return ResourceStatus.INACTIVE;
075    if ("abandoned".equals(codeString))
076      return ResourceStatus.ABANDONED;
077    if ("unknown".equals(codeString))
078      return ResourceStatus.UNKNOWN;
079    if ("unconfirmed".equals(codeString))
080      return ResourceStatus.UNCONFIRMED;
081    if ("confirmed".equals(codeString))
082      return ResourceStatus.CONFIRMED;
083    if ("resolved".equals(codeString))
084      return ResourceStatus.RESOLVED;
085    if ("refuted".equals(codeString))
086      return ResourceStatus.REFUTED;
087    if ("differential".equals(codeString))
088      return ResourceStatus.DIFFERENTIAL;
089    if ("partial".equals(codeString))
090      return ResourceStatus.PARTIAL;
091    if ("busy-unavailable".equals(codeString))
092      return ResourceStatus.BUSYUNAVAILABLE;
093    if ("free".equals(codeString))
094      return ResourceStatus.FREE;
095    if ("on-target".equals(codeString))
096      return ResourceStatus.ONTARGET;
097    if ("ahead-of-target".equals(codeString))
098      return ResourceStatus.AHEADOFTARGET;
099    if ("behind-target".equals(codeString))
100      return ResourceStatus.BEHINDTARGET;
101    if ("not-ready".equals(codeString))
102      return ResourceStatus.NOTREADY;
103    if ("transduc-discon".equals(codeString))
104      return ResourceStatus.TRANSDUCDISCON;
105    if ("hw-discon".equals(codeString))
106      return ResourceStatus.HWDISCON;
107    throw new IllegalArgumentException("Unknown ResourceStatus code '"+codeString+"'");
108  }
109
110  public String toCode(ResourceStatus code) {
111    if (code == ResourceStatus.ERROR)
112      return "error";
113    if (code == ResourceStatus.PROPOSED)
114      return "proposed";
115    if (code == ResourceStatus.PLANNED)
116      return "planned";
117    if (code == ResourceStatus.DRAFT)
118      return "draft";
119    if (code == ResourceStatus.REQUESTED)
120      return "requested";
121    if (code == ResourceStatus.RECEIVED)
122      return "received";
123    if (code == ResourceStatus.DECLINED)
124      return "declined";
125    if (code == ResourceStatus.ACCEPTED)
126      return "accepted";
127    if (code == ResourceStatus.ARRIVED)
128      return "arrived";
129    if (code == ResourceStatus.ACTIVE)
130      return "active";
131    if (code == ResourceStatus.SUSPENDED)
132      return "suspended";
133    if (code == ResourceStatus.FAILED)
134      return "failed";
135    if (code == ResourceStatus.REPLACED)
136      return "replaced";
137    if (code == ResourceStatus.COMPLETE)
138      return "complete";
139    if (code == ResourceStatus.INACTIVE)
140      return "inactive";
141    if (code == ResourceStatus.ABANDONED)
142      return "abandoned";
143    if (code == ResourceStatus.UNKNOWN)
144      return "unknown";
145    if (code == ResourceStatus.UNCONFIRMED)
146      return "unconfirmed";
147    if (code == ResourceStatus.CONFIRMED)
148      return "confirmed";
149    if (code == ResourceStatus.RESOLVED)
150      return "resolved";
151    if (code == ResourceStatus.REFUTED)
152      return "refuted";
153    if (code == ResourceStatus.DIFFERENTIAL)
154      return "differential";
155    if (code == ResourceStatus.PARTIAL)
156      return "partial";
157    if (code == ResourceStatus.BUSYUNAVAILABLE)
158      return "busy-unavailable";
159    if (code == ResourceStatus.FREE)
160      return "free";
161    if (code == ResourceStatus.ONTARGET)
162      return "on-target";
163    if (code == ResourceStatus.AHEADOFTARGET)
164      return "ahead-of-target";
165    if (code == ResourceStatus.BEHINDTARGET)
166      return "behind-target";
167    if (code == ResourceStatus.NOTREADY)
168      return "not-ready";
169    if (code == ResourceStatus.TRANSDUCDISCON)
170      return "transduc-discon";
171    if (code == ResourceStatus.HWDISCON)
172      return "hw-discon";
173    return "?";
174  }
175
176    public String toSystem(ResourceStatus code) {
177      return code.getSystem();
178      }
179
180}