/** * Sets the date that the status changed to CANCELLED. * * @param cancelledDate * the date that the status changed to CANCELLED */ public void setCancelledDate(Date cancelledDate) { this.cancelledDate = cancelledDate; setState(State.CANCELLED); }
public void setState(State state) { synchronized (reportListeners) { if (this.state != state) { State oldState = this.state; this.state = state; for (ReportListener reportListener : reportListeners) reportListener.stateChanged(oldState, state); } } }
/** * Returns the current {@link State} of the <code>Run</code>. * * A <code>Run</code>'s state can be CREATED, RUNNING, COMPLETED, PAUSED, * CANCELLED or FAILED. * * @return the current <code>State</code> of the <code>Run</code> */ public State getState() { return workflowReport.getState(); }
private int getLongestName(WorkflowReport workflowReport, int level) { int result = 0; result = Math.max(result, getSubject().getName().length() + level); for (ProcessorReport processorReport : workflowReport.getProcessorReports()) { result = Math.max(result, processorReport.getSubject().getName().length()); for (ActivityReport activityReport : processorReport.getActivityReports()) { WorkflowReport nestedWorkflowReport = activityReport.getNestedWorkflowReport(); if (nestedWorkflowReport != null) result = Math.max(result, getLongestName(nestedWorkflowReport, level + 1)); } } return result; }
public void cancel() throws RunStateException, InvalidExecutionIdException { synchronized (workflowReport) { State state = workflowReport.getState(); if (state.equals(CANCELLED) || state.equals(COMPLETED) || state.equals(FAILED)) throw new RunStateException("Cannot cancel a " + state + " run."); executionEnvironment.getExecutionService().cancel(executionID); workflowReport.setCancelledDate(new Date()); } } }
public void resume() throws RunStateException, InvalidExecutionIdException { synchronized (workflowReport) { State state = workflowReport.getState(); if (!state.equals(PAUSED)) throw new RunStateException("Cannot resume a " + state + " run."); executionEnvironment.getExecutionService().resume(executionID); workflowReport.setResumedDate(new Date()); } }
/** * Get an invocation with a given name. * @param invocationName * @return */ public Invocation getInvocation(String invocationName) { NavigableSet<Invocation> invocs = getInvocations(); // A Comparable Invocation with the desired name SortedSet<Invocation> tailSet = invocs.tailSet(new Invocation(invocationName)); if (!tailSet.isEmpty()) return tailSet.first(); return null; } }
public void start() throws RunStateException, InvalidExecutionIdException { synchronized (workflowReport) { State state = workflowReport.getState(); if (!state.equals(CREATED)) throw new RunStateException("Cannot start a " + state + " run."); executionEnvironment.getExecutionService().start(executionID); } }
/** * Constructs a new <code>StatusReport</code> for the subject and sets the created date to the * current date. * * @param subject * the subject of the report */ public StatusReport(SUBJECT subject) { this.subject = subject; setCreatedDate(new Date()); }
@JsonProperty("parent") public String getParentId() { if (parent == null) return null; return parent.getId(); }
/** * Test method for {@link org.apache.taverna.platform.report.StatusReport#getSubject()}. */ @Test public void testGetSubject() { assertNotNull(statusReport.getSubject()); assertEquals(subject, statusReport.getSubject()); assertEquals(subject, statusReport.getSubject()); }
@Override public String toString() { return "Invocation " + indexToString(index); }
/** * Informs the report that an output value has been added. * <p> * Any <code>ReportListener</code>s registered with this report will be notified that an output * value has been added. * * @param path * the path that the value was added to * @param portName * the port that the value belongs to * @param index * the position of the value */ public void outputAdded(Path path, String portName, int[] index) { synchronized (reportListeners) { for (ReportListener reportListener : reportListeners) reportListener.outputAdded(path, portName, index); } }
/** * Sets the date that the status changed to RUNNING. * * @param startedDate * the date that the status changed to RUNNING */ public void setStartedDate(Date startedDate) { if (this.startedDate == null) this.startedDate = startedDate; setState(State.RUNNING); }
/** * Sets the date that the status changed to FAILED. * * @param failedDate * the date that the status changed to FAILED */ public void setFailedDate(Date failedDate) { this.failedDate = failedDate; setState(State.FAILED); }
/** * Sets the date that the status was set to CREATED. * * @param createdDate * the date that the status was set to CREATED */ public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; setState(State.CREATED); }
/** * Sets the date that the status changed to COMPLETED. * * @param completedDate * the date that the status changed to COMPLETED */ public void setCompletedDate(Date completedDate) { this.completedDate = completedDate; setState(State.COMPLETED); }
/** * Sets the date that the status last changed form PAUSED to RUNNING. * * @param resumedDate * the date that the status last changed form PAUSED to RUNNING */ public void setResumedDate(Date resumedDate) { this.resumedDate = resumedDate; resumedDates.add(resumedDate); setState(State.RUNNING); }
/** * Sets the date that the status last changed to PAUSED. * * @param pausedDate * the date that the status last changed to PAUSED */ public void setPausedDate(Date pausedDate) { this.pausedDate = pausedDate; pausedDates.add(pausedDate); setState(State.PAUSED); }