001package org.hl7.fhir.common.hapi.validation.validator;
002
003import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
004import ca.uhn.fhir.context.FhirContext;
005import ca.uhn.fhir.context.RuntimeCompositeDatatypeDefinition;
006import ca.uhn.fhir.context.RuntimePrimitiveDatatypeDefinition;
007import ca.uhn.fhir.context.RuntimeResourceDefinition;
008import org.apache.commons.lang3.Validate;
009import org.hl7.fhir.exceptions.FHIRException;
010import org.hl7.fhir.r5.model.ElementDefinition;
011import org.hl7.fhir.r5.model.StructureDefinition;
012
013public class ProfileKnowledgeWorkerR5 implements org.hl7.fhir.r5.conformance.ProfileUtilities.ProfileKnowledgeProvider {
014    private final FhirContext myCtx;
015
016    public ProfileKnowledgeWorkerR5(FhirContext theCtx) {
017        myCtx = theCtx;
018    }
019
020    @Override
021    public boolean isDatatype(String typeSimple) {
022        BaseRuntimeElementDefinition<?> def = myCtx.getElementDefinition(typeSimple);
023        Validate.notNull(typeSimple);
024        return (def instanceof RuntimePrimitiveDatatypeDefinition) || (def instanceof RuntimeCompositeDatatypeDefinition);
025    }
026
027    @Override
028    public boolean isResource(String typeSimple) {
029        BaseRuntimeElementDefinition<?> def = myCtx.getElementDefinition(typeSimple);
030        Validate.notNull(typeSimple);
031        return def instanceof RuntimeResourceDefinition;
032    }
033
034    @Override
035    public boolean hasLinkFor(String typeSimple) {
036        return false;
037    }
038
039    @Override
040    public String getLinkFor(String corePath, String typeSimple) {
041        return null;
042    }
043
044    @Override
045    public BindingResolution resolveBinding(StructureDefinition theStructureDefinition, ElementDefinition.ElementDefinitionBindingComponent theElementDefinitionBindingComponent, String theS) throws FHIRException {
046        return null;
047    }
048
049    @Override
050    public BindingResolution resolveBinding(StructureDefinition theStructureDefinition, String theS, String theS1) throws FHIRException {
051        return null;
052    }
053
054    @Override
055    public String getLinkForProfile(StructureDefinition theStructureDefinition, String theS) {
056        return null;
057    }
058
059    @Override
060    public boolean prependLinks() {
061        return false;
062    }
063
064    @Override
065    public String getLinkForUrl(String corePath, String url) {
066        throw new UnsupportedOperationException();
067    }
068
069}