Package uk.ac.bbsrc.tgac.miso.core.data.impl

Examples of uk.ac.bbsrc.tgac.miso.core.data.impl.StatusImpl


      if (response != null && response.has("response")) {
        JSONArray a = response.getJSONArray("response");
        if (a.iterator().hasNext()) {
          JSONObject j = (JSONObject) a.iterator().next();
          if (j.has("file") && j.has("xml")) {
            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());
              }
            }
            return status;
          }
        }
View Full Code Here

TOP

Related Classes of uk.ac.bbsrc.tgac.miso.core.data.impl.StatusImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.