001package org.hl7.fhir.convertors.conv14_50;
002
003import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_14_50;
004import org.hl7.fhir.convertors.context.ConversionContext14_50;
005import org.hl7.fhir.convertors.conv14_50.datatypes14_50.Element14_50;
006import org.hl7.fhir.convertors.conv14_50.datatypes14_50.Type14_50;
007import org.hl7.fhir.convertors.conv14_50.resources14_50.Resource14_50;
008import org.hl7.fhir.exceptions.FHIRException;
009
010import javax.annotation.Nonnull;
011import java.util.ArrayList;
012import java.util.List;
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
042public class VersionConvertor_14_50 {
043  static public List<String> CANONICAL_URLS = new ArrayList<String>();
044
045  static {
046    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-conceptmap");
047    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset");
048    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/codesystem-map");
049    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/cqif-library");
050    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-allowedUnits");
051    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-inheritedExtensibleValueSet");
052    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet");
053    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet");
054    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/event-instantiatesCanonical");
055    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-allowedProfile");
056    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-deMap");
057    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-sourceStructureMap");
058    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-targetStructureMap");
059    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/questionnaire-unit-valueSet");
060    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-map");
061    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-supplement");
062    CANONICAL_URLS.add("http://hl7.org/fhir/StructureDefinition/valueset-system");
063  }
064
065  private final BaseAdvisor_14_50 advisor;
066  private final Element14_50 elementConvertor;
067  private final Resource14_50 resourceConvertor;
068  private final Type14_50 typeConvertor;
069
070  public VersionConvertor_14_50(@Nonnull BaseAdvisor_14_50 advisor) {
071    this.advisor = advisor;
072    this.elementConvertor = new Element14_50(advisor);
073    this.resourceConvertor = new Resource14_50(advisor);
074    this.typeConvertor = new Type14_50(advisor);
075  }
076
077  public BaseAdvisor_14_50 advisor() {
078    return advisor;
079  }
080
081  public void copyResource(@Nonnull org.hl7.fhir.dstu2016may.model.Resource src,
082                           @Nonnull org.hl7.fhir.r5.model.Resource tgt) throws FHIRException {
083    resourceConvertor.copyResource(src, tgt);
084  }
085
086  public void copyResource(@Nonnull org.hl7.fhir.r5.model.Resource src,
087                           @Nonnull org.hl7.fhir.dstu2016may.model.Resource tgt) throws FHIRException {
088    resourceConvertor.copyResource(src, tgt);
089  }
090
091  public org.hl7.fhir.r5.model.Resource convertResource(@Nonnull org.hl7.fhir.dstu2016may.model.Resource src) throws FHIRException {
092    ConversionContext14_50.INSTANCE.init(this, src.fhirType());
093    try {
094      return resourceConvertor.convertResource(src);
095    } finally {
096      ConversionContext14_50.INSTANCE.close(src.fhirType());
097    }
098  }
099
100  public org.hl7.fhir.dstu2016may.model.Resource convertResource(@Nonnull org.hl7.fhir.r5.model.Resource src) throws FHIRException {
101    ConversionContext14_50.INSTANCE.init(this, src.fhirType());
102    try {
103      return resourceConvertor.convertResource(src);
104    } finally {
105      ConversionContext14_50.INSTANCE.close(src.fhirType());
106    }
107  }
108
109  public org.hl7.fhir.r5.model.DataType convertType(@Nonnull org.hl7.fhir.dstu2016may.model.Type src) throws FHIRException {
110    ConversionContext14_50.INSTANCE.init(this, src.fhirType());
111    try {
112      return typeConvertor.convertType(src);
113    } finally {
114      ConversionContext14_50.INSTANCE.close(src.fhirType());
115    }
116  }
117
118  public org.hl7.fhir.dstu2016may.model.Type convertType(@Nonnull org.hl7.fhir.r5.model.DataType src) throws FHIRException {
119    ConversionContext14_50.INSTANCE.init(this, src.fhirType());
120    try {
121      return typeConvertor.convertType(src);
122    } finally {
123      ConversionContext14_50.INSTANCE.close(src.fhirType());
124    }
125  }
126
127  public void copyDomainResource(@Nonnull org.hl7.fhir.dstu2016may.model.DomainResource src,
128                                 @Nonnull org.hl7.fhir.r5.model.DomainResource tgt) throws FHIRException {
129    resourceConvertor.copyDomainResource(src, tgt);
130  }
131
132  public void copyDomainResource(@Nonnull org.hl7.fhir.r5.model.DomainResource src,
133                                 @Nonnull org.hl7.fhir.dstu2016may.model.DomainResource tgt) throws FHIRException {
134    resourceConvertor.copyDomainResource(src, tgt);
135  }
136
137  public void copyElement(@Nonnull org.hl7.fhir.dstu2016may.model.Element src,
138                          @Nonnull org.hl7.fhir.r5.model.Element tgt,
139                          String... var) throws FHIRException {
140    elementConvertor.copyElement(src, tgt, ConversionContext14_50.INSTANCE.path(), var);
141  }
142
143  public void copyElement(@Nonnull org.hl7.fhir.r5.model.Element src,
144                          @Nonnull org.hl7.fhir.dstu2016may.model.Element tgt,
145                          String... var) throws FHIRException {
146    elementConvertor.copyElement(src, tgt, ConversionContext14_50.INSTANCE.path(), var);
147  }
148}