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