001package org.hl7.fhir.convertors.conv14_50.resources14_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext14_50;
004import org.hl7.fhir.convertors.conv14_50.datatypes14_50.complextypes14_50.CodeableConcept14_50;
005import org.hl7.fhir.convertors.conv14_50.datatypes14_50.complextypes14_50.ContactPoint14_50;
006import org.hl7.fhir.convertors.conv14_50.datatypes14_50.complextypes14_50.Identifier14_50;
007import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.*;
008import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
009import org.hl7.fhir.dstu2016may.model.StructureMap;
010import org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType;
011import org.hl7.fhir.exceptions.FHIRException;
012import org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent;
013
014import java.util.stream.Collectors;
015
016public class StructureMap14_50 {
017
018  public static org.hl7.fhir.r5.model.StructureMap convertStructureMap(org.hl7.fhir.dstu2016may.model.StructureMap src) throws FHIRException {
019    if (src == null || src.isEmpty())
020      return null;
021    org.hl7.fhir.r5.model.StructureMap tgt = new org.hl7.fhir.r5.model.StructureMap();
022    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt);
023    if (src.hasUrlElement())
024      tgt.setUrlElement(Uri14_50.convertUri(src.getUrlElement()));
025    if (src.hasVersion())
026      tgt.setVersionElement(String14_50.convertString(src.getVersionElement()));
027    if (src.hasNameElement())
028      tgt.setNameElement(String14_50.convertString(src.getNameElement()));
029    if (src.hasStatus())
030      tgt.setStatusElement(Enumerations14_50.convertConformanceResourceStatus(src.getStatusElement()));
031    for (org.hl7.fhir.dstu2016may.model.Identifier t : src.getIdentifier())
032      tgt.addIdentifier(Identifier14_50.convertIdentifier(t));
033    if (src.hasExperimental())
034      tgt.setExperimentalElement(Boolean14_50.convertBoolean(src.getExperimentalElement()));
035    if (src.hasPublisher())
036      tgt.setPublisherElement(String14_50.convertString(src.getPublisherElement()));
037    for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent t : src.getContact())
038      tgt.addContact(convertStructureMapContactComponent(t));
039    if (src.hasDate())
040      tgt.setDateElement(DateTime14_50.convertDateTime(src.getDateElement()));
041    if (src.hasDescription())
042      tgt.setDescription(src.getDescription());
043    for (org.hl7.fhir.dstu2016may.model.CodeableConcept t : src.getUseContext())
044      if (CodeableConcept14_50.isJurisdiction(t))
045        tgt.addJurisdiction(CodeableConcept14_50.convertCodeableConcept(t));
046      else
047        tgt.addUseContext(CodeableConcept14_50.convertCodeableConceptToUsageContext(t));
048    if (src.hasRequirements())
049      tgt.setPurpose(src.getRequirements());
050    if (src.hasCopyright())
051      tgt.setCopyright(src.getCopyright());
052    for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent t : src.getStructure())
053      tgt.addStructure(convertStructureMapStructureComponent(t));
054    for (org.hl7.fhir.dstu2016may.model.UriType t : src.getImport()) tgt.addImport(t.getValue());
055    for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent t : src.getGroup())
056      tgt.addGroup(convertStructureMapGroupComponent(t));
057    return tgt;
058  }
059
060  public static org.hl7.fhir.dstu2016may.model.StructureMap convertStructureMap(org.hl7.fhir.r5.model.StructureMap src) throws FHIRException {
061    if (src == null || src.isEmpty())
062      return null;
063    org.hl7.fhir.dstu2016may.model.StructureMap tgt = new org.hl7.fhir.dstu2016may.model.StructureMap();
064    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyDomainResource(src, tgt);
065    if (src.hasUrlElement())
066      tgt.setUrlElement(Uri14_50.convertUri(src.getUrlElement()));
067    if (src.hasVersion())
068      tgt.setVersionElement(String14_50.convertString(src.getVersionElement()));
069    if (src.hasNameElement())
070      tgt.setNameElement(String14_50.convertString(src.getNameElement()));
071    if (src.hasStatus())
072      tgt.setStatusElement(Enumerations14_50.convertConformanceResourceStatus(src.getStatusElement()));
073    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
074      tgt.addIdentifier(Identifier14_50.convertIdentifier(t));
075    if (src.hasExperimental())
076      tgt.setExperimentalElement(Boolean14_50.convertBoolean(src.getExperimentalElement()));
077    if (src.hasPublisher())
078      tgt.setPublisherElement(String14_50.convertString(src.getPublisherElement()));
079    for (org.hl7.fhir.r5.model.ContactDetail t : src.getContact())
080      tgt.addContact(convertStructureMapContactComponent(t));
081    if (src.hasDate())
082      tgt.setDateElement(DateTime14_50.convertDateTime(src.getDateElement()));
083    if (src.hasDescription())
084      tgt.setDescription(src.getDescription());
085    for (org.hl7.fhir.r5.model.UsageContext t : src.getUseContext())
086      if (t.hasValueCodeableConcept())
087        tgt.addUseContext(CodeableConcept14_50.convertCodeableConcept(t.getValueCodeableConcept()));
088    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getJurisdiction())
089      tgt.addUseContext(CodeableConcept14_50.convertCodeableConcept(t));
090    if (src.hasPurpose())
091      tgt.setRequirements(src.getPurpose());
092    if (src.hasCopyright())
093      tgt.setCopyright(src.getCopyright());
094    for (org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent t : src.getStructure())
095      tgt.addStructure(convertStructureMapStructureComponent(t));
096    for (org.hl7.fhir.r5.model.UriType t : src.getImport()) tgt.addImport(t.getValue());
097    for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent t : src.getGroup())
098      tgt.addGroup(convertStructureMapGroupComponent(t));
099    return tgt;
100  }
101
102  public static org.hl7.fhir.r5.model.ContactDetail convertStructureMapContactComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent src) throws FHIRException {
103    if (src == null || src.isEmpty())
104      return null;
105    org.hl7.fhir.r5.model.ContactDetail tgt = new org.hl7.fhir.r5.model.ContactDetail();
106    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
107    if (src.hasName())
108      tgt.setNameElement(String14_50.convertString(src.getNameElement()));
109    for (org.hl7.fhir.dstu2016may.model.ContactPoint t : src.getTelecom())
110      tgt.addTelecom(ContactPoint14_50.convertContactPoint(t));
111    return tgt;
112  }
113
114  public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent convertStructureMapContactComponent(org.hl7.fhir.r5.model.ContactDetail src) throws FHIRException {
115    if (src == null || src.isEmpty())
116      return null;
117    org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContactComponent();
118    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
119    if (src.hasName())
120      tgt.setNameElement(String14_50.convertString(src.getNameElement()));
121    for (org.hl7.fhir.r5.model.ContactPoint t : src.getTelecom())
122      tgt.addTelecom(ContactPoint14_50.convertContactPoint(t));
123    return tgt;
124  }
125
126  public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent src) throws FHIRException {
127    if (src == null || src.isEmpty())
128      return null;
129    org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent();
130    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
131    if (src.hasNameElement())
132      tgt.setNameElement(Id14_50.convertId(src.getNameElement()));
133    if (src.hasExtends())
134      tgt.setExtendsElement(Id14_50.convertId(src.getExtendsElement()));
135    if (src.hasDocumentation())
136      tgt.setDocumentationElement(String14_50.convertString(src.getDocumentationElement()));
137    for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent t : src.getInput())
138      tgt.addInput(convertStructureMapGroupInputComponent(t));
139    for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule())
140      tgt.addRule(convertStructureMapGroupRuleComponent(t));
141    return tgt;
142  }
143
144  public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent convertStructureMapGroupComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupComponent src) throws FHIRException {
145    if (src == null || src.isEmpty())
146      return null;
147    org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupComponent();
148    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
149    if (src.hasNameElement())
150      tgt.setNameElement(Id14_50.convertId(src.getNameElement()));
151    if (src.hasExtends())
152      tgt.setExtendsElement(Id14_50.convertId(src.getExtendsElement()));
153    if (src.hasTypeMode())
154      throw new FHIRException("Unable to downgrade structure map with group.typeMode other than 'None': " + src.getTypeMode().getDisplay());
155    if (src.hasDocumentation())
156      tgt.setDocumentationElement(String14_50.convertString(src.getDocumentationElement()));
157    for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent t : src.getInput())
158      tgt.addInput(convertStructureMapGroupInputComponent(t));
159    for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule())
160      tgt.addRule(convertStructureMapGroupRuleComponent(t));
161    return tgt;
162  }
163
164  public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException {
165    if (src == null || src.isEmpty())
166      return null;
167    org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent();
168    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
169    if (src.hasNameElement())
170      tgt.setNameElement(Id14_50.convertId(src.getNameElement()));
171    if (src.hasType())
172      tgt.setTypeElement(String14_50.convertString(src.getTypeElement()));
173    if (src.hasMode())
174      tgt.setModeElement(convertStructureMapInputMode(src.getModeElement()));
175    if (src.hasDocumentation())
176      tgt.setDocumentationElement(String14_50.convertString(src.getDocumentationElement()));
177    return tgt;
178  }
179
180  public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent convertStructureMapGroupInputComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupInputComponent src) throws FHIRException {
181    if (src == null || src.isEmpty())
182      return null;
183    org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupInputComponent();
184    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
185    if (src.hasNameElement())
186      tgt.setNameElement(Id14_50.convertId(src.getNameElement()));
187    if (src.hasType())
188      tgt.setTypeElement(String14_50.convertString(src.getTypeElement()));
189    if (src.hasMode())
190      tgt.setModeElement(convertStructureMapInputMode(src.getModeElement()));
191    if (src.hasDocumentation())
192      tgt.setDocumentationElement(String14_50.convertString(src.getDocumentationElement()));
193    return tgt;
194  }
195
196  public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException {
197    if (src == null || src.isEmpty())
198      return null;
199    org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent();
200    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
201    if (src.hasNameElement())
202      tgt.setNameElement(Id14_50.convertId(src.getNameElement()));
203    for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource())
204      tgt.addSource(convertStructureMapGroupRuleSourceComponent(t));
205    for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget())
206      tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t));
207    for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule())
208      tgt.addRule(convertStructureMapGroupRuleComponent(t));
209    for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent())
210      tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t));
211    if (src.hasDocumentation())
212      tgt.setDocumentationElement(String14_50.convertString(src.getDocumentationElement()));
213    return tgt;
214  }
215
216  public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent convertStructureMapGroupRuleComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent src) throws FHIRException {
217    if (src == null || src.isEmpty())
218      return null;
219    org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleComponent();
220    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
221    if (src.hasNameElement())
222      tgt.setNameElement(Id14_50.convertId(src.getNameElement()));
223    for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent t : src.getSource())
224      tgt.addSource(convertStructureMapGroupRuleSourceComponent(t));
225    for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent t : src.getTarget())
226      tgt.addTarget(convertStructureMapGroupRuleTargetComponent(t));
227    for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleComponent t : src.getRule())
228      tgt.addRule(convertStructureMapGroupRuleComponent(t));
229    for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent t : src.getDependent())
230      tgt.addDependent(convertStructureMapGroupRuleDependentComponent(t));
231    if (src.hasDocumentation())
232      tgt.setDocumentationElement(String14_50.convertString(src.getDocumentationElement()));
233    return tgt;
234  }
235
236  public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException {
237    if (src == null || src.isEmpty())
238      return null;
239    org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent();
240    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
241    if (src.hasNameElement())
242      tgt.setNameElement(Id14_50.convertId(src.getNameElement()));
243    for (StructureMapGroupRuleTargetParameterComponent t : src.getParameter()) tgt.addVariable(t.getValue().primitiveValue());
244    return tgt;
245  }
246
247  public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent convertStructureMapGroupRuleDependentComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleDependentComponent src) throws FHIRException {
248    if (src == null || src.isEmpty())
249      return null;
250    org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleDependentComponent();
251    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
252    if (src.hasNameElement())
253      tgt.setNameElement(Id14_50.convertId(src.getNameElement()));
254    for (org.hl7.fhir.dstu2016may.model.StringType t : src.getVariable()) tgt.addParameter().setValue(String14_50.convertString(t));
255    return tgt;
256  }
257
258  public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException {
259    if (src == null || src.isEmpty())
260      return null;
261    org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent();
262    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
263    tgt.setContextType(StructureMapContextType.TYPE);
264    if (src.hasContextElement())
265      tgt.setContextElement(Id14_50.convertId(src.getContextElement()));
266    if (src.hasElement())
267      tgt.setElementElement(String14_50.convertString(src.getElementElement()));
268    if (src.hasListMode())
269      tgt.setListModeElement(convertStructureMapSourceListMode(src.getListModeElement()));
270    if (src.hasVariable())
271      tgt.setVariableElement(Id14_50.convertId(src.getVariableElement()));
272    if (src.hasCondition())
273      tgt.setConditionElement(String14_50.convertString(src.getConditionElement()));
274    if (src.hasCheck())
275      tgt.setCheckElement(String14_50.convertString(src.getCheckElement()));
276    return tgt;
277  }
278
279  public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent convertStructureMapGroupRuleSourceComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleSourceComponent src) throws FHIRException {
280    if (src == null || src.isEmpty())
281      return null;
282    org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleSourceComponent();
283    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
284    tgt.setMin(src.getRequired() ? 1 : 0);
285    if (src.getContextType().equals(StructureMap.StructureMapContextType.TYPE))
286      tgt.setType(src.getContext());
287    if (src.hasElement())
288      tgt.setElementElement(String14_50.convertString(src.getElementElement()));
289    if (src.hasListMode())
290      tgt.setListModeElement(convertStructureMapSourceListMode(src.getListModeElement()));
291    if (src.hasVariable())
292      tgt.setVariableElement(Id14_50.convertId(src.getVariableElement()));
293    if (src.hasCondition())
294      tgt.setConditionElement(String14_50.convertString(src.getConditionElement()));
295    if (src.hasCheck())
296      tgt.setCheckElement(String14_50.convertString(src.getCheckElement()));
297    return tgt;
298  }
299
300  public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException {
301    if (src == null || src.isEmpty())
302      return null;
303    org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent();
304    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
305    if (src.hasContext())
306      tgt.setContextElement(Id14_50.convertId(src.getContextElement()));
307    tgt.setContextType(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.VARIABLE);
308    if (src.hasElement())
309      tgt.setElementElement(String14_50.convertString(src.getElementElement()));
310    if (src.hasVariable())
311      tgt.setVariableElement(Id14_50.convertId(src.getVariableElement()));
312    tgt.setListMode(src.getListMode().stream()
313      .map(StructureMap14_50::convertStructureMapTargetListMode)
314      .collect(Collectors.toList()));
315    if (src.hasListRuleId())
316      tgt.setListRuleIdElement(Id14_50.convertId(src.getListRuleIdElement()));
317    if (src.hasTransform())
318      tgt.setTransformElement(convertStructureMapTransform(src.getTransformElement()));
319    for (org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter())
320      tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t));
321    return tgt;
322  }
323
324  public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent convertStructureMapGroupRuleTargetComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetComponent src) throws FHIRException {
325    if (src == null || src.isEmpty())
326      return null;
327    org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetComponent();
328    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
329    if (src.hasContext())
330      tgt.setContextElement(Id14_50.convertId(src.getContextElement()));
331    if (src.hasContextType() && src.getContextType() == org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapContextType.VARIABLE)
332      throw new Error("This conversion is not supported. Consult code maintainers"); // this should never happens - no one knows what the intent was here.
333    if (src.hasElement())
334      tgt.setElementElement(String14_50.convertString(src.getElementElement()));
335    if (src.hasVariable())
336      tgt.setVariableElement(Id14_50.convertId(src.getVariableElement()));
337    tgt.setListMode(src.getListMode().stream()
338      .map(StructureMap14_50::convertStructureMapTargetListMode)
339      .collect(Collectors.toList()));
340    if (src.hasListRuleId())
341      tgt.setListRuleIdElement(Id14_50.convertId(src.getListRuleIdElement()));
342    if (src.hasTransform())
343      tgt.setTransformElement(convertStructureMapTransform(src.getTransformElement()));
344    for (org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent t : src.getParameter())
345      tgt.addParameter(convertStructureMapGroupRuleTargetParameterComponent(t));
346    return tgt;
347  }
348
349  public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException {
350    if (src == null || src.isEmpty())
351      return null;
352    org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent();
353    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
354    if (src.hasValue())
355      tgt.setValue(ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().convertType(src.getValue()));
356    return tgt;
357  }
358
359  public static org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent convertStructureMapGroupRuleTargetParameterComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapGroupRuleTargetParameterComponent src) throws FHIRException {
360    if (src == null || src.isEmpty())
361      return null;
362    org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapGroupRuleTargetParameterComponent();
363    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
364    if (src.hasValue())
365      tgt.setValue(ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().convertType(src.getValue()));
366    return tgt;
367  }
368
369  static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode> convertStructureMapInputMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode> src) throws FHIRException {
370    if (src == null || src.isEmpty())
371      return null;
372    org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputModeEnumFactory());
373    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
374    switch (src.getValue()) {
375      case SOURCE:
376        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.SOURCE);
377        break;
378      case TARGET:
379        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.TARGET);
380        break;
381      default:
382        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode.NULL);
383        break;
384    }
385    return tgt;
386  }
387
388  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode> convertStructureMapInputMode(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapInputMode> src) throws FHIRException {
389    if (src == null || src.isEmpty())
390      return null;
391    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.StructureMap.StructureMapInputModeEnumFactory());
392    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
393    switch (src.getValue()) {
394      case SOURCE:
395        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.SOURCE);
396        break;
397      case TARGET:
398        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.TARGET);
399        break;
400      default:
401        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapInputMode.NULL);
402        break;
403    }
404    return tgt;
405  }
406
407  static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode> convertStructureMapSourceListMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode> src) throws FHIRException {
408    if (src == null || src.isEmpty())
409      return null;
410    org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListModeEnumFactory());
411    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
412    switch (src.getValue()) {
413      case FIRST:
414        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.FIRST);
415        break;
416      case LAST:
417        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.LAST);
418        break;
419      default:
420        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.NULL);
421        break;
422    }
423    return tgt;
424  }
425
426  public static org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode> convertStructureMapSourceListMode(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode> src) throws FHIRException {
427    if (src == null || src.isEmpty())
428      return null;
429    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListModeEnumFactory());
430    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
431    switch (src.getValue()) {
432      case FIRST:
433        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.FIRST);
434        break;
435      case LAST:
436        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.LAST);
437        break;
438      default:
439        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapSourceListMode.NULL);
440        break;
441    }
442    return tgt;
443  }
444
445  public static org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent src) throws FHIRException {
446    if (src == null || src.isEmpty())
447      return null;
448    org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent();
449    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
450    if (src.hasUrl())
451      tgt.setUrl(src.getUrl());
452    if (src.hasMode())
453      tgt.setModeElement(convertStructureMapStructureMode(src.getModeElement()));
454    if (src.hasDocumentation())
455      tgt.setDocumentationElement(String14_50.convertString(src.getDocumentationElement()));
456    return tgt;
457  }
458
459  public static org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent convertStructureMapStructureComponent(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapStructureComponent src) throws FHIRException {
460    if (src == null || src.isEmpty())
461      return null;
462    org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent tgt = new org.hl7.fhir.r5.model.StructureMap.StructureMapStructureComponent();
463    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
464    if (src.hasUrl())
465      tgt.setUrl(src.getUrl());
466    if (src.hasMode())
467      tgt.setModeElement(convertStructureMapStructureMode(src.getModeElement()));
468    if (src.hasDocumentation())
469      tgt.setDocumentationElement(String14_50.convertString(src.getDocumentationElement()));
470    return tgt;
471  }
472
473  static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode> convertStructureMapStructureMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode> src) throws FHIRException {
474    if (src == null || src.isEmpty())
475      return null;
476    org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelModeEnumFactory());
477    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
478    switch (src.getValue()) {
479      case PRODUCED:
480        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.PRODUCED);
481        break;
482      case QUERIED:
483        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.QUERIED);
484        break;
485      case SOURCE:
486        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.SOURCE);
487        break;
488      case TARGET:
489        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.TARGET);
490        break;
491      default:
492        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode.NULL);
493        break;
494    }
495    return tgt;
496  }
497
498  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode> convertStructureMapStructureMode(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapModelMode> src) throws FHIRException {
499    if (src == null || src.isEmpty())
500      return null;
501    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.StructureMap.StructureMapModelModeEnumFactory());
502    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
503    switch (src.getValue()) {
504      case PRODUCED:
505        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.PRODUCED);
506        break;
507      case QUERIED:
508        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.QUERIED);
509        break;
510      case SOURCE:
511        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.SOURCE);
512        break;
513      case TARGET:
514        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.TARGET);
515        break;
516      default:
517        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapModelMode.NULL);
518        break;
519    }
520    return tgt;
521  }
522
523  static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode> convertStructureMapTargetListMode(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode> src) throws FHIRException {
524    if (src == null || src.isEmpty())
525      return null;
526    org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListModeEnumFactory());
527    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
528    switch (src.getValue()) {
529      case FIRST:
530        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.FIRST);
531        break;
532      case LAST:
533        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.LAST);
534        break;
535      case SHARE:
536        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.SHARE);
537        break;
538      default:
539        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode.NULL);
540        break;
541    }
542    return tgt;
543  }
544
545  public static org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode> convertStructureMapTargetListMode(org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapListMode> src) throws FHIRException {
546    if (src == null || src.isEmpty())
547      return null;
548    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListModeEnumFactory());
549    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
550    switch (src.getValue()) {
551      case FIRST:
552        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.FIRST);
553        break;
554      case LAST:
555        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.LAST);
556        break;
557      case SHARE:
558        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.SHARE);
559        break;
560      default:
561        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTargetListMode.NULL);
562        break;
563    }
564    return tgt;
565  }
566
567  public static org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapTransform> convertStructureMapTransform(org.hl7.fhir.dstu2016may.model.Enumeration<StructureMap.StructureMapTransform> src) throws FHIRException {
568    if (src == null || src.isEmpty())
569      return null;
570    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapTransform> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.StructureMap.StructureMapTransformEnumFactory());
571    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
572    switch (src.getValue()) {
573      case APPEND:
574        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.APPEND);
575      case CAST:
576        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CAST);
577      case COPY:
578        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.COPY);
579      case CREATE:
580        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.CREATE);
581      case DATEOP:
582        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.DATEOP);
583      case ESCAPE:
584        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.ESCAPE);
585      case EVALUATE:
586        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.EVALUATE);
587      case POINTER:
588        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.POINTER);
589      case REFERENCE:
590        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.REFERENCE);
591      case TRANSLATE:
592        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRANSLATE);
593      case TRUNCATE:
594        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.TRUNCATE);
595      case UUID:
596        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.UUID);
597      default:
598        tgt.setValue(org.hl7.fhir.r5.model.StructureMap.StructureMapTransform.NULL);
599    }
600    return tgt;
601  }
602
603  static public org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform> convertStructureMapTransform(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.StructureMap.StructureMapTransform> src) throws FHIRException {
604    if (src == null || src.isEmpty())
605      return null;
606    org.hl7.fhir.dstu2016may.model.Enumeration<org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform> tgt = new org.hl7.fhir.dstu2016may.model.Enumeration<>(new org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransformEnumFactory());
607    ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
608    switch (src.getValue()) {
609      case APPEND:
610        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.APPEND);
611        break;
612      case CAST:
613        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.CAST);
614        break;
615      case COPY:
616        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.COPY);
617        break;
618      case CREATE:
619        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.CREATE);
620        break;
621      case DATEOP:
622        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.DATEOP);
623        break;
624      case ESCAPE:
625        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.ESCAPE);
626        break;
627      case EVALUATE:
628        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.EVALUATE);
629        break;
630      case POINTER:
631        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.POINTER);
632        break;
633      case REFERENCE:
634        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.REFERENCE);
635        break;
636      case TRANSLATE:
637        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.TRANSLATE);
638        break;
639      case TRUNCATE:
640        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.TRUNCATE);
641        break;
642      case UUID:
643        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.UUID);
644        break;
645      default:
646        tgt.setValue(org.hl7.fhir.dstu2016may.model.StructureMap.StructureMapTransform.NULL);
647        break;
648    }
649    return tgt;
650  }
651}