| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| Rule |
|
| 1.0;1 |
| 1 | /** | |
| 2 | The contents of this file are subject to the Mozilla Public License Version 1.1 | |
| 3 | (the "License"); you may not use this file except in compliance with the License. | |
| 4 | You may obtain a copy of the License at http://www.mozilla.org/MPL/ | |
| 5 | Software distributed under the License is distributed on an "AS IS" basis, | |
| 6 | WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the | |
| 7 | specific language governing rights and limitations under the License. | |
| 8 | ||
| 9 | The Original Code is "Rule.java". Description: | |
| 10 | "A testable rule to which HL7 messages should conform" | |
| 11 | ||
| 12 | The Initial Developer of the Original Code is University Health Network. Copyright (C) | |
| 13 | 2002. All Rights Reserved. | |
| 14 | ||
| 15 | Contributor(s): ______________________________________. | |
| 16 | ||
| 17 | Alternatively, the contents of this file may be used under the terms of the | |
| 18 | GNU General Public License (the �GPL�), in which case the provisions of the GPL are | |
| 19 | applicable instead of those above. If you wish to allow use of your version of this | |
| 20 | file only under the terms of the GPL and not to allow others to use your version | |
| 21 | of this file under the MPL, indicate your decision by deleting the provisions above | |
| 22 | and replace them with the notice and other provisions required by the GPL License. | |
| 23 | If you do not delete the provisions above, a recipient may use your version of | |
| 24 | this file under either the MPL or the GPL. | |
| 25 | */ | |
| 26 | ||
| 27 | package ca.uhn.hl7v2.validation; | |
| 28 | ||
| 29 | import java.io.Serializable; | |
| 30 | ||
| 31 | /** | |
| 32 | * <p> | |
| 33 | * A testable rule to which HL7 messages (at least certain specific message) | |
| 34 | * should conform. | |
| 35 | * <p> | |
| 36 | * There are three kinds of rules: | |
| 37 | * <ul> | |
| 38 | * <li>PrimitiveTypeRule: Called when the values of simple datatypes are set, | |
| 39 | * like the existing hard-coded datatype validations (e.g. | |
| 40 | * TNFollowsNorthAmericanFormat).</li> | |
| 41 | * <li>MessageRule: Called when complete message content is to be checked on a | |
| 42 | * parsed message (e.g. conformance profile).</li> | |
| 43 | * <li>EncodingRule: Applied to an encoded message (e.g. validation against a | |
| 44 | * .xml Schema, a rule that prohibits empty tags, etc.).</li> | |
| 45 | * </ul> | |
| 46 | * </p> | |
| 47 | * | |
| 48 | * @author Bryan Tripp | |
| 49 | */ | |
| 50 | public interface Rule<T> extends Serializable { | |
| 51 | ||
| 52 | /** | |
| 53 | * Returns a text description of the rule. This description may be used as a | |
| 54 | * message in exceptions generated if validation against the rule fails, or | |
| 55 | * in a user interface for rule configuration. | |
| 56 | * | |
| 57 | * @return rule description | |
| 58 | */ | |
| 59 | public String getDescription(); | |
| 60 | ||
| 61 | /** | |
| 62 | * Returns a string indicating the section of the HL7 standard from which this rule | |
| 63 | * is derived (if applicable). Like the description, this may be used in an | |
| 64 | * exception message or configuration UI. | |
| 65 | * | |
| 66 | * @return HL7 specification section reference | |
| 67 | */ | |
| 68 | public String getSectionReference(); | |
| 69 | ||
| 70 | /** | |
| 71 | * Applies to rule to an object to be checked | |
| 72 | * | |
| 73 | * @param value object to be checked | |
| 74 | * @return an (potentially empty) array of ValidationExceptions | |
| 75 | */ | |
| 76 | public ValidationException[] apply(T value); | |
| 77 | ||
| 78 | } |