info.magnolia.ui.api.action
Class AbstractActionExecutor

java.lang.Object
  extended by info.magnolia.ui.api.action.AbstractActionExecutor
All Implemented Interfaces:
ActionExecutor
Direct Known Subclasses:
DialogActionExecutor, MediaEditorActionExecutor, MessageActionExecutor, SubAppActionExecutor, UserActionExecutor

public abstract class AbstractActionExecutor
extends Object
implements ActionExecutor

Abstract base implementation of ActionExecutor. Creates the Action from the implementation class using a ComponentProvider and binds the ActionDefinition to the Action. Subclasses need only implement ActionExecutor.getActionDefinition(String).

See Also:
Action, ActionDefinition, ActionExecutor

Constructor Summary
AbstractActionExecutor(info.magnolia.objectfactory.ComponentProvider componentProvider)
           
 
Method Summary
protected  Action createAction(String actionName, Object... args)
          Creates an action using the implementation configured for the given action definition.
 void execute(String actionName, Object... args)
          Creates a new instance of the action for the supplied name and executes it.
 boolean isAvailable(String actionName, javax.jcr.Item... items)
          Evaluates if an action is available for the current user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.magnolia.ui.api.action.ActionExecutor
getActionDefinition
 

Constructor Detail

AbstractActionExecutor

@Inject
public AbstractActionExecutor(info.magnolia.objectfactory.ComponentProvider componentProvider)
Method Detail

execute

public final void execute(String actionName,
                          Object... args)
                   throws ActionExecutionException
Description copied from interface: ActionExecutor
Creates a new instance of the action for the supplied name and executes it. The arguments passed here along with the action definition are made available to the action instance using injection.

Specified by:
execute in interface ActionExecutor
Throws:
ActionExecutionException - if the action encounters a problem during execution or if no action definition matches the name

createAction

protected Action createAction(String actionName,
                              Object... args)
                       throws ActionExecutionException
Creates an action using the implementation configured for the given action definition. The parameters are made available for injection when the instance is created. The definition object is also available for injection.

Throws:
ActionExecutionException

isAvailable

public boolean isAvailable(String actionName,
                           javax.jcr.Item... items)
Description copied from interface: ActionExecutor
Evaluates if an action is available for the current user. This involves checking if the user has the required permission to use the action and if the action is available for a specific item.

Specified by:
isAvailable in interface ActionExecutor
See Also:
AvailabilityDefinition


Copyright © 2013 Magnolia International Ltd.. All Rights Reserved.