Exemplo n.º 1
0
  /* (non-Javadoc)
   * @see com.tsagate.puridiom.process.ITask#executeTask(java.lang.Object)
   */
  public Object executeTask(Object object) throws Exception {

    Map incomingRequest = (Map) object;

    DBSession dbs = (DBSession) incomingRequest.get("dbsession");
    String icHeader = (String) incomingRequest.get("ShipTo_icHeader");
    String icLine = (String) incomingRequest.get("ShipTo_icLine");
    if (icLine == null) {
      icLine = "0";
    }

    String queryString = "from ShipTo as s where s.id.icHeader = ? AND s.id.icLine = ?";

    BigDecimal bdHeader = new BigDecimal(icHeader);
    BigDecimal bdLine = new BigDecimal(icLine);

    List result =
        dbs.query(
            queryString,
            new Object[] {bdHeader, bdLine},
            new Type[] {Hibernate.BIG_DECIMAL, Hibernate.BIG_DECIMAL});

    this.setStatus(dbs.getStatus());

    return result;
  }
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      String icRecHeaderString = (String) incomingRequest.get("InspectionMte_icRecHeader");
      BigDecimal icRecHeader = new BigDecimal(icRecHeaderString);
      String icRecLineString = (String) incomingRequest.get("InspectionMte_icRecLine");
      BigDecimal icRecLine = new BigDecimal(icRecLineString);
      String keySequenceString = (String) incomingRequest.get("InspectionMte_keySequence");
      BigDecimal keySequence = new BigDecimal(keySequenceString);

      String queryString =
          "from InspectionMte as InspectionMte where InspectionMte.id.icRecHeader = ? and InspectionMte.id.icRecLine = ? and InspectionMte.id.keySequence = ? ";
      List resultList =
          dbs.query(
              queryString,
              new Object[] {
                icRecHeader, icRecLine, keySequence,
              },
              new Type[] {Hibernate.BIG_DECIMAL, Hibernate.BIG_DECIMAL, Hibernate.BIG_DECIMAL});

      if (resultList != null && resultList.size() > 0) {
        result = resultList.get(0);
      }
      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      String icCodeString = (String) incomingRequest.get("InvBinLocHistory_icCode");
      BigDecimal icCode = new BigDecimal(icCodeString);

      String queryString =
          "from InvBinLocHistory as InvBinLocHistory where InvBinLocHistory.id.icCode = ? ";
      List resultList =
          dbs.query(
              queryString,
              new Object[] {
                icCode,
              },
              new Type[] {Hibernate.BIG_DECIMAL});

      if (resultList != null && resultList.size() > 0) {
        result = resultList.get(0);
      }
      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
Exemplo n.º 4
0
  public static void main(String[] args) throws Exception {
    try {
      DBSession dbs = new DBSession("PURIDIOM");
      InvoiceLineAdd test = new InvoiceLineAdd();
      Map incomingRequest = new HashMap();

      InvoiceLine invoiceLine = new InvoiceLine();

      dbs.startTransaction();

      incomingRequest.put("dbsession", dbs);
      incomingRequest.put("organizationId", "PURIDIOM");
      incomingRequest.put("userId", "SYSADM");
      incomingRequest.put("invoiceLine", invoiceLine);

      invoiceLine = (InvoiceLine) test.executeTask(incomingRequest);
      if (dbs.getStatus() == Status.SUCCEEDED) {
        System.out.println("InvoiceLineAddTest SUCCESS");
        dbs.commit();
      }

      System.out.println(incomingRequest);
      System.out.println("InvoiceLineAddTest COMPLETE");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  /* (non-Javadoc)
   * @see com.tsagate.puridiom.process.ITask#executeTask(java.lang.Object)
   */
  public Object executeTask(Object object) throws Exception {

    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      DBSession dbs = (DBSession) incomingRequest.get("dbsession");

      String department = (String) incomingRequest.get("RequisitionHeader_departmentCode");

      String queryString = "from DepartmentBuyer as d where d.id.departmentCode = ? ";

      List resultList =
          dbs.query(queryString, new Object[] {department}, new Type[] {Hibernate.STRING});

      if (resultList != null && resultList.size() > 0) {
        result = resultList.get(0);
      }

      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
Exemplo n.º 6
0
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      // Always use host database configuration for this table
      DBSession dbs = new DBSession("host");
      String mailId = (String) incomingRequest.get("HostUser_mailId");

      mailId = Utility.ckNull(mailId).toLowerCase();

      String queryString = "from HostUser as HostUser where HostUser.mailId = ? ";
      List resultList =
          dbs.query(
              queryString,
              new Object[] {
                mailId,
              },
              new Type[] {Hibernate.STRING});

      if (resultList != null && resultList.size() > 0) {
        result = resultList.get(0);
      }
      this.setStatus(dbs.getStatus());

      dbs.close();
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      String icHeaderHistoryString = (String) incomingRequest.get("InvItem_icHeaderHistory");
      BigDecimal icHeaderHistory = new BigDecimal(0);
      if (!HiltonUtility.isEmpty(icHeaderHistoryString)) {
        icHeaderHistory = new BigDecimal(icHeaderHistoryString);
      }

      String queryString = "from InvItem as InvItem where InvItem.icHeaderHistory = ? ";
      List resultList =
          dbs.query(
              queryString, new Object[] {icHeaderHistory}, new Type[] {Hibernate.BIG_DECIMAL});

      if (resultList != null && resultList.size() > 0) {
        result = resultList.get(0);
      }
      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      PoHeader poHeader = (PoHeader) incomingRequest.get("poHeader");
      if (poHeader != null) {

        String queryString =
            "from InvoiceHeader as InvoiceHeader where InvoiceHeader.icPoHeader = ? and InvoiceHeader.invoiceNumber<>'N/A' order by InvoiceHeader.invoiceDate";
        List resultList =
            dbs.query(
                queryString,
                new Object[] {poHeader.getIcPoHeader()},
                new Type[] {Hibernate.BIG_DECIMAL});
        result = resultList;
      } else {
        Log.error(
            this, "IcPoHeader was empty.  InvoiceHeaderRetrieveByOrder could not be executed.");
      }

      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
  public static void main(String[] args) throws Exception {
    try {
      DBSession dbs = new DBSession("PURIDIOM");
      VendorInsuranceDeleteById test = new VendorInsuranceDeleteById();
      Map incomingRequest = new HashMap();

      dbs.startTransaction();

      incomingRequest.put("dbsession", dbs);
      incomingRequest.put("organizationId", "PURIDIOM");
      incomingRequest.put("userId", "SYSADM");
      incomingRequest.put("VendorInsurance_contNumber", "1");

      test.executeTask(incomingRequest);
      if (dbs.getStatus() == Status.SUCCEEDED) {
        System.out.println("VendorInsuranceDeleteByIdTest SUCCESS");
        dbs.commit();
      }

      System.out.println(incomingRequest);
      System.out.println("VendorInsuranceDeleteByIdTest COMPLETE");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    List result = null;

    try {
      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      String itemNumber = (String) incomingRequest.get("InvFormProduct_itemNumber");
      if (Utility.isEmpty(itemNumber)) {
        throw new Exception(
            "InvFormProduct_itemNumber cannot be empty.  InvFormProduct could not be retrieved.");
      }

      String queryString =
          "from InvFormProduct as InvFormProduct where InvFormProduct.id.itemNumber = ? ";
      result =
          dbs.query(
              queryString,
              new Object[] {
                itemNumber,
              },
              new Type[] {Hibernate.STRING});

      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
Exemplo n.º 11
0
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object ret = null;
    try {
      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      String icRfqHeader = (String) incomingRequest.get("RfqVendor_icRfqHeader");
      if (icRfqHeader == null) {
        icRfqHeader = (String) incomingRequest.get("RfqHeader_icRfqHeader");
      }
      StringBuffer queryString =
          new StringBuffer(
              "from RfqVendor as rfqvendor where rfqvendor.id.icRfqHeader = "
                  + icRfqHeader
                  + " AND rfqvendor.id.vendorId IN (SELECT RfqLine.vendorAwarded FROM RfqLine RfqLine WHERE RfqLine.icRfqHeader = "
                  + icRfqHeader
                  + ")");
      queryString.append(" order by rfqvendor.id.vendorId ASC");

      List result = dbs.query(queryString.toString());
      ret = result;

      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw new TsaException("Awarded Vendors List couls not be retrieved. " + e.getMessage(), e);
    }
    return ret;
  }
Exemplo n.º 12
0
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      if (incomingRequest.containsKey("RfqNote_icHeader")
          && incomingRequest.containsKey("RfqNote_icLine")) {
        DBSession dbs = (DBSession) incomingRequest.get("dbsession");
        String icHeader = (String) incomingRequest.get("RfqNote_icHeader");
        String icLine = (String) incomingRequest.get("RfqNote_icLine");
        StringBuffer queryString =
            new StringBuffer(
                "from RfqNote as rfqnote where rfqnote.id.icHeader = '"
                    + icHeader
                    + "' and rfqnote.id.icLine = '"
                    + icLine
                    + "'");

        result = dbs.query(queryString.toString());
        this.setStatus(dbs.getStatus());
      } else {
        throw new Exception("The value for RfqNote_icHeader and RfqNote_icLine must be set.");
      }
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
Exemplo n.º 13
0
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    DBSession dbs = (DBSession) incomingRequest.get("dbsession");
    String id = (String) incomingRequest.get("BomRouting_stageId");
    String seq = "01";
    if (incomingRequest.containsKey("BomRouting_icMethod")) {
      BigDecimal icMethod = new BigDecimal((String) incomingRequest.get("BomRouting_icMethod"));
      String sql =
          "Select MAX(bomRouting.stageId) from BomRouting as bomRouting "
              + "Where bomRouting.icMethod = ?";

      List resultList = dbs.query(sql, new Object[] {icMethod}, new Type[] {Hibernate.BIG_DECIMAL});

      if (resultList != null && resultList.size() > 0) {
        if (resultList.get(0) != null) {
          seq = resultList.get(0).toString().substring(0, 2);
          seq = Integer.toString(Integer.parseInt(seq) + 1);
          if (seq.length() < 2) seq = "0" + seq;
        }
      } else {
        seq = "01";
      }
      id = seq + "-" + id;
    }

    this.setStatus(dbs.getStatus());
    return id;
  }
Exemplo n.º 14
0
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    Object result = null;

    try {
      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      String icRfqHeaderString = (String) incomingRequest.get("RfqVendor_icRfqHeader");
      BigDecimal icRfqHeader = new BigDecimal(icRfqHeaderString);
      String vendorId = (String) incomingRequest.get("RfqVendor_vendorId");

      String queryString =
          "from RfqVendor as rfqVendor where rfqVendor.id.icRfqHeader = ? and rfqVendor.id.vendorId = ?";
      List resultList =
          dbs.query(
              queryString,
              new Object[] {
                icRfqHeader, vendorId,
              },
              new Type[] {Hibernate.BIG_DECIMAL, Hibernate.STRING});

      if (resultList != null && resultList.size() > 0) {
        result = resultList.get(0);
      }
      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return result;
  }
Exemplo n.º 15
0
  /**
   * Method executeTask.
   *
   * @param object
   *     <p>incomingRequest
   */
  public Object executeTask(Object object) throws Exception {
    Object ret = null;
    try {
      Map incomingRequest = (Map) object;
      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      String AssetCost_tagNumber = (String) incomingRequest.get("AssetCost_tagNumber");

      if (Utility.isEmpty(AssetCost_tagNumber)) {
        AssetCost_tagNumber = (String) incomingRequest.get("Asset_tagNumber");
      }

      String sql =
          "Select MAX(AssetCost.id.sequenceNo) from AssetCost AssetCost Where AssetCost.id.tagNumber = ?";
      List resultList =
          dbs.query(sql, new Object[] {AssetCost_tagNumber}, new Type[] {Hibernate.STRING});

      if (resultList != null && resultList.size() > 0) {
        ret = resultList.get(0);
        if (ret == null) {
          ret = new BigDecimal(0);
        }
      } else {
        ret = new BigDecimal(0);
      }
      this.setStatus(Status.SUCCEEDED);

    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw new TsaException(this.getName(), e);
    }
    return ret;
  }
  /* (non-Javadoc)
   * @see com.tsagate.puridiom.process.ITask#executeTask(java.lang.Object)
   */
  public Object executeTask(Object object) throws Exception {

    Map incomingRequest = (Map) object;
    Object result = null;

    DBSession dbs = (DBSession) incomingRequest.get("dbsession");
    String icHeader = (String) incomingRequest.get("RfqLine_icRfqHeader");
    // String lineNumber = (String) incomingRequest.get("RfqLine_rfqLine");
    String lineNumber = (String) incomingRequest.get("lineToRetrieve");
    BigDecimal bdHeader = new BigDecimal(icHeader);
    BigDecimal bdNumber = new BigDecimal(lineNumber);

    String queryString = "select b from RfqLine as b where b.icRfqHeader = ? AND b.rfqLine = ?";

    List resultList =
        dbs.query(
            queryString,
            new Object[] {bdHeader, bdNumber},
            new Type[] {Hibernate.BIG_DECIMAL, Hibernate.BIG_DECIMAL});

    if (resultList != null && resultList.size() > 0) {
      result = resultList.get(0);
    }

    this.setStatus(dbs.getStatus());

    return result;
  }
Exemplo n.º 17
0
  public Object executeTask(Object object) throws Exception {
    StringBuffer query = new StringBuffer();
    Object result = null;
    Map incomingRequest = (Map) object;
    try {

      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      BrowseObject b = (BrowseObject) incomingRequest.get("browseObject");
      String organizationId = (String) incomingRequest.get("organizationId");
      String userTimeZone = (String) incomingRequest.get("userTimeZone");
      String userDateFormat = (String) incomingRequest.get("userDateFormat");
      String sqlWhere = (String) incomingRequest.get("sqlWhere");
      List dateArguments = new ArrayList();

      if (Utility.isEmpty(userDateFormat)) {
        userDateFormat =
            PropertiesManager.getInstance(organizationId)
                .getProperty("MISC", "DATEFORMAT", "MM-dd-yyyy");
      }

      sqlWhere =
          ReportDates.dateWhereClauseDecoder(
              sqlWhere, dateArguments, organizationId, userTimeZone, userDateFormat);

      if (Utility.isEmpty(sqlWhere)) {
        sqlWhere = "";
      }
      String sqlSelect = b.getSqlSelect();

      query.append(sqlSelect);
      query.append(" from " + b.getSqlFrom());
      query.append(" " + sqlWhere);
      Log.debug(this, incomingRequest.get("userId") + " - query: " + query.toString());

      long start = System.currentTimeMillis();
      System.out.println("Report Query: " + query.toString());
      List list = dbs.query(query.toString(), dateArguments.toArray(), b.getMaxRows());
      long end = System.currentTimeMillis();
      Log.error(
          this,
          "It took "
              + ((end - start) / 1000)
              + " seconds to execute the query: "
              + query.toString());
      Log.debug(this, incomingRequest.get("userId") + " - dbs.query COMPLETE.");

      result = list;

      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      incomingRequest.put("failed", Boolean.TRUE);
      Log.error(
          this,
          "Error executing Report Query: " + query.toString() + " -Exception: " + e.getMessage());
      e.printStackTrace();

      this.setStatus(Status.FAILED);
    }
    return result;
  }
Exemplo n.º 18
0
 public Object executeTask(Object object) throws Exception {
   Map incomingRequest = (Map) object;
   DBSession dbs = (DBSession) incomingRequest.get("dbsession");
   String queryString = "from AssetService as assetService";
   List result = dbs.query(queryString);
   this.setStatus(dbs.getStatus());
   return result;
 }
Exemplo n.º 19
0
  /* (non-Javadoc)
   * @see com.tsagate.puridiom.process.ITask#executeTask(java.lang.Object)
   */
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    CatalogItem catalogItem = new CatalogItem();
    CatalogItemValues.setValues(object, catalogItem);
    DBSession dbs = (DBSession) incomingRequest.get("dbsession");

    dbs.delete(catalogItem);

    this.setStatus(dbs.getStatus());

    return catalogItem;
  }
Exemplo n.º 20
0
 public Object executeTask(Object object) throws Exception {
   Map incomingRequest = (Map) object;
   DBSession dbs = (DBSession) incomingRequest.get("dbsession");
   SecurityGroup securityGroup = (SecurityGroup) incomingRequest.get("securityGroup");
   if (securityGroup == null) {
     securityGroup = new SecurityGroup();
   }
   SecurityGroupSetValuesPK setValues = new SecurityGroupSetValuesPK();
   setValues.setValues(incomingRequest, securityGroup);
   dbs.delete(securityGroup);
   this.setStatus(dbs.getStatus());
   return securityGroup;
 }
Exemplo n.º 21
0
 public Object executeTask(Object object) throws Exception {
   Map incomingRequest = (Map) object;
   DBSession dbs = (DBSession) incomingRequest.get("dbsession");
   AutoGen autoGen = (AutoGen) incomingRequest.get("autoGen");
   if (autoGen == null) {
     autoGen = new AutoGen();
   }
   AutoGenSetValuesPK setValues = new AutoGenSetValuesPK();
   setValues.setValues(incomingRequest, autoGen);
   dbs.delete(autoGen);
   this.setStatus(dbs.getStatus());
   return autoGen;
 }
Exemplo n.º 22
0
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    DBSession dbs = (DBSession) incomingRequest.get("dbsession");
    UserProfile userProfile = (UserProfile) incomingRequest.get("userProfile");
    if (userProfile == null) {
      userProfile = new UserProfile();
      String userId = (String) incomingRequest.get("UserProfile_userId");
      userProfile.setUserId(userId);
    }

    dbs.delete(userProfile);
    this.setStatus(dbs.getStatus());
    return userProfile;
  }
  public Object executeTask(Object object) throws Exception {
    Object result = null;
    Map incomingRequest = (Map) object;

    PoHeader poHeader = (PoHeader) incomingRequest.get("poHeader");
    DBSession dbs = (DBSession) incomingRequest.get("dbsession");
    BigDecimal icPoHeader = poHeader.getIcPoHeader();
    String queryString =
        "select sum(invoiceLine.quantity) from InvoiceLine as invoiceLine where invoiceLine.icPoHeader= ? group by invoiceLine.lineNumber order by invoiceLine.lineNumber";
    result = dbs.query(queryString, icPoHeader, Hibernate.BIG_DECIMAL);

    this.setStatus(dbs.getStatus());
    return result;
  }
Exemplo n.º 24
0
  /* (non-Javadoc)
   * @see com.tsagate.puridiom.process.ITask#executeTask(java.lang.Object)
   */
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    DBSession dbs = (DBSession) incomingRequest.get("dbsession");

    Catalog catalog = new Catalog();

    CatalogSetValues catalogValues = new CatalogSetValues();
    incomingRequest.put("catalog", catalog);
    catalog = (Catalog) catalogValues.executeTask(incomingRequest);

    dbs.add(catalog);
    this.setStatus(dbs.getStatus());

    return catalog;
  }
Exemplo n.º 25
0
  /* (non-Javadoc)
   * @see com.tsagate.puridiom.process.ITask#executeTask(java.lang.Object)
   */
  public Object executeTask(Object object) throws Exception {

    Map incomingRequest = (Map) object;
    String section = "%DEFAULTS";

    DBSession dbs = (DBSession) incomingRequest.get("dbsession");
    String queryString = "from Property as prop where prop.id.section like ?";

    List result = dbs.query(queryString, section, Hibernate.STRING);

    // List result = dbs.query(queryString) ;
    this.setStatus(dbs.getStatus());

    return result;
  }
Exemplo n.º 26
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;
  }
  /* (non-Javadoc)
   * @see com.tsagate.puridiom.process.ITask#executeTask(java.lang.Object)
   */
  public Object executeTask(Object object) throws Exception {

    Map incomingRequest = (Map) object;
    DBSession dbs = (DBSession) incomingRequest.get("dbsession");

    String queryString =
        "from HistoryLog as hst where hst.icHeaderHistory = ? and (hst.doctype like '%H' or hst.doctype = 'REQ') order by hst.icHistory ASC";

    String icHeaderHistory = (String) incomingRequest.get("HistoryLog_icHeaderHistory");
    BigDecimal bdHeaderHistory = new BigDecimal(icHeaderHistory);

    List result =
        dbs.query(queryString, new Object[] {bdHeaderHistory}, new Type[] {Hibernate.BIG_DECIMAL});

    this.setStatus(dbs.getStatus());
    return result;
  }
  public Object executeTask(Object object) throws Exception {
    Map incomingRequest = (Map) object;
    List resultList = null;

    try {
      DBSession dbs = (DBSession) incomingRequest.get("dbsession");
      String budgetId = (String) incomingRequest.get("BudgetCenter_budgetId");

      String queryString = "from BudgetCenter BudgetCenter where BudgetCenter.id = ? ";
      resultList = dbs.query(queryString, new Object[] {budgetId}, new Type[] {Hibernate.STRING});

      this.setStatus(dbs.getStatus());
    } catch (Exception e) {
      this.setStatus(Status.FAILED);
      throw e;
    }
    return resultList;
  }
  public static void main(String[] args) throws Exception {
    try {
      DBSession dbs = new DBSession("HILTON");
      BomReferenceRetrieveById test = new BomReferenceRetrieveById();
      Map incomingRequest = new HashMap();

      incomingRequest.put("dbsession", dbs);
      incomingRequest.put("organizationId", "HILTON");
      incomingRequest.put("userId", "SYSADM");

      System.out.println("Database Status: " + dbs.getStatus());

      BomReference bomReference = (BomReference) test.executeTask(incomingRequest);

      System.out.println("BomReference: " + bomReference.toString());
      System.out.println("BomReferenceRetrieveByIdTest COMPLETE");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 30
0
  public static void main(String[] args) throws Exception {
    try {
      DBSession dbs = new DBSession("PURIDIOM");
      CountryRetrieveById test = new CountryRetrieveById();
      Map incomingRequest = new HashMap();

      incomingRequest.put("dbsession", dbs);
      incomingRequest.put("organizationId", "PURIDIOM");
      incomingRequest.put("userId", "SYSADM");

      System.out.println("Database Status: " + dbs.getStatus());

      Country country = (Country) test.executeTask(incomingRequest);

      System.out.println("Country: " + country.toString());
      System.out.println("CountryRetrieveByIdTest COMPLETE");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }