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

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


          return JSONUtils.SimpleJSONError("Please enter a value for '" +k+ "'");
        }
      }
      if (json.has("pcrId") && !json.get("pcrId").equals("")) {
        Long pcrId = Long.parseLong(json.getString("pcrId"));
        emPCR pcr = requestManager.getEmPcrById(pcrId);
        emPCRDilution newDilution = dataObjectFactory.getEmPCRDilution();
        newDilution.setSecurityProfile(pcr.getSecurityProfile());
        newDilution.setDilutionCreator(json.getString("pcrDilutionCreator"));
        newDilution.setCreationDate(new SimpleDateFormat("dd/MM/yyyy").parse(json.getString("pcrDilutionDate")));
        newDilution.setConcentration(Double.parseDouble(json.getString("results")));
        newDilution.setEmPCR(pcr);
        requestManager.saveEmPCRDilution(newDilution);

        StringBuilder sb = new StringBuilder();
        sb.append("<tr>");
        //sb.append("<th>ID</th><th>Done By</th><th>Date</th><th>Barcode</th><th>Results</th>");
        sb.append("<th>ID</th><th>Done By</th><th>Date</th><th>Results</th><th>ID Barcode</th>");
        sb.append("</tr>");
       
        File temploc = new File(session.getServletContext().getRealPath("/")+"temp/");
        for (emPCRDilution dil : requestManager.listAllEmPcrDilutionsByEmPcrId(pcrId)) {
          sb.append("<tr>");
          sb.append("<td>"+dil.getId()+"</td>");
          sb.append("<td>"+dil.getDilutionCreator()+"</td>");
          sb.append("<td>"+dil.getCreationDate()+"</td>");
          sb.append("<td>"+dil.getConcentration()+" "+ dil.getUnits()+"</td>");

          sb.append("<td>");
          try {
            barcodeFactory.setPointPixels(1.5f);
            barcodeFactory.setBitmapResolution(600);
            RenderedImage bi = barcodeFactory.generateSquareDataMatrix(dil, 400);
            if (bi != null) {
              File tempimage = misoFileManager.generateTemporaryFile("barcode-", ".png", temploc);
              if (ImageIO.write(bi, "png", tempimage)) {
                sb.append("<img style='border:0;' src='/temp/"+tempimage.getName()+"'/>");
              }
            }
          }
          catch (IOException e) {
            e.printStackTrace();
          }
          sb.append("</td>");

          //sb.append("<td><a href='/miso/pool/"+pcr.getLibraryDilution().getLibrary().getPlatformName().toLowerCase()+"/new/'>Construct New Pool</a></td>");
          sb.append("<td><a href='/miso/poolwizard/new/"+pcr.getLibraryDilution().getLibrary().getSample().getProject().getProjectId()+"'>Construct New Pool</a></td>");
          sb.append("</tr>");
        }
        return JSONUtils.SimpleJSONResponse(sb.toString());
      }
    }
View Full Code Here


        }
      }
      if (json.has("dilutionId") && !json.get("dilutionId").equals("")) {
        Long dilutionId = Long.parseLong(json.getString("dilutionId"));
        LibraryDilution dilution = requestManager.getLibraryDilutionById(dilutionId);
        emPCR pcr = dataObjectFactory.getEmPCR();
        pcr.setSecurityProfile(dilution.getSecurityProfile());
        pcr.setPcrCreator(json.getString("pcrCreator"));
        pcr.setCreationDate(new SimpleDateFormat("dd/MM/yyyy").parse(json.getString("pcrDate")));
        pcr.setConcentration(Double.parseDouble(json.getString("results")));
        pcr.setLibraryDilution(dilution);
        requestManager.saveEmPCR(pcr);

        StringBuilder sb = new StringBuilder();
        sb.append("<tr>");
        sb.append("<th>ID</th><th>Done By</th><th>Date</th><th>Results</th>");
View Full Code Here

                          }
                  )
  )
  public emPCR get(long pcrId) throws IOException {
    List eResults = template.query(EMPCR_SELECT_BY_PCR_ID, new Object[]{pcrId}, new EmPCRMapper());
    emPCR e = eResults.size() > 0 ? (emPCR) eResults.get(0) : null;
    return e;
  }
View Full Code Here

    return e;
  }

  public emPCR lazyGet(long pcrId) throws IOException {
    List eResults = template.query(EMPCR_SELECT_BY_PCR_ID, new Object[]{pcrId}, new EmPCRMapper(true));
    emPCR e = eResults.size() > 0 ? (emPCR) eResults.get(0) : null;
    return e;
  }
View Full Code Here

          log.debug("Cache hit on map for emPCR " + id);
          return (emPCR)element.getObjectValue();
        }
      }

      emPCR pcr = dataObjectFactory.getEmPCR();
      pcr.setId(id);
      pcr.setConcentration(rs.getDouble("concentration"));
      pcr.setName(rs.getString("name"));
      pcr.setCreationDate(rs.getDate("creationDate"));
      pcr.setPcrCreator(rs.getString("pcrUserName"));

      try {
        pcr.setSecurityProfile(securityProfileDAO.get(rs.getLong("securityProfile_profileId")));
        pcr.setLibraryDilution(libraryDilutionDAO.get(rs.getLong("dilution_dilutionId")));
        if (!isLazy()) {
          pcr.setEmPcrDilutions(emPCRDilutionDAO.listAllByEmPCRId(id));
        }
      }
      catch (IOException e1) {
        e1.printStackTrace();
      }
View Full Code Here

      namedTemplate.update(EMPCR_DILUTION_UPDATE, params);
      */
    }

    if (this.cascadeType != null) {
      emPCR e = dilution.getEmPCR();
      if (this.cascadeType.equals(CascadeType.PERSIST)) {
        if (e != null) emPcrDAO.save(e);
      }
      else if (this.cascadeType.equals(CascadeType.REMOVE)) {
        if (e != null) {
          Cache pc = cacheManager.getCache("empcrCache");
          pc.remove(DbUtils.hashCodeCacheKeyFor(e.getId()));
        }
      }
    }

    return dilution.getId();
View Full Code Here

  public boolean removeEmPCRDilution(emPCRDilution d) throws IOException {
    NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
    if (d.isDeletable() &&
           (namedTemplate.update(EMPCR_DILUTION_DELETE,
                                 new MapSqlParameterSource().addValue("dilutionId", d.getId())) == 1)) {
      emPCR e = d.getEmPCR();
      if (this.cascadeType.equals(CascadeType.PERSIST)) {
        if (e != null) emPcrDAO.save(e);
      }
      else if (this.cascadeType.equals(CascadeType.REMOVE)) {
        if (e != null) {
          Cache pc = cacheManager.getCache("empcrCache");
          pc.remove(DbUtils.hashCodeCacheKeyFor(e.getId()));
        }
      }
      return true;
    }
    return false;
View Full Code Here

      namedTemplate.update(EMPCR_DILUTION_UPDATE, params);
      */
    }

    if (this.cascadeType != null) {
      emPCR e = dilution.getEmPCR();
      if (this.cascadeType.equals(CascadeType.PERSIST)) {
        if (e != null) emPcrDAO.save(e);
      }
      else if (this.cascadeType.equals(CascadeType.REMOVE)) {
        if (e != null) {
View Full Code Here

  public boolean remove(emPCRDilution d) throws IOException {
    NamedParameterJdbcTemplate namedTemplate = new NamedParameterJdbcTemplate(template);
    if (d.isDeletable() &&
           (namedTemplate.update(EMPCR_DILUTION_DELETE,
                                 new MapSqlParameterSource().addValue("dilutionId", d.getId())) == 1)) {
      emPCR e = d.getEmPCR();
      if (this.cascadeType.equals(CascadeType.PERSIST)) {
        if (e != null) emPcrDAO.save(e);
      }
      else if (this.cascadeType.equals(CascadeType.REMOVE)) {
        if (e != null) {
View Full Code Here

TOP

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

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.