Support for requirements resource
This commit is contained in:
parent
628ace4716
commit
ac67f945a0
|
@ -30,6 +30,8 @@ public class BaseAdvisor_30_50 extends BaseAdvisor50<org.hl7.fhir.dstu3.model.Ex
|
||||||
return true;
|
return true;
|
||||||
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) {
|
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) {
|
||||||
return true;
|
return true;
|
||||||
|
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.")) {
|
||||||
|
return true;
|
||||||
} else
|
} else
|
||||||
return (paths.get(paths.size() - 1).equals("CapabilityStatement")) && (capabilityStatementIgnoredUrls.contains(url));
|
return (paths.get(paths.size() - 1).equals("CapabilityStatement")) && (capabilityStatementIgnoredUrls.contains(url));
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ public class BaseAdvisor_40_50 extends BaseAdvisor50<org.hl7.fhir.r4.model.Exten
|
||||||
return true;
|
return true;
|
||||||
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) {
|
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) {
|
||||||
return true;
|
return true;
|
||||||
|
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.")) {
|
||||||
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ public class BaseAdvisor_43_50 extends BaseAdvisor50<org.hl7.fhir.r4b.model.Exte
|
||||||
return true;
|
return true;
|
||||||
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) {
|
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.")) {
|
||||||
return true;
|
return true;
|
||||||
|
} else if (paths.get(paths.size() - 1).equals("Basic") && url.startsWith("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.")) {
|
||||||
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ import org.hl7.fhir.convertors.conv30_50.resources30_50.Provenance30_50;
|
||||||
import org.hl7.fhir.convertors.conv30_50.resources30_50.Questionnaire30_50;
|
import org.hl7.fhir.convertors.conv30_50.resources30_50.Questionnaire30_50;
|
||||||
import org.hl7.fhir.convertors.conv30_50.resources30_50.QuestionnaireResponse30_50;
|
import org.hl7.fhir.convertors.conv30_50.resources30_50.QuestionnaireResponse30_50;
|
||||||
import org.hl7.fhir.convertors.conv30_50.resources30_50.RelatedPerson30_50;
|
import org.hl7.fhir.convertors.conv30_50.resources30_50.RelatedPerson30_50;
|
||||||
|
import org.hl7.fhir.convertors.conv30_50.resources30_50.Requirements30_50;
|
||||||
import org.hl7.fhir.convertors.conv30_50.resources30_50.RiskAssessment30_50;
|
import org.hl7.fhir.convertors.conv30_50.resources30_50.RiskAssessment30_50;
|
||||||
import org.hl7.fhir.convertors.conv30_50.resources30_50.Schedule30_50;
|
import org.hl7.fhir.convertors.conv30_50.resources30_50.Schedule30_50;
|
||||||
import org.hl7.fhir.convertors.conv30_50.resources30_50.SearchParameter30_50;
|
import org.hl7.fhir.convertors.conv30_50.resources30_50.SearchParameter30_50;
|
||||||
|
@ -89,6 +90,7 @@ import org.hl7.fhir.convertors.conv30_50.resources30_50.TestScript30_50;
|
||||||
import org.hl7.fhir.convertors.conv30_50.resources30_50.ValueSet30_50;
|
import org.hl7.fhir.convertors.conv30_50.resources30_50.ValueSet30_50;
|
||||||
import org.hl7.fhir.convertors.conv40_50.resources40_50.ActorDefinition40_50;
|
import org.hl7.fhir.convertors.conv40_50.resources40_50.ActorDefinition40_50;
|
||||||
import org.hl7.fhir.convertors.conv40_50.resources40_50.Basic40_50;
|
import org.hl7.fhir.convertors.conv40_50.resources40_50.Basic40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.resources43_50.Requirements43_50;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.dstu3.model.Basic;
|
import org.hl7.fhir.dstu3.model.Basic;
|
||||||
|
|
||||||
|
@ -132,6 +134,8 @@ public class Resource30_50 {
|
||||||
org.hl7.fhir.dstu3.model.Basic basic = (Basic) src;
|
org.hl7.fhir.dstu3.model.Basic basic = (Basic) src;
|
||||||
if (basic.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "ActorDefinition")) {
|
if (basic.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "ActorDefinition")) {
|
||||||
return ActorDefinition30_50.convertActorDefinition((org.hl7.fhir.dstu3.model.Basic) src);
|
return ActorDefinition30_50.convertActorDefinition((org.hl7.fhir.dstu3.model.Basic) src);
|
||||||
|
} else if (basic.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "Requirements")) {
|
||||||
|
return Requirements30_50.convertRequirements((org.hl7.fhir.dstu3.model.Basic) src);
|
||||||
} else {
|
} else {
|
||||||
return Basic30_50.convertBasic((org.hl7.fhir.dstu3.model.Basic) src);
|
return Basic30_50.convertBasic((org.hl7.fhir.dstu3.model.Basic) src);
|
||||||
}
|
}
|
||||||
|
@ -415,6 +419,8 @@ public class Resource30_50 {
|
||||||
return QuestionnaireResponse30_50.convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src);
|
return QuestionnaireResponse30_50.convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src);
|
||||||
if (src instanceof org.hl7.fhir.r5.model.RelatedPerson)
|
if (src instanceof org.hl7.fhir.r5.model.RelatedPerson)
|
||||||
return RelatedPerson30_50.convertRelatedPerson((org.hl7.fhir.r5.model.RelatedPerson) src);
|
return RelatedPerson30_50.convertRelatedPerson((org.hl7.fhir.r5.model.RelatedPerson) src);
|
||||||
|
if (src instanceof org.hl7.fhir.r5.model.Requirements)
|
||||||
|
return Requirements30_50.convertRequirements((org.hl7.fhir.r5.model.Requirements) src);
|
||||||
if (src instanceof org.hl7.fhir.r5.model.RiskAssessment)
|
if (src instanceof org.hl7.fhir.r5.model.RiskAssessment)
|
||||||
return RiskAssessment30_50.convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src);
|
return RiskAssessment30_50.convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src);
|
||||||
if (src instanceof org.hl7.fhir.r5.model.Schedule)
|
if (src instanceof org.hl7.fhir.r5.model.Schedule)
|
||||||
|
|
|
@ -0,0 +1,270 @@
|
||||||
|
package org.hl7.fhir.convertors.conv30_50.resources30_50;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.hl7.fhir.convertors.context.ConversionContext30_50;
|
||||||
|
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.ContactDetail30_50;
|
||||||
|
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.Reference30_50;
|
||||||
|
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.UsageContext30_50;
|
||||||
|
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
|
||||||
|
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50;
|
||||||
|
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50;
|
||||||
|
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.DateTime30_50;
|
||||||
|
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Id30_50;
|
||||||
|
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.MarkDown30_50;
|
||||||
|
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.String30_50;
|
||||||
|
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50;
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
import org.hl7.fhir.dstu3.model.Extension;
|
||||||
|
import org.hl7.fhir.dstu3.model.UriType;
|
||||||
|
import org.hl7.fhir.dstu3.utils.ToolingExtensions;
|
||||||
|
import org.hl7.fhir.r5.model.CanonicalType;
|
||||||
|
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||||
|
import org.hl7.fhir.r5.model.CodeableReference;
|
||||||
|
import org.hl7.fhir.r5.model.Coding;
|
||||||
|
import org.hl7.fhir.r5.model.ContactDetail;
|
||||||
|
import org.hl7.fhir.r5.model.Enumeration;
|
||||||
|
import org.hl7.fhir.r5.model.Enumerations.ExampleScenarioActorType;
|
||||||
|
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||||
|
import org.hl7.fhir.r5.model.Reference;
|
||||||
|
import org.hl7.fhir.r5.model.Requirements.ConformanceExpectation;
|
||||||
|
import org.hl7.fhir.r5.model.Requirements.RequirementsStatementComponent;
|
||||||
|
import org.hl7.fhir.r5.model.UrlType;
|
||||||
|
import org.hl7.fhir.r5.model.UsageContext;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
|
||||||
|
public class Requirements30_50 {
|
||||||
|
|
||||||
|
public static org.hl7.fhir.r5.model.Requirements convertRequirements(org.hl7.fhir.dstu3.model.Basic src) throws FHIRException {
|
||||||
|
if (src == null)
|
||||||
|
return null;
|
||||||
|
if (!src.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "Requirements")) {
|
||||||
|
throw new FHIRException("Error in logic: this basic resource is not an Requirements");
|
||||||
|
}
|
||||||
|
org.hl7.fhir.r5.model.Requirements tgt = new org.hl7.fhir.r5.model.Requirements();
|
||||||
|
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
|
||||||
|
|
||||||
|
for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
|
||||||
|
tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
|
||||||
|
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url")) {
|
||||||
|
tgt.setUrlElement(Uri30_50.convertUri((org.hl7.fhir.dstu3.model.UriType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version")) {
|
||||||
|
tgt.setVersionElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name")) {
|
||||||
|
tgt.setNameElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title")) {
|
||||||
|
tgt.setTitleElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status")) {
|
||||||
|
tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status").getValue().primitiveValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental")) {
|
||||||
|
tgt.setExperimentalElement(Boolean30_50.convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date")) {
|
||||||
|
tgt.setDateElement(DateTime30_50.convertDateTime((org.hl7.fhir.dstu3.model.DateTimeType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher")) {
|
||||||
|
tgt.setPublisherElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact")) {
|
||||||
|
tgt.addContact(ContactDetail30_50.convertContactDetail((org.hl7.fhir.dstu3.model.ContactDetail) ext.getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description")) {
|
||||||
|
tgt.setPublisherElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext")) {
|
||||||
|
tgt.addUseContext(UsageContext30_50.convertUsageContext((org.hl7.fhir.dstu3.model.UsageContext) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction")) {
|
||||||
|
tgt.addJurisdiction(CodeableConcept30_50.convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) ext.getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose")) {
|
||||||
|
tgt.setPurposeElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright")) {
|
||||||
|
tgt.setCopyrightElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel")) {
|
||||||
|
tgt.setCopyrightLabelElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom")) {
|
||||||
|
tgt.getDerivedFrom().add(Uri30_50.convertCanonical((org.hl7.fhir.dstu3.model.UriType) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor")) {
|
||||||
|
tgt.getActor().add(Uri30_50.convertCanonical((org.hl7.fhir.dstu3.model.UriType) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement")) {
|
||||||
|
convertRequirementsStatement(ext, tgt.addStatement());
|
||||||
|
}
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static org.hl7.fhir.dstu3.model.Basic convertRequirements(org.hl7.fhir.r5.model.Requirements src) throws FHIRException {
|
||||||
|
if (src == null)
|
||||||
|
return null;
|
||||||
|
org.hl7.fhir.dstu3.model.Basic tgt = new org.hl7.fhir.dstu3.model.Basic();
|
||||||
|
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
|
||||||
|
tgt.getCode().getCodingFirstRep().setSystem("http://hl7.org/fhir/fhir-types").setCode("Requirements"); // note use of R5 type system
|
||||||
|
|
||||||
|
for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
|
||||||
|
tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
|
||||||
|
if (src.hasUrl()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url", Uri30_50.convertUri(src.getUrlElement()));
|
||||||
|
}
|
||||||
|
if (src.hasVersion()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version", String30_50.convertString(src.getVersionElement()));
|
||||||
|
}
|
||||||
|
if (src.hasName()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name", String30_50.convertString(src.getNameElement()));
|
||||||
|
}
|
||||||
|
if (src.hasTitle()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title", String30_50.convertString(src.getTitleElement()));
|
||||||
|
}
|
||||||
|
if (src.hasStatus()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status", new org.hl7.fhir.dstu3.model.CodeType(src.getStatus().toCode()));
|
||||||
|
}
|
||||||
|
if (src.hasExperimental()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental", Boolean30_50.convertBoolean(src.getExperimentalElement()));
|
||||||
|
}
|
||||||
|
if (src.hasDate()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date", DateTime30_50.convertDateTime(src.getDateElement()));
|
||||||
|
}
|
||||||
|
if (src.hasPublisher()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher", String30_50.convertString(src.getPublisherElement()));
|
||||||
|
}
|
||||||
|
for (ContactDetail cd : src.getContact()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact", ContactDetail30_50.convertContactDetail(cd));
|
||||||
|
}
|
||||||
|
if (src.hasDescription()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description", MarkDown30_50.convertMarkdown(src.getDescriptionElement()));
|
||||||
|
}
|
||||||
|
for (UsageContext cd : src.getUseContext()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext", UsageContext30_50.convertUsageContext(cd));
|
||||||
|
}
|
||||||
|
for (CodeableConcept cd : src.getJurisdiction()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction", CodeableConcept30_50.convertCodeableConcept(cd));
|
||||||
|
}
|
||||||
|
if (src.hasPurpose()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose", MarkDown30_50.convertMarkdown(src.getPurposeElement()));
|
||||||
|
}
|
||||||
|
if (src.hasCopyright()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright", MarkDown30_50.convertMarkdown(src.getCopyrightElement()));
|
||||||
|
}
|
||||||
|
if (src.hasCopyrightLabel()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel", String30_50.convertString(src.getCopyrightLabelElement()));
|
||||||
|
}
|
||||||
|
for (CanonicalType ref : src.getDerivedFrom()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom", Uri30_50.convertCanonical(ref));
|
||||||
|
}
|
||||||
|
for (CanonicalType ref : src.getActor()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor", Uri30_50.convertCanonical(ref));
|
||||||
|
}
|
||||||
|
for (RequirementsStatementComponent ref : src.getStatement()) {
|
||||||
|
org.hl7.fhir.dstu3.model.Extension tgte = new org.hl7.fhir.dstu3.model.Extension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement");
|
||||||
|
tgt.addExtension(tgte);
|
||||||
|
convertRequirementsStatement(ref, tgte);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void convertRequirementsStatement(RequirementsStatementComponent src, Extension tgt) {
|
||||||
|
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
|
||||||
|
if (src.hasKey()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.key", Id30_50.convertId(src.getKeyElement()));
|
||||||
|
}
|
||||||
|
if (src.hasLabel()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.label", String30_50.convertString(src.getLabelElement()));
|
||||||
|
}
|
||||||
|
for (Enumeration<ConformanceExpectation> t : src.getConformance()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.conformance", new org.hl7.fhir.dstu3.model.CodeType(t.getCode()));
|
||||||
|
}
|
||||||
|
if (src.hasRequirement()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.requirement", MarkDown30_50.convertMarkdown(src.getRequirementElement()));
|
||||||
|
}
|
||||||
|
if (src.hasDerivedFrom()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.derivedFrom", String30_50.convertString(src.getDerivedFromElement()));
|
||||||
|
}
|
||||||
|
for (UrlType ref : src.getSatisfiedBy()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.satisfiedBy", Uri30_50.convertUrl(ref));
|
||||||
|
}
|
||||||
|
for (UrlType ref : src.getReference()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.reference", Uri30_50.convertUrl(ref));
|
||||||
|
}
|
||||||
|
for (Reference ref : src.getSource()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.source", Reference30_50.convertReference(ref));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void convertRequirementsStatement(Extension src, RequirementsStatementComponent tgt) {
|
||||||
|
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt,
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.key",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.label",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.conformance",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.requirement",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.derivedFrom",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.satisfiedBy",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.reference",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.source"
|
||||||
|
);
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.key")) {
|
||||||
|
tgt.setKeyElement(Id30_50.convertId((org.hl7.fhir.dstu3.model.IdType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.key").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.label")) {
|
||||||
|
tgt.setLabelElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.label").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.conformance")) {
|
||||||
|
tgt.addConformance(ConformanceExpectation.fromCode(ext.getValue().primitiveValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.requirement")) {
|
||||||
|
tgt.setRequirementElement(MarkDown30_50.convertMarkdown((org.hl7.fhir.dstu3.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.requirement").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.derivedFrom")) {
|
||||||
|
tgt.setDerivedFromElement(String30_50.convertString((org.hl7.fhir.dstu3.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.derivedFrom").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.satisfiedBy")) {
|
||||||
|
tgt.getSatisfiedBy().add(Uri30_50.convertUrl((org.hl7.fhir.dstu3.model.UriType) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.reference")) {
|
||||||
|
tgt.getReference().add(Uri30_50.convertUrl((org.hl7.fhir.dstu3.model.UriType) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.source")) {
|
||||||
|
tgt.getSource().add(Reference30_50.convertReference((org.hl7.fhir.dstu3.model.Reference) ext.getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,273 @@
|
||||||
|
package org.hl7.fhir.convertors.conv40_50.resources40_50;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.hl7.fhir.convertors.context.ConversionContext40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Annotation40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.CodeableConcept40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Identifier40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.ContactDetail40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.metadata40_50.UsageContext40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Canonical40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.DateTime40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Id40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.MarkDown40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Url40_50;
|
||||||
|
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.special40_50.Reference40_50;
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
import org.hl7.fhir.r4.model.Extension;
|
||||||
|
import org.hl7.fhir.r4.model.UriType;
|
||||||
|
import org.hl7.fhir.r4.utils.ToolingExtensions;
|
||||||
|
import org.hl7.fhir.r5.model.CanonicalType;
|
||||||
|
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||||
|
import org.hl7.fhir.r5.model.CodeableReference;
|
||||||
|
import org.hl7.fhir.r5.model.Coding;
|
||||||
|
import org.hl7.fhir.r5.model.ContactDetail;
|
||||||
|
import org.hl7.fhir.r5.model.Enumeration;
|
||||||
|
import org.hl7.fhir.r5.model.Enumerations.ExampleScenarioActorType;
|
||||||
|
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||||
|
import org.hl7.fhir.r5.model.Reference;
|
||||||
|
import org.hl7.fhir.r5.model.Requirements.ConformanceExpectation;
|
||||||
|
import org.hl7.fhir.r5.model.Requirements.RequirementsStatementComponent;
|
||||||
|
import org.hl7.fhir.r5.model.UrlType;
|
||||||
|
import org.hl7.fhir.r5.model.UsageContext;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
|
||||||
|
public class Requirements40_50 {
|
||||||
|
|
||||||
|
public static org.hl7.fhir.r5.model.Requirements convertRequirements(org.hl7.fhir.r4.model.Basic src) throws FHIRException {
|
||||||
|
if (src == null)
|
||||||
|
return null;
|
||||||
|
if (!src.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "Requirements")) {
|
||||||
|
throw new FHIRException("Error in logic: this basic resource is not an Requirements");
|
||||||
|
}
|
||||||
|
org.hl7.fhir.r5.model.Requirements tgt = new org.hl7.fhir.r5.model.Requirements();
|
||||||
|
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
|
||||||
|
|
||||||
|
for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
|
||||||
|
tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
|
||||||
|
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url")) {
|
||||||
|
tgt.setUrlElement(Uri40_50.convertUri((org.hl7.fhir.r4.model.UriType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version")) {
|
||||||
|
tgt.setVersionElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name")) {
|
||||||
|
tgt.setNameElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title")) {
|
||||||
|
tgt.setTitleElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status")) {
|
||||||
|
tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status").getValue().primitiveValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental")) {
|
||||||
|
tgt.setExperimentalElement(Boolean40_50.convertBoolean((org.hl7.fhir.r4.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date")) {
|
||||||
|
tgt.setDateElement(DateTime40_50.convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher")) {
|
||||||
|
tgt.setPublisherElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact")) {
|
||||||
|
tgt.addContact(ContactDetail40_50.convertContactDetail((org.hl7.fhir.r4.model.ContactDetail) ext.getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description")) {
|
||||||
|
tgt.setPublisherElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext")) {
|
||||||
|
tgt.addUseContext(UsageContext40_50.convertUsageContext((org.hl7.fhir.r4.model.UsageContext) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction")) {
|
||||||
|
tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) ext.getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose")) {
|
||||||
|
tgt.setPurposeElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright")) {
|
||||||
|
tgt.setCopyrightElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel")) {
|
||||||
|
tgt.setCopyrightLabelElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom")) {
|
||||||
|
tgt.getDerivedFrom().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor")) {
|
||||||
|
tgt.getActor().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement")) {
|
||||||
|
convertRequirementsStatement(ext, tgt.addStatement());
|
||||||
|
}
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static org.hl7.fhir.r4.model.Basic convertRequirements(org.hl7.fhir.r5.model.Requirements src) throws FHIRException {
|
||||||
|
if (src == null)
|
||||||
|
return null;
|
||||||
|
org.hl7.fhir.r4.model.Basic tgt = new org.hl7.fhir.r4.model.Basic();
|
||||||
|
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt);
|
||||||
|
tgt.getCode().getCodingFirstRep().setSystem("http://hl7.org/fhir/fhir-types").setCode("Requirements"); // note use of R5 type system
|
||||||
|
|
||||||
|
for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
|
||||||
|
tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
|
||||||
|
if (src.hasUrl()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url", Uri40_50.convertUri(src.getUrlElement()));
|
||||||
|
}
|
||||||
|
if (src.hasVersion()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version", String40_50.convertString(src.getVersionElement()));
|
||||||
|
}
|
||||||
|
if (src.hasName()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name", String40_50.convertString(src.getNameElement()));
|
||||||
|
}
|
||||||
|
if (src.hasTitle()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title", String40_50.convertString(src.getTitleElement()));
|
||||||
|
}
|
||||||
|
if (src.hasStatus()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status", new org.hl7.fhir.r4.model.CodeType(src.getStatus().toCode()));
|
||||||
|
}
|
||||||
|
if (src.hasExperimental()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental", Boolean40_50.convertBoolean(src.getExperimentalElement()));
|
||||||
|
}
|
||||||
|
if (src.hasDate()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date", DateTime40_50.convertDateTime(src.getDateElement()));
|
||||||
|
}
|
||||||
|
if (src.hasPublisher()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher", String40_50.convertString(src.getPublisherElement()));
|
||||||
|
}
|
||||||
|
for (ContactDetail cd : src.getContact()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact", ContactDetail40_50.convertContactDetail(cd));
|
||||||
|
}
|
||||||
|
if (src.hasDescription()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description", MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
|
||||||
|
}
|
||||||
|
for (UsageContext cd : src.getUseContext()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext", UsageContext40_50.convertUsageContext(cd));
|
||||||
|
}
|
||||||
|
for (CodeableConcept cd : src.getJurisdiction()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction", CodeableConcept40_50.convertCodeableConcept(cd));
|
||||||
|
}
|
||||||
|
if (src.hasPurpose()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose", MarkDown40_50.convertMarkdown(src.getPurposeElement()));
|
||||||
|
}
|
||||||
|
if (src.hasCopyright()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright", MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
|
||||||
|
}
|
||||||
|
if (src.hasCopyrightLabel()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel", String40_50.convertString(src.getCopyrightLabelElement()));
|
||||||
|
}
|
||||||
|
for (CanonicalType ref : src.getDerivedFrom()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom", Canonical40_50.convertCanonical(ref));
|
||||||
|
}
|
||||||
|
for (CanonicalType ref : src.getActor()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor", Canonical40_50.convertCanonical(ref));
|
||||||
|
}
|
||||||
|
for (RequirementsStatementComponent ref : src.getStatement()) {
|
||||||
|
org.hl7.fhir.r4.model.Extension tgte = new org.hl7.fhir.r4.model.Extension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement");
|
||||||
|
tgt.addExtension(tgte);
|
||||||
|
convertRequirementsStatement(ref, tgte);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void convertRequirementsStatement(RequirementsStatementComponent src, Extension tgt) {
|
||||||
|
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
|
||||||
|
if (src.hasKey()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.key", Id40_50.convertId(src.getKeyElement()));
|
||||||
|
}
|
||||||
|
if (src.hasLabel()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.label", String40_50.convertString(src.getLabelElement()));
|
||||||
|
}
|
||||||
|
for (Enumeration<ConformanceExpectation> t : src.getConformance()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.conformance", new org.hl7.fhir.r4.model.CodeType(t.getCode()));
|
||||||
|
}
|
||||||
|
if (src.hasRequirement()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.requirement", MarkDown40_50.convertMarkdown(src.getRequirementElement()));
|
||||||
|
}
|
||||||
|
if (src.hasDerivedFrom()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.derivedFrom", String40_50.convertString(src.getDerivedFromElement()));
|
||||||
|
}
|
||||||
|
for (UrlType ref : src.getSatisfiedBy()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.satisfiedBy", Url40_50.convertUrl(ref));
|
||||||
|
}
|
||||||
|
for (UrlType ref : src.getReference()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.reference", Url40_50.convertUrl(ref));
|
||||||
|
}
|
||||||
|
for (Reference ref : src.getSource()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.source", Reference40_50.convertReference(ref));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void convertRequirementsStatement(Extension src, RequirementsStatementComponent tgt) {
|
||||||
|
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt,
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.key",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.label",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.conformance",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.requirement",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.derivedFrom",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.satisfiedBy",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.reference",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.source"
|
||||||
|
);
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.key")) {
|
||||||
|
tgt.setKeyElement(Id40_50.convertId((org.hl7.fhir.r4.model.IdType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.key").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.label")) {
|
||||||
|
tgt.setLabelElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.label").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.conformance")) {
|
||||||
|
tgt.addConformance(ConformanceExpectation.fromCode(ext.getValue().primitiveValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.requirement")) {
|
||||||
|
tgt.setRequirementElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.requirement").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.derivedFrom")) {
|
||||||
|
tgt.setDerivedFromElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.derivedFrom").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.satisfiedBy")) {
|
||||||
|
tgt.getSatisfiedBy().add(Url40_50.convertUrl((org.hl7.fhir.r4.model.UrlType) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.reference")) {
|
||||||
|
tgt.getReference().add(Url40_50.convertUrl((org.hl7.fhir.r4.model.UrlType) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.source")) {
|
||||||
|
tgt.getSource().add(Reference40_50.convertReference((org.hl7.fhir.r4.model.Reference) ext.getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -53,6 +53,8 @@ public class Resource40_50 {
|
||||||
org.hl7.fhir.r4.model.Basic basic = (Basic) src;
|
org.hl7.fhir.r4.model.Basic basic = (Basic) src;
|
||||||
if (basic.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "ActorDefinition")) {
|
if (basic.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "ActorDefinition")) {
|
||||||
return ActorDefinition40_50.convertActorDefinition((org.hl7.fhir.r4.model.Basic) src);
|
return ActorDefinition40_50.convertActorDefinition((org.hl7.fhir.r4.model.Basic) src);
|
||||||
|
} else if (basic.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "Requirements")) {
|
||||||
|
return Requirements40_50.convertRequirements((org.hl7.fhir.r4.model.Basic) src);
|
||||||
} else {
|
} else {
|
||||||
return Basic40_50.convertBasic((org.hl7.fhir.r4.model.Basic) src);
|
return Basic40_50.convertBasic((org.hl7.fhir.r4.model.Basic) src);
|
||||||
}
|
}
|
||||||
|
@ -468,6 +470,8 @@ public class Resource40_50 {
|
||||||
return QuestionnaireResponse40_50.convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src);
|
return QuestionnaireResponse40_50.convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src);
|
||||||
if (src instanceof org.hl7.fhir.r5.model.RelatedPerson)
|
if (src instanceof org.hl7.fhir.r5.model.RelatedPerson)
|
||||||
return RelatedPerson40_50.convertRelatedPerson((org.hl7.fhir.r5.model.RelatedPerson) src);
|
return RelatedPerson40_50.convertRelatedPerson((org.hl7.fhir.r5.model.RelatedPerson) src);
|
||||||
|
if (src instanceof org.hl7.fhir.r5.model.Requirements)
|
||||||
|
return Requirements40_50.convertRequirements((org.hl7.fhir.r5.model.Requirements) src);
|
||||||
if (src instanceof org.hl7.fhir.r5.model.RiskAssessment)
|
if (src instanceof org.hl7.fhir.r5.model.RiskAssessment)
|
||||||
return RiskAssessment40_50.convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src);
|
return RiskAssessment40_50.convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src);
|
||||||
if (src instanceof org.hl7.fhir.r5.model.Schedule)
|
if (src instanceof org.hl7.fhir.r5.model.Schedule)
|
||||||
|
|
|
@ -0,0 +1,273 @@
|
||||||
|
package org.hl7.fhir.convertors.conv43_50.resources43_50;
|
||||||
|
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.hl7.fhir.convertors.context.ConversionContext43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Annotation43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.CodeableConcept43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Identifier43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.ContactDetail43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.metadata43_50.UsageContext43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Canonical43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.DateTime43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Id43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.MarkDown43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.String43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Uri43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Url43_50;
|
||||||
|
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.special43_50.Reference43_50;
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
import org.hl7.fhir.r4b.model.Extension;
|
||||||
|
import org.hl7.fhir.r4b.model.UriType;
|
||||||
|
import org.hl7.fhir.r4b.utils.ToolingExtensions;
|
||||||
|
import org.hl7.fhir.r5.model.CanonicalType;
|
||||||
|
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||||
|
import org.hl7.fhir.r5.model.CodeableReference;
|
||||||
|
import org.hl7.fhir.r5.model.Coding;
|
||||||
|
import org.hl7.fhir.r5.model.ContactDetail;
|
||||||
|
import org.hl7.fhir.r5.model.Enumeration;
|
||||||
|
import org.hl7.fhir.r5.model.Enumerations.ExampleScenarioActorType;
|
||||||
|
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||||
|
import org.hl7.fhir.r5.model.Reference;
|
||||||
|
import org.hl7.fhir.r5.model.Requirements.ConformanceExpectation;
|
||||||
|
import org.hl7.fhir.r5.model.Requirements.RequirementsStatementComponent;
|
||||||
|
import org.hl7.fhir.r5.model.UrlType;
|
||||||
|
import org.hl7.fhir.r5.model.UsageContext;
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright (c) 2011+, HL7, Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice, this
|
||||||
|
list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of HL7 nor the names of its contributors may be used to
|
||||||
|
endorse or promote products derived from this software without specific
|
||||||
|
prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
||||||
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
// Generated on Sun, Feb 24, 2019 11:37+1100 for FHIR v4.0.0
|
||||||
|
public class Requirements43_50 {
|
||||||
|
|
||||||
|
public static org.hl7.fhir.r5.model.Requirements convertRequirements(org.hl7.fhir.r4b.model.Basic src) throws FHIRException {
|
||||||
|
if (src == null)
|
||||||
|
return null;
|
||||||
|
if (!src.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "Requirements")) {
|
||||||
|
throw new FHIRException("Error in logic: this basic resource is not an Requirements");
|
||||||
|
}
|
||||||
|
org.hl7.fhir.r5.model.Requirements tgt = new org.hl7.fhir.r5.model.Requirements();
|
||||||
|
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
|
||||||
|
|
||||||
|
for (org.hl7.fhir.r4b.model.Identifier t : src.getIdentifier())
|
||||||
|
tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
|
||||||
|
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url")) {
|
||||||
|
tgt.setUrlElement(Uri43_50.convertUri((org.hl7.fhir.r4b.model.UriType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version")) {
|
||||||
|
tgt.setVersionElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name")) {
|
||||||
|
tgt.setNameElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title")) {
|
||||||
|
tgt.setTitleElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status")) {
|
||||||
|
tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status").getValue().primitiveValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental")) {
|
||||||
|
tgt.setExperimentalElement(Boolean43_50.convertBoolean((org.hl7.fhir.r4b.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date")) {
|
||||||
|
tgt.setDateElement(DateTime43_50.convertDateTime((org.hl7.fhir.r4b.model.DateTimeType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher")) {
|
||||||
|
tgt.setPublisherElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact")) {
|
||||||
|
tgt.addContact(ContactDetail43_50.convertContactDetail((org.hl7.fhir.r4b.model.ContactDetail) ext.getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description")) {
|
||||||
|
tgt.setPublisherElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext")) {
|
||||||
|
tgt.addUseContext(UsageContext43_50.convertUsageContext((org.hl7.fhir.r4b.model.UsageContext) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction")) {
|
||||||
|
tgt.addJurisdiction(CodeableConcept43_50.convertCodeableConcept((org.hl7.fhir.r4b.model.CodeableConcept) ext.getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose")) {
|
||||||
|
tgt.setPurposeElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright")) {
|
||||||
|
tgt.setCopyrightElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel")) {
|
||||||
|
tgt.setCopyrightLabelElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom")) {
|
||||||
|
tgt.getDerivedFrom().add(Canonical43_50.convertCanonical((org.hl7.fhir.r4b.model.CanonicalType) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor")) {
|
||||||
|
tgt.getActor().add(Canonical43_50.convertCanonical((org.hl7.fhir.r4b.model.CanonicalType) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement")) {
|
||||||
|
convertRequirementsStatement(ext, tgt.addStatement());
|
||||||
|
}
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static org.hl7.fhir.r4b.model.Basic convertRequirements(org.hl7.fhir.r5.model.Requirements src) throws FHIRException {
|
||||||
|
if (src == null)
|
||||||
|
return null;
|
||||||
|
org.hl7.fhir.r4b.model.Basic tgt = new org.hl7.fhir.r4b.model.Basic();
|
||||||
|
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyDomainResource(src, tgt);
|
||||||
|
tgt.getCode().getCodingFirstRep().setSystem("http://hl7.org/fhir/fhir-types").setCode("Requirements"); // note use of R5 type system
|
||||||
|
|
||||||
|
for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
|
||||||
|
tgt.addIdentifier(Identifier43_50.convertIdentifier(t));
|
||||||
|
if (src.hasUrl()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.url", Uri43_50.convertUri(src.getUrlElement()));
|
||||||
|
}
|
||||||
|
if (src.hasVersion()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.version", String43_50.convertString(src.getVersionElement()));
|
||||||
|
}
|
||||||
|
if (src.hasName()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.name", String43_50.convertString(src.getNameElement()));
|
||||||
|
}
|
||||||
|
if (src.hasTitle()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title", String43_50.convertString(src.getTitleElement()));
|
||||||
|
}
|
||||||
|
if (src.hasStatus()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.status", new org.hl7.fhir.r4b.model.CodeType(src.getStatus().toCode()));
|
||||||
|
}
|
||||||
|
if (src.hasExperimental()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.experimental", Boolean43_50.convertBoolean(src.getExperimentalElement()));
|
||||||
|
}
|
||||||
|
if (src.hasDate()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.date", DateTime43_50.convertDateTime(src.getDateElement()));
|
||||||
|
}
|
||||||
|
if (src.hasPublisher()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.publisher", String43_50.convertString(src.getPublisherElement()));
|
||||||
|
}
|
||||||
|
for (ContactDetail cd : src.getContact()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.contact", ContactDetail43_50.convertContactDetail(cd));
|
||||||
|
}
|
||||||
|
if (src.hasDescription()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.description", MarkDown43_50.convertMarkdown(src.getDescriptionElement()));
|
||||||
|
}
|
||||||
|
for (UsageContext cd : src.getUseContext()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.useContext", UsageContext43_50.convertUsageContext(cd));
|
||||||
|
}
|
||||||
|
for (CodeableConcept cd : src.getJurisdiction()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.jurisdiction", CodeableConcept43_50.convertCodeableConcept(cd));
|
||||||
|
}
|
||||||
|
if (src.hasPurpose()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.purpose", MarkDown43_50.convertMarkdown(src.getPurposeElement()));
|
||||||
|
}
|
||||||
|
if (src.hasCopyright()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyright", MarkDown43_50.convertMarkdown(src.getCopyrightElement()));
|
||||||
|
}
|
||||||
|
if (src.hasCopyrightLabel()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.copyrightLabel", String43_50.convertString(src.getCopyrightLabelElement()));
|
||||||
|
}
|
||||||
|
for (CanonicalType ref : src.getDerivedFrom()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.derivedFrom", Canonical43_50.convertCanonical(ref));
|
||||||
|
}
|
||||||
|
for (CanonicalType ref : src.getActor()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.actor", Canonical43_50.convertCanonical(ref));
|
||||||
|
}
|
||||||
|
for (RequirementsStatementComponent ref : src.getStatement()) {
|
||||||
|
org.hl7.fhir.r4b.model.Extension tgte = new org.hl7.fhir.r4b.model.Extension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement");
|
||||||
|
tgt.addExtension(tgte);
|
||||||
|
convertRequirementsStatement(ref, tgte);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void convertRequirementsStatement(RequirementsStatementComponent src, Extension tgt) {
|
||||||
|
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
|
||||||
|
if (src.hasKey()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.key", Id43_50.convertId(src.getKeyElement()));
|
||||||
|
}
|
||||||
|
if (src.hasLabel()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.label", String43_50.convertString(src.getLabelElement()));
|
||||||
|
}
|
||||||
|
for (Enumeration<ConformanceExpectation> t : src.getConformance()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.conformance", new org.hl7.fhir.r4b.model.CodeType(t.getCode()));
|
||||||
|
}
|
||||||
|
if (src.hasRequirement()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.requirement", MarkDown43_50.convertMarkdown(src.getRequirementElement()));
|
||||||
|
}
|
||||||
|
if (src.hasDerivedFrom()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.derivedFrom", String43_50.convertString(src.getDerivedFromElement()));
|
||||||
|
}
|
||||||
|
for (UrlType ref : src.getSatisfiedBy()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.satisfiedBy", Url43_50.convertUrl(ref));
|
||||||
|
}
|
||||||
|
for (UrlType ref : src.getReference()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.reference", Url43_50.convertUrl(ref));
|
||||||
|
}
|
||||||
|
for (Reference ref : src.getSource()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.source", Reference43_50.convertReference(ref));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void convertRequirementsStatement(Extension src, RequirementsStatementComponent tgt) {
|
||||||
|
ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt,
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.key",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.label",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.conformance",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.requirement",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.derivedFrom",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.satisfiedBy",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.reference",
|
||||||
|
"http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.source"
|
||||||
|
);
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.key")) {
|
||||||
|
tgt.setKeyElement(Id43_50.convertId((org.hl7.fhir.r4b.model.IdType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.key").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.label")) {
|
||||||
|
tgt.setLabelElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.label").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.conformance")) {
|
||||||
|
tgt.addConformance(ConformanceExpectation.fromCode(ext.getValue().primitiveValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.requirement")) {
|
||||||
|
tgt.setRequirementElement(MarkDown43_50.convertMarkdown((org.hl7.fhir.r4b.model.MarkdownType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.requirement").getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.derivedFrom")) {
|
||||||
|
tgt.setDerivedFromElement(String43_50.convertString((org.hl7.fhir.r4b.model.StringType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.derivedFrom").getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.satisfiedBy")) {
|
||||||
|
tgt.getSatisfiedBy().add(Url43_50.convertUrl((org.hl7.fhir.r4b.model.UrlType) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.reference")) {
|
||||||
|
tgt.getReference().add(Url43_50.convertUrl((org.hl7.fhir.r4b.model.UrlType) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.source")) {
|
||||||
|
tgt.getSource().add(Reference43_50.convertReference((org.hl7.fhir.r4b.model.Reference) ext.getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -55,6 +55,8 @@ public class Resource43_50 {
|
||||||
org.hl7.fhir.r4b.model.Basic basic = (org.hl7.fhir.r4b.model.Basic) src;
|
org.hl7.fhir.r4b.model.Basic basic = (org.hl7.fhir.r4b.model.Basic) src;
|
||||||
if (basic.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "ActorDefinition")) {
|
if (basic.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "ActorDefinition")) {
|
||||||
return ActorDefinition43_50.convertActorDefinition((org.hl7.fhir.r4b.model.Basic) src);
|
return ActorDefinition43_50.convertActorDefinition((org.hl7.fhir.r4b.model.Basic) src);
|
||||||
|
} else if (basic.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "Requirements")) {
|
||||||
|
return Requirements43_50.convertRequirements((org.hl7.fhir.r4b.model.Basic) src);
|
||||||
} else {
|
} else {
|
||||||
return Basic43_50.convertBasic((org.hl7.fhir.r4b.model.Basic) src);
|
return Basic43_50.convertBasic((org.hl7.fhir.r4b.model.Basic) src);
|
||||||
}
|
}
|
||||||
|
@ -460,6 +462,8 @@ public class Resource43_50 {
|
||||||
return QuestionnaireResponse43_50.convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src);
|
return QuestionnaireResponse43_50.convertQuestionnaireResponse((org.hl7.fhir.r5.model.QuestionnaireResponse) src);
|
||||||
if (src instanceof org.hl7.fhir.r5.model.RelatedPerson)
|
if (src instanceof org.hl7.fhir.r5.model.RelatedPerson)
|
||||||
return RelatedPerson43_50.convertRelatedPerson((org.hl7.fhir.r5.model.RelatedPerson) src);
|
return RelatedPerson43_50.convertRelatedPerson((org.hl7.fhir.r5.model.RelatedPerson) src);
|
||||||
|
if (src instanceof org.hl7.fhir.r5.model.Requirements)
|
||||||
|
return Requirements43_50.convertRequirements((org.hl7.fhir.r5.model.Requirements) src);
|
||||||
if (src instanceof org.hl7.fhir.r5.model.RiskAssessment)
|
if (src instanceof org.hl7.fhir.r5.model.RiskAssessment)
|
||||||
return RiskAssessment43_50.convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src);
|
return RiskAssessment43_50.convertRiskAssessment((org.hl7.fhir.r5.model.RiskAssessment) src);
|
||||||
if (src instanceof org.hl7.fhir.r5.model.Schedule)
|
if (src instanceof org.hl7.fhir.r5.model.Schedule)
|
||||||
|
|
|
@ -36,52 +36,4 @@ public class ActorDefinition30_50Test {
|
||||||
|
|
||||||
assertTrue(r5_actual.equalsDeep(r5_conv), "should be the same");
|
assertTrue(r5_actual.equalsDeep(r5_conv), "should be the same");
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
|
||||||
// @DisplayName("Test r5 -> r4 AuditEvent conversion.")
|
|
||||||
// public void testR4_R5() throws IOException {
|
|
||||||
// InputStream r4_input = this.getClass().getResourceAsStream("/auditevent_40_with_base64binary.xml");
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.dstu3.model.AuditEvent r4_actual = (org.hl7.fhir.dstu3.model.AuditEvent) new org.hl7.fhir.dstu3.formats.XmlParser().parse(r4_input);
|
|
||||||
// org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_30_50.convertResource(r4_actual);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.formats.XmlParser r5_parser = new org.hl7.fhir.r5.formats.XmlParser();
|
|
||||||
//
|
|
||||||
// ByteArrayOutputStream stream
|
|
||||||
// = new ByteArrayOutputStream();
|
|
||||||
//
|
|
||||||
// r5_parser.compose(stream, r5_conv);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.model.Resource r5_streamed = (org.hl7.fhir.r5.model.AuditEvent) new org.hl7.fhir.r5.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray()));
|
|
||||||
//
|
|
||||||
// assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_conv).getEntity().get(0).getQuery(), THE_BASE_64_BINARY_BYTE_ARRAY);
|
|
||||||
// assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_streamed).getEntity().get(0).getQuery(), THE_BASE_64_BINARY_BYTE_ARRAY);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// @DisplayName("Test r5 -> r4 AuditEvent conversion with invalid Base64Binary.")
|
|
||||||
// public void testR4_R5BadBase64Binary() throws IOException {
|
|
||||||
// InputStream r4_input = this.getClass().getResourceAsStream("/auditevent_40_with_invalid_base64binary.xml");
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.dstu3.model.AuditEvent r4_actual = (org.hl7.fhir.dstu3.model.AuditEvent) new org.hl7.fhir.dstu3.formats.XmlParser().parse(r4_input);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_30_50.convertResource(r4_actual);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.formats.XmlParser r5_parser = new org.hl7.fhir.r5.formats.XmlParser();
|
|
||||||
//
|
|
||||||
// ByteArrayOutputStream stream
|
|
||||||
// = new ByteArrayOutputStream();
|
|
||||||
//
|
|
||||||
// r5_parser.compose(stream, r5_conv);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.model.Resource r5_streamed = (org.hl7.fhir.r5.model.AuditEvent) new org.hl7.fhir.r5.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray()));
|
|
||||||
//
|
|
||||||
// System.out.println(((org.hl7.fhir.r5.model.AuditEvent)r5_conv).getEntity().get(0).getQueryElement().getValueAsString());
|
|
||||||
//
|
|
||||||
// //FIXME we should not be even getting this far.
|
|
||||||
// assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_conv).getEntity().get(0).getQuery(), INVALID_BASE_64_BINARY_BYTE_ARRAY);
|
|
||||||
// assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_streamed).getEntity().get(0).getQuery(), INVALID_BASE_64_BINARY_BYTE_ARRAY);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package org.hl7.fhir.convertors.conv30_50;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50;
|
||||||
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
public class Requirements30_50Test {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test r5 -> r3 Requirements conversion.")
|
||||||
|
public void testR5_R4() throws IOException {
|
||||||
|
InputStream r5_input = this.getClass().getResourceAsStream("/requirements_50_example.json");
|
||||||
|
|
||||||
|
org.hl7.fhir.r5.model.Requirements r5_actual = (org.hl7.fhir.r5.model.Requirements) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_input);
|
||||||
|
org.hl7.fhir.dstu3.model.Resource r4_conv = VersionConvertorFactory_30_50.convertResource(r5_actual);
|
||||||
|
|
||||||
|
org.hl7.fhir.dstu3.formats.XmlParser r4_parser = new org.hl7.fhir.dstu3.formats.XmlParser();
|
||||||
|
|
||||||
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||||
|
r4_parser.compose(stream, r4_conv);
|
||||||
|
|
||||||
|
org.hl7.fhir.dstu3.model.Resource r4_streamed = (org.hl7.fhir.dstu3.model.Basic) new org.hl7.fhir.dstu3.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray()));
|
||||||
|
org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_30_50.convertResource(r4_streamed);
|
||||||
|
|
||||||
|
assertTrue(r5_actual.equalsDeep(r5_conv), "should be the same");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -36,52 +36,4 @@ public class ActorDefinition40_50Test {
|
||||||
|
|
||||||
assertTrue(r5_actual.equalsDeep(r5_conv), "should be the same");
|
assertTrue(r5_actual.equalsDeep(r5_conv), "should be the same");
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
|
||||||
// @DisplayName("Test r5 -> r4 AuditEvent conversion.")
|
|
||||||
// public void testR4_R5() throws IOException {
|
|
||||||
// InputStream r4_input = this.getClass().getResourceAsStream("/auditevent_40_with_base64binary.xml");
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r4.model.AuditEvent r4_actual = (org.hl7.fhir.r4.model.AuditEvent) new org.hl7.fhir.r4.formats.XmlParser().parse(r4_input);
|
|
||||||
// org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_40_50.convertResource(r4_actual);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.formats.XmlParser r5_parser = new org.hl7.fhir.r5.formats.XmlParser();
|
|
||||||
//
|
|
||||||
// ByteArrayOutputStream stream
|
|
||||||
// = new ByteArrayOutputStream();
|
|
||||||
//
|
|
||||||
// r5_parser.compose(stream, r5_conv);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.model.Resource r5_streamed = (org.hl7.fhir.r5.model.AuditEvent) new org.hl7.fhir.r5.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray()));
|
|
||||||
//
|
|
||||||
// assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_conv).getEntity().get(0).getQuery(), THE_BASE_64_BINARY_BYTE_ARRAY);
|
|
||||||
// assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_streamed).getEntity().get(0).getQuery(), THE_BASE_64_BINARY_BYTE_ARRAY);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// @DisplayName("Test r5 -> r4 AuditEvent conversion with invalid Base64Binary.")
|
|
||||||
// public void testR4_R5BadBase64Binary() throws IOException {
|
|
||||||
// InputStream r4_input = this.getClass().getResourceAsStream("/auditevent_40_with_invalid_base64binary.xml");
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r4.model.AuditEvent r4_actual = (org.hl7.fhir.r4.model.AuditEvent) new org.hl7.fhir.r4.formats.XmlParser().parse(r4_input);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_40_50.convertResource(r4_actual);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.formats.XmlParser r5_parser = new org.hl7.fhir.r5.formats.XmlParser();
|
|
||||||
//
|
|
||||||
// ByteArrayOutputStream stream
|
|
||||||
// = new ByteArrayOutputStream();
|
|
||||||
//
|
|
||||||
// r5_parser.compose(stream, r5_conv);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.model.Resource r5_streamed = (org.hl7.fhir.r5.model.AuditEvent) new org.hl7.fhir.r5.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray()));
|
|
||||||
//
|
|
||||||
// System.out.println(((org.hl7.fhir.r5.model.AuditEvent)r5_conv).getEntity().get(0).getQueryElement().getValueAsString());
|
|
||||||
//
|
|
||||||
// //FIXME we should not be even getting this far.
|
|
||||||
// assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_conv).getEntity().get(0).getQuery(), INVALID_BASE_64_BINARY_BYTE_ARRAY);
|
|
||||||
// assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_streamed).getEntity().get(0).getQuery(), INVALID_BASE_64_BINARY_BYTE_ARRAY);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package org.hl7.fhir.convertors.conv40_50;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||||
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
public class Requirements40_50Test {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test r5 -> r4 Requirements conversion.")
|
||||||
|
public void testR5_R4() throws IOException {
|
||||||
|
InputStream r5_input = this.getClass().getResourceAsStream("/requirements_50_example.json");
|
||||||
|
|
||||||
|
org.hl7.fhir.r5.model.Requirements r5_actual = (org.hl7.fhir.r5.model.Requirements) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_input);
|
||||||
|
org.hl7.fhir.r4.model.Resource r4_conv = VersionConvertorFactory_40_50.convertResource(r5_actual);
|
||||||
|
|
||||||
|
org.hl7.fhir.r4.formats.XmlParser r4_parser = new org.hl7.fhir.r4.formats.XmlParser();
|
||||||
|
|
||||||
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||||
|
r4_parser.compose(stream, r4_conv);
|
||||||
|
|
||||||
|
org.hl7.fhir.r4.model.Resource r4_streamed = (org.hl7.fhir.r4.model.Basic) new org.hl7.fhir.r4.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray()));
|
||||||
|
org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_40_50.convertResource(r4_streamed);
|
||||||
|
|
||||||
|
assertTrue(r5_actual.equalsDeep(r5_conv), "should be the same");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -36,51 +36,4 @@ public class ActorDefinition43_50Test {
|
||||||
assertTrue(r5_actual.equalsDeep(r5_conv), "should be the same");
|
assertTrue(r5_actual.equalsDeep(r5_conv), "should be the same");
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Test
|
|
||||||
// @DisplayName("Test r5 -> r4 AuditEvent conversion.")
|
|
||||||
// public void testR4_R5() throws IOException {
|
|
||||||
// InputStream r4_input = this.getClass().getResourceAsStream("/auditevent_40_with_base64binary.xml");
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r4b.model.AuditEvent r4_actual = (org.hl7.fhir.r4b.model.AuditEvent) new org.hl7.fhir.r4b.formats.XmlParser().parse(r4_input);
|
|
||||||
// org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_43_50.convertResource(r4_actual);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.formats.XmlParser r5_parser = new org.hl7.fhir.r5.formats.XmlParser();
|
|
||||||
//
|
|
||||||
// ByteArrayOutputStream stream
|
|
||||||
// = new ByteArrayOutputStream();
|
|
||||||
//
|
|
||||||
// r5_parser.compose(stream, r5_conv);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.model.Resource r5_streamed = (org.hl7.fhir.r5.model.AuditEvent) new org.hl7.fhir.r5.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray()));
|
|
||||||
//
|
|
||||||
// assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_conv).getEntity().get(0).getQuery(), THE_BASE_64_BINARY_BYTE_ARRAY);
|
|
||||||
// assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_streamed).getEntity().get(0).getQuery(), THE_BASE_64_BINARY_BYTE_ARRAY);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// @DisplayName("Test r5 -> r4 AuditEvent conversion with invalid Base64Binary.")
|
|
||||||
// public void testR4_R5BadBase64Binary() throws IOException {
|
|
||||||
// InputStream r4_input = this.getClass().getResourceAsStream("/auditevent_40_with_invalid_base64binary.xml");
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r4b.model.AuditEvent r4_actual = (org.hl7.fhir.r4b.model.AuditEvent) new org.hl7.fhir.r4b.formats.XmlParser().parse(r4_input);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_43_50.convertResource(r4_actual);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.formats.XmlParser r5_parser = new org.hl7.fhir.r5.formats.XmlParser();
|
|
||||||
//
|
|
||||||
// ByteArrayOutputStream stream
|
|
||||||
// = new ByteArrayOutputStream();
|
|
||||||
//
|
|
||||||
// r5_parser.compose(stream, r5_conv);
|
|
||||||
//
|
|
||||||
// org.hl7.fhir.r5.model.Resource r5_streamed = (org.hl7.fhir.r5.model.AuditEvent) new org.hl7.fhir.r5.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray()));
|
|
||||||
//
|
|
||||||
// System.out.println(((org.hl7.fhir.r5.model.AuditEvent)r5_conv).getEntity().get(0).getQueryElement().getValueAsString());
|
|
||||||
//
|
|
||||||
// //FIXME we should not be even getting this far.
|
|
||||||
// assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_conv).getEntity().get(0).getQuery(), INVALID_BASE_64_BINARY_BYTE_ARRAY);
|
|
||||||
// assertArrayEquals(((org.hl7.fhir.r5.model.AuditEvent)r5_streamed).getEntity().get(0).getQuery(), INVALID_BASE_64_BINARY_BYTE_ARRAY);
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package org.hl7.fhir.convertors.conv43_50;
|
||||||
|
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_43_50;
|
||||||
|
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
public class Requirements43_50Test {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test r5 -> r4 Requirements conversion.")
|
||||||
|
public void testR5_R4() throws IOException {
|
||||||
|
InputStream r5_input = this.getClass().getResourceAsStream("/requirements_50_example.json");
|
||||||
|
|
||||||
|
org.hl7.fhir.r5.model.Requirements r5_actual = (org.hl7.fhir.r5.model.Requirements) new org.hl7.fhir.r5.formats.JsonParser().parse(r5_input);
|
||||||
|
org.hl7.fhir.r4b.model.Resource r4_conv = VersionConvertorFactory_43_50.convertResource(r5_actual);
|
||||||
|
|
||||||
|
org.hl7.fhir.r4b.formats.XmlParser r4_parser = new org.hl7.fhir.r4b.formats.XmlParser();
|
||||||
|
|
||||||
|
ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
||||||
|
r4_parser.compose(stream, r4_conv);
|
||||||
|
|
||||||
|
org.hl7.fhir.r4b.model.Resource r4_streamed = (org.hl7.fhir.r4b.model.Basic) new org.hl7.fhir.r4b.formats.XmlParser().parse(new ByteArrayInputStream(stream.toByteArray()));
|
||||||
|
org.hl7.fhir.r5.model.Resource r5_conv = VersionConvertorFactory_43_50.convertResource(r4_streamed);
|
||||||
|
|
||||||
|
assertTrue(r5_actual.equalsDeep(r5_conv), "should be the same");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"resourceType": "Requirements",
|
||||||
|
"id": "example1",
|
||||||
|
"text": {
|
||||||
|
"status": "generated",
|
||||||
|
"div": "<div xmlns=\"http://www.w3.org/1999/xhtml\"><p><b>Generated Narrative: Requirements</b><a name=\"example1\"> </a></p><div style=\"display: inline-block; background-color: #d9e0e7; padding: 6px; margin: 4px; border: 1px solid #8da1b4; border-radius: 5px; line-height: 60%\"><p style=\"margin-bottom: 0px\">Resource Requirements "example1" </p></div><p><b>url</b>: <a href=\"http://hl7.org/fhir/Requirements/example1\">http://hl7.org/fhir/Requirements/example1</a></p><p><b>identifier</b>: id: urn:oid:2.16.840.1.113883.4.642.18.1</p><p><b>name</b>: ExampleRequirements1</p><p><b>title</b>: Example Requirements Set 1</p><p><b>status</b>: active</p><p><b>date</b>: 2021-11-02T14:31:30.239Z</p><p><b>actor</b>: <a href=\"http://hl7.org/fhir/ActorDefinition/server\">http://hl7.org/fhir/ActorDefinition/server</a></p><blockquote><p><b>statement</b></p><p><b>key</b>: req-1</p><p><b>conformance</b>: <span title=\" \n\t\t<label value="requirement-1"/>\n\t\tsince this is commented out, it's simply 'req-1'\n\t\t \">SHALL</span></p><p><b>requirement</b>: The server SHALL support expanding value sets</p><p><b>satisfiedBy</b>: <a href=\"http://hl7.org/fhir/terminology-service.html#expand\">http://hl7.org/fhir/terminology-service.html#expand</a></p><p><b>source</b>: <span>: Grahame Grieve</span></p></blockquote><blockquote><p><b>statement</b></p><p><b>key</b>: 46f77dcd-d51e-4738-b61f-22506d0cb0ac</p><p><b>label</b>: requirement-2</p><p><b>conformance</b>: SHALL</p><p><b>requirement</b>: Operations based on the codeSystem resource SHALL have the same result whether or not the relationships are represented explicitly as properties or implicitly using the CodeSystem resource hierarchy</p><p><b>source</b>: <span>: Jose Costa Teixeira</span></p></blockquote></div>"
|
||||||
|
},
|
||||||
|
"url": "http://hl7.org/fhir/Requirements/example1",
|
||||||
|
"identifier": [
|
||||||
|
{
|
||||||
|
"system": "urn:ietf:rfc:3986",
|
||||||
|
"value": "urn:oid:2.16.840.1.113883.4.642.18.1"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "ExampleRequirements1",
|
||||||
|
"title": "Example Requirements Set 1",
|
||||||
|
"status": "active",
|
||||||
|
"date": "2021-11-02T14:31:30.239Z",
|
||||||
|
"actor": [
|
||||||
|
"http://hl7.org/fhir/ActorDefinition/server"
|
||||||
|
],
|
||||||
|
"statement": [
|
||||||
|
{
|
||||||
|
"key": "req-1",
|
||||||
|
"conformance": [
|
||||||
|
"SHALL"
|
||||||
|
],
|
||||||
|
"requirement": "The server SHALL support expanding value sets",
|
||||||
|
"satisfiedBy": [
|
||||||
|
"http://hl7.org/fhir/terminology-service.html#expand"
|
||||||
|
],
|
||||||
|
"source": [
|
||||||
|
{
|
||||||
|
"display": "Grahame Grieve"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "46f77dcd-d51e-4738-b61f-22506d0cb0ac",
|
||||||
|
"label": "requirement-2",
|
||||||
|
"conformance": [
|
||||||
|
"SHALL"
|
||||||
|
],
|
||||||
|
"requirement": "Operations based on the codeSystem resource SHALL have the same result whether or not the relationships are represented explicitly as properties or implicitly using the CodeSystem resource hierarchy",
|
||||||
|
"source": [
|
||||||
|
{
|
||||||
|
"display": "Jose Costa Teixeira"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -173,6 +173,23 @@ public abstract class Element extends Base implements IBaseHasExtensions, IBaseE
|
||||||
return getExtension().get(0);
|
return getExtension().get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Extension getExtensionByUrl(String theUrl) {
|
||||||
|
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||||
|
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||||
|
for (Extension next : getExtension()) {
|
||||||
|
if (theUrl.equals(next.getUrl())) {
|
||||||
|
retVal.add(next);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (retVal.size() == 0)
|
||||||
|
return null;
|
||||||
|
else {
|
||||||
|
org.apache.commons.lang3.Validate.isTrue(retVal.size() == 1, "Url "+theUrl+" must have only one match");
|
||||||
|
return retVal.get(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an unmodifiable list containing all extensions on this element which
|
* Returns an unmodifiable list containing all extensions on this element which
|
||||||
* match the given URL.
|
* match the given URL.
|
||||||
|
|
|
@ -300,7 +300,7 @@ public class Property {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected List<Property> getChildProperties(String elementName, String statedType) throws FHIRException {
|
public List<Property> getChildProperties(String elementName, String statedType) throws FHIRException {
|
||||||
ElementDefinition ed = definition;
|
ElementDefinition ed = definition;
|
||||||
StructureDefinition sd = structure;
|
StructureDefinition sd = structure;
|
||||||
SourcedChildDefinitions children = profileUtilities.getChildMap(sd, ed);
|
SourcedChildDefinitions children = profileUtilities.getChildMap(sd, ed);
|
||||||
|
|
Loading…
Reference in New Issue