/** * @param startTime the startTime to set */ public void setStartTime(long startTime) { this.setCreateTime(startTime); }
/** * @return the startTime */ public long getStartTime() { return getCreateTime(); }
@Override public String toString() { return getWorkflowName() + "." + getWorkflowVersion() + "/" + workflowId + "." + status; }
/** * @throws ApplicationException */ public void pauseWorkflow(String workflowId) { WorkflowStatus status = WorkflowStatus.PAUSED; Workflow workflow = executionDAOFacade.getWorkflowById(workflowId, false); if (workflow.getStatus().isTerminal()) { throw new ApplicationException(CONFLICT, "Workflow id " + workflowId + " has ended, status cannot be updated."); } if (workflow.getStatus().equals(status)) { return; //Already paused! } workflow.setStatus(status); executionDAOFacade.updateWorkflow(workflow); }
@Override public void indexWorkflow(Workflow workflow) { String workflowId = workflow.getWorkflowId(); WorkflowSummary summary = new WorkflowSummary(workflow); indexObject(indexName, WORKFLOW_DOC_TYPE, workflowId, summary); }
@Override public List<Task> getTasksForWorkflow(String workflowId) { return getWorkflow(workflowId, true).getTasks(); }
@Override public void onWorkflowTerminated(Workflow workflow) { LOG.debug("Workflow {} is terminated", workflow.getWorkflowId()); }
public WorkflowDef getWorkflowDefinition() { return workflowInstance.getWorkflowDefinition(); }
/** * * @return Workflow Type / Definition */ @Deprecated public String getWorkflowType() { return getWorkflowName(); }
@Override public ExternalStorageLocation getLocation(Operation operation, PayloadType payloadType, String path) { ExternalStorageLocation location = new ExternalStorageLocation(); location.setUri("http://some/uri"); switch (payloadType) { case TASK_INPUT: location.setPath("task/input"); break; case WORKFLOW_OUTPUT: location.setPath("workflow/output"); break; } return location; }
@Override public SearchResult<String> searchWorkflows(String query, String freeText, int start, int count, List<String> sort) { return new SearchResult<>(0, new ArrayList<>()); }
public Map<String, Object> getTaskInput(Map<String, Object> inputParams, Workflow workflow, TaskDef taskDefinition, String taskId) { if (workflow.getSchemaVersion() > 1) { return getTaskInputV2(inputParams, workflow, taskId, taskDefinition); } return getTaskInputV1(workflow, inputParams); }
/** * @return the version */ @Deprecated public int getVersion() { return getWorkflowVersion(); }
public static void recordUpdateConflict(String taskType, String workflowType, WorkflowStatus status) { counter(classQualifier, "task_update_conflict", "workflowName", workflowType, "taskType", taskType, "workflowStatus", status.name()); }
@Override public void onWorkflowCompleted(Workflow workflow) { LOG.debug("Workflow {} is completed", workflow.getWorkflowId()); }
/** * @return the schemaVersion Version of the schema for the workflow definition */ public int getSchemaVersion() { return getWorkflowDefinition() != null ? getWorkflowDefinition().getSchemaVersion() : schemaVersion; }
@Override public SearchResult<String> searchTasks(String query, String freeText, int start, int count, List<String> sort) { return new SearchResult<>(0, new ArrayList<>()); }
public static void recordWorkflowTermination(String workflowType, WorkflowStatus status, String ownerApp) { counter(classQualifier, "workflow_failure", "workflowName", workflowType, "status", status.name(), "ownerApp", ""+ownerApp); }
/** * Convenience method for accessing the workflow definition version. * @return the workflow definition version. */ public int getWorkflowVersion() { return getWorkflowDefinition() != null ? getWorkflowDefinition().getVersion() : version; }
/** * Convenience method for accessing the workflow definition name. * @return the workflow definition name. */ public String getWorkflowName() { return getWorkflowDefinition() != null ? getWorkflowDefinition().getName() : workflowType; }