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

Examples of uk.ac.bbsrc.tgac.miso.core.data.impl.solid.SolidStatus


      sb.append("Processing " + runName + "\n");
      log.debug("Processing " + runName);

      if (run.has("status")) {
        String xml = run.getString("status");
        Status is = new SolidStatus(xml);
        is.setHealth(ht);
        is.setRunName(runName);

        Run r = null;
        Matcher m = p.matcher(runName);
        if (m.matches()) {
          try {
            r = requestManager.getRunByAlias(runName);
          }
          catch(IOException ioe) {
            log.warn("Cannot find run by this alias. This usually means the run hasn't been previously imported. If attemptRunPopulation is false, processing will not take place for this run!");
          }
        }

        try {
          if (attemptRunPopulation) {
            if (r == null) {
              log.debug("Saving new run and status: " + is.getRunName());
              r = new SolidRun(xml);
              r.getStatus().setHealth(ht);
              if (run.has("fullPath")) {
                r.setFilePath(run.getString("fullPath"));
              }

              SequencerReference sr = null;
              if (run.has("sequencerName")) {
                sr = requestManager.getSequencerReferenceByName(run.getString("sequencerName"));
                r.getStatus().setInstrumentName(run.getString("sequencerName"));
                r.setSequencerReference(sr);
              }
              if (r.getSequencerReference() == null) {
                sr = requestManager.getSequencerReferenceByName(m.group(1));
                r.getStatus().setInstrumentName(m.group(1));
                r.setSequencerReference(sr);
              }
              if (r.getSequencerReference() == null) {
                sr = requestManager.getSequencerReferenceByName(r.getStatus().getInstrumentName());
                r.setSequencerReference(sr);
              }

              if (r.getSequencerReference() != null) {
                if (run.has("startDate")) {
                  try {
                    log.debug("Updating start date:" + run.getString("startDate"));

                    Matcher m2 = simpleDateRegex.matcher(run.getString("startDate"));
                    if (m2.matches()) {
                      r.getStatus().setStartDate(simpleLogDateFormat.parse(run.getString("startDate")));
                    }
                    else {
                      r.getStatus().setStartDate(logDateFormat.parse(run.getString("startDate")));
                    }
                  }
                  catch (ParseException e) {
                    log.error(e.getMessage());
                    e.printStackTrace();
                  }
                }

                if (run.has("completionDate")) {
                  try {
                    if (run.get("completionDate") != null && !run.getString("completionDate").equals("null")) {
                      log.debug("Updating completion date:" + run.getString("completionDate"));
                      r.getStatus().setCompletionDate(logDateFormat.parse(run.getString("completionDate")));
                    }
                    else {
                      r.getStatus().setCompletionDate(null);
                    }
                  }
                  catch (ParseException e) {
                    log.error(e.getMessage());
                    e.printStackTrace();
                  }
                }
              }
            }
            else {
              log.debug("Updating existing run and status: " + is.getRunName());

              r.setPlatformType(PlatformType.SOLID);

              if (r.getSequencerReference() == null) {
                SequencerReference sr = null;
                if (run.has("sequencerName")) {
                  sr = requestManager.getSequencerReferenceByName(run.getString("sequencerName"));
                  r.getStatus().setInstrumentName(run.getString("sequencerName"));
                  r.setSequencerReference(sr);
                }
                if (r.getSequencerReference() == null) {
                  sr = requestManager.getSequencerReferenceByName(m.group(1));
                  r.getStatus().setInstrumentName(m.group(1));
                  r.setSequencerReference(sr);
                }
                if (r.getSequencerReference() == null) {
                  sr = requestManager.getSequencerReferenceByName(r.getStatus().getInstrumentName());
                  r.setSequencerReference(sr);
                }
              }
              if (r.getSequencerReference() != null) {
                if (run.has("startDate")) {
                  try {
                    log.debug("Updating start date:" + run.getString("startDate"));

                    Matcher m2 = simpleDateRegex.matcher(run.getString("startDate"));
                    if (m2.matches()) {
                      r.getStatus().setStartDate(simpleLogDateFormat.parse(run.getString("startDate")));
                    }
                    else {
                      r.getStatus().setStartDate(logDateFormat.parse(run.getString("startDate")));
                    }
                  }
                  catch (ParseException e) {
                    log.error(e.getMessage());
                    e.printStackTrace();
                  }
                }

                if (run.has("completionDate")) {
                  try {
                    if (run.get("completionDate") != null && !run.getString("completionDate").equals("null")) {
                      log.debug("Updating completion date:" + run.getString("completionDate"));
                      r.getStatus().setCompletionDate(logDateFormat.parse(run.getString("completionDate")));
                    }
                    else {
                      r.getStatus().setCompletionDate(null);
                    }
                  }
                  catch (ParseException e) {
                    log.error(e.getMessage());
                    e.printStackTrace();
                  }
                }

                //update path if changed
                if (run.has("fullPath") && !"".equals(run.getString("fullPath")) && r.getFilePath() != null && !"".equals(r.getFilePath())) {
                  if (!run.getString("fullPath").equals(r.getFilePath())) {
                    log.debug("Updating run file path:" + r.getFilePath() + " -> " + run.getString("fullPath"));
                    r.setFilePath(run.getString("fullPath"));
                  }
                }

                // update status if run isn't completed or failed
                if (!r.getStatus().getHealth().equals(HealthType.Completed) && !r.getStatus().getHealth().equals(HealthType.Failed)) {
                  log.debug("Saving previously saved status: " + is.getRunName() + " (" + r.getStatus().getHealth().getKey() + " -> " + is.getHealth().getKey() + ")");
                  r.setStatus(is);
                }
              }
            }
View Full Code Here

TOP

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

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.