001package org.hl7.fhir.convertors.conv43_50.resources43_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext43_50;
004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50;
005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Signature43_50;
006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Timing43_50;
007import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Date43_50;
008import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50;
009import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
010import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50;
011import org.hl7.fhir.exceptions.FHIRException;
012
013/*
014  Copyright (c) 2011+, HL7, Inc.
015  All rights reserved.
016  
017  Redistribution and use in source and binary forms, with or without modification, 
018  are permitted provided that the following conditions are met:
019  
020   * Redistributions of source code must retain the above copyright notice, this 
021     list of conditions and the following disclaimer.
022   * Redistributions in binary form must reproduce the above copyright notice, 
023     this list of conditions and the following disclaimer in the documentation 
024     and/or other materials provided with the distribution.
025   * Neither the name of HL7 nor the names of its contributors may be used to 
026     endorse or promote products derived from this software without specific 
027     prior written permission.
028  
029  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
030  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
031  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
032  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
033  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
034  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
035  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
036  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
037  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
038  POSSIBILITY OF SUCH DAMAGE.
039  
040*/
041// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
042public class VerificationResult43_50 {
043
044  public static org.hl7.fhir.r5.model.VerificationResult convertVerificationResult(org.hl7.fhir.r4b.model.VerificationResult src) throws FHIRException {
045    if (src == null)
046      return null;
047    org.hl7.fhir.r5.model.VerificationResult tgt = new org.hl7.fhir.r5.model.VerificationResult();
048    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
049    for (org.hl7.fhir.r4b.model.Reference t : src.getTarget()) tgt.addTarget(Reference43_50.convertReference(t));
050    for (org.hl7.fhir.r4b.model.StringType t : src.getTargetLocation())
051      tgt.getTargetLocation().add(String43_50.convertString(t));
052    if (src.hasNeed())
053      tgt.setNeed(CodeableConcept43_50.convertCodeableConcept(src.getNeed()));
054    if (src.hasStatus())
055      tgt.setStatusElement(convertStatus(src.getStatusElement()));
056    if (src.hasStatusDate())
057      tgt.setStatusDateElement(DateTime43_50.convertDateTime(src.getStatusDateElement()));
058    if (src.hasValidationType())
059      tgt.setValidationType(CodeableConcept43_50.convertCodeableConcept(src.getValidationType()));
060    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getValidationProcess())
061      tgt.addValidationProcess(CodeableConcept43_50.convertCodeableConcept(t));
062    if (src.hasFrequency())
063      tgt.setFrequency(Timing43_50.convertTiming(src.getFrequency()));
064    if (src.hasLastPerformed())
065      tgt.setLastPerformedElement(DateTime43_50.convertDateTime(src.getLastPerformedElement()));
066    if (src.hasNextScheduled())
067      tgt.setNextScheduledElement(Date43_50.convertDate(src.getNextScheduledElement()));
068    if (src.hasFailureAction())
069      tgt.setFailureAction(CodeableConcept43_50.convertCodeableConcept(src.getFailureAction()));
070    for (org.hl7.fhir.r4b.model.VerificationResult.VerificationResultPrimarySourceComponent t : src.getPrimarySource())
071      tgt.addPrimarySource(convertVerificationResultPrimarySourceComponent(t));
072    if (src.hasAttestation())
073      tgt.setAttestation(convertVerificationResultAttestationComponent(src.getAttestation()));
074    for (org.hl7.fhir.r4b.model.VerificationResult.VerificationResultValidatorComponent t : src.getValidator())
075      tgt.addValidator(convertVerificationResultValidatorComponent(t));
076    return tgt;
077  }
078
079  public static org.hl7.fhir.r4b.model.VerificationResult convertVerificationResult(org.hl7.fhir.r5.model.VerificationResult src) throws FHIRException {
080    if (src == null)
081      return null;
082    org.hl7.fhir.r4b.model.VerificationResult tgt = new org.hl7.fhir.r4b.model.VerificationResult();
083    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
084    for (org.hl7.fhir.r5.model.Reference t : src.getTarget()) tgt.addTarget(Reference43_50.convertReference(t));
085    for (org.hl7.fhir.r5.model.StringType t : src.getTargetLocation())
086      tgt.getTargetLocation().add(String43_50.convertString(t));
087    if (src.hasNeed())
088      tgt.setNeed(CodeableConcept43_50.convertCodeableConcept(src.getNeed()));
089    if (src.hasStatus())
090      tgt.setStatusElement(convertStatus(src.getStatusElement()));
091    if (src.hasStatusDate())
092      tgt.setStatusDateElement(DateTime43_50.convertDateTime(src.getStatusDateElement()));
093    if (src.hasValidationType())
094      tgt.setValidationType(CodeableConcept43_50.convertCodeableConcept(src.getValidationType()));
095    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getValidationProcess())
096      tgt.addValidationProcess(CodeableConcept43_50.convertCodeableConcept(t));
097    if (src.hasFrequency())
098      tgt.setFrequency(Timing43_50.convertTiming(src.getFrequency()));
099    if (src.hasLastPerformed())
100      tgt.setLastPerformedElement(DateTime43_50.convertDateTime(src.getLastPerformedElement()));
101    if (src.hasNextScheduled())
102      tgt.setNextScheduledElement(Date43_50.convertDate(src.getNextScheduledElement()));
103    if (src.hasFailureAction())
104      tgt.setFailureAction(CodeableConcept43_50.convertCodeableConcept(src.getFailureAction()));
105    for (org.hl7.fhir.r5.model.VerificationResult.VerificationResultPrimarySourceComponent t : src.getPrimarySource())
106      tgt.addPrimarySource(convertVerificationResultPrimarySourceComponent(t));
107    if (src.hasAttestation())
108      tgt.setAttestation(convertVerificationResultAttestationComponent(src.getAttestation()));
109    for (org.hl7.fhir.r5.model.VerificationResult.VerificationResultValidatorComponent t : src.getValidator())
110      tgt.addValidator(convertVerificationResultValidatorComponent(t));
111    return tgt;
112  }
113
114  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.VerificationResult.VerificationResultStatus> convertStatus(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.VerificationResult.Status> src) throws FHIRException {
115    if (src == null || src.isEmpty())
116      return null;
117    org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.VerificationResult.VerificationResultStatus> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.VerificationResult.VerificationResultStatusEnumFactory());
118    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
119    switch (src.getValue()) {
120      case ATTESTED:
121        tgt.setValue(org.hl7.fhir.r5.model.VerificationResult.VerificationResultStatus.ATTESTED);
122        break;
123      case VALIDATED:
124        tgt.setValue(org.hl7.fhir.r5.model.VerificationResult.VerificationResultStatus.VALIDATED);
125        break;
126      case INPROCESS:
127        tgt.setValue(org.hl7.fhir.r5.model.VerificationResult.VerificationResultStatus.INPROCESS);
128        break;
129      case REQREVALID:
130        tgt.setValue(org.hl7.fhir.r5.model.VerificationResult.VerificationResultStatus.REQREVALID);
131        break;
132      case VALFAIL:
133        tgt.setValue(org.hl7.fhir.r5.model.VerificationResult.VerificationResultStatus.VALFAIL);
134        break;
135      case REVALFAIL:
136        tgt.setValue(org.hl7.fhir.r5.model.VerificationResult.VerificationResultStatus.REVALFAIL);
137        break;
138      default:
139        tgt.setValue(org.hl7.fhir.r5.model.VerificationResult.VerificationResultStatus.NULL);
140        break;
141    }
142    return tgt;
143  }
144
145  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.VerificationResult.Status> convertStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.VerificationResult.VerificationResultStatus> src) throws FHIRException {
146    if (src == null || src.isEmpty())
147      return null;
148    org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.VerificationResult.Status> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.VerificationResult.StatusEnumFactory());
149    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
150    switch (src.getValue()) {
151      case ATTESTED:
152        tgt.setValue(org.hl7.fhir.r4b.model.VerificationResult.Status.ATTESTED);
153        break;
154      case VALIDATED:
155        tgt.setValue(org.hl7.fhir.r4b.model.VerificationResult.Status.VALIDATED);
156        break;
157      case INPROCESS:
158        tgt.setValue(org.hl7.fhir.r4b.model.VerificationResult.Status.INPROCESS);
159        break;
160      case REQREVALID:
161        tgt.setValue(org.hl7.fhir.r4b.model.VerificationResult.Status.REQREVALID);
162        break;
163      case VALFAIL:
164        tgt.setValue(org.hl7.fhir.r4b.model.VerificationResult.Status.VALFAIL);
165        break;
166      case REVALFAIL:
167        tgt.setValue(org.hl7.fhir.r4b.model.VerificationResult.Status.REVALFAIL);
168        break;
169      default:
170        tgt.setValue(org.hl7.fhir.r4b.model.VerificationResult.Status.NULL);
171        break;
172    }
173    return tgt;
174  }
175
176  public static org.hl7.fhir.r5.model.VerificationResult.VerificationResultPrimarySourceComponent convertVerificationResultPrimarySourceComponent(org.hl7.fhir.r4b.model.VerificationResult.VerificationResultPrimarySourceComponent src) throws FHIRException {
177    if (src == null)
178      return null;
179    org.hl7.fhir.r5.model.VerificationResult.VerificationResultPrimarySourceComponent tgt = new org.hl7.fhir.r5.model.VerificationResult.VerificationResultPrimarySourceComponent();
180    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
181    if (src.hasWho())
182      tgt.setWho(Reference43_50.convertReference(src.getWho()));
183    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getType())
184      tgt.addType(CodeableConcept43_50.convertCodeableConcept(t));
185    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getCommunicationMethod())
186      tgt.addCommunicationMethod(CodeableConcept43_50.convertCodeableConcept(t));
187    if (src.hasValidationStatus())
188      tgt.setValidationStatus(CodeableConcept43_50.convertCodeableConcept(src.getValidationStatus()));
189    if (src.hasValidationDate())
190      tgt.setValidationDateElement(DateTime43_50.convertDateTime(src.getValidationDateElement()));
191    if (src.hasCanPushUpdates())
192      tgt.setCanPushUpdates(CodeableConcept43_50.convertCodeableConcept(src.getCanPushUpdates()));
193    for (org.hl7.fhir.r4b.model.CodeableConcept t : src.getPushTypeAvailable())
194      tgt.addPushTypeAvailable(CodeableConcept43_50.convertCodeableConcept(t));
195    return tgt;
196  }
197
198  public static org.hl7.fhir.r4b.model.VerificationResult.VerificationResultPrimarySourceComponent convertVerificationResultPrimarySourceComponent(org.hl7.fhir.r5.model.VerificationResult.VerificationResultPrimarySourceComponent src) throws FHIRException {
199    if (src == null)
200      return null;
201    org.hl7.fhir.r4b.model.VerificationResult.VerificationResultPrimarySourceComponent tgt = new org.hl7.fhir.r4b.model.VerificationResult.VerificationResultPrimarySourceComponent();
202    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
203    if (src.hasWho())
204      tgt.setWho(Reference43_50.convertReference(src.getWho()));
205    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getType())
206      tgt.addType(CodeableConcept43_50.convertCodeableConcept(t));
207    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getCommunicationMethod())
208      tgt.addCommunicationMethod(CodeableConcept43_50.convertCodeableConcept(t));
209    if (src.hasValidationStatus())
210      tgt.setValidationStatus(CodeableConcept43_50.convertCodeableConcept(src.getValidationStatus()));
211    if (src.hasValidationDate())
212      tgt.setValidationDateElement(DateTime43_50.convertDateTime(src.getValidationDateElement()));
213    if (src.hasCanPushUpdates())
214      tgt.setCanPushUpdates(CodeableConcept43_50.convertCodeableConcept(src.getCanPushUpdates()));
215    for (org.hl7.fhir.r5.model.CodeableConcept t : src.getPushTypeAvailable())
216      tgt.addPushTypeAvailable(CodeableConcept43_50.convertCodeableConcept(t));
217    return tgt;
218  }
219
220  public static org.hl7.fhir.r5.model.VerificationResult.VerificationResultAttestationComponent convertVerificationResultAttestationComponent(org.hl7.fhir.r4b.model.VerificationResult.VerificationResultAttestationComponent src) throws FHIRException {
221    if (src == null)
222      return null;
223    org.hl7.fhir.r5.model.VerificationResult.VerificationResultAttestationComponent tgt = new org.hl7.fhir.r5.model.VerificationResult.VerificationResultAttestationComponent();
224    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
225    if (src.hasWho())
226      tgt.setWho(Reference43_50.convertReference(src.getWho()));
227    if (src.hasOnBehalfOf())
228      tgt.setOnBehalfOf(Reference43_50.convertReference(src.getOnBehalfOf()));
229    if (src.hasCommunicationMethod())
230      tgt.setCommunicationMethod(CodeableConcept43_50.convertCodeableConcept(src.getCommunicationMethod()));
231    if (src.hasDate())
232      tgt.setDateElement(Date43_50.convertDate(src.getDateElement()));
233    if (src.hasSourceIdentityCertificate())
234      tgt.setSourceIdentityCertificateElement(String43_50.convertString(src.getSourceIdentityCertificateElement()));
235    if (src.hasProxyIdentityCertificate())
236      tgt.setProxyIdentityCertificateElement(String43_50.convertString(src.getProxyIdentityCertificateElement()));
237    if (src.hasProxySignature())
238      tgt.setProxySignature(Signature43_50.convertSignature(src.getProxySignature()));
239    if (src.hasSourceSignature())
240      tgt.setSourceSignature(Signature43_50.convertSignature(src.getSourceSignature()));
241    return tgt;
242  }
243
244  public static org.hl7.fhir.r4b.model.VerificationResult.VerificationResultAttestationComponent convertVerificationResultAttestationComponent(org.hl7.fhir.r5.model.VerificationResult.VerificationResultAttestationComponent src) throws FHIRException {
245    if (src == null)
246      return null;
247    org.hl7.fhir.r4b.model.VerificationResult.VerificationResultAttestationComponent tgt = new org.hl7.fhir.r4b.model.VerificationResult.VerificationResultAttestationComponent();
248    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
249    if (src.hasWho())
250      tgt.setWho(Reference43_50.convertReference(src.getWho()));
251    if (src.hasOnBehalfOf())
252      tgt.setOnBehalfOf(Reference43_50.convertReference(src.getOnBehalfOf()));
253    if (src.hasCommunicationMethod())
254      tgt.setCommunicationMethod(CodeableConcept43_50.convertCodeableConcept(src.getCommunicationMethod()));
255    if (src.hasDate())
256      tgt.setDateElement(Date43_50.convertDate(src.getDateElement()));
257    if (src.hasSourceIdentityCertificate())
258      tgt.setSourceIdentityCertificateElement(String43_50.convertString(src.getSourceIdentityCertificateElement()));
259    if (src.hasProxyIdentityCertificate())
260      tgt.setProxyIdentityCertificateElement(String43_50.convertString(src.getProxyIdentityCertificateElement()));
261    if (src.hasProxySignature())
262      tgt.setProxySignature(Signature43_50.convertSignature(src.getProxySignature()));
263    if (src.hasSourceSignature())
264      tgt.setSourceSignature(Signature43_50.convertSignature(src.getSourceSignature()));
265    return tgt;
266  }
267
268  public static org.hl7.fhir.r5.model.VerificationResult.VerificationResultValidatorComponent convertVerificationResultValidatorComponent(org.hl7.fhir.r4b.model.VerificationResult.VerificationResultValidatorComponent src) throws FHIRException {
269    if (src == null)
270      return null;
271    org.hl7.fhir.r5.model.VerificationResult.VerificationResultValidatorComponent tgt = new org.hl7.fhir.r5.model.VerificationResult.VerificationResultValidatorComponent();
272    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
273    if (src.hasOrganization())
274      tgt.setOrganization(Reference43_50.convertReference(src.getOrganization()));
275    if (src.hasIdentityCertificate())
276      tgt.setIdentityCertificateElement(String43_50.convertString(src.getIdentityCertificateElement()));
277    if (src.hasAttestationSignature())
278      tgt.setAttestationSignature(Signature43_50.convertSignature(src.getAttestationSignature()));
279    return tgt;
280  }
281
282  public static org.hl7.fhir.r4b.model.VerificationResult.VerificationResultValidatorComponent convertVerificationResultValidatorComponent(org.hl7.fhir.r5.model.VerificationResult.VerificationResultValidatorComponent src) throws FHIRException {
283    if (src == null)
284      return null;
285    org.hl7.fhir.r4b.model.VerificationResult.VerificationResultValidatorComponent tgt = new org.hl7.fhir.r4b.model.VerificationResult.VerificationResultValidatorComponent();
286    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyBackboneElement(src, tgt);
287    if (src.hasOrganization())
288      tgt.setOrganization(Reference43_50.convertReference(src.getOrganization()));
289    if (src.hasIdentityCertificate())
290      tgt.setIdentityCertificateElement(String43_50.convertString(src.getIdentityCertificateElement()));
291    if (src.hasAttestationSignature())
292      tgt.setAttestationSignature(Signature43_50.convertSignature(src.getAttestationSignature()));
293    return tgt;
294  }
295}