Class ControllerStatus

java.lang.Object
com.jalios.jcms.ControllerStatus
All Implemented Interfaces:
JcmsConstants, JaliosConstants

public class ControllerStatus extends Object implements JcmsConstants
This class represents the status returned by a DataController.
Author:
Olivier Dedieu
  • Field Details

    • OK

      public static final ControllerStatus OK
      This status represents a sucessfull operation
      Since:
      jcms-5.0.0
    • FORBIDDEN

      public static final ControllerStatus FORBIDDEN
      This status represents a forbidden operation
      Since:
      jcms-5.0.0
  • Constructor Details

    • ControllerStatus

      public ControllerStatus()
      Constructs a new ControllerStatus
      Since:
      jcms-5.0.0
    • ControllerStatus

      public ControllerStatus(int topic)
      Constructs a new ControllerStatus with a given topic. Warning! This constructor is reserved for JPlatform internal usage.
      Parameters:
      topic - the topic (an internal JPlatform ControllerStatus topic)
      Since:
      jcms-5.0.0
    • ControllerStatus

      public ControllerStatus(String msg)
      Constructs a new ControllerStatus with the given message
      Parameters:
      msg - the message
      Since:
      jcms-5.0.0
  • Method Details

    • isForbidden

      public boolean isForbidden()
      Returns whether or not the operation is forbidden
      Returns:
      true if the status is a forbidden status
      Since:
      jcms-5.0.0
    • hasFailed

      public boolean hasFailed()
      Returns whether or not the operation has failed
      Returns:
      true if the status is a fail status
      Since:
      jcms-5.0.0
    • isOK

      public boolean isOK()
      Returns whether or not the operation was OK (equal to not hasFailed())
      Returns:
      true if the status is a OK status, false for a failed status
      Since:
      jcms-5.0.2
    • setProp

      public void setProp(String prop, Object... propParams)
      Sets the property used for status message
      Parameters:
      prop - the property
      propParams - the property parameters
      Since:
      jcms-8
    • getProp

      public String getProp()
      Returns:
      the property
      Since:
      jcms-5.0.0
    • getPropParams

      public Object[] getPropParams()
      Returns:
      the property parameters
      Since:
      jcms-8
    • getMessage

      public String getMessage(String userLang)
      Returns the status message. It may be either the message provided with setMessage() method or the value of property provided with setProp() methods. In this latter case, the message is localized according the userLang parameter. If there are nested status in this status, it will return all the message in a html form with <ul> <li> ... etc
      Parameters:
      userLang - the user language to be used to resolved the property
      Returns:
      the status message
      Since:
      jcms-5.0.0
      See Also:
    • setMessage

      public void setMessage(String msg)
      Sets the status message. This method should be only invoked for non-localized message. Otherwise use setProp() methods.
      Parameters:
      msg - message
      Since:
      jcms-5.0.0
      See Also:
    • getTopic

      public int getTopic()
      Returns:
      the topic of the status
      Since:
      jcms-5.0.0
    • setTopic

      public void setTopic(int v)
      Sets the topic of the status
      Parameters:
      v - topic
      Since:
      jcms-5.0.0
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      the status message in the default language
      Since:
      jcms-5.0.0
    • getNestedStatusList

      public ArrayList<ControllerStatus> getNestedStatusList()
      Returns:
      the list of all nested status (can be null)
      Since:
      jcms-5.0.2
    • addNestedStatus

      public void addNestedStatus(ControllerStatus status)
      Add a ControllerStatus to the list of nested status.
      Parameters:
      status - ControllerStatus
      Since:
      jcms-5.0.2