001package org.hl7.fhir.r4.model.codesystems; 002 003/*- 004 * #%L 005 * org.hl7.fhir.r4 006 * %% 007 * Copyright (C) 2014 - 2019 Health Level 7 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023 024/* 025 Copyright (c) 2011+, HL7, Inc. 026 All rights reserved. 027 028 Redistribution and use in source and binary forms, with or without modification, 029 are permitted provided that the following conditions are met: 030 031 * Redistributions of source code must retain the above copyright notice, this 032 list of conditions and the following disclaimer. 033 * Redistributions in binary form must reproduce the above copyright notice, 034 this list of conditions and the following disclaimer in the documentation 035 and/or other materials provided with the distribution. 036 * Neither the name of HL7 nor the names of its contributors may be used to 037 endorse or promote products derived from this software without specific 038 prior written permission. 039 040 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 041 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 042 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 043 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 044 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 045 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 046 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 047 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 048 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 049 POSSIBILITY OF SUCH DAMAGE. 050 051*/ 052 053// Generated on Wed, Jan 30, 2019 16:19-0500 for FHIR v4.0.0 054 055 056import org.hl7.fhir.exceptions.FHIRException; 057 058public enum MapTransform { 059 060 /** 061 * create(type : string) - type is passed through to the application on the standard API, and must be known by it. 062 */ 063 CREATE, 064 /** 065 * copy(source). 066 */ 067 COPY, 068 /** 069 * truncate(source, length) - source must be stringy type. 070 */ 071 TRUNCATE, 072 /** 073 * escape(source, fmt1, fmt2) - change source from one kind of escaping to another (plain, java, xml, json). note that this is for when the string itself is escaped. 074 */ 075 ESCAPE, 076 /** 077 * cast(source, type?) - case source from one type to another. target type can be left as implicit if there is one and only one target type known. 078 */ 079 CAST, 080 /** 081 * append(source...) - source is element or string. 082 */ 083 APPEND, 084 /** 085 * translate(source, uri_of_map) - use the translate operation. 086 */ 087 TRANSLATE, 088 /** 089 * reference(source : object) - return a string that references the provided tree properly. 090 */ 091 REFERENCE, 092 /** 093 * Perform a date operation. *Parameters to be documented*. 094 */ 095 DATEOP, 096 /** 097 * Generate a random UUID (in lowercase). No Parameters. 098 */ 099 UUID, 100 /** 101 * Return the appropriate string to put in a reference that refers to the resource provided as a parameter. 102 */ 103 POINTER, 104 /** 105 * Execute the supplied FHIRPath expression and use the value returned by that. 106 */ 107 EVALUATE, 108 /** 109 * Create a CodeableConcept. Parameters = (text) or (system. Code[, display]). 110 */ 111 CC, 112 /** 113 * Create a Coding. Parameters = (system. Code[, display]). 114 */ 115 C, 116 /** 117 * Create a quantity. Parameters = (text) or (value, unit, [system, code]) where text is the natural representation e.g. [comparator]value[space]unit. 118 */ 119 QTY, 120 /** 121 * Create an identifier. Parameters = (system, value[, type]) where type is a code from the identifier type value set. 122 */ 123 ID, 124 /** 125 * Create a contact details. Parameters = (value) or (system, value). If no system is provided, the system should be inferred from the content of the value. 126 */ 127 CP, 128 /** 129 * added to help the parsers 130 */ 131 NULL; 132 public static MapTransform fromCode(String codeString) throws FHIRException { 133 if (codeString == null || "".equals(codeString)) 134 return null; 135 if ("create".equals(codeString)) 136 return CREATE; 137 if ("copy".equals(codeString)) 138 return COPY; 139 if ("truncate".equals(codeString)) 140 return TRUNCATE; 141 if ("escape".equals(codeString)) 142 return ESCAPE; 143 if ("cast".equals(codeString)) 144 return CAST; 145 if ("append".equals(codeString)) 146 return APPEND; 147 if ("translate".equals(codeString)) 148 return TRANSLATE; 149 if ("reference".equals(codeString)) 150 return REFERENCE; 151 if ("dateOp".equals(codeString)) 152 return DATEOP; 153 if ("uuid".equals(codeString)) 154 return UUID; 155 if ("pointer".equals(codeString)) 156 return POINTER; 157 if ("evaluate".equals(codeString)) 158 return EVALUATE; 159 if ("cc".equals(codeString)) 160 return CC; 161 if ("c".equals(codeString)) 162 return C; 163 if ("qty".equals(codeString)) 164 return QTY; 165 if ("id".equals(codeString)) 166 return ID; 167 if ("cp".equals(codeString)) 168 return CP; 169 throw new FHIRException("Unknown MapTransform code '"+codeString+"'"); 170 } 171 public String toCode() { 172 switch (this) { 173 case CREATE: return "create"; 174 case COPY: return "copy"; 175 case TRUNCATE: return "truncate"; 176 case ESCAPE: return "escape"; 177 case CAST: return "cast"; 178 case APPEND: return "append"; 179 case TRANSLATE: return "translate"; 180 case REFERENCE: return "reference"; 181 case DATEOP: return "dateOp"; 182 case UUID: return "uuid"; 183 case POINTER: return "pointer"; 184 case EVALUATE: return "evaluate"; 185 case CC: return "cc"; 186 case C: return "c"; 187 case QTY: return "qty"; 188 case ID: return "id"; 189 case CP: return "cp"; 190 default: return "?"; 191 } 192 } 193 public String getSystem() { 194 return "http://hl7.org/fhir/map-transform"; 195 } 196 public String getDefinition() { 197 switch (this) { 198 case CREATE: return "create(type : string) - type is passed through to the application on the standard API, and must be known by it."; 199 case COPY: return "copy(source)."; 200 case TRUNCATE: return "truncate(source, length) - source must be stringy type."; 201 case ESCAPE: return "escape(source, fmt1, fmt2) - change source from one kind of escaping to another (plain, java, xml, json). note that this is for when the string itself is escaped."; 202 case CAST: return "cast(source, type?) - case source from one type to another. target type can be left as implicit if there is one and only one target type known."; 203 case APPEND: return "append(source...) - source is element or string."; 204 case TRANSLATE: return "translate(source, uri_of_map) - use the translate operation."; 205 case REFERENCE: return "reference(source : object) - return a string that references the provided tree properly."; 206 case DATEOP: return "Perform a date operation. *Parameters to be documented*."; 207 case UUID: return "Generate a random UUID (in lowercase). No Parameters."; 208 case POINTER: return "Return the appropriate string to put in a reference that refers to the resource provided as a parameter."; 209 case EVALUATE: return "Execute the supplied FHIRPath expression and use the value returned by that."; 210 case CC: return "Create a CodeableConcept. Parameters = (text) or (system. Code[, display])."; 211 case C: return "Create a Coding. Parameters = (system. Code[, display])."; 212 case QTY: return "Create a quantity. Parameters = (text) or (value, unit, [system, code]) where text is the natural representation e.g. [comparator]value[space]unit."; 213 case ID: return "Create an identifier. Parameters = (system, value[, type]) where type is a code from the identifier type value set."; 214 case CP: return "Create a contact details. Parameters = (value) or (system, value). If no system is provided, the system should be inferred from the content of the value."; 215 default: return "?"; 216 } 217 } 218 public String getDisplay() { 219 switch (this) { 220 case CREATE: return "create"; 221 case COPY: return "copy"; 222 case TRUNCATE: return "truncate"; 223 case ESCAPE: return "escape"; 224 case CAST: return "cast"; 225 case APPEND: return "append"; 226 case TRANSLATE: return "translate"; 227 case REFERENCE: return "reference"; 228 case DATEOP: return "dateOp"; 229 case UUID: return "uuid"; 230 case POINTER: return "pointer"; 231 case EVALUATE: return "evaluate"; 232 case CC: return "cc"; 233 case C: return "c"; 234 case QTY: return "qty"; 235 case ID: return "id"; 236 case CP: return "cp"; 237 default: return "?"; 238 } 239 } 240 241 242} 243