use of org.hl7.fhir.r5.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method registerResourceFromPackage.
public void registerResourceFromPackage(CanonicalResourceProxy r, PackageVersion packageInfo) throws FHIRException {
synchronized (lock) {
if (r.getId() != null) {
Map<String, ResourceProxy> map = allResourcesById.get(r.getType());
if (map == null) {
map = new HashMap<String, ResourceProxy>();
allResourcesById.put(r.getType(), map);
}
if ((packageInfo == null || !packageInfo.isExamplesPackage()) || !map.containsKey(r.getId())) {
map.put(r.getId(), new ResourceProxy(r));
}
}
String url = r.getUrl();
if (!allowLoadingDuplicates && hasResource(r.getType(), url)) {
// spcial workaround for known problems with existing packages
if (Utilities.existsInList(url, "http://hl7.org/fhir/SearchParameter/example")) {
return;
}
throw new DefinitionException(formatMessage(I18nConstants.DUPLICATE_RESOURCE_, url));
}
switch(r.getType()) {
case "StructureDefinition":
if ("1.4.0".equals(version)) {
StructureDefinition sd = (StructureDefinition) r.getResource();
fixOldSD(sd);
}
structures.register(r, packageInfo);
break;
case "ValueSet":
valueSets.register(r, packageInfo);
break;
case "CodeSystem":
codeSystems.register(r, packageInfo);
break;
case "ImplementationGuide":
guides.register(r, packageInfo);
break;
case "CapabilityStatement":
capstmts.register(r, packageInfo);
break;
case "Measure":
measures.register(r, packageInfo);
break;
case "Library":
libraries.register(r, packageInfo);
break;
case "SearchParameter":
searchParameters.register(r, packageInfo);
break;
case "PlanDefinition":
plans.register(r, packageInfo);
break;
case "OperationDefinition":
operations.register(r, packageInfo);
break;
case "Questionnaire":
questionnaires.register(r, packageInfo);
break;
case "ConceptMap":
maps.register(r, packageInfo);
break;
case "StructureMap":
transforms.register(r, packageInfo);
break;
case "NamingSystem":
systems.register(r, packageInfo);
break;
}
}
}
use of org.hl7.fhir.r5.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method cacheResourceFromPackage.
public void cacheResourceFromPackage(Resource r, PackageVersion packageInfo) throws FHIRException {
synchronized (lock) {
if (r.getId() != null) {
Map<String, ResourceProxy> map = allResourcesById.get(r.fhirType());
if (map == null) {
map = new HashMap<String, ResourceProxy>();
allResourcesById.put(r.fhirType(), map);
}
if ((packageInfo == null || !packageInfo.isExamplesPackage()) || !map.containsKey(r.getId())) {
map.put(r.getId(), new ResourceProxy(r));
} else {
logger.logDebugMessage(LogCategory.PROGRESS, "Ignore " + r.fhirType() + "/" + r.getId() + " from package " + packageInfo.toString());
}
}
if (r instanceof CodeSystem || r instanceof NamingSystem) {
oidCache.clear();
}
if (r instanceof CanonicalResource) {
CanonicalResource m = (CanonicalResource) r;
String url = m.getUrl();
if (!allowLoadingDuplicates && hasResource(r.getClass(), url)) {
// special workaround for known problems with existing packages
if (Utilities.existsInList(url, "http://hl7.org/fhir/SearchParameter/example")) {
return;
}
throw new DefinitionException(formatMessage(I18nConstants.DUPLICATE_RESOURCE_, url));
}
if (r instanceof StructureDefinition) {
StructureDefinition sd = (StructureDefinition) m;
if ("1.4.0".equals(version)) {
fixOldSD(sd);
}
structures.see(sd, packageInfo);
} else if (r instanceof ValueSet) {
valueSets.see((ValueSet) m, packageInfo);
} else if (r instanceof CodeSystem) {
CodeSystemUtilities.crossLinkCodeSystem((CodeSystem) r);
codeSystems.see((CodeSystem) m, packageInfo);
} else if (r instanceof ImplementationGuide) {
guides.see((ImplementationGuide) m, packageInfo);
} else if (r instanceof CapabilityStatement) {
capstmts.see((CapabilityStatement) m, packageInfo);
} else if (r instanceof Measure) {
measures.see((Measure) m, packageInfo);
} else if (r instanceof Library) {
libraries.see((Library) m, packageInfo);
} else if (r instanceof SearchParameter) {
searchParameters.see((SearchParameter) m, packageInfo);
} else if (r instanceof PlanDefinition) {
plans.see((PlanDefinition) m, packageInfo);
} else if (r instanceof OperationDefinition) {
operations.see((OperationDefinition) m, packageInfo);
} else if (r instanceof Questionnaire) {
questionnaires.see((Questionnaire) m, packageInfo);
} else if (r instanceof ConceptMap) {
maps.see((ConceptMap) m, packageInfo);
} else if (r instanceof StructureMap) {
transforms.see((StructureMap) m, packageInfo);
} else if (r instanceof NamingSystem) {
systems.see((NamingSystem) m, packageInfo);
}
}
}
}
use of org.hl7.fhir.r5.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composePlanDefinitionPlanDefinitionActionRelatedActionComponent.
protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(Complex parent, String parentType, String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "relatedAction", name, element, index);
if (element.hasActionIdElement())
composeId(t, "PlanDefinition", "actionId", element.getActionIdElement(), -1);
if (element.hasRelationshipElement())
composeEnum(t, "PlanDefinition", "relationship", element.getRelationshipElement(), -1);
if (element.hasOffset())
composeType(t, "PlanDefinition", "offset", element.getOffset(), -1);
}
use of org.hl7.fhir.r5.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composePlanDefinitionPlanDefinitionActionComponent.
protected void composePlanDefinitionPlanDefinitionActionComponent(Complex parent, String parentType, String name, PlanDefinition.PlanDefinitionActionComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "action", name, element, index);
if (element.hasPrefixElement())
composeString(t, "PlanDefinition", "prefix", element.getPrefixElement(), -1);
if (element.hasTitleElement())
composeString(t, "PlanDefinition", "title", element.getTitleElement(), -1);
if (element.hasDescriptionElement())
composeString(t, "PlanDefinition", "description", element.getDescriptionElement(), -1);
if (element.hasTextEquivalentElement())
composeString(t, "PlanDefinition", "textEquivalent", element.getTextEquivalentElement(), -1);
if (element.hasPriorityElement())
composeEnum(t, "PlanDefinition", "priority", element.getPriorityElement(), -1);
for (int i = 0; i < element.getCode().size(); i++) composeCodeableConcept(t, "PlanDefinition", "code", element.getCode().get(i), i);
for (int i = 0; i < element.getReason().size(); i++) composeCodeableConcept(t, "PlanDefinition", "reason", element.getReason().get(i), i);
for (int i = 0; i < element.getDocumentation().size(); i++) composeRelatedArtifact(t, "PlanDefinition", "documentation", element.getDocumentation().get(i), i);
for (int i = 0; i < element.getGoalId().size(); i++) composeId(t, "PlanDefinition", "goalId", element.getGoalId().get(i), i);
if (element.hasSubject())
composeType(t, "PlanDefinition", "subject", element.getSubject(), -1);
for (int i = 0; i < element.getTrigger().size(); i++) composeTriggerDefinition(t, "PlanDefinition", "trigger", element.getTrigger().get(i), i);
for (int i = 0; i < element.getCondition().size(); i++) composePlanDefinitionPlanDefinitionActionConditionComponent(t, "PlanDefinition", "condition", element.getCondition().get(i), i);
for (int i = 0; i < element.getInput().size(); i++) composeDataRequirement(t, "PlanDefinition", "input", element.getInput().get(i), i);
for (int i = 0; i < element.getOutput().size(); i++) composeDataRequirement(t, "PlanDefinition", "output", element.getOutput().get(i), i);
for (int i = 0; i < element.getRelatedAction().size(); i++) composePlanDefinitionPlanDefinitionActionRelatedActionComponent(t, "PlanDefinition", "relatedAction", element.getRelatedAction().get(i), i);
if (element.hasTiming())
composeType(t, "PlanDefinition", "timing", element.getTiming(), -1);
for (int i = 0; i < element.getParticipant().size(); i++) composePlanDefinitionPlanDefinitionActionParticipantComponent(t, "PlanDefinition", "participant", element.getParticipant().get(i), i);
if (element.hasType())
composeCodeableConcept(t, "PlanDefinition", "type", element.getType(), -1);
if (element.hasGroupingBehaviorElement())
composeEnum(t, "PlanDefinition", "groupingBehavior", element.getGroupingBehaviorElement(), -1);
if (element.hasSelectionBehaviorElement())
composeEnum(t, "PlanDefinition", "selectionBehavior", element.getSelectionBehaviorElement(), -1);
if (element.hasRequiredBehaviorElement())
composeEnum(t, "PlanDefinition", "requiredBehavior", element.getRequiredBehaviorElement(), -1);
if (element.hasPrecheckBehaviorElement())
composeEnum(t, "PlanDefinition", "precheckBehavior", element.getPrecheckBehaviorElement(), -1);
if (element.hasCardinalityBehaviorElement())
composeEnum(t, "PlanDefinition", "cardinalityBehavior", element.getCardinalityBehaviorElement(), -1);
if (element.hasDefinition())
composeType(t, "PlanDefinition", "definition", element.getDefinition(), -1);
if (element.hasTransformElement())
composeCanonical(t, "PlanDefinition", "transform", element.getTransformElement(), -1);
for (int i = 0; i < element.getDynamicValue().size(); i++) composePlanDefinitionPlanDefinitionActionDynamicValueComponent(t, "PlanDefinition", "dynamicValue", element.getDynamicValue().get(i), i);
for (int i = 0; i < element.getAction().size(); i++) composePlanDefinitionPlanDefinitionActionComponent(t, "PlanDefinition", "action", element.getAction().get(i), i);
}
use of org.hl7.fhir.r5.model.PlanDefinition in project org.hl7.fhir.core by hapifhir.
the class DataRenderer method isCanonical.
private boolean isCanonical(String path) {
if (!path.endsWith(".url"))
return false;
String t = path.substring(0, path.length() - 4);
StructureDefinition sd = getContext().getWorker().fetchTypeDefinition(t);
if (sd == null)
return false;
if (Utilities.existsInList(t, VersionUtilities.getCanonicalResourceNames(getContext().getWorker().getVersion()))) {
return true;
}
if (Utilities.existsInList(t, "ActivityDefinition", "CapabilityStatement", "CapabilityStatement2", "ChargeItemDefinition", "Citation", "CodeSystem", "CompartmentDefinition", "ConceptMap", "ConditionDefinition", "EventDefinition", "Evidence", "EvidenceReport", "EvidenceVariable", "ExampleScenario", "GraphDefinition", "ImplementationGuide", "Library", "Measure", "MessageDefinition", "NamingSystem", "PlanDefinition"))
return true;
return sd.getBaseDefinitionElement().hasExtension("http://hl7.org/fhir/StructureDefinition/structuredefinition-codegen-super");
}
Aggregations