001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0 036 037 038import org.hl7.fhir.exceptions.FHIRException; 039 040public enum ItemType { 041 042 /** 043 * An item with no direct answer but which has descendant items that are questions 044 */ 045 GROUP, 046 /** 047 * Text for display that will not capture an answer or have descendants 048 */ 049 DISPLAY, 050 /** 051 * An item that defines a specific answer to be captured (and may have descendant items) 052 */ 053 QUESTION, 054 /** 055 * Question with a yes/no answer 056 */ 057 BOOLEAN, 058 /** 059 * Question with is a real number answer 060 */ 061 DECIMAL, 062 /** 063 * Question with an integer answer 064 */ 065 INTEGER, 066 /** 067 * Question with adate answer 068 */ 069 DATE, 070 /** 071 * Question with a date and time answer 072 */ 073 DATETIME, 074 /** 075 * Question with a system timestamp answer 076 */ 077 INSTANT, 078 /** 079 * Question with a time (hour/minute/second) answer independent of date. 080 */ 081 TIME, 082 /** 083 * Question with a short (few words to short sentence) free-text entry answer 084 */ 085 STRING, 086 /** 087 * Question with a long (potentially multi-paragraph) free-text entry (still captured as a string) answer 088 */ 089 TEXT, 090 /** 091 * Question with a url (website, FTP site, etc.) answer 092 */ 093 URL, 094 /** 095 * Question with a Coding drawn from a list of options as an answer 096 */ 097 CHOICE, 098 /** 099 * Answer is a Coding drawn from a list of options or a free-text entry captured as Coding.display 100 */ 101 OPENCHOICE, 102 /** 103 * Question with binary content such as a image, PDF, etc. as an answer 104 */ 105 ATTACHMENT, 106 /** 107 * Question with a reference to another resource (practitioner, organization, etc.) as an answer 108 */ 109 REFERENCE, 110 /** 111 * Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer. 112 */ 113 QUANTITY, 114 /** 115 * added to help the parsers 116 */ 117 NULL; 118 public static ItemType fromCode(String codeString) throws FHIRException { 119 if (codeString == null || "".equals(codeString)) 120 return null; 121 if ("group".equals(codeString)) 122 return GROUP; 123 if ("display".equals(codeString)) 124 return DISPLAY; 125 if ("question".equals(codeString)) 126 return QUESTION; 127 if ("boolean".equals(codeString)) 128 return BOOLEAN; 129 if ("decimal".equals(codeString)) 130 return DECIMAL; 131 if ("integer".equals(codeString)) 132 return INTEGER; 133 if ("date".equals(codeString)) 134 return DATE; 135 if ("dateTime".equals(codeString)) 136 return DATETIME; 137 if ("instant".equals(codeString)) 138 return INSTANT; 139 if ("time".equals(codeString)) 140 return TIME; 141 if ("string".equals(codeString)) 142 return STRING; 143 if ("text".equals(codeString)) 144 return TEXT; 145 if ("url".equals(codeString)) 146 return URL; 147 if ("choice".equals(codeString)) 148 return CHOICE; 149 if ("open-choice".equals(codeString)) 150 return OPENCHOICE; 151 if ("attachment".equals(codeString)) 152 return ATTACHMENT; 153 if ("reference".equals(codeString)) 154 return REFERENCE; 155 if ("quantity".equals(codeString)) 156 return QUANTITY; 157 throw new FHIRException("Unknown ItemType code '"+codeString+"'"); 158 } 159 public String toCode() { 160 switch (this) { 161 case GROUP: return "group"; 162 case DISPLAY: return "display"; 163 case QUESTION: return "question"; 164 case BOOLEAN: return "boolean"; 165 case DECIMAL: return "decimal"; 166 case INTEGER: return "integer"; 167 case DATE: return "date"; 168 case DATETIME: return "dateTime"; 169 case INSTANT: return "instant"; 170 case TIME: return "time"; 171 case STRING: return "string"; 172 case TEXT: return "text"; 173 case URL: return "url"; 174 case CHOICE: return "choice"; 175 case OPENCHOICE: return "open-choice"; 176 case ATTACHMENT: return "attachment"; 177 case REFERENCE: return "reference"; 178 case QUANTITY: return "quantity"; 179 case NULL: return null; 180 default: return "?"; 181 } 182 } 183 public String getSystem() { 184 return "http://hl7.org/fhir/item-type"; 185 } 186 public String getDefinition() { 187 switch (this) { 188 case GROUP: return "An item with no direct answer but which has descendant items that are questions"; 189 case DISPLAY: return "Text for display that will not capture an answer or have descendants"; 190 case QUESTION: return "An item that defines a specific answer to be captured (and may have descendant items)"; 191 case BOOLEAN: return "Question with a yes/no answer"; 192 case DECIMAL: return "Question with is a real number answer"; 193 case INTEGER: return "Question with an integer answer"; 194 case DATE: return "Question with adate answer"; 195 case DATETIME: return "Question with a date and time answer"; 196 case INSTANT: return "Question with a system timestamp answer"; 197 case TIME: return "Question with a time (hour/minute/second) answer independent of date."; 198 case STRING: return "Question with a short (few words to short sentence) free-text entry answer"; 199 case TEXT: return "Question with a long (potentially multi-paragraph) free-text entry (still captured as a string) answer"; 200 case URL: return "Question with a url (website, FTP site, etc.) answer"; 201 case CHOICE: return "Question with a Coding drawn from a list of options as an answer"; 202 case OPENCHOICE: return "Answer is a Coding drawn from a list of options or a free-text entry captured as Coding.display"; 203 case ATTACHMENT: return "Question with binary content such as a image, PDF, etc. as an answer"; 204 case REFERENCE: return "Question with a reference to another resource (practitioner, organization, etc.) as an answer"; 205 case QUANTITY: return "Question with a combination of a numeric value and unit, potentially with a comparator (<, >, etc.) as an answer."; 206 case NULL: return null; 207 default: return "?"; 208 } 209 } 210 public String getDisplay() { 211 switch (this) { 212 case GROUP: return "Group"; 213 case DISPLAY: return "Display"; 214 case QUESTION: return "Question"; 215 case BOOLEAN: return "Boolean"; 216 case DECIMAL: return "Decimal"; 217 case INTEGER: return "Integer"; 218 case DATE: return "Date"; 219 case DATETIME: return "Date Time"; 220 case INSTANT: return "Instant"; 221 case TIME: return "Time"; 222 case STRING: return "String"; 223 case TEXT: return "Text"; 224 case URL: return "Url"; 225 case CHOICE: return "Choice"; 226 case OPENCHOICE: return "Open Choice"; 227 case ATTACHMENT: return "Attachment"; 228 case REFERENCE: return "Reference"; 229 case QUANTITY: return "Quantity"; 230 case NULL: return null; 231 default: return "?"; 232 } 233 } 234 235 236}