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