Merge pull request #1275 from hapifhir/gg-202304-subscription-topic
Gg 202304 subscription topic
This commit is contained in:
commit
3810f29b07
|
@ -13,5 +13,6 @@
|
||||||
|
|
||||||
* Add support for R4B to loader
|
* Add support for R4B to loader
|
||||||
* Change type if cache-id parameter
|
* Change type if cache-id parameter
|
||||||
|
* Change snapshot generation to not update documentation from profile for elements with profiled types that are not extensions
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,8 @@ public class Resource40_50 {
|
||||||
return Requirements40_50.convertRequirements((org.hl7.fhir.r4.model.Basic) src);
|
return Requirements40_50.convertRequirements((org.hl7.fhir.r4.model.Basic) src);
|
||||||
} else if (basic.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "TestPlan")) {
|
} else if (basic.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "TestPlan")) {
|
||||||
return TestPlan40_50.convertTestPlan((org.hl7.fhir.r4.model.Basic) src);
|
return TestPlan40_50.convertTestPlan((org.hl7.fhir.r4.model.Basic) src);
|
||||||
|
} else if (basic.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "SubscriptionTopic")) {
|
||||||
|
return SubscriptionTopic40_50.convertSubscriptionTopic((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);
|
||||||
}
|
}
|
||||||
|
@ -493,6 +495,8 @@ public class Resource40_50 {
|
||||||
return StructureDefinition40_50.convertStructureDefinition((org.hl7.fhir.r5.model.StructureDefinition) src);
|
return StructureDefinition40_50.convertStructureDefinition((org.hl7.fhir.r5.model.StructureDefinition) src);
|
||||||
if (src instanceof org.hl7.fhir.r5.model.StructureMap)
|
if (src instanceof org.hl7.fhir.r5.model.StructureMap)
|
||||||
return StructureMap40_50.convertStructureMap((org.hl7.fhir.r5.model.StructureMap) src);
|
return StructureMap40_50.convertStructureMap((org.hl7.fhir.r5.model.StructureMap) src);
|
||||||
|
if (src instanceof org.hl7.fhir.r5.model.SubscriptionTopic)
|
||||||
|
return SubscriptionTopic40_50.convertSubscriptionTopic((org.hl7.fhir.r5.model.SubscriptionTopic) src);
|
||||||
if (src instanceof org.hl7.fhir.r5.model.Substance)
|
if (src instanceof org.hl7.fhir.r5.model.Substance)
|
||||||
return Substance40_50.convertSubstance((org.hl7.fhir.r5.model.Substance) src);
|
return Substance40_50.convertSubstance((org.hl7.fhir.r5.model.Substance) src);
|
||||||
if (src instanceof org.hl7.fhir.r5.model.SubstanceNucleicAcid)
|
if (src instanceof org.hl7.fhir.r5.model.SubstanceNucleicAcid)
|
||||||
|
|
|
@ -0,0 +1,476 @@
|
||||||
|
package org.hl7.fhir.convertors.conv40_50.resources40_50;
|
||||||
|
|
||||||
|
import org.hl7.fhir.convertors.context.ConversionContext40_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.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.exceptions.FHIRException;
|
||||||
|
import org.hl7.fhir.r4.model.BooleanType;
|
||||||
|
import org.hl7.fhir.r4.model.Extension;
|
||||||
|
import org.hl7.fhir.r4.model.MarkdownType;
|
||||||
|
import org.hl7.fhir.r4.model.UriType;
|
||||||
|
import org.hl7.fhir.r5.model.CanonicalType;
|
||||||
|
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||||
|
import org.hl7.fhir.r5.model.ContactDetail;
|
||||||
|
import org.hl7.fhir.r5.model.Enumeration;
|
||||||
|
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||||
|
import org.hl7.fhir.r5.model.Enumerations.SearchComparator;
|
||||||
|
import org.hl7.fhir.r5.model.Enumerations.SearchModifierCode;
|
||||||
|
import org.hl7.fhir.r5.model.StringType;
|
||||||
|
import org.hl7.fhir.r5.model.SubscriptionTopic.InteractionTrigger;
|
||||||
|
import org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicCanFilterByComponent;
|
||||||
|
import org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicEventTriggerComponent;
|
||||||
|
import org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicNotificationShapeComponent;
|
||||||
|
import org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicResourceTriggerComponent;
|
||||||
|
import org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicResourceTriggerQueryCriteriaComponent;
|
||||||
|
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 SubscriptionTopic40_50 {
|
||||||
|
|
||||||
|
public static final String URL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.url";
|
||||||
|
public static final String VERSION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.version";
|
||||||
|
public static final String NAME_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.name";
|
||||||
|
public static final String TITLE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.title";
|
||||||
|
public static final String STATUS_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.status";
|
||||||
|
public static final String EXPERIMENTAL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.experimental";
|
||||||
|
public static final String DATE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.date";
|
||||||
|
public static final String PUBLISHER_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.publisher";
|
||||||
|
public static final String CONTACT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.contact";
|
||||||
|
public static final String DESCRIPTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.description";
|
||||||
|
public static final String USE_CONTEXT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.useContext";
|
||||||
|
public static final String JURISDICTION_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.jurisdiction";
|
||||||
|
public static final String PURPOSE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.purpose";
|
||||||
|
public static final String COPYRIGHT_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.copyright";
|
||||||
|
public static final String COPYRIGHT_LABEL_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.copyrightLabel";
|
||||||
|
public static final String APPROVAL_DATE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.approvalDate";
|
||||||
|
public static final String LAST_REVIEW_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.lastReviewDate";
|
||||||
|
public static final String EFFECTIVE_PERIOD_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.effectivePeriod";
|
||||||
|
public static final String DERIVED_FROM_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.derivedFrom";
|
||||||
|
|
||||||
|
public static final String RESOURCE_TRIGGER_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.resourceTrigger";
|
||||||
|
public static final String RESOURCE_TRIGGER_DESCRIPTION_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.resourceTrigger.*/"description";
|
||||||
|
public static final String RESOURCE_TRIGGER_RESOURCE_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.resourceTrigger.*/"resource";
|
||||||
|
public static final String RESOURCE_TRIGGER_SUPPORTED_INTERACTION_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.resourceTrigger.*/"supportedInteraction";
|
||||||
|
public static final String RESOURCE_TRIGGER_QUERY_CRITERIA_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.resourceTrigger.*/"queryCriteria";
|
||||||
|
public static final String RESOURCE_TRIGGER_QUERY_CRITERIA_PREVIOUS_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.resourceTrigger.queryCriteria.*/"previous";
|
||||||
|
public static final String RESOURCE_TRIGGER_QUERY_CRITERIA_RESULT_FOR_CREATE_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.resourceTrigger.queryCriteria.*/"resultForCreate";
|
||||||
|
public static final String RESOURCE_TRIGGER_QUERY_CRITERIA_CURRENT_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.resourceTrigger.queryCriteria.*/"current";
|
||||||
|
public static final String RESOURCE_TRIGGER_QUERY_CRITERIA_RESULT_FOR_DELETE_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.resourceTrigger.queryCriteria.*/"resultForDelete";
|
||||||
|
public static final String RESOURCE_TRIGGER_QUERY_CRITERIA_REQUIRE_BOTH_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.resourceTrigger.queryCriteria.*/"requireBoth";
|
||||||
|
public static final String RESOURCE_TRIGGER_FHIRPATH_CRITERIA_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.resourceTrigger.*/"fhirPathCriteria";
|
||||||
|
|
||||||
|
public static final String EVENT_TRIGGER_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.eventTrigger";
|
||||||
|
public static final String EVENT_TRIGGER_DESCRIPTION_EXTENSION_URL = /*"http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.eventTrigger.*/"description";
|
||||||
|
public static final String EVENT_TRIGGER_EVENT_EXTENSION_URL = /*"http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.eventTrigger.*/"event";
|
||||||
|
public static final String EVENT_TRIGGER_RESOURCE_EXTENSION_URL = /*"http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.eventTrigger.*/"resource";
|
||||||
|
|
||||||
|
public static final String CAN_FILTER_BY_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.canFilterBy";
|
||||||
|
public static final String CAN_FILTER_BY_DESCRIPTION_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.canFilterBy.*/"description";
|
||||||
|
public static final String CAN_FILTER_BY_RESOURCE_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.canFilterBy.*/"resource";
|
||||||
|
public static final String CAN_FILTER_BY_FILTER_PARMETER_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.canFilterBy.*/"filterParameter";
|
||||||
|
public static final String CAN_FILTER_BY_FILTER_DEFINITION_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.canFilterBy.*/"filterDefinition";
|
||||||
|
public static final String CAN_FILTER_BY_COMPARATOR_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.canFilterBy.*/"comparator";
|
||||||
|
public static final String CAN_FILTER_BY_MODIFIER_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.canFilterBy.*/"modifier";
|
||||||
|
|
||||||
|
public static final String NOTIFICATION_SHAPE_EXTENSION_URL = "http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.notificationShape";
|
||||||
|
public static final String NOTIFICATION_SHAPE_RESOURCE_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.notificationShape.*/"resource";
|
||||||
|
public static final String NOTIFICATION_SHAPE_INCLUDE_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.notificationShape.*/"include";
|
||||||
|
public static final String NOTIFICATION_SHAPE_REV_INCLUDE_EXTENSION_URL = /*http://hl7.org/fhir/5.0/StructureDefinition/extension-SubscriptionTopic.notificationShape.*/"revInclude";
|
||||||
|
|
||||||
|
|
||||||
|
private static final String[] IGNORED_EXTENSION_URLS = new String[]{
|
||||||
|
URL_EXTENSION_URL,
|
||||||
|
VERSION_EXTENSION_URL,
|
||||||
|
NAME_EXTENSION_URL,
|
||||||
|
TITLE_EXTENSION_URL,
|
||||||
|
STATUS_EXTENSION_URL,
|
||||||
|
EXPERIMENTAL_EXTENSION_URL,
|
||||||
|
DATE_EXTENSION_URL,
|
||||||
|
PUBLISHER_EXTENSION_URL,
|
||||||
|
CONTACT_EXTENSION_URL,
|
||||||
|
DESCRIPTION_EXTENSION_URL,
|
||||||
|
USE_CONTEXT_EXTENSION_URL,
|
||||||
|
JURISDICTION_EXTENSION_URL,
|
||||||
|
PURPOSE_EXTENSION_URL,
|
||||||
|
COPYRIGHT_EXTENSION_URL,
|
||||||
|
COPYRIGHT_LABEL_EXTENSION_URL,
|
||||||
|
RESOURCE_TRIGGER_EXTENSION_URL,
|
||||||
|
EVENT_TRIGGER_EXTENSION_URL,
|
||||||
|
CAN_FILTER_BY_EXTENSION_URL,
|
||||||
|
NOTIFICATION_SHAPE_EXTENSION_URL
|
||||||
|
};
|
||||||
|
|
||||||
|
public static org.hl7.fhir.r5.model.SubscriptionTopic convertSubscriptionTopic(org.hl7.fhir.r4.model.Basic src) throws FHIRException {
|
||||||
|
if (src == null)
|
||||||
|
return null;
|
||||||
|
if (!src.getCode().hasCoding("http://hl7.org/fhir/fhir-types", "SubscriptionTopic")) {
|
||||||
|
throw new FHIRException("Error in logic: this basic resource is not an SubscriptionTopic");
|
||||||
|
}
|
||||||
|
org.hl7.fhir.r5.model.SubscriptionTopic tgt = new org.hl7.fhir.r5.model.SubscriptionTopic();
|
||||||
|
|
||||||
|
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyDomainResource(src, tgt, IGNORED_EXTENSION_URLS);
|
||||||
|
|
||||||
|
for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
|
||||||
|
tgt.addIdentifier(Identifier40_50.convertIdentifier(t));
|
||||||
|
|
||||||
|
if (src.hasExtension(URL_EXTENSION_URL)) {
|
||||||
|
tgt.setUrlElement(Uri40_50.convertUri((org.hl7.fhir.r4.model.UriType) src.getExtensionByUrl(URL_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(VERSION_EXTENSION_URL)) {
|
||||||
|
tgt.setVersionElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(VERSION_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(NAME_EXTENSION_URL)) {
|
||||||
|
tgt.setNameElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(NAME_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(TITLE_EXTENSION_URL)) {
|
||||||
|
tgt.setTitleElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(TITLE_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(STATUS_EXTENSION_URL)) {
|
||||||
|
tgt.setStatus(PublicationStatus.fromCode(src.getExtensionByUrl(STATUS_EXTENSION_URL).getValue().primitiveValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(EXPERIMENTAL_EXTENSION_URL)) {
|
||||||
|
tgt.setExperimentalElement(Boolean40_50.convertBoolean((org.hl7.fhir.r4.model.BooleanType) src.getExtensionByUrl(EXPERIMENTAL_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(DATE_EXTENSION_URL)) {
|
||||||
|
tgt.setDateElement(DateTime40_50.convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src.getExtensionByUrl(DATE_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(PUBLISHER_EXTENSION_URL)) {
|
||||||
|
tgt.setPublisherElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(PUBLISHER_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(CONTACT_EXTENSION_URL)) {
|
||||||
|
tgt.addContact(ContactDetail40_50.convertContactDetail((org.hl7.fhir.r4.model.ContactDetail) ext.getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(DESCRIPTION_EXTENSION_URL)) {
|
||||||
|
tgt.setDescriptionElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(DESCRIPTION_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(USE_CONTEXT_EXTENSION_URL)) {
|
||||||
|
tgt.addUseContext(UsageContext40_50.convertUsageContext((org.hl7.fhir.r4.model.UsageContext) ext.getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(JURISDICTION_EXTENSION_URL)) {
|
||||||
|
tgt.addJurisdiction(CodeableConcept40_50.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) ext.getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(PURPOSE_EXTENSION_URL)) {
|
||||||
|
tgt.setPurposeElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(PURPOSE_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(COPYRIGHT_EXTENSION_URL)) {
|
||||||
|
tgt.setCopyrightElement(MarkDown40_50.convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src.getExtensionByUrl(COPYRIGHT_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(COPYRIGHT_LABEL_EXTENSION_URL)) {
|
||||||
|
tgt.setCopyrightLabelElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(COPYRIGHT_LABEL_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(DERIVED_FROM_EXTENSION_URL)) {
|
||||||
|
tgt.getDerivedFrom().add(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType) ext.getValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(RESOURCE_TRIGGER_EXTENSION_URL)) {
|
||||||
|
convertSubscriptionResourceTrigger(ext, tgt.addResourceTrigger());
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(EVENT_TRIGGER_EXTENSION_URL)) {
|
||||||
|
convertSubscriptionEventTrigger(ext, tgt.addEventTrigger());
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(CAN_FILTER_BY_EXTENSION_URL)) {
|
||||||
|
convertSubscriptionCanFilterBy(ext, tgt.addCanFilterBy());
|
||||||
|
}
|
||||||
|
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl(NOTIFICATION_SHAPE_EXTENSION_URL)) {
|
||||||
|
convertSubscriptionNotificationShape(ext, tgt.addNotificationShape());
|
||||||
|
}
|
||||||
|
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static org.hl7.fhir.r4.model.Basic convertSubscriptionTopic(org.hl7.fhir.r5.model.SubscriptionTopic 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("SubscriptionTopic"); // 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(URL_EXTENSION_URL, Uri40_50.convertUri(src.getUrlElement()));
|
||||||
|
}
|
||||||
|
if (src.hasVersion()) {
|
||||||
|
tgt.addExtension(VERSION_EXTENSION_URL, String40_50.convertString(src.getVersionElement()));
|
||||||
|
}
|
||||||
|
if (src.hasName()) {
|
||||||
|
tgt.addExtension(NAME_EXTENSION_URL, String40_50.convertString(src.getNameElement()));
|
||||||
|
}
|
||||||
|
if (src.hasTitle()) {
|
||||||
|
tgt.addExtension(TITLE_EXTENSION_URL, String40_50.convertString(src.getTitleElement()));
|
||||||
|
}
|
||||||
|
if (src.hasStatus()) {
|
||||||
|
tgt.addExtension(STATUS_EXTENSION_URL, new org.hl7.fhir.r4.model.CodeType(src.getStatus().toCode()));
|
||||||
|
}
|
||||||
|
if (src.hasExperimental()) {
|
||||||
|
tgt.addExtension(EXPERIMENTAL_EXTENSION_URL, Boolean40_50.convertBoolean(src.getExperimentalElement()));
|
||||||
|
}
|
||||||
|
if (src.hasDate()) {
|
||||||
|
tgt.addExtension(DATE_EXTENSION_URL, DateTime40_50.convertDateTime(src.getDateElement()));
|
||||||
|
}
|
||||||
|
if (src.hasPublisher()) {
|
||||||
|
tgt.addExtension(PUBLISHER_EXTENSION_URL, String40_50.convertString(src.getPublisherElement()));
|
||||||
|
}
|
||||||
|
for (ContactDetail cd : src.getContact()) {
|
||||||
|
tgt.addExtension(CONTACT_EXTENSION_URL, ContactDetail40_50.convertContactDetail(cd));
|
||||||
|
}
|
||||||
|
if (src.hasDescription()) {
|
||||||
|
tgt.addExtension(DESCRIPTION_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
|
||||||
|
}
|
||||||
|
for (UsageContext cd : src.getUseContext()) {
|
||||||
|
tgt.addExtension(USE_CONTEXT_EXTENSION_URL, UsageContext40_50.convertUsageContext(cd));
|
||||||
|
}
|
||||||
|
for (CodeableConcept cd : src.getJurisdiction()) {
|
||||||
|
tgt.addExtension(JURISDICTION_EXTENSION_URL, CodeableConcept40_50.convertCodeableConcept(cd));
|
||||||
|
}
|
||||||
|
if (src.hasPurpose()) {
|
||||||
|
tgt.addExtension(PURPOSE_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getPurposeElement()));
|
||||||
|
}
|
||||||
|
if (src.hasCopyright()) {
|
||||||
|
tgt.addExtension(COPYRIGHT_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getCopyrightElement()));
|
||||||
|
}
|
||||||
|
if (src.hasCopyrightLabel()) {
|
||||||
|
tgt.addExtension(COPYRIGHT_LABEL_EXTENSION_URL, String40_50.convertString(src.getCopyrightLabelElement()));
|
||||||
|
}
|
||||||
|
for (CanonicalType ref : src.getDerivedFrom()) {
|
||||||
|
tgt.addExtension(DERIVED_FROM_EXTENSION_URL, Canonical40_50.convertCanonical(ref));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (SubscriptionTopicResourceTriggerComponent ref : src.getResourceTrigger()) {
|
||||||
|
org.hl7.fhir.r4.model.Extension tgte = new org.hl7.fhir.r4.model.Extension(RESOURCE_TRIGGER_EXTENSION_URL);
|
||||||
|
tgt.addExtension(tgte);
|
||||||
|
convertSubscriptionResourceTrigger(ref, tgte);
|
||||||
|
}
|
||||||
|
for (SubscriptionTopicEventTriggerComponent ref : src.getEventTrigger()) {
|
||||||
|
org.hl7.fhir.r4.model.Extension tgte = new org.hl7.fhir.r4.model.Extension(EVENT_TRIGGER_EXTENSION_URL);
|
||||||
|
tgt.addExtension(tgte);
|
||||||
|
convertSubscriptionEventTrigger(ref, tgte);
|
||||||
|
}
|
||||||
|
for (SubscriptionTopicCanFilterByComponent ref : src.getCanFilterBy()) {
|
||||||
|
org.hl7.fhir.r4.model.Extension tgte = new org.hl7.fhir.r4.model.Extension(CAN_FILTER_BY_EXTENSION_URL);
|
||||||
|
tgt.addExtension(tgte);
|
||||||
|
convertSubscriptionCanFilterBy(ref, tgte);
|
||||||
|
}
|
||||||
|
for (SubscriptionTopicNotificationShapeComponent ref : src.getNotificationShape()) {
|
||||||
|
org.hl7.fhir.r4.model.Extension tgte = new org.hl7.fhir.r4.model.Extension(NOTIFICATION_SHAPE_EXTENSION_URL);
|
||||||
|
tgt.addExtension(tgte);
|
||||||
|
convertSubscriptionNotificationShape(ref, tgte);
|
||||||
|
}
|
||||||
|
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void convertSubscriptionResourceTrigger(SubscriptionTopicResourceTriggerComponent src, Extension tgt) {
|
||||||
|
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
|
||||||
|
if (src.hasDescription()) {
|
||||||
|
tgt.addExtension(RESOURCE_TRIGGER_DESCRIPTION_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
|
||||||
|
}
|
||||||
|
if (src.hasResource()) {
|
||||||
|
tgt.addExtension(RESOURCE_TRIGGER_RESOURCE_EXTENSION_URL, Uri40_50.convertUri(src.getResourceElement()));
|
||||||
|
}
|
||||||
|
for (Enumeration<InteractionTrigger> t : src.getSupportedInteraction()) {
|
||||||
|
tgt.addExtension(RESOURCE_TRIGGER_SUPPORTED_INTERACTION_EXTENSION_URL, new org.hl7.fhir.r4.model.CodeType(t.getCode()));
|
||||||
|
}
|
||||||
|
if (src.hasQueryCriteria()) {
|
||||||
|
Extension tgtQF = new Extension(RESOURCE_TRIGGER_QUERY_CRITERIA_EXTENSION_URL);
|
||||||
|
tgt.addExtension(tgtQF);
|
||||||
|
if (src.getQueryCriteria().hasPrevious()) {
|
||||||
|
tgtQF.addExtension(RESOURCE_TRIGGER_QUERY_CRITERIA_PREVIOUS_EXTENSION_URL, String40_50.convertString(src.getQueryCriteria().getPreviousElement()));
|
||||||
|
}
|
||||||
|
if (src.getQueryCriteria().hasResultForCreate()) {
|
||||||
|
tgtQF.addExtension(RESOURCE_TRIGGER_QUERY_CRITERIA_RESULT_FOR_CREATE_EXTENSION_URL, new org.hl7.fhir.r4.model.CodeType(src.getQueryCriteria().getResultForCreate().toCode()));
|
||||||
|
}
|
||||||
|
if (src.getQueryCriteria().hasCurrent()) {
|
||||||
|
tgtQF.addExtension(RESOURCE_TRIGGER_QUERY_CRITERIA_CURRENT_EXTENSION_URL, String40_50.convertString(src.getQueryCriteria().getCurrentElement()));
|
||||||
|
}
|
||||||
|
if (src.getQueryCriteria().hasResultForDelete()) {
|
||||||
|
tgtQF.addExtension(RESOURCE_TRIGGER_QUERY_CRITERIA_RESULT_FOR_DELETE_EXTENSION_URL, new org.hl7.fhir.r4.model.CodeType(src.getQueryCriteria().getResultForDelete().toCode()));
|
||||||
|
}
|
||||||
|
if (src.getQueryCriteria().hasRequireBoth()) {
|
||||||
|
tgtQF.addExtension(RESOURCE_TRIGGER_QUERY_CRITERIA_REQUIRE_BOTH_EXTENSION_URL, Boolean40_50.convertBoolean(src.getQueryCriteria().getRequireBothElement()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (src.hasFhirPathCriteria()) {
|
||||||
|
tgt.addExtension(RESOURCE_TRIGGER_FHIRPATH_CRITERIA_EXTENSION_URL, String40_50.convertString(src.getFhirPathCriteriaElement()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void convertSubscriptionResourceTrigger(Extension src, SubscriptionTopicResourceTriggerComponent tgt) {
|
||||||
|
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt,
|
||||||
|
RESOURCE_TRIGGER_DESCRIPTION_EXTENSION_URL, RESOURCE_TRIGGER_RESOURCE_EXTENSION_URL, RESOURCE_TRIGGER_QUERY_CRITERIA_EXTENSION_URL,
|
||||||
|
RESOURCE_TRIGGER_SUPPORTED_INTERACTION_EXTENSION_URL, RESOURCE_TRIGGER_FHIRPATH_CRITERIA_EXTENSION_URL);
|
||||||
|
if (src.hasExtension(RESOURCE_TRIGGER_DESCRIPTION_EXTENSION_URL)) {
|
||||||
|
tgt.setDescriptionElement(MarkDown40_50.convertMarkdown((MarkdownType) src.getExtensionByUrl(RESOURCE_TRIGGER_DESCRIPTION_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(RESOURCE_TRIGGER_RESOURCE_EXTENSION_URL)) {
|
||||||
|
tgt.setResourceElement(Uri40_50.convertUri((UriType) src.getExtensionByUrl(RESOURCE_TRIGGER_RESOURCE_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
for (Extension ext : src.getExtensionsByUrl(RESOURCE_TRIGGER_SUPPORTED_INTERACTION_EXTENSION_URL)) {
|
||||||
|
tgt.addSupportedInteractionElement().setValueAsString(ext.getValue().primitiveValue());
|
||||||
|
}
|
||||||
|
if (src.hasExtension(RESOURCE_TRIGGER_QUERY_CRITERIA_EXTENSION_URL)) {
|
||||||
|
Extension srcQF = src.getExtensionByUrl(RESOURCE_TRIGGER_QUERY_CRITERIA_EXTENSION_URL);
|
||||||
|
SubscriptionTopicResourceTriggerQueryCriteriaComponent tgtQF = tgt.getQueryCriteria();
|
||||||
|
if (srcQF.hasExtension(RESOURCE_TRIGGER_QUERY_CRITERIA_PREVIOUS_EXTENSION_URL)) {
|
||||||
|
tgtQF.setPreviousElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) srcQF.getExtensionByUrl(RESOURCE_TRIGGER_QUERY_CRITERIA_PREVIOUS_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (srcQF.hasExtension(RESOURCE_TRIGGER_QUERY_CRITERIA_RESULT_FOR_CREATE_EXTENSION_URL)) {
|
||||||
|
tgtQF.getResultForCreateElement().setValueAsString(srcQF.getExtensionByUrl(RESOURCE_TRIGGER_QUERY_CRITERIA_RESULT_FOR_CREATE_EXTENSION_URL).getValue().primitiveValue());
|
||||||
|
}
|
||||||
|
if (srcQF.hasExtension(RESOURCE_TRIGGER_QUERY_CRITERIA_CURRENT_EXTENSION_URL)) {
|
||||||
|
tgtQF.setCurrentElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) srcQF.getExtensionByUrl(RESOURCE_TRIGGER_QUERY_CRITERIA_CURRENT_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (srcQF.hasExtension(RESOURCE_TRIGGER_QUERY_CRITERIA_RESULT_FOR_DELETE_EXTENSION_URL)) {
|
||||||
|
tgtQF.getResultForDeleteElement().setValueAsString(srcQF.getExtensionByUrl(RESOURCE_TRIGGER_QUERY_CRITERIA_RESULT_FOR_DELETE_EXTENSION_URL).getValue().primitiveValue());
|
||||||
|
}
|
||||||
|
if (srcQF.hasExtension(RESOURCE_TRIGGER_QUERY_CRITERIA_REQUIRE_BOTH_EXTENSION_URL)) {
|
||||||
|
tgtQF.setRequireBothElement(Boolean40_50.convertBoolean((BooleanType) srcQF.getExtensionByUrl(RESOURCE_TRIGGER_QUERY_CRITERIA_REQUIRE_BOTH_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (src.hasExtension(RESOURCE_TRIGGER_FHIRPATH_CRITERIA_EXTENSION_URL)) {
|
||||||
|
tgt.setFhirPathCriteriaElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(RESOURCE_TRIGGER_FHIRPATH_CRITERIA_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void convertSubscriptionEventTrigger(SubscriptionTopicEventTriggerComponent src, Extension tgt) {
|
||||||
|
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
|
||||||
|
if (src.hasDescription()) {
|
||||||
|
tgt.addExtension(EVENT_TRIGGER_DESCRIPTION_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
|
||||||
|
}
|
||||||
|
if (src.hasResource()) {
|
||||||
|
tgt.addExtension(EVENT_TRIGGER_RESOURCE_EXTENSION_URL, Uri40_50.convertUri(src.getResourceElement()));
|
||||||
|
}
|
||||||
|
if (src.hasEvent()) {
|
||||||
|
tgt.addExtension(EVENT_TRIGGER_EVENT_EXTENSION_URL, CodeableConcept40_50.convertCodeableConcept(src.getEvent()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void convertSubscriptionEventTrigger(Extension src, SubscriptionTopicEventTriggerComponent tgt) {
|
||||||
|
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt, EVENT_TRIGGER_DESCRIPTION_EXTENSION_URL, EVENT_TRIGGER_RESOURCE_EXTENSION_URL, EVENT_TRIGGER_EVENT_EXTENSION_URL);
|
||||||
|
if (src.hasExtension(EVENT_TRIGGER_DESCRIPTION_EXTENSION_URL)) {
|
||||||
|
tgt.setDescriptionElement(MarkDown40_50.convertMarkdown((MarkdownType) src.getExtensionByUrl(EVENT_TRIGGER_DESCRIPTION_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(EVENT_TRIGGER_RESOURCE_EXTENSION_URL)) {
|
||||||
|
tgt.setResourceElement(Uri40_50.convertUri((UriType) src.getExtensionByUrl(EVENT_TRIGGER_RESOURCE_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(EVENT_TRIGGER_EVENT_EXTENSION_URL)) {
|
||||||
|
tgt.setEvent(CodeableConcept40_50.convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src.getExtensionByUrl(EVENT_TRIGGER_EVENT_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void convertSubscriptionCanFilterBy(SubscriptionTopicCanFilterByComponent src, Extension tgt) {
|
||||||
|
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
|
||||||
|
if (src.hasDescription()) {
|
||||||
|
tgt.addExtension(CAN_FILTER_BY_DESCRIPTION_EXTENSION_URL, MarkDown40_50.convertMarkdown(src.getDescriptionElement()));
|
||||||
|
}
|
||||||
|
if (src.hasResource()) {
|
||||||
|
tgt.addExtension(CAN_FILTER_BY_RESOURCE_EXTENSION_URL, Uri40_50.convertUri(src.getResourceElement()));
|
||||||
|
}
|
||||||
|
if (src.hasFilterParameter()) {
|
||||||
|
tgt.addExtension(CAN_FILTER_BY_FILTER_PARMETER_EXTENSION_URL, String40_50.convertString(src.getFilterParameterElement()));
|
||||||
|
}
|
||||||
|
if (src.hasFilterDefinition()) {
|
||||||
|
tgt.addExtension(CAN_FILTER_BY_FILTER_DEFINITION_EXTENSION_URL, Uri40_50.convertUri(src.getFilterDefinitionElement()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Enumeration<SearchComparator> t : src.getComparator()) {
|
||||||
|
tgt.addExtension(CAN_FILTER_BY_COMPARATOR_EXTENSION_URL, new org.hl7.fhir.r4.model.CodeType(t.getCode()));
|
||||||
|
}
|
||||||
|
for (Enumeration<SearchModifierCode> t : src.getModifier()) {
|
||||||
|
tgt.addExtension(CAN_FILTER_BY_MODIFIER_EXTENSION_URL, new org.hl7.fhir.r4.model.CodeType(t.getCode()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void convertSubscriptionCanFilterBy(Extension src, SubscriptionTopicCanFilterByComponent tgt) {
|
||||||
|
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt,
|
||||||
|
CAN_FILTER_BY_DESCRIPTION_EXTENSION_URL, CAN_FILTER_BY_RESOURCE_EXTENSION_URL, CAN_FILTER_BY_FILTER_PARMETER_EXTENSION_URL,
|
||||||
|
CAN_FILTER_BY_FILTER_DEFINITION_EXTENSION_URL, CAN_FILTER_BY_COMPARATOR_EXTENSION_URL, CAN_FILTER_BY_MODIFIER_EXTENSION_URL);
|
||||||
|
|
||||||
|
if (src.hasExtension(CAN_FILTER_BY_DESCRIPTION_EXTENSION_URL)) {
|
||||||
|
tgt.setDescriptionElement(MarkDown40_50.convertMarkdown((MarkdownType) src.getExtensionByUrl(CAN_FILTER_BY_DESCRIPTION_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(CAN_FILTER_BY_RESOURCE_EXTENSION_URL)) {
|
||||||
|
tgt.setResourceElement(Uri40_50.convertUri((UriType) src.getExtensionByUrl(CAN_FILTER_BY_RESOURCE_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(CAN_FILTER_BY_FILTER_PARMETER_EXTENSION_URL)) {
|
||||||
|
tgt.setFilterParameterElement(String40_50.convertString((org.hl7.fhir.r4.model.StringType) src.getExtensionByUrl(CAN_FILTER_BY_FILTER_PARMETER_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
if (src.hasExtension(CAN_FILTER_BY_FILTER_DEFINITION_EXTENSION_URL)) {
|
||||||
|
tgt.setFilterDefinitionElement(Uri40_50.convertUri((UriType) src.getExtensionByUrl(CAN_FILTER_BY_FILTER_DEFINITION_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Extension ext : src.getExtensionsByUrl(CAN_FILTER_BY_COMPARATOR_EXTENSION_URL)) {
|
||||||
|
tgt.addComparatorElement().setValueAsString(ext.getValue().primitiveValue());
|
||||||
|
}
|
||||||
|
for (Extension ext : src.getExtensionsByUrl(CAN_FILTER_BY_MODIFIER_EXTENSION_URL)) {
|
||||||
|
tgt.addModifierElement().setValueAsString(ext.getValue().primitiveValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void convertSubscriptionNotificationShape(SubscriptionTopicNotificationShapeComponent src, Extension tgt) {
|
||||||
|
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt);
|
||||||
|
if (src.hasResource()) {
|
||||||
|
tgt.addExtension(NOTIFICATION_SHAPE_RESOURCE_EXTENSION_URL, Uri40_50.convertUri(src.getResourceElement()));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (StringType t : src.getInclude()) {
|
||||||
|
tgt.addExtension(NOTIFICATION_SHAPE_INCLUDE_EXTENSION_URL, String40_50.convertString(t));
|
||||||
|
}
|
||||||
|
for (StringType t : src.getRevInclude()) {
|
||||||
|
tgt.addExtension(NOTIFICATION_SHAPE_REV_INCLUDE_EXTENSION_URL, String40_50.convertString(t));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void convertSubscriptionNotificationShape(Extension src, SubscriptionTopicNotificationShapeComponent tgt) {
|
||||||
|
ConversionContext40_50.INSTANCE.getVersionConvertor_40_50().copyElement(src, tgt, NOTIFICATION_SHAPE_RESOURCE_EXTENSION_URL, NOTIFICATION_SHAPE_INCLUDE_EXTENSION_URL, NOTIFICATION_SHAPE_REV_INCLUDE_EXTENSION_URL);
|
||||||
|
if (src.hasExtension(NOTIFICATION_SHAPE_RESOURCE_EXTENSION_URL)) {
|
||||||
|
tgt.setResourceElement(Uri40_50.convertUri((UriType) src.getExtensionByUrl(NOTIFICATION_SHAPE_RESOURCE_EXTENSION_URL).getValue()));
|
||||||
|
}
|
||||||
|
for (Extension ext : src.getExtensionsByUrl(NOTIFICATION_SHAPE_INCLUDE_EXTENSION_URL)) {
|
||||||
|
tgt.addIncludeElement().setValueAsString(ext.getValue().primitiveValue());
|
||||||
|
}
|
||||||
|
for (Extension ext : src.getExtensionsByUrl(NOTIFICATION_SHAPE_REV_INCLUDE_EXTENSION_URL)) {
|
||||||
|
tgt.addRevIncludeElement().setValueAsString(ext.getValue().primitiveValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package org.hl7.fhir.convertors.conv40_50;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||||
|
import org.hl7.fhir.r5.formats.IParser.OutputStyle;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
public class SubscriptionTopic40_50Test {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test r5 -> r4 SubscriptionTopic conversion.")
|
||||||
|
public void testR5_R4() throws IOException {
|
||||||
|
InputStream r5_input = this.getClass().getResourceAsStream("/subscription_topic_50.json");
|
||||||
|
|
||||||
|
org.hl7.fhir.r5.model.SubscriptionTopic r5_actual = (org.hl7.fhir.r5.model.SubscriptionTopic) 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);
|
||||||
|
|
||||||
|
org.hl7.fhir.r5.formats.JsonParser r5_parser = new org.hl7.fhir.r5.formats.JsonParser();
|
||||||
|
r5_parser.setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("/tmp/source.json"), r5_actual);
|
||||||
|
r5_parser.setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("/tmp/output.json"), r5_conv);
|
||||||
|
|
||||||
|
assertTrue(r5_actual.equalsDeep(r5_conv), "should be the same");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -62,7 +62,6 @@ public class R5ExtensionsLoader {
|
||||||
private BasePackageCacheManager pcm;
|
private BasePackageCacheManager pcm;
|
||||||
private int count;
|
private int count;
|
||||||
private NpmPackage pckCore;
|
private NpmPackage pckCore;
|
||||||
private NpmPackage pckExt;
|
|
||||||
private Map<String, Loadable<ValueSet>> valueSets;
|
private Map<String, Loadable<ValueSet>> valueSets;
|
||||||
private Map<String, Loadable<CodeSystem>> codeSystems;
|
private Map<String, Loadable<CodeSystem>> codeSystems;
|
||||||
private List<Loadable<StructureDefinition>> structures;
|
private List<Loadable<StructureDefinition>> structures;
|
||||||
|
@ -82,8 +81,6 @@ public class R5ExtensionsLoader {
|
||||||
public void load() throws FHIRException, IOException {
|
public void load() throws FHIRException, IOException {
|
||||||
pckCore = pcm.loadPackage("hl7.fhir.r5.core", "5.0.0");
|
pckCore = pcm.loadPackage("hl7.fhir.r5.core", "5.0.0");
|
||||||
loadDetails(pckCore);
|
loadDetails(pckCore);
|
||||||
pckExt = pcm.loadPackage("hl7.fhir.uv.extensions", "1.0.0");
|
|
||||||
loadDetails(pckExt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadDetails(NpmPackage pck) throws IOException {
|
private void loadDetails(NpmPackage pck) throws IOException {
|
||||||
|
@ -103,29 +100,39 @@ public class R5ExtensionsLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadR5Extensions() throws FHIRException, IOException {
|
// public void loadR5Extensions() throws FHIRException, IOException {
|
||||||
count = 0;
|
// count = 0;
|
||||||
List<String> typeNames = new ContextUtilities(context).getTypeNames();
|
// List<String> typeNames = new ContextUtilities(context).getTypeNames();
|
||||||
for (Loadable<StructureDefinition> lsd : structures) {
|
// for (Loadable<StructureDefinition> lsd : structures) {
|
||||||
if (lsd.info.getStatedType().equals("Extension") && !context.hasResource(StructureDefinition.class, lsd.info.getUrl())) {
|
// if (lsd.info.getStatedType().equals("Extension") && !context.hasResource(StructureDefinition.class, lsd.info.getUrl())) {
|
||||||
StructureDefinition sd = lsd.getResource();
|
// StructureDefinition sd = lsd.getResource();
|
||||||
if (sd.getDerivation() == TypeDerivationRule.CONSTRAINT) {
|
// if (sd.getDerivation() == TypeDerivationRule.CONSTRAINT) {
|
||||||
if (survivesStrippingTypes(sd, context, typeNames)) {
|
// if (survivesStrippingTypes(sd, context, typeNames)) {
|
||||||
count++;
|
// count++;
|
||||||
sd.setWebPath(Utilities.pathURL(pckExt.getWebLocation(), "extension-"+sd.getId().toLowerCase()+".html"));
|
// sd.setWebPath(Utilities.pathURL(pckExt.getWebLocation(), "extension-"+sd.getId().toLowerCase()+".html"));
|
||||||
registerTerminologies(sd);
|
// registerTerminologies(sd);
|
||||||
context.cacheResourceFromPackage(sd, new PackageInformation(lsd.source));
|
// context.cacheResourceFromPackage(sd, new PackageInformation(lsd.source));
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void loadR5SpecialTypes(List<String> types) throws FHIRException, IOException {
|
public void loadR5SpecialTypes(List<String> types) throws FHIRException, IOException {
|
||||||
for (Loadable<StructureDefinition> lsd : structures) {
|
for (Loadable<StructureDefinition> lsd : structures) {
|
||||||
StructureDefinition sd = lsd.getResource();
|
if (Utilities.existsInList(lsd.info.getId(), types)) {
|
||||||
if (Utilities.existsInList(sd.getType(), types)) {
|
StructureDefinition sd = lsd.getResource();
|
||||||
count++;
|
count++;
|
||||||
|
for (ElementDefinition ed : sd.getDifferential().getElement()) {
|
||||||
|
if (!stripTypes(ed, sd, types)) {
|
||||||
|
System.out.println("A problem...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
|
||||||
|
if (!stripTypes(ed, sd, types)) {
|
||||||
|
System.out.println("A problem...");
|
||||||
|
}
|
||||||
|
}
|
||||||
sd.setWebPath(Utilities.pathURL(lsd.source.getWebLocation(), sd.getId().toLowerCase()+".html"));
|
sd.setWebPath(Utilities.pathURL(lsd.source.getWebLocation(), sd.getId().toLowerCase()+".html"));
|
||||||
registerTerminologies(sd);
|
registerTerminologies(sd);
|
||||||
context.cacheResourceFromPackage(sd, new PackageInformation(lsd.source));
|
context.cacheResourceFromPackage(sd, new PackageInformation(lsd.source));
|
||||||
|
@ -133,6 +140,32 @@ public class R5ExtensionsLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean stripTypes(ElementDefinition ed, StructureDefinition sd, List<String> types) {
|
||||||
|
if (!ed.getPath().contains(".") || !ed.hasType()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
ed.getType().removeIf(tr -> context.fetchTypeDefinition(tr.getWorkingCode()) == null);
|
||||||
|
if (!ed.hasType()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (TypeRefComponent tr : ed.getType()) {
|
||||||
|
if (tr.hasTargetProfile()) {
|
||||||
|
tr.getTargetProfile().removeIf(n -> !context.hasResource(StructureDefinition.class, n.asStringValue()) && !n.asStringValue().equals(sd.getUrl()) && !types.contains(tail(n.asStringValue())));
|
||||||
|
if (!tr.hasTargetProfile()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object tail(String s) {
|
||||||
|
if (s == null || !s.contains("/")) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
return s.substring(s.lastIndexOf("/")+1);
|
||||||
|
}
|
||||||
|
|
||||||
private void registerTerminologies(StructureDefinition sd) throws FHIRFormatError, FileNotFoundException, IOException {
|
private void registerTerminologies(StructureDefinition sd) throws FHIRFormatError, FileNotFoundException, IOException {
|
||||||
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
|
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
|
||||||
if (ed.hasBinding() && ed.getBinding().hasValueSet()) {
|
if (ed.hasBinding() && ed.getBinding().hasValueSet()) {
|
||||||
|
@ -217,9 +250,6 @@ public class R5ExtensionsLoader {
|
||||||
return pckCore;
|
return pckCore;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NpmPackage getPckExt() {
|
|
||||||
return pckExt;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -244,7 +244,8 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
||||||
|
|
||||||
public SimpleWorkerContext fromPackage(NpmPackage pi, IContextResourceLoader loader) throws IOException, FHIRException {
|
public SimpleWorkerContext fromPackage(NpmPackage pi, IContextResourceLoader loader) throws IOException, FHIRException {
|
||||||
SimpleWorkerContext context = getSimpleWorkerContextInstance();
|
SimpleWorkerContext context = getSimpleWorkerContextInstance();
|
||||||
context.setAllowLoadingDuplicates(allowLoadingDuplicates); context.version = pi.getNpm().asString("version");
|
context.setAllowLoadingDuplicates(allowLoadingDuplicates);
|
||||||
|
context.version = pi.getNpm().asString("version");
|
||||||
context.loadFromPackage(pi, loader);
|
context.loadFromPackage(pi, loader);
|
||||||
context.finishLoading();
|
context.finishLoading();
|
||||||
return build(context);
|
return build(context);
|
||||||
|
|
|
@ -765,10 +765,19 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
||||||
protected void renderUri(XhtmlNode x, UriType uri) {
|
protected void renderUri(XhtmlNode x, UriType uri) {
|
||||||
if (uri.getValue().startsWith("mailto:")) {
|
if (uri.getValue().startsWith("mailto:")) {
|
||||||
x.ah(uri.getValue()).addText(uri.getValue().substring(7));
|
x.ah(uri.getValue()).addText(uri.getValue().substring(7));
|
||||||
} else if (Utilities.isAbsoluteUrlLinkable(uri.getValue()) && !(uri instanceof IdType)) {
|
|
||||||
x.ah(uri.getValue()).addText(uri.getValue());
|
|
||||||
} else {
|
} else {
|
||||||
x.addText(uri.getValue());
|
Resource r = context.getContext().fetchResource(Resource.class, uri.getValue());
|
||||||
|
if (r != null && r.getWebPath() != null) {
|
||||||
|
if (r instanceof CanonicalResource) {
|
||||||
|
x.ah(r.getWebPath()).addText(((CanonicalResource) r).present());
|
||||||
|
} else {
|
||||||
|
x.ah(r.getWebPath()).addText(uri.getValue());
|
||||||
|
}
|
||||||
|
} else if (Utilities.isAbsoluteUrlLinkable(uri.getValue()) && !(uri instanceof IdType)) {
|
||||||
|
x.ah(uri.getValue()).addText(uri.getValue());
|
||||||
|
} else {
|
||||||
|
x.addText(uri.getValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -91,6 +91,9 @@ public class RendererFactory {
|
||||||
if ("Requirements".equals(resourceName)) {
|
if ("Requirements".equals(resourceName)) {
|
||||||
return new RequirementsRenderer(context);
|
return new RequirementsRenderer(context);
|
||||||
}
|
}
|
||||||
|
if ("SubscriptionTopic".equals(resourceName)) {
|
||||||
|
return new SubscriptionTopicRenderer(context);
|
||||||
|
}
|
||||||
if ("StructureMap".equals(resourceName)) {
|
if ("StructureMap".equals(resourceName)) {
|
||||||
return new StructureMapRenderer(context);
|
return new StructureMapRenderer(context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
package org.hl7.fhir.r5.renderers;
|
package org.hl7.fhir.r5.renderers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
|
@ -577,4 +581,95 @@ public abstract class ResourceRenderer extends DataRenderer {
|
||||||
public RendererType getRendererType() {
|
public RendererType getRendererType() {
|
||||||
return RendererType.NATIVE;
|
return RendererType.NATIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TableRowData {
|
||||||
|
private Map<String, List<DataType>> cols = new HashMap<>();
|
||||||
|
private TableData data;
|
||||||
|
|
||||||
|
public void value(String name, DataType value) {
|
||||||
|
if (!cols.containsKey(name)) {
|
||||||
|
cols.put(name, new ArrayList<>());
|
||||||
|
}
|
||||||
|
if (!data.columns.contains(name)) {
|
||||||
|
data.columns.add(name);
|
||||||
|
}
|
||||||
|
cols.get(name).add(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasCol(String name) {
|
||||||
|
return cols.containsKey(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DataType> get(String name) {
|
||||||
|
return cols.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public class TableData {
|
||||||
|
private String title;
|
||||||
|
private List<String> columns = new ArrayList<>();
|
||||||
|
private List<TableRowData> rows = new ArrayList<>();
|
||||||
|
public TableData(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
public List<String> getColumns() {
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
|
public List<TableRowData> getRows() {
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
public void addColumn(String name) {
|
||||||
|
columns.add(name);
|
||||||
|
}
|
||||||
|
public TableRowData addRow() {
|
||||||
|
TableRowData res = new TableRowData();
|
||||||
|
rows.add(res);
|
||||||
|
res.data = this;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void renderTable(TableData provider, XhtmlNode x) throws FHIRFormatError, DefinitionException, IOException {
|
||||||
|
List<String> columns = new ArrayList<>();
|
||||||
|
for (String name : provider.getColumns()) {
|
||||||
|
boolean hasData = false;
|
||||||
|
for (TableRowData row : provider.getRows()) {
|
||||||
|
if (row.hasCol(name)) {
|
||||||
|
hasData = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasData) {
|
||||||
|
columns.add(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (columns.size() > 0) {
|
||||||
|
XhtmlNode table = x.table("grid");
|
||||||
|
|
||||||
|
if (provider.getTitle() != null) {
|
||||||
|
table.tr().td().colspan(columns.size()).b().tx(provider.getTitle());
|
||||||
|
}
|
||||||
|
XhtmlNode tr = table.tr();
|
||||||
|
for (String col : columns) {
|
||||||
|
tr.th().b().tx(col);
|
||||||
|
}
|
||||||
|
for (TableRowData row : provider.getRows()) {
|
||||||
|
tr = table.tr();
|
||||||
|
for (String col : columns) {
|
||||||
|
XhtmlNode td = tr.td();
|
||||||
|
boolean first = true;
|
||||||
|
List<DataType> list = row.get(col);
|
||||||
|
if (list != null) {
|
||||||
|
for (DataType value : list) {
|
||||||
|
if (first) first = false; else td.tx(", ");
|
||||||
|
render(td, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,171 @@
|
||||||
|
package org.hl7.fhir.r5.renderers;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
|
import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
|
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||||
|
import org.hl7.fhir.r5.model.Enumeration;
|
||||||
|
import org.hl7.fhir.r5.model.Enumerations.SearchComparator;
|
||||||
|
import org.hl7.fhir.r5.model.Enumerations.SearchModifierCode;
|
||||||
|
import org.hl7.fhir.r5.model.Library;
|
||||||
|
import org.hl7.fhir.r5.model.MarkdownType;
|
||||||
|
import org.hl7.fhir.r5.model.Requirements;
|
||||||
|
import org.hl7.fhir.r5.model.Resource;
|
||||||
|
import org.hl7.fhir.r5.model.StringType;
|
||||||
|
import org.hl7.fhir.r5.model.SubscriptionTopic;
|
||||||
|
import org.hl7.fhir.r5.model.SubscriptionTopic.InteractionTrigger;
|
||||||
|
import org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicCanFilterByComponent;
|
||||||
|
import org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicEventTriggerComponent;
|
||||||
|
import org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicNotificationShapeComponent;
|
||||||
|
import org.hl7.fhir.r5.model.SubscriptionTopic.SubscriptionTopicResourceTriggerComponent;
|
||||||
|
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper;
|
||||||
|
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||||
|
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
|
||||||
|
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||||
|
|
||||||
|
public class SubscriptionTopicRenderer extends ResourceRenderer {
|
||||||
|
|
||||||
|
public SubscriptionTopicRenderer(RenderingContext context) {
|
||||||
|
super(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SubscriptionTopicRenderer(RenderingContext context, ResourceContext rcontext) {
|
||||||
|
super(context, rcontext);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean render(XhtmlNode x, Resource dr) throws FHIRFormatError, DefinitionException, IOException {
|
||||||
|
return render(x, (SubscriptionTopic) dr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean render(XhtmlNode x, SubscriptionTopic st) throws FHIRFormatError, DefinitionException, IOException {
|
||||||
|
|
||||||
|
if (context.isHeader()) {
|
||||||
|
XhtmlNode h = x.h2();
|
||||||
|
h.addText(st.hasTitle() ? st.getTitle() : st.getName());
|
||||||
|
addMarkdown(x, st.getDescription());
|
||||||
|
if (st.hasCopyright())
|
||||||
|
generateCopyright(x, st);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (st.hasResourceTrigger()) {
|
||||||
|
TableData td = new TableData("Resource Triggers");
|
||||||
|
for (SubscriptionTopicResourceTriggerComponent rt : st.getResourceTrigger()) {
|
||||||
|
TableRowData tr = td.addRow();
|
||||||
|
if (rt.hasResource()) {
|
||||||
|
tr.value("Resource", rt.getResourceElement());
|
||||||
|
}
|
||||||
|
for (Enumeration<InteractionTrigger> t : rt.getSupportedInteraction()) {
|
||||||
|
tr.value("Interactions", t);
|
||||||
|
}
|
||||||
|
if (rt.hasQueryCriteria()) {
|
||||||
|
StringBuilder md = new StringBuilder();
|
||||||
|
if (rt.getQueryCriteria().hasPrevious()) {
|
||||||
|
md.append("* previous = "+rt.getQueryCriteria().getPrevious()+"\r\n");
|
||||||
|
}
|
||||||
|
if (rt.getQueryCriteria().hasResultForCreate()) {
|
||||||
|
md.append("* create result = "+rt.getQueryCriteria().getResultForCreate()+"\r\n");
|
||||||
|
}
|
||||||
|
if (rt.getQueryCriteria().hasCurrent()) {
|
||||||
|
md.append("* create result = "+rt.getQueryCriteria().getCurrent()+"\r\n");
|
||||||
|
}
|
||||||
|
if (rt.getQueryCriteria().hasPrevious()) {
|
||||||
|
md.append("* delete result = "+rt.getQueryCriteria().getResultForDelete()+"\r\n");
|
||||||
|
}
|
||||||
|
if (rt.getQueryCriteria().hasRequireBoth()) {
|
||||||
|
md.append("* require both = "+rt.getQueryCriteria().getRequireBoth()+"\r\n");
|
||||||
|
}
|
||||||
|
tr.value("Criteria", new MarkdownType(md.toString()));
|
||||||
|
}
|
||||||
|
if (rt.hasFhirPathCriteriaElement()) {
|
||||||
|
tr.value("FHIR Path", rt.getFhirPathCriteriaElement());
|
||||||
|
}
|
||||||
|
if (rt.hasDescription()) {
|
||||||
|
tr.value("Description", rt.getDescriptionElement());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
renderTable(td, x);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (st.hasResourceTrigger()) {
|
||||||
|
TableData td = new TableData("Event Triggers");
|
||||||
|
for (SubscriptionTopicEventTriggerComponent rt : st.getEventTrigger()) {
|
||||||
|
TableRowData tr = td.addRow();
|
||||||
|
if (rt.hasResource()) {
|
||||||
|
tr.value("Resource", rt.getResourceElement());
|
||||||
|
}
|
||||||
|
if (rt.hasEvent()) {
|
||||||
|
tr.value("Event", rt.getEvent());
|
||||||
|
}
|
||||||
|
if (rt.hasDescription()) {
|
||||||
|
tr.value("Description", rt.getDescriptionElement());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
renderTable(td, x);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (st.hasCanFilterBy()) {
|
||||||
|
TableData td = new TableData("Can Filter By");
|
||||||
|
for (SubscriptionTopicCanFilterByComponent rt : st.getCanFilterBy()) {
|
||||||
|
TableRowData tr = td.addRow();
|
||||||
|
if (rt.hasResource()) {
|
||||||
|
tr.value("Resource", rt.getResourceElement());
|
||||||
|
}
|
||||||
|
if (rt.hasFilterParameter()) {
|
||||||
|
tr.value("Filter Parameter", rt.getFilterParameterElement());
|
||||||
|
}
|
||||||
|
if (rt.hasFilterDefinition()) {
|
||||||
|
tr.value("Filter Definition", rt.getFilterDefinitionElement());
|
||||||
|
}
|
||||||
|
for (Enumeration<SearchComparator> t : rt.getComparator()) {
|
||||||
|
tr.value("Comparators", t);
|
||||||
|
}
|
||||||
|
for (Enumeration<SearchModifierCode> t : rt.getModifier()) {
|
||||||
|
tr.value("Modifiers", t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
renderTable(td, x);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (st.hasNotificationShape()) {
|
||||||
|
TableData td = new TableData("Notification Shapes");
|
||||||
|
for (SubscriptionTopicNotificationShapeComponent rt : st.getNotificationShape()) {
|
||||||
|
TableRowData tr = td.addRow();
|
||||||
|
if (rt.hasResource()) {
|
||||||
|
tr.value("Resource", rt.getResourceElement());
|
||||||
|
}
|
||||||
|
for (StringType t : rt.getInclude()) {
|
||||||
|
tr.value("Includes", t);
|
||||||
|
}
|
||||||
|
for (StringType t : rt.getRevInclude()) {
|
||||||
|
tr.value("Reverse Includes", t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
renderTable(td, x);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void describe(XhtmlNode x, Library lib) {
|
||||||
|
x.tx(display(lib));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String display(Library lib) {
|
||||||
|
return lib.present();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String display(Resource r) throws UnsupportedEncodingException, IOException {
|
||||||
|
return ((Library) r).present();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String display(ResourceWrapper r) throws UnsupportedEncodingException, IOException {
|
||||||
|
if (r.has("title")) {
|
||||||
|
return r.children("title").get(0).getBase().primitiveValue();
|
||||||
|
}
|
||||||
|
return "??";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -223,9 +223,9 @@ public class ValueSetValidator {
|
||||||
for (Coding c : code.getCoding()) {
|
for (Coding c : code.getCoding()) {
|
||||||
b.append(c.getSystem()+(c.hasVersion() ? "|"+c.getVersion() : "")+"#"+c.getCode());
|
b.append(c.getSystem()+(c.hasVersion() ? "|"+c.getVersion() : "")+"#"+c.getCode());
|
||||||
Boolean ok = codeInValueSet(c.getSystem(), c.getVersion(), c.getCode(), info);
|
Boolean ok = codeInValueSet(c.getSystem(), c.getVersion(), c.getCode(), info);
|
||||||
if (ok == null && result == false) {
|
if (ok == null && result != null && result == false) {
|
||||||
result = null;
|
result = null;
|
||||||
} else if (ok) {
|
} else if (ok != null && ok) {
|
||||||
result = true;
|
result = true;
|
||||||
foundCoding = c;
|
foundCoding = c;
|
||||||
if (options.getValueSetMode() == ValueSetMode.CHECK_MEMERSHIP_ONLY) {
|
if (options.getValueSetMode() == ValueSetMode.CHECK_MEMERSHIP_ONLY) {
|
||||||
|
|
|
@ -754,6 +754,10 @@ public class XhtmlNode extends XhtmlFluent implements IBaseXhtml {
|
||||||
return setAttribute("colspan", n);
|
return setAttribute("colspan", n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public XhtmlNode colspan(int n) {
|
||||||
|
return setAttribute("colspan", Integer.toString(n));
|
||||||
|
}
|
||||||
|
|
||||||
// differs from tx because it returns the owner node, not the created text
|
// differs from tx because it returns the owner node, not the created text
|
||||||
public XhtmlNode txN(String cnt) {
|
public XhtmlNode txN(String cnt) {
|
||||||
addText(cnt);
|
addText(cnt);
|
||||||
|
|
Loading…
Reference in New Issue