Package hudson.model

Class Actionable

    • Constructor Detail

      • Actionable

        public Actionable()
    • Method Detail

      • getAllActions

        @Exported(name="actions")
        @NonNull
        public final List<? extends Action> getAllActions()
        Gets all actions, transient or persistent. getActions() is supplemented with anything contributed by TransientActionFactory.
        Returns:
        an unmodifiable, possible empty list
        Since:
        1.548
      • getActions

        @NonNull
        public <T extends ActionList<T> getActions​(Class<T> type)
        Gets all actions of a specified type that contributed to this object.
        Parameters:
        type - The type of action to return.
        Returns:
        an unmodifiable, possible empty list
        See Also:
        getAction(Class)
      • addAction

        public void addAction​(@NonNull
                              Action a)
        Adds a new action. Note: calls to getAllActions() that happen before calls to this method may not see the update. Note: this method will always modify the actions
      • replaceAction

        public void replaceAction​(@NonNull
                                  Action a)
        Add an action, replacing any existing actions of the (exact) same class. Note: calls to getAllActions() that happen before calls to this method may not see the update. Note: this method does not affect transient actions contributed by a TransientActionFactory. Note: this method cannot provide concurrency control due to the backing storage being a CopyOnWriteArrayList so concurrent calls to any of the mutation methods may produce surprising results though technically consistent from the concurrency contract of CopyOnWriteArrayList (we would need some form of transactions or a different backing type).

        See also addOrReplaceAction(Action) if you want to know whether the backing actions was modified, for example in cases where the caller would need to persist the Actionable in order to persist the change and there is a desire to elide unnecessary persistence of unmodified objects.

        Parameters:
        a - an action to add/replace
        Since:
        1.548
      • addOrReplaceAction

        public boolean addOrReplaceAction​(@NonNull
                                          Action a)
        Add an action, replacing any existing actions of the (exact) same class. Note: calls to getAllActions() that happen before calls to this method may not see the update. Note: this method does not affect transient actions contributed by a TransientActionFactory Note: this method cannot provide concurrency control due to the backing storage being a CopyOnWriteArrayList so concurrent calls to any of the mutation methods may produce surprising results though technically consistent from the concurrency contract of CopyOnWriteArrayList (we would need some form of transactions or a different backing type).
        Parameters:
        a - an action to add/replace
        Returns:
        true if this actions changed as a result of the call
        Since:
        2.29
      • removeAction

        public boolean removeAction​(@Nullable
                                    Action a)
        Remove an action. Note: calls to getAllActions() that happen before calls to this method may not see the update. Note: this method does not affect transient actions contributed by a TransientActionFactory Note: this method cannot provide concurrency control due to the backing storage being a CopyOnWriteArrayList so concurrent calls to any of the mutation methods may produce surprising results though technically consistent from the concurrency contract of CopyOnWriteArrayList (we would need some form of transactions or a different backing type).
        Parameters:
        a - an action to remove (if null then this will be a no-op)
        Returns:
        true if this actions changed as a result of the call
        Since:
        2.29
      • removeActions

        public boolean removeActions​(@NonNull
                                     Class<? extends Action> clazz)
        Removes any actions of the specified type. Note: calls to getAllActions() that happen before calls to this method may not see the update. Note: this method does not affect transient actions contributed by a TransientActionFactory Note: this method cannot provide concurrency control due to the backing storage being a CopyOnWriteArrayList so concurrent calls to any of the mutation methods may produce surprising results though technically consistent from the concurrency contract of CopyOnWriteArrayList (we would need some form of transactions or a different backing type).
        Parameters:
        clazz - the type of actions to remove
        Returns:
        true if this actions changed as a result of the call
        Since:
        2.29
      • replaceActions

        public boolean replaceActions​(@NonNull
                                      Class<? extends Action> clazz,
                                      @NonNull
                                      Action a)
        Replaces any actions of the specified type by the supplied action. Note: calls to getAllActions() that happen before calls to this method may not see the update. Note: this method does not affect transient actions contributed by a TransientActionFactory Note: this method cannot provide concurrency control due to the backing storage being a CopyOnWriteArrayList so concurrent calls to any of the mutation methods may produce surprising results though technically consistent from the concurrency contract of CopyOnWriteArrayList (we would need some form of transactions or a different backing type).
        Parameters:
        clazz - the type of actions to replace (note that the action you are replacing this with need not extend this class)
        a - the action to replace with
        Returns:
        true if this actions changed as a result of the call
        Since:
        2.29
      • getAction

        public <T extends Action> T getAction​(Class<T> type)
        Gets the action (first instance to be found) of a specified type that contributed to this build.
        Returns:
        The action or null if no such actions exist.
        See Also:
        getActions(Class)
      • getDynamic

        public Object getDynamic​(String token,
                                 org.kohsuke.stapler.StaplerRequest req,
                                 org.kohsuke.stapler.StaplerResponse rsp)