public UpdateLastRunAlert(String _organizationId) {
   String _fileName =
       DictionaryManager.getInstance("host", organizationId).getProperty("alerts-path");
   this.fileName = _fileName;
   this.organizationId = _organizationId;
   this.xmlDocument = Utility.loadXml(this.fileName, this.organizationId);
 }
Beispiel #2
0
  /* (non-Javadoc)
   * @see com.tsagate.foundation.processengine.ITask#executeTask(java.lang.Object)
   */
  public Object executeTask(Object object) throws Exception {
    Object ret = "";
    try {
      Map incomingRequest = (Map) object;

      String organizationId = (String) incomingRequest.get("organizationId");
      String path =
          DictionaryManager.getInstance("host", organizationId).getProperty("reportsPath", "");
      String reportName = (String) incomingRequest.get("reportName");

      Map parameters = new HashMap();
      parameters.put("reportTitle", "Requisition Line Report");
      String userId = (String) incomingRequest.get("userId");
      parameters.put("userId", userId);
      DBSession session = (DBSession) incomingRequest.get("dbsession");
      Connection con = session.getSqlConnection();

      String filePath = path + reportName + ".jasper";
      // JasperDesign jasperDesign = JasperManager.loadXmlDesign(filePath);
      // JasperReport jasperReport = JasperManager.compileReport(jasperDesign);
      JasperReport jasperReport = JasperManager.loadReport(filePath);
      JasperPrint jasperPrint = JasperManager.fillReport(jasperReport, parameters, con);

      // JasperCompileManager.compileReportToFile(filePath);
      // filePath = path + "requisition-line.jasper";
      // JasperFillManager.fillReportToFile(filePath, parameters, con);

      // filePath = path + "requisitionLine.pdf";
      // JasperExportManager.exportReportToPdfFile(filePath);

      // You can use JasperPrint to create PDF
      UniqueKeyGenerator ukg = UniqueKeyGenerator.getInstance();
      String nameIt = ukg.getUniqueKey().toString();
      filePath =
          DictionaryManager.getInstance("host", organizationId).getProperty("reportsOut", "")
              + nameIt
              + ".pdf";
      JasperManager.printReportToPdfFile(jasperPrint, filePath);
      ret = nameIt + ".pdf";
      this.setStatus(Status.SUCCEEDED);
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw new TsaException(this.getName(), e);
    }
    return ret;
  }