001package org.hl7.fhir.dstu2016may.validation; 002 003import com.google.gson.JsonObject; 004import org.hl7.fhir.dstu2016may.metamodel.Manager.FhirFormat; 005import org.hl7.fhir.dstu2016may.model.StructureDefinition; 006import org.hl7.fhir.utilities.validation.ValidationMessage; 007 008import java.io.InputStream; 009import java.util.List; 010 011/** 012 * Interface to the instance validator. This takes a resource, in one of many forms, and 013 * checks whether it is valid 014 * 015 * @author Grahame Grieve 016 * 017 */ 018public interface IResourceValidator { 019 020 public enum BestPracticeWarningLevel { 021 Ignore, 022 Hint, 023 Warning, 024 Error 025 } 026 027 public enum CheckDisplayOption { 028 Ignore, 029 Check, 030 CheckCaseAndSpace, 031 CheckCase, 032 CheckSpace 033 } 034 035 enum IdStatus { 036 OPTIONAL, REQUIRED, PROHIBITED 037 } 038 039 040 /** 041 * how much to check displays for coded elements 042 * @return 043 */ 044 CheckDisplayOption getCheckDisplay(); 045 void setCheckDisplay(CheckDisplayOption checkDisplay); 046 047 /** 048 * whether the resource must have an id or not (depends on context) 049 * 050 * @return 051 */ 052 053 IdStatus getResourceIdRule(); 054 void setResourceIdRule(IdStatus resourceIdRule); 055 056 /** 057 * whether the validator should enforce best practice guidelines 058 * as defined by various HL7 committees 059 * 060 */ 061 BestPracticeWarningLevel getBasePracticeWarningLevel(); 062 void setBestPracticeWarningLevel(BestPracticeWarningLevel value); 063 064 /** 065 * Validate suite 066 * 067 * you can validate one of the following representations of resources: 068 * 069 * stream - provide a format 070 * a native resource 071 * a metamodel resource 072 * a DOM element or Document 073 * a Json Object 074 * 075 */ 076 void validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format) throws Exception; 077 void validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format, String profile) throws Exception; 078 void validate(List<ValidationMessage> errors, InputStream stream, FhirFormat format, StructureDefinition profile) throws Exception; 079 void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu2016may.model.Resource resource) throws Exception; 080 void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu2016may.model.Resource resource, String profile) throws Exception; 081 void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu2016may.model.Resource resource, StructureDefinition profile) throws Exception; 082 void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu2016may.metamodel.Element element) throws Exception; 083 void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu2016may.metamodel.Element element, String profile) throws Exception; 084 void validate(List<ValidationMessage> errors, org.hl7.fhir.dstu2016may.metamodel.Element element, StructureDefinition profile) throws Exception; 085 void validate(List<ValidationMessage> errors, org.w3c.dom.Element element) throws Exception; 086 void validate(List<ValidationMessage> errors, org.w3c.dom.Element element, String profile) throws Exception; 087 void validate(List<ValidationMessage> errors, org.w3c.dom.Element element, StructureDefinition profile) throws Exception; 088 void validate(List<ValidationMessage> errors, org.w3c.dom.Document document) throws Exception; 089 void validate(List<ValidationMessage> errors, org.w3c.dom.Document document, String profile) throws Exception; 090 void validate(List<ValidationMessage> errors, org.w3c.dom.Document document, StructureDefinition profile) throws Exception; 091 void validate(List<ValidationMessage> errors, JsonObject object) throws Exception; 092 void validate(List<ValidationMessage> errors, JsonObject object, String profile) throws Exception; 093 void validate(List<ValidationMessage> errors, JsonObject object, StructureDefinition profile) throws Exception; 094}