1 /* 2 * Created on 16-Apr-2004 3 */ 4 package ca.uhn.hl7v2.protocol; 5 6 /** 7 * <p>Determines whether messages are acceptable for storage. See HL7 8 * v2.5 chapter 2 for relevant specifications. In original-mode 9 * processing, validation at this level includes checking whether 10 * MSH-9, 11, and 12 have appropriate values.</p> 11 * 12 * <p>In enhanced mode, the above checks are optional. Checking for 13 * syntactical correctness is also optional. However storage availability 14 * and interface status must be checked.</p> 15 * 16 * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a> 17 * @version $Revision: 1.1 $ updated on $Date: 2007-02-19 02:24:38 $ by $Author: jamesagnew $ 18 */ 19 public interface AcceptValidator { 20 21 /** 22 * Returns a ruling regarding whether the given message can be accepted 23 * for further processing (ie determines CE, CR, or CA for enhanced mode, 24 * and AR for original mode). 25 * 26 * @param theMessage the message to check for acceptability. 27 * @return 28 */ 29 AcceptRuling check(Transportable theMessage); 30 31 /** 32 * Represents a decision regarding whether a message can be initially 33 * accepted for further processing. As per HL7 specs, for original-mode 34 * messages, a message should be accepted at this stage if the system thinks it can handle 35 * the message based on MSH-9, 11, and 12 values (assuming these can be parsed). 36 * 37 * In enhanced mode, the above checks are optional. Also optional is a check for 38 * syntactical correctness. Mandatory checks include availability of safe storage 39 * and "interface status". 40 * 41 * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a> 42 * @version $Revision: 1.1 $ updated on $Date: 2007-02-19 02:24:38 $ by $Author: jamesagnew $ 43 */ 44 interface AcceptRuling { 45 46 String ACK_AR = "AR"; 47 String ACK_CA = "CA"; 48 String ACK_CE = "CE"; 49 String ACK_CR = "CR"; 50 51 /** 52 * @return true if the message can be accepted at the protocol stage. 53 */ 54 boolean isAcceptable(); 55 56 /** 57 * @return the ACK code corresponding to the ruling, if any. Ie "AR", 58 * "CE", "CR", or "CA". If in original mode, null is returned for non-"AR" 59 * situations. This is because only the application layer can tell whether the 60 * answer is "AE" or "AA". 61 */ 62 String getAckCode(); 63 64 /** 65 * @return an error code from among the static fields of HL7Exception 66 * (if no error, HL7Exception.MESSAGE_ACCEPTED) 67 */ 68 int getErrorCode(); 69 70 /** 71 * @return zero or more reasons for rejecting a message (suitable for inclusion 72 * in a reply). 73 */ 74 String[] getReasons(); 75 } 76 77 }