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.Identifier43_50;
006import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Money43_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.special43_50.Reference43_50;
010import org.hl7.fhir.exceptions.FHIRException;
011import org.hl7.fhir.r5.model.Enumeration;
012import org.hl7.fhir.r5.model.Enumerations;
013
014/*
015  Copyright (c) 2011+, HL7, Inc.
016  All rights reserved.
017  
018  Redistribution and use in source and binary forms, with or without modification, 
019  are permitted provided that the following conditions are met:
020  
021   * Redistributions of source code must retain the above copyright notice, this 
022     list of conditions and the following disclaimer.
023   * Redistributions in binary form must reproduce the above copyright notice, 
024     this list of conditions and the following disclaimer in the documentation 
025     and/or other materials provided with the distribution.
026   * Neither the name of HL7 nor the names of its contributors may be used to 
027     endorse or promote products derived from this software without specific 
028     prior written permission.
029  
030  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
031  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
032  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
033  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
034  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
035  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
036  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
037  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
038  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
039  POSSIBILITY OF SUCH DAMAGE.
040  
041*/
042// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
043public class PaymentNotice43_50 {
044
045  public static org.hl7.fhir.r5.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.r4b.model.PaymentNotice src) throws FHIRException {
046    if (src == null)
047      return null;
048    org.hl7.fhir.r5.model.PaymentNotice tgt = new org.hl7.fhir.r5.model.PaymentNotice();
049    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
050    for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier())
051      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
052    if (src.hasStatus())
053      tgt.setStatusElement(convertPaymentNoticeStatus(src.getStatusElement()));
054    if (src.hasRequest())
055      tgt.setRequest(Reference43_50.convertReference(src.getRequest()));
056    if (src.hasResponse())
057      tgt.setResponse(Reference43_50.convertReference(src.getResponse()));
058    if (src.hasCreated())
059      tgt.setCreatedElement(DateTime43_50.convertDateTime(src.getCreatedElement()));
060    if (src.hasProvider())
061      tgt.setReporter(Reference43_50.convertReference(src.getProvider()));
062    if (src.hasPayment())
063      tgt.setPayment(Reference43_50.convertReference(src.getPayment()));
064    if (src.hasPaymentDate())
065      tgt.setPaymentDateElement(Date43_50.convertDate(src.getPaymentDateElement()));
066    if (src.hasPayee())
067      tgt.setPayee(Reference43_50.convertReference(src.getPayee()));
068    if (src.hasRecipient())
069      tgt.setRecipient(Reference43_50.convertReference(src.getRecipient()));
070    if (src.hasAmount())
071      tgt.setAmount(Money43_50.convertMoney(src.getAmount()));
072    if (src.hasPaymentStatus())
073      tgt.setPaymentStatus(CodeableConcept43_50.convertCodeableConcept(src.getPaymentStatus()));
074    return tgt;
075  }
076
077  public static org.hl7.fhir.r4b.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.r5.model.PaymentNotice src) throws FHIRException {
078    if (src == null)
079      return null;
080    org.hl7.fhir.r4b.model.PaymentNotice tgt = new org.hl7.fhir.r4b.model.PaymentNotice();
081    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
082    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
083      tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
084    if (src.hasStatus())
085      tgt.setStatusElement(convertPaymentNoticeStatus(src.getStatusElement()));
086    if (src.hasRequest())
087      tgt.setRequest(Reference43_50.convertReference(src.getRequest()));
088    if (src.hasResponse())
089      tgt.setResponse(Reference43_50.convertReference(src.getResponse()));
090    if (src.hasCreated())
091      tgt.setCreatedElement(DateTime43_50.convertDateTime(src.getCreatedElement()));
092    if (src.hasReporter())
093      tgt.setProvider(Reference43_50.convertReference(src.getReporter()));
094    if (src.hasPayment())
095      tgt.setPayment(Reference43_50.convertReference(src.getPayment()));
096    if (src.hasPaymentDate())
097      tgt.setPaymentDateElement(Date43_50.convertDate(src.getPaymentDateElement()));
098    if (src.hasPayee())
099      tgt.setPayee(Reference43_50.convertReference(src.getPayee()));
100    if (src.hasRecipient())
101      tgt.setRecipient(Reference43_50.convertReference(src.getRecipient()));
102    if (src.hasAmount())
103      tgt.setAmount(Money43_50.convertMoney(src.getAmount()));
104    if (src.hasPaymentStatus())
105      tgt.setPaymentStatus(CodeableConcept43_50.convertCodeableConcept(src.getPaymentStatus()));
106    return tgt;
107  }
108
109  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes> convertPaymentNoticeStatus(org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.FinancialResourceStatusCodes> src) throws FHIRException {
110      if (src == null || src.isEmpty())
111          return null;
112      Enumeration<Enumerations.FinancialResourceStatusCodes> tgt = new Enumeration<>(new Enumerations.FinancialResourceStatusCodesEnumFactory());
113      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
114      if (src.getValue() == null) {
115          tgt.setValue(null);
116      } else {
117          switch (src.getValue()) {
118              case ACTIVE:
119                  tgt.setValue(Enumerations.FinancialResourceStatusCodes.ACTIVE);
120                  break;
121              case CANCELLED:
122                  tgt.setValue(Enumerations.FinancialResourceStatusCodes.CANCELLED);
123                  break;
124              case DRAFT:
125                  tgt.setValue(Enumerations.FinancialResourceStatusCodes.DRAFT);
126                  break;
127              case ENTEREDINERROR:
128                  tgt.setValue(Enumerations.FinancialResourceStatusCodes.ENTEREDINERROR);
129                  break;
130              default:
131                  tgt.setValue(Enumerations.FinancialResourceStatusCodes.NULL);
132                  break;
133          }
134      }
135      return tgt;
136  }
137
138  static public org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.FinancialResourceStatusCodes> convertPaymentNoticeStatus(org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes> src) throws FHIRException {
139      if (src == null || src.isEmpty())
140          return null;
141      org.hl7.fhir.r4b.model.Enumeration<org.hl7.fhir.r4b.model.Enumerations.FinancialResourceStatusCodes> tgt = new org.hl7.fhir.r4b.model.Enumeration<>(new org.hl7.fhir.r4b.model.Enumerations.FinancialResourceStatusCodesEnumFactory());
142      ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
143      if (src.getValue() == null) {
144          tgt.setValue(null);
145      } else {
146          switch (src.getValue()) {
147              case ACTIVE:
148                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.FinancialResourceStatusCodes.ACTIVE);
149                  break;
150              case CANCELLED:
151                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.FinancialResourceStatusCodes.CANCELLED);
152                  break;
153              case DRAFT:
154                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.FinancialResourceStatusCodes.DRAFT);
155                  break;
156              case ENTEREDINERROR:
157                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.FinancialResourceStatusCodes.ENTEREDINERROR);
158                  break;
159              default:
160                  tgt.setValue(org.hl7.fhir.r4b.model.Enumerations.FinancialResourceStatusCodes.NULL);
161                  break;
162          }
163      }
164      return tgt;
165  }
166}