Class LongRunningProcess

java.lang.Object
java.lang.Thread
com.saperion.ngc.servlet.process.LongRunningProcess
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
ExportProcess, PdfRenderProcess

public abstract class LongRunningProcess extends Thread
Abstract class for processes that might take a long time to run. The processes are executed by the LongRunningProcessServlet. Because a LongRunningProcess is a thread, classes that extend this class must override Thread.run().
  • Field Details

    • CONTROL_BEAN_SESSION_ATTR

      public static final String CONTROL_BEAN_SESSION_ATTR
      Name of the session attribute used to store the control bean for long running processes.
      See Also:
    • bean

      protected final LRPControlBean bean
      Control bean for this process.
    • session

      protected final jakarta.servlet.http.HttpSession session
      Current session.
    • progress

      protected int progress
      Current progress (percent).
    • error

      protected boolean error
      If an error occurred.
    • canceled

      protected boolean canceled
      If the process was canceled.
    • connectionProvider

      protected NewConnectionClassicConnectorProvider connectionProvider
      Connection provider that provides a new connection for this process. Each process must take care of logging-off the connector when it is no longer in use.
  • Constructor Details

    • LongRunningProcess

      public LongRunningProcess(LRPControlBean bean, jakarta.servlet.http.HttpSession session)
      Parameters:
      bean - bean containing information for the process
      session - the current session
  • Method Details

    • writeResult

      public abstract void writeResult(jakarta.servlet.http.HttpServletResponse response) throws IOException, SystemException
      Writes the result of the process to the output-stream.
      Parameters:
      response - servlet response to write to
      Throws:
      IOException - IO Exception when writing
      SystemException - generic exception when writing
    • updateProgress

      protected void updateProgress(int currentElement, int totalElements)
      Updates the progress.
      Parameters:
      currentElement - element currently being processed
      totalElements - total number of elements
    • getProgress

      public int getProgress()
      Returns:
      the current progress
    • isError

      public boolean isError()
      Returns:
      true if an error occurred
    • cancel

      public void cancel()
      Cancels the process.