This site has moved to the integrated Appfire documentation and information site for our apps.

From February 2024 this site is no longer updated.

Take a look here! If you have any questions please email support@appfire.com

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

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

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

Usage

The API Services are divided in five groups

  • State Services

  • Task Services

  • Approval Services

  • Workflow Services

  • DocumentActivityService

Access the full Javadoc documentation for the API services here

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"/>
<component-import name="Comala Document Activity API" key="documentActivitySevice" interface="com.comalatech.workflow.DocumentActivityService"/>

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();
        contextMap.put("state",state);
        contextMap.put("page",page);
        contextMap.put("pageManger",pageManager);
        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:

@ComponentImport
private WorkflowService workflowService;

  • No labels