private Element getWellNode(Session sess, char row, int col, int quadrant) { try { String plateQuery = "SELECT p from Plate as p where p.idInstrumentRun=" + ir.getIdInstrumentRun() + " AND p.quadrant=" + quadrant; Plate plate = (Plate) sess.createQuery(plateQuery).uniqueResult(); Element wellNode = new Element("PlateWell"); if (plate != null) { String wellQuery = "SELECT pw from PlateWell as pw where pw.idPlate=" + plate.getIdPlate() + " AND pw.row='" + row + "' AND pw.col=" + col; PlateWell plateWell = (PlateWell) sess.createQuery(wellQuery).uniqueResult(); if (plateWell != null) { plateWell.excludeMethodFromXML("getPlate"); plateWell.excludeMethodFromXML("getSample"); plateWell.excludeMethodFromXML("getAssay"); plateWell.excludeMethodFromXML("getPrimer"); wellNode = plateWell.toXMLDocument(null, DetailObject.DATE_OUTPUT_SQL).getRootElement(); if (plateWell.getAssay() != null) { wellNode.setAttribute("assay", plateWell.getAssay().getDisplay()); } else if (plateWell.getPrimer() != null) { wellNode.setAttribute("primer", plateWell.getPrimer().getDisplay()); } } else { wellNode.setAttribute("idPlateWell", "0"); } } else { wellNode.setAttribute("idPlateWell", "0"); } return wellNode; } catch (Exception e) { LOG.error("An exception has occurred in CreateRunFile ", e); return null; } }
private void changeRequestsToProcessing(Session sess, InstrumentRun ir) throws ProductException { // Get any requests on that run Map requests = new HashMap(); List wells = sess.createQuery( "SELECT pw from PlateWell as pw " + " join pw.plate as plate where plate.idInstrumentRun =" + ir.getIdInstrumentRun()) .list(); for (Iterator i1 = wells.iterator(); i1.hasNext(); ) { PlateWell well = (PlateWell) i1.next(); if (well.getIdRequest() == null) { break; } if (!well.getIdRequest().equals("") && !requests.containsKey(well.getIdRequest())) { Request req = (Request) sess.get(Request.class, well.getIdRequest()); requests.put(req.getIdRequest(), req); } } // Change request Status for (Iterator i = requests.keySet().iterator(); i.hasNext(); ) { int idReq = (Integer) i.next(); Request req = (Request) sess.get(Request.class, idReq); if (req.getCodeRequestStatus() == null) { ProductUtil.updateLedgerOnRequestStatusChange( sess, req, req.getCodeRequestStatus(), RequestStatus.PROCESSING); req.setCodeRequestStatus(RequestStatus.PROCESSING); } else if (req.getCodeRequestStatus().equals(RequestStatus.NEW) || req.getCodeRequestStatus().equals(RequestStatus.SUBMITTED)) { ProductUtil.updateLedgerOnRequestStatusChange( sess, req, req.getCodeRequestStatus(), RequestStatus.PROCESSING); req.setCodeRequestStatus(RequestStatus.PROCESSING); } } sess.flush(); }