Search in sources :

Example 1 with DefaultWorkflowDescription

use of org.onosproject.workflow.api.DefaultWorkflowDescription in project onos by opennetworkinglab.

the class WorkFlowTestCommand method invoke.

/**
 * Invokes workflow.
 *
 * @param workflowId    workflow id
 * @param workplaceName workplace name
 */
private void invoke(String workflowId, String workplaceName) {
    WorkflowService service = get(WorkflowService.class);
    ObjectNode dataModel = JsonNodeFactory.instance.objectNode();
    dataModel.put("count", 0);
    try {
        DefaultWorkflowDescription wfDesc = DefaultWorkflowDescription.builder().workplaceName(workplaceName).id(workflowId).data(dataModel).build();
        service.invokeWorkflow(wfDesc);
    } catch (WorkflowException e) {
        error(e.getMessage() + ", trace: " + Arrays.asList(e.getStackTrace()));
    }
}
Also used : ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) WorkflowService(org.onosproject.workflow.api.WorkflowService) WorkflowException(org.onosproject.workflow.api.WorkflowException) DefaultWorkflowDescription(org.onosproject.workflow.api.DefaultWorkflowDescription)

Example 2 with DefaultWorkflowDescription

use of org.onosproject.workflow.api.DefaultWorkflowDescription in project onos by opennetworkinglab.

the class WorkFlowCommand method invoke.

/**
 * Invokes workflow.
 * @param workflowId workflow id
 * @param workplaceName workplace name
 */
private void invoke(String workflowId, String workplaceName) {
    WorkflowService service = get(WorkflowService.class);
    try {
        DefaultWorkflowDescription wfDesc = DefaultWorkflowDescription.builder().workplaceName(workplaceName).id(workflowId).data(JsonNodeFactory.instance.objectNode()).build();
        service.invokeWorkflow(wfDesc);
    } catch (WorkflowException e) {
        error("Exception: ", e);
    }
}
Also used : WorkflowService(org.onosproject.workflow.api.WorkflowService) WorkflowException(org.onosproject.workflow.api.WorkflowException) DefaultWorkflowDescription(org.onosproject.workflow.api.DefaultWorkflowDescription)

Aggregations

DefaultWorkflowDescription (org.onosproject.workflow.api.DefaultWorkflowDescription)2 WorkflowException (org.onosproject.workflow.api.WorkflowException)2 WorkflowService (org.onosproject.workflow.api.WorkflowService)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1