001/* 002 * Created on 16-Apr-2004 003 */ 004package ca.uhn.hl7v2.protocol; 005 006/** 007 * <p>Determines whether messages are acceptable for storage. See HL7 008 * v2.5 chapter 2 for relevant specifications. In original-mode 009 * processing, validation at this level includes checking whether 010 * MSH-9, 11, and 12 have appropriate values.</p> 011 * 012 * <p>In enhanced mode, the above checks are optional. Checking for 013 * syntactical correctness is also optional. However storage availability 014 * and interface status must be checked.</p> 015 * 016 * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a> 017 * @version $Revision: 1.1 $ updated on $Date: 2007-02-19 02:24:38 $ by $Author: jamesagnew $ 018 */ 019public interface AcceptValidator { 020 021 /** 022 * Returns a ruling regarding whether the given message can be accepted 023 * for further processing (ie determines CE, CR, or CA for enhanced mode, 024 * and AR for original mode). 025 * 026 * @param theMessage the message to check for acceptability. 027 * @return 028 */ 029 public AcceptRuling check(Transportable theMessage); 030 031 /** 032 * Represents a decision regarding whether a message can be initially 033 * accepted for further processing. As per HL7 specs, for original-mode 034 * messages, a message should be accepted at this stage if the system thinks it can handle 035 * the message based on MSH-9, 11, and 12 values (assuming these can be parsed). 036 * 037 * In enhanced mode, the above checks are optional. Also optional is a check for 038 * syntactical correctness. Mandatory checks include availability of safe storage 039 * and "interface status". 040 * 041 * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a> 042 * @version $Revision: 1.1 $ updated on $Date: 2007-02-19 02:24:38 $ by $Author: jamesagnew $ 043 */ 044 public interface AcceptRuling { 045 046 public static final String ACK_AR = "AR"; 047 public static final String ACK_CA = "CA"; 048 public static final String ACK_CE = "CE"; 049 public static final String ACK_CR = "CR"; 050 051 /** 052 * @return true if the message can be accepted at the protocol stage. 053 */ 054 public boolean isAcceptable(); 055 056 /** 057 * @return the ACK code corresponding to the ruling, if any. Ie "AR", 058 * "CE", "CR", or "CA". If in original mode, null is returned for non-"AR" 059 * situations. This is because only the application layer can tell whether the 060 * answer is "AE" or "AA". 061 */ 062 public String getAckCode(); 063 064 /** 065 * @return an error code from among the static fields of HL7Exception 066 * (if no error, HL7Exception.MESSAGE_ACCEPTED) 067 */ 068 public int getErrorCode(); 069 070 /** 071 * @return zero or more reasons for rejecting a message (suitable for inclusion 072 * in a reply). 073 */ 074 public String[] getReasons(); 075 } 076 077}