001package org.hl7.fhir.r4.model.codesystems;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Sep 13, 2018 09:04-0400 for FHIR v3.5.0
033
034
035import org.hl7.fhir.r4.model.EnumFactory;
036
037public class ResourceStatusEnumFactory implements EnumFactory<ResourceStatus> {
038
039  public ResourceStatus fromCode(String codeString) throws IllegalArgumentException {
040    if (codeString == null || "".equals(codeString))
041      return null;
042    if ("error".equals(codeString))
043      return ResourceStatus.ERROR;
044    if ("proposed".equals(codeString))
045      return ResourceStatus.PROPOSED;
046    if ("planned".equals(codeString))
047      return ResourceStatus.PLANNED;
048    if ("draft".equals(codeString))
049      return ResourceStatus.DRAFT;
050    if ("requested".equals(codeString))
051      return ResourceStatus.REQUESTED;
052    if ("received".equals(codeString))
053      return ResourceStatus.RECEIVED;
054    if ("declined".equals(codeString))
055      return ResourceStatus.DECLINED;
056    if ("accepted".equals(codeString))
057      return ResourceStatus.ACCEPTED;
058    if ("arrived".equals(codeString))
059      return ResourceStatus.ARRIVED;
060    if ("active".equals(codeString))
061      return ResourceStatus.ACTIVE;
062    if ("suspended".equals(codeString))
063      return ResourceStatus.SUSPENDED;
064    if ("failed".equals(codeString))
065      return ResourceStatus.FAILED;
066    if ("replaced".equals(codeString))
067      return ResourceStatus.REPLACED;
068    if ("complete".equals(codeString))
069      return ResourceStatus.COMPLETE;
070    if ("inactive".equals(codeString))
071      return ResourceStatus.INACTIVE;
072    if ("abandoned".equals(codeString))
073      return ResourceStatus.ABANDONED;
074    if ("unknown".equals(codeString))
075      return ResourceStatus.UNKNOWN;
076    if ("unconfirmed".equals(codeString))
077      return ResourceStatus.UNCONFIRMED;
078    if ("confirmed".equals(codeString))
079      return ResourceStatus.CONFIRMED;
080    if ("resolved".equals(codeString))
081      return ResourceStatus.RESOLVED;
082    if ("refuted".equals(codeString))
083      return ResourceStatus.REFUTED;
084    if ("differential".equals(codeString))
085      return ResourceStatus.DIFFERENTIAL;
086    if ("partial".equals(codeString))
087      return ResourceStatus.PARTIAL;
088    if ("busy-unavailable".equals(codeString))
089      return ResourceStatus.BUSYUNAVAILABLE;
090    if ("free".equals(codeString))
091      return ResourceStatus.FREE;
092    if ("on-target".equals(codeString))
093      return ResourceStatus.ONTARGET;
094    if ("ahead-of-target".equals(codeString))
095      return ResourceStatus.AHEADOFTARGET;
096    if ("behind-target".equals(codeString))
097      return ResourceStatus.BEHINDTARGET;
098    if ("not-ready".equals(codeString))
099      return ResourceStatus.NOTREADY;
100    if ("transduc-discon".equals(codeString))
101      return ResourceStatus.TRANSDUCDISCON;
102    if ("hw-discon".equals(codeString))
103      return ResourceStatus.HWDISCON;
104    throw new IllegalArgumentException("Unknown ResourceStatus code '"+codeString+"'");
105  }
106
107  public String toCode(ResourceStatus code) {
108    if (code == ResourceStatus.ERROR)
109      return "error";
110    if (code == ResourceStatus.PROPOSED)
111      return "proposed";
112    if (code == ResourceStatus.PLANNED)
113      return "planned";
114    if (code == ResourceStatus.DRAFT)
115      return "draft";
116    if (code == ResourceStatus.REQUESTED)
117      return "requested";
118    if (code == ResourceStatus.RECEIVED)
119      return "received";
120    if (code == ResourceStatus.DECLINED)
121      return "declined";
122    if (code == ResourceStatus.ACCEPTED)
123      return "accepted";
124    if (code == ResourceStatus.ARRIVED)
125      return "arrived";
126    if (code == ResourceStatus.ACTIVE)
127      return "active";
128    if (code == ResourceStatus.SUSPENDED)
129      return "suspended";
130    if (code == ResourceStatus.FAILED)
131      return "failed";
132    if (code == ResourceStatus.REPLACED)
133      return "replaced";
134    if (code == ResourceStatus.COMPLETE)
135      return "complete";
136    if (code == ResourceStatus.INACTIVE)
137      return "inactive";
138    if (code == ResourceStatus.ABANDONED)
139      return "abandoned";
140    if (code == ResourceStatus.UNKNOWN)
141      return "unknown";
142    if (code == ResourceStatus.UNCONFIRMED)
143      return "unconfirmed";
144    if (code == ResourceStatus.CONFIRMED)
145      return "confirmed";
146    if (code == ResourceStatus.RESOLVED)
147      return "resolved";
148    if (code == ResourceStatus.REFUTED)
149      return "refuted";
150    if (code == ResourceStatus.DIFFERENTIAL)
151      return "differential";
152    if (code == ResourceStatus.PARTIAL)
153      return "partial";
154    if (code == ResourceStatus.BUSYUNAVAILABLE)
155      return "busy-unavailable";
156    if (code == ResourceStatus.FREE)
157      return "free";
158    if (code == ResourceStatus.ONTARGET)
159      return "on-target";
160    if (code == ResourceStatus.AHEADOFTARGET)
161      return "ahead-of-target";
162    if (code == ResourceStatus.BEHINDTARGET)
163      return "behind-target";
164    if (code == ResourceStatus.NOTREADY)
165      return "not-ready";
166    if (code == ResourceStatus.TRANSDUCDISCON)
167      return "transduc-discon";
168    if (code == ResourceStatus.HWDISCON)
169      return "hw-discon";
170    return "?";
171  }
172
173    public String toSystem(ResourceStatus code) {
174      return code.getSystem();
175      }
176
177}
178