Class BaseAction

  • All Implemented Interfaces:
    JSONItem, LiveAction
    Direct Known Subclasses:
    FilteredAction

    public abstract class BaseAction
    extends java.lang.Object
    implements LiveAction
    Base implementation for the LiveAction interface. This abstract class offers some basic configuration tasks for building a LiveAction and also default implementations for the deprecated methods. It will speed up the implementation of a LiveAction by only implementing the handles and doExecute abstract methods.
    • Method Detail

      • execute

        public void execute​(Resource source,
                            Resource target,
                            LiveRelationship relation,
                            boolean autoSave,
                            boolean isResetRollout)
                     throws WCMException
        Executes the current action.
        - checks the preconditions using handles()
        - if preconditions are met the doExecute() is called
        - changes will be saved automatically if the autoSave flag is set to true

        This method needs that at least one of the Resource parameters (source,target) to be non-null when used in conjunction with the autoSave flag since a ResourceResolver will need to be obtained to save the changes. A NonExistingResource should be used when dealing with non existing resources.
        Specified by:
        execute in interface LiveAction
        Parameters:
        source - The Resource to roll-out. This may bee null
        target - The Resource to receive modification. This may bee null
        relation - LiveRelationship between the two given Resources
        autoSave - Save modifications
        isResetRollout - True if rollout is run in reset mode
        Throws:
        WCMException - if an error occurs
        See Also:
        RolloutManager.rollout(com.day.cq.wcm.msm.api.RolloutManager.RolloutParams)
      • resourceHasNode

        public static boolean resourceHasNode​(Resource resource)
        Simple test if a Resource exists and is adaptable to Node
        Parameters:
        resource - in question
        Returns:
        true if the Resource is non-synthetic and can be adapted to a Node
      • isPage

        public static boolean isPage​(Node node)
                              throws RepositoryException
        Checks if the given Node is considered a Page
        The check considers the "cq:Page" and its primary child the "jcr:content" Node as being a Page. This is as the RolloutManager calls the LiveActions with the later. As modifications should only be written to its content. Pages should not be changed.

        Pages are considered an aggregate of all the Nodes and sub-graph at its "jcr:content" Node. Thus Services may require special treatment of them. Eg. Replication, Revisions are bound to Pages.

        Parameters:
        node - to Test
        Returns:
        true if the Node's NodeType is of "cq:Page" or it is the Page's "jcr:content" Node
        Throws:
        RepositoryException - on errors accessing the Repository
      • getParameterName

        @Deprecated
        public java.lang.String getParameterName()
        Deprecated.
        Description copied from interface: LiveAction
        Returns the global parameter name of current action. Parameter name is used in requests.
        Specified by:
        getParameterName in interface LiveAction
        Returns:
        action parameter name
      • getRank

        @Deprecated
        public int getRank()
        Deprecated.
        Description copied from interface: LiveAction
        Returns execution rank of the action: actions are executed by ascending ranks
        Specified by:
        getRank in interface LiveAction
        Returns:
        action rank
      • getTitle

        @Deprecated
        public java.lang.String getTitle()
        Deprecated.
        Description copied from interface: LiveAction
        Returns the title of current action. Title is used to be displayed to end-user.
        Specified by:
        getTitle in interface LiveAction
        Returns:
        action name
      • getPropertiesNames

        @Deprecated
        public java.lang.String[] getPropertiesNames()
        Deprecated.
        Description copied from interface: LiveAction
        Returns names of the properties defined for this action.
        Specified by:
        getPropertiesNames in interface LiveAction
        Returns:
        array of parameters names