if (response != null && response.has("response")) {
JSONArray a = response.getJSONArray("response");
for (JSONObject j : (Iterable<JSONObject>) a) {
if (j.has("file") && j.has("xml")) {
try {
StatusImpl status = new StatusImpl();
if (j.has("complete") && j.getString("complete").equals("true")) {
status.setHealth(HealthType.Completed);
}
else {
status.setHealth(HealthType.Running);
}
Document statusDoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
SubmissionUtils.transform(new UnicodeReader(j.getString("xml")), statusDoc);
String runStarted = statusDoc.getElementsByTagName("date").item(0).getTextContent();
status.setStartDate(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'").parse(runStarted));
status.setInstrumentName(statusDoc.getElementsByTagName("serialNumber").item(0).getTextContent());
Node n = statusDoc.getElementsByTagName("run").item(0);
for (int i = 0; i < n.getChildNodes().getLength(); i++) {
Node child = n.getChildNodes().item(i);
if(child instanceof Element && ((Element) child).getTagName().equals("id")) {
status.setRunName(child.getTextContent());
}
}
s.add(status);
}
catch (ParserConfigurationException e) {