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