com.ibm.as400.access
Class AS400Message

java.lang.Object
  |
  +--com.ibm.as400.access.AS400Message
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
QueuedMessage

public class AS400Message
extends java.lang.Object
implements java.io.Serializable

The AS400Message class represents a message returned from an AS/400. A Java program does not normally create AS400Message objects directly. Instead, AS400Message objects are created and returned by various other AS/400 Toolbox for Java components.
Usage hint: To fully "prime" an AS400Message object with additional information that otherwise might not be returned from the AS/400, call the load() method. For example, if getHelp() returns null, try preceding the getHelp() with a call to load().

See Also:
AS400Exception, CommandCall, ProgramCall, SpooledFile, Serialized Form

Field Summary
static int COMPLETION
          Message type for completion messages.
static int DIAGNOSTIC
          Message type for diagnostic messages.
static int ESCAPE
          Message type for escape (exception already handled when API is called) messages.
static int ESCAPE_NOT_HANDLED
          Message type for escape (exception not handled when API is called) messages.
static int INFORMATIONAL
          Message type for informational messages.
static int INQUIRY
          Message type for inquiry messages.
static int NOTIFY
          Message type for notify (exception already handled when API is called) messages.
static int NOTIFY_NOT_HANDLED
          Message type for notify (exception not handled when API is called) messages.
static int REPLY_FROM_SYSTEM_REPLY_LIST
          Message type for reply, from system reply list messages.
static int REPLY_MESSAGE_DEFAULT_USED
          Message type for reply, message default used messages.
static int REPLY_NOT_VALIDITY_CHECKED
          Message type for reply, not validity checked messages.
static int REPLY_SYSTEM_DEFAULT_USED
          Message type for reply, system default used messages.
static int REPLY_VALIDITY_CHECKED
          Message type for reply, validity checked messages.
static int REQUEST
          Message type for request messages.
static int REQUEST_WITH_PROMPTING
          Message type for request with prompting messages.
static int SENDERS_COPY
          Message type for sender's copy messages.
 
Method Summary
 java.util.Calendar getDate()
          Returns the date and time the message was sent.
 java.lang.String getDefaultReply()
          Returns the default reply.
 java.lang.String getFileName()
          Returns the message file name.
 java.lang.String getHelp()
          Returns the message help.
 java.lang.String getID()
          Returns the message ID.
 java.lang.String getLibraryName()
          Returns the message file library.
 java.lang.String getPath()
          Returns the full integrated file system path name of the message file.
 int getSeverity()
          Returns the message severity.
 byte[] getSubstitutionData()
          Returns the substitution data.
 java.lang.String getText()
          Returns the message text with the substitution text inserted.
 int getType()
          Returns the message type.
 void load()
          Loads additional message information from AS/400.
 void load(int helpTextFormatting)
          Loads additional message information from AS/400.
 java.lang.String toString()
          Returns the message ID and message text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COMPLETION

public static final int COMPLETION
Message type for completion messages.

DIAGNOSTIC

public static final int DIAGNOSTIC
Message type for diagnostic messages.

INFORMATIONAL

public static final int INFORMATIONAL
Message type for informational messages.

INQUIRY

public static final int INQUIRY
Message type for inquiry messages.

SENDERS_COPY

public static final int SENDERS_COPY
Message type for sender's copy messages.

REQUEST

public static final int REQUEST
Message type for request messages.

REQUEST_WITH_PROMPTING

public static final int REQUEST_WITH_PROMPTING
Message type for request with prompting messages.

NOTIFY

public static final int NOTIFY
Message type for notify (exception already handled when API is called) messages.

ESCAPE

public static final int ESCAPE
Message type for escape (exception already handled when API is called) messages.

NOTIFY_NOT_HANDLED

public static final int NOTIFY_NOT_HANDLED
Message type for notify (exception not handled when API is called) messages.

ESCAPE_NOT_HANDLED

public static final int ESCAPE_NOT_HANDLED
Message type for escape (exception not handled when API is called) messages.

REPLY_NOT_VALIDITY_CHECKED

public static final int REPLY_NOT_VALIDITY_CHECKED
Message type for reply, not validity checked messages.

REPLY_VALIDITY_CHECKED

public static final int REPLY_VALIDITY_CHECKED
Message type for reply, validity checked messages.

REPLY_MESSAGE_DEFAULT_USED

public static final int REPLY_MESSAGE_DEFAULT_USED
Message type for reply, message default used messages.

REPLY_SYSTEM_DEFAULT_USED

public static final int REPLY_SYSTEM_DEFAULT_USED
Message type for reply, system default used messages.

REPLY_FROM_SYSTEM_REPLY_LIST

public static final int REPLY_FROM_SYSTEM_REPLY_LIST
Message type for reply, from system reply list messages.
Method Detail

getDate

public java.util.Calendar getDate()
Returns the date and time the message was sent. The returned Calendar object will have the following fields set:
Returns:
The date and time the message was sent, or null if not applicable.

getDefaultReply

public java.lang.String getDefaultReply()
Returns the default reply.
Returns:
The default reply, or null if it is not set.

getFileName

public java.lang.String getFileName()
Returns the message file name.
Returns:
The message file name, or null if it is not set.

getHelp

public java.lang.String getHelp()
Returns the message help.

Message formatting characters may appear in the message help and are defined as follows:

Usage hint: If getHelp() returns null, try "priming" the AS400Message object by first calling load(), then getHelp().
Returns:
The message help, or null if it is not set.

getID

public java.lang.String getID()
Returns the message ID.
Returns:
The message ID, or null if it is not set.

getLibraryName

public java.lang.String getLibraryName()
Returns the message file library.
Returns:
The message file library, or null if it is not set.

getPath

public java.lang.String getPath()
Returns the full integrated file system path name of the message file.
Returns:
The full integrated file system path name of the message file name, or null if it is not set.

getSeverity

public int getSeverity()
Returns the message severity.
Returns:
The message severity. Valid values are between 0 and 99, or -1 if it is not set.

getSubstitutionData

public byte[] getSubstitutionData()
Returns the substitution data. This is unconverted data used to fill in the replacement characters in the message.
Returns:
The subsitution data, or null if not set.

getText

public java.lang.String getText()
Returns the message text with the substitution text inserted.
Returns:
The message text, or null if it is not set.

getType

public int getType()
Returns the message type.
Returns:
The message type, or negative one (-1) if it is not set. Valid values are:
  • COMPLETION
  • DIAGNOSTIC
  • INFORMATIONAL
  • INQUIRY
  • SENDERS_COPY
  • REQUEST
  • REQUEST_WITH_PROMPTING
  • NOTIFY
  • ESCAPE
  • REPLY_NOT_VALIDITY_CHECKED
  • REPLY_VALIDITY_CHECKED
  • REPLY_MESSAGE_DEFAULT_USED
  • REPLY_SYSTEM_DEFAULT_USED
  • REPLY_FROM_SYSTEM_REPLY_LIST

load

public void load()
          throws AS400SecurityException,
                 ErrorCompletingRequestException,
                 java.io.IOException,
                 java.lang.InterruptedException,
                 ObjectDoesNotExistException
Loads additional message information from AS/400.
Throws:
AS400SecurityException - If a security or authority error occurs.
ErrorCompletingRequestException - If an error occurs before the request is completed.
java.io.IOException - If an error occurs while communicating with the AS/400.
java.lang.InterruptedException - If this thread is interrupted.
ObjectDoesNotExistException - If the AS/400 object does not exist.

load

public void load(int helpTextFormatting)
          throws AS400SecurityException,
                 ErrorCompletingRequestException,
                 java.io.IOException,
                 java.lang.InterruptedException,
                 ObjectDoesNotExistException
Loads additional message information from AS/400.
Parameters:
helpTextFormatting - Formatting performed on the help text. Valid values for this parameter are defined in the MessageFile class. They are no formatting, return formatting characters, and replace (substitute) formatting characters.
Throws:
AS400SecurityException - If a security or authority error occurs.
ErrorCompletingRequestException - If an error occurs before the request is completed.
java.io.IOException - If an error occurs while communicating with the AS/400.
java.lang.InterruptedException - If this thread is interrupted.
ObjectDoesNotExistException - If the AS/400 object does not exist.

toString

public java.lang.String toString()
Returns the message ID and message text.
Overrides:
toString in class java.lang.Object
Returns:
The message ID and message text.