Class Result

java.lang.Object
org.jpos.rc.Result
All Implemented Interfaces:
Loggeable

public class Result extends Object implements Loggeable
Represents the Result of a transaction
  • Constructor Details

    • Result

      public Result()
      Default constructor.
  • Method Details

    • info

      public Result info(String source, String format, Object... args)
      Adds an informational entry to this result.
      Parameters:
      source - the source identifier of the entry
      format - printf-style format string
      args - format arguments
      Returns:
      this Result instance
    • warn

      public Result warn(String source, String format, Object... args)
      Adds a warning entry to this result.
      Parameters:
      source - the source identifier of the entry
      format - printf-style format string
      args - format arguments
      Returns:
      this Result instance
    • success

      public Result success(IRC irc, String source, String format, Object... args)
      Adds a success entry to this result.
      Parameters:
      irc - the success IRC code (must satisfy IRC.success())
      source - the source identifier of the entry
      format - printf-style format string
      args - format arguments
      Returns:
      this Result instance
      Throws:
      IllegalArgumentException - if the IRC is not a success code
    • fail

      public Result fail(IRC irc, String source, String format, Object... args)
      Adds a failure entry to this result.
      Parameters:
      irc - the failure IRC code
      source - the source identifier of the entry
      format - printf-style format string
      args - format arguments
      Returns:
      this Result instance
    • FAIL

      public int FAIL()
      Helper method used to avoid adding an extra 'return' line in failing transaction participants
      Returns:
      TransactionConstants.FAIL which is basically ABORT | READONLY | NO_JOIN;
    • hasInfo

      public boolean hasInfo()
      Returns true if this result contains at least one informational entry.
      Returns:
      true if an INFO entry is present
    • hasWarnings

      public boolean hasWarnings()
      Returns true if this result contains at least one warning entry.
      Returns:
      true if a WARN entry is present
    • hasFailures

      public boolean hasFailures()
      Returns true if this result contains at least one failure entry.
      Returns:
      true if a FAIL entry is present
    • hasInhibit

      public boolean hasInhibit()
      Returns true if any entry has an IRC that is marked as inhibit.
      Returns:
      true if an inhibit IRC is present
    • hasIRC

      public boolean hasIRC(IRC irc)
      Returns true if any entry carries the given IRC code.
      Parameters:
      irc - the IRC to look for
      Returns:
      true if the IRC is found in any entry
    • hasFailure

      public boolean hasFailure(IRC irc)
      Returns true if there is a failure entry with the given IRC code.
      Parameters:
      irc - the failure IRC to look for
      Returns:
      true if a failure entry with the given IRC is present
    • hasWarning

      public boolean hasWarning(IRC irc)
      Returns true if there is a warning entry with the given IRC code.
      Parameters:
      irc - the warning IRC to look for
      Returns:
      true if a warning entry with the given IRC is present
    • hasInfo

      public boolean hasInfo(IRC irc)
      Returns true if there is an informational entry with the given IRC code.
      Parameters:
      irc - the info IRC to look for
      Returns:
      true if an info entry with the given IRC is present
    • isSuccess

      public boolean isSuccess()
      Returns true if this result has a success entry and no failure entries.
      Returns:
      true if the overall result is a success
    • failure

      Returns the first failure entry, or null if none exists.
      Returns:
      the first Result.Entry of type FAIL, or null
    • success

      Returns the first success entry if the result is successful, or null otherwise.
      Returns:
      the first Result.Entry of type SUCCESS if successful, or null
    • entries

      Returns the full list of all entries in this result.
      Returns:
      list of all Result.Entry objects
    • infoList

      Returns a list of all informational entries.
      Returns:
      list of INFO Result.Entry objects
    • successList

      Returns a list of all success entries.
      Returns:
      list of SUCCESS Result.Entry objects
    • warningList

      Returns a list of all warning entries.
      Returns:
      list of WARN Result.Entry objects
    • failureList

      Returns a list of all failure entries.
      Returns:
      list of FAIL Result.Entry objects
    • dump

      public void dump(PrintStream ps, String indent)
      Description copied from interface: Loggeable
      Dumps a human-readable representation of this object to the print stream.
      Specified by:
      dump in interface Loggeable
      Parameters:
      ps - the output stream
      indent - indentation prefix
    • toString

      public String toString()
      Overrides:
      toString in class Object