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

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


  }

  public class PrintJobMapper implements RowMapper<PrintJob> {
    public PrintJob mapRow(ResultSet rs, int rowNum) throws SQLException {
      try {
        MisoPrintJob printJob = new MisoPrintJob();
        printJob.setJobId(rs.getLong("jobId"));
        printJob.setPrintDate(rs.getDate("printDate"));
        printJob.setPrintService(printManager.getPrintService(rs.getString("printServiceName")));
        printJob.setPrintUser(securityManager.getUserById(rs.getLong("jobCreator_userId")));
        Blob barcodeBlob = rs.getBlob("printedElements");
        if (barcodeBlob != null) {
          if (barcodeBlob.length() > 0) {
            byte[] rbytes = barcodeBlob.getBytes(1, (int)barcodeBlob.length());
            printJob.setQueuedElements((Queue<?>)LimsUtils.byteArrayToObject(rbytes));
          }
        }
        printJob.setStatus(rs.getString("status"));
        return printJob;
      }
      catch (IOException e) {
        e.printStackTrace();
      }
View Full Code Here


  @Override
  public PrintJob print(Queue<File> barcodesToPrint, String printServiceName, User user) throws MisoPrintException {
    try {
      MisoPrintService mps = getPrintService(printServiceName);
      if (mps != null) {
        MisoPrintJob job = new MisoPrintJob();
        job.setPrintDate(new Date());
        job.setPrintService(mps);
        job.setPrintUser(user);
        job.setQueuedElements(barcodesToPrint);
        job.setStatus("QUEUED");
        try {
          long jobId = storePrintJob(job);
          job.setJobId(jobId);
        }
        catch (IOException e) {
          e.printStackTrace();
          log.debug("Could not store print job");
        }

        try {
          boolean jobOK = true;
          for (File barcodeFile : barcodesToPrint) {
            if (!mps.print(barcodeFile)) {
              jobOK = false;
            }
          }

          if (jobOK) {
            job.setStatus("OK");
          }
          else {
            job.setStatus("FAIL");
          }

          storePrintJob(job);
        }
        catch (IOException e) {
View Full Code Here

TOP

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

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.