Search in sources :

Example 51 with OperationDefinition

use of org.hl7.fhir.r4.model.OperationDefinition in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeOperationDefinitionOperationDefinitionParameterComponent.

protected void composeOperationDefinitionOperationDefinitionParameterComponent(Complex parent, String parentType, String name, OperationDefinition.OperationDefinitionParameterComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "parameter", name, element, index);
    if (element.hasNameElement())
        composeCode(t, "OperationDefinition", "name", element.getNameElement(), -1);
    if (element.hasUseElement())
        composeEnum(t, "OperationDefinition", "use", element.getUseElement(), -1);
    if (element.hasMinElement())
        composeInteger(t, "OperationDefinition", "min", element.getMinElement(), -1);
    if (element.hasMaxElement())
        composeString(t, "OperationDefinition", "max", element.getMaxElement(), -1);
    if (element.hasDocumentationElement())
        composeString(t, "OperationDefinition", "documentation", element.getDocumentationElement(), -1);
    if (element.hasTypeElement())
        composeCode(t, "OperationDefinition", "type", element.getTypeElement(), -1);
    if (element.hasSearchTypeElement())
        composeEnum(t, "OperationDefinition", "searchType", element.getSearchTypeElement(), -1);
    if (element.hasProfile())
        composeReference(t, "OperationDefinition", "profile", element.getProfile(), -1);
    if (element.hasBinding())
        composeOperationDefinitionOperationDefinitionParameterBindingComponent(t, "OperationDefinition", "binding", element.getBinding(), -1);
    for (int i = 0; i < element.getPart().size(); i++) composeOperationDefinitionOperationDefinitionParameterComponent(t, "OperationDefinition", "part", element.getPart().get(i), i);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 52 with OperationDefinition

use of org.hl7.fhir.r4.model.OperationDefinition in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeServiceDefinition.

protected void composeServiceDefinition(Complex parent, String parentType, String name, ServiceDefinition element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeDomainResource(t, "ServiceDefinition", name, element, index);
    if (element.hasUrlElement())
        composeUri(t, "ServiceDefinition", "url", element.getUrlElement(), -1);
    for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "ServiceDefinition", "identifier", element.getIdentifier().get(i), i);
    if (element.hasVersionElement())
        composeString(t, "ServiceDefinition", "version", element.getVersionElement(), -1);
    if (element.hasNameElement())
        composeString(t, "ServiceDefinition", "name", element.getNameElement(), -1);
    if (element.hasTitleElement())
        composeString(t, "ServiceDefinition", "title", element.getTitleElement(), -1);
    if (element.hasStatusElement())
        composeEnum(t, "ServiceDefinition", "status", element.getStatusElement(), -1);
    if (element.hasExperimentalElement())
        composeBoolean(t, "ServiceDefinition", "experimental", element.getExperimentalElement(), -1);
    if (element.hasDateElement())
        composeDateTime(t, "ServiceDefinition", "date", element.getDateElement(), -1);
    if (element.hasPublisherElement())
        composeString(t, "ServiceDefinition", "publisher", element.getPublisherElement(), -1);
    if (element.hasDescriptionElement())
        composeMarkdown(t, "ServiceDefinition", "description", element.getDescriptionElement(), -1);
    if (element.hasPurposeElement())
        composeMarkdown(t, "ServiceDefinition", "purpose", element.getPurposeElement(), -1);
    if (element.hasUsageElement())
        composeString(t, "ServiceDefinition", "usage", element.getUsageElement(), -1);
    if (element.hasApprovalDateElement())
        composeDate(t, "ServiceDefinition", "approvalDate", element.getApprovalDateElement(), -1);
    if (element.hasLastReviewDateElement())
        composeDate(t, "ServiceDefinition", "lastReviewDate", element.getLastReviewDateElement(), -1);
    if (element.hasEffectivePeriod())
        composePeriod(t, "ServiceDefinition", "effectivePeriod", element.getEffectivePeriod(), -1);
    for (int i = 0; i < element.getUseContext().size(); i++) composeUsageContext(t, "ServiceDefinition", "useContext", element.getUseContext().get(i), i);
    for (int i = 0; i < element.getJurisdiction().size(); i++) composeCodeableConcept(t, "ServiceDefinition", "jurisdiction", element.getJurisdiction().get(i), i);
    for (int i = 0; i < element.getTopic().size(); i++) composeCodeableConcept(t, "ServiceDefinition", "topic", element.getTopic().get(i), i);
    for (int i = 0; i < element.getContributor().size(); i++) composeContributor(t, "ServiceDefinition", "contributor", element.getContributor().get(i), i);
    for (int i = 0; i < element.getContact().size(); i++) composeContactDetail(t, "ServiceDefinition", "contact", element.getContact().get(i), i);
    if (element.hasCopyrightElement())
        composeMarkdown(t, "ServiceDefinition", "copyright", element.getCopyrightElement(), -1);
    for (int i = 0; i < element.getRelatedArtifact().size(); i++) composeRelatedArtifact(t, "ServiceDefinition", "relatedArtifact", element.getRelatedArtifact().get(i), i);
    for (int i = 0; i < element.getTrigger().size(); i++) composeTriggerDefinition(t, "ServiceDefinition", "trigger", element.getTrigger().get(i), i);
    for (int i = 0; i < element.getDataRequirement().size(); i++) composeDataRequirement(t, "ServiceDefinition", "dataRequirement", element.getDataRequirement().get(i), i);
    if (element.hasOperationDefinition())
        composeReference(t, "ServiceDefinition", "operationDefinition", element.getOperationDefinition(), -1);
}
Also used : Complex(org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)

Example 53 with OperationDefinition

use of org.hl7.fhir.r4.model.OperationDefinition in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeOperationDefinitionOperationDefinitionOverloadComponent.

protected void composeOperationDefinitionOperationDefinitionOverloadComponent(Complex parent, String parentType, String name, OperationDefinition.OperationDefinitionOverloadComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "overload", name, element, index);
    for (int i = 0; i < element.getParameterName().size(); i++) composeString(t, "OperationDefinition", "parameterName", element.getParameterName().get(i), i);
    if (element.hasCommentElement())
        composeString(t, "OperationDefinition", "comment", element.getCommentElement(), -1);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 54 with OperationDefinition

use of org.hl7.fhir.r4.model.OperationDefinition 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);
            }
        }
    }
}
Also used : Questionnaire(org.hl7.fhir.r4b.model.Questionnaire) ImplementationGuide(org.hl7.fhir.r4b.model.ImplementationGuide) CodeSystem(org.hl7.fhir.r4b.model.CodeSystem) CanonicalResourceProxy(org.hl7.fhir.r4b.context.CanonicalResourceManager.CanonicalResourceProxy) ResourceProxy(org.hl7.fhir.r4b.context.BaseWorkerContext.ResourceProxy) StructureMap(org.hl7.fhir.r4b.model.StructureMap) StructureDefinition(org.hl7.fhir.r4b.model.StructureDefinition) NamingSystem(org.hl7.fhir.r4b.model.NamingSystem) CapabilityStatement(org.hl7.fhir.r4b.model.CapabilityStatement) Measure(org.hl7.fhir.r4b.model.Measure) PlanDefinition(org.hl7.fhir.r4b.model.PlanDefinition) DefinitionException(org.hl7.fhir.exceptions.DefinitionException) Library(org.hl7.fhir.r4b.model.Library) SearchParameter(org.hl7.fhir.r4b.model.SearchParameter) ConceptMap(org.hl7.fhir.r4b.model.ConceptMap) CanonicalResource(org.hl7.fhir.r4b.model.CanonicalResource) ValueSet(org.hl7.fhir.r4b.model.ValueSet) OperationDefinition(org.hl7.fhir.r4b.model.OperationDefinition)

Example 55 with OperationDefinition

use of org.hl7.fhir.r4.model.OperationDefinition 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;
        }
    }
}
Also used : StructureDefinition(org.hl7.fhir.r4b.model.StructureDefinition) DefinitionException(org.hl7.fhir.exceptions.DefinitionException) CanonicalResourceProxy(org.hl7.fhir.r4b.context.CanonicalResourceManager.CanonicalResourceProxy) ResourceProxy(org.hl7.fhir.r4b.context.BaseWorkerContext.ResourceProxy)

Aggregations

OperationDefinition (org.hl7.fhir.r5.model.OperationDefinition)10 FHIRException (org.hl7.fhir.exceptions.FHIRException)9 DefinitionException (org.hl7.fhir.exceptions.DefinitionException)8 OperationDefinitionParameterComponent (org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterComponent)7 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)6 File (java.io.File)5 ArrayList (java.util.ArrayList)5 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)5 XmlParser (org.hl7.fhir.r5.formats.XmlParser)5 StructureDefinition (org.hl7.fhir.r5.model.StructureDefinition)5 Description (ca.uhn.fhir.model.api.annotation.Description)4 Operation (ca.uhn.fhir.rest.annotation.Operation)4 FileOutputStream (java.io.FileOutputStream)4 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)4 Parameters (org.hl7.fhir.r4.model.Parameters)4 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)4 StructureDefinition (org.hl7.fhir.r4b.model.StructureDefinition)4 CanonicalResource (org.hl7.fhir.r5.model.CanonicalResource)4 Extension (org.hl7.fhir.r5.model.Extension)4 ListResource (org.hl7.fhir.r5.model.ListResource)4