![](/hapi-fhir/images/logos/raccoon-forwards.png)
001/*- 002 * #%L 003 * HAPI FHIR - Server Framework 004 * %% 005 * Copyright (C) 2014 - 2024 Smile CDR, Inc. 006 * %% 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * You may obtain a copy of the License at 010 * 011 * http://www.apache.org/licenses/LICENSE-2.0 012 * 013 * Unless required by applicable law or agreed to in writing, software 014 * distributed under the License is distributed on an "AS IS" BASIS, 015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 016 * See the License for the specific language governing permissions and 017 * limitations under the License. 018 * #L% 019 */ 020package ca.uhn.fhir.rest.server.interceptor.validation.address; 021 022import ca.uhn.fhir.context.FhirContext; 023import org.hl7.fhir.instance.model.api.IBase; 024 025/** 026 * Contract for validating addresses. 027 */ 028public interface IAddressValidator { 029 030 /** 031 * URL for validation results that should be placed on addresses. Extension with boolean value "true" indicates there there is an address validation error. 032 */ 033 public static final String ADDRESS_VALIDATION_EXTENSION_URL = 034 "http://hapifhir.org/StructureDefinition/ext-validation-address-has-error"; 035 036 /** 037 * URL for an optional address quality extensions that may be added to addresses. 038 */ 039 public static final String ADDRESS_QUALITY_EXTENSION_URL = 040 "http://hapifhir.org/StructureDefinition/ext-validation-address-quality"; 041 042 /** 043 * URL for an optional geocoding accuracy extensions that may be added to addresses. 044 */ 045 public static final String ADDRESS_GEO_ACCURACY_EXTENSION_URL = 046 "http://hapifhir.org/StructureDefinition/ext-validation-address-geo-accuracy"; 047 048 /** 049 * URL for an optional address verification extensions that may be added to addresses. 050 */ 051 public static final String ADDRESS_VERIFICATION_CODE_EXTENSION_URL = 052 "http://hapifhir.org/StructureDefinition/ext-validation-address-verification"; 053 054 /** 055 * URL for an optional FHIR geolocation extension. 056 */ 057 public static final String FHIR_GEOCODE_EXTENSION_URL = "http://hl7.org/fhir/StructureDefinition/geolocation"; 058 059 /** 060 * Validates address against a service 061 * 062 * @param theAddress Address to be validated 063 * @param theFhirContext Current FHIR context 064 * @return Returns true in case address represents a valid 065 * @throws AddressValidationException AddressValidationException is thrown in case validation can not be completed successfully. 066 */ 067 AddressValidationResult isValid(IBase theAddress, FhirContext theFhirContext) throws AddressValidationException; 068}