Actions - maksudsharif/Armedia-Training-Module GitHub Wiki

Actions

If you haven't completed Jeff Pott's tutorial on Actions, read and complete that before following along here.

Actions allow you to complete repeatable operations. It is a very easy way to provide generic, purpose-driven operations that can be leveraged against any type of object in Alfresco. Jeff Potts' tutorial very thoroughly explains how create/use actions and provides a good framework to building actions. Actions, while obviously most used in Share side operations, also allow you to call them outside of share. Actions can also leverage business logic when performed against content.

Process for creating actions (non-UI):

  • Create a Java class that extends ActionExecuterAbstractBase.
  • Create a bean for the aforementioned Java class.

Because an Action is created in Java, you can leverage any of the Alfresco services. An action is based around passed in parameters and the NodeRef the action is being used upon. ParameterDefinitions are properties the user provides (either through UI elements or predefined by you) to the action which you can then use to perform the action. An example would be from the Jeff Potts tutorial where you pass in the isActive property.

The flexibility of actions is the locations from which you can call them. You can use them anywhere you have access to the Java/JavaScript API like in workflows. It also allows you easily gather user data before performing an action when associating the action with a UI option.

If you have completed the Jeff Potts tutorial on Actions, you should have a good foundation of the types of things that can be done with Actions. For the assignment, you are going to model another action around the SetWebFlag action which you can leverage in workflows for the Publish Folder structure.

Things to Know

UI vs Regular Actions

When creating actions, it is helpful to plan where those actions are going to take place. Implementing UI actions is a bit more involved than an action that is defined in a Java file and registered in Spring. Regular actions can be thought of as methods that can be used in the different Alfresco development areas.

Assignments

Set Reviewiewable

To implement this Action you will need to have a:

  • Java class extending the ActionExecuterAbstractBase.
  • Add a corresponding bean to inject appropriate Alfresco services and register the action.

In the included code, a framework for what you might need is provided for you.