OK, here is what I did to resolve this:
In your customised services-context.xml file:
1) <bean class="org.alfresco.web.app.ResourceBundleBootstrap">
<property name="resourceBundles">
<list>
<value>alfresco.extension.workflow-messages</value>
</list>
</property>
</bean>
2) In workflow-messages.properties
abort_task=Abort Task
3) In web-client-config-custom.xml
a) <action id="abort_task">
<label-id>abort_task</label-id>
<image>/images/icons/cancel_checkout.gif</image>
<action-listener>#{WorkflowCustomisedIconsAction.abortTask}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
<param name="type">#{actionContext.type}</param>
</params>
</action>
b) <action-group id="dashlet_todo_actions">
<action idref="manage_task" />
<action idref="reassign_task" />
<action idref="abort_task" />
</action-group>
c) <action-group id="dashlet_pooled_actions">
<action idref="manage_task" />
<action idref="take_ownership_task" />
</action-group>
d) <action id="take_ownership_task">
<permissions>
<permission allow="true">TakeOwnership</permission>
</permissions>
<label-id>take_ownership</label-id>
<image>/images/icons/take_ownership.gif</image>
<action>dialog:manageTask</action>
<action-listener>#{WorkflowCustomisedIconsAction.takeOwnership}</action-listener>
<params>
<param name="id">#{actionContext.id}</param>
<param name="type">#{actionContext.type}</param>
</params>
</action>
4) In faces-config-custom.xml
<managed-bean>
<description>
Backing bean used by the document details dialog
</description>
<managed-bean-name>WorkflowCustomisedIconsAction</managed-bean-name>
<managed-bean-class>com.company.alfresco.actions.WorkflowCustomisedIconsAction</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>nodeService</property-name>
<value>#{NodeService}</value>
</managed-property>
<managed-property>
<property-name>workflowService</property-name>
<value>#{WorkflowService}</value>
</managed-property>
<managed-property>
<property-name>navigationBean</property-name>
<value>#{NavigationBean}</value>
</managed-property>
</managed-bean>
5) In WorkflowCustomisedIconsAction.java
public void takeOwnership(final ActionEvent event) {
UIActionLink link = (UIActionLink)event.getComponent();
Map<String, String> parameters = link.getParameterMap();
String id = parameters.get("id");
// pass on parameters for the dialog
Application.getDialogManager().setupParameters(event);
UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans();
final FacesContext context = FacesContext.getCurrentInstance();
// before taking ownership check the task still exists and is not
// completed
final WorkflowTask checkTask = workflowService.getTaskById(id);
if (checkTask == null || checkTask.state == WorkflowTaskState.COMPLETED) {
Utils.addErrorMessage(Application.getMessage(context, "invalid_task"));
return;
}
UserTransaction tx = null;
try {
tx = Repository.getUserTransaction(context);
tx.begin();
// prepare the edited parameters for saving
final User user = Application.getCurrentUser(context);
final String userName = user.getUserName();
final Map<QName, Serializable> params = new HashMap<QName, Serializable>();
params.put(ContentModel.PROP_OWNER, userName);
// update the task with the updated parameters and resources
workflowService.updateTask(id, params, null, null);
// commit the changes
tx.commit();
} catch (final Throwable e) {
// rollback the transaction
try {
if (tx != null) {
tx.rollback();
}
} catch (final Exception ex) {
s_logger.info(ex);
}
}
}
public void abortTask(final ActionEvent event) {
UIActionLink link = (UIActionLink)event.getComponent();
Map<String, String> parameters = link.getParameterMap();
String id = parameters.get("id");
// pass on parameters for the dialog
Application.getDialogManager().setupParameters(event);
// before taking ownership check the task still exists and is not
// completed
final WorkflowTask checkTask = workflowService.getTaskById(id);
checkTask.state = WorkflowTaskState.COMPLETED;
String transition = "Abort Task";
if (transition != null) {
WorkflowTransition[] transitions = checkTask.definition.node.transitions;
for (WorkflowTransition trans : transitions) {
if (trans.id.equals(transition)) {
workflowService.endTask(id, transition);
break;
}
}
}
}