
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 org.hl7.fhir.r5.model.*; 038import org.hl7.fhir.r5.formats.*; 039import org.xmlpull.v1.*; 040import org.hl7.fhir.utilities.xml.IXMLWriter; 041import org.hl7.fhir.utilities.Utilities; 042import org.hl7.fhir.exceptions.FHIRFormatError; 043import org.hl7.fhir.exceptions.FHIRException; 044import java.io.IOException; 045import java.util.Enumeration; 046 047public class ToolsXmlParser extends org.hl7.fhir.r5.formats.XmlParser { 048 049 public ToolsXmlParser(boolean allowUnknownContent) { 050 super(); 051 setAllowUnknownContent(allowUnknownContent); 052 } 053 054 public ToolsXmlParser(IXMLWriter xml) { 055 super(); 056 this.xml = xml; 057 } 058 059 protected boolean parseCDSHookContextContent(int eventType, XmlPullParser xpp, CDSHookContext res) throws XmlPullParserException, IOException, FHIRFormatError { 060 if (!parseBaseContent(eventType, xpp, res)) { //3 061 return false; 062 } 063 return true; 064 } 065 066 protected boolean parseCDSHooksElementContent(int eventType, XmlPullParser xpp, CDSHooksElement res) throws XmlPullParserException, IOException, FHIRFormatError { 067 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("extension")) { 068 res.setExtension(parseCDSHooksExtensions(xpp)); 069 } else if (!parseBaseContent(eventType, xpp, res)) { //3 070 return false; 071 } 072 return true; 073 } 074 075 protected CDSHookOrderSelectContext parseCDSHookOrderSelectContext(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 076 CDSHookOrderSelectContext res = new CDSHookOrderSelectContext(); 077 next(xpp); 078 int eventType = nextNoWhitespace(xpp); 079 while (eventType != XmlPullParser.END_TAG) { 080 if (!parseCDSHookOrderSelectContextContent(eventType, xpp, res)) // 1 081 unknownContent(xpp); 082 eventType = nextNoWhitespace(xpp); 083 } 084 next(xpp); 085 parseElementClose(res); 086 return res; 087 } 088 089 protected boolean parseCDSHookOrderSelectContextContent(int eventType, XmlPullParser xpp, CDSHookOrderSelectContext res) throws XmlPullParserException, IOException, FHIRFormatError { 090 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("userId")) { 091 res.setUserIdElement(parseUrl(xpp)); 092 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patientId")) { 093 res.setPatientIdElement(parseId(xpp)); 094 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounterId")) { 095 res.setEncounterIdElement(parseId(xpp)); 096 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("selections")) { 097 res.getSelections().add(parseUri(xpp)); 098 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("draftOrders")) { 099 res.setDraftOrders(parseBundle(xpp)); 100 } else if (!parseCDSHookContextContent(eventType, xpp, res)){ //2 101 return false; 102 } 103 return true; 104 } 105 106 protected CDSHookOrderSignContext parseCDSHookOrderSignContext(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 107 CDSHookOrderSignContext res = new CDSHookOrderSignContext(); 108 next(xpp); 109 int eventType = nextNoWhitespace(xpp); 110 while (eventType != XmlPullParser.END_TAG) { 111 if (!parseCDSHookOrderSignContextContent(eventType, xpp, res)) // 1 112 unknownContent(xpp); 113 eventType = nextNoWhitespace(xpp); 114 } 115 next(xpp); 116 parseElementClose(res); 117 return res; 118 } 119 120 protected boolean parseCDSHookOrderSignContextContent(int eventType, XmlPullParser xpp, CDSHookOrderSignContext res) throws XmlPullParserException, IOException, FHIRFormatError { 121 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("userId")) { 122 res.setUserIdElement(parseUrl(xpp)); 123 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patientId")) { 124 res.setPatientIdElement(parseId(xpp)); 125 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounterId")) { 126 res.setEncounterIdElement(parseId(xpp)); 127 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("draftOrders")) { 128 res.setDraftOrders(parseBundle(xpp)); 129 } else if (!parseCDSHookContextContent(eventType, xpp, res)){ //2 130 return false; 131 } 132 return true; 133 } 134 135 protected CDSHookPatientViewContext parseCDSHookPatientViewContext(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 136 CDSHookPatientViewContext res = new CDSHookPatientViewContext(); 137 next(xpp); 138 int eventType = nextNoWhitespace(xpp); 139 while (eventType != XmlPullParser.END_TAG) { 140 if (!parseCDSHookPatientViewContextContent(eventType, xpp, res)) // 1 141 unknownContent(xpp); 142 eventType = nextNoWhitespace(xpp); 143 } 144 next(xpp); 145 parseElementClose(res); 146 return res; 147 } 148 149 protected boolean parseCDSHookPatientViewContextContent(int eventType, XmlPullParser xpp, CDSHookPatientViewContext res) throws XmlPullParserException, IOException, FHIRFormatError { 150 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("userId")) { 151 res.setUserIdElement(parseUrl(xpp)); 152 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patientId")) { 153 res.setPatientIdElement(parseId(xpp)); 154 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("encounterId")) { 155 res.setEncounterIdElement(parseId(xpp)); 156 } else if (!parseCDSHookContextContent(eventType, xpp, res)){ //2 157 return false; 158 } 159 return true; 160 } 161 162 protected CDSHooksExtensions parseCDSHooksExtensions(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 163 CDSHooksExtensions res = new CDSHooksExtensions(); 164 next(xpp); 165 int eventType = nextNoWhitespace(xpp); 166 while (eventType != XmlPullParser.END_TAG) { 167 if (!parseCDSHooksExtensionsContent(eventType, xpp, res)) // 1 168 unknownContent(xpp); 169 eventType = nextNoWhitespace(xpp); 170 } 171 next(xpp); 172 parseElementClose(res); 173 return res; 174 } 175 176 protected boolean parseCDSHooksExtensionsContent(int eventType, XmlPullParser xpp, CDSHooksExtensions res) throws XmlPullParserException, IOException, FHIRFormatError { 177 if (!parseElementContent(eventType, xpp, res)){ //2 178 return false; 179 } 180 return true; 181 } 182 183 protected CDSHooksRequest parseCDSHooksRequest(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 184 CDSHooksRequest res = new CDSHooksRequest(); 185 next(xpp); 186 int eventType = nextNoWhitespace(xpp); 187 while (eventType != XmlPullParser.END_TAG) { 188 if (!parseCDSHooksRequestContent(eventType, xpp, res)) // 1 189 unknownContent(xpp); 190 eventType = nextNoWhitespace(xpp); 191 } 192 next(xpp); 193 parseElementClose(res); 194 return res; 195 } 196 197 protected boolean parseCDSHooksRequestContent(int eventType, XmlPullParser xpp, CDSHooksRequest res) throws XmlPullParserException, IOException, FHIRFormatError { 198 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hook")) { 199 res.setHookElement(parseCode(xpp)); 200 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hookInstance")) { 201 res.setHookInstanceElement(parseUuid(xpp)); 202 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fhirServer")) { 203 res.setFhirServerElement(parseUrl(xpp)); 204 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("fhirAuthorization")) { 205 res.setFhirAuthorization(parseCDSHooksRequestFhirAuthorizationComponent(xpp)); 206 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("context")) { 207 res.setContext(parseCDSHookContext(xpp)); 208 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prefetch")) { 209 res.getPrefetch().add(parseCDSHooksRequestPrefetchComponent(xpp)); 210 } else if (!parseCDSHooksElementContent(eventType, xpp, res)){ //2 211 return false; 212 } 213 return true; 214 } 215 216 protected CDSHookContext parseCDSHookContext(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 217 String xsiType = xpp.getAttributeValue("xsi", "type"); 218 if ("CDSHookPatientViewContext".equals(xsiType)) { 219 return parseCDSHookPatientViewContext(xpp); 220 } 221 if ("CDSHookOrderSignContext".equals(xsiType)) { 222 return parseCDSHookOrderSignContext(xpp); 223 } 224 if ("CDSHookOrderSelectContext".equals(xsiType)) { 225 return parseCDSHookOrderSelectContext(xpp); 226 } 227 throw new FHIRFormatError("Unable to parse CDSHookContext: xsi:type '"+xsiType+"' not known"); 228 } 229 230 protected CDSHooksRequest.CDSHooksRequestFhirAuthorizationComponent parseCDSHooksRequestFhirAuthorizationComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 231 CDSHooksRequest.CDSHooksRequestFhirAuthorizationComponent res = new CDSHooksRequest.CDSHooksRequestFhirAuthorizationComponent(); 232 next(xpp); 233 int eventType = nextNoWhitespace(xpp); 234 while (eventType != XmlPullParser.END_TAG) { 235 if (!parseCDSHooksRequestFhirAuthorizationComponentContent(eventType, xpp, res)) // 1 236 unknownContent(xpp); 237 eventType = nextNoWhitespace(xpp); 238 } 239 next(xpp); 240 parseElementClose(res); 241 return res; 242 } 243 244 protected boolean parseCDSHooksRequestFhirAuthorizationComponentContent(int eventType, XmlPullParser xpp, CDSHooksRequest.CDSHooksRequestFhirAuthorizationComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 245 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("accessToken")) { 246 res.setAccessTokenElement(parseString(xpp)); 247 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("tokenType")) { 248 res.setTokenTypeElement(parseCode(xpp)); 249 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("expiresIn")) { 250 res.setExpiresInElement(parseInteger(xpp)); 251 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("scope")) { 252 res.setScopeElement(parseString(xpp)); 253 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("subject")) { 254 res.setSubjectElement(parseString(xpp)); 255 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("patient")) { 256 res.setPatientElement(parseId(xpp)); 257 } else if (!parseCDSHooksElementContent(eventType, xpp, res)){ //2 258 return false; 259 } 260 return true; 261 } 262 263 protected CDSHooksRequest.CDSHooksRequestPrefetchComponent parseCDSHooksRequestPrefetchComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 264 CDSHooksRequest.CDSHooksRequestPrefetchComponent res = new CDSHooksRequest.CDSHooksRequestPrefetchComponent(); 265 next(xpp); 266 int eventType = nextNoWhitespace(xpp); 267 while (eventType != XmlPullParser.END_TAG) { 268 if (!parseCDSHooksRequestPrefetchComponentContent(eventType, xpp, res)) // 1 269 unknownContent(xpp); 270 eventType = nextNoWhitespace(xpp); 271 } 272 next(xpp); 273 parseElementClose(res); 274 return res; 275 } 276 277 protected boolean parseCDSHooksRequestPrefetchComponentContent(int eventType, XmlPullParser xpp, CDSHooksRequest.CDSHooksRequestPrefetchComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 278 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("key")) { 279 res.setKeyElement(parseCode(xpp)); 280 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) { 281 res.setValue(parseResourceContained(xpp)); 282 } else if (!parseBaseContent(eventType, xpp, res)){ //2 283 return false; 284 } 285 return true; 286 } 287 288 protected CDSHooksResponse parseCDSHooksResponse(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 289 CDSHooksResponse res = new CDSHooksResponse(); 290 next(xpp); 291 int eventType = nextNoWhitespace(xpp); 292 while (eventType != XmlPullParser.END_TAG) { 293 if (!parseCDSHooksResponseContent(eventType, xpp, res)) // 1 294 unknownContent(xpp); 295 eventType = nextNoWhitespace(xpp); 296 } 297 next(xpp); 298 parseElementClose(res); 299 return res; 300 } 301 302 protected boolean parseCDSHooksResponseContent(int eventType, XmlPullParser xpp, CDSHooksResponse res) throws XmlPullParserException, IOException, FHIRFormatError { 303 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("cards")) { 304 res.getCards().add(parseCDSHooksResponseCardsComponent(xpp)); 305 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("systemActions")) { 306 res.getSystemActions().add(parseCDSHooksResponseCardsSuggestionsActionsComponent(xpp)); 307 } else if (!parseCDSHooksElementContent(eventType, xpp, res)){ //2 308 return false; 309 } 310 return true; 311 } 312 313 protected CDSHooksResponse.CDSHooksResponseCardsComponent parseCDSHooksResponseCardsComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 314 CDSHooksResponse.CDSHooksResponseCardsComponent res = new CDSHooksResponse.CDSHooksResponseCardsComponent(); 315 next(xpp); 316 int eventType = nextNoWhitespace(xpp); 317 while (eventType != XmlPullParser.END_TAG) { 318 if (!parseCDSHooksResponseCardsComponentContent(eventType, xpp, res)) // 1 319 unknownContent(xpp); 320 eventType = nextNoWhitespace(xpp); 321 } 322 next(xpp); 323 parseElementClose(res); 324 return res; 325 } 326 327 protected boolean parseCDSHooksResponseCardsComponentContent(int eventType, XmlPullParser xpp, CDSHooksResponse.CDSHooksResponseCardsComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 328 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uuid")) { 329 res.setUuidElement(parseUuid(xpp)); 330 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("summary")) { 331 res.setSummaryElement(parseString(xpp)); 332 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("detail")) { 333 res.setDetailElement(parseMarkdown(xpp)); 334 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("indicator")) { 335 res.setIndicatorElement(parseEnumeration(xpp, CDSHooksResponse.CDSIndicatorCodesVS.NULL, new CDSHooksResponse.CDSIndicatorCodesVSEnumFactory())); 336 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("source")) { 337 res.setSource(parseCDSHooksResponseCardsSourceComponent(xpp)); 338 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("suggestions")) { 339 res.getSuggestions().add(parseCDSHooksResponseCardsSuggestionsComponent(xpp)); 340 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("selectionBehavior")) { 341 res.setSelectionBehaviorElement(parseEnumeration(xpp, CDSHooksResponse.CDSSelectionBehaviorCodesVS.NULL, new CDSHooksResponse.CDSSelectionBehaviorCodesVSEnumFactory())); 342 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("overrideReasons")) { 343 res.getOverrideReasons().add(parseCoding(xpp)); 344 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("links")) { 345 res.getLinks().add(parseCDSHooksResponseCardsLinksComponent(xpp)); 346 } else if (!parseCDSHooksElementContent(eventType, xpp, res)){ //2 347 return false; 348 } 349 return true; 350 } 351 352 protected CDSHooksResponse.CDSHooksResponseCardsSourceComponent parseCDSHooksResponseCardsSourceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 353 CDSHooksResponse.CDSHooksResponseCardsSourceComponent res = new CDSHooksResponse.CDSHooksResponseCardsSourceComponent(); 354 next(xpp); 355 int eventType = nextNoWhitespace(xpp); 356 while (eventType != XmlPullParser.END_TAG) { 357 if (!parseCDSHooksResponseCardsSourceComponentContent(eventType, xpp, res)) // 1 358 unknownContent(xpp); 359 eventType = nextNoWhitespace(xpp); 360 } 361 next(xpp); 362 parseElementClose(res); 363 return res; 364 } 365 366 protected boolean parseCDSHooksResponseCardsSourceComponentContent(int eventType, XmlPullParser xpp, CDSHooksResponse.CDSHooksResponseCardsSourceComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 367 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) { 368 res.setLabelElement(parseString(xpp)); 369 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) { 370 res.setUrlElement(parseUrl(xpp)); 371 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("icon")) { 372 res.setIconElement(parseUrl(xpp)); 373 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("topic")) { 374 res.setTopic(parseCoding(xpp)); 375 } else if (!parseCDSHooksElementContent(eventType, xpp, res)){ //2 376 return false; 377 } 378 return true; 379 } 380 381 protected CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent parseCDSHooksResponseCardsSuggestionsComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 382 CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent res = new CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent(); 383 next(xpp); 384 int eventType = nextNoWhitespace(xpp); 385 while (eventType != XmlPullParser.END_TAG) { 386 if (!parseCDSHooksResponseCardsSuggestionsComponentContent(eventType, xpp, res)) // 1 387 unknownContent(xpp); 388 eventType = nextNoWhitespace(xpp); 389 } 390 next(xpp); 391 parseElementClose(res); 392 return res; 393 } 394 395 protected boolean parseCDSHooksResponseCardsSuggestionsComponentContent(int eventType, XmlPullParser xpp, CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 396 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) { 397 res.setLabelElement(parseString(xpp)); 398 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("uuid")) { 399 res.setUuidElement(parseUuid(xpp)); 400 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("isRecommended")) { 401 res.setIsRecommendedElement(parseBoolean(xpp)); 402 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("actions")) { 403 res.getActions().add(parseCDSHooksResponseCardsSuggestionsActionsComponent(xpp)); 404 } else if (!parseCDSHooksElementContent(eventType, xpp, res)){ //2 405 return false; 406 } 407 return true; 408 } 409 410 protected CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent parseCDSHooksResponseCardsSuggestionsActionsComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 411 CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent res = new CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent(); 412 next(xpp); 413 int eventType = nextNoWhitespace(xpp); 414 while (eventType != XmlPullParser.END_TAG) { 415 if (!parseCDSHooksResponseCardsSuggestionsActionsComponentContent(eventType, xpp, res)) // 1 416 unknownContent(xpp); 417 eventType = nextNoWhitespace(xpp); 418 } 419 next(xpp); 420 parseElementClose(res); 421 return res; 422 } 423 424 protected boolean parseCDSHooksResponseCardsSuggestionsActionsComponentContent(int eventType, XmlPullParser xpp, CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 425 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) { 426 res.setTypeElement(parseEnumeration(xpp, CDSHooksResponse.CDSActionTypeCodesVS.NULL, new CDSHooksResponse.CDSActionTypeCodesVSEnumFactory())); 427 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) { 428 res.setDescriptionElement(parseString(xpp)); 429 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) { 430 res.setResource(parseResourceContained(xpp)); 431 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resourceId")) { 432 res.setResourceIdElement(parseUrl(xpp)); 433 } else if (!parseCDSHooksElementContent(eventType, xpp, res)){ //2 434 return false; 435 } 436 return true; 437 } 438 439 protected CDSHooksResponse.CDSHooksResponseCardsLinksComponent parseCDSHooksResponseCardsLinksComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 440 CDSHooksResponse.CDSHooksResponseCardsLinksComponent res = new CDSHooksResponse.CDSHooksResponseCardsLinksComponent(); 441 next(xpp); 442 int eventType = nextNoWhitespace(xpp); 443 while (eventType != XmlPullParser.END_TAG) { 444 if (!parseCDSHooksResponseCardsLinksComponentContent(eventType, xpp, res)) // 1 445 unknownContent(xpp); 446 eventType = nextNoWhitespace(xpp); 447 } 448 next(xpp); 449 parseElementClose(res); 450 return res; 451 } 452 453 protected boolean parseCDSHooksResponseCardsLinksComponentContent(int eventType, XmlPullParser xpp, CDSHooksResponse.CDSHooksResponseCardsLinksComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 454 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("label")) { 455 res.setLabelElement(parseString(xpp)); 456 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) { 457 res.setUrlElement(parseUrl(xpp)); 458 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("type")) { 459 res.setTypeElement(parseEnumeration(xpp, CDSHooksResponse.CDSLinkTypeCodesVS.NULL, new CDSHooksResponse.CDSLinkTypeCodesVSEnumFactory())); 460 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("appContext")) { 461 res.setAppContextElement(parseString(xpp)); 462 } else if (!parseCDSHooksElementContent(eventType, xpp, res)){ //2 463 return false; 464 } 465 return true; 466 } 467 468 protected CDSHooksServices parseCDSHooksServices(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 469 CDSHooksServices res = new CDSHooksServices(); 470 next(xpp); 471 int eventType = nextNoWhitespace(xpp); 472 while (eventType != XmlPullParser.END_TAG) { 473 if (!parseCDSHooksServicesContent(eventType, xpp, res)) // 1 474 unknownContent(xpp); 475 eventType = nextNoWhitespace(xpp); 476 } 477 next(xpp); 478 parseElementClose(res); 479 return res; 480 } 481 482 protected boolean parseCDSHooksServicesContent(int eventType, XmlPullParser xpp, CDSHooksServices res) throws XmlPullParserException, IOException, FHIRFormatError { 483 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("services")) { 484 res.getServices().add(parseCDSHooksServicesServicesComponent(xpp)); 485 } else if (!parseCDSHooksElementContent(eventType, xpp, res)){ //2 486 return false; 487 } 488 return true; 489 } 490 491 protected CDSHooksServices.CDSHooksServicesServicesComponent parseCDSHooksServicesServicesComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 492 CDSHooksServices.CDSHooksServicesServicesComponent res = new CDSHooksServices.CDSHooksServicesServicesComponent(); 493 next(xpp); 494 int eventType = nextNoWhitespace(xpp); 495 while (eventType != XmlPullParser.END_TAG) { 496 if (!parseCDSHooksServicesServicesComponentContent(eventType, xpp, res)) // 1 497 unknownContent(xpp); 498 eventType = nextNoWhitespace(xpp); 499 } 500 next(xpp); 501 parseElementClose(res); 502 return res; 503 } 504 505 protected boolean parseCDSHooksServicesServicesComponentContent(int eventType, XmlPullParser xpp, CDSHooksServices.CDSHooksServicesServicesComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 506 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("hook")) { 507 res.setHookElement(parseString(xpp)); 508 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("title")) { 509 res.setTitleElement(parseString(xpp)); 510 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("id")) { 511 res.setIdElement(parseCode(xpp)); 512 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) { 513 res.setDescriptionElement(parseString(xpp)); 514 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("usageRequirements")) { 515 res.setUsageRequirementsElement(parseString(xpp)); 516 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("prefetch")) { 517 res.getPrefetch().add(parseCDSHooksServicesServicesPrefetchComponent(xpp)); 518 } else if (!parseCDSHooksElementContent(eventType, xpp, res)){ //2 519 return false; 520 } 521 return true; 522 } 523 524 protected CDSHooksServices.CDSHooksServicesServicesPrefetchComponent parseCDSHooksServicesServicesPrefetchComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 525 CDSHooksServices.CDSHooksServicesServicesPrefetchComponent res = new CDSHooksServices.CDSHooksServicesServicesPrefetchComponent(); 526 next(xpp); 527 int eventType = nextNoWhitespace(xpp); 528 while (eventType != XmlPullParser.END_TAG) { 529 if (!parseCDSHooksServicesServicesPrefetchComponentContent(eventType, xpp, res)) // 1 530 unknownContent(xpp); 531 eventType = nextNoWhitespace(xpp); 532 } 533 next(xpp); 534 parseElementClose(res); 535 return res; 536 } 537 538 protected boolean parseCDSHooksServicesServicesPrefetchComponentContent(int eventType, XmlPullParser xpp, CDSHooksServices.CDSHooksServicesServicesPrefetchComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 539 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("key")) { 540 res.setKeyElement(parseCode(xpp)); 541 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("value")) { 542 res.setValueElement(parseString(xpp)); 543 } else if (!parseBaseContent(eventType, xpp, res)){ //2 544 return false; 545 } 546 return true; 547 } 548 549 protected TestCases parseTestCases(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 550 TestCases res = new TestCases(); 551 next(xpp); 552 int eventType = nextNoWhitespace(xpp); 553 while (eventType != XmlPullParser.END_TAG) { 554 if (!parseTestCasesContent(eventType, xpp, res)) // 1 555 unknownContent(xpp); 556 eventType = nextNoWhitespace(xpp); 557 } 558 next(xpp); 559 parseElementClose(res); 560 return res; 561 } 562 563 protected boolean parseTestCasesContent(int eventType, XmlPullParser xpp, TestCases res) throws XmlPullParserException, IOException, FHIRFormatError { 564 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("url")) { 565 res.setUrlElement(parseUri(xpp)); 566 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("version")) { 567 res.setVersionElement(parseString(xpp)); 568 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) { 569 res.setNameElement(parseString(xpp)); 570 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) { 571 res.setDescriptionElement(parseMarkdown(xpp)); 572 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("runner")) { 573 res.setRunnerElement(parseUrl(xpp)); 574 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) { 575 res.getMode().add(parseTestCasesModeComponent(xpp)); 576 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("suite")) { 577 res.getSuite().add(parseTestCasesSuiteComponent(xpp)); 578 } else if (!parseResourceContent(eventType, xpp, res)){ //2 579 return false; 580 } 581 return true; 582 } 583 584 protected TestCases.TestCasesModeComponent parseTestCasesModeComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 585 TestCases.TestCasesModeComponent res = new TestCases.TestCasesModeComponent(); 586 next(xpp); 587 int eventType = nextNoWhitespace(xpp); 588 while (eventType != XmlPullParser.END_TAG) { 589 if (!parseTestCasesModeComponentContent(eventType, xpp, res)) // 1 590 unknownContent(xpp); 591 eventType = nextNoWhitespace(xpp); 592 } 593 next(xpp); 594 parseElementClose(res); 595 return res; 596 } 597 598 protected boolean parseTestCasesModeComponentContent(int eventType, XmlPullParser xpp, TestCases.TestCasesModeComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 599 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("code")) { 600 res.setCodeElement(parseString(xpp)); 601 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) { 602 res.setDescriptionElement(parseString(xpp)); 603 } else if (!parseBaseContent(eventType, xpp, res)){ //2 604 return false; 605 } 606 return true; 607 } 608 609 protected TestCases.TestCasesSuiteComponent parseTestCasesSuiteComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 610 TestCases.TestCasesSuiteComponent res = new TestCases.TestCasesSuiteComponent(); 611 next(xpp); 612 int eventType = nextNoWhitespace(xpp); 613 while (eventType != XmlPullParser.END_TAG) { 614 if (!parseTestCasesSuiteComponentContent(eventType, xpp, res)) // 1 615 unknownContent(xpp); 616 eventType = nextNoWhitespace(xpp); 617 } 618 next(xpp); 619 parseElementClose(res); 620 return res; 621 } 622 623 protected boolean parseTestCasesSuiteComponentContent(int eventType, XmlPullParser xpp, TestCases.TestCasesSuiteComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 624 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) { 625 res.setNameElement(parseString(xpp)); 626 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) { 627 res.setDescriptionElement(parseString(xpp)); 628 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) { 629 res.setModeElement(parseCode(xpp)); 630 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) { 631 res.getResource().add(parseTestCasesSuiteResourceComponent(xpp)); 632 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameter")) { 633 res.getParameter().add(parseTestCasesSuiteParameterComponent(xpp)); 634 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("test")) { 635 res.getTest().add(parseTestCasesSuiteTestComponent(xpp)); 636 } else if (!parseBaseContent(eventType, xpp, res)){ //2 637 return false; 638 } 639 return true; 640 } 641 642 protected TestCases.TestCasesSuiteResourceComponent parseTestCasesSuiteResourceComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 643 TestCases.TestCasesSuiteResourceComponent res = new TestCases.TestCasesSuiteResourceComponent(); 644 next(xpp); 645 int eventType = nextNoWhitespace(xpp); 646 while (eventType != XmlPullParser.END_TAG) { 647 if (!parseTestCasesSuiteResourceComponentContent(eventType, xpp, res)) // 1 648 unknownContent(xpp); 649 eventType = nextNoWhitespace(xpp); 650 } 651 next(xpp); 652 parseElementClose(res); 653 return res; 654 } 655 656 protected boolean parseTestCasesSuiteResourceComponentContent(int eventType, XmlPullParser xpp, TestCases.TestCasesSuiteResourceComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 657 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) { 658 res.setNameElement(parseString(xpp)); 659 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("file")) { 660 res.setFileElement(parseString(xpp)); 661 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("resource")) { 662 res.setResource(parseResourceContained(xpp)); 663 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) { 664 res.setModeElement(parseCode(xpp)); 665 } else if (!parseBaseContent(eventType, xpp, res)){ //2 666 return false; 667 } 668 return true; 669 } 670 671 protected TestCases.TestCasesSuiteParameterComponent parseTestCasesSuiteParameterComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 672 TestCases.TestCasesSuiteParameterComponent res = new TestCases.TestCasesSuiteParameterComponent(); 673 next(xpp); 674 int eventType = nextNoWhitespace(xpp); 675 while (eventType != XmlPullParser.END_TAG) { 676 if (!parseTestCasesSuiteParameterComponentContent(eventType, xpp, res)) // 1 677 unknownContent(xpp); 678 eventType = nextNoWhitespace(xpp); 679 } 680 next(xpp); 681 parseElementClose(res); 682 return res; 683 } 684 685 protected boolean parseTestCasesSuiteParameterComponentContent(int eventType, XmlPullParser xpp, TestCases.TestCasesSuiteParameterComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 686 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) { 687 res.setNameElement(parseString(xpp)); 688 } else if (eventType == XmlPullParser.START_TAG && nameIsTypeName(xpp, "value")) { 689 res.setValue(parseType("value", xpp)); 690 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) { 691 res.setModeElement(parseCode(xpp)); 692 } else if (!parseBaseContent(eventType, xpp, res)){ //2 693 return false; 694 } 695 return true; 696 } 697 698 protected TestCases.TestCasesSuiteTestComponent parseTestCasesSuiteTestComponent(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 699 TestCases.TestCasesSuiteTestComponent res = new TestCases.TestCasesSuiteTestComponent(); 700 next(xpp); 701 int eventType = nextNoWhitespace(xpp); 702 while (eventType != XmlPullParser.END_TAG) { 703 if (!parseTestCasesSuiteTestComponentContent(eventType, xpp, res)) // 1 704 unknownContent(xpp); 705 eventType = nextNoWhitespace(xpp); 706 } 707 next(xpp); 708 parseElementClose(res); 709 return res; 710 } 711 712 protected boolean parseTestCasesSuiteTestComponentContent(int eventType, XmlPullParser xpp, TestCases.TestCasesSuiteTestComponent res) throws XmlPullParserException, IOException, FHIRFormatError { 713 if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("name")) { 714 res.setNameElement(parseString(xpp)); 715 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("description")) { 716 res.setDescriptionElement(parseString(xpp)); 717 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("operation")) { 718 res.setOperationElement(parseCode(xpp)); 719 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("mode")) { 720 res.setModeElement(parseString(xpp)); 721 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("parameter")) { 722 res.getParameter().add(parseTestCasesSuiteParameterComponent(xpp)); 723 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("input")) { 724 res.getInput().add(parseTestCasesSuiteResourceComponent(xpp)); 725 } else if (eventType == XmlPullParser.START_TAG && xpp.getName().equals("output")) { 726 res.getOutput().add(parseTestCasesSuiteResourceComponent(xpp)); 727 } else if (!parseBaseContent(eventType, xpp, res)){ //2 728 return false; 729 } 730 return true; 731 } 732 733 734 735 @Override 736 protected Resource parseResource(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 737 if (xpp == null) { 738 throw new IOException("xpp == null!"); 739 } else if (xpp.getName().equals("TestCases")) { 740 return parseTestCases(xpp); 741 742 } else { 743 throw new FHIRFormatError("Unknown resource type "+xpp.getName()+""); 744 } 745 } 746 747 protected DataType parseType(String prefix, XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError { 748 if (prefix == null) { 749 throw new IOException("prefix == null!"); 750 } else if (xpp == null) { 751 throw new IOException("xpp == null!"); 752 } else if (xpp.getName().equals(prefix+"Date")) { 753 return parseDate(xpp); 754 } else if (xpp.getName().equals(prefix+"DateTime")) { 755 return parseDateTime(xpp); 756 } else if (xpp.getName().equals(prefix+"Code")) { 757 return parseCode(xpp); 758 } else if (xpp.getName().equals(prefix+"String")) { 759 return parseString(xpp); 760 } else if (xpp.getName().equals(prefix+"Integer")) { 761 return parseInteger(xpp); 762 } else if (xpp.getName().equals(prefix+"Integer64")) { 763 return parseInteger64(xpp); 764 } else if (xpp.getName().equals(prefix+"Oid")) { 765 return parseOid(xpp); 766 } else if (xpp.getName().equals(prefix+"Canonical")) { 767 return parseCanonical(xpp); 768 } else if (xpp.getName().equals(prefix+"Uri")) { 769 return parseUri(xpp); 770 } else if (xpp.getName().equals(prefix+"Uuid")) { 771 return parseUuid(xpp); 772 } else if (xpp.getName().equals(prefix+"Url")) { 773 return parseUrl(xpp); 774 } else if (xpp.getName().equals(prefix+"Instant")) { 775 return parseInstant(xpp); 776 } else if (xpp.getName().equals(prefix+"Boolean")) { 777 return parseBoolean(xpp); 778 } else if (xpp.getName().equals(prefix+"Base64Binary")) { 779 return parseBase64Binary(xpp); 780 } else if (xpp.getName().equals(prefix+"UnsignedInt")) { 781 return parseUnsignedInt(xpp); 782 } else if (xpp.getName().equals(prefix+"Markdown")) { 783 return parseMarkdown(xpp); 784 } else if (xpp.getName().equals(prefix+"Time")) { 785 return parseTime(xpp); 786 } else if (xpp.getName().equals(prefix+"Id")) { 787 return parseId(xpp); 788 } else if (xpp.getName().equals(prefix+"PositiveInt")) { 789 return parsePositiveInt(xpp); 790 } else if (xpp.getName().equals(prefix+"Decimal")) { 791 return parseDecimal(xpp); 792 793 } else { 794 throw new FHIRFormatError("Unknown type "+xpp.getName()); 795 } 796 } 797 798 protected DataType parseType(XmlPullParser xpp, String type) throws XmlPullParserException, IOException, FHIRFormatError { 799 if (type == null) { 800 throw new IOException("type == null!"); 801 } else if (xpp == null) { 802 throw new IOException("xpp == null!"); 803 } else if (type.equals("date")) { 804 return parseDate(xpp); 805 } else if (type.equals("dateTime")) { 806 return parseDateTime(xpp); 807 } else if (type.equals("code")) { 808 return parseCode(xpp); 809 } else if (type.equals("string")) { 810 return parseString(xpp); 811 } else if (type.equals("integer")) { 812 return parseInteger(xpp); 813 } else if (type.equals("integer64")) { 814 return parseInteger64(xpp); 815 } else if (type.equals("oid")) { 816 return parseOid(xpp); 817 } else if (type.equals("canonical")) { 818 return parseCanonical(xpp); 819 } else if (type.equals("uri")) { 820 return parseUri(xpp); 821 } else if (type.equals("uuid")) { 822 return parseUuid(xpp); 823 } else if (type.equals("url")) { 824 return parseUrl(xpp); 825 } else if (type.equals("instant")) { 826 return parseInstant(xpp); 827 } else if (type.equals("boolean")) { 828 return parseBoolean(xpp); 829 } else if (type.equals("base64Binary")) { 830 return parseBase64Binary(xpp); 831 } else if (type.equals("unsignedInt")) { 832 return parseUnsignedInt(xpp); 833 } else if (type.equals("markdown")) { 834 return parseMarkdown(xpp); 835 } else if (type.equals("time")) { 836 return parseTime(xpp); 837 } else if (type.equals("id")) { 838 return parseId(xpp); 839 } else if (type.equals("positiveInt")) { 840 return parsePositiveInt(xpp); 841 } else if (type.equals("decimal")) { 842 return parseDecimal(xpp); 843 844 } else { 845 throw new FHIRFormatError("Unknown type "+type); 846 } 847 } 848 849 public Base parseFragment(XmlPullParser xpp, String type) throws XmlPullParserException, IOException, FHIRFormatError { 850 if (type == null) { 851 throw new IOException("type == null!"); 852 } else if (xpp == null) { 853 throw new IOException("xpp == null!"); 854 } else if (type.equals("CDSHookOrderSelectContext")) { 855 return parseCDSHookOrderSelectContext(xpp); 856 } else if (type.equals("CDSHookOrderSignContext")) { 857 return parseCDSHookOrderSignContext(xpp); 858 } else if (type.equals("CDSHookPatientViewContext")) { 859 return parseCDSHookPatientViewContext(xpp); 860 } else if (type.equals("CDSHooksExtensions")) { 861 return parseCDSHooksExtensions(xpp); 862 } else if (type.equals("CDSHooksRequest")) { 863 return parseCDSHooksRequest(xpp); 864 } else if (type.equals("CDSHooksResponse")) { 865 return parseCDSHooksResponse(xpp); 866 } else if (type.equals("CDSHooksServices")) { 867 return parseCDSHooksServices(xpp); 868 } else if (type.equals("TestCases")) { 869 return parseTestCases(xpp); 870 871 } else if (type.equals("date")) { 872 return parseDate(xpp); 873 } else if (type.equals("dateTime")) { 874 return parseDateTime(xpp); 875 } else if (type.equals("code")) { 876 return parseCode(xpp); 877 } else if (type.equals("string")) { 878 return parseString(xpp); 879 } else if (type.equals("integer")) { 880 return parseInteger(xpp); 881 } else if (type.equals("integer64")) { 882 return parseInteger64(xpp); 883 } else if (type.equals("oid")) { 884 return parseOid(xpp); 885 } else if (type.equals("canonical")) { 886 return parseCanonical(xpp); 887 } else if (type.equals("uri")) { 888 return parseUri(xpp); 889 } else if (type.equals("uuid")) { 890 return parseUuid(xpp); 891 } else if (type.equals("url")) { 892 return parseUrl(xpp); 893 } else if (type.equals("instant")) { 894 return parseInstant(xpp); 895 } else if (type.equals("boolean")) { 896 return parseBoolean(xpp); 897 } else if (type.equals("base64Binary")) { 898 return parseBase64Binary(xpp); 899 } else if (type.equals("unsignedInt")) { 900 return parseUnsignedInt(xpp); 901 } else if (type.equals("markdown")) { 902 return parseMarkdown(xpp); 903 } else if (type.equals("time")) { 904 return parseTime(xpp); 905 } else if (type.equals("id")) { 906 return parseId(xpp); 907 } else if (type.equals("positiveInt")) { 908 return parsePositiveInt(xpp); 909 } else if (type.equals("decimal")) { 910 return parseDecimal(xpp); 911 } else { 912 throw new FHIRFormatError("Unknown type "+type); 913 } 914 } 915 916 private boolean nameIsTypeName(XmlPullParser xpp, String prefix) throws IOException { 917 if (prefix == null) { 918 throw new IOException("prefix == null!"); 919 } else if (xpp == null) { 920 throw new IOException("xpp == null!"); 921 } else if (xpp.getName().equals(prefix+"CDSHookOrderSelectContext")) { 922 return true; 923 } else if (xpp.getName().equals(prefix+"CDSHookOrderSignContext")) { 924 return true; 925 } else if (xpp.getName().equals(prefix+"CDSHookPatientViewContext")) { 926 return true; 927 } else if (xpp.getName().equals(prefix+"CDSHooksExtensions")) { 928 return true; 929 } else if (xpp.getName().equals(prefix+"CDSHooksRequest")) { 930 return true; 931 } else if (xpp.getName().equals(prefix+"CDSHooksResponse")) { 932 return true; 933 } else if (xpp.getName().equals(prefix+"CDSHooksServices")) { 934 return true; 935 } else if (xpp.getName().equals(prefix+"TestCases")) { 936 return true; 937 938 } else if (xpp.getName().equals(prefix+"Date")) { 939 return true; 940 } else if (xpp.getName().equals(prefix+"DateTime")) { 941 return true; 942 } else if (xpp.getName().equals(prefix+"Code")) { 943 return true; 944 } else if (xpp.getName().equals(prefix+"String")) { 945 return true; 946 } else if (xpp.getName().equals(prefix+"Integer")) { 947 return true; 948 } else if (xpp.getName().equals(prefix+"Integer64")) { 949 return true; 950 } else if (xpp.getName().equals(prefix+"Oid")) { 951 return true; 952 } else if (xpp.getName().equals(prefix+"Canonical")) { 953 return true; 954 } else if (xpp.getName().equals(prefix+"Uri")) { 955 return true; 956 } else if (xpp.getName().equals(prefix+"Uuid")) { 957 return true; 958 } else if (xpp.getName().equals(prefix+"Url")) { 959 return true; 960 } else if (xpp.getName().equals(prefix+"Instant")) { 961 return true; 962 } else if (xpp.getName().equals(prefix+"Boolean")) { 963 return true; 964 } else if (xpp.getName().equals(prefix+"Base64Binary")) { 965 return true; 966 } else if (xpp.getName().equals(prefix+"UnsignedInt")) { 967 return true; 968 } else if (xpp.getName().equals(prefix+"Markdown")) { 969 return true; 970 } else if (xpp.getName().equals(prefix+"Time")) { 971 return true; 972 } else if (xpp.getName().equals(prefix+"Id")) { 973 return true; 974 } else if (xpp.getName().equals(prefix+"PositiveInt")) { 975 return true; 976 } else if (xpp.getName().equals(prefix+"Decimal")) { 977 return true; 978 } else { 979 return false; 980 } 981 } 982 983 @Override 984 protected DataType parseAnyType(XmlPullParser xpp, String type) throws XmlPullParserException, IOException, FHIRFormatError { 985 return parseType(xpp, type); 986 } 987 988 989//----------------- Composer ------------------------------------------------------------------------------------------- 990 991 protected void composeCDSHookContextElements(CDSHookContext element) throws IOException { 992 composeBaseElements(element); 993 } 994 995 protected void composeCDSHooksElementElements(CDSHooksElement element) throws IOException { 996 composeBaseElements(element); 997 if (element.hasExtension()) { 998 composeCDSHooksExtensions("extension", element.getExtension()); 999 } 1000 } 1001 1002 protected void composeCDSHookOrderSelectContext(String name, CDSHookOrderSelectContext element) throws IOException { 1003 if (element != null) { 1004 xml.enter(FHIR_NS, name); 1005 composeCDSHookOrderSelectContextElements(element); 1006 composeElementClose(element); 1007 xml.exit(FHIR_NS, name); 1008 } 1009 } 1010 1011 protected void composeCDSHookOrderSelectContextElements(CDSHookOrderSelectContext element) throws IOException { 1012 composeCDSHookContextElements(element); 1013 if (element.hasUserIdElement()) { 1014 composeUrl("userId", element.getUserIdElement()); 1015 } 1016 if (element.hasPatientIdElement()) { 1017 composeId("patientId", element.getPatientIdElement()); 1018 } 1019 if (element.hasEncounterIdElement()) { 1020 composeId("encounterId", element.getEncounterIdElement()); 1021 } 1022 if (element.hasSelections()) { 1023 for (UriType e : element.getSelections()) 1024 composeUri("selections", e); // a 1025 } 1026 if (element.hasDraftOrders()) { 1027 composeBundle("draftOrders", element.getDraftOrders()); 1028 } 1029 } 1030 1031 protected void composeCDSHookOrderSignContext(String name, CDSHookOrderSignContext element) throws IOException { 1032 if (element != null) { 1033 xml.enter(FHIR_NS, name); 1034 composeCDSHookOrderSignContextElements(element); 1035 composeElementClose(element); 1036 xml.exit(FHIR_NS, name); 1037 } 1038 } 1039 1040 protected void composeCDSHookOrderSignContextElements(CDSHookOrderSignContext element) throws IOException { 1041 composeCDSHookContextElements(element); 1042 if (element.hasUserIdElement()) { 1043 composeUrl("userId", element.getUserIdElement()); 1044 } 1045 if (element.hasPatientIdElement()) { 1046 composeId("patientId", element.getPatientIdElement()); 1047 } 1048 if (element.hasEncounterIdElement()) { 1049 composeId("encounterId", element.getEncounterIdElement()); 1050 } 1051 if (element.hasDraftOrders()) { 1052 composeBundle("draftOrders", element.getDraftOrders()); 1053 } 1054 } 1055 1056 protected void composeCDSHookPatientViewContext(String name, CDSHookPatientViewContext element) throws IOException { 1057 if (element != null) { 1058 xml.enter(FHIR_NS, name); 1059 composeCDSHookPatientViewContextElements(element); 1060 composeElementClose(element); 1061 xml.exit(FHIR_NS, name); 1062 } 1063 } 1064 1065 protected void composeCDSHookPatientViewContextElements(CDSHookPatientViewContext element) throws IOException { 1066 composeCDSHookContextElements(element); 1067 if (element.hasUserIdElement()) { 1068 composeUrl("userId", element.getUserIdElement()); 1069 } 1070 if (element.hasPatientIdElement()) { 1071 composeId("patientId", element.getPatientIdElement()); 1072 } 1073 if (element.hasEncounterIdElement()) { 1074 composeId("encounterId", element.getEncounterIdElement()); 1075 } 1076 } 1077 1078 protected void composeCDSHooksExtensions(String name, CDSHooksExtensions element) throws IOException { 1079 if (element != null) { 1080 xml.enter(FHIR_NS, name); 1081 composeCDSHooksExtensionsElements(element); 1082 composeElementClose(element); 1083 xml.exit(FHIR_NS, name); 1084 } 1085 } 1086 1087 protected void composeCDSHooksExtensionsElements(CDSHooksExtensions element) throws IOException { 1088 composeElementElements(element); 1089 } 1090 1091 protected void composeCDSHooksRequest(String name, CDSHooksRequest element) throws IOException { 1092 if (element != null) { 1093 xml.enter(FHIR_NS, name); 1094 composeCDSHooksRequestElements(element); 1095 composeElementClose(element); 1096 xml.exit(FHIR_NS, name); 1097 } 1098 } 1099 1100 protected void composeCDSHooksRequestElements(CDSHooksRequest element) throws IOException { 1101 composeCDSHooksElementElements(element); 1102 if (element.hasHookElement()) { 1103 composeCode("hook", element.getHookElement()); 1104 } 1105 if (element.hasHookInstanceElement()) { 1106 composeUuid("hookInstance", element.getHookInstanceElement()); 1107 } 1108 if (element.hasFhirServerElement()) { 1109 composeUrl("fhirServer", element.getFhirServerElement()); 1110 } 1111 if (element.hasFhirAuthorization()) { 1112 composeCDSHooksRequestFhirAuthorizationComponent("fhirAuthorization", element.getFhirAuthorization()); 1113 } 1114 if (element.hasContext()) { 1115 composeCDSHookContext("context", element.getContext()); 1116 } 1117 if (element.hasPrefetch()) { 1118 for (CDSHooksRequest.CDSHooksRequestPrefetchComponent e : element.getPrefetch()) 1119 composeCDSHooksRequestPrefetchComponent("prefetch", e); // a 1120 } 1121 } 1122 1123 protected void composeCDSHookContext(String name, CDSHookContext element) throws IOException { 1124 if (element instanceof CDSHookPatientViewContext) { 1125 composeCDSHookPatientViewContext(name, (CDSHookPatientViewContext) element); 1126 } else if (element instanceof CDSHookOrderSignContext) { 1127 composeCDSHookOrderSignContext(name, (CDSHookOrderSignContext) element); 1128 } else if (element instanceof CDSHookOrderSelectContext) { 1129 composeCDSHookOrderSelectContext(name, (CDSHookOrderSelectContext) element); 1130 } else { 1131 throw new FHIRFormatError("Unable to compose CDSHookContext: Unexpected type "+element.getClass().getName()); 1132 } 1133 } 1134 1135 protected void composeCDSHooksRequestFhirAuthorizationComponent(String name, CDSHooksRequest.CDSHooksRequestFhirAuthorizationComponent element) throws IOException { 1136 if (element != null) { 1137 xml.enter(FHIR_NS, name); 1138 composeCDSHooksRequestFhirAuthorizationComponentElements(element); 1139 composeElementClose(element); 1140 xml.exit(FHIR_NS, name); 1141 } 1142 } 1143 1144 protected void composeCDSHooksRequestFhirAuthorizationComponentElements(CDSHooksRequest.CDSHooksRequestFhirAuthorizationComponent element) throws IOException { 1145 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementElements(element); 1146 if (element.hasAccessTokenElement()) { 1147 composeString("accessToken", element.getAccessTokenElement()); 1148 } 1149 if (element.hasTokenTypeElement()) { 1150 composeCode("tokenType", element.getTokenTypeElement()); 1151 } 1152 if (element.hasExpiresInElement()) { 1153 composeInteger("expiresIn", element.getExpiresInElement()); 1154 } 1155 if (element.hasScopeElement()) { 1156 composeString("scope", element.getScopeElement()); 1157 } 1158 if (element.hasSubjectElement()) { 1159 composeString("subject", element.getSubjectElement()); 1160 } 1161 if (element.hasPatientElement()) { 1162 composeId("patient", element.getPatientElement()); 1163 } 1164 } 1165 1166 protected void composeCDSHooksRequestPrefetchComponent(String name, CDSHooksRequest.CDSHooksRequestPrefetchComponent element) throws IOException { 1167 if (element != null) { 1168 xml.enter(FHIR_NS, name); 1169 composeCDSHooksRequestPrefetchComponentElements(element); 1170 composeElementClose(element); 1171 xml.exit(FHIR_NS, name); 1172 } 1173 } 1174 1175 protected void composeCDSHooksRequestPrefetchComponentElements(CDSHooksRequest.CDSHooksRequestPrefetchComponent element) throws IOException { 1176 composeBaseElements(element); 1177 if (element.hasKeyElement()) { 1178 composeCode("key", element.getKeyElement()); 1179 } 1180 if (element.hasValue()) { 1181 xml.enter(FHIR_NS, "value"); 1182 composeResource(element.getValue()); 1183 xml.exit(FHIR_NS, "value"); 1184 } 1185 } 1186 1187 protected void composeCDSHooksResponse(String name, CDSHooksResponse element) throws IOException { 1188 if (element != null) { 1189 xml.enter(FHIR_NS, name); 1190 composeCDSHooksResponseElements(element); 1191 composeElementClose(element); 1192 xml.exit(FHIR_NS, name); 1193 } 1194 } 1195 1196 protected void composeCDSHooksResponseElements(CDSHooksResponse element) throws IOException { 1197 composeCDSHooksElementElements(element); 1198 if (element.hasCards()) { 1199 for (CDSHooksResponse.CDSHooksResponseCardsComponent e : element.getCards()) 1200 composeCDSHooksResponseCardsComponent("cards", e); // a 1201 } 1202 if (element.hasSystemActions()) { 1203 for (CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent e : element.getSystemActions()) 1204 composeCDSHooksResponseCardsSuggestionsActionsComponent("systemActions", e); // a 1205 } 1206 } 1207 1208 protected void composeCDSHooksResponseCardsComponent(String name, CDSHooksResponse.CDSHooksResponseCardsComponent element) throws IOException { 1209 if (element != null) { 1210 xml.enter(FHIR_NS, name); 1211 composeCDSHooksResponseCardsComponentElements(element); 1212 composeElementClose(element); 1213 xml.exit(FHIR_NS, name); 1214 } 1215 } 1216 1217 protected void composeCDSHooksResponseCardsComponentElements(CDSHooksResponse.CDSHooksResponseCardsComponent element) throws IOException { 1218 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementElements(element); 1219 if (element.hasUuidElement()) { 1220 composeUuid("uuid", element.getUuidElement()); 1221 } 1222 if (element.hasSummaryElement()) { 1223 composeString("summary", element.getSummaryElement()); 1224 } 1225 if (element.hasDetailElement()) { 1226 composeMarkdown("detail", element.getDetailElement()); 1227 } 1228 if (element.hasIndicatorElement()) 1229 composeEnumeration("indicator", element.getIndicatorElement(), new CDSHooksResponse.CDSIndicatorCodesVSEnumFactory()); 1230 if (element.hasSource()) { 1231 composeCDSHooksResponseCardsSourceComponent("source", element.getSource()); 1232 } 1233 if (element.hasSuggestions()) { 1234 for (CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent e : element.getSuggestions()) 1235 composeCDSHooksResponseCardsSuggestionsComponent("suggestions", e); // a 1236 } 1237 if (element.hasSelectionBehaviorElement()) 1238 composeEnumeration("selectionBehavior", element.getSelectionBehaviorElement(), new CDSHooksResponse.CDSSelectionBehaviorCodesVSEnumFactory()); 1239 if (element.hasOverrideReasons()) { 1240 for (Coding e : element.getOverrideReasons()) 1241 composeCoding("overrideReasons", e); // a 1242 } 1243 if (element.hasLinks()) { 1244 for (CDSHooksResponse.CDSHooksResponseCardsLinksComponent e : element.getLinks()) 1245 composeCDSHooksResponseCardsLinksComponent("links", e); // a 1246 } 1247 } 1248 1249 protected void composeCDSHooksResponseCardsSourceComponent(String name, CDSHooksResponse.CDSHooksResponseCardsSourceComponent element) throws IOException { 1250 if (element != null) { 1251 xml.enter(FHIR_NS, name); 1252 composeCDSHooksResponseCardsSourceComponentElements(element); 1253 composeElementClose(element); 1254 xml.exit(FHIR_NS, name); 1255 } 1256 } 1257 1258 protected void composeCDSHooksResponseCardsSourceComponentElements(CDSHooksResponse.CDSHooksResponseCardsSourceComponent element) throws IOException { 1259 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementElements(element); 1260 if (element.hasLabelElement()) { 1261 composeString("label", element.getLabelElement()); 1262 } 1263 if (element.hasUrlElement()) { 1264 composeUrl("url", element.getUrlElement()); 1265 } 1266 if (element.hasIconElement()) { 1267 composeUrl("icon", element.getIconElement()); 1268 } 1269 if (element.hasTopic()) { 1270 composeCoding("topic", element.getTopic()); 1271 } 1272 } 1273 1274 protected void composeCDSHooksResponseCardsSuggestionsComponent(String name, CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent element) throws IOException { 1275 if (element != null) { 1276 xml.enter(FHIR_NS, name); 1277 composeCDSHooksResponseCardsSuggestionsComponentElements(element); 1278 composeElementClose(element); 1279 xml.exit(FHIR_NS, name); 1280 } 1281 } 1282 1283 protected void composeCDSHooksResponseCardsSuggestionsComponentElements(CDSHooksResponse.CDSHooksResponseCardsSuggestionsComponent element) throws IOException { 1284 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementElements(element); 1285 if (element.hasLabelElement()) { 1286 composeString("label", element.getLabelElement()); 1287 } 1288 if (element.hasUuidElement()) { 1289 composeUuid("uuid", element.getUuidElement()); 1290 } 1291 if (element.hasIsRecommendedElement()) { 1292 composeBoolean("isRecommended", element.getIsRecommendedElement()); 1293 } 1294 if (element.hasActions()) { 1295 for (CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent e : element.getActions()) 1296 composeCDSHooksResponseCardsSuggestionsActionsComponent("actions", e); // a 1297 } 1298 } 1299 1300 protected void composeCDSHooksResponseCardsSuggestionsActionsComponent(String name, CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent element) throws IOException { 1301 if (element != null) { 1302 xml.enter(FHIR_NS, name); 1303 composeCDSHooksResponseCardsSuggestionsActionsComponentElements(element); 1304 composeElementClose(element); 1305 xml.exit(FHIR_NS, name); 1306 } 1307 } 1308 1309 protected void composeCDSHooksResponseCardsSuggestionsActionsComponentElements(CDSHooksResponse.CDSHooksResponseCardsSuggestionsActionsComponent element) throws IOException { 1310 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementElements(element); 1311 if (element.hasTypeElement()) 1312 composeEnumeration("type", element.getTypeElement(), new CDSHooksResponse.CDSActionTypeCodesVSEnumFactory()); 1313 if (element.hasDescriptionElement()) { 1314 composeString("description", element.getDescriptionElement()); 1315 } 1316 if (element.hasResource()) { 1317 xml.enter(FHIR_NS, "resource"); 1318 composeResource(element.getResource()); 1319 xml.exit(FHIR_NS, "resource"); 1320 } 1321 if (element.hasResourceIdElement()) { 1322 composeUrl("resourceId", element.getResourceIdElement()); 1323 } 1324 } 1325 1326 protected void composeCDSHooksResponseCardsLinksComponent(String name, CDSHooksResponse.CDSHooksResponseCardsLinksComponent element) throws IOException { 1327 if (element != null) { 1328 xml.enter(FHIR_NS, name); 1329 composeCDSHooksResponseCardsLinksComponentElements(element); 1330 composeElementClose(element); 1331 xml.exit(FHIR_NS, name); 1332 } 1333 } 1334 1335 protected void composeCDSHooksResponseCardsLinksComponentElements(CDSHooksResponse.CDSHooksResponseCardsLinksComponent element) throws IOException { 1336 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementElements(element); 1337 if (element.hasLabelElement()) { 1338 composeString("label", element.getLabelElement()); 1339 } 1340 if (element.hasUrlElement()) { 1341 composeUrl("url", element.getUrlElement()); 1342 } 1343 if (element.hasTypeElement()) 1344 composeEnumeration("type", element.getTypeElement(), new CDSHooksResponse.CDSLinkTypeCodesVSEnumFactory()); 1345 if (element.hasAppContextElement()) { 1346 composeString("appContext", element.getAppContextElement()); 1347 } 1348 } 1349 1350 protected void composeCDSHooksServices(String name, CDSHooksServices element) throws IOException { 1351 if (element != null) { 1352 xml.enter(FHIR_NS, name); 1353 composeCDSHooksServicesElements(element); 1354 composeElementClose(element); 1355 xml.exit(FHIR_NS, name); 1356 } 1357 } 1358 1359 protected void composeCDSHooksServicesElements(CDSHooksServices element) throws IOException { 1360 composeCDSHooksElementElements(element); 1361 if (element.hasServices()) { 1362 for (CDSHooksServices.CDSHooksServicesServicesComponent e : element.getServices()) 1363 composeCDSHooksServicesServicesComponent("services", e); // a 1364 } 1365 } 1366 1367 protected void composeCDSHooksServicesServicesComponent(String name, CDSHooksServices.CDSHooksServicesServicesComponent element) throws IOException { 1368 if (element != null) { 1369 xml.enter(FHIR_NS, name); 1370 composeCDSHooksServicesServicesComponentElements(element); 1371 composeElementClose(element); 1372 xml.exit(FHIR_NS, name); 1373 } 1374 } 1375 1376 protected void composeCDSHooksServicesServicesComponentElements(CDSHooksServices.CDSHooksServicesServicesComponent element) throws IOException { 1377 composehttp://hl7.org/fhir/tools/StructureDefinition/CDSHooksElementElements(element); 1378 if (element.hasHookElement()) { 1379 composeString("hook", element.getHookElement()); 1380 } 1381 if (element.hasTitleElement()) { 1382 composeString("title", element.getTitleElement()); 1383 } 1384 if (element.hasIdElement()) { 1385 composeCode("id", element.getIdElement()); 1386 } 1387 if (element.hasDescriptionElement()) { 1388 composeString("description", element.getDescriptionElement()); 1389 } 1390 if (element.hasUsageRequirementsElement()) { 1391 composeString("usageRequirements", element.getUsageRequirementsElement()); 1392 } 1393 if (element.hasPrefetch()) { 1394 for (CDSHooksServices.CDSHooksServicesServicesPrefetchComponent e : element.getPrefetch()) 1395 composeCDSHooksServicesServicesPrefetchComponent("prefetch", e); // a 1396 } 1397 } 1398 1399 protected void composeCDSHooksServicesServicesPrefetchComponent(String name, CDSHooksServices.CDSHooksServicesServicesPrefetchComponent element) throws IOException { 1400 if (element != null) { 1401 xml.enter(FHIR_NS, name); 1402 composeCDSHooksServicesServicesPrefetchComponentElements(element); 1403 composeElementClose(element); 1404 xml.exit(FHIR_NS, name); 1405 } 1406 } 1407 1408 protected void composeCDSHooksServicesServicesPrefetchComponentElements(CDSHooksServices.CDSHooksServicesServicesPrefetchComponent element) throws IOException { 1409 composeBaseElements(element); 1410 if (element.hasKeyElement()) { 1411 composeCode("key", element.getKeyElement()); 1412 } 1413 if (element.hasValueElement()) { 1414 composeString("value", element.getValueElement()); 1415 } 1416 } 1417 1418 protected void composeTestCases(String name, TestCases element) throws IOException { 1419 if (element != null) { 1420 xml.enter(FHIR_NS, name); 1421 composeTestCasesElements(element); 1422 composeElementClose(element); 1423 xml.exit(FHIR_NS, name); 1424 } 1425 } 1426 1427 protected void composeTestCasesElements(TestCases element) throws IOException { 1428 composeResourceElements(element); 1429 if (element.hasUrlElement()) { 1430 composeUri("url", element.getUrlElement()); 1431 } 1432 if (element.hasVersionElement()) { 1433 composeString("version", element.getVersionElement()); 1434 } 1435 if (element.hasNameElement()) { 1436 composeString("name", element.getNameElement()); 1437 } 1438 if (element.hasDescriptionElement()) { 1439 composeMarkdown("description", element.getDescriptionElement()); 1440 } 1441 if (element.hasRunnerElement()) { 1442 composeUrl("runner", element.getRunnerElement()); 1443 } 1444 if (element.hasMode()) { 1445 for (TestCases.TestCasesModeComponent e : element.getMode()) 1446 composeTestCasesModeComponent("mode", e); // a 1447 } 1448 if (element.hasSuite()) { 1449 for (TestCases.TestCasesSuiteComponent e : element.getSuite()) 1450 composeTestCasesSuiteComponent("suite", e); // a 1451 } 1452 } 1453 1454 protected void composeTestCasesModeComponent(String name, TestCases.TestCasesModeComponent element) throws IOException { 1455 if (element != null) { 1456 xml.enter(FHIR_NS, name); 1457 composeTestCasesModeComponentElements(element); 1458 composeElementClose(element); 1459 xml.exit(FHIR_NS, name); 1460 } 1461 } 1462 1463 protected void composeTestCasesModeComponentElements(TestCases.TestCasesModeComponent element) throws IOException { 1464 composeBaseElements(element); 1465 if (element.hasCodeElement()) { 1466 composeString("code", element.getCodeElement()); 1467 } 1468 if (element.hasDescriptionElement()) { 1469 composeString("description", element.getDescriptionElement()); 1470 } 1471 } 1472 1473 protected void composeTestCasesSuiteComponent(String name, TestCases.TestCasesSuiteComponent element) throws IOException { 1474 if (element != null) { 1475 xml.enter(FHIR_NS, name); 1476 composeTestCasesSuiteComponentElements(element); 1477 composeElementClose(element); 1478 xml.exit(FHIR_NS, name); 1479 } 1480 } 1481 1482 protected void composeTestCasesSuiteComponentElements(TestCases.TestCasesSuiteComponent element) throws IOException { 1483 composeBaseElements(element); 1484 if (element.hasNameElement()) { 1485 composeString("name", element.getNameElement()); 1486 } 1487 if (element.hasDescriptionElement()) { 1488 composeString("description", element.getDescriptionElement()); 1489 } 1490 if (element.hasModeElement()) { 1491 composeCode("mode", element.getModeElement()); 1492 } 1493 if (element.hasResource()) { 1494 for (TestCases.TestCasesSuiteResourceComponent e : element.getResource()) 1495 composeTestCasesSuiteResourceComponent("resource", e); // a 1496 } 1497 if (element.hasParameter()) { 1498 for (TestCases.TestCasesSuiteParameterComponent e : element.getParameter()) 1499 composeTestCasesSuiteParameterComponent("parameter", e); // a 1500 } 1501 if (element.hasTest()) { 1502 for (TestCases.TestCasesSuiteTestComponent e : element.getTest()) 1503 composeTestCasesSuiteTestComponent("test", e); // a 1504 } 1505 } 1506 1507 protected void composeTestCasesSuiteResourceComponent(String name, TestCases.TestCasesSuiteResourceComponent element) throws IOException { 1508 if (element != null) { 1509 xml.enter(FHIR_NS, name); 1510 composeTestCasesSuiteResourceComponentElements(element); 1511 composeElementClose(element); 1512 xml.exit(FHIR_NS, name); 1513 } 1514 } 1515 1516 protected void composeTestCasesSuiteResourceComponentElements(TestCases.TestCasesSuiteResourceComponent element) throws IOException { 1517 composeBaseElements(element); 1518 if (element.hasNameElement()) { 1519 composeString("name", element.getNameElement()); 1520 } 1521 if (element.hasFileElement()) { 1522 composeString("file", element.getFileElement()); 1523 } 1524 if (element.hasResource()) { 1525 xml.enter(FHIR_NS, "resource"); 1526 composeResource(element.getResource()); 1527 xml.exit(FHIR_NS, "resource"); 1528 } 1529 if (element.hasModeElement()) { 1530 composeCode("mode", element.getModeElement()); 1531 } 1532 } 1533 1534 protected void composeTestCasesSuiteParameterComponent(String name, TestCases.TestCasesSuiteParameterComponent element) throws IOException { 1535 if (element != null) { 1536 xml.enter(FHIR_NS, name); 1537 composeTestCasesSuiteParameterComponentElements(element); 1538 composeElementClose(element); 1539 xml.exit(FHIR_NS, name); 1540 } 1541 } 1542 1543 protected void composeTestCasesSuiteParameterComponentElements(TestCases.TestCasesSuiteParameterComponent element) throws IOException { 1544 composeBaseElements(element); 1545 if (element.hasNameElement()) { 1546 composeString("name", element.getNameElement()); 1547 } 1548 if (element.hasValue()) { 1549 composeType("value", element.getValue()); 1550 } if (element.hasModeElement()) { 1551 composeCode("mode", element.getModeElement()); 1552 } 1553 } 1554 1555 protected void composeTestCasesSuiteTestComponent(String name, TestCases.TestCasesSuiteTestComponent element) throws IOException { 1556 if (element != null) { 1557 xml.enter(FHIR_NS, name); 1558 composeTestCasesSuiteTestComponentElements(element); 1559 composeElementClose(element); 1560 xml.exit(FHIR_NS, name); 1561 } 1562 } 1563 1564 protected void composeTestCasesSuiteTestComponentElements(TestCases.TestCasesSuiteTestComponent element) throws IOException { 1565 composeBaseElements(element); 1566 if (element.hasNameElement()) { 1567 composeString("name", element.getNameElement()); 1568 } 1569 if (element.hasDescriptionElement()) { 1570 composeString("description", element.getDescriptionElement()); 1571 } 1572 if (element.hasOperationElement()) { 1573 composeCode("operation", element.getOperationElement()); 1574 } 1575 if (element.hasModeElement()) { 1576 composeString("mode", element.getModeElement()); 1577 } 1578 if (element.hasParameter()) { 1579 for (TestCases.TestCasesSuiteParameterComponent e : element.getParameter()) 1580 composeTestCasesSuiteParameterComponent("parameter", e); // a 1581 } 1582 if (element.hasInput()) { 1583 for (TestCases.TestCasesSuiteResourceComponent e : element.getInput()) 1584 composeTestCasesSuiteResourceComponent("input", e); // a 1585 } 1586 if (element.hasOutput()) { 1587 for (TestCases.TestCasesSuiteResourceComponent e : element.getOutput()) 1588 composeTestCasesSuiteResourceComponent("output", e); // a 1589 } 1590 } 1591 1592 1593 1594 @Override 1595 protected void composeResource(Resource resource) throws IOException { 1596 if (resource == null) { 1597 throw new IOException("resource == null"); 1598 } else if (resource instanceof TestCases) { 1599 composeTestCases("TestCases", (TestCases)resource); 1600 1601 } else { 1602 throw new Error("Unhandled resource type "+resource.getClass().getName()); 1603 } 1604 } 1605 1606 protected void composeResource(String name, Resource resource) throws IOException { 1607 if (name == null) { 1608 throw new IOException("name == null"); 1609 } else if (resource == null) { 1610 throw new IOException("resource == null"); 1611 } else if (resource instanceof TestCases) { 1612 composeTestCases(name, (TestCases)resource); 1613 1614 } else { 1615 throw new Error("Unhandled resource type "+resource.getClass().getName()); 1616 } 1617 } 1618 1619 protected void composeType(String prefix, DataType type) throws IOException { 1620 if (prefix == null) { 1621 throw new IOException("prefix == null"); 1622 } else if (type == null) { 1623 throw new IOException("type == null"); 1624 1625 } else if (type instanceof CodeType) { 1626 composeCode(prefix+"Code", (CodeType) type); 1627 } else if (type instanceof OidType) { 1628 composeOid(prefix+"Oid", (OidType) type); 1629 } else if (type instanceof CanonicalType) { 1630 composeCanonical(prefix+"Canonical", (CanonicalType) type); 1631 } else if (type instanceof UuidType) { 1632 composeUuid(prefix+"Uuid", (UuidType) type); 1633 } else if (type instanceof UrlType) { 1634 composeUrl(prefix+"Url", (UrlType) type); 1635 } else if (type instanceof UnsignedIntType) { 1636 composeUnsignedInt(prefix+"UnsignedInt", (UnsignedIntType) type); 1637 } else if (type instanceof MarkdownType) { 1638 composeMarkdown(prefix+"Markdown", (MarkdownType) type); 1639 } else if (type instanceof IdType) { 1640 composeId(prefix+"Id", (IdType) type); 1641 } else if (type instanceof PositiveIntType) { 1642 composePositiveInt(prefix+"PositiveInt", (PositiveIntType) type); 1643 } else if (type instanceof DateType) { 1644 composeDate(prefix+"Date", (DateType) type); 1645 } else if (type instanceof DateTimeType) { 1646 composeDateTime(prefix+"DateTime", (DateTimeType) type); 1647 } else if (type instanceof StringType) { 1648 composeString(prefix+"String", (StringType) type); 1649 } else if (type instanceof IntegerType) { 1650 composeInteger(prefix+"Integer", (IntegerType) type); 1651 } else if (type instanceof Integer64Type) { 1652 composeInteger64(prefix+"Integer64", (Integer64Type) type); 1653 } else if (type instanceof UriType) { 1654 composeUri(prefix+"Uri", (UriType) type); 1655 } else if (type instanceof InstantType) { 1656 composeInstant(prefix+"Instant", (InstantType) type); 1657 } else if (type instanceof BooleanType) { 1658 composeBoolean(prefix+"Boolean", (BooleanType) type); 1659 } else if (type instanceof Base64BinaryType) { 1660 composeBase64Binary(prefix+"Base64Binary", (Base64BinaryType) type); 1661 } else if (type instanceof TimeType) { 1662 composeTime(prefix+"Time", (TimeType) type); 1663 } else if (type instanceof DecimalType) { 1664 composeDecimal(prefix+"Decimal", (DecimalType) type); 1665 } else { 1666 throw new Error("Unhandled type "+type.fhirType()); 1667 } 1668 } 1669 1670}