001package org.hl7.fhir.r5.openehr;
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;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.exceptions.FHIRFormatError;
041
042import org.hl7.fhir.r5.formats.JsonCreator;
043import org.hl7.fhir.r5.formats.JsonParserBase;
044import org.hl7.fhir.r5.model.*;
045import org.hl7.fhir.utilities.Utilities;
046
047import com.google.gson.JsonArray;
048import com.google.gson.JsonObject;
049
050public class OpenehrJsonParser extends org.hl7.fhir.r5.formats.JsonParser {
051 
052  public OpenehrJsonParser(JsonCreator json) {
053    super();
054    this.json = json;
055  }
056
057  public OpenehrJsonParser(boolean allowUnknownContent, boolean allowComments) {
058    super();
059    setAllowUnknownContent(allowUnknownContent);
060    setAllowComments(allowComments);
061  }
062
063  public Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
064    if (!json.has("resourceType")) {
065      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
066    }
067    String t = json.get("resourceType").getAsString();
068    if (Utilities.noString(t)) {
069      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
070
071    } else {
072      throw new FHIRFormatError("Unknown/Unrecognised resource type '"+t+"' (in property 'resourceType')");
073    }
074  }
075
076  protected ACCESS_CONTROL_SETTINGS parseACCESS_CONTROL_SETTINGS(JsonObject json) throws IOException, FHIRFormatError {
077    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
078    String type = json.get("_type").getAsString();
079    switch (type) {
080    default: throw new FHIRException("Unsupported type '"+type+"'");
081    }
082  }
083
084  protected void parseACCESS_CONTROL_SETTINGSProperties(JsonObject json, ACCESS_CONTROL_SETTINGS res) throws IOException, FHIRFormatError {
085    parseBaseProperties(json, res);
086  }
087
088  protected ACTOR parseACTOR(JsonObject json) throws IOException, FHIRFormatError {
089    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
090    String type = json.get("_type").getAsString();
091    switch (type) {
092    case "AGENT": return parseAGENT(json);
093    case "GROUP": return parseGROUP(json);
094    case "PERSON": return parsePERSON(json);
095    case "ORGANISATION": return parseORGANISATION(json);
096    default: throw new FHIRException("Unsupported type '"+type+"'");
097    }
098  }
099
100  protected void parseACTORProperties(JsonObject json, ACTOR res) throws IOException, FHIRFormatError {
101    parsePARTYProperties(json, res);
102    if (json.has("languages")) {
103      JsonArray array = getJArray(json, "languages");
104      for (int i = 0; i < array.size(); i++) {
105        res.getLanguagesList().add(parseDV_TEXT(array.get(i).getAsJsonObject()));
106      }
107    };
108    if (json.has("roles")) {
109      JsonArray array = getJArray(json, "roles");
110      for (int i = 0; i < array.size(); i++) {
111        res.getRolesList().add(parsePARTY_REF(array.get(i).getAsJsonObject()));
112      }
113    };
114  }
115
116  protected AUTHORED_RESOURCE parseAUTHORED_RESOURCE(JsonObject json) throws IOException, FHIRFormatError {
117    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
118    String type = json.get("_type").getAsString();
119    switch (type) {
120    default: throw new FHIRException("Unsupported type '"+type+"'");
121    }
122  }
123
124  protected void parseAUTHORED_RESOURCEProperties(JsonObject json, AUTHORED_RESOURCE res) throws IOException, FHIRFormatError {
125    parseBaseProperties(json, res);
126    if (json.has("original_language"))
127      res.setOriginal_language(parseCODE_PHRASE(getJObject(json, "original_language")));
128    if (json.has("is_controlled"))
129      res.setIs_controlledElement(parseBoolean(json.get("is_controlled").getAsBoolean()));
130    if (json.has("_is_controlled"))
131      parseElementProperties(getJObject(json, "_is_controlled"), res.getIs_controlledElement());
132    if (json.has("translations")) {
133      JsonArray array = getJArray(json, "translations");
134      for (int i = 0; i < array.size(); i++) {
135        res.getTranslationsList().add(parseTRANSLATION_DETAILS(array.get(i).getAsJsonObject()));
136      }
137    };
138    if (json.has("description"))
139      res.setDescription(parseRESOURCE_DESCRIPTION(getJObject(json, "description")));
140    if (json.has("revision_history"))
141      res.setRevision_history(parseREVISION_HISTORY(getJObject(json, "revision_history")));
142  }
143
144  protected Any parseAny(JsonObject json) throws IOException, FHIRFormatError {
145    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
146    String type = json.get("_type").getAsString();
147    switch (type) {
148    case "EHR": return parseEHR(json);
149    default: throw new FHIRException("Unsupported type '"+type+"'");
150    }
151  }
152
153  protected void parseAnyProperties(JsonObject json, Any res) throws IOException, FHIRFormatError {
154    parseBaseProperties(json, res);
155  }
156
157  protected CARE_ENTRY parseCARE_ENTRY(JsonObject json) throws IOException, FHIRFormatError {
158    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
159    String type = json.get("_type").getAsString();
160    switch (type) {
161    case "INSTRUCTION": return parseINSTRUCTION(json);
162    case "OBSERVATION": return parseOBSERVATION(json);
163    case "ACTION": return parseACTION(json);
164    case "EVALUATION": return parseEVALUATION(json);
165    default: throw new FHIRException("Unsupported type '"+type+"'");
166    }
167  }
168
169  protected void parseCARE_ENTRYProperties(JsonObject json, CARE_ENTRY res) throws IOException, FHIRFormatError {
170    parseENTRYProperties(json, res);
171    if (json.has("protocol"))
172      res.setProtocol(parseITEM_STRUCTURE(getJObject(json, "protocol")));
173    if (json.has("guideline_id"))
174      res.setGuideline_id(parseOBJECT_REF(getJObject(json, "guideline_id")));
175  }
176
177  protected CONTENT_ITEM parseCONTENT_ITEM(JsonObject json) throws IOException, FHIRFormatError {
178    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
179    String type = json.get("_type").getAsString();
180    switch (type) {
181    case "SECTION": return parseSECTION(json);
182    default: throw new FHIRException("Unsupported type '"+type+"'");
183    }
184  }
185
186  protected void parseCONTENT_ITEMProperties(JsonObject json, CONTENT_ITEM res) throws IOException, FHIRFormatError {
187    parseLOCATABLEProperties(json, res);
188  }
189
190  protected DATA_STRUCTURE parseDATA_STRUCTURE(JsonObject json) throws IOException, FHIRFormatError {
191    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
192    String type = json.get("_type").getAsString();
193    switch (type) {
194    case "HISTORY": return parseHISTORY(json);
195    default: throw new FHIRException("Unsupported type '"+type+"'");
196    }
197  }
198
199  protected void parseDATA_STRUCTUREProperties(JsonObject json, DATA_STRUCTURE res) throws IOException, FHIRFormatError {
200    parseLOCATABLEProperties(json, res);
201  }
202
203  protected DATA_VALUE parseDATA_VALUE(JsonObject json) throws IOException, FHIRFormatError {
204    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
205    String type = json.get("_type").getAsString();
206    switch (type) {
207    case "DV-TEXT": return parseDV_TEXT(json);
208    case "DV-IDENTIFIER": return parseDV_IDENTIFIER(json);
209    case "DV-BOOLEAN": return parseDV_BOOLEAN(json);
210    case "DV-PARAGRAPH": return parseDV_PARAGRAPH(json);
211    case "DV-URI": return parseDV_URI(json);
212    case "DV-STATE": return parseDV_STATE(json);
213    default: throw new FHIRException("Unsupported type '"+type+"'");
214    }
215  }
216
217  protected void parseDATA_VALUEProperties(JsonObject json, DATA_VALUE res) throws IOException, FHIRFormatError {
218    parseBaseProperties(json, res);
219  }
220
221  protected DV_ABSOLUTE_QUANTITY parseDV_ABSOLUTE_QUANTITY(JsonObject json) throws IOException, FHIRFormatError {
222    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
223    String type = json.get("_type").getAsString();
224    switch (type) {
225    default: throw new FHIRException("Unsupported type '"+type+"'");
226    }
227  }
228
229  protected void parseDV_ABSOLUTE_QUANTITYProperties(JsonObject json, DV_ABSOLUTE_QUANTITY res) throws IOException, FHIRFormatError {
230    parseDV_QUANTIFIEDProperties(json, res);
231  }
232
233  protected DV_AMOUNT parseDV_AMOUNT(JsonObject json) throws IOException, FHIRFormatError {
234    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
235    String type = json.get("_type").getAsString();
236    switch (type) {
237    case "DV-DURATION": return parseDV_DURATION(json);
238    case "DV-COUNT": return parseDV_COUNT(json);
239    case "DV-PROPORTION": return parseDV_PROPORTION(json);
240    case "DV-QUANTITY": return parseDV_QUANTITY(json);
241    default: throw new FHIRException("Unsupported type '"+type+"'");
242    }
243  }
244
245  protected void parseDV_AMOUNTProperties(JsonObject json, DV_AMOUNT res) throws IOException, FHIRFormatError {
246    parseDV_QUANTIFIEDProperties(json, res);
247    if (json.has("accuracy_is_percent"))
248      res.setAccuracy_is_percentElement(parseBoolean(json.get("accuracy_is_percent").getAsBoolean()));
249    if (json.has("_accuracy_is_percent"))
250      parseElementProperties(getJObject(json, "_accuracy_is_percent"), res.getAccuracy_is_percentElement());
251  }
252
253  protected DV_ENCAPSULATED parseDV_ENCAPSULATED(JsonObject json) throws IOException, FHIRFormatError {
254    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
255    String type = json.get("_type").getAsString();
256    switch (type) {
257    case "DV-MULTIMEDIA": return parseDV_MULTIMEDIA(json);
258    case "DV-PARSABLE": return parseDV_PARSABLE(json);
259    default: throw new FHIRException("Unsupported type '"+type+"'");
260    }
261  }
262
263  protected void parseDV_ENCAPSULATEDProperties(JsonObject json, DV_ENCAPSULATED res) throws IOException, FHIRFormatError {
264    parseDV_AMOUNTProperties(json, res);
265    if (json.has("charset"))
266      res.setCharset(parseCODE_PHRASE(getJObject(json, "charset")));
267    if (json.has("language"))
268      res.setLanguage(parseCODE_PHRASE(getJObject(json, "language")));
269  }
270
271  protected DV_ORDERED parseDV_ORDERED(JsonObject json) throws IOException, FHIRFormatError {
272    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
273    String type = json.get("_type").getAsString();
274    switch (type) {
275    case "DV-DATE-TIME": return parseDV_DATE_TIME(json);
276    case "DV-TIME": return parseDV_TIME(json);
277    case "DV-INTERVAL": return parseDV_INTERVAL(json);
278    case "DV-ORDINAL": return parseDV_ORDINAL(json);
279    case "DV-SCALE": return parseDV_SCALE(json);
280    default: throw new FHIRException("Unsupported type '"+type+"'");
281    }
282  }
283
284  protected void parseDV_ORDEREDProperties(JsonObject json, DV_ORDERED res) throws IOException, FHIRFormatError {
285    parseDATA_VALUEProperties(json, res);
286    if (json.has("normal_status"))
287      res.setNormal_status(parseCODE_PHRASE(getJObject(json, "normal_status")));
288    if (json.has("normal_range"))
289      res.setNormal_range(parseDV_INTERVAL(getJObject(json, "normal_range")));
290    if (json.has("other_reference_ranges")) {
291      JsonArray array = getJArray(json, "other_reference_ranges");
292      for (int i = 0; i < array.size(); i++) {
293        res.getOther_reference_rangesList().add(parseREFERENCE_RANGE(array.get(i).getAsJsonObject()));
294      }
295    };
296  }
297
298  protected DV_QUANTIFIED parseDV_QUANTIFIED(JsonObject json) throws IOException, FHIRFormatError {
299    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
300    String type = json.get("_type").getAsString();
301    switch (type) {
302    default: throw new FHIRException("Unsupported type '"+type+"'");
303    }
304  }
305
306  protected void parseDV_QUANTIFIEDProperties(JsonObject json, DV_QUANTIFIED res) throws IOException, FHIRFormatError {
307    parseDV_ORDEREDProperties(json, res);
308    if (json.has("magnitude_status"))
309      res.setMagnitude_statusElement(parseString(json.get("magnitude_status").getAsString()));
310    if (json.has("_magnitude_status"))
311      parseElementProperties(getJObject(json, "_magnitude_status"), res.getMagnitude_statusElement());
312    if (json.has("accuracy"))
313      res.setAccuracy(parseBase(getJObject(json, "accuracy")));
314  }
315
316  protected DV_TEMPORAL parseDV_TEMPORAL(JsonObject json) throws IOException, FHIRFormatError {
317    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
318    String type = json.get("_type").getAsString();
319    switch (type) {
320    case "DV-DATE": return parseDV_DATE(json);
321    default: throw new FHIRException("Unsupported type '"+type+"'");
322    }
323  }
324
325  protected void parseDV_TEMPORALProperties(JsonObject json, DV_TEMPORAL res) throws IOException, FHIRFormatError {
326    parseDV_ABSOLUTE_QUANTITYProperties(json, res);
327  }
328
329  protected DV_TIME_SPECIFICATION parseDV_TIME_SPECIFICATION(JsonObject json) throws IOException, FHIRFormatError {
330    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
331    String type = json.get("_type").getAsString();
332    switch (type) {
333    case "DV-GENERAL-TIME-SPECIFICATION": return parseDV_GENERAL_TIME_SPECIFICATION(json);
334    case "DV-PERIODIC-TIME-SPECIFICATION": return parseDV_PERIODIC_TIME_SPECIFICATION(json);
335    default: throw new FHIRException("Unsupported type '"+type+"'");
336    }
337  }
338
339  protected void parseDV_TIME_SPECIFICATIONProperties(JsonObject json, DV_TIME_SPECIFICATION res) throws IOException, FHIRFormatError {
340    parseDATA_VALUEProperties(json, res);
341    if (json.has("DV_PARSABLE"))
342      res.setDV_PARSABLEElement(parseString(json.get("DV_PARSABLE").getAsString()));
343    if (json.has("_DV_PARSABLE"))
344      parseElementProperties(getJObject(json, "_DV_PARSABLE"), res.getDV_PARSABLEElement());
345  }
346
347  protected ENTRY parseENTRY(JsonObject json) throws IOException, FHIRFormatError {
348    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
349    String type = json.get("_type").getAsString();
350    switch (type) {
351    case "ADMIN-ENTRY": return parseADMIN_ENTRY(json);
352    default: throw new FHIRException("Unsupported type '"+type+"'");
353    }
354  }
355
356  protected void parseENTRYProperties(JsonObject json, ENTRY res) throws IOException, FHIRFormatError {
357    parseCONTENT_ITEMProperties(json, res);
358    if (json.has("language"))
359      res.setLanguage(parseCODE_PHRASE(getJObject(json, "language")));
360    if (json.has("encoding"))
361      res.setEncoding(parseCODE_PHRASE(getJObject(json, "encoding")));
362    if (json.has("other_participations")) {
363      JsonArray array = getJArray(json, "other_participations");
364      for (int i = 0; i < array.size(); i++) {
365        res.getOther_participationsList().add(parsePARTICIPATION(array.get(i).getAsJsonObject()));
366      }
367    };
368    if (json.has("workflow_id"))
369      res.setWorkflow_id(parseOBJECT_REF(getJObject(json, "workflow_id")));
370    if (json.has("subject"))
371      res.setSubject(parsePARTY_PROXY(getJObject(json, "subject")));
372    if (json.has("provider"))
373      res.setProvider(parsePARTY_PROXY(getJObject(json, "provider")));
374  }
375
376  protected EVENT parseEVENT(JsonObject json) throws IOException, FHIRFormatError {
377    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
378    String type = json.get("_type").getAsString();
379    switch (type) {
380    case "INTERVAL-EVENT": return parseINTERVAL_EVENT(json);
381    case "POINT-EVENT": return parsePOINT_EVENT(json);
382    default: throw new FHIRException("Unsupported type '"+type+"'");
383    }
384  }
385
386  protected void parseEVENTProperties(JsonObject json, EVENT res) throws IOException, FHIRFormatError {
387    parseLOCATABLEProperties(json, res);
388    if (json.has("time"))
389      res.setTime(parseDV_DATE_TIME(getJObject(json, "time")));
390    if (json.has("state"))
391      res.setState(parseITEM_STRUCTURE(getJObject(json, "state")));
392    if (json.has("data"))
393      res.setData(parseAny(getJObject(json, "data")));
394  }
395
396  protected ITEM_STRUCTURE parseITEM_STRUCTURE(JsonObject json) throws IOException, FHIRFormatError {
397    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
398    String type = json.get("_type").getAsString();
399    switch (type) {
400    case "ITEM-SINGLE": return parseITEM_SINGLE(json);
401    case "ITEM-TREE": return parseITEM_TREE(json);
402    case "ITEM-TABLE": return parseITEM_TABLE(json);
403    case "ITEM-LIST": return parseITEM_LIST(json);
404    default: throw new FHIRException("Unsupported type '"+type+"'");
405    }
406  }
407
408  protected void parseITEM_STRUCTUREProperties(JsonObject json, ITEM_STRUCTURE res) throws IOException, FHIRFormatError {
409    parseDATA_STRUCTUREProperties(json, res);
410  }
411
412  protected ITEM parseITEM(JsonObject json) throws IOException, FHIRFormatError {
413    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
414    String type = json.get("_type").getAsString();
415    switch (type) {
416    case "ELEMENT": return parseELEMENT(json);
417    case "CLUSTER": return parseCLUSTER(json);
418    default: throw new FHIRException("Unsupported type '"+type+"'");
419    }
420  }
421
422  protected void parseITEMProperties(JsonObject json, ITEM res) throws IOException, FHIRFormatError {
423    parseLOCATABLEProperties(json, res);
424  }
425
426  protected LOCATABLE parseLOCATABLE(JsonObject json) throws IOException, FHIRFormatError {
427    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
428    String type = json.get("_type").getAsString();
429    switch (type) {
430    case "CONTACT": return parseCONTACT(json);
431    case "EVENT-CONTEXT": return parseEVENT_CONTEXT(json);
432    case "EHR-STATUS": return parseEHR_STATUS(json);
433    case "PARTY-IDENTITY": return parsePARTY_IDENTITY(json);
434    case "ADDRESS": return parseADDRESS(json);
435    case "COMPOSITION": return parseCOMPOSITION(json);
436    case "PARTY-RELATIONSHIP": return parsePARTY_RELATIONSHIP(json);
437    case "CAPABILITY": return parseCAPABILITY(json);
438    case "EHR-ACCESS": return parseEHR_ACCESS(json);
439    case "ACTIVITY": return parseACTIVITY(json);
440    case "FOLDER": return parseFOLDER(json);
441    case "PARTICIPATION": return parsePARTICIPATION(json);
442    default: throw new FHIRException("Unsupported type '"+type+"'");
443    }
444  }
445
446  protected void parseLOCATABLEProperties(JsonObject json, LOCATABLE res) throws IOException, FHIRFormatError {
447    parsePATHABLEProperties(json, res);
448  }
449
450  protected OBJECT_ID parseOBJECT_ID(JsonObject json) throws IOException, FHIRFormatError {
451    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
452    String type = json.get("_type").getAsString();
453    switch (type) {
454    case "TEMPLATE-ID": return parseTEMPLATE_ID(json);
455    case "ARCHETYPE-ID": return parseARCHETYPE_ID(json);
456    case "GENERIC-ID": return parseGENERIC_ID(json);
457    case "TERMINOLOGY-ID": return parseTERMINOLOGY_ID(json);
458    default: throw new FHIRException("Unsupported type '"+type+"'");
459    }
460  }
461
462  protected void parseOBJECT_IDProperties(JsonObject json, OBJECT_ID res) throws IOException, FHIRFormatError {
463    parseUIDProperties(json, res);
464  }
465
466  protected PARTY_PROXY parsePARTY_PROXY(JsonObject json) throws IOException, FHIRFormatError {
467    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
468    String type = json.get("_type").getAsString();
469    switch (type) {
470    case "PARTY-SELF": return parsePARTY_SELF(json);
471    case "PARTY-IDENTIFIED": return parsePARTY_IDENTIFIED(json);
472    default: throw new FHIRException("Unsupported type '"+type+"'");
473    }
474  }
475
476  protected void parsePARTY_PROXYProperties(JsonObject json, PARTY_PROXY res) throws IOException, FHIRFormatError {
477    parseBaseProperties(json, res);
478    if (json.has("external_ref"))
479      res.setExternal_ref(parsePARTY_REF(getJObject(json, "external_ref")));
480  }
481
482  protected PARTY parsePARTY(JsonObject json) throws IOException, FHIRFormatError {
483    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
484    String type = json.get("_type").getAsString();
485    switch (type) {
486    case "ROLE": return parseROLE(json);
487    default: throw new FHIRException("Unsupported type '"+type+"'");
488    }
489  }
490
491  protected void parsePARTYProperties(JsonObject json, PARTY res) throws IOException, FHIRFormatError {
492    parseLOCATABLEProperties(json, res);
493    if (json.has("identities")) {
494      JsonArray array = getJArray(json, "identities");
495      for (int i = 0; i < array.size(); i++) {
496        res.getIdentitiesList().add(parsePARTY_IDENTITY(array.get(i).getAsJsonObject()));
497      }
498    };
499    if (json.has("contacts"))
500      res.setContacts(parseCONTACT(getJObject(json, "contacts")));
501    if (json.has("details"))
502      res.setDetails(parseITEM_STRUCTURE(getJObject(json, "details")));
503    if (json.has("reverse_relationships")) {
504      JsonArray array = getJArray(json, "reverse_relationships");
505      for (int i = 0; i < array.size(); i++) {
506        res.getReverse_relationshipsList().add(parseLOCATABLE_REF(array.get(i).getAsJsonObject()));
507      }
508    };
509    if (json.has("relationships")) {
510      JsonArray array = getJArray(json, "relationships");
511      for (int i = 0; i < array.size(); i++) {
512        res.getRelationshipsList().add(parsePARTY_RELATIONSHIP(array.get(i).getAsJsonObject()));
513      }
514    };
515  }
516
517  protected PATHABLE parsePATHABLE(JsonObject json) throws IOException, FHIRFormatError {
518    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
519    String type = json.get("_type").getAsString();
520    switch (type) {
521    case "INSTRUCTION-DETAILS": return parseINSTRUCTION_DETAILS(json);
522    case "ISM-TRANSITION": return parseISM_TRANSITION(json);
523    default: throw new FHIRException("Unsupported type '"+type+"'");
524    }
525  }
526
527  protected void parsePATHABLEProperties(JsonObject json, PATHABLE res) throws IOException, FHIRFormatError {
528    parseAnyProperties(json, res);
529    if (json.has("name"))
530      res.setName(parseDV_TEXT(getJObject(json, "name")));
531    if (json.has("archetype_node_id"))
532      res.setArchetype_node_idElement(parseString(json.get("archetype_node_id").getAsString()));
533    if (json.has("_archetype_node_id"))
534      parseElementProperties(getJObject(json, "_archetype_node_id"), res.getArchetype_node_idElement());
535    if (json.has("uid"))
536      res.setUid(parseUID_BASED_ID(getJObject(json, "uid")));
537    if (json.has("links")) {
538      JsonArray array = getJArray(json, "links");
539      for (int i = 0; i < array.size(); i++) {
540        res.getLinksList().add(parseLINK(array.get(i).getAsJsonObject()));
541      }
542    };
543    if (json.has("archetype_details"))
544      res.setArchetype_details(parseARCHETYPED(getJObject(json, "archetype_details")));
545    if (json.has("feeder_audit"))
546      res.setFeeder_audit(parseFEEDER_AUDIT(getJObject(json, "feeder_audit")));
547  }
548
549  protected UID_BASED_ID parseUID_BASED_ID(JsonObject json) throws IOException, FHIRFormatError {
550    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
551    String type = json.get("_type").getAsString();
552    switch (type) {
553    case "OBJECT-VERSION-ID": return parseOBJECT_VERSION_ID(json);
554    case "HIER-OBJECT-ID": return parseHIER_OBJECT_ID(json);
555    default: throw new FHIRException("Unsupported type '"+type+"'");
556    }
557  }
558
559  protected void parseUID_BASED_IDProperties(JsonObject json, UID_BASED_ID res) throws IOException, FHIRFormatError {
560    parseOBJECT_IDProperties(json, res);
561  }
562
563  protected UID parseUID(JsonObject json) throws IOException, FHIRFormatError {
564    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
565    String type = json.get("_type").getAsString();
566    switch (type) {
567    case "ISO-OID": return parseISO_OID(json);
568    case "UUID": return parseUUID(json);
569    case "INTERNET-ID": return parseINTERNET_ID(json);
570    default: throw new FHIRException("Unsupported type '"+type+"'");
571    }
572  }
573
574  protected void parseUIDProperties(JsonObject json, UID res) throws IOException, FHIRFormatError {
575    parseBaseProperties(json, res);
576    if (json.has("value"))
577      res.setValueElement(parseString(json.get("value").getAsString()));
578    if (json.has("_value"))
579      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
580  }
581
582  protected VERSION parseVERSION(JsonObject json) throws IOException, FHIRFormatError {
583    if (json.has("_type")) { throw new FHIRException("'_type' property not found"); }
584    String type = json.get("_type").getAsString();
585    switch (type) {
586    case "IMPORTED-VERSION": return parseIMPORTED_VERSION(json);
587    case "ORIGINAL-VERSION": return parseORIGINAL_VERSION(json);
588    default: throw new FHIRException("Unsupported type '"+type+"'");
589    }
590  }
591
592  protected void parseVERSIONProperties(JsonObject json, VERSION res) throws IOException, FHIRFormatError {
593    parseBaseProperties(json, res);
594    if (json.has("contribution"))
595      res.setContribution(parseOBJECT_REF(getJObject(json, "contribution")));
596    if (json.has("signature"))
597      res.setSignatureElement(parseString(json.get("signature").getAsString()));
598    if (json.has("_signature"))
599      parseElementProperties(getJObject(json, "_signature"), res.getSignatureElement());
600    if (json.has("commit_audit"))
601      res.setCommit_audit(parseAUDIT_DETAILS(getJObject(json, "commit_audit")));
602  }
603
604  protected ACTION parseACTION(JsonObject json) throws IOException, FHIRFormatError {
605    ACTION res = new ACTION();
606    parseACTIONProperties(json, res);
607    return res;
608  }
609
610  protected void parseACTIONProperties(JsonObject json, ACTION res) throws IOException, FHIRFormatError {
611    parseCARE_ENTRYProperties(json, res);
612    if (json.has("time"))
613      res.setTime(parseDV_DATE_TIME(getJObject(json, "time")));
614    if (json.has("ism_transition"))
615      res.setIsm_transition(parseISM_TRANSITION(getJObject(json, "ism_transition")));
616    if (json.has("instruction_details"))
617      res.setInstruction_details(parseINSTRUCTION_DETAILS(getJObject(json, "instruction_details")));
618    if (json.has("description"))
619      res.setDescription(parseITEM_STRUCTURE(getJObject(json, "description")));
620  }
621
622  protected ACTIVITY parseACTIVITY(JsonObject json) throws IOException, FHIRFormatError {
623    ACTIVITY res = new ACTIVITY();
624    parseACTIVITYProperties(json, res);
625    return res;
626  }
627
628  protected void parseACTIVITYProperties(JsonObject json, ACTIVITY res) throws IOException, FHIRFormatError {
629    parseLOCATABLEProperties(json, res);
630    if (json.has("timing"))
631      res.setTiming(parseDV_PARSABLE(getJObject(json, "timing")));
632    if (json.has("action_archetype_id"))
633      res.setAction_archetype_idElement(parseString(json.get("action_archetype_id").getAsString()));
634    if (json.has("_action_archetype_id"))
635      parseElementProperties(getJObject(json, "_action_archetype_id"), res.getAction_archetype_idElement());
636    if (json.has("description"))
637      res.setDescription(parseITEM_STRUCTURE(getJObject(json, "description")));
638  }
639
640  protected ADDRESS parseADDRESS(JsonObject json) throws IOException, FHIRFormatError {
641    ADDRESS res = new ADDRESS();
642    parseADDRESSProperties(json, res);
643    return res;
644  }
645
646  protected void parseADDRESSProperties(JsonObject json, ADDRESS res) throws IOException, FHIRFormatError {
647    parseLOCATABLEProperties(json, res);
648    if (json.has("details"))
649      res.setDetails(parseITEM_STRUCTURE(getJObject(json, "details")));
650  }
651
652  protected ADMIN_ENTRY parseADMIN_ENTRY(JsonObject json) throws IOException, FHIRFormatError {
653    ADMIN_ENTRY res = new ADMIN_ENTRY();
654    parseADMIN_ENTRYProperties(json, res);
655    return res;
656  }
657
658  protected void parseADMIN_ENTRYProperties(JsonObject json, ADMIN_ENTRY res) throws IOException, FHIRFormatError {
659    parseENTRYProperties(json, res);
660    if (json.has("data"))
661      res.setData(parseITEM_STRUCTURE(getJObject(json, "data")));
662  }
663
664  protected AGENT parseAGENT(JsonObject json) throws IOException, FHIRFormatError {
665    AGENT res = new AGENT();
666    parseAGENTProperties(json, res);
667    return res;
668  }
669
670  protected void parseAGENTProperties(JsonObject json, AGENT res) throws IOException, FHIRFormatError {
671    parseACTORProperties(json, res);
672  }
673
674  protected ARCHETYPE_ID parseARCHETYPE_ID(JsonObject json) throws IOException, FHIRFormatError {
675    ARCHETYPE_ID res = new ARCHETYPE_ID();
676    parseARCHETYPE_IDProperties(json, res);
677    return res;
678  }
679
680  protected void parseARCHETYPE_IDProperties(JsonObject json, ARCHETYPE_ID res) throws IOException, FHIRFormatError {
681    parseOBJECT_IDProperties(json, res);
682  }
683
684  protected ARCHETYPED parseARCHETYPED(JsonObject json) throws IOException, FHIRFormatError {
685    ARCHETYPED res = new ARCHETYPED();
686    parseARCHETYPEDProperties(json, res);
687    return res;
688  }
689
690  protected void parseARCHETYPEDProperties(JsonObject json, ARCHETYPED res) throws IOException, FHIRFormatError {
691    parseBaseProperties(json, res);
692    if (json.has("archetype_id"))
693      res.setArchetype_id(parseARCHETYPE_ID(getJObject(json, "archetype_id")));
694    if (json.has("template_id"))
695      res.setTemplate_id(parseTEMPLATE_ID(getJObject(json, "template_id")));
696    if (json.has("rm_version"))
697      res.setRm_versionElement(parseString(json.get("rm_version").getAsString()));
698    if (json.has("_rm_version"))
699      parseElementProperties(getJObject(json, "_rm_version"), res.getRm_versionElement());
700  }
701
702  protected ATTESTATION parseATTESTATION(JsonObject json) throws IOException, FHIRFormatError {
703    ATTESTATION res = new ATTESTATION();
704    parseATTESTATIONProperties(json, res);
705    return res;
706  }
707
708  protected void parseATTESTATIONProperties(JsonObject json, ATTESTATION res) throws IOException, FHIRFormatError {
709    parseAUDIT_DETAILSProperties(json, res);
710    if (json.has("attested_view"))
711      res.setAttested_view(parseDV_MULTIMEDIA(getJObject(json, "attested_view")));
712    if (json.has("proof"))
713      res.setProofElement(parseString(json.get("proof").getAsString()));
714    if (json.has("_proof"))
715      parseElementProperties(getJObject(json, "_proof"), res.getProofElement());
716    if (json.has("items")) {
717      JsonArray array = getJArray(json, "items");
718      for (int i = 0; i < array.size(); i++) {
719        res.getItemsList().add(parseDV_EHR_URI(array.get(i).getAsJsonObject()));
720      }
721    };
722    if (json.has("reason"))
723      res.setReason(parseDV_TEXT(getJObject(json, "reason")));
724    if (json.has("is_pending"))
725      res.setIs_pendingElement(parseBoolean(json.get("is_pending").getAsBoolean()));
726    if (json.has("_is_pending"))
727      parseElementProperties(getJObject(json, "_is_pending"), res.getIs_pendingElement());
728  }
729
730  protected AUDIT_DETAILS parseAUDIT_DETAILS(JsonObject json) throws IOException, FHIRFormatError {
731    AUDIT_DETAILS res = new AUDIT_DETAILS();
732    parseAUDIT_DETAILSProperties(json, res);
733    return res;
734  }
735
736  protected void parseAUDIT_DETAILSProperties(JsonObject json, AUDIT_DETAILS res) throws IOException, FHIRFormatError {
737    parseBaseProperties(json, res);
738    if (json.has("system_id"))
739      res.setSystem_idElement(parseString(json.get("system_id").getAsString()));
740    if (json.has("_system_id"))
741      parseElementProperties(getJObject(json, "_system_id"), res.getSystem_idElement());
742    if (json.has("time_committed"))
743      res.setTime_committed(parseDV_DATE_TIME(getJObject(json, "time_committed")));
744    if (json.has("change_type"))
745      res.setChange_type(parseDV_CODED_TEXT(getJObject(json, "change_type")));
746    if (json.has("description"))
747      res.setDescription(parseDV_TEXT(getJObject(json, "description")));
748    if (json.has("committer"))
749      res.setCommitter(parsePARTY_PROXY(getJObject(json, "committer")));
750  }
751
752  protected Annotations parseAnnotations(JsonObject json) throws IOException, FHIRFormatError {
753    Annotations res = new Annotations();
754    parseAnnotationsProperties(json, res);
755    return res;
756  }
757
758  protected void parseAnnotationsProperties(JsonObject json, Annotations res) throws IOException, FHIRFormatError {
759    parseBaseProperties(json, res);
760    if (json.has("comment"))
761      res.setCommentElement(parseString(json.get("comment").getAsString()));
762    if (json.has("_comment"))
763      parseElementProperties(getJObject(json, "_comment"), res.getCommentElement());
764    if (json.has("fhir_mapping"))
765      res.setFhir_mappingElement(parseString(json.get("fhir_mapping").getAsString()));
766    if (json.has("_fhir_mapping"))
767      parseElementProperties(getJObject(json, "_fhir_mapping"), res.getFhir_mappingElement());
768    if (json.has("vset_description"))
769      res.setVset_descriptionElement(parseString(json.get("vset_description").getAsString()));
770    if (json.has("_vset_description"))
771      parseElementProperties(getJObject(json, "_vset_description"), res.getVset_descriptionElement());
772    if (json.has("hl7v2_mapping"))
773      res.setHl7v2_mappingElement(parseString(json.get("hl7v2_mapping").getAsString()));
774    if (json.has("_hl7v2_mapping"))
775      parseElementProperties(getJObject(json, "_hl7v2_mapping"), res.getHl7v2_mappingElement());
776    if (json.has("visibleInView"))
777      res.setVisibleInViewElement(parseString(json.get("visibleInView").getAsString()));
778    if (json.has("_visibleInView"))
779      parseElementProperties(getJObject(json, "_visibleInView"), res.getVisibleInViewElement());
780  }
781
782  protected CAPABILITY parseCAPABILITY(JsonObject json) throws IOException, FHIRFormatError {
783    CAPABILITY res = new CAPABILITY();
784    parseCAPABILITYProperties(json, res);
785    return res;
786  }
787
788  protected void parseCAPABILITYProperties(JsonObject json, CAPABILITY res) throws IOException, FHIRFormatError {
789    parseLOCATABLEProperties(json, res);
790    if (json.has("credentials"))
791      res.setCredentials(parseITEM_STRUCTURE(getJObject(json, "credentials")));
792    if (json.has("time_validity"))
793      res.setTime_validity(parseDV_INTERVAL(getJObject(json, "time_validity")));
794  }
795
796  protected CLUSTER parseCLUSTER(JsonObject json) throws IOException, FHIRFormatError {
797    CLUSTER res = new CLUSTER();
798    parseCLUSTERProperties(json, res);
799    return res;
800  }
801
802  protected void parseCLUSTERProperties(JsonObject json, CLUSTER res) throws IOException, FHIRFormatError {
803    parseITEMProperties(json, res);
804    if (json.has("items")) {
805      JsonArray array = getJArray(json, "items");
806      for (int i = 0; i < array.size(); i++) {
807        res.getItemsList().add(parseITEM(array.get(i).getAsJsonObject()));
808      }
809    };
810  }
811
812  protected CODE_PHRASE parseCODE_PHRASE(JsonObject json) throws IOException, FHIRFormatError {
813    CODE_PHRASE res = new CODE_PHRASE();
814    parseCODE_PHRASEProperties(json, res);
815    return res;
816  }
817
818  protected void parseCODE_PHRASEProperties(JsonObject json, CODE_PHRASE res) throws IOException, FHIRFormatError {
819    parseBaseProperties(json, res);
820    if (json.has("terminology_id"))
821      res.setTerminology_id(parseTERMINOLOGY_ID(getJObject(json, "terminology_id")));
822    if (json.has("code_string"))
823      res.setCode_stringElement(parseString(json.get("code_string").getAsString()));
824    if (json.has("_code_string"))
825      parseElementProperties(getJObject(json, "_code_string"), res.getCode_stringElement());
826    if (json.has("preferred_term"))
827      res.setPreferred_termElement(parseString(json.get("preferred_term").getAsString()));
828    if (json.has("_preferred_term"))
829      parseElementProperties(getJObject(json, "_preferred_term"), res.getPreferred_termElement());
830  }
831
832  protected COMPOSITION parseCOMPOSITION(JsonObject json) throws IOException, FHIRFormatError {
833    COMPOSITION res = new COMPOSITION();
834    parseCOMPOSITIONProperties(json, res);
835    return res;
836  }
837
838  protected void parseCOMPOSITIONProperties(JsonObject json, COMPOSITION res) throws IOException, FHIRFormatError {
839    parseLOCATABLEProperties(json, res);
840    if (json.has("language"))
841      res.setLanguage(parseCODE_PHRASE(getJObject(json, "language")));
842    if (json.has("territory"))
843      res.setTerritory(parseCODE_PHRASE(getJObject(json, "territory")));
844    if (json.has("category"))
845      res.setCategory(parseDV_CODED_TEXT(getJObject(json, "category")));
846    if (json.has("context"))
847      res.setContext(parseEVENT_CONTEXT(getJObject(json, "context")));
848    if (json.has("composer"))
849      res.setComposer(parsePARTY_PROXY(getJObject(json, "composer")));
850    if (json.has("content")) {
851      JsonArray array = getJArray(json, "content");
852      for (int i = 0; i < array.size(); i++) {
853        res.getContentList().add(parseCONTENT_ITEM(array.get(i).getAsJsonObject()));
854      }
855    };
856  }
857
858  protected CONTACT parseCONTACT(JsonObject json) throws IOException, FHIRFormatError {
859    CONTACT res = new CONTACT();
860    parseCONTACTProperties(json, res);
861    return res;
862  }
863
864  protected void parseCONTACTProperties(JsonObject json, CONTACT res) throws IOException, FHIRFormatError {
865    parseLOCATABLEProperties(json, res);
866    if (json.has("addresses")) {
867      JsonArray array = getJArray(json, "addresses");
868      for (int i = 0; i < array.size(); i++) {
869        res.getAddressesList().add(parseADDRESS(array.get(i).getAsJsonObject()));
870      }
871    };
872    if (json.has("time_validity"))
873      res.setTime_validity(parseDV_INTERVAL(getJObject(json, "time_validity")));
874  }
875
876  protected CONTRIBUTION parseCONTRIBUTION(JsonObject json) throws IOException, FHIRFormatError {
877    CONTRIBUTION res = new CONTRIBUTION();
878    parseCONTRIBUTIONProperties(json, res);
879    return res;
880  }
881
882  protected void parseCONTRIBUTIONProperties(JsonObject json, CONTRIBUTION res) throws IOException, FHIRFormatError {
883    parseBaseProperties(json, res);
884    if (json.has("uid"))
885      res.setUid(parseHIER_OBJECT_ID(getJObject(json, "uid")));
886    if (json.has("versions")) {
887      JsonArray array = getJArray(json, "versions");
888      for (int i = 0; i < array.size(); i++) {
889        res.getVersionsList().add(parseOBJECT_REF(array.get(i).getAsJsonObject()));
890      }
891    };
892    if (json.has("audit"))
893      res.setAudit(parseAUDIT_DETAILS(getJObject(json, "audit")));
894  }
895
896  protected DV_BOOLEAN parseDV_BOOLEAN(JsonObject json) throws IOException, FHIRFormatError {
897    DV_BOOLEAN res = new DV_BOOLEAN();
898    parseDV_BOOLEANProperties(json, res);
899    return res;
900  }
901
902  protected void parseDV_BOOLEANProperties(JsonObject json, DV_BOOLEAN res) throws IOException, FHIRFormatError {
903    parseDATA_VALUEProperties(json, res);
904    if (json.has("value"))
905      res.setValueElement(parseBoolean(json.get("value").getAsBoolean()));
906    if (json.has("_value"))
907      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
908  }
909
910  protected DV_CODED_TEXT parseDV_CODED_TEXT(JsonObject json) throws IOException, FHIRFormatError {
911    DV_CODED_TEXT res = new DV_CODED_TEXT();
912    parseDV_CODED_TEXTProperties(json, res);
913    return res;
914  }
915
916  protected void parseDV_CODED_TEXTProperties(JsonObject json, DV_CODED_TEXT res) throws IOException, FHIRFormatError {
917    parseDV_TEXTProperties(json, res);
918    if (json.has("defining_code"))
919      res.setDefining_code(parseCODE_PHRASE(getJObject(json, "defining_code")));
920  }
921
922  protected DV_COUNT parseDV_COUNT(JsonObject json) throws IOException, FHIRFormatError {
923    DV_COUNT res = new DV_COUNT();
924    parseDV_COUNTProperties(json, res);
925    return res;
926  }
927
928  protected void parseDV_COUNTProperties(JsonObject json, DV_COUNT res) throws IOException, FHIRFormatError {
929    parseDV_AMOUNTProperties(json, res);
930    if (json.has("magnitude"))
931      res.setMagnitudeElement(parseDecimal(json.get("magnitude").getAsBigDecimal()));
932    if (json.has("_magnitude"))
933      parseElementProperties(getJObject(json, "_magnitude"), res.getMagnitudeElement());
934  }
935
936  protected DV_DATE_TIME parseDV_DATE_TIME(JsonObject json) throws IOException, FHIRFormatError {
937    DV_DATE_TIME res = new DV_DATE_TIME();
938    parseDV_DATE_TIMEProperties(json, res);
939    return res;
940  }
941
942  protected void parseDV_DATE_TIMEProperties(JsonObject json, DV_DATE_TIME res) throws IOException, FHIRFormatError {
943    parseDV_ORDEREDProperties(json, res);
944    if (json.has("value"))
945      res.setValueElement(parseDateTime(json.get("value").getAsString()));
946    if (json.has("_value"))
947      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
948  }
949
950  protected DV_DATE parseDV_DATE(JsonObject json) throws IOException, FHIRFormatError {
951    DV_DATE res = new DV_DATE();
952    parseDV_DATEProperties(json, res);
953    return res;
954  }
955
956  protected void parseDV_DATEProperties(JsonObject json, DV_DATE res) throws IOException, FHIRFormatError {
957    parseDV_TEMPORALProperties(json, res);
958    if (json.has("value"))
959      res.setValueElement(parseDateTime(json.get("value").getAsString()));
960    if (json.has("_value"))
961      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
962  }
963
964  protected DV_DURATION parseDV_DURATION(JsonObject json) throws IOException, FHIRFormatError {
965    DV_DURATION res = new DV_DURATION();
966    parseDV_DURATIONProperties(json, res);
967    return res;
968  }
969
970  protected void parseDV_DURATIONProperties(JsonObject json, DV_DURATION res) throws IOException, FHIRFormatError {
971    parseDV_AMOUNTProperties(json, res);
972    if (json.has("value"))
973      res.setValueElement(parseString(json.get("value").getAsString()));
974    if (json.has("_value"))
975      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
976  }
977
978  protected DV_EHR_URI parseDV_EHR_URI(JsonObject json) throws IOException, FHIRFormatError {
979    DV_EHR_URI res = new DV_EHR_URI();
980    parseDV_EHR_URIProperties(json, res);
981    return res;
982  }
983
984  protected void parseDV_EHR_URIProperties(JsonObject json, DV_EHR_URI res) throws IOException, FHIRFormatError {
985    parseDV_URIProperties(json, res);
986  }
987
988  protected DV_GENERAL_TIME_SPECIFICATION parseDV_GENERAL_TIME_SPECIFICATION(JsonObject json) throws IOException, FHIRFormatError {
989    DV_GENERAL_TIME_SPECIFICATION res = new DV_GENERAL_TIME_SPECIFICATION();
990    parseDV_GENERAL_TIME_SPECIFICATIONProperties(json, res);
991    return res;
992  }
993
994  protected void parseDV_GENERAL_TIME_SPECIFICATIONProperties(JsonObject json, DV_GENERAL_TIME_SPECIFICATION res) throws IOException, FHIRFormatError {
995    parseDV_TIME_SPECIFICATIONProperties(json, res);
996  }
997
998  protected DV_IDENTIFIER parseDV_IDENTIFIER(JsonObject json) throws IOException, FHIRFormatError {
999    DV_IDENTIFIER res = new DV_IDENTIFIER();
1000    parseDV_IDENTIFIERProperties(json, res);
1001    return res;
1002  }
1003
1004  protected void parseDV_IDENTIFIERProperties(JsonObject json, DV_IDENTIFIER res) throws IOException, FHIRFormatError {
1005    parseDATA_VALUEProperties(json, res);
1006    if (json.has("issuer"))
1007      res.setIssuerElement(parseString(json.get("issuer").getAsString()));
1008    if (json.has("_issuer"))
1009      parseElementProperties(getJObject(json, "_issuer"), res.getIssuerElement());
1010    if (json.has("assigner"))
1011      res.setAssignerElement(parseString(json.get("assigner").getAsString()));
1012    if (json.has("_assigner"))
1013      parseElementProperties(getJObject(json, "_assigner"), res.getAssignerElement());
1014    if (json.has("id"))
1015      res.setIdElement(parseString(json.get("id").getAsString()));
1016    if (json.has("_id"))
1017      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
1018    if (json.has("type"))
1019      res.setTypeElement(parseString(json.get("type").getAsString()));
1020    if (json.has("_type"))
1021      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1022  }
1023
1024  protected DV_INTERVAL parseDV_INTERVAL(JsonObject json) throws IOException, FHIRFormatError {
1025    DV_INTERVAL res = new DV_INTERVAL();
1026    parseDV_INTERVALProperties(json, res);
1027    return res;
1028  }
1029
1030  protected void parseDV_INTERVALProperties(JsonObject json, DV_INTERVAL res) throws IOException, FHIRFormatError {
1031    parseDV_ORDEREDProperties(json, res);
1032  }
1033
1034  protected DV_MULTIMEDIA parseDV_MULTIMEDIA(JsonObject json) throws IOException, FHIRFormatError {
1035    DV_MULTIMEDIA res = new DV_MULTIMEDIA();
1036    parseDV_MULTIMEDIAProperties(json, res);
1037    return res;
1038  }
1039
1040  protected void parseDV_MULTIMEDIAProperties(JsonObject json, DV_MULTIMEDIA res) throws IOException, FHIRFormatError {
1041    parseDV_ENCAPSULATEDProperties(json, res);
1042    if (json.has("alternate_text"))
1043      res.setAlternate_textElement(parseString(json.get("alternate_text").getAsString()));
1044    if (json.has("_alternate_text"))
1045      parseElementProperties(getJObject(json, "_alternate_text"), res.getAlternate_textElement());
1046    if (json.has("uri"))
1047      res.setUri(parseDV_URI(getJObject(json, "uri")));
1048    if (json.has("data"))
1049      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
1050    if (json.has("_data"))
1051      parseElementProperties(getJObject(json, "_data"), res.getDataElement());
1052    if (json.has("media_type"))
1053      res.setMedia_type(parseCODE_PHRASE(getJObject(json, "media_type")));
1054    if (json.has("compression_algorithm"))
1055      res.setCompression_algorithm(parseCODE_PHRASE(getJObject(json, "compression_algorithm")));
1056    if (json.has("integrity_check"))
1057      res.setIntegrity_checkElement(parseBase64Binary(json.get("integrity_check").getAsString()));
1058    if (json.has("_integrity_check"))
1059      parseElementProperties(getJObject(json, "_integrity_check"), res.getIntegrity_checkElement());
1060    if (json.has("integrity_check_algorithm"))
1061      res.setIntegrity_check_algorithm(parseCODE_PHRASE(getJObject(json, "integrity_check_algorithm")));
1062    if (json.has("thumbnail"))
1063      res.setThumbnail(parseDV_MULTIMEDIA(getJObject(json, "thumbnail")));
1064    if (json.has("size"))
1065      res.setSizeElement(parseInteger(json.get("size").getAsLong()));
1066    if (json.has("_size"))
1067      parseElementProperties(getJObject(json, "_size"), res.getSizeElement());
1068  }
1069
1070  protected DV_ORDINAL parseDV_ORDINAL(JsonObject json) throws IOException, FHIRFormatError {
1071    DV_ORDINAL res = new DV_ORDINAL();
1072    parseDV_ORDINALProperties(json, res);
1073    return res;
1074  }
1075
1076  protected void parseDV_ORDINALProperties(JsonObject json, DV_ORDINAL res) throws IOException, FHIRFormatError {
1077    parseDV_ORDEREDProperties(json, res);
1078    if (json.has("symbol"))
1079      res.setSymbol(parseDV_CODED_TEXT(getJObject(json, "symbol")));
1080    if (json.has("value"))
1081      res.setValueElement(parseInteger(json.get("value").getAsLong()));
1082    if (json.has("_value"))
1083      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1084  }
1085
1086  protected DV_PARAGRAPH parseDV_PARAGRAPH(JsonObject json) throws IOException, FHIRFormatError {
1087    DV_PARAGRAPH res = new DV_PARAGRAPH();
1088    parseDV_PARAGRAPHProperties(json, res);
1089    return res;
1090  }
1091
1092  protected void parseDV_PARAGRAPHProperties(JsonObject json, DV_PARAGRAPH res) throws IOException, FHIRFormatError {
1093    parseDATA_VALUEProperties(json, res);
1094    if (json.has("items")) {
1095      JsonArray array = getJArray(json, "items");
1096      for (int i = 0; i < array.size(); i++) {
1097        res.getItemsList().add(parseDV_TEXT(array.get(i).getAsJsonObject()));
1098      }
1099    };
1100  }
1101
1102  protected DV_PARSABLE parseDV_PARSABLE(JsonObject json) throws IOException, FHIRFormatError {
1103    DV_PARSABLE res = new DV_PARSABLE();
1104    parseDV_PARSABLEProperties(json, res);
1105    return res;
1106  }
1107
1108  protected void parseDV_PARSABLEProperties(JsonObject json, DV_PARSABLE res) throws IOException, FHIRFormatError {
1109    parseDV_ENCAPSULATEDProperties(json, res);
1110    if (json.has("value"))
1111      res.setValueElement(parseString(json.get("value").getAsString()));
1112    if (json.has("_value"))
1113      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1114    if (json.has("formalism"))
1115      res.setFormalismElement(parseString(json.get("formalism").getAsString()));
1116    if (json.has("_formalism"))
1117      parseElementProperties(getJObject(json, "_formalism"), res.getFormalismElement());
1118  }
1119
1120  protected DV_PERIODIC_TIME_SPECIFICATION parseDV_PERIODIC_TIME_SPECIFICATION(JsonObject json) throws IOException, FHIRFormatError {
1121    DV_PERIODIC_TIME_SPECIFICATION res = new DV_PERIODIC_TIME_SPECIFICATION();
1122    parseDV_PERIODIC_TIME_SPECIFICATIONProperties(json, res);
1123    return res;
1124  }
1125
1126  protected void parseDV_PERIODIC_TIME_SPECIFICATIONProperties(JsonObject json, DV_PERIODIC_TIME_SPECIFICATION res) throws IOException, FHIRFormatError {
1127    parseDV_TIME_SPECIFICATIONProperties(json, res);
1128  }
1129
1130  protected DV_PROPORTION parseDV_PROPORTION(JsonObject json) throws IOException, FHIRFormatError {
1131    DV_PROPORTION res = new DV_PROPORTION();
1132    parseDV_PROPORTIONProperties(json, res);
1133    return res;
1134  }
1135
1136  protected void parseDV_PROPORTIONProperties(JsonObject json, DV_PROPORTION res) throws IOException, FHIRFormatError {
1137    parseDV_AMOUNTProperties(json, res);
1138    if (json.has("numerator"))
1139      res.setNumeratorElement(parseDecimal(json.get("numerator").getAsBigDecimal()));
1140    if (json.has("_numerator"))
1141      parseElementProperties(getJObject(json, "_numerator"), res.getNumeratorElement());
1142    if (json.has("denominator"))
1143      res.setDenominatorElement(parseDecimal(json.get("denominator").getAsBigDecimal()));
1144    if (json.has("_denominator"))
1145      parseElementProperties(getJObject(json, "_denominator"), res.getDenominatorElement());
1146    if (json.has("type"))
1147      res.setTypeElement(parseCode(json.get("type").getAsString()));
1148    if (json.has("_type"))
1149      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1150    if (json.has("precision"))
1151      res.setPrecisionElement(parseInteger(json.get("precision").getAsLong()));
1152    if (json.has("_precision"))
1153      parseElementProperties(getJObject(json, "_precision"), res.getPrecisionElement());
1154  }
1155
1156  protected DV_QUANTITY parseDV_QUANTITY(JsonObject json) throws IOException, FHIRFormatError {
1157    DV_QUANTITY res = new DV_QUANTITY();
1158    parseDV_QUANTITYProperties(json, res);
1159    return res;
1160  }
1161
1162  protected void parseDV_QUANTITYProperties(JsonObject json, DV_QUANTITY res) throws IOException, FHIRFormatError {
1163    parseDV_AMOUNTProperties(json, res);
1164    if (json.has("magnitude"))
1165      res.setMagnitudeElement(parseDecimal(json.get("magnitude").getAsBigDecimal()));
1166    if (json.has("_magnitude"))
1167      parseElementProperties(getJObject(json, "_magnitude"), res.getMagnitudeElement());
1168    if (json.has("precision"))
1169      res.setPrecisionElement(parseInteger(json.get("precision").getAsLong()));
1170    if (json.has("_precision"))
1171      parseElementProperties(getJObject(json, "_precision"), res.getPrecisionElement());
1172    if (json.has("units"))
1173      res.setUnitsElement(parseString(json.get("units").getAsString()));
1174    if (json.has("_units"))
1175      parseElementProperties(getJObject(json, "_units"), res.getUnitsElement());
1176    if (json.has("units_system"))
1177      res.setUnits_systemElement(parseString(json.get("units_system").getAsString()));
1178    if (json.has("_units_system"))
1179      parseElementProperties(getJObject(json, "_units_system"), res.getUnits_systemElement());
1180    if (json.has("units_display_name"))
1181      res.setUnits_display_nameElement(parseString(json.get("units_display_name").getAsString()));
1182    if (json.has("_units_display_name"))
1183      parseElementProperties(getJObject(json, "_units_display_name"), res.getUnits_display_nameElement());
1184  }
1185
1186  protected DV_SCALE parseDV_SCALE(JsonObject json) throws IOException, FHIRFormatError {
1187    DV_SCALE res = new DV_SCALE();
1188    parseDV_SCALEProperties(json, res);
1189    return res;
1190  }
1191
1192  protected void parseDV_SCALEProperties(JsonObject json, DV_SCALE res) throws IOException, FHIRFormatError {
1193    parseDV_ORDEREDProperties(json, res);
1194    if (json.has("symbol"))
1195      res.setSymbol(parseDV_CODED_TEXT(getJObject(json, "symbol")));
1196    if (json.has("value"))
1197      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
1198    if (json.has("_value"))
1199      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1200  }
1201
1202  protected DV_STATE parseDV_STATE(JsonObject json) throws IOException, FHIRFormatError {
1203    DV_STATE res = new DV_STATE();
1204    parseDV_STATEProperties(json, res);
1205    return res;
1206  }
1207
1208  protected void parseDV_STATEProperties(JsonObject json, DV_STATE res) throws IOException, FHIRFormatError {
1209    parseDATA_VALUEProperties(json, res);
1210    if (json.has("value"))
1211      res.setValue(parseDV_CODED_TEXT(getJObject(json, "value")));
1212    if (json.has("is_terminal"))
1213      res.setIs_terminalElement(parseBoolean(json.get("is_terminal").getAsBoolean()));
1214    if (json.has("_is_terminal"))
1215      parseElementProperties(getJObject(json, "_is_terminal"), res.getIs_terminalElement());
1216  }
1217
1218  protected DV_TEXT parseDV_TEXT(JsonObject json) throws IOException, FHIRFormatError {
1219    DV_TEXT res = new DV_TEXT();
1220    parseDV_TEXTProperties(json, res);
1221    return res;
1222  }
1223
1224  protected void parseDV_TEXTProperties(JsonObject json, DV_TEXT res) throws IOException, FHIRFormatError {
1225    parseDATA_VALUEProperties(json, res);
1226    if (json.has("value"))
1227      res.setValueElement(parseString(json.get("value").getAsString()));
1228    if (json.has("_value"))
1229      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1230    if (json.has("hyperlink"))
1231      res.setHyperlink(parseDV_URI(getJObject(json, "hyperlink")));
1232    if (json.has("formatting"))
1233      res.setFormattingElement(parseString(json.get("formatting").getAsString()));
1234    if (json.has("_formatting"))
1235      parseElementProperties(getJObject(json, "_formatting"), res.getFormattingElement());
1236    if (json.has("mappings")) {
1237      JsonArray array = getJArray(json, "mappings");
1238      for (int i = 0; i < array.size(); i++) {
1239        res.getMappingsList().add(parseTERM_MAPPING(array.get(i).getAsJsonObject()));
1240      }
1241    };
1242    if (json.has("language"))
1243      res.setLanguage(parseCODE_PHRASE(getJObject(json, "language")));
1244    if (json.has("encoding"))
1245      res.setEncoding(parseCODE_PHRASE(getJObject(json, "encoding")));
1246  }
1247
1248  protected DV_TIME parseDV_TIME(JsonObject json) throws IOException, FHIRFormatError {
1249    DV_TIME res = new DV_TIME();
1250    parseDV_TIMEProperties(json, res);
1251    return res;
1252  }
1253
1254  protected void parseDV_TIMEProperties(JsonObject json, DV_TIME res) throws IOException, FHIRFormatError {
1255    parseDV_ORDEREDProperties(json, res);
1256    if (json.has("value"))
1257      res.setValueElement(parseString(json.get("value").getAsString()));
1258    if (json.has("_value"))
1259      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1260  }
1261
1262  protected DV_URI parseDV_URI(JsonObject json) throws IOException, FHIRFormatError {
1263    DV_URI res = new DV_URI();
1264    parseDV_URIProperties(json, res);
1265    return res;
1266  }
1267
1268  protected void parseDV_URIProperties(JsonObject json, DV_URI res) throws IOException, FHIRFormatError {
1269    parseDATA_VALUEProperties(json, res);
1270    if (json.has("value"))
1271      res.setValueElement(parseUri(json.get("value").getAsString()));
1272    if (json.has("_value"))
1273      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1274  }
1275
1276  protected EHR_ACCESS parseEHR_ACCESS(JsonObject json) throws IOException, FHIRFormatError {
1277    EHR_ACCESS res = new EHR_ACCESS();
1278    parseEHR_ACCESSProperties(json, res);
1279    return res;
1280  }
1281
1282  protected void parseEHR_ACCESSProperties(JsonObject json, EHR_ACCESS res) throws IOException, FHIRFormatError {
1283    parseLOCATABLEProperties(json, res);
1284    if (json.has("settings"))
1285      res.setSettings(parseACCESS_CONTROL_SETTINGS(getJObject(json, "settings")));
1286  }
1287
1288  protected EHR_STATUS parseEHR_STATUS(JsonObject json) throws IOException, FHIRFormatError {
1289    EHR_STATUS res = new EHR_STATUS();
1290    parseEHR_STATUSProperties(json, res);
1291    return res;
1292  }
1293
1294  protected void parseEHR_STATUSProperties(JsonObject json, EHR_STATUS res) throws IOException, FHIRFormatError {
1295    parseLOCATABLEProperties(json, res);
1296    if (json.has("subject"))
1297      res.setSubject(parsePARTY_SELF(getJObject(json, "subject")));
1298    if (json.has("is_queryable"))
1299      res.setIs_queryableElement(parseBoolean(json.get("is_queryable").getAsBoolean()));
1300    if (json.has("_is_queryable"))
1301      parseElementProperties(getJObject(json, "_is_queryable"), res.getIs_queryableElement());
1302    if (json.has("is_modifiable"))
1303      res.setIs_modifiableElement(parseBoolean(json.get("is_modifiable").getAsBoolean()));
1304    if (json.has("_is_modifiable"))
1305      parseElementProperties(getJObject(json, "_is_modifiable"), res.getIs_modifiableElement());
1306    if (json.has("other_details"))
1307      res.setOther_details(parseITEM_STRUCTURE(getJObject(json, "other_details")));
1308  }
1309
1310  protected EHR parseEHR(JsonObject json) throws IOException, FHIRFormatError {
1311    EHR res = new EHR();
1312    parseEHRProperties(json, res);
1313    return res;
1314  }
1315
1316  protected void parseEHRProperties(JsonObject json, EHR res) throws IOException, FHIRFormatError {
1317    parseAnyProperties(json, res);
1318    if (json.has("system_id")) {
1319      JsonArray array = getJArray(json, "system_id");
1320      for (int i = 0; i < array.size(); i++) {
1321        res.getSystem_idList().add(parseHIER_OBJECT_ID(array.get(i).getAsJsonObject()));
1322      }
1323    };
1324    if (json.has("ehr_id"))
1325      res.setEhr_id(parseHIER_OBJECT_ID(getJObject(json, "ehr_id")));
1326    if (json.has("contributions")) {
1327      JsonArray array = getJArray(json, "contributions");
1328      for (int i = 0; i < array.size(); i++) {
1329        res.getContributionsList().add(parseOBJECT_REF(array.get(i).getAsJsonObject()));
1330      }
1331    };
1332    if (json.has("ehr_status"))
1333      res.setEhr_status(parseOBJECT_REF(getJObject(json, "ehr_status")));
1334    if (json.has("ehr_access"))
1335      res.setEhr_access(parseOBJECT_REF(getJObject(json, "ehr_access")));
1336    if (json.has("compositions")) {
1337      JsonArray array = getJArray(json, "compositions");
1338      for (int i = 0; i < array.size(); i++) {
1339        res.getCompositionsList().add(parseOBJECT_REF(array.get(i).getAsJsonObject()));
1340      }
1341    };
1342    if (json.has("directory"))
1343      res.setDirectory(parseOBJECT_REF(getJObject(json, "directory")));
1344    if (json.has("time_created"))
1345      res.setTime_created(parseDV_DATE_TIME(getJObject(json, "time_created")));
1346    if (json.has("folders")) {
1347      JsonArray array = getJArray(json, "folders");
1348      for (int i = 0; i < array.size(); i++) {
1349        res.getFoldersList().add(parseOBJECT_REF(array.get(i).getAsJsonObject()));
1350      }
1351    };
1352    if (json.has("tags")) {
1353      JsonArray array = getJArray(json, "tags");
1354      for (int i = 0; i < array.size(); i++) {
1355        res.getTagsList().add(parseOBJECT_REF(array.get(i).getAsJsonObject()));
1356      }
1357    };
1358  }
1359
1360  protected ELEMENT parseELEMENT(JsonObject json) throws IOException, FHIRFormatError {
1361    ELEMENT res = new ELEMENT();
1362    parseELEMENTProperties(json, res);
1363    return res;
1364  }
1365
1366  protected void parseELEMENTProperties(JsonObject json, ELEMENT res) throws IOException, FHIRFormatError {
1367    parseITEMProperties(json, res);
1368    if (json.has("null_flavour"))
1369      res.setNull_flavour(parseDV_CODED_TEXT(getJObject(json, "null_flavour")));
1370    if (json.has("value"))
1371      res.setValue(parseDATA_VALUE(getJObject(json, "value")));
1372    if (json.has("null_reason"))
1373      res.setNull_reason(parseDV_TEXT(getJObject(json, "null_reason")));
1374  }
1375
1376  protected EVALUATION parseEVALUATION(JsonObject json) throws IOException, FHIRFormatError {
1377    EVALUATION res = new EVALUATION();
1378    parseEVALUATIONProperties(json, res);
1379    return res;
1380  }
1381
1382  protected void parseEVALUATIONProperties(JsonObject json, EVALUATION res) throws IOException, FHIRFormatError {
1383    parseCARE_ENTRYProperties(json, res);
1384    if (json.has("data"))
1385      res.setData(parseITEM_STRUCTURE(getJObject(json, "data")));
1386  }
1387
1388  protected EVENT_CONTEXT parseEVENT_CONTEXT(JsonObject json) throws IOException, FHIRFormatError {
1389    EVENT_CONTEXT res = new EVENT_CONTEXT();
1390    parseEVENT_CONTEXTProperties(json, res);
1391    return res;
1392  }
1393
1394  protected void parseEVENT_CONTEXTProperties(JsonObject json, EVENT_CONTEXT res) throws IOException, FHIRFormatError {
1395    parseLOCATABLEProperties(json, res);
1396    if (json.has("start_time"))
1397      res.setStart_time(parseDV_DATE_TIME(getJObject(json, "start_time")));
1398    if (json.has("end_time"))
1399      res.setEnd_time(parseDV_DATE_TIME(getJObject(json, "end_time")));
1400    if (json.has("location"))
1401      res.setLocationElement(parseString(json.get("location").getAsString()));
1402    if (json.has("_location"))
1403      parseElementProperties(getJObject(json, "_location"), res.getLocationElement());
1404    if (json.has("setting"))
1405      res.setSetting(parseDV_CODED_TEXT(getJObject(json, "setting")));
1406    if (json.has("other_context"))
1407      res.setOther_context(parseITEM_STRUCTURE(getJObject(json, "other_context")));
1408    if (json.has("health_care_facility"))
1409      res.setHealth_care_facility(parsePARTY_IDENTIFIED(getJObject(json, "health_care_facility")));
1410    if (json.has("participations")) {
1411      JsonArray array = getJArray(json, "participations");
1412      for (int i = 0; i < array.size(); i++) {
1413        res.getParticipationsList().add(parsePARTICIPATION(array.get(i).getAsJsonObject()));
1414      }
1415    };
1416  }
1417
1418  protected FEEDER_AUDIT_DETAILS parseFEEDER_AUDIT_DETAILS(JsonObject json) throws IOException, FHIRFormatError {
1419    FEEDER_AUDIT_DETAILS res = new FEEDER_AUDIT_DETAILS();
1420    parseFEEDER_AUDIT_DETAILSProperties(json, res);
1421    return res;
1422  }
1423
1424  protected void parseFEEDER_AUDIT_DETAILSProperties(JsonObject json, FEEDER_AUDIT_DETAILS res) throws IOException, FHIRFormatError {
1425    parseBaseProperties(json, res);
1426    if (json.has("system_id"))
1427      res.setSystem_idElement(parseString(json.get("system_id").getAsString()));
1428    if (json.has("_system_id"))
1429      parseElementProperties(getJObject(json, "_system_id"), res.getSystem_idElement());
1430    if (json.has("location"))
1431      res.setLocation(parsePARTY_IDENTIFIED(getJObject(json, "location")));
1432    if (json.has("subject"))
1433      res.setSubject(parsePARTY_PROXY(getJObject(json, "subject")));
1434    if (json.has("provider"))
1435      res.setProvider(parsePARTY_IDENTIFIED(getJObject(json, "provider")));
1436    if (json.has("time"))
1437      res.setTime(parseDV_DATE_TIME(getJObject(json, "time")));
1438    if (json.has("version_id"))
1439      res.setVersion_idElement(parseString(json.get("version_id").getAsString()));
1440    if (json.has("_version_id"))
1441      parseElementProperties(getJObject(json, "_version_id"), res.getVersion_idElement());
1442    if (json.has("other_details"))
1443      res.setOther_details(parseITEM_STRUCTURE(getJObject(json, "other_details")));
1444  }
1445
1446  protected FEEDER_AUDIT parseFEEDER_AUDIT(JsonObject json) throws IOException, FHIRFormatError {
1447    FEEDER_AUDIT res = new FEEDER_AUDIT();
1448    parseFEEDER_AUDITProperties(json, res);
1449    return res;
1450  }
1451
1452  protected void parseFEEDER_AUDITProperties(JsonObject json, FEEDER_AUDIT res) throws IOException, FHIRFormatError {
1453    parseBaseProperties(json, res);
1454    if (json.has("originating_system_item_ids")) {
1455      JsonArray array = getJArray(json, "originating_system_item_ids");
1456      for (int i = 0; i < array.size(); i++) {
1457        res.getOriginating_system_item_idsList().add(parseDV_IDENTIFIER(array.get(i).getAsJsonObject()));
1458      }
1459    };
1460    if (json.has("feeder_system_item_ids")) {
1461      JsonArray array = getJArray(json, "feeder_system_item_ids");
1462      for (int i = 0; i < array.size(); i++) {
1463        res.getFeeder_system_item_idsList().add(parseDV_IDENTIFIER(array.get(i).getAsJsonObject()));
1464      }
1465    };
1466    if (json.has("original_content"))
1467      res.setOriginal_content(parseDV_ENCAPSULATED(getJObject(json, "original_content")));
1468    if (json.has("originating_system_audit"))
1469      res.setOriginating_system_audit(parseFEEDER_AUDIT_DETAILS(getJObject(json, "originating_system_audit")));
1470    if (json.has("feeder_system_audit"))
1471      res.setFeeder_system_audit(parseFEEDER_AUDIT_DETAILS(getJObject(json, "feeder_system_audit")));
1472  }
1473
1474  protected FOLDER parseFOLDER(JsonObject json) throws IOException, FHIRFormatError {
1475    FOLDER res = new FOLDER();
1476    parseFOLDERProperties(json, res);
1477    return res;
1478  }
1479
1480  protected void parseFOLDERProperties(JsonObject json, FOLDER res) throws IOException, FHIRFormatError {
1481    parseLOCATABLEProperties(json, res);
1482    if (json.has("items")) {
1483      JsonArray array = getJArray(json, "items");
1484      for (int i = 0; i < array.size(); i++) {
1485        res.getItemsList().add(parseOBJECT_REF(array.get(i).getAsJsonObject()));
1486      }
1487    };
1488    if (json.has("folders")) {
1489      JsonArray array = getJArray(json, "folders");
1490      for (int i = 0; i < array.size(); i++) {
1491        res.getFoldersList().add(parseFOLDER(array.get(i).getAsJsonObject()));
1492      }
1493    };
1494    if (json.has("details"))
1495      res.setDetails(parseITEM_STRUCTURE(getJObject(json, "details")));
1496  }
1497
1498  protected GENERIC_ID parseGENERIC_ID(JsonObject json) throws IOException, FHIRFormatError {
1499    GENERIC_ID res = new GENERIC_ID();
1500    parseGENERIC_IDProperties(json, res);
1501    return res;
1502  }
1503
1504  protected void parseGENERIC_IDProperties(JsonObject json, GENERIC_ID res) throws IOException, FHIRFormatError {
1505    parseOBJECT_IDProperties(json, res);
1506  }
1507
1508  protected GROUP parseGROUP(JsonObject json) throws IOException, FHIRFormatError {
1509    GROUP res = new GROUP();
1510    parseGROUPProperties(json, res);
1511    return res;
1512  }
1513
1514  protected void parseGROUPProperties(JsonObject json, GROUP res) throws IOException, FHIRFormatError {
1515    parseACTORProperties(json, res);
1516  }
1517
1518  protected HIER_OBJECT_ID parseHIER_OBJECT_ID(JsonObject json) throws IOException, FHIRFormatError {
1519    HIER_OBJECT_ID res = new HIER_OBJECT_ID();
1520    parseHIER_OBJECT_IDProperties(json, res);
1521    return res;
1522  }
1523
1524  protected void parseHIER_OBJECT_IDProperties(JsonObject json, HIER_OBJECT_ID res) throws IOException, FHIRFormatError {
1525    parseUID_BASED_IDProperties(json, res);
1526  }
1527
1528  protected HISTORY parseHISTORY(JsonObject json) throws IOException, FHIRFormatError {
1529    HISTORY res = new HISTORY();
1530    parseHISTORYProperties(json, res);
1531    return res;
1532  }
1533
1534  protected void parseHISTORYProperties(JsonObject json, HISTORY res) throws IOException, FHIRFormatError {
1535    parseDATA_STRUCTUREProperties(json, res);
1536    if (json.has("origin"))
1537      res.setOrigin(parseDV_DATE_TIME(getJObject(json, "origin")));
1538    if (json.has("period"))
1539      res.setPeriod(parseDV_DURATION(getJObject(json, "period")));
1540    if (json.has("duration"))
1541      res.setDuration(parseDV_DURATION(getJObject(json, "duration")));
1542    if (json.has("summary"))
1543      res.setSummary(parseITEM_STRUCTURE(getJObject(json, "summary")));
1544    if (json.has("events")) {
1545      JsonArray array = getJArray(json, "events");
1546      for (int i = 0; i < array.size(); i++) {
1547        res.getEventsList().add(parseEVENT(array.get(i).getAsJsonObject()));
1548      }
1549    };
1550  }
1551
1552  protected IMPORTED_VERSION parseIMPORTED_VERSION(JsonObject json) throws IOException, FHIRFormatError {
1553    IMPORTED_VERSION res = new IMPORTED_VERSION();
1554    parseIMPORTED_VERSIONProperties(json, res);
1555    return res;
1556  }
1557
1558  protected void parseIMPORTED_VERSIONProperties(JsonObject json, IMPORTED_VERSION res) throws IOException, FHIRFormatError {
1559    parseVERSIONProperties(json, res);
1560    if (json.has("item"))
1561      res.setItem(parseORIGINAL_VERSION(getJObject(json, "item")));
1562  }
1563
1564  protected INSTRUCTION_DETAILS parseINSTRUCTION_DETAILS(JsonObject json) throws IOException, FHIRFormatError {
1565    INSTRUCTION_DETAILS res = new INSTRUCTION_DETAILS();
1566    parseINSTRUCTION_DETAILSProperties(json, res);
1567    return res;
1568  }
1569
1570  protected void parseINSTRUCTION_DETAILSProperties(JsonObject json, INSTRUCTION_DETAILS res) throws IOException, FHIRFormatError {
1571    parsePATHABLEProperties(json, res);
1572    if (json.has("instruction_id"))
1573      res.setInstruction_id(parseLOCATABLE_REF(getJObject(json, "instruction_id")));
1574    if (json.has("activity_id"))
1575      res.setActivity_idElement(parseString(json.get("activity_id").getAsString()));
1576    if (json.has("_activity_id"))
1577      parseElementProperties(getJObject(json, "_activity_id"), res.getActivity_idElement());
1578    if (json.has("wf_details"))
1579      res.setWf_details(parseITEM_STRUCTURE(getJObject(json, "wf_details")));
1580  }
1581
1582  protected INSTRUCTION parseINSTRUCTION(JsonObject json) throws IOException, FHIRFormatError {
1583    INSTRUCTION res = new INSTRUCTION();
1584    parseINSTRUCTIONProperties(json, res);
1585    return res;
1586  }
1587
1588  protected void parseINSTRUCTIONProperties(JsonObject json, INSTRUCTION res) throws IOException, FHIRFormatError {
1589    parseCARE_ENTRYProperties(json, res);
1590    if (json.has("narrative"))
1591      res.setNarrative(parseDV_TEXT(getJObject(json, "narrative")));
1592    if (json.has("expiry_time"))
1593      res.setExpiry_time(parseDV_DATE_TIME(getJObject(json, "expiry_time")));
1594    if (json.has("wf_definition"))
1595      res.setWf_definition(parseDV_PARSABLE(getJObject(json, "wf_definition")));
1596    if (json.has("activities")) {
1597      JsonArray array = getJArray(json, "activities");
1598      for (int i = 0; i < array.size(); i++) {
1599        res.getActivitiesList().add(parseACTIVITY(array.get(i).getAsJsonObject()));
1600      }
1601    };
1602  }
1603
1604  protected INTERNET_ID parseINTERNET_ID(JsonObject json) throws IOException, FHIRFormatError {
1605    INTERNET_ID res = new INTERNET_ID();
1606    parseINTERNET_IDProperties(json, res);
1607    return res;
1608  }
1609
1610  protected void parseINTERNET_IDProperties(JsonObject json, INTERNET_ID res) throws IOException, FHIRFormatError {
1611    parseUIDProperties(json, res);
1612  }
1613
1614  protected INTERVAL_EVENT parseINTERVAL_EVENT(JsonObject json) throws IOException, FHIRFormatError {
1615    INTERVAL_EVENT res = new INTERVAL_EVENT();
1616    parseINTERVAL_EVENTProperties(json, res);
1617    return res;
1618  }
1619
1620  protected void parseINTERVAL_EVENTProperties(JsonObject json, INTERVAL_EVENT res) throws IOException, FHIRFormatError {
1621    parseEVENTProperties(json, res);
1622    if (json.has("width"))
1623      res.setWidth(parseDV_DURATION(getJObject(json, "width")));
1624    if (json.has("sample_count"))
1625      res.setSample_countElement(parseInteger(json.get("sample_count").getAsLong()));
1626    if (json.has("_sample_count"))
1627      parseElementProperties(getJObject(json, "_sample_count"), res.getSample_countElement());
1628    if (json.has("math_function"))
1629      res.setMath_function(parseDV_CODED_TEXT(getJObject(json, "math_function")));
1630  }
1631
1632  protected ISM_TRANSITION parseISM_TRANSITION(JsonObject json) throws IOException, FHIRFormatError {
1633    ISM_TRANSITION res = new ISM_TRANSITION();
1634    parseISM_TRANSITIONProperties(json, res);
1635    return res;
1636  }
1637
1638  protected void parseISM_TRANSITIONProperties(JsonObject json, ISM_TRANSITION res) throws IOException, FHIRFormatError {
1639    parsePATHABLEProperties(json, res);
1640    if (json.has("current_state"))
1641      res.setCurrent_state(parseDV_CODED_TEXT(getJObject(json, "current_state")));
1642    if (json.has("transition"))
1643      res.setTransition(parseDV_CODED_TEXT(getJObject(json, "transition")));
1644    if (json.has("careflow_step"))
1645      res.setCareflow_step(parseDV_CODED_TEXT(getJObject(json, "careflow_step")));
1646    if (json.has("reason")) {
1647      JsonArray array = getJArray(json, "reason");
1648      for (int i = 0; i < array.size(); i++) {
1649        res.getReasonList().add(parseDV_TEXT(array.get(i).getAsJsonObject()));
1650      }
1651    };
1652  }
1653
1654  protected ISO_OID parseISO_OID(JsonObject json) throws IOException, FHIRFormatError {
1655    ISO_OID res = new ISO_OID();
1656    parseISO_OIDProperties(json, res);
1657    return res;
1658  }
1659
1660  protected void parseISO_OIDProperties(JsonObject json, ISO_OID res) throws IOException, FHIRFormatError {
1661    parseUIDProperties(json, res);
1662  }
1663
1664  protected ITEM_LIST parseITEM_LIST(JsonObject json) throws IOException, FHIRFormatError {
1665    ITEM_LIST res = new ITEM_LIST();
1666    parseITEM_LISTProperties(json, res);
1667    return res;
1668  }
1669
1670  protected void parseITEM_LISTProperties(JsonObject json, ITEM_LIST res) throws IOException, FHIRFormatError {
1671    parseITEM_STRUCTUREProperties(json, res);
1672    if (json.has("items")) {
1673      JsonArray array = getJArray(json, "items");
1674      for (int i = 0; i < array.size(); i++) {
1675        res.getItemsList().add(parseELEMENT(array.get(i).getAsJsonObject()));
1676      }
1677    };
1678  }
1679
1680  protected ITEM_SINGLE parseITEM_SINGLE(JsonObject json) throws IOException, FHIRFormatError {
1681    ITEM_SINGLE res = new ITEM_SINGLE();
1682    parseITEM_SINGLEProperties(json, res);
1683    return res;
1684  }
1685
1686  protected void parseITEM_SINGLEProperties(JsonObject json, ITEM_SINGLE res) throws IOException, FHIRFormatError {
1687    parseITEM_STRUCTUREProperties(json, res);
1688    if (json.has("item"))
1689      res.setItem(parseELEMENT(getJObject(json, "item")));
1690  }
1691
1692  protected ITEM_TABLE parseITEM_TABLE(JsonObject json) throws IOException, FHIRFormatError {
1693    ITEM_TABLE res = new ITEM_TABLE();
1694    parseITEM_TABLEProperties(json, res);
1695    return res;
1696  }
1697
1698  protected void parseITEM_TABLEProperties(JsonObject json, ITEM_TABLE res) throws IOException, FHIRFormatError {
1699    parseITEM_STRUCTUREProperties(json, res);
1700    if (json.has("rows")) {
1701      JsonArray array = getJArray(json, "rows");
1702      for (int i = 0; i < array.size(); i++) {
1703        res.getRowsList().add(parseCLUSTER(array.get(i).getAsJsonObject()));
1704      }
1705    };
1706  }
1707
1708  protected ITEM_TAG parseITEM_TAG(JsonObject json) throws IOException, FHIRFormatError {
1709    ITEM_TAG res = new ITEM_TAG();
1710    parseITEM_TAGProperties(json, res);
1711    return res;
1712  }
1713
1714  protected void parseITEM_TAGProperties(JsonObject json, ITEM_TAG res) throws IOException, FHIRFormatError {
1715    parseBaseProperties(json, res);
1716    if (json.has("key"))
1717      res.setKeyElement(parseString(json.get("key").getAsString()));
1718    if (json.has("_key"))
1719      parseElementProperties(getJObject(json, "_key"), res.getKeyElement());
1720    if (json.has("value"))
1721      res.setValueElement(parseString(json.get("value").getAsString()));
1722    if (json.has("_value"))
1723      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
1724    if (json.has("target"))
1725      res.setTarget(parseUID_BASED_ID(getJObject(json, "target")));
1726    if (json.has("target_path"))
1727      res.setTarget_pathElement(parseString(json.get("target_path").getAsString()));
1728    if (json.has("_target_path"))
1729      parseElementProperties(getJObject(json, "_target_path"), res.getTarget_pathElement());
1730    if (json.has("owner_id"))
1731      res.setOwner_id(parseOBJECT_REF(getJObject(json, "owner_id")));
1732  }
1733
1734  protected ITEM_TREE parseITEM_TREE(JsonObject json) throws IOException, FHIRFormatError {
1735    ITEM_TREE res = new ITEM_TREE();
1736    parseITEM_TREEProperties(json, res);
1737    return res;
1738  }
1739
1740  protected void parseITEM_TREEProperties(JsonObject json, ITEM_TREE res) throws IOException, FHIRFormatError {
1741    parseITEM_STRUCTUREProperties(json, res);
1742    if (json.has("items")) {
1743      JsonArray array = getJArray(json, "items");
1744      for (int i = 0; i < array.size(); i++) {
1745        res.getItemsList().add(parseITEM(array.get(i).getAsJsonObject()));
1746      }
1747    };
1748  }
1749
1750  protected LINK parseLINK(JsonObject json) throws IOException, FHIRFormatError {
1751    LINK res = new LINK();
1752    parseLINKProperties(json, res);
1753    return res;
1754  }
1755
1756  protected void parseLINKProperties(JsonObject json, LINK res) throws IOException, FHIRFormatError {
1757    parseBaseProperties(json, res);
1758    if (json.has("meaning"))
1759      res.setMeaning(parseDV_TEXT(getJObject(json, "meaning")));
1760    if (json.has("type"))
1761      res.setType(parseDV_TEXT(getJObject(json, "type")));
1762    if (json.has("target"))
1763      res.setTarget(parseDV_EHR_URI(getJObject(json, "target")));
1764  }
1765
1766  protected LOCATABLE_REF parseLOCATABLE_REF(JsonObject json) throws IOException, FHIRFormatError {
1767    LOCATABLE_REF res = new LOCATABLE_REF();
1768    parseLOCATABLE_REFProperties(json, res);
1769    return res;
1770  }
1771
1772  protected void parseLOCATABLE_REFProperties(JsonObject json, LOCATABLE_REF res) throws IOException, FHIRFormatError {
1773    parseOBJECT_REFProperties(json, res);
1774    if (json.has("path"))
1775      res.setPathElement(parseString(json.get("path").getAsString()));
1776    if (json.has("_path"))
1777      parseElementProperties(getJObject(json, "_path"), res.getPathElement());
1778  }
1779
1780  protected OBJECT_REF parseOBJECT_REF(JsonObject json) throws IOException, FHIRFormatError {
1781    OBJECT_REF res = new OBJECT_REF();
1782    parseOBJECT_REFProperties(json, res);
1783    return res;
1784  }
1785
1786  protected void parseOBJECT_REFProperties(JsonObject json, OBJECT_REF res) throws IOException, FHIRFormatError {
1787    parseBaseProperties(json, res);
1788    if (json.has("namespace"))
1789      res.setNamespaceElement(parseString(json.get("namespace").getAsString()));
1790    if (json.has("_namespace"))
1791      parseElementProperties(getJObject(json, "_namespace"), res.getNamespaceElement());
1792    if (json.has("type"))
1793      res.setTypeElement(parseString(json.get("type").getAsString()));
1794    if (json.has("_type"))
1795      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
1796    if (json.has("id"))
1797      res.setId(parseOBJECT_ID(getJObject(json, "id")));
1798  }
1799
1800  protected OBJECT_VERSION_ID parseOBJECT_VERSION_ID(JsonObject json) throws IOException, FHIRFormatError {
1801    OBJECT_VERSION_ID res = new OBJECT_VERSION_ID();
1802    parseOBJECT_VERSION_IDProperties(json, res);
1803    return res;
1804  }
1805
1806  protected void parseOBJECT_VERSION_IDProperties(JsonObject json, OBJECT_VERSION_ID res) throws IOException, FHIRFormatError {
1807    parseUID_BASED_IDProperties(json, res);
1808  }
1809
1810  protected OBSERVATION parseOBSERVATION(JsonObject json) throws IOException, FHIRFormatError {
1811    OBSERVATION res = new OBSERVATION();
1812    parseOBSERVATIONProperties(json, res);
1813    return res;
1814  }
1815
1816  protected void parseOBSERVATIONProperties(JsonObject json, OBSERVATION res) throws IOException, FHIRFormatError {
1817    parseCARE_ENTRYProperties(json, res);
1818    if (json.has("data"))
1819      res.setData(parseHISTORY(getJObject(json, "data")));
1820    if (json.has("state"))
1821      res.setState(parseHISTORY(getJObject(json, "state")));
1822  }
1823
1824  protected ORGANISATION parseORGANISATION(JsonObject json) throws IOException, FHIRFormatError {
1825    ORGANISATION res = new ORGANISATION();
1826    parseORGANISATIONProperties(json, res);
1827    return res;
1828  }
1829
1830  protected void parseORGANISATIONProperties(JsonObject json, ORGANISATION res) throws IOException, FHIRFormatError {
1831    parseACTORProperties(json, res);
1832  }
1833
1834  protected ORIGINAL_VERSION parseORIGINAL_VERSION(JsonObject json) throws IOException, FHIRFormatError {
1835    ORIGINAL_VERSION res = new ORIGINAL_VERSION();
1836    parseORIGINAL_VERSIONProperties(json, res);
1837    return res;
1838  }
1839
1840  protected void parseORIGINAL_VERSIONProperties(JsonObject json, ORIGINAL_VERSION res) throws IOException, FHIRFormatError {
1841    parseVERSIONProperties(json, res);
1842    if (json.has("uid"))
1843      res.setUid(parseOBJECT_VERSION_ID(getJObject(json, "uid")));
1844    if (json.has("preceding_version_uid"))
1845      res.setPreceding_version_uid(parseOBJECT_VERSION_ID(getJObject(json, "preceding_version_uid")));
1846    if (json.has("other_input_version_uids")) {
1847      JsonArray array = getJArray(json, "other_input_version_uids");
1848      for (int i = 0; i < array.size(); i++) {
1849        res.getOther_input_version_uidsList().add(parseOBJECT_VERSION_ID(array.get(i).getAsJsonObject()));
1850      }
1851    };
1852    if (json.has("lifecycle_state"))
1853      res.setLifecycle_state(parseDV_CODED_TEXT(getJObject(json, "lifecycle_state")));
1854    if (json.has("attestations")) {
1855      JsonArray array = getJArray(json, "attestations");
1856      for (int i = 0; i < array.size(); i++) {
1857        res.getAttestationsList().add(parseATTESTATION(array.get(i).getAsJsonObject()));
1858      }
1859    };
1860    if (json.has("data"))
1861      res.setData(parseAny(getJObject(json, "data")));
1862  }
1863
1864  protected PARTICIPATION parsePARTICIPATION(JsonObject json) throws IOException, FHIRFormatError {
1865    PARTICIPATION res = new PARTICIPATION();
1866    parsePARTICIPATIONProperties(json, res);
1867    return res;
1868  }
1869
1870  protected void parsePARTICIPATIONProperties(JsonObject json, PARTICIPATION res) throws IOException, FHIRFormatError {
1871    parseLOCATABLEProperties(json, res);
1872    if (json.has("function"))
1873      res.setFunction(parseDV_TEXT(getJObject(json, "function")));
1874    if (json.has("mode"))
1875      res.setMode(parseDV_CODED_TEXT(getJObject(json, "mode")));
1876    if (json.has("performer"))
1877      res.setPerformer(parsePARTY_PROXY(getJObject(json, "performer")));
1878    if (json.has("time"))
1879      res.setTime(parseDV_INTERVAL(getJObject(json, "time")));
1880  }
1881
1882  protected PARTY_IDENTIFIED parsePARTY_IDENTIFIED(JsonObject json) throws IOException, FHIRFormatError {
1883    PARTY_IDENTIFIED res = new PARTY_IDENTIFIED();
1884    parsePARTY_IDENTIFIEDProperties(json, res);
1885    return res;
1886  }
1887
1888  protected void parsePARTY_IDENTIFIEDProperties(JsonObject json, PARTY_IDENTIFIED res) throws IOException, FHIRFormatError {
1889    parsePARTY_PROXYProperties(json, res);
1890    if (json.has("name"))
1891      res.setNameElement(parseString(json.get("name").getAsString()));
1892    if (json.has("_name"))
1893      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
1894    if (json.has("identifiers")) {
1895      JsonArray array = getJArray(json, "identifiers");
1896      for (int i = 0; i < array.size(); i++) {
1897        res.getIdentifiersList().add(parseDV_IDENTIFIER(array.get(i).getAsJsonObject()));
1898      }
1899    };
1900  }
1901
1902  protected PARTY_IDENTITY parsePARTY_IDENTITY(JsonObject json) throws IOException, FHIRFormatError {
1903    PARTY_IDENTITY res = new PARTY_IDENTITY();
1904    parsePARTY_IDENTITYProperties(json, res);
1905    return res;
1906  }
1907
1908  protected void parsePARTY_IDENTITYProperties(JsonObject json, PARTY_IDENTITY res) throws IOException, FHIRFormatError {
1909    parseLOCATABLEProperties(json, res);
1910    if (json.has("details"))
1911      res.setDetails(parseITEM_STRUCTURE(getJObject(json, "details")));
1912  }
1913
1914  protected PARTY_REF parsePARTY_REF(JsonObject json) throws IOException, FHIRFormatError {
1915    PARTY_REF res = new PARTY_REF();
1916    parsePARTY_REFProperties(json, res);
1917    return res;
1918  }
1919
1920  protected void parsePARTY_REFProperties(JsonObject json, PARTY_REF res) throws IOException, FHIRFormatError {
1921    parseOBJECT_REFProperties(json, res);
1922  }
1923
1924  protected PARTY_RELATED parsePARTY_RELATED(JsonObject json) throws IOException, FHIRFormatError {
1925    PARTY_RELATED res = new PARTY_RELATED();
1926    parsePARTY_RELATEDProperties(json, res);
1927    return res;
1928  }
1929
1930  protected void parsePARTY_RELATEDProperties(JsonObject json, PARTY_RELATED res) throws IOException, FHIRFormatError {
1931    parsePARTY_IDENTIFIEDProperties(json, res);
1932    if (json.has("relationship"))
1933      res.setRelationship(parseDV_CODED_TEXT(getJObject(json, "relationship")));
1934  }
1935
1936  protected PARTY_RELATIONSHIP parsePARTY_RELATIONSHIP(JsonObject json) throws IOException, FHIRFormatError {
1937    PARTY_RELATIONSHIP res = new PARTY_RELATIONSHIP();
1938    parsePARTY_RELATIONSHIPProperties(json, res);
1939    return res;
1940  }
1941
1942  protected void parsePARTY_RELATIONSHIPProperties(JsonObject json, PARTY_RELATIONSHIP res) throws IOException, FHIRFormatError {
1943    parseLOCATABLEProperties(json, res);
1944    if (json.has("details"))
1945      res.setDetails(parseITEM_STRUCTURE(getJObject(json, "details")));
1946    if (json.has("target"))
1947      res.setTarget(parsePARTY_REF(getJObject(json, "target")));
1948    if (json.has("time_validity"))
1949      res.setTime_validity(parseDV_INTERVAL(getJObject(json, "time_validity")));
1950    if (json.has("source"))
1951      res.setSource(parsePARTY_REF(getJObject(json, "source")));
1952  }
1953
1954  protected PARTY_SELF parsePARTY_SELF(JsonObject json) throws IOException, FHIRFormatError {
1955    PARTY_SELF res = new PARTY_SELF();
1956    parsePARTY_SELFProperties(json, res);
1957    return res;
1958  }
1959
1960  protected void parsePARTY_SELFProperties(JsonObject json, PARTY_SELF res) throws IOException, FHIRFormatError {
1961    parsePARTY_PROXYProperties(json, res);
1962  }
1963
1964  protected PERSON parsePERSON(JsonObject json) throws IOException, FHIRFormatError {
1965    PERSON res = new PERSON();
1966    parsePERSONProperties(json, res);
1967    return res;
1968  }
1969
1970  protected void parsePERSONProperties(JsonObject json, PERSON res) throws IOException, FHIRFormatError {
1971    parseACTORProperties(json, res);
1972  }
1973
1974  protected POINT_EVENT parsePOINT_EVENT(JsonObject json) throws IOException, FHIRFormatError {
1975    POINT_EVENT res = new POINT_EVENT();
1976    parsePOINT_EVENTProperties(json, res);
1977    return res;
1978  }
1979
1980  protected void parsePOINT_EVENTProperties(JsonObject json, POINT_EVENT res) throws IOException, FHIRFormatError {
1981    parseEVENTProperties(json, res);
1982  }
1983
1984  protected REFERENCE_RANGE parseREFERENCE_RANGE(JsonObject json) throws IOException, FHIRFormatError {
1985    REFERENCE_RANGE res = new REFERENCE_RANGE();
1986    parseREFERENCE_RANGEProperties(json, res);
1987    return res;
1988  }
1989
1990  protected void parseREFERENCE_RANGEProperties(JsonObject json, REFERENCE_RANGE res) throws IOException, FHIRFormatError {
1991    parseBaseProperties(json, res);
1992    if (json.has("meaning"))
1993      res.setMeaning(parseDV_TEXT(getJObject(json, "meaning")));
1994    if (json.has("range"))
1995      res.setRange(parseDV_INTERVAL(getJObject(json, "range")));
1996  }
1997
1998  protected RESOURCE_DESCRIPTION_ITEM parseRESOURCE_DESCRIPTION_ITEM(JsonObject json) throws IOException, FHIRFormatError {
1999    RESOURCE_DESCRIPTION_ITEM res = new RESOURCE_DESCRIPTION_ITEM();
2000    parseRESOURCE_DESCRIPTION_ITEMProperties(json, res);
2001    return res;
2002  }
2003
2004  protected void parseRESOURCE_DESCRIPTION_ITEMProperties(JsonObject json, RESOURCE_DESCRIPTION_ITEM res) throws IOException, FHIRFormatError {
2005    parseBaseProperties(json, res);
2006    if (json.has("language"))
2007      res.setLanguage(parseCODE_PHRASE(getJObject(json, "language")));
2008    if (json.has("purpose"))
2009      res.setPurposeElement(parseString(json.get("purpose").getAsString()));
2010    if (json.has("_purpose"))
2011      parseElementProperties(getJObject(json, "_purpose"), res.getPurposeElement());
2012    if (json.has("keywords")) {
2013      JsonArray array = getJArray(json, "keywords");
2014      for (int i = 0; i < array.size(); i++) {
2015        if (array.get(i).isJsonNull()) {
2016          res.getKeywordsList().add(new StringType());
2017        } else {;
2018          res.getKeywordsList().add(parseString(array.get(i).getAsString()));
2019        }
2020      }
2021    };
2022    if (json.has("_keywords")) {
2023      JsonArray array = getJArray(json, "_keywords");
2024      for (int i = 0; i < array.size(); i++) {
2025        if (i == res.getKeywordsList().size())
2026          res.getKeywordsList().add(parseString(null));
2027        if (array.get(i) instanceof JsonObject) 
2028          parseElementProperties(array.get(i).getAsJsonObject(), res.getKeywordsList().get(i));
2029      }
2030    };
2031    if (json.has("use"))
2032      res.setUseElement(parseString(json.get("use").getAsString()));
2033    if (json.has("_use"))
2034      parseElementProperties(getJObject(json, "_use"), res.getUseElement());
2035    if (json.has("misuse"))
2036      res.setMisuseElement(parseString(json.get("misuse").getAsString()));
2037    if (json.has("_misuse"))
2038      parseElementProperties(getJObject(json, "_misuse"), res.getMisuseElement());
2039    if (json.has("copyright"))
2040      res.setCopyrightElement(parseString(json.get("copyright").getAsString()));
2041    if (json.has("_copyright"))
2042      parseElementProperties(getJObject(json, "_copyright"), res.getCopyrightElement());
2043    if (json.has("original_resource_uri")) {
2044      JsonArray array = getJArray(json, "original_resource_uri");
2045      for (int i = 0; i < array.size(); i++) {
2046        if (array.get(i).isJsonNull()) {
2047          res.getOriginal_resource_uriList().add(new StringType());
2048        } else {;
2049          res.getOriginal_resource_uriList().add(parseString(array.get(i).getAsString()));
2050        }
2051      }
2052    };
2053    if (json.has("_original_resource_uri")) {
2054      JsonArray array = getJArray(json, "_original_resource_uri");
2055      for (int i = 0; i < array.size(); i++) {
2056        if (i == res.getOriginal_resource_uriList().size())
2057          res.getOriginal_resource_uriList().add(parseString(null));
2058        if (array.get(i) instanceof JsonObject) 
2059          parseElementProperties(array.get(i).getAsJsonObject(), res.getOriginal_resource_uriList().get(i));
2060      }
2061    };
2062    if (json.has("other_details")) {
2063      JsonArray array = getJArray(json, "other_details");
2064      for (int i = 0; i < array.size(); i++) {
2065        if (array.get(i).isJsonNull()) {
2066          res.getOther_detailsList().add(new StringType());
2067        } else {;
2068          res.getOther_detailsList().add(parseString(array.get(i).getAsString()));
2069        }
2070      }
2071    };
2072    if (json.has("_other_details")) {
2073      JsonArray array = getJArray(json, "_other_details");
2074      for (int i = 0; i < array.size(); i++) {
2075        if (i == res.getOther_detailsList().size())
2076          res.getOther_detailsList().add(parseString(null));
2077        if (array.get(i) instanceof JsonObject) 
2078          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther_detailsList().get(i));
2079      }
2080    };
2081  }
2082
2083  protected RESOURCE_DESCRIPTION parseRESOURCE_DESCRIPTION(JsonObject json) throws IOException, FHIRFormatError {
2084    RESOURCE_DESCRIPTION res = new RESOURCE_DESCRIPTION();
2085    parseRESOURCE_DESCRIPTIONProperties(json, res);
2086    return res;
2087  }
2088
2089  protected void parseRESOURCE_DESCRIPTIONProperties(JsonObject json, RESOURCE_DESCRIPTION res) throws IOException, FHIRFormatError {
2090    parseBaseProperties(json, res);
2091    if (json.has("original_author")) {
2092      JsonArray array = getJArray(json, "original_author");
2093      for (int i = 0; i < array.size(); i++) {
2094        if (array.get(i).isJsonNull()) {
2095          res.getOriginal_authorList().add(new StringType());
2096        } else {;
2097          res.getOriginal_authorList().add(parseString(array.get(i).getAsString()));
2098        }
2099      }
2100    };
2101    if (json.has("_original_author")) {
2102      JsonArray array = getJArray(json, "_original_author");
2103      for (int i = 0; i < array.size(); i++) {
2104        if (i == res.getOriginal_authorList().size())
2105          res.getOriginal_authorList().add(parseString(null));
2106        if (array.get(i) instanceof JsonObject) 
2107          parseElementProperties(array.get(i).getAsJsonObject(), res.getOriginal_authorList().get(i));
2108      }
2109    };
2110    if (json.has("other_contributors")) {
2111      JsonArray array = getJArray(json, "other_contributors");
2112      for (int i = 0; i < array.size(); i++) {
2113        if (array.get(i).isJsonNull()) {
2114          res.getOther_contributorsList().add(new StringType());
2115        } else {;
2116          res.getOther_contributorsList().add(parseString(array.get(i).getAsString()));
2117        }
2118      }
2119    };
2120    if (json.has("_other_contributors")) {
2121      JsonArray array = getJArray(json, "_other_contributors");
2122      for (int i = 0; i < array.size(); i++) {
2123        if (i == res.getOther_contributorsList().size())
2124          res.getOther_contributorsList().add(parseString(null));
2125        if (array.get(i) instanceof JsonObject) 
2126          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther_contributorsList().get(i));
2127      }
2128    };
2129    if (json.has("lifecycle_state"))
2130      res.setLifecycle_stateElement(parseString(json.get("lifecycle_state").getAsString()));
2131    if (json.has("_lifecycle_state"))
2132      parseElementProperties(getJObject(json, "_lifecycle_state"), res.getLifecycle_stateElement());
2133    if (json.has("resource_package_uri"))
2134      res.setResource_package_uriElement(parseString(json.get("resource_package_uri").getAsString()));
2135    if (json.has("_resource_package_uri"))
2136      parseElementProperties(getJObject(json, "_resource_package_uri"), res.getResource_package_uriElement());
2137    if (json.has("other_details")) {
2138      JsonArray array = getJArray(json, "other_details");
2139      for (int i = 0; i < array.size(); i++) {
2140        res.getOther_detailsList().add(parseOBJECT_REF(array.get(i).getAsJsonObject()));
2141      }
2142    };
2143    if (json.has("parent_resource"))
2144      res.setParent_resource(parseAUTHORED_RESOURCE(getJObject(json, "parent_resource")));
2145    if (json.has("details")) {
2146      JsonArray array = getJArray(json, "details");
2147      for (int i = 0; i < array.size(); i++) {
2148        res.getDetailsList().add(parseRESOURCE_DESCRIPTION_ITEM(array.get(i).getAsJsonObject()));
2149      }
2150    };
2151  }
2152
2153  protected REVISION_HISTORY_ITEM parseREVISION_HISTORY_ITEM(JsonObject json) throws IOException, FHIRFormatError {
2154    REVISION_HISTORY_ITEM res = new REVISION_HISTORY_ITEM();
2155    parseREVISION_HISTORY_ITEMProperties(json, res);
2156    return res;
2157  }
2158
2159  protected void parseREVISION_HISTORY_ITEMProperties(JsonObject json, REVISION_HISTORY_ITEM res) throws IOException, FHIRFormatError {
2160    parseBaseProperties(json, res);
2161    if (json.has("version_id"))
2162      res.setVersion_id(parseOBJECT_VERSION_ID(getJObject(json, "version_id")));
2163    if (json.has("audits")) {
2164      JsonArray array = getJArray(json, "audits");
2165      for (int i = 0; i < array.size(); i++) {
2166        res.getAuditsList().add(parseAUDIT_DETAILS(array.get(i).getAsJsonObject()));
2167      }
2168    };
2169  }
2170
2171  protected REVISION_HISTORY parseREVISION_HISTORY(JsonObject json) throws IOException, FHIRFormatError {
2172    REVISION_HISTORY res = new REVISION_HISTORY();
2173    parseREVISION_HISTORYProperties(json, res);
2174    return res;
2175  }
2176
2177  protected void parseREVISION_HISTORYProperties(JsonObject json, REVISION_HISTORY res) throws IOException, FHIRFormatError {
2178    parseBaseProperties(json, res);
2179    if (json.has("most_recent_version"))
2180      res.setMost_recent_versionElement(parseString(json.get("most_recent_version").getAsString()));
2181    if (json.has("_most_recent_version"))
2182      parseElementProperties(getJObject(json, "_most_recent_version"), res.getMost_recent_versionElement());
2183    if (json.has("most_recent_version_time_committed"))
2184      res.setMost_recent_version_time_committedElement(parseString(json.get("most_recent_version_time_committed").getAsString()));
2185    if (json.has("_most_recent_version_time_committed"))
2186      parseElementProperties(getJObject(json, "_most_recent_version_time_committed"), res.getMost_recent_version_time_committedElement());
2187  }
2188
2189  protected ROLE parseROLE(JsonObject json) throws IOException, FHIRFormatError {
2190    ROLE res = new ROLE();
2191    parseROLEProperties(json, res);
2192    return res;
2193  }
2194
2195  protected void parseROLEProperties(JsonObject json, ROLE res) throws IOException, FHIRFormatError {
2196    parsePARTYProperties(json, res);
2197    if (json.has("time_validity"))
2198      res.setTime_validity(parseDV_INTERVAL(getJObject(json, "time_validity")));
2199    if (json.has("performer"))
2200      res.setPerformer(parsePARTY_REF(getJObject(json, "performer")));
2201    if (json.has("capabilities")) {
2202      JsonArray array = getJArray(json, "capabilities");
2203      for (int i = 0; i < array.size(); i++) {
2204        res.getCapabilitiesList().add(parseCAPABILITY(array.get(i).getAsJsonObject()));
2205      }
2206    };
2207  }
2208
2209  protected SECTION parseSECTION(JsonObject json) throws IOException, FHIRFormatError {
2210    SECTION res = new SECTION();
2211    parseSECTIONProperties(json, res);
2212    return res;
2213  }
2214
2215  protected void parseSECTIONProperties(JsonObject json, SECTION res) throws IOException, FHIRFormatError {
2216    parseCONTENT_ITEMProperties(json, res);
2217    if (json.has("items")) {
2218      JsonArray array = getJArray(json, "items");
2219      for (int i = 0; i < array.size(); i++) {
2220        res.getItemsList().add(parseCONTENT_ITEM(array.get(i).getAsJsonObject()));
2221      }
2222    };
2223  }
2224
2225  protected TEMPLATE_ID parseTEMPLATE_ID(JsonObject json) throws IOException, FHIRFormatError {
2226    TEMPLATE_ID res = new TEMPLATE_ID();
2227    parseTEMPLATE_IDProperties(json, res);
2228    return res;
2229  }
2230
2231  protected void parseTEMPLATE_IDProperties(JsonObject json, TEMPLATE_ID res) throws IOException, FHIRFormatError {
2232    parseOBJECT_IDProperties(json, res);
2233  }
2234
2235  protected TERM_MAPPING parseTERM_MAPPING(JsonObject json) throws IOException, FHIRFormatError {
2236    TERM_MAPPING res = new TERM_MAPPING();
2237    parseTERM_MAPPINGProperties(json, res);
2238    return res;
2239  }
2240
2241  protected void parseTERM_MAPPINGProperties(JsonObject json, TERM_MAPPING res) throws IOException, FHIRFormatError {
2242    parseBaseProperties(json, res);
2243    if (json.has("match"))
2244      res.setMatchElement(parseString(json.get("match").getAsString()));
2245    if (json.has("_match"))
2246      parseElementProperties(getJObject(json, "_match"), res.getMatchElement());
2247    if (json.has("purpose"))
2248      res.setPurpose(parseDV_CODED_TEXT(getJObject(json, "purpose")));
2249    if (json.has("target"))
2250      res.setTarget(parseCODE_PHRASE(getJObject(json, "target")));
2251  }
2252
2253  protected TERMINOLOGY_ID parseTERMINOLOGY_ID(JsonObject json) throws IOException, FHIRFormatError {
2254    TERMINOLOGY_ID res = new TERMINOLOGY_ID();
2255    parseTERMINOLOGY_IDProperties(json, res);
2256    return res;
2257  }
2258
2259  protected void parseTERMINOLOGY_IDProperties(JsonObject json, TERMINOLOGY_ID res) throws IOException, FHIRFormatError {
2260    parseOBJECT_IDProperties(json, res);
2261  }
2262
2263  protected TRANSLATION_DETAILS parseTRANSLATION_DETAILS(JsonObject json) throws IOException, FHIRFormatError {
2264    TRANSLATION_DETAILS res = new TRANSLATION_DETAILS();
2265    parseTRANSLATION_DETAILSProperties(json, res);
2266    return res;
2267  }
2268
2269  protected void parseTRANSLATION_DETAILSProperties(JsonObject json, TRANSLATION_DETAILS res) throws IOException, FHIRFormatError {
2270    parseBaseProperties(json, res);
2271    if (json.has("language"))
2272      res.setLanguage(parseCODE_PHRASE(getJObject(json, "language")));
2273    if (json.has("author")) {
2274      JsonArray array = getJArray(json, "author");
2275      for (int i = 0; i < array.size(); i++) {
2276        if (array.get(i).isJsonNull()) {
2277          res.getAuthorList().add(new StringType());
2278        } else {;
2279          res.getAuthorList().add(parseString(array.get(i).getAsString()));
2280        }
2281      }
2282    };
2283    if (json.has("_author")) {
2284      JsonArray array = getJArray(json, "_author");
2285      for (int i = 0; i < array.size(); i++) {
2286        if (i == res.getAuthorList().size())
2287          res.getAuthorList().add(parseString(null));
2288        if (array.get(i) instanceof JsonObject) 
2289          parseElementProperties(array.get(i).getAsJsonObject(), res.getAuthorList().get(i));
2290      }
2291    };
2292    if (json.has("accreditation"))
2293      res.setAccreditationElement(parseString(json.get("accreditation").getAsString()));
2294    if (json.has("_accreditation"))
2295      parseElementProperties(getJObject(json, "_accreditation"), res.getAccreditationElement());
2296    if (json.has("other_details")) {
2297      JsonArray array = getJArray(json, "other_details");
2298      for (int i = 0; i < array.size(); i++) {
2299        if (array.get(i).isJsonNull()) {
2300          res.getOther_detailsList().add(new StringType());
2301        } else {;
2302          res.getOther_detailsList().add(parseString(array.get(i).getAsString()));
2303        }
2304      }
2305    };
2306    if (json.has("_other_details")) {
2307      JsonArray array = getJArray(json, "_other_details");
2308      for (int i = 0; i < array.size(); i++) {
2309        if (i == res.getOther_detailsList().size())
2310          res.getOther_detailsList().add(parseString(null));
2311        if (array.get(i) instanceof JsonObject) 
2312          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther_detailsList().get(i));
2313      }
2314    };
2315  }
2316
2317  protected TranslatedString parseTranslatedString(JsonObject json) throws IOException, FHIRFormatError {
2318    TranslatedString res = new TranslatedString();
2319    parseTranslatedStringProperties(json, res);
2320    return res;
2321  }
2322
2323  protected void parseTranslatedStringProperties(JsonObject json, TranslatedString res) throws IOException, FHIRFormatError {
2324    parseBaseProperties(json, res);
2325    if (json.has("language"))
2326      res.setLanguageElement(parseCode(json.get("language").getAsString()));
2327    if (json.has("_language"))
2328      parseElementProperties(getJObject(json, "_language"), res.getLanguageElement());
2329    if (json.has("value"))
2330      res.setValueElement(parseString(json.get("value").getAsString()));
2331    if (json.has("_value"))
2332      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
2333  }
2334
2335  protected UUID parseUUID(JsonObject json) throws IOException, FHIRFormatError {
2336    UUID res = new UUID();
2337    parseUUIDProperties(json, res);
2338    return res;
2339  }
2340
2341  protected void parseUUIDProperties(JsonObject json, UUID res) throws IOException, FHIRFormatError {
2342    parseUIDProperties(json, res);
2343  }
2344
2345  protected VERSION_TREE_ID parseVERSION_TREE_ID(JsonObject json) throws IOException, FHIRFormatError {
2346    VERSION_TREE_ID res = new VERSION_TREE_ID();
2347    parseVERSION_TREE_IDProperties(json, res);
2348    return res;
2349  }
2350
2351  protected void parseVERSION_TREE_IDProperties(JsonObject json, VERSION_TREE_ID res) throws IOException, FHIRFormatError {
2352    parseBaseProperties(json, res);
2353    if (json.has("value"))
2354      res.setValueElement(parseString(json.get("value").getAsString()));
2355    if (json.has("_value"))
2356      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
2357  }
2358
2359  protected VERSIONED_COMPOSITION parseVERSIONED_COMPOSITION(JsonObject json) throws IOException, FHIRFormatError {
2360    VERSIONED_COMPOSITION res = new VERSIONED_COMPOSITION();
2361    parseVERSIONED_COMPOSITIONProperties(json, res);
2362    return res;
2363  }
2364
2365  protected void parseVERSIONED_COMPOSITIONProperties(JsonObject json, VERSIONED_COMPOSITION res) throws IOException, FHIRFormatError {
2366    parseVERSIONED_OBJECTProperties(json, res);
2367  }
2368
2369  protected VERSIONED_EHR_ACCESS parseVERSIONED_EHR_ACCESS(JsonObject json) throws IOException, FHIRFormatError {
2370    VERSIONED_EHR_ACCESS res = new VERSIONED_EHR_ACCESS();
2371    parseVERSIONED_EHR_ACCESSProperties(json, res);
2372    return res;
2373  }
2374
2375  protected void parseVERSIONED_EHR_ACCESSProperties(JsonObject json, VERSIONED_EHR_ACCESS res) throws IOException, FHIRFormatError {
2376    parseVERSIONED_OBJECTProperties(json, res);
2377  }
2378
2379  protected VERSIONED_EHR_STATUS parseVERSIONED_EHR_STATUS(JsonObject json) throws IOException, FHIRFormatError {
2380    VERSIONED_EHR_STATUS res = new VERSIONED_EHR_STATUS();
2381    parseVERSIONED_EHR_STATUSProperties(json, res);
2382    return res;
2383  }
2384
2385  protected void parseVERSIONED_EHR_STATUSProperties(JsonObject json, VERSIONED_EHR_STATUS res) throws IOException, FHIRFormatError {
2386    parseVERSIONED_OBJECTProperties(json, res);
2387  }
2388
2389  protected VERSIONED_FOLDER parseVERSIONED_FOLDER(JsonObject json) throws IOException, FHIRFormatError {
2390    VERSIONED_FOLDER res = new VERSIONED_FOLDER();
2391    parseVERSIONED_FOLDERProperties(json, res);
2392    return res;
2393  }
2394
2395  protected void parseVERSIONED_FOLDERProperties(JsonObject json, VERSIONED_FOLDER res) throws IOException, FHIRFormatError {
2396    parseVERSIONED_OBJECTProperties(json, res);
2397  }
2398
2399  protected VERSIONED_OBJECT parseVERSIONED_OBJECT(JsonObject json) throws IOException, FHIRFormatError {
2400    VERSIONED_OBJECT res = new VERSIONED_OBJECT();
2401    parseVERSIONED_OBJECTProperties(json, res);
2402    return res;
2403  }
2404
2405  protected void parseVERSIONED_OBJECTProperties(JsonObject json, VERSIONED_OBJECT res) throws IOException, FHIRFormatError {
2406    parseBaseProperties(json, res);
2407    if (json.has("uid"))
2408      res.setUid(parseHIER_OBJECT_ID(getJObject(json, "uid")));
2409    if (json.has("owner_id"))
2410      res.setOwner_id(parseOBJECT_REF(getJObject(json, "owner_id")));
2411    if (json.has("time_created"))
2412      res.setTime_created(parseDV_DATE_TIME(getJObject(json, "time_created")));
2413  }
2414
2415  protected VERSIONED_PARTY parseVERSIONED_PARTY(JsonObject json) throws IOException, FHIRFormatError {
2416    VERSIONED_PARTY res = new VERSIONED_PARTY();
2417    parseVERSIONED_PARTYProperties(json, res);
2418    return res;
2419  }
2420
2421  protected void parseVERSIONED_PARTYProperties(JsonObject json, VERSIONED_PARTY res) throws IOException, FHIRFormatError {
2422    parseVERSIONED_OBJECTProperties(json, res);
2423  }
2424
2425  protected WebTemplate parseWebTemplate(JsonObject json) throws IOException, FHIRFormatError {
2426    WebTemplate res = new WebTemplate();
2427    parseWebTemplateProperties(json, res);
2428    return res;
2429  }
2430
2431  protected void parseWebTemplateProperties(JsonObject json, WebTemplate res) throws IOException, FHIRFormatError {
2432    parseBaseProperties(json, res);
2433    if (json.has("templateId"))
2434      res.setTemplateIdElement(parseString(json.get("templateId").getAsString()));
2435    if (json.has("_templateId"))
2436      parseElementProperties(getJObject(json, "_templateId"), res.getTemplateIdElement());
2437    if (json.has("version"))
2438      res.setVersionElement(parseString(json.get("version").getAsString()));
2439    if (json.has("_version"))
2440      parseElementProperties(getJObject(json, "_version"), res.getVersionElement());
2441    if (json.has("semver"))
2442      res.setSemverElement(parseString(json.get("semver").getAsString()));
2443    if (json.has("_semver"))
2444      parseElementProperties(getJObject(json, "_semver"), res.getSemverElement());
2445    if (json.has("defaultLanguage"))
2446      res.setDefaultLanguageElement(parseString(json.get("defaultLanguage").getAsString()));
2447    if (json.has("_defaultLanguage"))
2448      parseElementProperties(getJObject(json, "_defaultLanguage"), res.getDefaultLanguageElement());
2449    if (json.has("languages")) {
2450      JsonArray array = getJArray(json, "languages");
2451      for (int i = 0; i < array.size(); i++) {
2452        if (array.get(i).isJsonNull()) {
2453          res.getLanguagesList().add(new StringType());
2454        } else {;
2455          res.getLanguagesList().add(parseString(array.get(i).getAsString()));
2456        }
2457      }
2458    };
2459    if (json.has("_languages")) {
2460      JsonArray array = getJArray(json, "_languages");
2461      for (int i = 0; i < array.size(); i++) {
2462        if (i == res.getLanguagesList().size())
2463          res.getLanguagesList().add(parseString(null));
2464        if (array.get(i) instanceof JsonObject) 
2465          parseElementProperties(array.get(i).getAsJsonObject(), res.getLanguagesList().get(i));
2466      }
2467    };
2468    if (json.has("tree"))
2469      res.setTree(parseWebTemplateItem(getJObject(json, "tree")));
2470  }
2471
2472  protected WebTemplateInput parseWebTemplateInput(JsonObject json) throws IOException, FHIRFormatError {
2473    WebTemplateInput res = new WebTemplateInput();
2474    parseWebTemplateInputProperties(json, res);
2475    return res;
2476  }
2477
2478  protected void parseWebTemplateInputProperties(JsonObject json, WebTemplateInput res) throws IOException, FHIRFormatError {
2479    parseBaseProperties(json, res);
2480    if (json.has("suffix"))
2481      res.setSuffixElement(parseString(json.get("suffix").getAsString()));
2482    if (json.has("_suffix"))
2483      parseElementProperties(getJObject(json, "_suffix"), res.getSuffixElement());
2484    if (json.has("type"))
2485      res.setTypeElement(parseCode(json.get("type").getAsString()));
2486    if (json.has("_type"))
2487      parseElementProperties(getJObject(json, "_type"), res.getTypeElement());
2488    if (json.has("defaultValue"))
2489      res.setDefaultValue(parseNativePrimitive(json, "defaultValue"));
2490    if (json.has("terminology"))
2491      res.setTerminologyElement(parseCode(json.get("terminology").getAsString()));
2492    if (json.has("_terminology"))
2493      parseElementProperties(getJObject(json, "_terminology"), res.getTerminologyElement());
2494    if (json.has("validation"))
2495      res.setValidation(parseWebTemplateInputValidation(getJObject(json, "validation")));
2496    if (json.has("list")) {
2497      JsonArray array = getJArray(json, "list");
2498      for (int i = 0; i < array.size(); i++) {
2499        res.getListList().add(parseWebTemplateInputListItem(array.get(i).getAsJsonObject()));
2500      }
2501    };
2502    if (json.has("listOpen"))
2503      res.setListOpenElement(parseBoolean(json.get("listOpen").getAsBoolean()));
2504    if (json.has("_listOpen"))
2505      parseElementProperties(getJObject(json, "_listOpen"), res.getListOpenElement());
2506  }
2507
2508
2509  protected WebTemplateInputListItem parseWebTemplateInputListItem(JsonObject json) throws IOException, FHIRFormatError {
2510    WebTemplateInputListItem res = new WebTemplateInputListItem();
2511    parseWebTemplateInputListItemProperties(json, res);
2512    return res;
2513  }
2514
2515  protected void parseWebTemplateInputListItemProperties(JsonObject json, WebTemplateInputListItem res) throws IOException, FHIRFormatError {
2516    parseBaseProperties(json, res);
2517    if (json.has("value"))
2518      res.setValueElement(parseCode(json.get("value").getAsString()));
2519    if (json.has("_value"))
2520      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
2521    if (json.has("label"))
2522      res.setLabelElement(parseString(json.get("label").getAsString()));
2523    if (json.has("_label"))
2524      parseElementProperties(getJObject(json, "_label"), res.getLabelElement());
2525    if (json.has("ordinal"))
2526      res.setOrdinalElement(parseString(json.get("ordinal").getAsString()));
2527    if (json.has("_ordinal"))
2528      parseElementProperties(getJObject(json, "_ordinal"), res.getOrdinalElement());
2529    if (json.has("localizedLabels")) {
2530      JsonArray array = getJArray(json, "localizedLabels");
2531      for (int i = 0; i < array.size(); i++) {
2532        res.getLocalizedLabelsList().add(parseTranslatedString(array.get(i).getAsJsonObject()));
2533      }
2534    };
2535    if (json.has("localizedDescriptions")) {
2536      JsonArray array = getJArray(json, "localizedDescriptions");
2537      for (int i = 0; i < array.size(); i++) {
2538        res.getLocalizedDescriptionsList().add(parseTranslatedString(array.get(i).getAsJsonObject()));
2539      }
2540    };
2541    if (json.has("currentStates"))
2542      res.setCurrentStatesElement(parseString(json.get("currentStates").getAsString()));
2543    if (json.has("_currentStates"))
2544      parseElementProperties(getJObject(json, "_currentStates"), res.getCurrentStatesElement());
2545    if (json.has("range"))
2546      res.setRangeElement(parseString(json.get("range").getAsString()));
2547    if (json.has("_range"))
2548      parseElementProperties(getJObject(json, "_range"), res.getRangeElement());
2549    if (json.has("precision"))
2550      res.setPrecisionElement(parseString(json.get("precision").getAsString()));
2551    if (json.has("_precision"))
2552      parseElementProperties(getJObject(json, "_precision"), res.getPrecisionElement());
2553    if (json.has("termBindings")) {
2554      JsonArray array = getJArray(json, "termBindings");
2555      for (int i = 0; i < array.size(); i++) {
2556        res.getTermBindingsList().add(parseWebTemplateTermBinding(array.get(i).getAsJsonObject()));
2557      }
2558    };
2559  }
2560
2561  protected WebTemplateInputValidation parseWebTemplateInputValidation(JsonObject json) throws IOException, FHIRFormatError {
2562    WebTemplateInputValidation res = new WebTemplateInputValidation();
2563    parseWebTemplateInputValidationProperties(json, res);
2564    return res;
2565  }
2566
2567  protected void parseWebTemplateInputValidationProperties(JsonObject json, WebTemplateInputValidation res) throws IOException, FHIRFormatError {
2568    parseBaseProperties(json, res);
2569    if (json.has("range"))
2570      res.setRange(parseWebTemplateInputValidationRange(getJObject(json, "range")));
2571    if (json.has("precision"))
2572      res.setPrecision(parseWebTemplateInputValidationRange(getJObject(json, "precision")));
2573  }
2574
2575  protected WebTemplateInputValidationRange parseWebTemplateInputValidationRange(JsonObject json) throws IOException, FHIRFormatError {
2576    WebTemplateInputValidationRange res = new WebTemplateInputValidationRange();
2577    parseWebTemplateInputValidationRangeProperties(json, res);
2578    return res;
2579  }
2580
2581  protected void parseWebTemplateInputValidationRangeProperties(JsonObject json, WebTemplateInputValidationRange res) throws IOException, FHIRFormatError {
2582    parseBaseProperties(json, res);
2583    if (json.has("minOp"))
2584      res.setMinOpElement(parseCode(json.get("minOp").getAsString()));
2585    if (json.has("_minOp"))
2586      parseElementProperties(getJObject(json, "_minOp"), res.getMinOpElement());
2587    if (json.has("min"))
2588      res.setMinElement(parseDecimal(json.get("min").getAsBigDecimal()));
2589    if (json.has("_min"))
2590      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
2591    if (json.has("maxOp"))
2592      res.setMaxOpElement(parseCode(json.get("maxOp").getAsString()));
2593    if (json.has("_maxOp"))
2594      parseElementProperties(getJObject(json, "_maxOp"), res.getMaxOpElement());
2595    if (json.has("max"))
2596      res.setMaxElement(parseDecimal(json.get("max").getAsBigDecimal()));
2597    if (json.has("_max"))
2598      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
2599  }
2600
2601  protected WebTemplateItem parseWebTemplateItem(JsonObject json) throws IOException, FHIRFormatError {
2602    WebTemplateItem res = new WebTemplateItem();
2603    parseWebTemplateItemProperties(json, res);
2604    return res;
2605  }
2606
2607  protected void parseWebTemplateItemProperties(JsonObject json, WebTemplateItem res) throws IOException, FHIRFormatError {
2608    parseBaseProperties(json, res);
2609    if (json.has("id"))
2610      res.setIdElement(parseString(json.get("id").getAsString()));
2611    if (json.has("_id"))
2612      parseElementProperties(getJObject(json, "_id"), res.getIdElement());
2613    if (json.has("depth"))
2614      res.setDepthElement(parseInteger(json.get("depth").getAsLong()));
2615    if (json.has("_depth"))
2616      parseElementProperties(getJObject(json, "_depth"), res.getDepthElement());
2617    if (json.has("name"))
2618      res.setNameElement(parseString(json.get("name").getAsString()));
2619    if (json.has("_name"))
2620      parseElementProperties(getJObject(json, "_name"), res.getNameElement());
2621    if (json.has("localizedName"))
2622      res.setLocalizedNameElement(parseString(json.get("localizedName").getAsString()));
2623    if (json.has("_localizedName"))
2624      parseElementProperties(getJObject(json, "_localizedName"), res.getLocalizedNameElement());
2625    if (json.has("rmType"))
2626      res.setRmTypeElement(parseCode(json.get("rmType").getAsString()));
2627    if (json.has("_rmType"))
2628      parseElementProperties(getJObject(json, "_rmType"), res.getRmTypeElement());
2629    if (json.has("nodeId"))
2630      res.setNodeIdElement(parseString(json.get("nodeId").getAsString()));
2631    if (json.has("_nodeId"))
2632      parseElementProperties(getJObject(json, "_nodeId"), res.getNodeIdElement());
2633    if (json.has("min"))
2634      res.setMinElement(parseString(json.get("min").getAsString()));
2635    if (json.has("_min"))
2636      parseElementProperties(getJObject(json, "_min"), res.getMinElement());
2637    if (json.has("max"))
2638      res.setMaxElement(parseString(json.get("max").getAsString()));
2639    if (json.has("_max"))
2640      parseElementProperties(getJObject(json, "_max"), res.getMaxElement());
2641    if (json.has("dependsOn"))
2642      res.setDependsOnElement(parseString(json.get("dependsOn").getAsString()));
2643    if (json.has("_dependsOn"))
2644      parseElementProperties(getJObject(json, "_dependsOn"), res.getDependsOnElement());
2645    if (json.has("localizedNames")) {
2646      JsonArray array = getJArray(json, "localizedNames");
2647      for (int i = 0; i < array.size(); i++) {
2648        res.getLocalizedNamesList().add(parseTranslatedString(array.get(i).getAsJsonObject()));
2649      }
2650    };
2651    if (json.has("localizedDescriptions")) {
2652      JsonArray array = getJArray(json, "localizedDescriptions");
2653      for (int i = 0; i < array.size(); i++) {
2654        res.getLocalizedDescriptionsList().add(parseTranslatedString(array.get(i).getAsJsonObject()));
2655      }
2656    };
2657    if (json.has("annotations"))
2658      res.setAnnotations(parseAnnotations(getJObject(json, "annotations")));
2659    if (json.has("archetype_id"))
2660      res.setArchetype_idElement(parseString(json.get("archetype_id").getAsString()));
2661    if (json.has("_archetype_id"))
2662      parseElementProperties(getJObject(json, "_archetype_id"), res.getArchetype_idElement());
2663    if (json.has("aqlPath"))
2664      res.setAqlPathElement(parseString(json.get("aqlPath").getAsString()));
2665    if (json.has("_aqlPath"))
2666      parseElementProperties(getJObject(json, "_aqlPath"), res.getAqlPathElement());
2667    if (json.has("custodian_namespace"))
2668      res.setCustodian_namespaceElement(parseString(json.get("custodian_namespace").getAsString()));
2669    if (json.has("_custodian_namespace"))
2670      parseElementProperties(getJObject(json, "_custodian_namespace"), res.getCustodian_namespaceElement());
2671    if (json.has("custodian_organisation"))
2672      res.setCustodian_organisationElement(parseString(json.get("custodian_organisation").getAsString()));
2673    if (json.has("_custodian_organisation"))
2674      parseElementProperties(getJObject(json, "_custodian_organisation"), res.getCustodian_organisationElement());
2675    if (json.has("lifecycleState"))
2676      res.setLifecycleStateElement(parseCode(json.get("lifecycleState").getAsString()));
2677    if (json.has("_lifecycleState"))
2678      parseElementProperties(getJObject(json, "_lifecycleState"), res.getLifecycleStateElement());
2679    if (json.has("original_namespace"))
2680      res.setOriginal_namespaceElement(parseString(json.get("original_namespace").getAsString()));
2681    if (json.has("_original_namespace"))
2682      parseElementProperties(getJObject(json, "_original_namespace"), res.getOriginal_namespaceElement());
2683    if (json.has("original_publisher"))
2684      res.setOriginal_publisherElement(parseString(json.get("original_publisher").getAsString()));
2685    if (json.has("_original_publisher"))
2686      parseElementProperties(getJObject(json, "_original_publisher"), res.getOriginal_publisherElement());
2687    if (json.has("proportionTypes"))
2688      res.setProportionTypesElement(parseCode(json.get("proportionTypes").getAsString()));
2689    if (json.has("_proportionTypes"))
2690      parseElementProperties(getJObject(json, "_proportionTypes"), res.getProportionTypesElement());
2691    if (json.has("revision"))
2692      res.setRevisionElement(parseString(json.get("revision").getAsString()));
2693    if (json.has("_revision"))
2694      parseElementProperties(getJObject(json, "_revision"), res.getRevisionElement());
2695    if (json.has("inContext"))
2696      res.setInContextElement(parseBoolean(json.get("inContext").getAsBoolean()));
2697    if (json.has("_inContext"))
2698      parseElementProperties(getJObject(json, "_inContext"), res.getInContextElement());
2699    if (json.has("inputs")) {
2700      JsonArray array = getJArray(json, "inputs");
2701      for (int i = 0; i < array.size(); i++) {
2702        res.getInputsList().add(parseWebTemplateInput(array.get(i).getAsJsonObject()));
2703      }
2704    };
2705    if (json.has("termBindings")) {
2706      JsonArray array = getJArray(json, "termBindings");
2707      for (int i = 0; i < array.size(); i++) {
2708        res.getTermBindingsList().add(parseWebTemplateTermBinding(array.get(i).getAsJsonObject()));
2709      }
2710    };
2711    if (json.has("children")) {
2712      JsonArray array = getJArray(json, "children");
2713      for (int i = 0; i < array.size(); i++) {
2714        res.getChildrenList().add(parseWebTemplateItem(array.get(i).getAsJsonObject()));
2715      }
2716    };
2717  }
2718
2719  protected WebTemplateTermBinding parseWebTemplateTermBinding(JsonObject json) throws IOException, FHIRFormatError {
2720    WebTemplateTermBinding res = new WebTemplateTermBinding();
2721    parseWebTemplateTermBindingProperties(json, res);
2722    return res;
2723  }
2724
2725  protected void parseWebTemplateTermBindingProperties(JsonObject json, WebTemplateTermBinding res) throws IOException, FHIRFormatError {
2726    parseBaseProperties(json, res);
2727    if (json.has("code"))
2728      res.setCodeElement(parseCode(json.get("code").getAsString()));
2729    if (json.has("_code"))
2730      parseElementProperties(getJObject(json, "_code"), res.getCodeElement());
2731    if (json.has("value"))
2732      res.setValue(parseWebTemplateTermBindingValue(getJObject(json, "value")));
2733  }
2734
2735  protected WebTemplateTermBindingValue parseWebTemplateTermBindingValue(JsonObject json) throws IOException, FHIRFormatError {
2736    WebTemplateTermBindingValue res = new WebTemplateTermBindingValue();
2737    parseWebTemplateTermBindingValueProperties(json, res);
2738    return res;
2739  }
2740
2741  protected void parseWebTemplateTermBindingValueProperties(JsonObject json, WebTemplateTermBindingValue res) throws IOException, FHIRFormatError {
2742    parseBaseProperties(json, res);
2743    if (json.has("value"))
2744      res.setValueElement(parseString(json.get("value").getAsString()));
2745    if (json.has("_value"))
2746      parseElementProperties(getJObject(json, "_value"), res.getValueElement());
2747    if (json.has("terminologyId"))
2748      res.setTerminologyIdElement(parseString(json.get("terminologyId").getAsString()));
2749    if (json.has("_terminologyId"))
2750      parseElementProperties(getJObject(json, "_terminologyId"), res.getTerminologyIdElement());
2751  }
2752
2753
2754  
2755
2756// -- compose ---------------------------------------------------------------------------------------------------------------------
2757
2758
2759  protected void composeACCESS_CONTROL_SETTINGS(String name, ACCESS_CONTROL_SETTINGS element) throws IOException {
2760    if (element != null) {
2761      open(name);
2762      prop("_type", element.fhirType());
2763      switch (element.fhirType()) {
2764      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
2765      }
2766    }
2767  }
2768
2769  protected void composeACCESS_CONTROL_SETTINGSProperties(ACCESS_CONTROL_SETTINGS element) throws IOException {
2770      composeBaseProperties(element);
2771  }
2772
2773  protected void composeACTOR(String name, ACTOR element) throws IOException {
2774    if (element != null) {
2775      open(name);
2776      prop("_type", element.fhirType());
2777      switch (element.fhirType()) {
2778      case "AGENT":
2779        composeAGENTProperties((AGENT) element);
2780        close();
2781        break;
2782      case "GROUP":
2783        composeGROUPProperties((GROUP) element);
2784        close();
2785        break;
2786      case "PERSON":
2787        composePERSONProperties((PERSON) element);
2788        close();
2789        break;
2790      case "ORGANISATION":
2791        composeORGANISATIONProperties((ORGANISATION) element);
2792        close();
2793        break;
2794      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
2795      }
2796    }
2797  }
2798
2799  protected void composeACTORProperties(ACTOR element) throws IOException {
2800      composePARTYProperties(element);
2801      if (element.hasLanguages()) {
2802        openArray("languages");
2803        for (DV_TEXT e : element.getLanguagesList()) 
2804          composeDV_TEXT(null, e);
2805        closeArray();
2806      };
2807      if (element.hasRoles()) {
2808        openArray("roles");
2809        for (PARTY_REF e : element.getRolesList()) 
2810          composePARTY_REF(null, e);
2811        closeArray();
2812      };
2813  }
2814
2815  protected void composeAUTHORED_RESOURCE(String name, AUTHORED_RESOURCE element) throws IOException {
2816    if (element != null) {
2817      open(name);
2818      prop("_type", element.fhirType());
2819      switch (element.fhirType()) {
2820      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
2821      }
2822    }
2823  }
2824
2825  protected void composeAUTHORED_RESOURCEProperties(AUTHORED_RESOURCE element) throws IOException {
2826      composeBaseProperties(element);
2827      if (element.hasOriginal_language()) {
2828        composeCODE_PHRASE("original_language", element.getOriginal_language());
2829      }
2830      if (element.hasIs_controlledElement()) {
2831        composeBooleanCore("is_controlled", element.getIs_controlledElement(), false);
2832        composeBooleanExtras("is_controlled", element.getIs_controlledElement(), false);
2833      }
2834      if (element.hasTranslations()) {
2835        openArray("translations");
2836        for (TRANSLATION_DETAILS e : element.getTranslationsList()) 
2837          composeTRANSLATION_DETAILS(null, e);
2838        closeArray();
2839      };
2840      if (element.hasDescription()) {
2841        composeRESOURCE_DESCRIPTION("description", element.getDescription());
2842      }
2843      if (element.hasRevision_history()) {
2844        composeREVISION_HISTORY("revision_history", element.getRevision_history());
2845      }
2846  }
2847
2848  protected void composeAny(String name, Any element) throws IOException {
2849    if (element != null) {
2850      open(name);
2851      prop("_type", element.fhirType());
2852      switch (element.fhirType()) {
2853      case "EHR":
2854        composeEHRProperties((EHR) element);
2855        close();
2856        break;
2857      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
2858      }
2859    }
2860  }
2861
2862  protected void composeAnyProperties(Any element) throws IOException {
2863      composeBaseProperties(element);
2864  }
2865
2866  protected void composeCARE_ENTRY(String name, CARE_ENTRY element) throws IOException {
2867    if (element != null) {
2868      open(name);
2869      prop("_type", element.fhirType());
2870      switch (element.fhirType()) {
2871      case "INSTRUCTION":
2872        composeINSTRUCTIONProperties((INSTRUCTION) element);
2873        close();
2874        break;
2875      case "OBSERVATION":
2876        composeOBSERVATIONProperties((OBSERVATION) element);
2877        close();
2878        break;
2879      case "ACTION":
2880        composeACTIONProperties((ACTION) element);
2881        close();
2882        break;
2883      case "EVALUATION":
2884        composeEVALUATIONProperties((EVALUATION) element);
2885        close();
2886        break;
2887      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
2888      }
2889    }
2890  }
2891
2892  protected void composeCARE_ENTRYProperties(CARE_ENTRY element) throws IOException {
2893      composeENTRYProperties(element);
2894      if (element.hasProtocol()) {
2895        composeITEM_STRUCTURE("protocol", element.getProtocol());
2896      }
2897      if (element.hasGuideline_id()) {
2898        composeOBJECT_REF("guideline_id", element.getGuideline_id());
2899      }
2900  }
2901
2902  protected void composeCONTENT_ITEM(String name, CONTENT_ITEM element) throws IOException {
2903    if (element != null) {
2904      open(name);
2905      prop("_type", element.fhirType());
2906      switch (element.fhirType()) {
2907      case "SECTION":
2908        composeSECTIONProperties((SECTION) element);
2909        close();
2910        break;
2911      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
2912      }
2913    }
2914  }
2915
2916  protected void composeCONTENT_ITEMProperties(CONTENT_ITEM element) throws IOException {
2917      composeLOCATABLEProperties(element);
2918  }
2919
2920  protected void composeDATA_STRUCTURE(String name, DATA_STRUCTURE element) throws IOException {
2921    if (element != null) {
2922      open(name);
2923      prop("_type", element.fhirType());
2924      switch (element.fhirType()) {
2925      case "HISTORY":
2926        composeHISTORYProperties((HISTORY) element);
2927        close();
2928        break;
2929      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
2930      }
2931    }
2932  }
2933
2934  protected void composeDATA_STRUCTUREProperties(DATA_STRUCTURE element) throws IOException {
2935      composeLOCATABLEProperties(element);
2936  }
2937
2938  protected void composeDATA_VALUE(String name, DATA_VALUE element) throws IOException {
2939    if (element != null) {
2940      open(name);
2941      prop("_type", element.fhirType());
2942      switch (element.fhirType()) {
2943      case "DV-TEXT":
2944        composeDV_TEXTProperties((DV_TEXT) element);
2945        close();
2946        break;
2947      case "DV-IDENTIFIER":
2948        composeDV_IDENTIFIERProperties((DV_IDENTIFIER) element);
2949        close();
2950        break;
2951      case "DV-BOOLEAN":
2952        composeDV_BOOLEANProperties((DV_BOOLEAN) element);
2953        close();
2954        break;
2955      case "DV-PARAGRAPH":
2956        composeDV_PARAGRAPHProperties((DV_PARAGRAPH) element);
2957        close();
2958        break;
2959      case "DV-URI":
2960        composeDV_URIProperties((DV_URI) element);
2961        close();
2962        break;
2963      case "DV-STATE":
2964        composeDV_STATEProperties((DV_STATE) element);
2965        close();
2966        break;
2967      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
2968      }
2969    }
2970  }
2971
2972  protected void composeDATA_VALUEProperties(DATA_VALUE element) throws IOException {
2973      composeBaseProperties(element);
2974  }
2975
2976  protected void composeDV_ABSOLUTE_QUANTITY(String name, DV_ABSOLUTE_QUANTITY element) throws IOException {
2977    if (element != null) {
2978      open(name);
2979      prop("_type", element.fhirType());
2980      switch (element.fhirType()) {
2981      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
2982      }
2983    }
2984  }
2985
2986  protected void composeDV_ABSOLUTE_QUANTITYProperties(DV_ABSOLUTE_QUANTITY element) throws IOException {
2987      composeDV_QUANTIFIEDProperties(element);
2988  }
2989
2990  protected void composeDV_AMOUNT(String name, DV_AMOUNT element) throws IOException {
2991    if (element != null) {
2992      open(name);
2993      prop("_type", element.fhirType());
2994      switch (element.fhirType()) {
2995      case "DV-DURATION":
2996        composeDV_DURATIONProperties((DV_DURATION) element);
2997        close();
2998        break;
2999      case "DV-COUNT":
3000        composeDV_COUNTProperties((DV_COUNT) element);
3001        close();
3002        break;
3003      case "DV-PROPORTION":
3004        composeDV_PROPORTIONProperties((DV_PROPORTION) element);
3005        close();
3006        break;
3007      case "DV-QUANTITY":
3008        composeDV_QUANTITYProperties((DV_QUANTITY) element);
3009        close();
3010        break;
3011      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3012      }
3013    }
3014  }
3015
3016  protected void composeDV_AMOUNTProperties(DV_AMOUNT element) throws IOException {
3017      composeDV_QUANTIFIEDProperties(element);
3018      if (element.hasAccuracy_is_percentElement()) {
3019        composeBooleanCore("accuracy_is_percent", element.getAccuracy_is_percentElement(), false);
3020        composeBooleanExtras("accuracy_is_percent", element.getAccuracy_is_percentElement(), false);
3021      }
3022  }
3023
3024  protected void composeDV_ENCAPSULATED(String name, DV_ENCAPSULATED element) throws IOException {
3025    if (element != null) {
3026      open(name);
3027      prop("_type", element.fhirType());
3028      switch (element.fhirType()) {
3029      case "DV-MULTIMEDIA":
3030        composeDV_MULTIMEDIAProperties((DV_MULTIMEDIA) element);
3031        close();
3032        break;
3033      case "DV-PARSABLE":
3034        composeDV_PARSABLEProperties((DV_PARSABLE) element);
3035        close();
3036        break;
3037      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3038      }
3039    }
3040  }
3041
3042  protected void composeDV_ENCAPSULATEDProperties(DV_ENCAPSULATED element) throws IOException {
3043      composeDV_AMOUNTProperties(element);
3044      if (element.hasCharset()) {
3045        composeCODE_PHRASE("charset", element.getCharset());
3046      }
3047      if (element.hasLanguage()) {
3048        composeCODE_PHRASE("language", element.getLanguage());
3049      }
3050  }
3051
3052  protected void composeDV_ORDERED(String name, DV_ORDERED element) throws IOException {
3053    if (element != null) {
3054      open(name);
3055      prop("_type", element.fhirType());
3056      switch (element.fhirType()) {
3057      case "DV-DATE-TIME":
3058        composeDV_DATE_TIMEProperties((DV_DATE_TIME) element);
3059        close();
3060        break;
3061      case "DV-TIME":
3062        composeDV_TIMEProperties((DV_TIME) element);
3063        close();
3064        break;
3065      case "DV-INTERVAL":
3066        composeDV_INTERVALProperties((DV_INTERVAL) element);
3067        close();
3068        break;
3069      case "DV-ORDINAL":
3070        composeDV_ORDINALProperties((DV_ORDINAL) element);
3071        close();
3072        break;
3073      case "DV-SCALE":
3074        composeDV_SCALEProperties((DV_SCALE) element);
3075        close();
3076        break;
3077      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3078      }
3079    }
3080  }
3081
3082  protected void composeDV_ORDEREDProperties(DV_ORDERED element) throws IOException {
3083      composeDATA_VALUEProperties(element);
3084      if (element.hasNormal_status()) {
3085        composeCODE_PHRASE("normal_status", element.getNormal_status());
3086      }
3087      if (element.hasNormal_range()) {
3088        composeDV_INTERVAL("normal_range", element.getNormal_range());
3089      }
3090      if (element.hasOther_reference_ranges()) {
3091        openArray("other_reference_ranges");
3092        for (REFERENCE_RANGE e : element.getOther_reference_rangesList()) 
3093          composeREFERENCE_RANGE(null, e);
3094        closeArray();
3095      };
3096  }
3097
3098  protected void composeDV_QUANTIFIED(String name, DV_QUANTIFIED element) throws IOException {
3099    if (element != null) {
3100      open(name);
3101      prop("_type", element.fhirType());
3102      switch (element.fhirType()) {
3103      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3104      }
3105    }
3106  }
3107
3108  protected void composeDV_QUANTIFIEDProperties(DV_QUANTIFIED element) throws IOException {
3109      composeDV_ORDEREDProperties(element);
3110      if (element.hasMagnitude_statusElement()) {
3111        composeStringCore("magnitude_status", element.getMagnitude_statusElement(), false);
3112        composeStringExtras("magnitude_status", element.getMagnitude_statusElement(), false);
3113      }
3114      if (element.hasAccuracy()) {
3115        composeBase("accuracy", element.getAccuracy());
3116      }
3117  }
3118
3119  protected void composeDV_TEMPORAL(String name, DV_TEMPORAL element) throws IOException {
3120    if (element != null) {
3121      open(name);
3122      prop("_type", element.fhirType());
3123      switch (element.fhirType()) {
3124      case "DV-DATE":
3125        composeDV_DATEProperties((DV_DATE) element);
3126        close();
3127        break;
3128      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3129      }
3130    }
3131  }
3132
3133  protected void composeDV_TEMPORALProperties(DV_TEMPORAL element) throws IOException {
3134      composeDV_ABSOLUTE_QUANTITYProperties(element);
3135  }
3136
3137  protected void composeDV_TIME_SPECIFICATION(String name, DV_TIME_SPECIFICATION element) throws IOException {
3138    if (element != null) {
3139      open(name);
3140      prop("_type", element.fhirType());
3141      switch (element.fhirType()) {
3142      case "DV-GENERAL-TIME-SPECIFICATION":
3143        composeDV_GENERAL_TIME_SPECIFICATIONProperties((DV_GENERAL_TIME_SPECIFICATION) element);
3144        close();
3145        break;
3146      case "DV-PERIODIC-TIME-SPECIFICATION":
3147        composeDV_PERIODIC_TIME_SPECIFICATIONProperties((DV_PERIODIC_TIME_SPECIFICATION) element);
3148        close();
3149        break;
3150      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3151      }
3152    }
3153  }
3154
3155  protected void composeDV_TIME_SPECIFICATIONProperties(DV_TIME_SPECIFICATION element) throws IOException {
3156      composeDATA_VALUEProperties(element);
3157      if (element.hasDV_PARSABLEElement()) {
3158        composeStringCore("DV_PARSABLE", element.getDV_PARSABLEElement(), false);
3159        composeStringExtras("DV_PARSABLE", element.getDV_PARSABLEElement(), false);
3160      }
3161  }
3162
3163  protected void composeENTRY(String name, ENTRY element) throws IOException {
3164    if (element != null) {
3165      open(name);
3166      prop("_type", element.fhirType());
3167      switch (element.fhirType()) {
3168      case "ADMIN-ENTRY":
3169        composeADMIN_ENTRYProperties((ADMIN_ENTRY) element);
3170        close();
3171        break;
3172      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3173      }
3174    }
3175  }
3176
3177  protected void composeENTRYProperties(ENTRY element) throws IOException {
3178      composeCONTENT_ITEMProperties(element);
3179      if (element.hasLanguage()) {
3180        composeCODE_PHRASE("language", element.getLanguage());
3181      }
3182      if (element.hasEncoding()) {
3183        composeCODE_PHRASE("encoding", element.getEncoding());
3184      }
3185      if (element.hasOther_participations()) {
3186        openArray("other_participations");
3187        for (PARTICIPATION e : element.getOther_participationsList()) 
3188          composePARTICIPATION(null, e);
3189        closeArray();
3190      };
3191      if (element.hasWorkflow_id()) {
3192        composeOBJECT_REF("workflow_id", element.getWorkflow_id());
3193      }
3194      if (element.hasSubject()) {
3195        composePARTY_PROXY("subject", element.getSubject());
3196      }
3197      if (element.hasProvider()) {
3198        composePARTY_PROXY("provider", element.getProvider());
3199      }
3200  }
3201
3202  protected void composeEVENT(String name, EVENT element) throws IOException {
3203    if (element != null) {
3204      open(name);
3205      prop("_type", element.fhirType());
3206      switch (element.fhirType()) {
3207      case "INTERVAL-EVENT":
3208        composeINTERVAL_EVENTProperties((INTERVAL_EVENT) element);
3209        close();
3210        break;
3211      case "POINT-EVENT":
3212        composePOINT_EVENTProperties((POINT_EVENT) element);
3213        close();
3214        break;
3215      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3216      }
3217    }
3218  }
3219
3220  protected void composeEVENTProperties(EVENT element) throws IOException {
3221      composeLOCATABLEProperties(element);
3222      if (element.hasTime()) {
3223        composeDV_DATE_TIME("time", element.getTime());
3224      }
3225      if (element.hasState()) {
3226        composeITEM_STRUCTURE("state", element.getState());
3227      }
3228      if (element.hasData()) {
3229        composeAny("data", element.getData());
3230      }
3231  }
3232
3233  protected void composeITEM_STRUCTURE(String name, ITEM_STRUCTURE element) throws IOException {
3234    if (element != null) {
3235      open(name);
3236      prop("_type", element.fhirType());
3237      switch (element.fhirType()) {
3238      case "ITEM-SINGLE":
3239        composeITEM_SINGLEProperties((ITEM_SINGLE) element);
3240        close();
3241        break;
3242      case "ITEM-TREE":
3243        composeITEM_TREEProperties((ITEM_TREE) element);
3244        close();
3245        break;
3246      case "ITEM-TABLE":
3247        composeITEM_TABLEProperties((ITEM_TABLE) element);
3248        close();
3249        break;
3250      case "ITEM-LIST":
3251        composeITEM_LISTProperties((ITEM_LIST) element);
3252        close();
3253        break;
3254      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3255      }
3256    }
3257  }
3258
3259  protected void composeITEM_STRUCTUREProperties(ITEM_STRUCTURE element) throws IOException {
3260      composeDATA_STRUCTUREProperties(element);
3261  }
3262
3263  protected void composeITEM(String name, ITEM element) throws IOException {
3264    if (element != null) {
3265      open(name);
3266      prop("_type", element.fhirType());
3267      switch (element.fhirType()) {
3268      case "ELEMENT":
3269        composeELEMENTProperties((ELEMENT) element);
3270        close();
3271        break;
3272      case "CLUSTER":
3273        composeCLUSTERProperties((CLUSTER) element);
3274        close();
3275        break;
3276      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3277      }
3278    }
3279  }
3280
3281  protected void composeITEMProperties(ITEM element) throws IOException {
3282      composeLOCATABLEProperties(element);
3283  }
3284
3285  protected void composeLOCATABLE(String name, LOCATABLE element) throws IOException {
3286    if (element != null) {
3287      open(name);
3288      prop("_type", element.fhirType());
3289      switch (element.fhirType()) {
3290      case "CONTACT":
3291        composeCONTACTProperties((CONTACT) element);
3292        close();
3293        break;
3294      case "EVENT-CONTEXT":
3295        composeEVENT_CONTEXTProperties((EVENT_CONTEXT) element);
3296        close();
3297        break;
3298      case "EHR-STATUS":
3299        composeEHR_STATUSProperties((EHR_STATUS) element);
3300        close();
3301        break;
3302      case "PARTY-IDENTITY":
3303        composePARTY_IDENTITYProperties((PARTY_IDENTITY) element);
3304        close();
3305        break;
3306      case "ADDRESS":
3307        composeADDRESSProperties((ADDRESS) element);
3308        close();
3309        break;
3310      case "COMPOSITION":
3311        composeCOMPOSITIONProperties((COMPOSITION) element);
3312        close();
3313        break;
3314      case "PARTY-RELATIONSHIP":
3315        composePARTY_RELATIONSHIPProperties((PARTY_RELATIONSHIP) element);
3316        close();
3317        break;
3318      case "CAPABILITY":
3319        composeCAPABILITYProperties((CAPABILITY) element);
3320        close();
3321        break;
3322      case "EHR-ACCESS":
3323        composeEHR_ACCESSProperties((EHR_ACCESS) element);
3324        close();
3325        break;
3326      case "ACTIVITY":
3327        composeACTIVITYProperties((ACTIVITY) element);
3328        close();
3329        break;
3330      case "FOLDER":
3331        composeFOLDERProperties((FOLDER) element);
3332        close();
3333        break;
3334      case "PARTICIPATION":
3335        composePARTICIPATIONProperties((PARTICIPATION) element);
3336        close();
3337        break;
3338      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3339      }
3340    }
3341  }
3342
3343  protected void composeLOCATABLEProperties(LOCATABLE element) throws IOException {
3344      composePATHABLEProperties(element);
3345  }
3346
3347  protected void composeOBJECT_ID(String name, OBJECT_ID element) throws IOException {
3348    if (element != null) {
3349      open(name);
3350      prop("_type", element.fhirType());
3351      switch (element.fhirType()) {
3352      case "TEMPLATE-ID":
3353        composeTEMPLATE_IDProperties((TEMPLATE_ID) element);
3354        close();
3355        break;
3356      case "ARCHETYPE-ID":
3357        composeARCHETYPE_IDProperties((ARCHETYPE_ID) element);
3358        close();
3359        break;
3360      case "GENERIC-ID":
3361        composeGENERIC_IDProperties((GENERIC_ID) element);
3362        close();
3363        break;
3364      case "TERMINOLOGY-ID":
3365        composeTERMINOLOGY_IDProperties((TERMINOLOGY_ID) element);
3366        close();
3367        break;
3368      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3369      }
3370    }
3371  }
3372
3373  protected void composeOBJECT_IDProperties(OBJECT_ID element) throws IOException {
3374      composeUIDProperties(element);
3375  }
3376
3377  protected void composePARTY_PROXY(String name, PARTY_PROXY element) throws IOException {
3378    if (element != null) {
3379      open(name);
3380      prop("_type", element.fhirType());
3381      switch (element.fhirType()) {
3382      case "PARTY-SELF":
3383        composePARTY_SELFProperties((PARTY_SELF) element);
3384        close();
3385        break;
3386      case "PARTY-IDENTIFIED":
3387        composePARTY_IDENTIFIEDProperties((PARTY_IDENTIFIED) element);
3388        close();
3389        break;
3390      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3391      }
3392    }
3393  }
3394
3395  protected void composePARTY_PROXYProperties(PARTY_PROXY element) throws IOException {
3396      composeBaseProperties(element);
3397      if (element.hasExternal_ref()) {
3398        composePARTY_REF("external_ref", element.getExternal_ref());
3399      }
3400  }
3401
3402  protected void composePARTY(String name, PARTY element) throws IOException {
3403    if (element != null) {
3404      open(name);
3405      prop("_type", element.fhirType());
3406      switch (element.fhirType()) {
3407      case "ROLE":
3408        composeROLEProperties((ROLE) element);
3409        close();
3410        break;
3411      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3412      }
3413    }
3414  }
3415
3416  protected void composePARTYProperties(PARTY element) throws IOException {
3417      composeLOCATABLEProperties(element);
3418      if (element.hasIdentities()) {
3419        openArray("identities");
3420        for (PARTY_IDENTITY e : element.getIdentitiesList()) 
3421          composePARTY_IDENTITY(null, e);
3422        closeArray();
3423      };
3424      if (element.hasContacts()) {
3425        composeCONTACT("contacts", element.getContacts());
3426      }
3427      if (element.hasDetails()) {
3428        composeITEM_STRUCTURE("details", element.getDetails());
3429      }
3430      if (element.hasReverse_relationships()) {
3431        openArray("reverse_relationships");
3432        for (LOCATABLE_REF e : element.getReverse_relationshipsList()) 
3433          composeLOCATABLE_REF(null, e);
3434        closeArray();
3435      };
3436      if (element.hasRelationships()) {
3437        openArray("relationships");
3438        for (PARTY_RELATIONSHIP e : element.getRelationshipsList()) 
3439          composePARTY_RELATIONSHIP(null, e);
3440        closeArray();
3441      };
3442  }
3443
3444  protected void composePATHABLE(String name, PATHABLE element) throws IOException {
3445    if (element != null) {
3446      open(name);
3447      prop("_type", element.fhirType());
3448      switch (element.fhirType()) {
3449      case "INSTRUCTION-DETAILS":
3450        composeINSTRUCTION_DETAILSProperties((INSTRUCTION_DETAILS) element);
3451        close();
3452        break;
3453      case "ISM-TRANSITION":
3454        composeISM_TRANSITIONProperties((ISM_TRANSITION) element);
3455        close();
3456        break;
3457      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3458      }
3459    }
3460  }
3461
3462  protected void composePATHABLEProperties(PATHABLE element) throws IOException {
3463      composeAnyProperties(element);
3464      if (element.hasName()) {
3465        composeDV_TEXT("name", element.getName());
3466      }
3467      if (element.hasArchetype_node_idElement()) {
3468        composeStringCore("archetype_node_id", element.getArchetype_node_idElement(), false);
3469        composeStringExtras("archetype_node_id", element.getArchetype_node_idElement(), false);
3470      }
3471      if (element.hasUid()) {
3472        composeUID_BASED_ID("uid", element.getUid());
3473      }
3474      if (element.hasLinks()) {
3475        openArray("links");
3476        for (LINK e : element.getLinksList()) 
3477          composeLINK(null, e);
3478        closeArray();
3479      };
3480      if (element.hasArchetype_details()) {
3481        composeARCHETYPED("archetype_details", element.getArchetype_details());
3482      }
3483      if (element.hasFeeder_audit()) {
3484        composeFEEDER_AUDIT("feeder_audit", element.getFeeder_audit());
3485      }
3486  }
3487
3488  protected void composeUID_BASED_ID(String name, UID_BASED_ID element) throws IOException {
3489    if (element != null) {
3490      open(name);
3491      prop("_type", element.fhirType());
3492      switch (element.fhirType()) {
3493      case "OBJECT-VERSION-ID":
3494        composeOBJECT_VERSION_IDProperties((OBJECT_VERSION_ID) element);
3495        close();
3496        break;
3497      case "HIER-OBJECT-ID":
3498        composeHIER_OBJECT_IDProperties((HIER_OBJECT_ID) element);
3499        close();
3500        break;
3501      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3502      }
3503    }
3504  }
3505
3506  protected void composeUID_BASED_IDProperties(UID_BASED_ID element) throws IOException {
3507      composeOBJECT_IDProperties(element);
3508  }
3509
3510  protected void composeUID(String name, UID element) throws IOException {
3511    if (element != null) {
3512      open(name);
3513      prop("_type", element.fhirType());
3514      switch (element.fhirType()) {
3515      case "ISO-OID":
3516        composeISO_OIDProperties((ISO_OID) element);
3517        close();
3518        break;
3519      case "UUID":
3520        composeUUIDProperties((UUID) element);
3521        close();
3522        break;
3523      case "INTERNET-ID":
3524        composeINTERNET_IDProperties((INTERNET_ID) element);
3525        close();
3526        break;
3527      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3528      }
3529    }
3530  }
3531
3532  protected void composeUIDProperties(UID element) throws IOException {
3533      composeBaseProperties(element);
3534      if (element.hasValueElement()) {
3535        composeStringCore("value", element.getValueElement(), false);
3536        composeStringExtras("value", element.getValueElement(), false);
3537      }
3538  }
3539
3540  protected void composeVERSION(String name, VERSION element) throws IOException {
3541    if (element != null) {
3542      open(name);
3543      prop("_type", element.fhirType());
3544      switch (element.fhirType()) {
3545      case "IMPORTED-VERSION":
3546        composeIMPORTED_VERSIONProperties((IMPORTED_VERSION) element);
3547        close();
3548        break;
3549      case "ORIGINAL-VERSION":
3550        composeORIGINAL_VERSIONProperties((ORIGINAL_VERSION) element);
3551        close();
3552        break;
3553      default: throw new FHIRException("Unsupported type '"+element.fhirType()+"'");
3554      }
3555    }
3556  }
3557
3558  protected void composeVERSIONProperties(VERSION element) throws IOException {
3559      composeBaseProperties(element);
3560      if (element.hasContribution()) {
3561        composeOBJECT_REF("contribution", element.getContribution());
3562      }
3563      if (element.hasSignatureElement()) {
3564        composeStringCore("signature", element.getSignatureElement(), false);
3565        composeStringExtras("signature", element.getSignatureElement(), false);
3566      }
3567      if (element.hasCommit_audit()) {
3568        composeAUDIT_DETAILS("commit_audit", element.getCommit_audit());
3569      }
3570  }
3571
3572  protected void composeACTION(String name, ACTION element) throws IOException {
3573    if (element != null) {
3574      open(name);
3575      composeACTIONProperties(element);
3576      close();
3577    }
3578  }
3579
3580  protected void composeACTIONProperties(ACTION element) throws IOException {
3581    composeCARE_ENTRYProperties(element);
3582      if (element.hasTime()) {
3583        composeDV_DATE_TIME("time", element.getTime());
3584      }
3585      if (element.hasIsm_transition()) {
3586        composeISM_TRANSITION("ism_transition", element.getIsm_transition());
3587      }
3588      if (element.hasInstruction_details()) {
3589        composeINSTRUCTION_DETAILS("instruction_details", element.getInstruction_details());
3590      }
3591      if (element.hasDescription()) {
3592        composeITEM_STRUCTURE("description", element.getDescription());
3593      }
3594  }
3595
3596  protected void composeACTIVITY(String name, ACTIVITY element) throws IOException {
3597    if (element != null) {
3598      open(name);
3599      composeACTIVITYProperties(element);
3600      close();
3601    }
3602  }
3603
3604  protected void composeACTIVITYProperties(ACTIVITY element) throws IOException {
3605    composeLOCATABLEProperties(element);
3606      if (element.hasTiming()) {
3607        composeDV_PARSABLE("timing", element.getTiming());
3608      }
3609      if (element.hasAction_archetype_idElement()) {
3610        composeStringCore("action_archetype_id", element.getAction_archetype_idElement(), false);
3611        composeStringExtras("action_archetype_id", element.getAction_archetype_idElement(), false);
3612      }
3613      if (element.hasDescription()) {
3614        composeITEM_STRUCTURE("description", element.getDescription());
3615      }
3616  }
3617
3618  protected void composeADDRESS(String name, ADDRESS element) throws IOException {
3619    if (element != null) {
3620      open(name);
3621      composeADDRESSProperties(element);
3622      close();
3623    }
3624  }
3625
3626  protected void composeADDRESSProperties(ADDRESS element) throws IOException {
3627    composeLOCATABLEProperties(element);
3628      if (element.hasDetails()) {
3629        composeITEM_STRUCTURE("details", element.getDetails());
3630      }
3631  }
3632
3633  protected void composeADMIN_ENTRY(String name, ADMIN_ENTRY element) throws IOException {
3634    if (element != null) {
3635      open(name);
3636      composeADMIN_ENTRYProperties(element);
3637      close();
3638    }
3639  }
3640
3641  protected void composeADMIN_ENTRYProperties(ADMIN_ENTRY element) throws IOException {
3642    composeENTRYProperties(element);
3643      if (element.hasData()) {
3644        composeITEM_STRUCTURE("data", element.getData());
3645      }
3646  }
3647
3648  protected void composeAGENT(String name, AGENT element) throws IOException {
3649    if (element != null) {
3650      open(name);
3651      composeAGENTProperties(element);
3652      close();
3653    }
3654  }
3655
3656  protected void composeAGENTProperties(AGENT element) throws IOException {
3657    composeACTORProperties(element);
3658  }
3659
3660  protected void composeARCHETYPE_ID(String name, ARCHETYPE_ID element) throws IOException {
3661    if (element != null) {
3662      open(name);
3663      composeARCHETYPE_IDProperties(element);
3664      close();
3665    }
3666  }
3667
3668  protected void composeARCHETYPE_IDProperties(ARCHETYPE_ID element) throws IOException {
3669    composeOBJECT_IDProperties(element);
3670  }
3671
3672  protected void composeARCHETYPED(String name, ARCHETYPED element) throws IOException {
3673    if (element != null) {
3674      open(name);
3675      composeARCHETYPEDProperties(element);
3676      close();
3677    }
3678  }
3679
3680  protected void composeARCHETYPEDProperties(ARCHETYPED element) throws IOException {
3681    composeBaseProperties(element);
3682      if (element.hasArchetype_id()) {
3683        composeARCHETYPE_ID("archetype_id", element.getArchetype_id());
3684      }
3685      if (element.hasTemplate_id()) {
3686        composeTEMPLATE_ID("template_id", element.getTemplate_id());
3687      }
3688      if (element.hasRm_versionElement()) {
3689        composeStringCore("rm_version", element.getRm_versionElement(), false);
3690        composeStringExtras("rm_version", element.getRm_versionElement(), false);
3691      }
3692  }
3693
3694  protected void composeATTESTATION(String name, ATTESTATION element) throws IOException {
3695    if (element != null) {
3696      open(name);
3697      composeATTESTATIONProperties(element);
3698      close();
3699    }
3700  }
3701
3702  protected void composeATTESTATIONProperties(ATTESTATION element) throws IOException {
3703    composeAUDIT_DETAILSProperties(element);
3704      if (element.hasAttested_view()) {
3705        composeDV_MULTIMEDIA("attested_view", element.getAttested_view());
3706      }
3707      if (element.hasProofElement()) {
3708        composeStringCore("proof", element.getProofElement(), false);
3709        composeStringExtras("proof", element.getProofElement(), false);
3710      }
3711      if (element.hasItems()) {
3712        openArray("items");
3713        for (DV_EHR_URI e : element.getItemsList()) 
3714          composeDV_EHR_URI(null, e);
3715        closeArray();
3716      };
3717      if (element.hasReason()) {
3718        composeDV_TEXT("reason", element.getReason());
3719      }
3720      if (element.hasIs_pendingElement()) {
3721        composeBooleanCore("is_pending", element.getIs_pendingElement(), false);
3722        composeBooleanExtras("is_pending", element.getIs_pendingElement(), false);
3723      }
3724  }
3725
3726  protected void composeAUDIT_DETAILS(String name, AUDIT_DETAILS element) throws IOException {
3727    if (element != null) {
3728      open(name);
3729      composeAUDIT_DETAILSProperties(element);
3730      close();
3731    }
3732  }
3733
3734  protected void composeAUDIT_DETAILSProperties(AUDIT_DETAILS element) throws IOException {
3735    composeBaseProperties(element);
3736      if (element.hasSystem_idElement()) {
3737        composeStringCore("system_id", element.getSystem_idElement(), false);
3738        composeStringExtras("system_id", element.getSystem_idElement(), false);
3739      }
3740      if (element.hasTime_committed()) {
3741        composeDV_DATE_TIME("time_committed", element.getTime_committed());
3742      }
3743      if (element.hasChange_type()) {
3744        composeDV_CODED_TEXT("change_type", element.getChange_type());
3745      }
3746      if (element.hasDescription()) {
3747        composeDV_TEXT("description", element.getDescription());
3748      }
3749      if (element.hasCommitter()) {
3750        composePARTY_PROXY("committer", element.getCommitter());
3751      }
3752  }
3753
3754  protected void composeAnnotations(String name, Annotations element) throws IOException {
3755    if (element != null) {
3756      open(name);
3757      composeAnnotationsProperties(element);
3758      close();
3759    }
3760  }
3761
3762  protected void composeAnnotationsProperties(Annotations element) throws IOException {
3763    composeBaseProperties(element);
3764      if (element.hasCommentElement()) {
3765        composeStringCore("comment", element.getCommentElement(), false);
3766        composeStringExtras("comment", element.getCommentElement(), false);
3767      }
3768      if (element.hasFhir_mappingElement()) {
3769        composeStringCore("fhir_mapping", element.getFhir_mappingElement(), false);
3770        composeStringExtras("fhir_mapping", element.getFhir_mappingElement(), false);
3771      }
3772      if (element.hasVset_descriptionElement()) {
3773        composeStringCore("vset_description", element.getVset_descriptionElement(), false);
3774        composeStringExtras("vset_description", element.getVset_descriptionElement(), false);
3775      }
3776      if (element.hasHl7v2_mappingElement()) {
3777        composeStringCore("hl7v2_mapping", element.getHl7v2_mappingElement(), false);
3778        composeStringExtras("hl7v2_mapping", element.getHl7v2_mappingElement(), false);
3779      }
3780      if (element.hasVisibleInViewElement()) {
3781        composeStringCore("visibleInView", element.getVisibleInViewElement(), false);
3782        composeStringExtras("visibleInView", element.getVisibleInViewElement(), false);
3783      }
3784  }
3785
3786  protected void composeCAPABILITY(String name, CAPABILITY element) throws IOException {
3787    if (element != null) {
3788      open(name);
3789      composeCAPABILITYProperties(element);
3790      close();
3791    }
3792  }
3793
3794  protected void composeCAPABILITYProperties(CAPABILITY element) throws IOException {
3795    composeLOCATABLEProperties(element);
3796      if (element.hasCredentials()) {
3797        composeITEM_STRUCTURE("credentials", element.getCredentials());
3798      }
3799      if (element.hasTime_validity()) {
3800        composeDV_INTERVAL("time_validity", element.getTime_validity());
3801      }
3802  }
3803
3804  protected void composeCLUSTER(String name, CLUSTER element) throws IOException {
3805    if (element != null) {
3806      open(name);
3807      composeCLUSTERProperties(element);
3808      close();
3809    }
3810  }
3811
3812  protected void composeCLUSTERProperties(CLUSTER element) throws IOException {
3813    composeITEMProperties(element);
3814      if (element.hasItems()) {
3815        openArray("items");
3816        for (ITEM e : element.getItemsList()) 
3817          composeITEM(null, e);
3818        closeArray();
3819      };
3820  }
3821
3822  protected void composeCODE_PHRASE(String name, CODE_PHRASE element) throws IOException {
3823    if (element != null) {
3824      open(name);
3825      composeCODE_PHRASEProperties(element);
3826      close();
3827    }
3828  }
3829
3830  protected void composeCODE_PHRASEProperties(CODE_PHRASE element) throws IOException {
3831    composeBaseProperties(element);
3832      if (element.hasTerminology_id()) {
3833        composeTERMINOLOGY_ID("terminology_id", element.getTerminology_id());
3834      }
3835      if (element.hasCode_stringElement()) {
3836        composeStringCore("code_string", element.getCode_stringElement(), false);
3837        composeStringExtras("code_string", element.getCode_stringElement(), false);
3838      }
3839      if (element.hasPreferred_termElement()) {
3840        composeStringCore("preferred_term", element.getPreferred_termElement(), false);
3841        composeStringExtras("preferred_term", element.getPreferred_termElement(), false);
3842      }
3843  }
3844
3845  protected void composeCOMPOSITION(String name, COMPOSITION element) throws IOException {
3846    if (element != null) {
3847      open(name);
3848      composeCOMPOSITIONProperties(element);
3849      close();
3850    }
3851  }
3852
3853  protected void composeCOMPOSITIONProperties(COMPOSITION element) throws IOException {
3854    composeLOCATABLEProperties(element);
3855      if (element.hasLanguage()) {
3856        composeCODE_PHRASE("language", element.getLanguage());
3857      }
3858      if (element.hasTerritory()) {
3859        composeCODE_PHRASE("territory", element.getTerritory());
3860      }
3861      if (element.hasCategory()) {
3862        composeDV_CODED_TEXT("category", element.getCategory());
3863      }
3864      if (element.hasContext()) {
3865        composeEVENT_CONTEXT("context", element.getContext());
3866      }
3867      if (element.hasComposer()) {
3868        composePARTY_PROXY("composer", element.getComposer());
3869      }
3870      if (element.hasContent()) {
3871        openArray("content");
3872        for (CONTENT_ITEM e : element.getContentList()) 
3873          composeCONTENT_ITEM(null, e);
3874        closeArray();
3875      };
3876  }
3877
3878  protected void composeCONTACT(String name, CONTACT element) throws IOException {
3879    if (element != null) {
3880      open(name);
3881      composeCONTACTProperties(element);
3882      close();
3883    }
3884  }
3885
3886  protected void composeCONTACTProperties(CONTACT element) throws IOException {
3887    composeLOCATABLEProperties(element);
3888      if (element.hasAddresses()) {
3889        openArray("addresses");
3890        for (ADDRESS e : element.getAddressesList()) 
3891          composeADDRESS(null, e);
3892        closeArray();
3893      };
3894      if (element.hasTime_validity()) {
3895        composeDV_INTERVAL("time_validity", element.getTime_validity());
3896      }
3897  }
3898
3899  protected void composeCONTRIBUTION(String name, CONTRIBUTION element) throws IOException {
3900    if (element != null) {
3901      open(name);
3902      composeCONTRIBUTIONProperties(element);
3903      close();
3904    }
3905  }
3906
3907  protected void composeCONTRIBUTIONProperties(CONTRIBUTION element) throws IOException {
3908    composeBaseProperties(element);
3909      if (element.hasUid()) {
3910        composeHIER_OBJECT_ID("uid", element.getUid());
3911      }
3912      if (element.hasVersions()) {
3913        openArray("versions");
3914        for (OBJECT_REF e : element.getVersionsList()) 
3915          composeOBJECT_REF(null, e);
3916        closeArray();
3917      };
3918      if (element.hasAudit()) {
3919        composeAUDIT_DETAILS("audit", element.getAudit());
3920      }
3921  }
3922
3923  protected void composeDV_BOOLEAN(String name, DV_BOOLEAN element) throws IOException {
3924    if (element != null) {
3925      open(name);
3926      composeDV_BOOLEANProperties(element);
3927      close();
3928    }
3929  }
3930
3931  protected void composeDV_BOOLEANProperties(DV_BOOLEAN element) throws IOException {
3932    composeDATA_VALUEProperties(element);
3933      if (element.hasValueElement()) {
3934        composeBooleanCore("value", element.getValueElement(), false);
3935        composeBooleanExtras("value", element.getValueElement(), false);
3936      }
3937  }
3938
3939  protected void composeDV_CODED_TEXT(String name, DV_CODED_TEXT element) throws IOException {
3940    if (element != null) {
3941      open(name);
3942      composeDV_CODED_TEXTProperties(element);
3943      close();
3944    }
3945  }
3946
3947  protected void composeDV_CODED_TEXTProperties(DV_CODED_TEXT element) throws IOException {
3948    composeDV_TEXTProperties(element);
3949      if (element.hasDefining_code()) {
3950        composeCODE_PHRASE("defining_code", element.getDefining_code());
3951      }
3952  }
3953
3954  protected void composeDV_COUNT(String name, DV_COUNT element) throws IOException {
3955    if (element != null) {
3956      open(name);
3957      composeDV_COUNTProperties(element);
3958      close();
3959    }
3960  }
3961
3962  protected void composeDV_COUNTProperties(DV_COUNT element) throws IOException {
3963    composeDV_AMOUNTProperties(element);
3964      if (element.hasMagnitudeElement()) {
3965        composeDecimalCore("magnitude", element.getMagnitudeElement(), false);
3966        composeDecimalExtras("magnitude", element.getMagnitudeElement(), false);
3967      }
3968  }
3969
3970  protected void composeDV_DATE_TIME(String name, DV_DATE_TIME element) throws IOException {
3971    if (element != null) {
3972      open(name);
3973      composeDV_DATE_TIMEProperties(element);
3974      close();
3975    }
3976  }
3977
3978  protected void composeDV_DATE_TIMEProperties(DV_DATE_TIME element) throws IOException {
3979    composeDV_ORDEREDProperties(element);
3980      if (element.hasValueElement()) {
3981        composeDateTimeCore("value", element.getValueElement(), false);
3982        composeDateTimeExtras("value", element.getValueElement(), false);
3983      }
3984  }
3985
3986  protected void composeDV_DATE(String name, DV_DATE element) throws IOException {
3987    if (element != null) {
3988      open(name);
3989      composeDV_DATEProperties(element);
3990      close();
3991    }
3992  }
3993
3994  protected void composeDV_DATEProperties(DV_DATE element) throws IOException {
3995    composeDV_TEMPORALProperties(element);
3996      if (element.hasValueElement()) {
3997        composeDateTimeCore("value", element.getValueElement(), false);
3998        composeDateTimeExtras("value", element.getValueElement(), false);
3999      }
4000  }
4001
4002  protected void composeDV_DURATION(String name, DV_DURATION element) throws IOException {
4003    if (element != null) {
4004      open(name);
4005      composeDV_DURATIONProperties(element);
4006      close();
4007    }
4008  }
4009
4010  protected void composeDV_DURATIONProperties(DV_DURATION element) throws IOException {
4011    composeDV_AMOUNTProperties(element);
4012      if (element.hasValueElement()) {
4013        composeStringCore("value", element.getValueElement(), false);
4014        composeStringExtras("value", element.getValueElement(), false);
4015      }
4016  }
4017
4018  protected void composeDV_EHR_URI(String name, DV_EHR_URI element) throws IOException {
4019    if (element != null) {
4020      open(name);
4021      composeDV_EHR_URIProperties(element);
4022      close();
4023    }
4024  }
4025
4026  protected void composeDV_EHR_URIProperties(DV_EHR_URI element) throws IOException {
4027    composeDV_URIProperties(element);
4028  }
4029
4030  protected void composeDV_GENERAL_TIME_SPECIFICATION(String name, DV_GENERAL_TIME_SPECIFICATION element) throws IOException {
4031    if (element != null) {
4032      open(name);
4033      composeDV_GENERAL_TIME_SPECIFICATIONProperties(element);
4034      close();
4035    }
4036  }
4037
4038  protected void composeDV_GENERAL_TIME_SPECIFICATIONProperties(DV_GENERAL_TIME_SPECIFICATION element) throws IOException {
4039    composeDV_TIME_SPECIFICATIONProperties(element);
4040  }
4041
4042  protected void composeDV_IDENTIFIER(String name, DV_IDENTIFIER element) throws IOException {
4043    if (element != null) {
4044      open(name);
4045      composeDV_IDENTIFIERProperties(element);
4046      close();
4047    }
4048  }
4049
4050  protected void composeDV_IDENTIFIERProperties(DV_IDENTIFIER element) throws IOException {
4051    composeDATA_VALUEProperties(element);
4052      if (element.hasIssuerElement()) {
4053        composeStringCore("issuer", element.getIssuerElement(), false);
4054        composeStringExtras("issuer", element.getIssuerElement(), false);
4055      }
4056      if (element.hasAssignerElement()) {
4057        composeStringCore("assigner", element.getAssignerElement(), false);
4058        composeStringExtras("assigner", element.getAssignerElement(), false);
4059      }
4060      if (element.hasIdElement()) {
4061        composeStringCore("id", element.getIdElement(), false);
4062        composeStringExtras("id", element.getIdElement(), false);
4063      }
4064      if (element.hasTypeElement()) {
4065        composeStringCore("type", element.getTypeElement(), false);
4066        composeStringExtras("type", element.getTypeElement(), false);
4067      }
4068  }
4069
4070  protected void composeDV_INTERVAL(String name, DV_INTERVAL element) throws IOException {
4071    if (element != null) {
4072      open(name);
4073      composeDV_INTERVALProperties(element);
4074      close();
4075    }
4076  }
4077
4078  protected void composeDV_INTERVALProperties(DV_INTERVAL element) throws IOException {
4079    composeDV_ORDEREDProperties(element);
4080  }
4081
4082  protected void composeDV_MULTIMEDIA(String name, DV_MULTIMEDIA element) throws IOException {
4083    if (element != null) {
4084      open(name);
4085      composeDV_MULTIMEDIAProperties(element);
4086      close();
4087    }
4088  }
4089
4090  protected void composeDV_MULTIMEDIAProperties(DV_MULTIMEDIA element) throws IOException {
4091    composeDV_ENCAPSULATEDProperties(element);
4092      if (element.hasAlternate_textElement()) {
4093        composeStringCore("alternate_text", element.getAlternate_textElement(), false);
4094        composeStringExtras("alternate_text", element.getAlternate_textElement(), false);
4095      }
4096      if (element.hasUri()) {
4097        composeDV_URI("uri", element.getUri());
4098      }
4099      if (element.hasDataElement()) {
4100        composeBase64BinaryCore("data", element.getDataElement(), false);
4101        composeBase64BinaryExtras("data", element.getDataElement(), false);
4102      }
4103      if (element.hasMedia_type()) {
4104        composeCODE_PHRASE("media_type", element.getMedia_type());
4105      }
4106      if (element.hasCompression_algorithm()) {
4107        composeCODE_PHRASE("compression_algorithm", element.getCompression_algorithm());
4108      }
4109      if (element.hasIntegrity_checkElement()) {
4110        composeBase64BinaryCore("integrity_check", element.getIntegrity_checkElement(), false);
4111        composeBase64BinaryExtras("integrity_check", element.getIntegrity_checkElement(), false);
4112      }
4113      if (element.hasIntegrity_check_algorithm()) {
4114        composeCODE_PHRASE("integrity_check_algorithm", element.getIntegrity_check_algorithm());
4115      }
4116      if (element.hasThumbnail()) {
4117        composeDV_MULTIMEDIA("thumbnail", element.getThumbnail());
4118      }
4119      if (element.hasSizeElement()) {
4120        composeIntegerCore("size", element.getSizeElement(), false);
4121        composeIntegerExtras("size", element.getSizeElement(), false);
4122      }
4123  }
4124
4125  protected void composeDV_ORDINAL(String name, DV_ORDINAL element) throws IOException {
4126    if (element != null) {
4127      open(name);
4128      composeDV_ORDINALProperties(element);
4129      close();
4130    }
4131  }
4132
4133  protected void composeDV_ORDINALProperties(DV_ORDINAL element) throws IOException {
4134    composeDV_ORDEREDProperties(element);
4135      if (element.hasSymbol()) {
4136        composeDV_CODED_TEXT("symbol", element.getSymbol());
4137      }
4138      if (element.hasValueElement()) {
4139        composeIntegerCore("value", element.getValueElement(), false);
4140        composeIntegerExtras("value", element.getValueElement(), false);
4141      }
4142  }
4143
4144  protected void composeDV_PARAGRAPH(String name, DV_PARAGRAPH element) throws IOException {
4145    if (element != null) {
4146      open(name);
4147      composeDV_PARAGRAPHProperties(element);
4148      close();
4149    }
4150  }
4151
4152  protected void composeDV_PARAGRAPHProperties(DV_PARAGRAPH element) throws IOException {
4153    composeDATA_VALUEProperties(element);
4154      if (element.hasItems()) {
4155        openArray("items");
4156        for (DV_TEXT e : element.getItemsList()) 
4157          composeDV_TEXT(null, e);
4158        closeArray();
4159      };
4160  }
4161
4162  protected void composeDV_PARSABLE(String name, DV_PARSABLE element) throws IOException {
4163    if (element != null) {
4164      open(name);
4165      composeDV_PARSABLEProperties(element);
4166      close();
4167    }
4168  }
4169
4170  protected void composeDV_PARSABLEProperties(DV_PARSABLE element) throws IOException {
4171    composeDV_ENCAPSULATEDProperties(element);
4172      if (element.hasValueElement()) {
4173        composeStringCore("value", element.getValueElement(), false);
4174        composeStringExtras("value", element.getValueElement(), false);
4175      }
4176      if (element.hasFormalismElement()) {
4177        composeStringCore("formalism", element.getFormalismElement(), false);
4178        composeStringExtras("formalism", element.getFormalismElement(), false);
4179      }
4180  }
4181
4182  protected void composeDV_PERIODIC_TIME_SPECIFICATION(String name, DV_PERIODIC_TIME_SPECIFICATION element) throws IOException {
4183    if (element != null) {
4184      open(name);
4185      composeDV_PERIODIC_TIME_SPECIFICATIONProperties(element);
4186      close();
4187    }
4188  }
4189
4190  protected void composeDV_PERIODIC_TIME_SPECIFICATIONProperties(DV_PERIODIC_TIME_SPECIFICATION element) throws IOException {
4191    composeDV_TIME_SPECIFICATIONProperties(element);
4192  }
4193
4194  protected void composeDV_PROPORTION(String name, DV_PROPORTION element) throws IOException {
4195    if (element != null) {
4196      open(name);
4197      composeDV_PROPORTIONProperties(element);
4198      close();
4199    }
4200  }
4201
4202  protected void composeDV_PROPORTIONProperties(DV_PROPORTION element) throws IOException {
4203    composeDV_AMOUNTProperties(element);
4204      if (element.hasNumeratorElement()) {
4205        composeDecimalCore("numerator", element.getNumeratorElement(), false);
4206        composeDecimalExtras("numerator", element.getNumeratorElement(), false);
4207      }
4208      if (element.hasDenominatorElement()) {
4209        composeDecimalCore("denominator", element.getDenominatorElement(), false);
4210        composeDecimalExtras("denominator", element.getDenominatorElement(), false);
4211      }
4212      if (element.hasTypeElement()) {
4213        composeCodeCore("type", element.getTypeElement(), false);
4214        composeCodeExtras("type", element.getTypeElement(), false);
4215      }
4216      if (element.hasPrecisionElement()) {
4217        composeIntegerCore("precision", element.getPrecisionElement(), false);
4218        composeIntegerExtras("precision", element.getPrecisionElement(), false);
4219      }
4220  }
4221
4222  protected void composeDV_QUANTITY(String name, DV_QUANTITY element) throws IOException {
4223    if (element != null) {
4224      open(name);
4225      composeDV_QUANTITYProperties(element);
4226      close();
4227    }
4228  }
4229
4230  protected void composeDV_QUANTITYProperties(DV_QUANTITY element) throws IOException {
4231    composeDV_AMOUNTProperties(element);
4232      if (element.hasMagnitudeElement()) {
4233        composeDecimalCore("magnitude", element.getMagnitudeElement(), false);
4234        composeDecimalExtras("magnitude", element.getMagnitudeElement(), false);
4235      }
4236      if (element.hasPrecisionElement()) {
4237        composeIntegerCore("precision", element.getPrecisionElement(), false);
4238        composeIntegerExtras("precision", element.getPrecisionElement(), false);
4239      }
4240      if (element.hasUnitsElement()) {
4241        composeStringCore("units", element.getUnitsElement(), false);
4242        composeStringExtras("units", element.getUnitsElement(), false);
4243      }
4244      if (element.hasUnits_systemElement()) {
4245        composeStringCore("units_system", element.getUnits_systemElement(), false);
4246        composeStringExtras("units_system", element.getUnits_systemElement(), false);
4247      }
4248      if (element.hasUnits_display_nameElement()) {
4249        composeStringCore("units_display_name", element.getUnits_display_nameElement(), false);
4250        composeStringExtras("units_display_name", element.getUnits_display_nameElement(), false);
4251      }
4252  }
4253
4254  protected void composeDV_SCALE(String name, DV_SCALE element) throws IOException {
4255    if (element != null) {
4256      open(name);
4257      composeDV_SCALEProperties(element);
4258      close();
4259    }
4260  }
4261
4262  protected void composeDV_SCALEProperties(DV_SCALE element) throws IOException {
4263    composeDV_ORDEREDProperties(element);
4264      if (element.hasSymbol()) {
4265        composeDV_CODED_TEXT("symbol", element.getSymbol());
4266      }
4267      if (element.hasValueElement()) {
4268        composeDecimalCore("value", element.getValueElement(), false);
4269        composeDecimalExtras("value", element.getValueElement(), false);
4270      }
4271  }
4272
4273  protected void composeDV_STATE(String name, DV_STATE element) throws IOException {
4274    if (element != null) {
4275      open(name);
4276      composeDV_STATEProperties(element);
4277      close();
4278    }
4279  }
4280
4281  protected void composeDV_STATEProperties(DV_STATE element) throws IOException {
4282    composeDATA_VALUEProperties(element);
4283      if (element.hasValue()) {
4284        composeDV_CODED_TEXT("value", element.getValue());
4285      }
4286      if (element.hasIs_terminalElement()) {
4287        composeBooleanCore("is_terminal", element.getIs_terminalElement(), false);
4288        composeBooleanExtras("is_terminal", element.getIs_terminalElement(), false);
4289      }
4290  }
4291
4292  protected void composeDV_TEXT(String name, DV_TEXT element) throws IOException {
4293    if (element != null) {
4294      open(name);
4295      composeDV_TEXTProperties(element);
4296      close();
4297    }
4298  }
4299
4300  protected void composeDV_TEXTProperties(DV_TEXT element) throws IOException {
4301    composeDATA_VALUEProperties(element);
4302      if (element.hasValueElement()) {
4303        composeStringCore("value", element.getValueElement(), false);
4304        composeStringExtras("value", element.getValueElement(), false);
4305      }
4306      if (element.hasHyperlink()) {
4307        composeDV_URI("hyperlink", element.getHyperlink());
4308      }
4309      if (element.hasFormattingElement()) {
4310        composeStringCore("formatting", element.getFormattingElement(), false);
4311        composeStringExtras("formatting", element.getFormattingElement(), false);
4312      }
4313      if (element.hasMappings()) {
4314        openArray("mappings");
4315        for (TERM_MAPPING e : element.getMappingsList()) 
4316          composeTERM_MAPPING(null, e);
4317        closeArray();
4318      };
4319      if (element.hasLanguage()) {
4320        composeCODE_PHRASE("language", element.getLanguage());
4321      }
4322      if (element.hasEncoding()) {
4323        composeCODE_PHRASE("encoding", element.getEncoding());
4324      }
4325  }
4326
4327  protected void composeDV_TIME(String name, DV_TIME element) throws IOException {
4328    if (element != null) {
4329      open(name);
4330      composeDV_TIMEProperties(element);
4331      close();
4332    }
4333  }
4334
4335  protected void composeDV_TIMEProperties(DV_TIME element) throws IOException {
4336    composeDV_ORDEREDProperties(element);
4337      if (element.hasValueElement()) {
4338        composeStringCore("value", element.getValueElement(), false);
4339        composeStringExtras("value", element.getValueElement(), false);
4340      }
4341  }
4342
4343  protected void composeDV_URI(String name, DV_URI element) throws IOException {
4344    if (element != null) {
4345      open(name);
4346      composeDV_URIProperties(element);
4347      close();
4348    }
4349  }
4350
4351  protected void composeDV_URIProperties(DV_URI element) throws IOException {
4352    composeDATA_VALUEProperties(element);
4353      if (element.hasValueElement()) {
4354        composeUriCore("value", element.getValueElement(), false);
4355        composeUriExtras("value", element.getValueElement(), false);
4356      }
4357  }
4358
4359  protected void composeEHR_ACCESS(String name, EHR_ACCESS element) throws IOException {
4360    if (element != null) {
4361      open(name);
4362      composeEHR_ACCESSProperties(element);
4363      close();
4364    }
4365  }
4366
4367  protected void composeEHR_ACCESSProperties(EHR_ACCESS element) throws IOException {
4368    composeLOCATABLEProperties(element);
4369      if (element.hasSettings()) {
4370        composeACCESS_CONTROL_SETTINGS("settings", element.getSettings());
4371      }
4372  }
4373
4374  protected void composeEHR_STATUS(String name, EHR_STATUS element) throws IOException {
4375    if (element != null) {
4376      open(name);
4377      composeEHR_STATUSProperties(element);
4378      close();
4379    }
4380  }
4381
4382  protected void composeEHR_STATUSProperties(EHR_STATUS element) throws IOException {
4383    composeLOCATABLEProperties(element);
4384      if (element.hasSubject()) {
4385        composePARTY_SELF("subject", element.getSubject());
4386      }
4387      if (element.hasIs_queryableElement()) {
4388        composeBooleanCore("is_queryable", element.getIs_queryableElement(), false);
4389        composeBooleanExtras("is_queryable", element.getIs_queryableElement(), false);
4390      }
4391      if (element.hasIs_modifiableElement()) {
4392        composeBooleanCore("is_modifiable", element.getIs_modifiableElement(), false);
4393        composeBooleanExtras("is_modifiable", element.getIs_modifiableElement(), false);
4394      }
4395      if (element.hasOther_details()) {
4396        composeITEM_STRUCTURE("other_details", element.getOther_details());
4397      }
4398  }
4399
4400  protected void composeEHR(String name, EHR element) throws IOException {
4401    if (element != null) {
4402      open(name);
4403      composeEHRProperties(element);
4404      close();
4405    }
4406  }
4407
4408  protected void composeEHRProperties(EHR element) throws IOException {
4409    composeAnyProperties(element);
4410      if (element.hasSystem_id()) {
4411        openArray("system_id");
4412        for (HIER_OBJECT_ID e : element.getSystem_idList()) 
4413          composeHIER_OBJECT_ID(null, e);
4414        closeArray();
4415      };
4416      if (element.hasEhr_id()) {
4417        composeHIER_OBJECT_ID("ehr_id", element.getEhr_id());
4418      }
4419      if (element.hasContributions()) {
4420        openArray("contributions");
4421        for (OBJECT_REF e : element.getContributionsList()) 
4422          composeOBJECT_REF(null, e);
4423        closeArray();
4424      };
4425      if (element.hasEhr_status()) {
4426        composeOBJECT_REF("ehr_status", element.getEhr_status());
4427      }
4428      if (element.hasEhr_access()) {
4429        composeOBJECT_REF("ehr_access", element.getEhr_access());
4430      }
4431      if (element.hasCompositions()) {
4432        openArray("compositions");
4433        for (OBJECT_REF e : element.getCompositionsList()) 
4434          composeOBJECT_REF(null, e);
4435        closeArray();
4436      };
4437      if (element.hasDirectory()) {
4438        composeOBJECT_REF("directory", element.getDirectory());
4439      }
4440      if (element.hasTime_created()) {
4441        composeDV_DATE_TIME("time_created", element.getTime_created());
4442      }
4443      if (element.hasFolders()) {
4444        openArray("folders");
4445        for (OBJECT_REF e : element.getFoldersList()) 
4446          composeOBJECT_REF(null, e);
4447        closeArray();
4448      };
4449      if (element.hasTags()) {
4450        openArray("tags");
4451        for (OBJECT_REF e : element.getTagsList()) 
4452          composeOBJECT_REF(null, e);
4453        closeArray();
4454      };
4455  }
4456
4457  protected void composeELEMENT(String name, ELEMENT element) throws IOException {
4458    if (element != null) {
4459      open(name);
4460      composeELEMENTProperties(element);
4461      close();
4462    }
4463  }
4464
4465  protected void composeELEMENTProperties(ELEMENT element) throws IOException {
4466    composeITEMProperties(element);
4467      if (element.hasNull_flavour()) {
4468        composeDV_CODED_TEXT("null_flavour", element.getNull_flavour());
4469      }
4470      if (element.hasValue()) {
4471        composeDATA_VALUE("value", element.getValue());
4472      }
4473      if (element.hasNull_reason()) {
4474        composeDV_TEXT("null_reason", element.getNull_reason());
4475      }
4476  }
4477
4478  protected void composeEVALUATION(String name, EVALUATION element) throws IOException {
4479    if (element != null) {
4480      open(name);
4481      composeEVALUATIONProperties(element);
4482      close();
4483    }
4484  }
4485
4486  protected void composeEVALUATIONProperties(EVALUATION element) throws IOException {
4487    composeCARE_ENTRYProperties(element);
4488      if (element.hasData()) {
4489        composeITEM_STRUCTURE("data", element.getData());
4490      }
4491  }
4492
4493  protected void composeEVENT_CONTEXT(String name, EVENT_CONTEXT element) throws IOException {
4494    if (element != null) {
4495      open(name);
4496      composeEVENT_CONTEXTProperties(element);
4497      close();
4498    }
4499  }
4500
4501  protected void composeEVENT_CONTEXTProperties(EVENT_CONTEXT element) throws IOException {
4502    composeLOCATABLEProperties(element);
4503      if (element.hasStart_time()) {
4504        composeDV_DATE_TIME("start_time", element.getStart_time());
4505      }
4506      if (element.hasEnd_time()) {
4507        composeDV_DATE_TIME("end_time", element.getEnd_time());
4508      }
4509      if (element.hasLocationElement()) {
4510        composeStringCore("location", element.getLocationElement(), false);
4511        composeStringExtras("location", element.getLocationElement(), false);
4512      }
4513      if (element.hasSetting()) {
4514        composeDV_CODED_TEXT("setting", element.getSetting());
4515      }
4516      if (element.hasOther_context()) {
4517        composeITEM_STRUCTURE("other_context", element.getOther_context());
4518      }
4519      if (element.hasHealth_care_facility()) {
4520        composePARTY_IDENTIFIED("health_care_facility", element.getHealth_care_facility());
4521      }
4522      if (element.hasParticipations()) {
4523        openArray("participations");
4524        for (PARTICIPATION e : element.getParticipationsList()) 
4525          composePARTICIPATION(null, e);
4526        closeArray();
4527      };
4528  }
4529
4530  protected void composeFEEDER_AUDIT_DETAILS(String name, FEEDER_AUDIT_DETAILS element) throws IOException {
4531    if (element != null) {
4532      open(name);
4533      composeFEEDER_AUDIT_DETAILSProperties(element);
4534      close();
4535    }
4536  }
4537
4538  protected void composeFEEDER_AUDIT_DETAILSProperties(FEEDER_AUDIT_DETAILS element) throws IOException {
4539    composeBaseProperties(element);
4540      if (element.hasSystem_idElement()) {
4541        composeStringCore("system_id", element.getSystem_idElement(), false);
4542        composeStringExtras("system_id", element.getSystem_idElement(), false);
4543      }
4544      if (element.hasLocation()) {
4545        composePARTY_IDENTIFIED("location", element.getLocation());
4546      }
4547      if (element.hasSubject()) {
4548        composePARTY_PROXY("subject", element.getSubject());
4549      }
4550      if (element.hasProvider()) {
4551        composePARTY_IDENTIFIED("provider", element.getProvider());
4552      }
4553      if (element.hasTime()) {
4554        composeDV_DATE_TIME("time", element.getTime());
4555      }
4556      if (element.hasVersion_idElement()) {
4557        composeStringCore("version_id", element.getVersion_idElement(), false);
4558        composeStringExtras("version_id", element.getVersion_idElement(), false);
4559      }
4560      if (element.hasOther_details()) {
4561        composeITEM_STRUCTURE("other_details", element.getOther_details());
4562      }
4563  }
4564
4565  protected void composeFEEDER_AUDIT(String name, FEEDER_AUDIT element) throws IOException {
4566    if (element != null) {
4567      open(name);
4568      composeFEEDER_AUDITProperties(element);
4569      close();
4570    }
4571  }
4572
4573  protected void composeFEEDER_AUDITProperties(FEEDER_AUDIT element) throws IOException {
4574    composeBaseProperties(element);
4575      if (element.hasOriginating_system_item_ids()) {
4576        openArray("originating_system_item_ids");
4577        for (DV_IDENTIFIER e : element.getOriginating_system_item_idsList()) 
4578          composeDV_IDENTIFIER(null, e);
4579        closeArray();
4580      };
4581      if (element.hasFeeder_system_item_ids()) {
4582        openArray("feeder_system_item_ids");
4583        for (DV_IDENTIFIER e : element.getFeeder_system_item_idsList()) 
4584          composeDV_IDENTIFIER(null, e);
4585        closeArray();
4586      };
4587      if (element.hasOriginal_content()) {
4588        composeDV_ENCAPSULATED("original_content", element.getOriginal_content());
4589      }
4590      if (element.hasOriginating_system_audit()) {
4591        composeFEEDER_AUDIT_DETAILS("originating_system_audit", element.getOriginating_system_audit());
4592      }
4593      if (element.hasFeeder_system_audit()) {
4594        composeFEEDER_AUDIT_DETAILS("feeder_system_audit", element.getFeeder_system_audit());
4595      }
4596  }
4597
4598  protected void composeFOLDER(String name, FOLDER element) throws IOException {
4599    if (element != null) {
4600      open(name);
4601      composeFOLDERProperties(element);
4602      close();
4603    }
4604  }
4605
4606  protected void composeFOLDERProperties(FOLDER element) throws IOException {
4607    composeLOCATABLEProperties(element);
4608      if (element.hasItems()) {
4609        openArray("items");
4610        for (OBJECT_REF e : element.getItemsList()) 
4611          composeOBJECT_REF(null, e);
4612        closeArray();
4613      };
4614      if (element.hasFolders()) {
4615        openArray("folders");
4616        for (FOLDER e : element.getFoldersList()) 
4617          composeFOLDER(null, e);
4618        closeArray();
4619      };
4620      if (element.hasDetails()) {
4621        composeITEM_STRUCTURE("details", element.getDetails());
4622      }
4623  }
4624
4625  protected void composeGENERIC_ID(String name, GENERIC_ID element) throws IOException {
4626    if (element != null) {
4627      open(name);
4628      composeGENERIC_IDProperties(element);
4629      close();
4630    }
4631  }
4632
4633  protected void composeGENERIC_IDProperties(GENERIC_ID element) throws IOException {
4634    composeOBJECT_IDProperties(element);
4635  }
4636
4637  protected void composeGROUP(String name, GROUP element) throws IOException {
4638    if (element != null) {
4639      open(name);
4640      composeGROUPProperties(element);
4641      close();
4642    }
4643  }
4644
4645  protected void composeGROUPProperties(GROUP element) throws IOException {
4646    composeACTORProperties(element);
4647  }
4648
4649  protected void composeHIER_OBJECT_ID(String name, HIER_OBJECT_ID element) throws IOException {
4650    if (element != null) {
4651      open(name);
4652      composeHIER_OBJECT_IDProperties(element);
4653      close();
4654    }
4655  }
4656
4657  protected void composeHIER_OBJECT_IDProperties(HIER_OBJECT_ID element) throws IOException {
4658    composeUID_BASED_IDProperties(element);
4659  }
4660
4661  protected void composeHISTORY(String name, HISTORY element) throws IOException {
4662    if (element != null) {
4663      open(name);
4664      composeHISTORYProperties(element);
4665      close();
4666    }
4667  }
4668
4669  protected void composeHISTORYProperties(HISTORY element) throws IOException {
4670    composeDATA_STRUCTUREProperties(element);
4671      if (element.hasOrigin()) {
4672        composeDV_DATE_TIME("origin", element.getOrigin());
4673      }
4674      if (element.hasPeriod()) {
4675        composeDV_DURATION("period", element.getPeriod());
4676      }
4677      if (element.hasDuration()) {
4678        composeDV_DURATION("duration", element.getDuration());
4679      }
4680      if (element.hasSummary()) {
4681        composeITEM_STRUCTURE("summary", element.getSummary());
4682      }
4683      if (element.hasEvents()) {
4684        openArray("events");
4685        for (EVENT e : element.getEventsList()) 
4686          composeEVENT(null, e);
4687        closeArray();
4688      };
4689  }
4690
4691  protected void composeIMPORTED_VERSION(String name, IMPORTED_VERSION element) throws IOException {
4692    if (element != null) {
4693      open(name);
4694      composeIMPORTED_VERSIONProperties(element);
4695      close();
4696    }
4697  }
4698
4699  protected void composeIMPORTED_VERSIONProperties(IMPORTED_VERSION element) throws IOException {
4700    composeVERSIONProperties(element);
4701      if (element.hasItem()) {
4702        composeORIGINAL_VERSION("item", element.getItem());
4703      }
4704  }
4705
4706  protected void composeINSTRUCTION_DETAILS(String name, INSTRUCTION_DETAILS element) throws IOException {
4707    if (element != null) {
4708      open(name);
4709      composeINSTRUCTION_DETAILSProperties(element);
4710      close();
4711    }
4712  }
4713
4714  protected void composeINSTRUCTION_DETAILSProperties(INSTRUCTION_DETAILS element) throws IOException {
4715    composePATHABLEProperties(element);
4716      if (element.hasInstruction_id()) {
4717        composeLOCATABLE_REF("instruction_id", element.getInstruction_id());
4718      }
4719      if (element.hasActivity_idElement()) {
4720        composeStringCore("activity_id", element.getActivity_idElement(), false);
4721        composeStringExtras("activity_id", element.getActivity_idElement(), false);
4722      }
4723      if (element.hasWf_details()) {
4724        composeITEM_STRUCTURE("wf_details", element.getWf_details());
4725      }
4726  }
4727
4728  protected void composeINSTRUCTION(String name, INSTRUCTION element) throws IOException {
4729    if (element != null) {
4730      open(name);
4731      composeINSTRUCTIONProperties(element);
4732      close();
4733    }
4734  }
4735
4736  protected void composeINSTRUCTIONProperties(INSTRUCTION element) throws IOException {
4737    composeCARE_ENTRYProperties(element);
4738      if (element.hasNarrative()) {
4739        composeDV_TEXT("narrative", element.getNarrative());
4740      }
4741      if (element.hasExpiry_time()) {
4742        composeDV_DATE_TIME("expiry_time", element.getExpiry_time());
4743      }
4744      if (element.hasWf_definition()) {
4745        composeDV_PARSABLE("wf_definition", element.getWf_definition());
4746      }
4747      if (element.hasActivities()) {
4748        openArray("activities");
4749        for (ACTIVITY e : element.getActivitiesList()) 
4750          composeACTIVITY(null, e);
4751        closeArray();
4752      };
4753  }
4754
4755  protected void composeINTERNET_ID(String name, INTERNET_ID element) throws IOException {
4756    if (element != null) {
4757      open(name);
4758      composeINTERNET_IDProperties(element);
4759      close();
4760    }
4761  }
4762
4763  protected void composeINTERNET_IDProperties(INTERNET_ID element) throws IOException {
4764    composeUIDProperties(element);
4765  }
4766
4767  protected void composeINTERVAL_EVENT(String name, INTERVAL_EVENT element) throws IOException {
4768    if (element != null) {
4769      open(name);
4770      composeINTERVAL_EVENTProperties(element);
4771      close();
4772    }
4773  }
4774
4775  protected void composeINTERVAL_EVENTProperties(INTERVAL_EVENT element) throws IOException {
4776    composeEVENTProperties(element);
4777      if (element.hasWidth()) {
4778        composeDV_DURATION("width", element.getWidth());
4779      }
4780      if (element.hasSample_countElement()) {
4781        composeIntegerCore("sample_count", element.getSample_countElement(), false);
4782        composeIntegerExtras("sample_count", element.getSample_countElement(), false);
4783      }
4784      if (element.hasMath_function()) {
4785        composeDV_CODED_TEXT("math_function", element.getMath_function());
4786      }
4787  }
4788
4789  protected void composeISM_TRANSITION(String name, ISM_TRANSITION element) throws IOException {
4790    if (element != null) {
4791      open(name);
4792      composeISM_TRANSITIONProperties(element);
4793      close();
4794    }
4795  }
4796
4797  protected void composeISM_TRANSITIONProperties(ISM_TRANSITION element) throws IOException {
4798    composePATHABLEProperties(element);
4799      if (element.hasCurrent_state()) {
4800        composeDV_CODED_TEXT("current_state", element.getCurrent_state());
4801      }
4802      if (element.hasTransition()) {
4803        composeDV_CODED_TEXT("transition", element.getTransition());
4804      }
4805      if (element.hasCareflow_step()) {
4806        composeDV_CODED_TEXT("careflow_step", element.getCareflow_step());
4807      }
4808      if (element.hasReason()) {
4809        openArray("reason");
4810        for (DV_TEXT e : element.getReasonList()) 
4811          composeDV_TEXT(null, e);
4812        closeArray();
4813      };
4814  }
4815
4816  protected void composeISO_OID(String name, ISO_OID element) throws IOException {
4817    if (element != null) {
4818      open(name);
4819      composeISO_OIDProperties(element);
4820      close();
4821    }
4822  }
4823
4824  protected void composeISO_OIDProperties(ISO_OID element) throws IOException {
4825    composeUIDProperties(element);
4826  }
4827
4828  protected void composeITEM_LIST(String name, ITEM_LIST element) throws IOException {
4829    if (element != null) {
4830      open(name);
4831      composeITEM_LISTProperties(element);
4832      close();
4833    }
4834  }
4835
4836  protected void composeITEM_LISTProperties(ITEM_LIST element) throws IOException {
4837    composeITEM_STRUCTUREProperties(element);
4838      if (element.hasItems()) {
4839        openArray("items");
4840        for (ELEMENT e : element.getItemsList()) 
4841          composeELEMENT(null, e);
4842        closeArray();
4843      };
4844  }
4845
4846  protected void composeITEM_SINGLE(String name, ITEM_SINGLE element) throws IOException {
4847    if (element != null) {
4848      open(name);
4849      composeITEM_SINGLEProperties(element);
4850      close();
4851    }
4852  }
4853
4854  protected void composeITEM_SINGLEProperties(ITEM_SINGLE element) throws IOException {
4855    composeITEM_STRUCTUREProperties(element);
4856      if (element.hasItem()) {
4857        composeELEMENT("item", element.getItem());
4858      }
4859  }
4860
4861  protected void composeITEM_TABLE(String name, ITEM_TABLE element) throws IOException {
4862    if (element != null) {
4863      open(name);
4864      composeITEM_TABLEProperties(element);
4865      close();
4866    }
4867  }
4868
4869  protected void composeITEM_TABLEProperties(ITEM_TABLE element) throws IOException {
4870    composeITEM_STRUCTUREProperties(element);
4871      if (element.hasRows()) {
4872        openArray("rows");
4873        for (CLUSTER e : element.getRowsList()) 
4874          composeCLUSTER(null, e);
4875        closeArray();
4876      };
4877  }
4878
4879  protected void composeITEM_TAG(String name, ITEM_TAG element) throws IOException {
4880    if (element != null) {
4881      open(name);
4882      composeITEM_TAGProperties(element);
4883      close();
4884    }
4885  }
4886
4887  protected void composeITEM_TAGProperties(ITEM_TAG element) throws IOException {
4888    composeBaseProperties(element);
4889      if (element.hasKeyElement()) {
4890        composeStringCore("key", element.getKeyElement(), false);
4891        composeStringExtras("key", element.getKeyElement(), false);
4892      }
4893      if (element.hasValueElement()) {
4894        composeStringCore("value", element.getValueElement(), false);
4895        composeStringExtras("value", element.getValueElement(), false);
4896      }
4897      if (element.hasTarget()) {
4898        composeUID_BASED_ID("target", element.getTarget());
4899      }
4900      if (element.hasTarget_pathElement()) {
4901        composeStringCore("target_path", element.getTarget_pathElement(), false);
4902        composeStringExtras("target_path", element.getTarget_pathElement(), false);
4903      }
4904      if (element.hasOwner_id()) {
4905        composeOBJECT_REF("owner_id", element.getOwner_id());
4906      }
4907  }
4908
4909  protected void composeITEM_TREE(String name, ITEM_TREE element) throws IOException {
4910    if (element != null) {
4911      open(name);
4912      composeITEM_TREEProperties(element);
4913      close();
4914    }
4915  }
4916
4917  protected void composeITEM_TREEProperties(ITEM_TREE element) throws IOException {
4918    composeITEM_STRUCTUREProperties(element);
4919      if (element.hasItems()) {
4920        openArray("items");
4921        for (ITEM e : element.getItemsList()) 
4922          composeITEM(null, e);
4923        closeArray();
4924      };
4925  }
4926
4927  protected void composeLINK(String name, LINK element) throws IOException {
4928    if (element != null) {
4929      open(name);
4930      composeLINKProperties(element);
4931      close();
4932    }
4933  }
4934
4935  protected void composeLINKProperties(LINK element) throws IOException {
4936    composeBaseProperties(element);
4937      if (element.hasMeaning()) {
4938        composeDV_TEXT("meaning", element.getMeaning());
4939      }
4940      if (element.hasType()) {
4941        composeDV_TEXT("type", element.getType());
4942      }
4943      if (element.hasTarget()) {
4944        composeDV_EHR_URI("target", element.getTarget());
4945      }
4946  }
4947
4948  protected void composeLOCATABLE_REF(String name, LOCATABLE_REF element) throws IOException {
4949    if (element != null) {
4950      open(name);
4951      composeLOCATABLE_REFProperties(element);
4952      close();
4953    }
4954  }
4955
4956  protected void composeLOCATABLE_REFProperties(LOCATABLE_REF element) throws IOException {
4957    composeOBJECT_REFProperties(element);
4958      if (element.hasPathElement()) {
4959        composeStringCore("path", element.getPathElement(), false);
4960        composeStringExtras("path", element.getPathElement(), false);
4961      }
4962  }
4963
4964  protected void composeOBJECT_REF(String name, OBJECT_REF element) throws IOException {
4965    if (element != null) {
4966      open(name);
4967      composeOBJECT_REFProperties(element);
4968      close();
4969    }
4970  }
4971
4972  protected void composeOBJECT_REFProperties(OBJECT_REF element) throws IOException {
4973    composeBaseProperties(element);
4974      if (element.hasNamespaceElement()) {
4975        composeStringCore("namespace", element.getNamespaceElement(), false);
4976        composeStringExtras("namespace", element.getNamespaceElement(), false);
4977      }
4978      if (element.hasTypeElement()) {
4979        composeStringCore("type", element.getTypeElement(), false);
4980        composeStringExtras("type", element.getTypeElement(), false);
4981      }
4982      if (element.hasId()) {
4983        composeOBJECT_ID("id", element.getId());
4984      }
4985  }
4986
4987  protected void composeOBJECT_VERSION_ID(String name, OBJECT_VERSION_ID element) throws IOException {
4988    if (element != null) {
4989      open(name);
4990      composeOBJECT_VERSION_IDProperties(element);
4991      close();
4992    }
4993  }
4994
4995  protected void composeOBJECT_VERSION_IDProperties(OBJECT_VERSION_ID element) throws IOException {
4996    composeUID_BASED_IDProperties(element);
4997  }
4998
4999  protected void composeOBSERVATION(String name, OBSERVATION element) throws IOException {
5000    if (element != null) {
5001      open(name);
5002      composeOBSERVATIONProperties(element);
5003      close();
5004    }
5005  }
5006
5007  protected void composeOBSERVATIONProperties(OBSERVATION element) throws IOException {
5008    composeCARE_ENTRYProperties(element);
5009      if (element.hasData()) {
5010        composeHISTORY("data", element.getData());
5011      }
5012      if (element.hasState()) {
5013        composeHISTORY("state", element.getState());
5014      }
5015  }
5016
5017  protected void composeORGANISATION(String name, ORGANISATION element) throws IOException {
5018    if (element != null) {
5019      open(name);
5020      composeORGANISATIONProperties(element);
5021      close();
5022    }
5023  }
5024
5025  protected void composeORGANISATIONProperties(ORGANISATION element) throws IOException {
5026    composeACTORProperties(element);
5027  }
5028
5029  protected void composeORIGINAL_VERSION(String name, ORIGINAL_VERSION element) throws IOException {
5030    if (element != null) {
5031      open(name);
5032      composeORIGINAL_VERSIONProperties(element);
5033      close();
5034    }
5035  }
5036
5037  protected void composeORIGINAL_VERSIONProperties(ORIGINAL_VERSION element) throws IOException {
5038    composeVERSIONProperties(element);
5039      if (element.hasUid()) {
5040        composeOBJECT_VERSION_ID("uid", element.getUid());
5041      }
5042      if (element.hasPreceding_version_uid()) {
5043        composeOBJECT_VERSION_ID("preceding_version_uid", element.getPreceding_version_uid());
5044      }
5045      if (element.hasOther_input_version_uids()) {
5046        openArray("other_input_version_uids");
5047        for (OBJECT_VERSION_ID e : element.getOther_input_version_uidsList()) 
5048          composeOBJECT_VERSION_ID(null, e);
5049        closeArray();
5050      };
5051      if (element.hasLifecycle_state()) {
5052        composeDV_CODED_TEXT("lifecycle_state", element.getLifecycle_state());
5053      }
5054      if (element.hasAttestations()) {
5055        openArray("attestations");
5056        for (ATTESTATION e : element.getAttestationsList()) 
5057          composeATTESTATION(null, e);
5058        closeArray();
5059      };
5060      if (element.hasData()) {
5061        composeAny("data", element.getData());
5062      }
5063  }
5064
5065  protected void composePARTICIPATION(String name, PARTICIPATION element) throws IOException {
5066    if (element != null) {
5067      open(name);
5068      composePARTICIPATIONProperties(element);
5069      close();
5070    }
5071  }
5072
5073  protected void composePARTICIPATIONProperties(PARTICIPATION element) throws IOException {
5074    composeLOCATABLEProperties(element);
5075      if (element.hasFunction()) {
5076        composeDV_TEXT("function", element.getFunction());
5077      }
5078      if (element.hasMode()) {
5079        composeDV_CODED_TEXT("mode", element.getMode());
5080      }
5081      if (element.hasPerformer()) {
5082        composePARTY_PROXY("performer", element.getPerformer());
5083      }
5084      if (element.hasTime()) {
5085        composeDV_INTERVAL("time", element.getTime());
5086      }
5087  }
5088
5089  protected void composePARTY_IDENTIFIED(String name, PARTY_IDENTIFIED element) throws IOException {
5090    if (element != null) {
5091      open(name);
5092      composePARTY_IDENTIFIEDProperties(element);
5093      close();
5094    }
5095  }
5096
5097  protected void composePARTY_IDENTIFIEDProperties(PARTY_IDENTIFIED element) throws IOException {
5098    composePARTY_PROXYProperties(element);
5099      if (element.hasNameElement()) {
5100        composeStringCore("name", element.getNameElement(), false);
5101        composeStringExtras("name", element.getNameElement(), false);
5102      }
5103      if (element.hasIdentifiers()) {
5104        openArray("identifiers");
5105        for (DV_IDENTIFIER e : element.getIdentifiersList()) 
5106          composeDV_IDENTIFIER(null, e);
5107        closeArray();
5108      };
5109  }
5110
5111  protected void composePARTY_IDENTITY(String name, PARTY_IDENTITY element) throws IOException {
5112    if (element != null) {
5113      open(name);
5114      composePARTY_IDENTITYProperties(element);
5115      close();
5116    }
5117  }
5118
5119  protected void composePARTY_IDENTITYProperties(PARTY_IDENTITY element) throws IOException {
5120    composeLOCATABLEProperties(element);
5121      if (element.hasDetails()) {
5122        composeITEM_STRUCTURE("details", element.getDetails());
5123      }
5124  }
5125
5126  protected void composePARTY_REF(String name, PARTY_REF element) throws IOException {
5127    if (element != null) {
5128      open(name);
5129      composePARTY_REFProperties(element);
5130      close();
5131    }
5132  }
5133
5134  protected void composePARTY_REFProperties(PARTY_REF element) throws IOException {
5135    composeOBJECT_REFProperties(element);
5136  }
5137
5138  protected void composePARTY_RELATED(String name, PARTY_RELATED element) throws IOException {
5139    if (element != null) {
5140      open(name);
5141      composePARTY_RELATEDProperties(element);
5142      close();
5143    }
5144  }
5145
5146  protected void composePARTY_RELATEDProperties(PARTY_RELATED element) throws IOException {
5147    composePARTY_IDENTIFIEDProperties(element);
5148      if (element.hasRelationship()) {
5149        composeDV_CODED_TEXT("relationship", element.getRelationship());
5150      }
5151  }
5152
5153  protected void composePARTY_RELATIONSHIP(String name, PARTY_RELATIONSHIP element) throws IOException {
5154    if (element != null) {
5155      open(name);
5156      composePARTY_RELATIONSHIPProperties(element);
5157      close();
5158    }
5159  }
5160
5161  protected void composePARTY_RELATIONSHIPProperties(PARTY_RELATIONSHIP element) throws IOException {
5162    composeLOCATABLEProperties(element);
5163      if (element.hasDetails()) {
5164        composeITEM_STRUCTURE("details", element.getDetails());
5165      }
5166      if (element.hasTarget()) {
5167        composePARTY_REF("target", element.getTarget());
5168      }
5169      if (element.hasTime_validity()) {
5170        composeDV_INTERVAL("time_validity", element.getTime_validity());
5171      }
5172      if (element.hasSource()) {
5173        composePARTY_REF("source", element.getSource());
5174      }
5175  }
5176
5177  protected void composePARTY_SELF(String name, PARTY_SELF element) throws IOException {
5178    if (element != null) {
5179      open(name);
5180      composePARTY_SELFProperties(element);
5181      close();
5182    }
5183  }
5184
5185  protected void composePARTY_SELFProperties(PARTY_SELF element) throws IOException {
5186    composePARTY_PROXYProperties(element);
5187  }
5188
5189  protected void composePERSON(String name, PERSON element) throws IOException {
5190    if (element != null) {
5191      open(name);
5192      composePERSONProperties(element);
5193      close();
5194    }
5195  }
5196
5197  protected void composePERSONProperties(PERSON element) throws IOException {
5198    composeACTORProperties(element);
5199  }
5200
5201  protected void composePOINT_EVENT(String name, POINT_EVENT element) throws IOException {
5202    if (element != null) {
5203      open(name);
5204      composePOINT_EVENTProperties(element);
5205      close();
5206    }
5207  }
5208
5209  protected void composePOINT_EVENTProperties(POINT_EVENT element) throws IOException {
5210    composeEVENTProperties(element);
5211  }
5212
5213  protected void composeREFERENCE_RANGE(String name, REFERENCE_RANGE element) throws IOException {
5214    if (element != null) {
5215      open(name);
5216      composeREFERENCE_RANGEProperties(element);
5217      close();
5218    }
5219  }
5220
5221  protected void composeREFERENCE_RANGEProperties(REFERENCE_RANGE element) throws IOException {
5222    composeBaseProperties(element);
5223      if (element.hasMeaning()) {
5224        composeDV_TEXT("meaning", element.getMeaning());
5225      }
5226      if (element.hasRange()) {
5227        composeDV_INTERVAL("range", element.getRange());
5228      }
5229  }
5230
5231  protected void composeRESOURCE_DESCRIPTION_ITEM(String name, RESOURCE_DESCRIPTION_ITEM element) throws IOException {
5232    if (element != null) {
5233      open(name);
5234      composeRESOURCE_DESCRIPTION_ITEMProperties(element);
5235      close();
5236    }
5237  }
5238
5239  protected void composeRESOURCE_DESCRIPTION_ITEMProperties(RESOURCE_DESCRIPTION_ITEM element) throws IOException {
5240    composeBaseProperties(element);
5241      if (element.hasLanguage()) {
5242        composeCODE_PHRASE("language", element.getLanguage());
5243      }
5244      if (element.hasPurposeElement()) {
5245        composeStringCore("purpose", element.getPurposeElement(), false);
5246        composeStringExtras("purpose", element.getPurposeElement(), false);
5247      }
5248      if (element.hasKeywords()) {
5249        if (anyHasValue(element.getKeywordsList())) {
5250          openArray("keywords");
5251          for (StringType e : element.getKeywordsList()) 
5252            composeStringCore(null, e, e != element.getKeywordsList().get(element.getKeywordsList().size()-1));
5253          closeArray();
5254        }
5255        if (anyHasExtras(element.getKeywordsList())) {
5256          openArray("_keywords");
5257          for (StringType e : element.getKeywordsList()) 
5258            composeStringExtras(null, e, true);
5259          closeArray();
5260        }
5261      };
5262      if (element.hasUseElement()) {
5263        composeStringCore("use", element.getUseElement(), false);
5264        composeStringExtras("use", element.getUseElement(), false);
5265      }
5266      if (element.hasMisuseElement()) {
5267        composeStringCore("misuse", element.getMisuseElement(), false);
5268        composeStringExtras("misuse", element.getMisuseElement(), false);
5269      }
5270      if (element.hasCopyrightElement()) {
5271        composeStringCore("copyright", element.getCopyrightElement(), false);
5272        composeStringExtras("copyright", element.getCopyrightElement(), false);
5273      }
5274      if (element.hasOriginal_resource_uri()) {
5275        if (anyHasValue(element.getOriginal_resource_uriList())) {
5276          openArray("original_resource_uri");
5277          for (StringType e : element.getOriginal_resource_uriList()) 
5278            composeStringCore(null, e, e != element.getOriginal_resource_uriList().get(element.getOriginal_resource_uriList().size()-1));
5279          closeArray();
5280        }
5281        if (anyHasExtras(element.getOriginal_resource_uriList())) {
5282          openArray("_original_resource_uri");
5283          for (StringType e : element.getOriginal_resource_uriList()) 
5284            composeStringExtras(null, e, true);
5285          closeArray();
5286        }
5287      };
5288      if (element.hasOther_details()) {
5289        if (anyHasValue(element.getOther_detailsList())) {
5290          openArray("other_details");
5291          for (StringType e : element.getOther_detailsList()) 
5292            composeStringCore(null, e, e != element.getOther_detailsList().get(element.getOther_detailsList().size()-1));
5293          closeArray();
5294        }
5295        if (anyHasExtras(element.getOther_detailsList())) {
5296          openArray("_other_details");
5297          for (StringType e : element.getOther_detailsList()) 
5298            composeStringExtras(null, e, true);
5299          closeArray();
5300        }
5301      };
5302  }
5303
5304  protected void composeRESOURCE_DESCRIPTION(String name, RESOURCE_DESCRIPTION element) throws IOException {
5305    if (element != null) {
5306      open(name);
5307      composeRESOURCE_DESCRIPTIONProperties(element);
5308      close();
5309    }
5310  }
5311
5312  protected void composeRESOURCE_DESCRIPTIONProperties(RESOURCE_DESCRIPTION element) throws IOException {
5313    composeBaseProperties(element);
5314      if (element.hasOriginal_author()) {
5315        if (anyHasValue(element.getOriginal_authorList())) {
5316          openArray("original_author");
5317          for (StringType e : element.getOriginal_authorList()) 
5318            composeStringCore(null, e, e != element.getOriginal_authorList().get(element.getOriginal_authorList().size()-1));
5319          closeArray();
5320        }
5321        if (anyHasExtras(element.getOriginal_authorList())) {
5322          openArray("_original_author");
5323          for (StringType e : element.getOriginal_authorList()) 
5324            composeStringExtras(null, e, true);
5325          closeArray();
5326        }
5327      };
5328      if (element.hasOther_contributors()) {
5329        if (anyHasValue(element.getOther_contributorsList())) {
5330          openArray("other_contributors");
5331          for (StringType e : element.getOther_contributorsList()) 
5332            composeStringCore(null, e, e != element.getOther_contributorsList().get(element.getOther_contributorsList().size()-1));
5333          closeArray();
5334        }
5335        if (anyHasExtras(element.getOther_contributorsList())) {
5336          openArray("_other_contributors");
5337          for (StringType e : element.getOther_contributorsList()) 
5338            composeStringExtras(null, e, true);
5339          closeArray();
5340        }
5341      };
5342      if (element.hasLifecycle_stateElement()) {
5343        composeStringCore("lifecycle_state", element.getLifecycle_stateElement(), false);
5344        composeStringExtras("lifecycle_state", element.getLifecycle_stateElement(), false);
5345      }
5346      if (element.hasResource_package_uriElement()) {
5347        composeStringCore("resource_package_uri", element.getResource_package_uriElement(), false);
5348        composeStringExtras("resource_package_uri", element.getResource_package_uriElement(), false);
5349      }
5350      if (element.hasOther_details()) {
5351        openArray("other_details");
5352        for (OBJECT_REF e : element.getOther_detailsList()) 
5353          composeOBJECT_REF(null, e);
5354        closeArray();
5355      };
5356      if (element.hasParent_resource()) {
5357        composeAUTHORED_RESOURCE("parent_resource", element.getParent_resource());
5358      }
5359      if (element.hasDetails()) {
5360        openArray("details");
5361        for (RESOURCE_DESCRIPTION_ITEM e : element.getDetailsList()) 
5362          composeRESOURCE_DESCRIPTION_ITEM(null, e);
5363        closeArray();
5364      };
5365  }
5366
5367  protected void composeREVISION_HISTORY_ITEM(String name, REVISION_HISTORY_ITEM element) throws IOException {
5368    if (element != null) {
5369      open(name);
5370      composeREVISION_HISTORY_ITEMProperties(element);
5371      close();
5372    }
5373  }
5374
5375  protected void composeREVISION_HISTORY_ITEMProperties(REVISION_HISTORY_ITEM element) throws IOException {
5376    composeBaseProperties(element);
5377      if (element.hasVersion_id()) {
5378        composeOBJECT_VERSION_ID("version_id", element.getVersion_id());
5379      }
5380      if (element.hasAudits()) {
5381        openArray("audits");
5382        for (AUDIT_DETAILS e : element.getAuditsList()) 
5383          composeAUDIT_DETAILS(null, e);
5384        closeArray();
5385      };
5386  }
5387
5388  protected void composeREVISION_HISTORY(String name, REVISION_HISTORY element) throws IOException {
5389    if (element != null) {
5390      open(name);
5391      composeREVISION_HISTORYProperties(element);
5392      close();
5393    }
5394  }
5395
5396  protected void composeREVISION_HISTORYProperties(REVISION_HISTORY element) throws IOException {
5397    composeBaseProperties(element);
5398      if (element.hasMost_recent_versionElement()) {
5399        composeStringCore("most_recent_version", element.getMost_recent_versionElement(), false);
5400        composeStringExtras("most_recent_version", element.getMost_recent_versionElement(), false);
5401      }
5402      if (element.hasMost_recent_version_time_committedElement()) {
5403        composeStringCore("most_recent_version_time_committed", element.getMost_recent_version_time_committedElement(), false);
5404        composeStringExtras("most_recent_version_time_committed", element.getMost_recent_version_time_committedElement(), false);
5405      }
5406  }
5407
5408  protected void composeROLE(String name, ROLE element) throws IOException {
5409    if (element != null) {
5410      open(name);
5411      composeROLEProperties(element);
5412      close();
5413    }
5414  }
5415
5416  protected void composeROLEProperties(ROLE element) throws IOException {
5417    composePARTYProperties(element);
5418      if (element.hasTime_validity()) {
5419        composeDV_INTERVAL("time_validity", element.getTime_validity());
5420      }
5421      if (element.hasPerformer()) {
5422        composePARTY_REF("performer", element.getPerformer());
5423      }
5424      if (element.hasCapabilities()) {
5425        openArray("capabilities");
5426        for (CAPABILITY e : element.getCapabilitiesList()) 
5427          composeCAPABILITY(null, e);
5428        closeArray();
5429      };
5430  }
5431
5432  protected void composeSECTION(String name, SECTION element) throws IOException {
5433    if (element != null) {
5434      open(name);
5435      composeSECTIONProperties(element);
5436      close();
5437    }
5438  }
5439
5440  protected void composeSECTIONProperties(SECTION element) throws IOException {
5441    composeCONTENT_ITEMProperties(element);
5442      if (element.hasItems()) {
5443        openArray("items");
5444        for (CONTENT_ITEM e : element.getItemsList()) 
5445          composeCONTENT_ITEM(null, e);
5446        closeArray();
5447      };
5448  }
5449
5450  protected void composeTEMPLATE_ID(String name, TEMPLATE_ID element) throws IOException {
5451    if (element != null) {
5452      open(name);
5453      composeTEMPLATE_IDProperties(element);
5454      close();
5455    }
5456  }
5457
5458  protected void composeTEMPLATE_IDProperties(TEMPLATE_ID element) throws IOException {
5459    composeOBJECT_IDProperties(element);
5460  }
5461
5462  protected void composeTERM_MAPPING(String name, TERM_MAPPING element) throws IOException {
5463    if (element != null) {
5464      open(name);
5465      composeTERM_MAPPINGProperties(element);
5466      close();
5467    }
5468  }
5469
5470  protected void composeTERM_MAPPINGProperties(TERM_MAPPING element) throws IOException {
5471    composeBaseProperties(element);
5472      if (element.hasMatchElement()) {
5473        composeStringCore("match", element.getMatchElement(), false);
5474        composeStringExtras("match", element.getMatchElement(), false);
5475      }
5476      if (element.hasPurpose()) {
5477        composeDV_CODED_TEXT("purpose", element.getPurpose());
5478      }
5479      if (element.hasTarget()) {
5480        composeCODE_PHRASE("target", element.getTarget());
5481      }
5482  }
5483
5484  protected void composeTERMINOLOGY_ID(String name, TERMINOLOGY_ID element) throws IOException {
5485    if (element != null) {
5486      open(name);
5487      composeTERMINOLOGY_IDProperties(element);
5488      close();
5489    }
5490  }
5491
5492  protected void composeTERMINOLOGY_IDProperties(TERMINOLOGY_ID element) throws IOException {
5493    composeOBJECT_IDProperties(element);
5494  }
5495
5496  protected void composeTRANSLATION_DETAILS(String name, TRANSLATION_DETAILS element) throws IOException {
5497    if (element != null) {
5498      open(name);
5499      composeTRANSLATION_DETAILSProperties(element);
5500      close();
5501    }
5502  }
5503
5504  protected void composeTRANSLATION_DETAILSProperties(TRANSLATION_DETAILS element) throws IOException {
5505    composeBaseProperties(element);
5506      if (element.hasLanguage()) {
5507        composeCODE_PHRASE("language", element.getLanguage());
5508      }
5509      if (element.hasAuthor()) {
5510        if (anyHasValue(element.getAuthorList())) {
5511          openArray("author");
5512          for (StringType e : element.getAuthorList()) 
5513            composeStringCore(null, e, e != element.getAuthorList().get(element.getAuthorList().size()-1));
5514          closeArray();
5515        }
5516        if (anyHasExtras(element.getAuthorList())) {
5517          openArray("_author");
5518          for (StringType e : element.getAuthorList()) 
5519            composeStringExtras(null, e, true);
5520          closeArray();
5521        }
5522      };
5523      if (element.hasAccreditationElement()) {
5524        composeStringCore("accreditation", element.getAccreditationElement(), false);
5525        composeStringExtras("accreditation", element.getAccreditationElement(), false);
5526      }
5527      if (element.hasOther_details()) {
5528        if (anyHasValue(element.getOther_detailsList())) {
5529          openArray("other_details");
5530          for (StringType e : element.getOther_detailsList()) 
5531            composeStringCore(null, e, e != element.getOther_detailsList().get(element.getOther_detailsList().size()-1));
5532          closeArray();
5533        }
5534        if (anyHasExtras(element.getOther_detailsList())) {
5535          openArray("_other_details");
5536          for (StringType e : element.getOther_detailsList()) 
5537            composeStringExtras(null, e, true);
5538          closeArray();
5539        }
5540      };
5541  }
5542
5543  protected void composeTranslatedString(String name, TranslatedString element) throws IOException {
5544    if (element != null) {
5545      open(name);
5546      composeTranslatedStringProperties(element);
5547      close();
5548    }
5549  }
5550
5551  protected void composeTranslatedStringProperties(TranslatedString element) throws IOException {
5552    composeBaseProperties(element);
5553      if (element.hasLanguageElement()) {
5554        composeCodeCore("language", element.getLanguageElement(), false);
5555        composeCodeExtras("language", element.getLanguageElement(), false);
5556      }
5557      if (element.hasValueElement()) {
5558        composeStringCore("value", element.getValueElement(), false);
5559        composeStringExtras("value", element.getValueElement(), false);
5560      }
5561  }
5562
5563  protected void composeUUID(String name, UUID element) throws IOException {
5564    if (element != null) {
5565      open(name);
5566      composeUUIDProperties(element);
5567      close();
5568    }
5569  }
5570
5571  protected void composeUUIDProperties(UUID element) throws IOException {
5572    composeUIDProperties(element);
5573  }
5574
5575  protected void composeVERSION_TREE_ID(String name, VERSION_TREE_ID element) throws IOException {
5576    if (element != null) {
5577      open(name);
5578      composeVERSION_TREE_IDProperties(element);
5579      close();
5580    }
5581  }
5582
5583  protected void composeVERSION_TREE_IDProperties(VERSION_TREE_ID element) throws IOException {
5584    composeBaseProperties(element);
5585      if (element.hasValueElement()) {
5586        composeStringCore("value", element.getValueElement(), false);
5587        composeStringExtras("value", element.getValueElement(), false);
5588      }
5589  }
5590
5591  protected void composeVERSIONED_COMPOSITION(String name, VERSIONED_COMPOSITION element) throws IOException {
5592    if (element != null) {
5593      open(name);
5594      composeVERSIONED_COMPOSITIONProperties(element);
5595      close();
5596    }
5597  }
5598
5599  protected void composeVERSIONED_COMPOSITIONProperties(VERSIONED_COMPOSITION element) throws IOException {
5600    composeVERSIONED_OBJECTProperties(element);
5601  }
5602
5603  protected void composeVERSIONED_EHR_ACCESS(String name, VERSIONED_EHR_ACCESS element) throws IOException {
5604    if (element != null) {
5605      open(name);
5606      composeVERSIONED_EHR_ACCESSProperties(element);
5607      close();
5608    }
5609  }
5610
5611  protected void composeVERSIONED_EHR_ACCESSProperties(VERSIONED_EHR_ACCESS element) throws IOException {
5612    composeVERSIONED_OBJECTProperties(element);
5613  }
5614
5615  protected void composeVERSIONED_EHR_STATUS(String name, VERSIONED_EHR_STATUS element) throws IOException {
5616    if (element != null) {
5617      open(name);
5618      composeVERSIONED_EHR_STATUSProperties(element);
5619      close();
5620    }
5621  }
5622
5623  protected void composeVERSIONED_EHR_STATUSProperties(VERSIONED_EHR_STATUS element) throws IOException {
5624    composeVERSIONED_OBJECTProperties(element);
5625  }
5626
5627  protected void composeVERSIONED_FOLDER(String name, VERSIONED_FOLDER element) throws IOException {
5628    if (element != null) {
5629      open(name);
5630      composeVERSIONED_FOLDERProperties(element);
5631      close();
5632    }
5633  }
5634
5635  protected void composeVERSIONED_FOLDERProperties(VERSIONED_FOLDER element) throws IOException {
5636    composeVERSIONED_OBJECTProperties(element);
5637  }
5638
5639  protected void composeVERSIONED_OBJECT(String name, VERSIONED_OBJECT element) throws IOException {
5640    if (element != null) {
5641      open(name);
5642      composeVERSIONED_OBJECTProperties(element);
5643      close();
5644    }
5645  }
5646
5647  protected void composeVERSIONED_OBJECTProperties(VERSIONED_OBJECT element) throws IOException {
5648    composeBaseProperties(element);
5649      if (element.hasUid()) {
5650        composeHIER_OBJECT_ID("uid", element.getUid());
5651      }
5652      if (element.hasOwner_id()) {
5653        composeOBJECT_REF("owner_id", element.getOwner_id());
5654      }
5655      if (element.hasTime_created()) {
5656        composeDV_DATE_TIME("time_created", element.getTime_created());
5657      }
5658  }
5659
5660  protected void composeVERSIONED_PARTY(String name, VERSIONED_PARTY element) throws IOException {
5661    if (element != null) {
5662      open(name);
5663      composeVERSIONED_PARTYProperties(element);
5664      close();
5665    }
5666  }
5667
5668  protected void composeVERSIONED_PARTYProperties(VERSIONED_PARTY element) throws IOException {
5669    composeVERSIONED_OBJECTProperties(element);
5670  }
5671
5672  protected void composeWebTemplate(String name, WebTemplate element) throws IOException {
5673    if (element != null) {
5674      open(name);
5675      composeWebTemplateProperties(element);
5676      close();
5677    }
5678  }
5679
5680  protected void composeWebTemplateProperties(WebTemplate element) throws IOException {
5681    composeBaseProperties(element);
5682      if (element.hasTemplateIdElement()) {
5683        composeStringCore("templateId", element.getTemplateIdElement(), false);
5684        composeStringExtras("templateId", element.getTemplateIdElement(), false);
5685      }
5686      if (element.hasVersionElement()) {
5687        composeStringCore("version", element.getVersionElement(), false);
5688        composeStringExtras("version", element.getVersionElement(), false);
5689      }
5690      if (element.hasSemverElement()) {
5691        composeStringCore("semver", element.getSemverElement(), false);
5692        composeStringExtras("semver", element.getSemverElement(), false);
5693      }
5694      if (element.hasDefaultLanguageElement()) {
5695        composeStringCore("defaultLanguage", element.getDefaultLanguageElement(), false);
5696        composeStringExtras("defaultLanguage", element.getDefaultLanguageElement(), false);
5697      }
5698      if (element.hasLanguages()) {
5699        if (anyHasValue(element.getLanguagesList())) {
5700          openArray("languages");
5701          for (StringType e : element.getLanguagesList()) 
5702            composeStringCore(null, e, e != element.getLanguagesList().get(element.getLanguagesList().size()-1));
5703          closeArray();
5704        }
5705        if (anyHasExtras(element.getLanguagesList())) {
5706          openArray("_languages");
5707          for (StringType e : element.getLanguagesList()) 
5708            composeStringExtras(null, e, true);
5709          closeArray();
5710        }
5711      };
5712      if (element.hasTree()) {
5713        composeWebTemplateItem("tree", element.getTree());
5714      }
5715  }
5716
5717  protected void composeWebTemplateInput(String name, WebTemplateInput element) throws IOException {
5718    if (element != null) {
5719      open(name);
5720      composeWebTemplateInputProperties(element);
5721      close();
5722    }
5723  }
5724
5725  protected void composeWebTemplateInputProperties(WebTemplateInput element) throws IOException {
5726    composeBaseProperties(element);
5727      if (element.hasSuffixElement()) {
5728        composeStringCore("suffix", element.getSuffixElement(), false);
5729        composeStringExtras("suffix", element.getSuffixElement(), false);
5730      }
5731      if (element.hasTypeElement()) {
5732        composeCodeCore("type", element.getTypeElement(), false);
5733        composeCodeExtras("type", element.getTypeElement(), false);
5734      }
5735      if (element.hasDefaultValue()) {
5736        composeNativePrimitive("defaultValue", element.getDefaultValue());
5737      }
5738      if (element.hasTerminologyElement()) {
5739        composeCodeCore("terminology", element.getTerminologyElement(), false);
5740        composeCodeExtras("terminology", element.getTerminologyElement(), false);
5741      }
5742      if (element.hasValidation()) {
5743        composeWebTemplateInputValidation("validation", element.getValidation());
5744      }
5745      if (element.hasList()) {
5746        openArray("list");
5747        for (WebTemplateInputListItem e : element.getListList()) 
5748          composeWebTemplateInputListItem(null, e);
5749        closeArray();
5750      };
5751      if (element.hasListOpenElement()) {
5752        composeBooleanCore("listOpen", element.getListOpenElement(), false);
5753        composeBooleanExtras("listOpen", element.getListOpenElement(), false);
5754      }
5755  }
5756
5757  protected void composeWebTemplateInputListItem(String name, WebTemplateInputListItem element) throws IOException {
5758    if (element != null) {
5759      open(name);
5760      composeWebTemplateInputListItemProperties(element);
5761      close();
5762    }
5763  }
5764
5765  protected void composeWebTemplateInputListItemProperties(WebTemplateInputListItem element) throws IOException {
5766    composeBaseProperties(element);
5767      if (element.hasValueElement()) {
5768        composeCodeCore("value", element.getValueElement(), false);
5769        composeCodeExtras("value", element.getValueElement(), false);
5770      }
5771      if (element.hasLabelElement()) {
5772        composeStringCore("label", element.getLabelElement(), false);
5773        composeStringExtras("label", element.getLabelElement(), false);
5774      }
5775      if (element.hasOrdinalElement()) {
5776        composeStringCore("ordinal", element.getOrdinalElement(), false);
5777        composeStringExtras("ordinal", element.getOrdinalElement(), false);
5778      }
5779      if (element.hasLocalizedLabels()) {
5780        openArray("localizedLabels");
5781        for (TranslatedString e : element.getLocalizedLabelsList()) 
5782          composeTranslatedString(null, e);
5783        closeArray();
5784      };
5785      if (element.hasLocalizedDescriptions()) {
5786        openArray("localizedDescriptions");
5787        for (TranslatedString e : element.getLocalizedDescriptionsList()) 
5788          composeTranslatedString(null, e);
5789        closeArray();
5790      };
5791      if (element.hasCurrentStatesElement()) {
5792        composeStringCore("currentStates", element.getCurrentStatesElement(), false);
5793        composeStringExtras("currentStates", element.getCurrentStatesElement(), false);
5794      }
5795      if (element.hasRangeElement()) {
5796        composeStringCore("range", element.getRangeElement(), false);
5797        composeStringExtras("range", element.getRangeElement(), false);
5798      }
5799      if (element.hasPrecisionElement()) {
5800        composeStringCore("precision", element.getPrecisionElement(), false);
5801        composeStringExtras("precision", element.getPrecisionElement(), false);
5802      }
5803      if (element.hasTermBindings()) {
5804        openArray("termBindings");
5805        for (WebTemplateTermBinding e : element.getTermBindingsList()) 
5806          composeWebTemplateTermBinding(null, e);
5807        closeArray();
5808      };
5809  }
5810
5811  protected void composeWebTemplateInputValidation(String name, WebTemplateInputValidation element) throws IOException {
5812    if (element != null) {
5813      open(name);
5814      composeWebTemplateInputValidationProperties(element);
5815      close();
5816    }
5817  }
5818
5819  protected void composeWebTemplateInputValidationProperties(WebTemplateInputValidation element) throws IOException {
5820    composeBaseProperties(element);
5821      if (element.hasRange()) {
5822        composeWebTemplateInputValidationRange("range", element.getRange());
5823      }
5824      if (element.hasPrecision()) {
5825        composeWebTemplateInputValidationRange("precision", element.getPrecision());
5826      }
5827  }
5828
5829  protected void composeWebTemplateInputValidationRange(String name, WebTemplateInputValidationRange element) throws IOException {
5830    if (element != null) {
5831      open(name);
5832      composeWebTemplateInputValidationRangeProperties(element);
5833      close();
5834    }
5835  }
5836
5837  protected void composeWebTemplateInputValidationRangeProperties(WebTemplateInputValidationRange element) throws IOException {
5838    composeBaseProperties(element);
5839      if (element.hasMinOpElement()) {
5840        composeCodeCore("minOp", element.getMinOpElement(), false);
5841        composeCodeExtras("minOp", element.getMinOpElement(), false);
5842      }
5843      if (element.hasMinElement()) {
5844        composeDecimalCore("min", element.getMinElement(), false);
5845        composeDecimalExtras("min", element.getMinElement(), false);
5846      }
5847      if (element.hasMaxOpElement()) {
5848        composeCodeCore("maxOp", element.getMaxOpElement(), false);
5849        composeCodeExtras("maxOp", element.getMaxOpElement(), false);
5850      }
5851      if (element.hasMaxElement()) {
5852        composeDecimalCore("max", element.getMaxElement(), false);
5853        composeDecimalExtras("max", element.getMaxElement(), false);
5854      }
5855  }
5856
5857  protected void composeWebTemplateItem(String name, WebTemplateItem element) throws IOException {
5858    if (element != null) {
5859      open(name);
5860      composeWebTemplateItemProperties(element);
5861      close();
5862    }
5863  }
5864
5865  protected void composeWebTemplateItemProperties(WebTemplateItem element) throws IOException {
5866    composeBaseProperties(element);
5867      if (element.hasIdElement()) {
5868        composeStringCore("id", element.getIdElement(), false);
5869        composeStringExtras("id", element.getIdElement(), false);
5870      }
5871      if (element.hasDepthElement()) {
5872        composeIntegerCore("depth", element.getDepthElement(), false);
5873        composeIntegerExtras("depth", element.getDepthElement(), false);
5874      }
5875      if (element.hasNameElement()) {
5876        composeStringCore("name", element.getNameElement(), false);
5877        composeStringExtras("name", element.getNameElement(), false);
5878      }
5879      if (element.hasLocalizedNameElement()) {
5880        composeStringCore("localizedName", element.getLocalizedNameElement(), false);
5881        composeStringExtras("localizedName", element.getLocalizedNameElement(), false);
5882      }
5883      if (element.hasRmTypeElement()) {
5884        composeCodeCore("rmType", element.getRmTypeElement(), false);
5885        composeCodeExtras("rmType", element.getRmTypeElement(), false);
5886      }
5887      if (element.hasNodeIdElement()) {
5888        composeStringCore("nodeId", element.getNodeIdElement(), false);
5889        composeStringExtras("nodeId", element.getNodeIdElement(), false);
5890      }
5891      if (element.hasMinElement()) {
5892        composeStringCore("min", element.getMinElement(), false);
5893        composeStringExtras("min", element.getMinElement(), false);
5894      }
5895      if (element.hasMaxElement()) {
5896        composeStringCore("max", element.getMaxElement(), false);
5897        composeStringExtras("max", element.getMaxElement(), false);
5898      }
5899      if (element.hasDependsOnElement()) {
5900        composeStringCore("dependsOn", element.getDependsOnElement(), false);
5901        composeStringExtras("dependsOn", element.getDependsOnElement(), false);
5902      }
5903      if (element.hasLocalizedNames()) {
5904        openArray("localizedNames");
5905        for (TranslatedString e : element.getLocalizedNamesList()) 
5906          composeTranslatedString(null, e);
5907        closeArray();
5908      };
5909      if (element.hasLocalizedDescriptions()) {
5910        openArray("localizedDescriptions");
5911        for (TranslatedString e : element.getLocalizedDescriptionsList()) 
5912          composeTranslatedString(null, e);
5913        closeArray();
5914      };
5915      if (element.hasAnnotations()) {
5916        composeAnnotations("annotations", element.getAnnotations());
5917      }
5918      if (element.hasArchetype_idElement()) {
5919        composeStringCore("archetype_id", element.getArchetype_idElement(), false);
5920        composeStringExtras("archetype_id", element.getArchetype_idElement(), false);
5921      }
5922      if (element.hasAqlPathElement()) {
5923        composeStringCore("aqlPath", element.getAqlPathElement(), false);
5924        composeStringExtras("aqlPath", element.getAqlPathElement(), false);
5925      }
5926      if (element.hasCustodian_namespaceElement()) {
5927        composeStringCore("custodian_namespace", element.getCustodian_namespaceElement(), false);
5928        composeStringExtras("custodian_namespace", element.getCustodian_namespaceElement(), false);
5929      }
5930      if (element.hasCustodian_organisationElement()) {
5931        composeStringCore("custodian_organisation", element.getCustodian_organisationElement(), false);
5932        composeStringExtras("custodian_organisation", element.getCustodian_organisationElement(), false);
5933      }
5934      if (element.hasLifecycleStateElement()) {
5935        composeCodeCore("lifecycleState", element.getLifecycleStateElement(), false);
5936        composeCodeExtras("lifecycleState", element.getLifecycleStateElement(), false);
5937      }
5938      if (element.hasOriginal_namespaceElement()) {
5939        composeStringCore("original_namespace", element.getOriginal_namespaceElement(), false);
5940        composeStringExtras("original_namespace", element.getOriginal_namespaceElement(), false);
5941      }
5942      if (element.hasOriginal_publisherElement()) {
5943        composeStringCore("original_publisher", element.getOriginal_publisherElement(), false);
5944        composeStringExtras("original_publisher", element.getOriginal_publisherElement(), false);
5945      }
5946      if (element.hasProportionTypesElement()) {
5947        composeCodeCore("proportionTypes", element.getProportionTypesElement(), false);
5948        composeCodeExtras("proportionTypes", element.getProportionTypesElement(), false);
5949      }
5950      if (element.hasRevisionElement()) {
5951        composeStringCore("revision", element.getRevisionElement(), false);
5952        composeStringExtras("revision", element.getRevisionElement(), false);
5953      }
5954      if (element.hasInContextElement()) {
5955        composeBooleanCore("inContext", element.getInContextElement(), false);
5956        composeBooleanExtras("inContext", element.getInContextElement(), false);
5957      }
5958      if (element.hasInputs()) {
5959        openArray("inputs");
5960        for (WebTemplateInput e : element.getInputsList()) 
5961          composeWebTemplateInput(null, e);
5962        closeArray();
5963      };
5964      if (element.hasTermBindings()) {
5965        openArray("termBindings");
5966        for (WebTemplateTermBinding e : element.getTermBindingsList()) 
5967          composeWebTemplateTermBinding(null, e);
5968        closeArray();
5969      };
5970      if (element.hasChildren()) {
5971        openArray("children");
5972        for (WebTemplateItem e : element.getChildrenList()) 
5973          composeWebTemplateItem(null, e);
5974        closeArray();
5975      };
5976  }
5977
5978  protected void composeWebTemplateTermBinding(String name, WebTemplateTermBinding element) throws IOException {
5979    if (element != null) {
5980      open(name);
5981      composeWebTemplateTermBindingProperties(element);
5982      close();
5983    }
5984  }
5985
5986  protected void composeWebTemplateTermBindingProperties(WebTemplateTermBinding element) throws IOException {
5987    composeBaseProperties(element);
5988      if (element.hasCodeElement()) {
5989        composeCodeCore("code", element.getCodeElement(), false);
5990        composeCodeExtras("code", element.getCodeElement(), false);
5991      }
5992      if (element.hasValue()) {
5993        composeWebTemplateTermBindingValue("value", element.getValue());
5994      }
5995  }
5996
5997  protected void composeWebTemplateTermBindingValue(String name, WebTemplateTermBindingValue element) throws IOException {
5998    if (element != null) {
5999      open(name);
6000      composeWebTemplateTermBindingValueProperties(element);
6001      close();
6002    }
6003  }
6004
6005  protected void composeWebTemplateTermBindingValueProperties(WebTemplateTermBindingValue element) throws IOException {
6006    composeBaseProperties(element);
6007      if (element.hasValueElement()) {
6008        composeStringCore("value", element.getValueElement(), false);
6009        composeStringExtras("value", element.getValueElement(), false);
6010      }
6011      if (element.hasTerminologyIdElement()) {
6012        composeStringCore("terminologyId", element.getTerminologyIdElement(), false);
6013        composeStringExtras("terminologyId", element.getTerminologyIdElement(), false);
6014      }
6015  }
6016
6017
6018
6019  @Override
6020  protected void composeResource(Resource resource) throws IOException {
6021    if (resource == null) {
6022      throw new Error("Unhandled resource type "+resource.getClass().getName());
6023 
6024    } else
6025      throw new Error("Unhandled resource type "+resource.getClass().getName());
6026  }
6027
6028}