Class ControllerStatus

  • All Implemented Interfaces:
    JcmsConstants, JaliosConstants

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

      • 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 Detail

      • 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​(java.lang.String msg)
        Constructs a new ControllerStatus with the given message
        Parameters:
        msg - the message
        Since:
        jcms-5.0.0
    • Method Detail

      • 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​(java.lang.String prop,
                            java.lang.Object... propParams)
        Sets the property used for status message
        Parameters:
        prop - the property
        propParams - the property parameters
        Since:
        jcms-8
      • getProp

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

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

        public java.lang.String getMessage​(java.lang.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:
        setProp(String, Object...)
      • setMessage

        public void setMessage​(java.lang.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:
        setProp(String, Object...)
      • 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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
        Returns:
        the status message in the default language
        Since:
        jcms-5.0.0
      • getNestedStatusList

        public java.util.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