@JsonProperty("parent") public String getParentId() { if (parent == null) return null; return parent.getId(); }
index = new int[0]; Invocation invocation = new Invocation(name, index, parent, report); Date startedDate = getDate(json, "startedDate"); if (startedDate != null) invocation.setStartedDate(startedDate); Date completedDate = getDate(json, "completedDate"); if (completedDate != null) invocation.setCompletedDate(completedDate); invocation.setInputs(parseValues(json.path("inputs"), workflowReportJson)); invocation.setOutputs(parseValues(json.path("outputs"), workflowReportJson));
assertEquals("wf0", wfInvov.getName()); assertEquals("wf0", wfInvov.getId()); assertNull(wfInvov.getParentId()); assertNull(wfInvov.getParent()); assertEquals(0, wfInvov.getIndex().length); assertSame(wfReport, wfInvov.getReport()); assertEquals(State.COMPLETED, wfInvov.getState()); assertEquals(date(2013,1,2,14,51), wfInvov.getStartedDate()); assertEquals(date(2013,12,30,23,50), wfInvov.getCompletedDate()); assertEquals(1, wfInvov.getInputs().size()); assertEquals(1, wfInvov.getOutputs().size()); Path name = wfInvov.getInputs().get("name"); assertEquals("/inputs/name", name.toString()); assertEquals("John Doe", DataBundles.getStringValue(name)); Path greeting = wfInvov.getOutputs().get("greeting"); assertEquals("/outputs/greeting", greeting.toString()); assertEquals("Hello, John Doe", DataBundles.getStringValue(greeting)); assertEquals(date(2013,2,2,11,00), pInvoc.getStartedDate()); assertEquals(date(2013,2,2,13,00), pInvoc.getCompletedDate()); assertEquals(State.COMPLETED, pInvoc.getState()); assertEquals(wfInvov, pInvoc.getParent()); assertEquals("wf0", pInvoc.getParentId()); if (processor.getName().equals("hello")) { assertEquals("proc-hello0", pInvoc.getName());
wfReport.setCreatedDate(date(2013,1,2,13,37)); wfReport.setStartedDate(date(2013,1,2,14,50)); Invocation wfInvocation = new Invocation("wf0", null, wfReport); wfInvocation.setStartedDate(date(2013,1,2,14,51)); wfInvocation.setCompletedDate(date(2013,12,30,23,50)); wfInvocation.getInputs().put("name", name); wfInvocation.getOutputs().put("greeting", greeting); Invocation pInvocation = new Invocation("proc-" + p.getName() + "0", wfInvocation, processorReport); pInvocation.setStartedDate(date(2013,2,2,11,0)); pInvocation.setCompletedDate(date(2013,2,2,13,0)); pInvocation.getOutputs().put("value", helloValue); DataBundles.setStringValue(helloValue, "Hello, "); } else if (p.getName().equals("Concatenate_two_strings")) { pInvocation.getInputs().put("string1", helloValue); pInvocation.getInputs().put("string2", name); pInvocation.getOutputs().put("output", concatenateOutput); DataBundles.setStringValue(concatenateOutput, "Hello, John Doe"); } else { activityReport.setStartedDate(date(2013,2,20,11,00)); activityReport.setCancelledDate(date(2013,2,21,11,30)); Invocation aInvocation = new Invocation("act-" + p.getName() + "0", pInvocation, activityReport); aInvocation.setStartedDate(date(2013,2,20,11,30));
public Invocation(String name, int[] index, Invocation parent, StatusReport<?, ?> report) { this.name = name; this.index = index; this.parent = parent; this.report = report; invocations = new TreeSet<>(); inputs = new TreeMap<>(); for (Port port : report.getSubject().getInputPorts()) inputs.put(port.getName(), null); outputs = new TreeMap<>(); for (Port port : report.getSubject().getOutputPorts()) outputs.put(port.getName(), null); setStartedDate(new Date()); if (parent != null) parent.getInvocations().add(this); report.addInvocation(this); }
/** * 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; } }
/** * Returns the identifier for this invocation by prepending the identifier of the parent * invocation. * * @return the identifier for this invocation */ @JsonProperty("id") public String getId() { if (parent != null) { String parentId = parent.getId(); if (parentId != null && !parentId.isEmpty()) return parent.getId() + "/" + name; } return name; }