001package ca.uhn.fhir.validation;
002
003import org.hl7.fhir.instance.model.api.IBaseResource;
004
005import ca.uhn.fhir.model.api.Bundle;
006
007
008/*
009 * #%L
010 * HAPI FHIR - Core Library
011 * %%
012 * Copyright (C) 2014 - 2016 University Health Network
013 * %%
014 * Licensed under the Apache License, Version 2.0 (the "License");
015 * you may not use this file except in compliance with the License.
016 * You may obtain a copy of the License at
017 * 
018 *      http://www.apache.org/licenses/LICENSE-2.0
019 * 
020 * Unless required by applicable law or agreed to in writing, software
021 * distributed under the License is distributed on an "AS IS" BASIS,
022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
023 * See the License for the specific language governing permissions and
024 * limitations under the License.
025 * #L%
026 */
027
028/**
029 * An individual validation module, which applies validation rules against
030 * resources and adds failure/informational messages as it goes.
031 * 
032 * See <a href="http://jamesagnew.github.io/hapi-fhir/doc_validation.html">Validation</a>
033 * for a list of available modules. You may also create your own.
034 */
035public interface IValidatorModule {
036
037        /**
038         * Validate the actual resource.
039         * 
040         * The {@link IValidationContext} can be used to access the resource being validated,
041         * and is populated with the results.
042         */
043        void validateResource(IValidationContext<IBaseResource> theCtx);
044
045        /**
046         * This method applies only to DSTU1 Atom Bundles. All other validation will pass through
047         * {@link #validateResource(IValidationContext)} inclusing DSTU2+ Bundle resources. If you
048         * will not be validating DSTU1 Bundles, you may implement this method as
049         * a NO-OP.
050         */
051        void validateBundle(IValidationContext<Bundle> theContext);
052
053}