in taverna-run-impl/src/main/java/org/apache/taverna/platform/run/impl/WorkflowReportJSON.java [269:325]
protected void parseDates(JsonNode json,
@SuppressWarnings("rawtypes") StatusReport report)
throws ParseException {
Date createdDate = getDate(json, "createdDate");
if (createdDate != null)
report.setCreatedDate(createdDate);
Date startedDate = getDate(json, "startedDate");
if (startedDate != null)
report.setStartedDate(startedDate);
// Special case for paused and resumed dates>
for (JsonNode s : json.path("pausedDates")) {
Date pausedDate = STD_DATE_FORMAT.parse(s.asText());
report.setPausedDate(pausedDate);
}
Date pausedDate = getDate(json, "pausedDate");
if (report.getPausedDates().isEmpty() && pausedDate != null) {
/*
* "pausedDate" is normally redundant (last value of "pausedDates")
* but here for some reason the list is missing, so we'll parse it
* separately.
*
* Note that if there was a list, we will ignore "pauseDate" no
* matter its value
*/
report.setPausedDate(pausedDate);
}
for (JsonNode s : json.path("resumedDates")) {
Date resumedDate = STD_DATE_FORMAT.parse(s.asText());
report.setResumedDate(resumedDate);
}
Date resumedDate = getDate(json, "resumedDate");
if (report.getResumedDates().isEmpty() && resumedDate != null)
// Same fall-back as for "pausedDate" above
report.setResumedDate(resumedDate);
Date cancelledDate = getDate(json, "cancelledDate");
if (cancelledDate != null)
report.setCancelledDate(cancelledDate);
Date failedDate = getDate(json, "failedDate");
if (failedDate != null)
report.setFailedDate(failedDate);
Date completedDate = getDate(json, "completedDate");
if (completedDate != null)
report.setCompletedDate(completedDate);
try {
State state = State.valueOf(json.get("state").asText());
report.setState(state);
} catch (IllegalArgumentException ex) {
throw new ParseException("Invalid state: " + json.get("state"), -1);
}
}