
001package org.hl7.fhir.r5.tools; 002 003// generated 004 005/* 006 Copyright (c) 2011+, HL7, Inc. 007 All rights reserved. 008 009 Redistribution and use in source and binary forms, with or without modification, \ 010 are permitted provided that the following conditions are met: 011 012 * Redistributions of source code must retain the above copyright notice, this \ 013 list of conditions and the following disclaimer. 014 * Redistributions in binary form must reproduce the above copyright notice, \ 015 this list of conditions and the following disclaimer in the documentation \ 016 and/or other materials provided with the distribution. 017 * Neither the name of HL7 nor the names of its contributors may be used to 018 endorse or promote products derived from this software without specific 019 prior written permission. 020 021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 024 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 025 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 026 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 027 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 028 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 029 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 030 POSSIBILITY OF SUCH DAMAGE. 031 */ 032 033// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0 034 035 036 037import java.io.IOException; 038import org.hl7.fhir.exceptions.FHIRFormatError; 039 040import org.hl7.fhir.r5.formats.JsonCreator; 041import org.hl7.fhir.r5.formats.JsonParserBase; 042import org.hl7.fhir.r5.model.*; 043import org.hl7.fhir.utilities.Utilities; 044 045import com.google.gson.JsonArray; 046import com.google.gson.JsonObject; 047 048public class ToolsJsonParser extends org.hl7.fhir.r5.formats.JsonParser { 049 050 public ToolsJsonParser(JsonCreator json) { 051 super(); 052 this.json = json; 053 } 054 055 public ToolsJsonParser(boolean allowUnknownContent, boolean allowComments) { 056 super(); 057 setAllowUnknownContent(allowUnknownContent); 058 setAllowComments(allowComments); 059 } 060 061 public Resource parseResource(JsonObject json) throws IOException, FHIRFormatError { 062 if (!json.has("resourceType")) { 063 throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?"); 064 } 065 String t = json.get("resourceType").getAsString(); 066 if (Utilities.noString(t)) { 067 throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?"); 068 } else if (t.equals("TestCases")) { 069 return parseTestCases(json); 070 071 } else { 072 throw new FHIRFormatError("Unknown/Unrecognised resource type '"+t+"' (in property 'resourceType')"); 073 } 074 } 075 076 protected void parseCDSHookContextProperties(JsonObject json, CDSHookContext res) throws IOException, FHIRFormatError { 077 parseBaseProperties(json, res); 078 } 079 080 protected void parseCDSHooksElementProperties(JsonObject json, CDSHooksElement res) throws IOException, FHIRFormatError { 081 parseBaseProperties(json, res); 082 if (json.has("extension")) 083 res.setExtension(parseCDSHooksExtensions(getJObject(json, "extension"))); 084 } 085 086 protected CDSHookOrderSelectContext parseCDSHookOrderSelectContext(JsonObject json) throws IOException, FHIRFormatError { 087 CDSHookOrderSelectContext res = new CDSHookOrderSelectContext(); 088 parseCDSHookOrderSelectContextProperties(json, res); 089 return res; 090 } 091 092 protected void parseCDSHookOrderSelectContextProperties(JsonObject json, CDSHookOrderSelectContext res) throws IOException, FHIRFormatError { 093 parseCDSHookContextProperties(json, res); 094 if (json.has("userId")) 095 res.setUserIdElement(parseUrl(json.get("userId").getAsString())); 096 if (json.has("_userId")) 097 parseElementProperties(getJObject(json, "_userId"), res.getUserIdElement()); 098 if (json.has("patientId")) 099 res.setPatientIdElement(parseId(json.get("patientId").getAsString())); 100 if (json.has("_patientId")) 101 parseElementProperties(getJObject(json, "_patientId"), res.getPatientIdElement()); 102 if (json.has("encounterId")) 103 res.setEncounterIdElement(parseId(json.get("encounterId").getAsString())); 104 if (json.has("_encounterId")) 105 parseElementProperties(getJObject(json, "_encounterId"), res.getEncounterIdElement()); 106 if (json.has("selections")) { 107 JsonArray array = getJArray(json, "selections"); 108 for (int i = 0; i < array.size(); i++) { 109 if (array.get(i).isJsonNull()) { 110 res.getSelectionsList().add(new UriType()); 111 } else {; 112 res.getSelectionsList().add(parseUri(array.get(i).getAsString())); 113 } 114 } 115 }; 116 if (json.has("_selections")) { 117 JsonArray array = getJArray(json, "_selections"); 118 for (int i = 0; i < array.size(); i++) { 119 if (i == res.getSelectionsList().size()) 120 res.getSelectionsList().add(parseUri(null)); 121 if (array.get(i) instanceof JsonObject) 122 parseElementProperties(array.get(i).getAsJsonObject(), res.getSelectionsList().get(i)); 123 } 124 }; 125 if (json.has("draftOrders")) 126 res.setDraftOrders(parseBundle(getJObject(json, "draftOrders"))); 127 } 128 129 protected CDSHookOrderSignContext parseCDSHookOrderSignContext(JsonObject json) throws IOException, FHIRFormatError { 130 CDSHookOrderSignContext res = new CDSHookOrderSignContext(); 131 parseCDSHookOrderSignContextProperties(json, res); 132 return res; 133 } 134 135 protected void parseCDSHookOrderSignContextProperties(JsonObject json, CDSHookOrderSignContext res) throws IOException, FHIRFormatError { 136 parseCDSHookContextProperties(json, res); 137 if (json.has("userId")) 138 res.setUserIdElement(parseUrl(json.get("userId").getAsString())); 139 if (json.has("_userId")) 140 parseElementProperties(getJObject(json, "_userId"), res.getUserIdElement()); 141 if (json.has("patientId")) 142 res.setPatientIdElement(parseId(json.get("patientId").getAsString())); 143 if (json.has("_patientId")) 144 parseElementProperties(getJObject(json, "_patientId"), res.getPatientIdElement()); 145 if (json.has("encounterId")) 146 res.setEncounterIdElement(parseId(json.get("encounterId").getAsString())); 147 if (json.has("_encounterId")) 148 parseElementProperties(getJObject(json, "_encounterId"), res.getEncounterIdElement()); 149 if (json.has("draftOrders")) 150 res.setDraftOrders(parseBundle(getJObject(json, "draftOrders"))); 151 } 152 153 protected CDSHookPatientViewContext parseCDSHookPatientViewContext(JsonObject json) throws IOException, FHIRFormatError { 154 CDSHookPatientViewContext res = new CDSHookPatientViewContext(); 155 parseCDSHookPatientViewContextProperties(json, res); 156 return res; 157 } 158 159 protected void parseCDSHookPatientViewContextProperties(JsonObject json, CDSHookPatientViewContext res) throws IOException, FHIRFormatError { 160 parseCDSHookContextProperties(json, res); 161 if (json.has("userId")) 162 res.setUserIdElement(parseUrl(json.get("userId").getAsString())); 163 if (json.has("_userId")) 164 parseElementProperties(getJObject(json, "_userId"), res.getUserIdElement()); 165 if (json.has("patientId")) 166 res.setPatientIdElement(parseId(json.get("patientId").getAsString())); 167 if (json.has("_patientId")) 168 parseElementProperties(getJObject(json, "_patientId"), res.getPatientIdElement()); 169 if (json.has("encounterId")) 170 res.setEncounterIdElement(parseId(json.get("encounterId").getAsString())); 171 if (json.has("_encounterId")) 172 parseElementProperties(getJObject(json, "_encounterId"), res.getEncounterIdElement()); 173 } 174 175 protected CDSHooksExtensions parseCDSHooksExtensions(JsonObject json) throws IOException, FHIRFormatError { 176 CDSHooksExtensions res = new CDSHooksExtensions(); 177 parseCDSHooksExtensionsProperties(json, res); 178 return res; 179 } 180 181 protected void parseCDSHooksExtensionsProperties(JsonObject json, CDSHooksExtensions res) throws IOException, FHIRFormatError { 182 parseBaseProperties(json, res); 183 // todo: Named Element Extensions 184 } 185 186 protected CDSHooksRequest parseCDSHooksRequest(JsonObject json) throws IOException, FHIRFormatError { 187 CDSHooksRequest res = new CDSHooksRequest(); 188 parseCDSHooksRequestProperties(json, res); 189 return res; 190 } 191 192 protected void parseCDSHooksRequestProperties(JsonObject json, CDSHooksRequest res) throws IOException, FHIRFormatError { 193 parseCDSHooksElementProperties(json, res); 194 if (json.has("hook")) 195 res.setHookElement(parseCode(json.get("hook").getAsString())); 196 if (json.has("_hook")) 197 parseElementProperties(getJObject(json, "_hook"), res.getHookElement()); 198 if (json.has("hookInstance")) 199 res.setHookInstanceElement(parseUuid(json.get("hookInstance").getAsString())); 200 if (json.has("_hookInstance")) 201 parseElementProperties(getJObject(json, "_hookInstance"), res.getHookInstanceElement()); 202 if (json.has("fhirServer")) 203 res.setFhirServerElement(parseUrl(json.get("fhirServer").getAsString())); 204 if (json.has("_fhirServer")) 205 parseElementProperties(getJObject(json, "_fhirServer"), res.getFhirServerElement()); 206 if (json.has("fhirAuthorization")) 207 res.setFhirAuthorization(parseCDSHooksRequestFhirAuthorizationComponent(getJObject(json, "fhirAuthorization"))); 208 if (json.has("context")) 209 res.setContext(parseCDSHookContext(json, getJObject(json, "context"))); 210 if (json.has("prefetch")) { 211 JsonArray array = getJArray(json, "prefetch"); 212 for (int i = 0; i < array.size(); i++) { 213 res.getPrefetchList().add(parseCDSHooksRequestPrefetchComponent(array.get(i).getAsJsonObject())); 214 } 215 }; 216 } 217 218 protected CDSHookContext parseCDSHookContext(JsonObject resource, JsonObject json) throws IOException, FHIRFormatError { 219 if (resource.get("hook").getAsString().equals("patient-view")) { 220 return parseCDSHookPatientViewContext(json); 221 } 222 if (resource.get("hook").getAsString().equals("order-sign")) { 223 return parseCDSHookOrderSignContext(json); 224 } 225 if (resource.get("hook").getAsString().equals("order-select")) { 226 return parseCDSHookOrderSelectContext(json); 227 } 228 throw new FHIRFormatError("Unable to parse CDSHookContext: The content does not meet any of the type specifiers"); 229 } 230 231 protected CDSHooksRequest.CDSHooksRequestFhirAuthorizationComponent parseCDSHooksRequestFhirAuthorizationComponent(JsonObject json) throws IOException, FHIRFormatError { 232 CDSHooksRequest.CDSHooksRequestFhirAuthorizationComponent res = new CDSHooksRequest.CDSHooksRequestFhirAuthorizationComponent(); 233 parseCDSHooksRequestFhirAuthorizationComponentProperties(json, res); 234 return res; 235 } 236 237 protected void parseCDSHooksRequestFhirAuthorizationComponentProperties(JsonObject json, CDSHooksRequest.CDSHooksRequestFhirAuthorizationComponent res) throws IOException, FHIRFormatError { 238 parsehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(json, res); 239 if (json.has("accessToken")) 240 res.setAccessTokenElement(parseString(json.get("accessToken").getAsString())); 241 if (json.has("_accessToken")) 242 parseElementProperties(getJObject(json, "_accessToken"), res.getAccessTokenElement()); 243 if (json.has("tokenType")) 244 res.setTokenTypeElement(parseCode(json.get("tokenType").getAsString())); 245 if (json.has("_tokenType")) 246 parseElementProperties(getJObject(json, "_tokenType"), res.getTokenTypeElement()); 247 if (json.has("expiresIn")) 248 res.setExpiresInElement(parseInteger(json.get("expiresIn").getAsLong())); 249 if (json.has("_expiresIn")) 250 parseElementProperties(getJObject(json, "_expiresIn"), res.getExpiresInElement()); 251 if (json.has("scope")) 252 res.setScopeElement(parseString(json.get("scope").getAsString())); 253 if (json.has("_scope")) 254 parseElementProperties(getJObject(json, "_scope"), res.getScopeElement()); 255 if (json.has("subject")) 256 res.setSubjectElement(parseString(json.get("subject").getAsString())); 257 if (json.has("_subject")) 258 parseElementProperties(getJObject(json, "_subject"), res.getSubjectElement()); 259 if (json.has("patient")) 260 res.setPatientElement(parseId(json.get("patient").getAsString())); 261 if (json.has("_patient")) 262 parseElementProperties(getJObject(json, "_patient"), res.getPatientElement()); 263 } 264 265 protected CDSHooksRequest.CDSHooksRequestPrefetchComponent parseCDSHooksRequestPrefetchComponent(JsonObject json) throws IOException, FHIRFormatError { 266 CDSHooksRequest.CDSHooksRequestPrefetchComponent res = new CDSHooksRequest.CDSHooksRequestPrefetchComponent(); 267 parseCDSHooksRequestPrefetchComponentProperties(json, res); 268 return res; 269 } 270 271 protected void parseCDSHooksRequestPrefetchComponentProperties(JsonObject json, CDSHooksRequest.CDSHooksRequestPrefetchComponent res) throws IOException, FHIRFormatError { 272 parseBaseProperties(json, res); 273 if (json.has("key")) 274 res.setKeyElement(parseCode(json.get("key").getAsString())); 275 if (json.has("_key")) 276 parseElementProperties(getJObject(json, "_key"), res.getKeyElement()); 277 if (json.has("value")) 278 res.setValue(parseResource(getJObject(json, "value"))); 279 } 280 281 protected CDSHooksResponse parseCDSHooksResponse(JsonObject json) throws IOException, FHIRFormatError { 282 CDSHooksResponse res = new CDSHooksResponse(); 283 parseCDSHooksResponseProperties(json, res); 284 return res; 285 } 286 287 protected void parseCDSHooksResponseProperties(JsonObject json, CDSHooksResponse res) throws IOException, FHIRFormatError { 288 parseCDSHooksElementProperties(json, res); 289 if (json.has("cards")) { 290 JsonArray array = getJArray(json, "cards"); 291 for (int i = 0; i < array.size(); i++) { 292 res.getCardsList().add(parseCDSHooksResponseCardsComponent(array.get(i).getAsJsonObject())); 293 } 294 }; 295 if (json.has("systemActions")) { 296 JsonArray array = getJArray(json, "systemActions"); 297 for (int i = 0; i < array.size(); i++) { 298 res.getSystemActionsList().add(parseCDSHooksResponseCardsSuggestionsActionsComponent(array.get(i).getAsJsonObject())); 299 } 300 }; 301 } 302 303 protected CDSHooksResponse.CDSHooksResponseCardsComponent parseCDSHooksResponseCardsComponent(JsonObject json) throws IOException, FHIRFormatError { 304 CDSHooksResponse.CDSHooksResponseCardsComponent res = new CDSHooksResponse.CDSHooksResponseCardsComponent(); 305 parseCDSHooksResponseCardsComponentProperties(json, res); 306 return res; 307 } 308 309 protected void parseCDSHooksResponseCardsComponentProperties(JsonObject json, CDSHooksResponse.CDSHooksResponseCardsComponent res) throws IOException, FHIRFormatError { 310 parsehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(json, res); 311 if (json.has("uuid")) 312 res.setUuidElement(parseUuid(json.get("uuid").getAsString())); 313 if (json.has("_uuid")) 314 parseElementProperties(getJObject(json, "_uuid"), res.getUuidElement()); 315 if (json.has("summary")) 316 res.setSummaryElement(parseString(json.get("summary").getAsString())); 317 if (json.has("_summary")) 318 parseElementProperties(getJObject(json, "_summary"), res.getSummaryElement()); 319 if (json.has("detail")) 320 res.setDetailElement(parseMarkdown(json.get("detail").getAsString())); 321 if (json.has("_detail")) 322 parseElementProperties(getJObject(json, "_detail"), res.getDetailElement()); 323 if (json.has("indicator")) 324 res.setIndicatorElement(parseEnumeration(json.get("indicator").getAsString(), CDSHooksResponse.CDSIndicatorCodesVS.NULL, new CDSHooksResponse.CDSIndicatorCodesVSEnumFactory())); 325 if (json.has("_indicator")) 326 parseElementProperties(getJObject(json, "_indicator"), res.getIndicatorElement()); 327 if (json.has("source")) 328 res.setSource(parseCDSHooksResponseCardsSourceComponent(getJObject(json, "source"))); 329 if (json.has("suggestions")) { 330 JsonArray array = getJArray(json, "suggestions"); 331 for (int i = 0; i < array.size(); i++) { 332 res.getSuggestionsList().add(parseCDSHooksResponseCardsSuggestionsComponent(array.get(i).getAsJsonObject())); 333 } 334 }; 335 if (json.has("selectionBehavior")) 336 res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), CDSHooksResponse.CDSSelectionBehaviorCodesVS.NULL, new CDSHooksResponse.CDSSelectionBehaviorCodesVSEnumFactory())); 337 if (json.has("_selectionBehavior")) 338 parseElementProperties(getJObject(json, "_selectionBehavior"), res.getSelectionBehaviorElement()); 339 if (json.has("overrideReasons")) { 340 JsonArray array = getJArray(json, "overrideReasons"); 341 for (int i = 0; i < array.size(); i++) { 342 res.getOverrideReasonsList().add(parseCoding(array.get(i).getAsJsonObject())); 343 } 344 }; 345 if (json.has("links")) { 346 JsonArray array = getJArray(json, "links"); 347 for (int i = 0; i < array.size(); i++) { 348 res.getLinksList().add(parseCDSHooksResponseCardsLinksComponent(array.get(i).getAsJsonObject())); 349 } 350 }; 351 } 352 353 protected CDSHooksResponse.CDSHooksResponseCardsSourceComponent parseCDSHooksResponseCardsSourceComponent(JsonObject json) throws IOException, FHIRFormatError { 354 CDSHooksResponse.CDSHooksResponseCardsSourceComponent res = new CDSHooksResponse.CDSHooksResponseCardsSourceComponent(); 355 parseCDSHooksResponseCardsSourceComponentProperties(json, res); 356 return res; 357 } 358 359 protected void parseCDSHooksResponseCardsSourceComponentProperties(JsonObject json, CDSHooksResponse.CDSHooksResponseCardsSourceComponent res) throws IOException, FHIRFormatError { 360 parsehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(json, res); 361 if (json.has("label")) 362 res.setLabelElement(parseString(json.get("label").getAsString())); 363 if (json.has("_label")) 364 parseElementProperties(getJObject(json, "_label"), res.getLabelElement()); 365 if (json.has("url")) 366 res.setUrlElement(parseUrl(json.get("url").getAsString())); 367 if (json.has("_url")) 368 parseElementProperties(getJObject(json, "_url"), res.getUrlElement()); 369 if (json.has("icon")) 370 res.setIconElement(parseUrl(json.get("icon").getAsString())); 371 if (json.has("_icon")) 372 parseElementProperties(getJObject(json, "_icon"), res.getIconElement()); 373 if (json.has("topic")) 374 res.setTopic(parseCoding(getJObject(json, "topic"))); 375 } 376 377 protected CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent parseCDSHooksResponseCardsSuggestionsComponent(JsonObject json) throws IOException, FHIRFormatError { 378 CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent res = new CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent(); 379 parseCDSHooksResponseCardsSuggestionsComponentProperties(json, res); 380 return res; 381 } 382 383 protected void parseCDSHooksResponseCardsSuggestionsComponentProperties(JsonObject json, CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent res) throws IOException, FHIRFormatError { 384 parsehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(json, res); 385 if (json.has("label")) 386 res.setLabelElement(parseString(json.get("label").getAsString())); 387 if (json.has("_label")) 388 parseElementProperties(getJObject(json, "_label"), res.getLabelElement()); 389 if (json.has("uuid")) 390 res.setUuidElement(parseUuid(json.get("uuid").getAsString())); 391 if (json.has("_uuid")) 392 parseElementProperties(getJObject(json, "_uuid"), res.getUuidElement()); 393 if (json.has("isRecommended")) 394 res.setIsRecommendedElement(parseBoolean(json.get("isRecommended").getAsBoolean())); 395 if (json.has("_isRecommended")) 396 parseElementProperties(getJObject(json, "_isRecommended"), res.getIsRecommendedElement()); 397 if (json.has("actions")) { 398 JsonArray array = getJArray(json, "actions"); 399 for (int i = 0; i < array.size(); i++) { 400 res.getActionsList().add(parseCDSHooksResponseCardsSuggestionsActionsComponent(array.get(i).getAsJsonObject())); 401 } 402 }; 403 } 404 405 protected CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent parseCDSHooksResponseCardsSuggestionsActionsComponent(JsonObject json) throws IOException, FHIRFormatError { 406 CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent res = new CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent(); 407 parseCDSHooksResponseCardsSuggestionsActionsComponentProperties(json, res); 408 return res; 409 } 410 411 protected void parseCDSHooksResponseCardsSuggestionsActionsComponentProperties(JsonObject json, CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent res) throws IOException, FHIRFormatError { 412 parsehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(json, res); 413 if (json.has("type")) 414 res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CDSHooksResponse.CDSActionTypeCodesVS.NULL, new CDSHooksResponse.CDSActionTypeCodesVSEnumFactory())); 415 if (json.has("_type")) 416 parseElementProperties(getJObject(json, "_type"), res.getTypeElement()); 417 if (json.has("description")) 418 res.setDescriptionElement(parseString(json.get("description").getAsString())); 419 if (json.has("_description")) 420 parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement()); 421 if (json.has("resource")) 422 res.setResource(parseResource(getJObject(json, "resource"))); 423 if (json.has("resourceId")) 424 res.setResourceIdElement(parseUrl(json.get("resourceId").getAsString())); 425 if (json.has("_resourceId")) 426 parseElementProperties(getJObject(json, "_resourceId"), res.getResourceIdElement()); 427 } 428 429 protected CDSHooksResponse.CDSHooksResponseCardsLinksComponent parseCDSHooksResponseCardsLinksComponent(JsonObject json) throws IOException, FHIRFormatError { 430 CDSHooksResponse.CDSHooksResponseCardsLinksComponent res = new CDSHooksResponse.CDSHooksResponseCardsLinksComponent(); 431 parseCDSHooksResponseCardsLinksComponentProperties(json, res); 432 return res; 433 } 434 435 protected void parseCDSHooksResponseCardsLinksComponentProperties(JsonObject json, CDSHooksResponse.CDSHooksResponseCardsLinksComponent res) throws IOException, FHIRFormatError { 436 parsehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(json, res); 437 if (json.has("label")) 438 res.setLabelElement(parseString(json.get("label").getAsString())); 439 if (json.has("_label")) 440 parseElementProperties(getJObject(json, "_label"), res.getLabelElement()); 441 if (json.has("url")) 442 res.setUrlElement(parseUrl(json.get("url").getAsString())); 443 if (json.has("_url")) 444 parseElementProperties(getJObject(json, "_url"), res.getUrlElement()); 445 if (json.has("type")) 446 res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CDSHooksResponse.CDSLinkTypeCodesVS.NULL, new CDSHooksResponse.CDSLinkTypeCodesVSEnumFactory())); 447 if (json.has("_type")) 448 parseElementProperties(getJObject(json, "_type"), res.getTypeElement()); 449 if (json.has("appContext")) 450 res.setAppContextElement(parseString(json.get("appContext").getAsString())); 451 if (json.has("_appContext")) 452 parseElementProperties(getJObject(json, "_appContext"), res.getAppContextElement()); 453 } 454 455 protected CDSHooksServices parseCDSHooksServices(JsonObject json) throws IOException, FHIRFormatError { 456 CDSHooksServices res = new CDSHooksServices(); 457 parseCDSHooksServicesProperties(json, res); 458 return res; 459 } 460 461 protected void parseCDSHooksServicesProperties(JsonObject json, CDSHooksServices res) throws IOException, FHIRFormatError { 462 parseCDSHooksElementProperties(json, res); 463 if (json.has("services")) { 464 JsonArray array = getJArray(json, "services"); 465 for (int i = 0; i < array.size(); i++) { 466 res.getServicesList().add(parseCDSHooksServicesServicesComponent(array.get(i).getAsJsonObject())); 467 } 468 }; 469 } 470 471 protected CDSHooksServices.CDSHooksServicesServicesComponent parseCDSHooksServicesServicesComponent(JsonObject json) throws IOException, FHIRFormatError { 472 CDSHooksServices.CDSHooksServicesServicesComponent res = new CDSHooksServices.CDSHooksServicesServicesComponent(); 473 parseCDSHooksServicesServicesComponentProperties(json, res); 474 return res; 475 } 476 477 protected void parseCDSHooksServicesServicesComponentProperties(JsonObject json, CDSHooksServices.CDSHooksServicesServicesComponent res) throws IOException, FHIRFormatError { 478 parsehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(json, res); 479 if (json.has("hook")) 480 res.setHookElement(parseString(json.get("hook").getAsString())); 481 if (json.has("_hook")) 482 parseElementProperties(getJObject(json, "_hook"), res.getHookElement()); 483 if (json.has("title")) 484 res.setTitleElement(parseString(json.get("title").getAsString())); 485 if (json.has("_title")) 486 parseElementProperties(getJObject(json, "_title"), res.getTitleElement()); 487 if (json.has("id")) 488 res.setIdElement(parseCode(json.get("id").getAsString())); 489 if (json.has("_id")) 490 parseElementProperties(getJObject(json, "_id"), res.getIdElement()); 491 if (json.has("description")) 492 res.setDescriptionElement(parseString(json.get("description").getAsString())); 493 if (json.has("_description")) 494 parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement()); 495 if (json.has("usageRequirements")) 496 res.setUsageRequirementsElement(parseString(json.get("usageRequirements").getAsString())); 497 if (json.has("_usageRequirements")) 498 parseElementProperties(getJObject(json, "_usageRequirements"), res.getUsageRequirementsElement()); 499 if (json.has("prefetch")) { 500 JsonArray array = getJArray(json, "prefetch"); 501 for (int i = 0; i < array.size(); i++) { 502 res.getPrefetchList().add(parseCDSHooksServicesServicesPrefetchComponent(array.get(i).getAsJsonObject())); 503 } 504 }; 505 } 506 507 protected CDSHooksServices.CDSHooksServicesServicesPrefetchComponent parseCDSHooksServicesServicesPrefetchComponent(JsonObject json) throws IOException, FHIRFormatError { 508 CDSHooksServices.CDSHooksServicesServicesPrefetchComponent res = new CDSHooksServices.CDSHooksServicesServicesPrefetchComponent(); 509 parseCDSHooksServicesServicesPrefetchComponentProperties(json, res); 510 return res; 511 } 512 513 protected void parseCDSHooksServicesServicesPrefetchComponentProperties(JsonObject json, CDSHooksServices.CDSHooksServicesServicesPrefetchComponent res) throws IOException, FHIRFormatError { 514 parseBaseProperties(json, res); 515 if (json.has("key")) 516 res.setKeyElement(parseCode(json.get("key").getAsString())); 517 if (json.has("_key")) 518 parseElementProperties(getJObject(json, "_key"), res.getKeyElement()); 519 if (json.has("value")) 520 res.setValueElement(parseString(json.get("value").getAsString())); 521 if (json.has("_value")) 522 parseElementProperties(getJObject(json, "_value"), res.getValueElement()); 523 } 524 525 protected TestCases parseTestCases(JsonObject json) throws IOException, FHIRFormatError { 526 TestCases res = new TestCases(); 527 parseTestCasesProperties(json, res); 528 return res; 529 } 530 531 protected void parseTestCasesProperties(JsonObject json, TestCases res) throws IOException, FHIRFormatError { 532 parseResourceProperties(json, res); 533 if (json.has("url")) 534 res.setUrlElement(parseUri(json.get("url").getAsString())); 535 if (json.has("_url")) 536 parseElementProperties(getJObject(json, "_url"), res.getUrlElement()); 537 if (json.has("version")) 538 res.setVersionElement(parseString(json.get("version").getAsString())); 539 if (json.has("_version")) 540 parseElementProperties(getJObject(json, "_version"), res.getVersionElement()); 541 if (json.has("name")) 542 res.setNameElement(parseString(json.get("name").getAsString())); 543 if (json.has("_name")) 544 parseElementProperties(getJObject(json, "_name"), res.getNameElement()); 545 if (json.has("description")) 546 res.setDescriptionElement(parseMarkdown(json.get("description").getAsString())); 547 if (json.has("_description")) 548 parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement()); 549 if (json.has("runner")) 550 res.setRunnerElement(parseUrl(json.get("runner").getAsString())); 551 if (json.has("_runner")) 552 parseElementProperties(getJObject(json, "_runner"), res.getRunnerElement()); 553 if (json.has("mode")) { 554 JsonArray array = getJArray(json, "mode"); 555 for (int i = 0; i < array.size(); i++) { 556 res.getModeList().add(parseTestCasesModeComponent(array.get(i).getAsJsonObject())); 557 } 558 }; 559 if (json.has("suite")) { 560 JsonArray array = getJArray(json, "suite"); 561 for (int i = 0; i < array.size(); i++) { 562 res.getSuiteList().add(parseTestCasesSuiteComponent(array.get(i).getAsJsonObject())); 563 } 564 }; 565 } 566 567 protected TestCases.TestCasesModeComponent parseTestCasesModeComponent(JsonObject json) throws IOException, FHIRFormatError { 568 TestCases.TestCasesModeComponent res = new TestCases.TestCasesModeComponent(); 569 parseTestCasesModeComponentProperties(json, res); 570 return res; 571 } 572 573 protected void parseTestCasesModeComponentProperties(JsonObject json, TestCases.TestCasesModeComponent res) throws IOException, FHIRFormatError { 574 parseBaseProperties(json, res); 575 if (json.has("code")) 576 res.setCodeElement(parseString(json.get("code").getAsString())); 577 if (json.has("_code")) 578 parseElementProperties(getJObject(json, "_code"), res.getCodeElement()); 579 if (json.has("description")) 580 res.setDescriptionElement(parseString(json.get("description").getAsString())); 581 if (json.has("_description")) 582 parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement()); 583 } 584 585 protected TestCases.TestCasesSuiteComponent parseTestCasesSuiteComponent(JsonObject json) throws IOException, FHIRFormatError { 586 TestCases.TestCasesSuiteComponent res = new TestCases.TestCasesSuiteComponent(); 587 parseTestCasesSuiteComponentProperties(json, res); 588 return res; 589 } 590 591 protected void parseTestCasesSuiteComponentProperties(JsonObject json, TestCases.TestCasesSuiteComponent res) throws IOException, FHIRFormatError { 592 parseBaseProperties(json, res); 593 if (json.has("name")) 594 res.setNameElement(parseString(json.get("name").getAsString())); 595 if (json.has("_name")) 596 parseElementProperties(getJObject(json, "_name"), res.getNameElement()); 597 if (json.has("description")) 598 res.setDescriptionElement(parseString(json.get("description").getAsString())); 599 if (json.has("_description")) 600 parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement()); 601 if (json.has("mode")) 602 res.setModeElement(parseCode(json.get("mode").getAsString())); 603 if (json.has("_mode")) 604 parseElementProperties(getJObject(json, "_mode"), res.getModeElement()); 605 if (json.has("resource")) { 606 JsonArray array = getJArray(json, "resource"); 607 for (int i = 0; i < array.size(); i++) { 608 res.getResourceList().add(parseTestCasesSuiteResourceComponent(array.get(i).getAsJsonObject())); 609 } 610 }; 611 if (json.has("parameter")) { 612 JsonArray array = getJArray(json, "parameter"); 613 for (int i = 0; i < array.size(); i++) { 614 res.getParameterList().add(parseTestCasesSuiteParameterComponent(array.get(i).getAsJsonObject())); 615 } 616 }; 617 if (json.has("test")) { 618 JsonArray array = getJArray(json, "test"); 619 for (int i = 0; i < array.size(); i++) { 620 res.getTestList().add(parseTestCasesSuiteTestComponent(array.get(i).getAsJsonObject())); 621 } 622 }; 623 } 624 625 protected TestCases.TestCasesSuiteResourceComponent parseTestCasesSuiteResourceComponent(JsonObject json) throws IOException, FHIRFormatError { 626 TestCases.TestCasesSuiteResourceComponent res = new TestCases.TestCasesSuiteResourceComponent(); 627 parseTestCasesSuiteResourceComponentProperties(json, res); 628 return res; 629 } 630 631 protected void parseTestCasesSuiteResourceComponentProperties(JsonObject json, TestCases.TestCasesSuiteResourceComponent res) throws IOException, FHIRFormatError { 632 parseBaseProperties(json, res); 633 if (json.has("name")) 634 res.setNameElement(parseString(json.get("name").getAsString())); 635 if (json.has("_name")) 636 parseElementProperties(getJObject(json, "_name"), res.getNameElement()); 637 if (json.has("file")) 638 res.setFileElement(parseString(json.get("file").getAsString())); 639 if (json.has("_file")) 640 parseElementProperties(getJObject(json, "_file"), res.getFileElement()); 641 if (json.has("resource")) 642 res.setResource(parseResource(getJObject(json, "resource"))); 643 if (json.has("mode")) 644 res.setModeElement(parseCode(json.get("mode").getAsString())); 645 if (json.has("_mode")) 646 parseElementProperties(getJObject(json, "_mode"), res.getModeElement()); 647 } 648 649 protected TestCases.TestCasesSuiteParameterComponent parseTestCasesSuiteParameterComponent(JsonObject json) throws IOException, FHIRFormatError { 650 TestCases.TestCasesSuiteParameterComponent res = new TestCases.TestCasesSuiteParameterComponent(); 651 parseTestCasesSuiteParameterComponentProperties(json, res); 652 return res; 653 } 654 655 protected void parseTestCasesSuiteParameterComponentProperties(JsonObject json, TestCases.TestCasesSuiteParameterComponent res) throws IOException, FHIRFormatError { 656 parseBaseProperties(json, res); 657 if (json.has("name")) 658 res.setNameElement(parseString(json.get("name").getAsString())); 659 if (json.has("_name")) 660 parseElementProperties(getJObject(json, "_name"), res.getNameElement()); 661 DataType value = parseType("value", json); 662 if (value != null) 663 res.setValue(value); 664 if (json.has("mode")) 665 res.setModeElement(parseCode(json.get("mode").getAsString())); 666 if (json.has("_mode")) 667 parseElementProperties(getJObject(json, "_mode"), res.getModeElement()); 668 } 669 670 protected TestCases.TestCasesSuiteTestComponent parseTestCasesSuiteTestComponent(JsonObject json) throws IOException, FHIRFormatError { 671 TestCases.TestCasesSuiteTestComponent res = new TestCases.TestCasesSuiteTestComponent(); 672 parseTestCasesSuiteTestComponentProperties(json, res); 673 return res; 674 } 675 676 protected void parseTestCasesSuiteTestComponentProperties(JsonObject json, TestCases.TestCasesSuiteTestComponent res) throws IOException, FHIRFormatError { 677 parseBaseProperties(json, res); 678 if (json.has("name")) 679 res.setNameElement(parseString(json.get("name").getAsString())); 680 if (json.has("_name")) 681 parseElementProperties(getJObject(json, "_name"), res.getNameElement()); 682 if (json.has("description")) 683 res.setDescriptionElement(parseString(json.get("description").getAsString())); 684 if (json.has("_description")) 685 parseElementProperties(getJObject(json, "_description"), res.getDescriptionElement()); 686 if (json.has("operation")) 687 res.setOperationElement(parseCode(json.get("operation").getAsString())); 688 if (json.has("_operation")) 689 parseElementProperties(getJObject(json, "_operation"), res.getOperationElement()); 690 if (json.has("mode")) 691 res.setModeElement(parseString(json.get("mode").getAsString())); 692 if (json.has("_mode")) 693 parseElementProperties(getJObject(json, "_mode"), res.getModeElement()); 694 if (json.has("parameter")) { 695 JsonArray array = getJArray(json, "parameter"); 696 for (int i = 0; i < array.size(); i++) { 697 res.getParameterList().add(parseTestCasesSuiteParameterComponent(array.get(i).getAsJsonObject())); 698 } 699 }; 700 if (json.has("input")) { 701 JsonArray array = getJArray(json, "input"); 702 for (int i = 0; i < array.size(); i++) { 703 res.getInputList().add(parseTestCasesSuiteResourceComponent(array.get(i).getAsJsonObject())); 704 } 705 }; 706 if (json.has("output")) { 707 JsonArray array = getJArray(json, "output"); 708 for (int i = 0; i < array.size(); i++) { 709 res.getOutputList().add(parseTestCasesSuiteResourceComponent(array.get(i).getAsJsonObject())); 710 } 711 }; 712 } 713 714 715 716 717// -- compose --------------------------------------------------------------------------------------------------------------------- 718 719 720 protected void composeCDSHookContextProperties(CDSHookContext element) throws IOException { 721 composeBaseProperties(element); 722 } 723 724 protected void composeCDSHooksElementProperties(CDSHooksElement element) throws IOException { 725 composeBaseProperties(element); 726 if (element.hasExtension()) { 727 composeCDSHooksExtensions("extension", element.getExtension()); 728 } 729 } 730 731 protected void composeCDSHookOrderSelectContext(String name, CDSHookOrderSelectContext element) throws IOException { 732 if (element != null) { 733 open(name); 734 composeCDSHookOrderSelectContextProperties(element); 735 close(); 736 } 737 } 738 739 protected void composeCDSHookOrderSelectContextProperties(CDSHookOrderSelectContext element) throws IOException { 740 composeCDSHookContextProperties(element); 741 if (element.hasUserIdElement()) { 742 composeUrlCore("userId", element.getUserIdElement(), false); 743 composeUrlExtras("userId", element.getUserIdElement(), false); 744 } 745 if (element.hasPatientIdElement()) { 746 composeIdCore("patientId", element.getPatientIdElement(), false); 747 composeIdExtras("patientId", element.getPatientIdElement(), false); 748 } 749 if (element.hasEncounterIdElement()) { 750 composeIdCore("encounterId", element.getEncounterIdElement(), false); 751 composeIdExtras("encounterId", element.getEncounterIdElement(), false); 752 } 753 if (element.hasSelections()) { 754 if (anyHasValue(element.getSelectionsList())) { 755 openArray("selections"); 756 for (UriType e : element.getSelectionsList()) 757 composeUriCore(null, e, e != element.getSelectionsList().get(element.getSelectionsList().size()-1)); 758 closeArray(); 759 } 760 if (anyHasExtras(element.getSelectionsList())) { 761 openArray("_selections"); 762 for (UriType e : element.getSelectionsList()) 763 composeUriExtras(null, e, true); 764 closeArray(); 765 } 766 }; 767 if (element.hasDraftOrders()) { 768 composeBundle("draftOrders", element.getDraftOrders()); 769 } 770 } 771 772 protected void composeCDSHookOrderSignContext(String name, CDSHookOrderSignContext element) throws IOException { 773 if (element != null) { 774 open(name); 775 composeCDSHookOrderSignContextProperties(element); 776 close(); 777 } 778 } 779 780 protected void composeCDSHookOrderSignContextProperties(CDSHookOrderSignContext element) throws IOException { 781 composeCDSHookContextProperties(element); 782 if (element.hasUserIdElement()) { 783 composeUrlCore("userId", element.getUserIdElement(), false); 784 composeUrlExtras("userId", element.getUserIdElement(), false); 785 } 786 if (element.hasPatientIdElement()) { 787 composeIdCore("patientId", element.getPatientIdElement(), false); 788 composeIdExtras("patientId", element.getPatientIdElement(), false); 789 } 790 if (element.hasEncounterIdElement()) { 791 composeIdCore("encounterId", element.getEncounterIdElement(), false); 792 composeIdExtras("encounterId", element.getEncounterIdElement(), false); 793 } 794 if (element.hasDraftOrders()) { 795 composeBundle("draftOrders", element.getDraftOrders()); 796 } 797 } 798 799 protected void composeCDSHookPatientViewContext(String name, CDSHookPatientViewContext element) throws IOException { 800 if (element != null) { 801 open(name); 802 composeCDSHookPatientViewContextProperties(element); 803 close(); 804 } 805 } 806 807 protected void composeCDSHookPatientViewContextProperties(CDSHookPatientViewContext element) throws IOException { 808 composeCDSHookContextProperties(element); 809 if (element.hasUserIdElement()) { 810 composeUrlCore("userId", element.getUserIdElement(), false); 811 composeUrlExtras("userId", element.getUserIdElement(), false); 812 } 813 if (element.hasPatientIdElement()) { 814 composeIdCore("patientId", element.getPatientIdElement(), false); 815 composeIdExtras("patientId", element.getPatientIdElement(), false); 816 } 817 if (element.hasEncounterIdElement()) { 818 composeIdCore("encounterId", element.getEncounterIdElement(), false); 819 composeIdExtras("encounterId", element.getEncounterIdElement(), false); 820 } 821 } 822 823 protected void composeCDSHooksExtensions(String name, CDSHooksExtensions element) throws IOException { 824 if (element != null) { 825 open(name); 826 composeCDSHooksExtensionsProperties(element); 827 close(); 828 } 829 } 830 831 protected void composeCDSHooksExtensionsProperties(CDSHooksExtensions element) throws IOException { 832 composeBaseProperties(element); 833 // todo: Named Element Extensions 834 } 835 836 protected void composeCDSHooksRequest(String name, CDSHooksRequest element) throws IOException { 837 if (element != null) { 838 open(name); 839 composeCDSHooksRequestProperties(element); 840 close(); 841 } 842 } 843 844 protected void composeCDSHooksRequestProperties(CDSHooksRequest element) throws IOException { 845 composeCDSHooksElementProperties(element); 846 if (element.hasHookElement()) { 847 composeCodeCore("hook", element.getHookElement(), false); 848 composeCodeExtras("hook", element.getHookElement(), false); 849 } 850 if (element.hasHookInstanceElement()) { 851 composeUuidCore("hookInstance", element.getHookInstanceElement(), false); 852 composeUuidExtras("hookInstance", element.getHookInstanceElement(), false); 853 } 854 if (element.hasFhirServerElement()) { 855 composeUrlCore("fhirServer", element.getFhirServerElement(), false); 856 composeUrlExtras("fhirServer", element.getFhirServerElement(), false); 857 } 858 if (element.hasFhirAuthorization()) { 859 composeCDSHooksRequestFhirAuthorizationComponent("fhirAuthorization", element.getFhirAuthorization()); 860 } 861 if (element.hasContext()) { 862 composeCDSHookContext("context", element.getContext()); 863 } 864 if (element.hasPrefetch()) { 865 openArray("prefetch"); 866 for (CDSHooksRequest.CDSHooksRequestPrefetchComponent e : element.getPrefetchList()) 867 composeCDSHooksRequestPrefetchComponent(null, e); 868 closeArray(); 869 }; 870 } 871 872 protected void composeCDSHookContext(String name, CDSHookContext element) throws IOException { 873 if (element instanceof CDSHookPatientViewContext) { 874 composeCDSHookPatientViewContext(name, (CDSHookPatientViewContext) element); 875 } else if (element instanceof CDSHookOrderSignContext) { 876 composeCDSHookOrderSignContext(name, (CDSHookOrderSignContext) element); 877 } else if (element instanceof CDSHookOrderSelectContext) { 878 composeCDSHookOrderSelectContext(name, (CDSHookOrderSelectContext) element); 879 } else { 880 throw new FHIRFormatError("Unable to compose CDSHookContext: Unexpected type "+element.getClass().getName()); 881 } 882 } 883 884 protected void composeCDSHooksRequestFhirAuthorizationComponent(String name, CDSHooksRequest.CDSHooksRequestFhirAuthorizationComponent element) throws IOException { 885 if (element != null) { 886 open(name); 887 composeCDSHooksRequestFhirAuthorizationComponentProperties(element); 888 close(); 889 } 890 } 891 892 protected void composeCDSHooksRequestFhirAuthorizationComponentProperties(CDSHooksRequest.CDSHooksRequestFhirAuthorizationComponent element) throws IOException { 893 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(element); 894 if (element.hasAccessTokenElement()) { 895 composeStringCore("accessToken", element.getAccessTokenElement(), false); 896 composeStringExtras("accessToken", element.getAccessTokenElement(), false); 897 } 898 if (element.hasTokenTypeElement()) { 899 composeCodeCore("tokenType", element.getTokenTypeElement(), false); 900 composeCodeExtras("tokenType", element.getTokenTypeElement(), false); 901 } 902 if (element.hasExpiresInElement()) { 903 composeIntegerCore("expiresIn", element.getExpiresInElement(), false); 904 composeIntegerExtras("expiresIn", element.getExpiresInElement(), false); 905 } 906 if (element.hasScopeElement()) { 907 composeStringCore("scope", element.getScopeElement(), false); 908 composeStringExtras("scope", element.getScopeElement(), false); 909 } 910 if (element.hasSubjectElement()) { 911 composeStringCore("subject", element.getSubjectElement(), false); 912 composeStringExtras("subject", element.getSubjectElement(), false); 913 } 914 if (element.hasPatientElement()) { 915 composeIdCore("patient", element.getPatientElement(), false); 916 composeIdExtras("patient", element.getPatientElement(), false); 917 } 918 } 919 920 protected void composeCDSHooksRequestPrefetchComponent(String name, CDSHooksRequest.CDSHooksRequestPrefetchComponent element) throws IOException { 921 if (element != null) { 922 open(name); 923 composeCDSHooksRequestPrefetchComponentProperties(element); 924 close(); 925 } 926 } 927 928 protected void composeCDSHooksRequestPrefetchComponentProperties(CDSHooksRequest.CDSHooksRequestPrefetchComponent element) throws IOException { 929 composeBaseProperties(element); 930 if (element.hasKeyElement()) { 931 composeCodeCore("key", element.getKeyElement(), false); 932 composeCodeExtras("key", element.getKeyElement(), false); 933 } 934 if (element.hasValue()) { 935 open("value"); 936 composeResource(element.getValue()); 937 close(); 938 } 939 } 940 941 protected void composeCDSHooksResponse(String name, CDSHooksResponse element) throws IOException { 942 if (element != null) { 943 open(name); 944 composeCDSHooksResponseProperties(element); 945 close(); 946 } 947 } 948 949 protected void composeCDSHooksResponseProperties(CDSHooksResponse element) throws IOException { 950 composeCDSHooksElementProperties(element); 951 if (element.hasCards()) { 952 openArray("cards"); 953 for (CDSHooksResponse.CDSHooksResponseCardsComponent e : element.getCardsList()) 954 composeCDSHooksResponseCardsComponent(null, e); 955 closeArray(); 956 }; 957 if (element.hasSystemActions()) { 958 openArray("systemActions"); 959 for (CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent e : element.getSystemActionsList()) 960 composeCDSHooksResponseCardsSuggestionsActionsComponent(null, e); 961 closeArray(); 962 }; 963 } 964 965 protected void composeCDSHooksResponseCardsComponent(String name, CDSHooksResponse.CDSHooksResponseCardsComponent element) throws IOException { 966 if (element != null) { 967 open(name); 968 composeCDSHooksResponseCardsComponentProperties(element); 969 close(); 970 } 971 } 972 973 protected void composeCDSHooksResponseCardsComponentProperties(CDSHooksResponse.CDSHooksResponseCardsComponent element) throws IOException { 974 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(element); 975 if (element.hasUuidElement()) { 976 composeUuidCore("uuid", element.getUuidElement(), false); 977 composeUuidExtras("uuid", element.getUuidElement(), false); 978 } 979 if (element.hasSummaryElement()) { 980 composeStringCore("summary", element.getSummaryElement(), false); 981 composeStringExtras("summary", element.getSummaryElement(), false); 982 } 983 if (element.hasDetailElement()) { 984 composeMarkdownCore("detail", element.getDetailElement(), false); 985 composeMarkdownExtras("detail", element.getDetailElement(), false); 986 } 987 if (element.hasIndicatorElement()) { 988 composeEnumerationCore("indicator", element.getIndicatorElement(), new CDSHooksResponse.CDSIndicatorCodesVSEnumFactory(), false); 989 composeEnumerationExtras("indicator", element.getIndicatorElement(), new CDSHooksResponse.CDSIndicatorCodesVSEnumFactory(), false); 990 } 991 if (element.hasSource()) { 992 composeCDSHooksResponseCardsSourceComponent("source", element.getSource()); 993 } 994 if (element.hasSuggestions()) { 995 openArray("suggestions"); 996 for (CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent e : element.getSuggestionsList()) 997 composeCDSHooksResponseCardsSuggestionsComponent(null, e); 998 closeArray(); 999 }; 1000 if (element.hasSelectionBehaviorElement()) { 1001 composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new CDSHooksResponse.CDSSelectionBehaviorCodesVSEnumFactory(), false); 1002 composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new CDSHooksResponse.CDSSelectionBehaviorCodesVSEnumFactory(), false); 1003 } 1004 if (element.hasOverrideReasons()) { 1005 openArray("overrideReasons"); 1006 for (Coding e : element.getOverrideReasonsList()) 1007 composeCoding(null, e); 1008 closeArray(); 1009 }; 1010 if (element.hasLinks()) { 1011 openArray("links"); 1012 for (CDSHooksResponse.CDSHooksResponseCardsLinksComponent e : element.getLinksList()) 1013 composeCDSHooksResponseCardsLinksComponent(null, e); 1014 closeArray(); 1015 }; 1016 } 1017 1018 protected void composeCDSHooksResponseCardsSourceComponent(String name, CDSHooksResponse.CDSHooksResponseCardsSourceComponent element) throws IOException { 1019 if (element != null) { 1020 open(name); 1021 composeCDSHooksResponseCardsSourceComponentProperties(element); 1022 close(); 1023 } 1024 } 1025 1026 protected void composeCDSHooksResponseCardsSourceComponentProperties(CDSHooksResponse.CDSHooksResponseCardsSourceComponent element) throws IOException { 1027 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(element); 1028 if (element.hasLabelElement()) { 1029 composeStringCore("label", element.getLabelElement(), false); 1030 composeStringExtras("label", element.getLabelElement(), false); 1031 } 1032 if (element.hasUrlElement()) { 1033 composeUrlCore("url", element.getUrlElement(), false); 1034 composeUrlExtras("url", element.getUrlElement(), false); 1035 } 1036 if (element.hasIconElement()) { 1037 composeUrlCore("icon", element.getIconElement(), false); 1038 composeUrlExtras("icon", element.getIconElement(), false); 1039 } 1040 if (element.hasTopic()) { 1041 composeCoding("topic", element.getTopic()); 1042 } 1043 } 1044 1045 protected void composeCDSHooksResponseCardsSuggestionsComponent(String name, CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent element) throws IOException { 1046 if (element != null) { 1047 open(name); 1048 composeCDSHooksResponseCardsSuggestionsComponentProperties(element); 1049 close(); 1050 } 1051 } 1052 1053 protected void composeCDSHooksResponseCardsSuggestionsComponentProperties(CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent element) throws IOException { 1054 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(element); 1055 if (element.hasLabelElement()) { 1056 composeStringCore("label", element.getLabelElement(), false); 1057 composeStringExtras("label", element.getLabelElement(), false); 1058 } 1059 if (element.hasUuidElement()) { 1060 composeUuidCore("uuid", element.getUuidElement(), false); 1061 composeUuidExtras("uuid", element.getUuidElement(), false); 1062 } 1063 if (element.hasIsRecommendedElement()) { 1064 composeBooleanCore("isRecommended", element.getIsRecommendedElement(), false); 1065 composeBooleanExtras("isRecommended", element.getIsRecommendedElement(), false); 1066 } 1067 if (element.hasActions()) { 1068 openArray("actions"); 1069 for (CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent e : element.getActionsList()) 1070 composeCDSHooksResponseCardsSuggestionsActionsComponent(null, e); 1071 closeArray(); 1072 }; 1073 } 1074 1075 protected void composeCDSHooksResponseCardsSuggestionsActionsComponent(String name, CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent element) throws IOException { 1076 if (element != null) { 1077 open(name); 1078 composeCDSHooksResponseCardsSuggestionsActionsComponentProperties(element); 1079 close(); 1080 } 1081 } 1082 1083 protected void composeCDSHooksResponseCardsSuggestionsActionsComponentProperties(CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent element) throws IOException { 1084 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(element); 1085 if (element.hasTypeElement()) { 1086 composeEnumerationCore("type", element.getTypeElement(), new CDSHooksResponse.CDSActionTypeCodesVSEnumFactory(), false); 1087 composeEnumerationExtras("type", element.getTypeElement(), new CDSHooksResponse.CDSActionTypeCodesVSEnumFactory(), false); 1088 } 1089 if (element.hasDescriptionElement()) { 1090 composeStringCore("description", element.getDescriptionElement(), false); 1091 composeStringExtras("description", element.getDescriptionElement(), false); 1092 } 1093 if (element.hasResource()) { 1094 open("resource"); 1095 composeResource(element.getResource()); 1096 close(); 1097 } 1098 if (element.hasResourceIdElement()) { 1099 composeUrlCore("resourceId", element.getResourceIdElement(), false); 1100 composeUrlExtras("resourceId", element.getResourceIdElement(), false); 1101 } 1102 } 1103 1104 protected void composeCDSHooksResponseCardsLinksComponent(String name, CDSHooksResponse.CDSHooksResponseCardsLinksComponent element) throws IOException { 1105 if (element != null) { 1106 open(name); 1107 composeCDSHooksResponseCardsLinksComponentProperties(element); 1108 close(); 1109 } 1110 } 1111 1112 protected void composeCDSHooksResponseCardsLinksComponentProperties(CDSHooksResponse.CDSHooksResponseCardsLinksComponent element) throws IOException { 1113 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(element); 1114 if (element.hasLabelElement()) { 1115 composeStringCore("label", element.getLabelElement(), false); 1116 composeStringExtras("label", element.getLabelElement(), false); 1117 } 1118 if (element.hasUrlElement()) { 1119 composeUrlCore("url", element.getUrlElement(), false); 1120 composeUrlExtras("url", element.getUrlElement(), false); 1121 } 1122 if (element.hasTypeElement()) { 1123 composeEnumerationCore("type", element.getTypeElement(), new CDSHooksResponse.CDSLinkTypeCodesVSEnumFactory(), false); 1124 composeEnumerationExtras("type", element.getTypeElement(), new CDSHooksResponse.CDSLinkTypeCodesVSEnumFactory(), false); 1125 } 1126 if (element.hasAppContextElement()) { 1127 composeStringCore("appContext", element.getAppContextElement(), false); 1128 composeStringExtras("appContext", element.getAppContextElement(), false); 1129 } 1130 } 1131 1132 protected void composeCDSHooksServices(String name, CDSHooksServices element) throws IOException { 1133 if (element != null) { 1134 open(name); 1135 composeCDSHooksServicesProperties(element); 1136 close(); 1137 } 1138 } 1139 1140 protected void composeCDSHooksServicesProperties(CDSHooksServices element) throws IOException { 1141 composeCDSHooksElementProperties(element); 1142 if (element.hasServices()) { 1143 openArray("services"); 1144 for (CDSHooksServices.CDSHooksServicesServicesComponent e : element.getServicesList()) 1145 composeCDSHooksServicesServicesComponent(null, e); 1146 closeArray(); 1147 }; 1148 } 1149 1150 protected void composeCDSHooksServicesServicesComponent(String name, CDSHooksServices.CDSHooksServicesServicesComponent element) throws IOException { 1151 if (element != null) { 1152 open(name); 1153 composeCDSHooksServicesServicesComponentProperties(element); 1154 close(); 1155 } 1156 } 1157 1158 protected void composeCDSHooksServicesServicesComponentProperties(CDSHooksServices.CDSHooksServicesServicesComponent element) throws IOException { 1159 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementProperties(element); 1160 if (element.hasHookElement()) { 1161 composeStringCore("hook", element.getHookElement(), false); 1162 composeStringExtras("hook", element.getHookElement(), false); 1163 } 1164 if (element.hasTitleElement()) { 1165 composeStringCore("title", element.getTitleElement(), false); 1166 composeStringExtras("title", element.getTitleElement(), false); 1167 } 1168 if (element.hasIdElement()) { 1169 composeCodeCore("id", element.getIdElement(), false); 1170 composeCodeExtras("id", element.getIdElement(), false); 1171 } 1172 if (element.hasDescriptionElement()) { 1173 composeStringCore("description", element.getDescriptionElement(), false); 1174 composeStringExtras("description", element.getDescriptionElement(), false); 1175 } 1176 if (element.hasUsageRequirementsElement()) { 1177 composeStringCore("usageRequirements", element.getUsageRequirementsElement(), false); 1178 composeStringExtras("usageRequirements", element.getUsageRequirementsElement(), false); 1179 } 1180 if (element.hasPrefetch()) { 1181 openArray("prefetch"); 1182 for (CDSHooksServices.CDSHooksServicesServicesPrefetchComponent e : element.getPrefetchList()) 1183 composeCDSHooksServicesServicesPrefetchComponent(null, e); 1184 closeArray(); 1185 }; 1186 } 1187 1188 protected void composeCDSHooksServicesServicesPrefetchComponent(String name, CDSHooksServices.CDSHooksServicesServicesPrefetchComponent element) throws IOException { 1189 if (element != null) { 1190 open(name); 1191 composeCDSHooksServicesServicesPrefetchComponentProperties(element); 1192 close(); 1193 } 1194 } 1195 1196 protected void composeCDSHooksServicesServicesPrefetchComponentProperties(CDSHooksServices.CDSHooksServicesServicesPrefetchComponent element) throws IOException { 1197 composeBaseProperties(element); 1198 if (element.hasKeyElement()) { 1199 composeCodeCore("key", element.getKeyElement(), false); 1200 composeCodeExtras("key", element.getKeyElement(), false); 1201 } 1202 if (element.hasValueElement()) { 1203 composeStringCore("value", element.getValueElement(), false); 1204 composeStringExtras("value", element.getValueElement(), false); 1205 } 1206 } 1207 1208 protected void composeTestCases(String name, TestCases element) throws IOException { 1209 if (element != null) { 1210 prop("resourceType", "TestCases"); 1211 composeTestCasesProperties(element); 1212 } 1213 } 1214 1215 protected void composeTestCasesProperties(TestCases element) throws IOException { 1216 composeResourceProperties(element); 1217 if (element.hasUrlElement()) { 1218 composeUriCore("url", element.getUrlElement(), false); 1219 composeUriExtras("url", element.getUrlElement(), false); 1220 } 1221 if (element.hasVersionElement()) { 1222 composeStringCore("version", element.getVersionElement(), false); 1223 composeStringExtras("version", element.getVersionElement(), false); 1224 } 1225 if (element.hasNameElement()) { 1226 composeStringCore("name", element.getNameElement(), false); 1227 composeStringExtras("name", element.getNameElement(), false); 1228 } 1229 if (element.hasDescriptionElement()) { 1230 composeMarkdownCore("description", element.getDescriptionElement(), false); 1231 composeMarkdownExtras("description", element.getDescriptionElement(), false); 1232 } 1233 if (element.hasRunnerElement()) { 1234 composeUrlCore("runner", element.getRunnerElement(), false); 1235 composeUrlExtras("runner", element.getRunnerElement(), false); 1236 } 1237 if (element.hasMode()) { 1238 openArray("mode"); 1239 for (TestCases.TestCasesModeComponent e : element.getModeList()) 1240 composeTestCasesModeComponent(null, e); 1241 closeArray(); 1242 }; 1243 if (element.hasSuite()) { 1244 openArray("suite"); 1245 for (TestCases.TestCasesSuiteComponent e : element.getSuiteList()) 1246 composeTestCasesSuiteComponent(null, e); 1247 closeArray(); 1248 }; 1249 } 1250 1251 protected void composeTestCasesModeComponent(String name, TestCases.TestCasesModeComponent element) throws IOException { 1252 if (element != null) { 1253 open(name); 1254 composeTestCasesModeComponentProperties(element); 1255 close(); 1256 } 1257 } 1258 1259 protected void composeTestCasesModeComponentProperties(TestCases.TestCasesModeComponent element) throws IOException { 1260 composeBaseProperties(element); 1261 if (element.hasCodeElement()) { 1262 composeStringCore("code", element.getCodeElement(), false); 1263 composeStringExtras("code", element.getCodeElement(), false); 1264 } 1265 if (element.hasDescriptionElement()) { 1266 composeStringCore("description", element.getDescriptionElement(), false); 1267 composeStringExtras("description", element.getDescriptionElement(), false); 1268 } 1269 } 1270 1271 protected void composeTestCasesSuiteComponent(String name, TestCases.TestCasesSuiteComponent element) throws IOException { 1272 if (element != null) { 1273 open(name); 1274 composeTestCasesSuiteComponentProperties(element); 1275 close(); 1276 } 1277 } 1278 1279 protected void composeTestCasesSuiteComponentProperties(TestCases.TestCasesSuiteComponent element) throws IOException { 1280 composeBaseProperties(element); 1281 if (element.hasNameElement()) { 1282 composeStringCore("name", element.getNameElement(), false); 1283 composeStringExtras("name", element.getNameElement(), false); 1284 } 1285 if (element.hasDescriptionElement()) { 1286 composeStringCore("description", element.getDescriptionElement(), false); 1287 composeStringExtras("description", element.getDescriptionElement(), false); 1288 } 1289 if (element.hasModeElement()) { 1290 composeCodeCore("mode", element.getModeElement(), false); 1291 composeCodeExtras("mode", element.getModeElement(), false); 1292 } 1293 if (element.hasResource()) { 1294 openArray("resource"); 1295 for (TestCases.TestCasesSuiteResourceComponent e : element.getResourceList()) 1296 composeTestCasesSuiteResourceComponent(null, e); 1297 closeArray(); 1298 }; 1299 if (element.hasParameter()) { 1300 openArray("parameter"); 1301 for (TestCases.TestCasesSuiteParameterComponent e : element.getParameterList()) 1302 composeTestCasesSuiteParameterComponent(null, e); 1303 closeArray(); 1304 }; 1305 if (element.hasTest()) { 1306 openArray("test"); 1307 for (TestCases.TestCasesSuiteTestComponent e : element.getTestList()) 1308 composeTestCasesSuiteTestComponent(null, e); 1309 closeArray(); 1310 }; 1311 } 1312 1313 protected void composeTestCasesSuiteResourceComponent(String name, TestCases.TestCasesSuiteResourceComponent element) throws IOException { 1314 if (element != null) { 1315 open(name); 1316 composeTestCasesSuiteResourceComponentProperties(element); 1317 close(); 1318 } 1319 } 1320 1321 protected void composeTestCasesSuiteResourceComponentProperties(TestCases.TestCasesSuiteResourceComponent element) throws IOException { 1322 composeBaseProperties(element); 1323 if (element.hasNameElement()) { 1324 composeStringCore("name", element.getNameElement(), false); 1325 composeStringExtras("name", element.getNameElement(), false); 1326 } 1327 if (element.hasFileElement()) { 1328 composeStringCore("file", element.getFileElement(), false); 1329 composeStringExtras("file", element.getFileElement(), false); 1330 } 1331 if (element.hasResource()) { 1332 open("resource"); 1333 composeResource(element.getResource()); 1334 close(); 1335 } 1336 if (element.hasModeElement()) { 1337 composeCodeCore("mode", element.getModeElement(), false); 1338 composeCodeExtras("mode", element.getModeElement(), false); 1339 } 1340 } 1341 1342 protected void composeTestCasesSuiteParameterComponent(String name, TestCases.TestCasesSuiteParameterComponent element) throws IOException { 1343 if (element != null) { 1344 open(name); 1345 composeTestCasesSuiteParameterComponentProperties(element); 1346 close(); 1347 } 1348 } 1349 1350 protected void composeTestCasesSuiteParameterComponentProperties(TestCases.TestCasesSuiteParameterComponent element) throws IOException { 1351 composeBaseProperties(element); 1352 if (element.hasNameElement()) { 1353 composeStringCore("name", element.getNameElement(), false); 1354 composeStringExtras("name", element.getNameElement(), false); 1355 } 1356 if (element.hasValue()) { 1357 composeType("value", element.getValue()); 1358 } 1359 if (element.hasModeElement()) { 1360 composeCodeCore("mode", element.getModeElement(), false); 1361 composeCodeExtras("mode", element.getModeElement(), false); 1362 } 1363 } 1364 1365 protected void composeTestCasesSuiteTestComponent(String name, TestCases.TestCasesSuiteTestComponent element) throws IOException { 1366 if (element != null) { 1367 open(name); 1368 composeTestCasesSuiteTestComponentProperties(element); 1369 close(); 1370 } 1371 } 1372 1373 protected void composeTestCasesSuiteTestComponentProperties(TestCases.TestCasesSuiteTestComponent element) throws IOException { 1374 composeBaseProperties(element); 1375 if (element.hasNameElement()) { 1376 composeStringCore("name", element.getNameElement(), false); 1377 composeStringExtras("name", element.getNameElement(), false); 1378 } 1379 if (element.hasDescriptionElement()) { 1380 composeStringCore("description", element.getDescriptionElement(), false); 1381 composeStringExtras("description", element.getDescriptionElement(), false); 1382 } 1383 if (element.hasOperationElement()) { 1384 composeCodeCore("operation", element.getOperationElement(), false); 1385 composeCodeExtras("operation", element.getOperationElement(), false); 1386 } 1387 if (element.hasModeElement()) { 1388 composeStringCore("mode", element.getModeElement(), false); 1389 composeStringExtras("mode", element.getModeElement(), false); 1390 } 1391 if (element.hasParameter()) { 1392 openArray("parameter"); 1393 for (TestCases.TestCasesSuiteParameterComponent e : element.getParameterList()) 1394 composeTestCasesSuiteParameterComponent(null, e); 1395 closeArray(); 1396 }; 1397 if (element.hasInput()) { 1398 openArray("input"); 1399 for (TestCases.TestCasesSuiteResourceComponent e : element.getInputList()) 1400 composeTestCasesSuiteResourceComponent(null, e); 1401 closeArray(); 1402 }; 1403 if (element.hasOutput()) { 1404 openArray("output"); 1405 for (TestCases.TestCasesSuiteResourceComponent e : element.getOutputList()) 1406 composeTestCasesSuiteResourceComponent(null, e); 1407 closeArray(); 1408 }; 1409 } 1410 1411 1412 1413 @Override 1414 protected void composeResource(Resource resource) throws IOException { 1415 if (resource == null) { 1416 throw new Error("Unhandled resource type "+resource.getClass().getName()); 1417 } else if (resource instanceof TestCases) { 1418 composeTestCases("TestCases", (TestCases)resource); 1419 1420 } else 1421 throw new Error("Unhandled resource type "+resource.getClass().getName()); 1422 } 1423 1424}