Comala Workflows is now Comala Document Management. Click here for the latest documentation.

You need to set up your project and environment go be able to use the Workflow API Services

You can use the Comala Workflows API Services to request and manipulate State, Tasks and Approval information.


The API Services are divided in four groups

  • State Services
  • Task Services
  • Approval Services
  • Workflow Services

The service objects have to be imported in your atlassian-plugin.xml:

<component-import name="Comala Workflows API" key="workflowService" interface="com.comalatech.workflow.WorkflowService"/>
<component-import name="Comala State Services" key="stateService" interface="com.comalatech.workflow.StateService"/>
<component-import name="Comala Tasks Services" key="taskService" interface="com.comalatech.workflow.TaskService"/>
<component-import name="Comala Approvals Services" key="approvalService" interface="com.comalatech.workflow.ApprovalService"/>

The services can then be imported by your plugin modules:

public class ShowStateMacro extends BaseMacro {

    private PageManager pageManager;

    private StateService stateService;

    public boolean hasBody() {
        return false;

    public RenderMode getBodyRenderMode() {
        return RenderMode.NO_RENDER;

    public String execute(Map parameters, String body, RenderContext renderContext) throws MacroException {
        AbstractPage page = (AbstractPage) ((PageContext)renderContext).getEntity();
        boolean isPublishedState = "releaseview".equalsIgnoreCase(ActionContext.getContext().getName());
        State state;
        if (isPublishedState) {
            state = stateService.getPublishedState(page);
        } else {
            state = stateService.getCurrentState(page);
        } if (state == null) {
            throw new MacroException("page does not have published state"); 
        Map<String,Object> contextMap = MacroUtils.defaultVelocityContext();
        return VelocityUtils.getRenderedTemplate("templates/com/comalatech/confluence/workflowutils/state.vm", contextMap);

    public void setStateService(StateService stateService) {
        this.stateService = stateService;

    public void setPageManager(PageManager pageManager) {
        this.pageManager = pageManager;

If using Atlassian spring scanner, then skip component-imports in atlassian-plugin.xml and use annotations @ComponentImport  right inside your plugin component:

private WorkflowService workflowService;

One thing to be aware of when using the API Services is that many of the get methods are driven by the Confluence index internally. This means that some updates may not appear through calls to the API as the index can take a few minutes to update depending on the settings in your Confluence instance.