Esempio n. 1
0
 public AccountInventory useAccount(String name) throws ApiSenderException {
   SimpleQuery<AccountVO> q = dbf.createQuery(AccountVO.class);
   q.add(AccountVO_.name, Op.EQ, name);
   AccountVO vo = q.find();
   DebugUtils.Assert(vo != null, String.format("cannot find account[name:%s]", name));
   account = AccountInventory.valueOf(vo);
   accountSession = api.loginByAccount(name, vo.getPassword());
   return account;
 }
  /**
   * Method invoked when the user has clicked on delete button and the grid is in READONLY mode.
   *
   * @param persistentObjects value objects to delete (related to the currently selected rows)
   * @return an ErrorResponse value object in case of errors, VOResponse if the operation is
   *     successfully completed
   */
  public Response deleteRecords(ArrayList persistentObjects) throws Exception {
    AccountVO vo = null;
    for (int i = 0; i < persistentObjects.size(); i++) {
      vo = (AccountVO) persistentObjects.get(i);
      if (!vo.getCanDelACC02().booleanValue()) return new ErrorResponse("deleting not allowed");
    }

    return ClientUtils.getData("deleteAccounts", persistentObjects);
  }
Esempio n. 3
0
 public static AccountInventory valueOf(AccountVO vo) {
   AccountInventory inv = new AccountInventory();
   inv.setUuid(vo.getUuid());
   inv.setName(vo.getName());
   inv.setDescription(vo.getDescription());
   inv.setType(vo.getType().toString());
   inv.setCreateDate(vo.getCreateDate());
   inv.setLastOpDate(vo.getLastOpDate());
   return inv;
 }
 /**
  * Callback method invoked when the user has clicked on the insert button
  *
  * @param valueObject empty value object just created: the user can manage it to fill some
  *     attribute values
  */
 public void createValueObject(ValueObject valueObject) throws Exception {
   AccountVO vo = (AccountVO) valueObject;
   vo.setCompanyCodeSys01ACC02(gridFrame.getControlCompaniesCombo().getValue().toString());
   vo.setLedgerCodeAcc01ACC02(gridFrame.getControlLedgerCode().getValue().toString());
   vo.setLedgerDescriptionACC02(gridFrame.getControlLedgerDescr().getValue().toString());
 }
Esempio n. 5
0
  private static boolean getAccountFromGeneva(
      String logTag, String number, int selParam, AccountVO acctVO) throws ProcessingException {
    L.debug(
        "getAccountFromGeneva():"
            + logTag
            + "Entering with number="
            + number
            + "; type="
            + selParam);
    InitialContext ic = null;
    DataSource ds = null;
    Connection conn = null;
    PreparedStatement pstmt = null;
    ResultSet rset = null;
    boolean retVal = false;
    String dgtID = SPProps.getProdAttrProps().getProperty("PROD_DGT");
    String subID = SPProps.getProdAttrProps().getProperty("SUB_PREPAY");
    if ((dgtID == null || dgtID.trim().length() < 1)
        || (subID == null || subID.trim().length() < 1)) {
      L.error(
          "getAccountFromGeneva():"
              + logTag
              + "During getAccountFromGeneva(): Cannot get Product ID for DGT or Sub ID for Prepay");
      throw new ProcessingException(
          ProcessingException.GLOBAL,
          "During getAccountFromGeneva(): Cannot get Product ID for DGT or Sub ID for Prepay");
    }

    String mdnQuery =
        "select a.customer_ref, a.event_source as mdn, b.account_num, c.bill_handling_code, "
            + "d.event_source as min from pvcusteventsource4 a, pvaccount11 b, pvaccountdetails4 c, "
            + "pvcusteventsource4 d where a.end_dtm is null and a.event_type_id = ? and "
            + "a.event_source = ? and a.customer_ref = b.customer_ref and b.account_num = c.account_num and "
            + "c.end_dat is null and a.customer_ref = d.customer_ref and d.event_type_id = ? and d.end_dtm is null";
    String minQuery =
        "select a.customer_ref, a.event_source as min, b.account_num, c.bill_handling_code, "
            + "d.event_source as mdn from pvcusteventsource4 a, pvaccount11 b, pvaccountdetails4 c, "
            + "pvcusteventsource4 d where a.end_dtm is null and a.event_type_id = ? and "
            + "a.event_source = ? and a.customer_ref = b.customer_ref and b.account_num = c.account_num and "
            + "c.end_dat is null and a.customer_ref = d.customer_ref and d.event_type_id = ? and d.end_dtm is null";

    // PrePay RBT Change
    // String checkPrepay = "select attribute_value from custproductattrdetails where product_id=" +
    // dgtID +
    //		" and product_attribute_subid=" + subID + " and customer_ref = ?";

    String checkPrepay =
        "select /*+ INDEX(CUSTPRODUCTATTRDETAILS CUSTPRODUCTATTRDETAILS_PK) */ count(*) from custproductattrdetails where product_id="
            + dgtID
            + " and product_attribute_subid="
            + subID
            + " and customer_ref = ? and attribute_value='Y' "
            + "and start_dat<sysdate and (end_dat is null or end_dat>sysdate)";

    try {
      ic = new InitialContext();
      ds = (DataSource) ic.lookup(dsNameG);
      conn = ds.getConnection();
      //			String mdnEventType = SPProps.getProperty("MDN_EVENT_TYPE");
      //			String minEventType = SPProps.getProperty("MIN_EVENT_TYPE");
      //			if (mdnEventType == null || mdnEventType.equals(""))
      //				mdnEventType = "8";
      //			if (minEventType == null || minEventType.equals(""))
      //				minEventType = "9";
      //			StringBuffer sb = new StringBuffer();
      //			sb.append("select a.customer_ref, a.event_source as ");
      //			if (selParam == MDN)
      //				sb.append("mdn,");
      //			else
      //				sb.append("min,");
      //			sb.append(
      //				"b.account_num, c.bill_handling_code, d.event_source as ");
      //			if (selParam == MDN)
      //				sb.append("min");
      //			else
      //				sb.append("mdn");
      //			sb.append(" from pvcusteventsource4 a, pvaccount11 b,");
      //			sb.append("pvaccountdetails4 c, pvcusteventsource4 d where ");
      //			sb.append("a.end_dtm is null and ");
      //			sb.append("a.event_type_id = '");
      //			if (selParam == MDN)
      //				sb.append(mdnEventType);
      //			else
      //				sb.append(minEventType);
      //			sb.append("' and ");
      //			sb.append("a.event_source = '" + number + "' and ");
      //			sb.append("a.customer_ref = b.customer_ref and ");
      //			sb.append("b.account_num = c.account_num and ");
      //			sb.append("c.end_dat is null and ");
      //			sb.append("a.customer_ref = d.customer_ref and ");
      //			sb.append("d.event_type_id = '");
      //			if (selParam == MDN)
      //				sb.append(minEventType);
      //			else
      //				sb.append(mdnEventType);
      //			sb.append("' and d.end_dtm is null");

      String query = null;
      if (selParam == MDN) query = mdnQuery;
      else query = minQuery;
      L.debug("getAccountFromGeneva():" + logTag + "SQL Statement is: " + query);

      pstmt = conn.prepareStatement(query);
      if (selParam == MDN) pstmt.setInt(1, SPProps.mdnEventTypeId);
      else pstmt.setInt(1, SPProps.minEventTypeId);
      pstmt.setString(2, number);
      if (selParam == MDN) pstmt.setInt(3, SPProps.minEventTypeId);
      else pstmt.setInt(3, SPProps.mdnEventTypeId);

      rset = pstmt.executeQuery();

      if (rset.next()) {
        String cust_ref = rset.getString(1);
        acctVO.cust_ref = cust_ref;

        if (selParam == MDN) acctVO.mdn = rset.getString(2);
        else acctVO.min = rset.getString(2);

        acctVO.unid = rset.getString(3);
        acctVO.billSysId = rset.getString(4);
        if (selParam == MDN) acctVO.min = rset.getString(5);
        else acctVO.mdn = rset.getString(5);

        acctVO.esn = "";
        acctVO.marketId = "";

        pstmt = conn.prepareStatement(checkPrepay);
        pstmt.setString(1, cust_ref);
        ResultSet rs = pstmt.executeQuery();
        if (rs.next()) {
          if (rs.getInt(1) > 0) acctVO.prepay_ind = "Y";
          else acctVO.prepay_ind = "N";
        }

        L.debug(
            "getAccountFromGeneva():"
                + logTag
                + "Customer Ref="
                + cust_ref
                + ";MDN = "
                + acctVO.mdn
                + ";MIN = "
                + acctVO.min
                + ";PREPAY_IND = "
                + acctVO.prepay_ind); // PrePay RBT Change

        retVal = true;
      }

    } catch (Exception e) {
      L.error("getAccountFromGeneva():" + logTag + "During getAccountFromGeneva(): ", e);
      throw new ProcessingException(ProcessingException.GLOBAL, e.getMessage());
    } finally {
      try {
        if (rset != null) rset.close();
        if (pstmt != null) pstmt.close();
        if (conn != null) conn.close();
      } catch (Exception eat) {
      }
    }
    return retVal;
  }