Interface ServerActionHandle<T extends ActionProgress,R extends Serializable>

Type Parameters:
T - Type of ActionProgress.
R - Type of result.

public interface ServerActionHandle<T extends ActionProgress,R extends Serializable>
This interface provides methods to handle server actions like e.g. ProjectStorage.startExport(de.espirit.firstspirit.access.export.ExportParameters) and gives access to the progress of the related action.
Since:
4.0.13
  • Method Summary

    Modifier and Type
    Method
    Description
    Cancel the related server action.
    void
    Checks, whether an exception has yet occurred during the execution of the related server action and throws it, if any.
    int
    Returns the unique id of the belonging server action.
    Returns the name of the belonging server action.
    getProgress(boolean removeActionIfFinished)
    Returns the current action progress of the related server action since the last progress poll.
    The recommended delay between polls is 1 to 2 seconds.
    getResult(boolean removeAction)
    Blocks until the execution of the related server action has been finished.
    boolean
    Indicates wether the related server action is still running, or not.
  • Method Details

    • getActionName

      String getActionName()
      Returns the name of the belonging server action.
      Returns:
      the name String
      Since:
      4.0.9
    • getActionId

      int getActionId()
      Returns the unique id of the belonging server action.
      Returns:
      the action id
      Since:
      4.0.9
    • getProgress

      T getProgress(boolean removeActionIfFinished) throws ServerActionNotFoundException
      Returns the current action progress of the related server action since the last progress poll.
      The recommended delay between polls is 1 to 2 seconds.
      Parameters:
      removeActionIfFinished - If true, the action will be removed, if finished.
      Returns:
      the current action progress
      Throws:
      ServerActionNotFoundException - if the related server action not longer exists on the server.
      Since:
      4.0.9
    • checkAndThrow

      void checkAndThrow() throws Exception
      Checks, whether an exception has yet occurred during the execution of the related server action and throws it, if any. This call does not block. Use getResult() if you want to know if the action completed successfully.
      Throws:
      Exception - if an exception has yet occurred during execution of the related server action.
      Since:
      4.0.13
    • getResult

      @Nullable R getResult() throws Exception
      Returns:
      the result of the action
      Throws:
      Exception - if the server action throws an exception.
      Since:
      4.0.13
    • getResult

      @Nullable R getResult(boolean removeAction) throws Exception
      Blocks until the execution of the related server action has been finished. Call this method with true if you don't want to call getProgress(boolean) afterwards to ensure action will be removed on server.
      Parameters:
      removeAction - use true to remove the belonging server action after this call
      Returns:
      the result of the action
      Throws:
      Exception - if the server action throws an exception.
      Since:
      4.1.27
    • cancelAction

      T cancelAction() throws ServerActionNotFoundException
      Cancel the related server action.
      Returns:
      Type of ActionProgress
      Throws:
      ServerActionNotFoundException - if the related server action not longer exists on the server.
      Since:
      4.0.9
    • isRunning

      boolean isRunning() throws ServerActionNotFoundException
      Indicates wether the related server action is still running, or not.
      Returns:
      true, if the server action is still running, false, otherwise
      Throws:
      ServerActionNotFoundException - if the related server action not longer exists on the server.
      Since:
      4.0.9