use of org.hl7.fhir.r4b.model.SearchParameter in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method cacheResource.
public void cacheResource(Resource r) throws FHIRException {
synchronized (lock) {
Map<String, Resource> map = allResourcesById.get(r.fhirType());
if (map == null) {
map = new HashMap<String, Resource>();
allResourcesById.put(r.fhirType(), map);
}
map.put(r.getId(), r);
if (r instanceof MetadataResource) {
MetadataResource m = (MetadataResource) r;
String url = m.getUrl();
if (!allowLoadingDuplicates && hasResource(r.getClass(), url))
throw new DefinitionException("Duplicate Resource " + url);
if (r instanceof StructureDefinition)
seeMetadataResource((StructureDefinition) m, structures, false);
else if (r instanceof ValueSet)
seeMetadataResource((ValueSet) m, valueSets, false);
else if (r instanceof CodeSystem)
seeMetadataResource((CodeSystem) m, codeSystems, false);
else if (r instanceof ImplementationGuide)
seeMetadataResource((ImplementationGuide) m, guides, false);
else if (r instanceof CapabilityStatement)
seeMetadataResource((CapabilityStatement) m, capstmts, false);
else if (r instanceof SearchParameter)
seeMetadataResource((SearchParameter) m, searchParameters, false);
else if (r instanceof PlanDefinition)
seeMetadataResource((PlanDefinition) m, plans, false);
else if (r instanceof OperationDefinition)
seeMetadataResource((OperationDefinition) m, operations, false);
else if (r instanceof Questionnaire)
seeMetadataResource((Questionnaire) m, questionnaires, true);
else if (r instanceof ConceptMap)
seeMetadataResource((ConceptMap) m, maps, false);
else if (r instanceof StructureMap)
seeMetadataResource((StructureMap) m, transforms, false);
else if (r instanceof NamingSystem)
systems.add((NamingSystem) r);
}
}
}
use of org.hl7.fhir.r4b.model.SearchParameter in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeSearchParameterSearchParameterComponentComponent.
protected void composeSearchParameterSearchParameterComponentComponent(Complex parent, String parentType, String name, SearchParameter.SearchParameterComponentComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "component", name, element, index);
if (element.hasDefinition())
composeReference(t, "SearchParameter", "definition", element.getDefinition(), -1);
if (element.hasExpressionElement())
composeString(t, "SearchParameter", "expression", element.getExpressionElement(), -1);
}
use of org.hl7.fhir.r4b.model.SearchParameter in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeSearchParameter.
protected void composeSearchParameter(Complex parent, String parentType, String name, SearchParameter element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "SearchParameter", name, element, index);
if (element.hasUrlElement())
composeUri(t, "SearchParameter", "url", element.getUrlElement(), -1);
if (element.hasVersionElement())
composeString(t, "SearchParameter", "version", element.getVersionElement(), -1);
if (element.hasNameElement())
composeString(t, "SearchParameter", "name", element.getNameElement(), -1);
if (element.hasDerivedFromElement())
composeCanonical(t, "SearchParameter", "derivedFrom", element.getDerivedFromElement(), -1);
if (element.hasStatusElement())
composeEnum(t, "SearchParameter", "status", element.getStatusElement(), -1);
if (element.hasExperimentalElement())
composeBoolean(t, "SearchParameter", "experimental", element.getExperimentalElement(), -1);
if (element.hasDateElement())
composeDateTime(t, "SearchParameter", "date", element.getDateElement(), -1);
if (element.hasPublisherElement())
composeString(t, "SearchParameter", "publisher", element.getPublisherElement(), -1);
for (int i = 0; i < element.getContact().size(); i++) composeContactDetail(t, "SearchParameter", "contact", element.getContact().get(i), i);
if (element.hasDescriptionElement())
composeMarkdown(t, "SearchParameter", "description", element.getDescriptionElement(), -1);
for (int i = 0; i < element.getUseContext().size(); i++) composeUsageContext(t, "SearchParameter", "useContext", element.getUseContext().get(i), i);
for (int i = 0; i < element.getJurisdiction().size(); i++) composeCodeableConcept(t, "SearchParameter", "jurisdiction", element.getJurisdiction().get(i), i);
if (element.hasPurposeElement())
composeMarkdown(t, "SearchParameter", "purpose", element.getPurposeElement(), -1);
if (element.hasCodeElement())
composeCode(t, "SearchParameter", "code", element.getCodeElement(), -1);
for (int i = 0; i < element.getBase().size(); i++) composeCode(t, "SearchParameter", "base", element.getBase().get(i), i);
if (element.hasTypeElement())
composeEnum(t, "SearchParameter", "type", element.getTypeElement(), -1);
if (element.hasExpressionElement())
composeString(t, "SearchParameter", "expression", element.getExpressionElement(), -1);
if (element.hasXpathElement())
composeString(t, "SearchParameter", "xpath", element.getXpathElement(), -1);
if (element.hasXpathUsageElement())
composeEnum(t, "SearchParameter", "xpathUsage", element.getXpathUsageElement(), -1);
for (int i = 0; i < element.getTarget().size(); i++) composeCode(t, "SearchParameter", "target", element.getTarget().get(i), i);
if (element.hasMultipleOrElement())
composeBoolean(t, "SearchParameter", "multipleOr", element.getMultipleOrElement(), -1);
if (element.hasMultipleAndElement())
composeBoolean(t, "SearchParameter", "multipleAnd", element.getMultipleAndElement(), -1);
for (int i = 0; i < element.getComparator().size(); i++) composeEnum(t, "SearchParameter", "comparator", element.getComparator().get(i), i);
for (int i = 0; i < element.getModifier().size(); i++) composeEnum(t, "SearchParameter", "modifier", element.getModifier().get(i), i);
for (int i = 0; i < element.getChain().size(); i++) composeString(t, "SearchParameter", "chain", element.getChain().get(i), i);
for (int i = 0; i < element.getComponent().size(); i++) composeSearchParameterSearchParameterComponentComponent(t, "SearchParameter", "component", element.getComponent().get(i), i);
}
use of org.hl7.fhir.r4b.model.SearchParameter in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method cacheResourceFromPackage.
public void cacheResourceFromPackage(Resource r, PackageVersion packageInfo) throws FHIRException {
synchronized (lock) {
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 {
System.out.println("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)) {
// 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));
}
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.r4b.model.SearchParameter in project org.hl7.fhir.core by hapifhir.
the class BaseWorkerContext method registerResourceFromPackage.
public void registerResourceFromPackage(CanonicalResourceProxy r, PackageVersion packageInfo) throws FHIRException {
synchronized (lock) {
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;
}
}
}
Aggregations