Example usage for java.sql ResultSet getDouble

List of usage examples for java.sql ResultSet getDouble

Introduction

In this page you can find the example usage for java.sql ResultSet getDouble.

Prototype

double getDouble(String columnLabel) throws SQLException;

Source Link

Document

Retrieves the value of the designated column in the current row of this ResultSet object as a double in the Java programming language.

Usage

From source file:com.ibm.ioes.dao.ReportsDao_Usage.java

public ArrayList<PendingOrderAndBillingReportDTO> viewPendingOrderAndBillingList(
        PendingOrderAndBillingReportDTO objDto) throws Exception {
    //Nagarjuna//from   w  w w.j  a  v  a 2 s  . c  o m
    String methodName = "viewPendingOrderAndBillingList", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<PendingOrderAndBillingReportDTO> objUserList = new ArrayList<PendingOrderAndBillingReportDTO>();
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    PendingOrderAndBillingReportDTO objRDto;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    Date tempDate = null;

    try {

        conn = DbConnection.getReportsConnectionObject();

        proc = conn.prepareCall(sqlPendingOrderAndBillingReport);
        if (objDto.getOrderType() != null && !"".equals(objDto.getOrderType())) {
            proc.setString(1, objDto.getOrderType().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }
        if (objDto.getLOC_Date() != null && !"".equals(objDto.getLOC_Date())) {
            proc.setString(2, objDto.getLOC_Date());
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromAccountNo() != 0 && !"".equals(objDto.getFromAccountNo())) {
            proc.setInt(3, objDto.getFromAccountNo());
        } else {
            proc.setNull(3, java.sql.Types.BIGINT);
        }
        if (objDto.getToAccountNo() != 0 && !"".equals(objDto.getToAccountNo())) {
            proc.setInt(4, objDto.getToAccountNo());
        } else {
            proc.setNull(4, java.sql.Types.BIGINT);
        }
        if (objDto.getFromCopcApprovedDate() != null && !"".equals(objDto.getFromCopcApprovedDate())) {
            SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr = formatter.parse(objDto.getFromCopcApprovedDate());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formatter = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate = formatter.format(date1);
            proc.setString(5, formattedDate);
        } else {
            proc.setNull(5, java.sql.Types.VARCHAR);
        }
        if (objDto.getToCopcApprovedDate() != null && !"".equals(objDto.getToCopcApprovedDate())) {
            SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr1 = formatter1.parse(objDto.getToCopcApprovedDate());
            String formattedDate1 = formatter1.format(dateStr1);
            Date date2 = formatter1.parse(formattedDate1);
            formatter1 = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate1 = formatter1.format(date2);
            proc.setString(6, formattedDate1);
        } else {
            proc.setNull(6, java.sql.Types.VARCHAR);
        }

        if (objDto.getFromOrderNo() != 0 && !"".equals(objDto.getFromOrderNo())) {
            proc.setInt(7, objDto.getFromOrderNo());
        } else {
            proc.setNull(7, java.sql.Types.BIGINT);
        }
        if (objDto.getToOrderNo() != 0 && !"".equals(objDto.getToOrderNo())) {
            proc.setInt(8, objDto.getToOrderNo());
        } else {
            proc.setNull(8, java.sql.Types.BIGINT);
        }

        if (objDto.getActmngname() != null && !"".equals(objDto.getActmngname())) {
            proc.setString(9, objDto.getActmngname().trim());
        } else {
            proc.setNull(9, java.sql.Types.VARCHAR);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(10, pagingSorting.getSortByColumn());// columnName
        proc.setString(11, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(12, pagingSorting.getStartRecordId());// start index
        proc.setInt(13, pagingSorting.getEndRecordId());// end index
        proc.setInt(14, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index
        proc.setInt(15, objDto.getIsUsage());// end
        if (objDto.getOsp() != null && !"".equals(objDto.getOsp())) {
            proc.setString(16, objDto.getOsp().trim());
        } else {
            proc.setNull(16, java.sql.Types.VARCHAR);
        }
        rs = proc.executeQuery();
        int countFlag = 0;
        while (rs.next() != false) {
            countFlag++;

            objRDto = new PendingOrderAndBillingReportDTO();
            objRDto.setCrmAccountNo(rs.getInt("CRMACCOUNTNO"));
            objRDto.setCus_segment(rs.getString("CUST_SEGMENT_CODE"));
            objRDto.setAct_category(rs.getString("ACCOUNTCATEGORY_DETAILS"));
            objRDto.setOrderNumber(rs.getInt("ORDERNO"));
            objRDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objRDto.setCustPoDate(rs.getString("CUSTPODATE"));
            /*if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE")))
            {            
               Date date=df.parse(objRDto.getCustPoDate());
               objRDto.setCustPoDate((Utility.showDate_Report(date)).toUpperCase());         
            }*/
            tempDate = rs.getDate("CUSTPODATE");
            if (tempDate != null && !"".equals(tempDate)) {
                objRDto.setCustPoDate((utility.showDate_Report(tempDate)).toUpperCase());
            }

            objRDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objRDto.setM6OrderNo(rs.getInt("M6ORDERNO"));
            objRDto.setCurrencyName(rs.getString("CURRENCYNAME"));
            objRDto.setOrderType(rs.getString("ORDERTYPE"));
            objRDto.setLOC_Date(rs.getString("LOCDATE"));
            if (rs.getString("LOCDATE") != null && !"".equals(rs.getString("LOCDATE"))) {
                Date date = df.parse(objRDto.getLOC_Date());
                objRDto.setLOC_Date((Utility.showDate_Report(date)).toUpperCase());
            }
            objRDto.setPm_pro_date(rs.getString("PM_PROV_DATE"));
            if (rs.getString("PM_PROV_DATE") != null && !"".equals(rs.getString("PM_PROV_DATE"))) {
                String s1 = rs.getString("PM_PROV_DATE");
                String s3 = s1.substring(0, 7).toUpperCase();
                String s4 = s1.substring(9, 11);
                String s5 = s3.concat(s4);
                objRDto.setPm_pro_date(s5);
            }
            tempDate = rs.getDate("ORDERDATE");
            objRDto.setOrderDate(rs.getString("ORDERDATE"));
            if (tempDate != null && !"".equals(tempDate)) {
                objRDto.setOrderDate((utility.showDate_Report(tempDate)).toUpperCase());
            }
            objRDto.setPoNumber(rs.getInt("PONUMBER"));
            objRDto.setUom(rs.getString("UOM"));
            objRDto.setBandwaidth(rs.getString("BANDWIDTH"));
            objRDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            objRDto.setBilling_uom(rs.getString("BILLING_BANDWIDTH_UOM"));
            objRDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));

            //          Meenakshi : Changes for Usage
            if (objDto.getIsUsage() == 1) {
                objRDto.setRegionName(rs.getString("REGION"));
                objRDto.setAccountID(rs.getInt("CUSTACCOUNTID"));
                objRDto.setLogicalSINo(rs.getString("LOGICAL_SI_NO"));
                objRDto.setLinename(rs.getString("SERVICEDETDESCRIPTION"));
                objRDto.setLcompanyname(rs.getString("LCOMPANYNAME"));
                objRDto.setLine_desc(rs.getString("SERVICEDETDESCRIPTION"));
                objRDto.setActmngname(rs.getString("ACCOUNTMANAGER"));
                objRDto.setPrjmngname(rs.getString("PROJECTMANAGER"));
                objRDto.setCopcApproveDate(rs.getString("COPC_APPROVED_DATE"));
                if (rs.getString("COPC_APPROVED_DATE") != null
                        && !"".equals(rs.getString("COPC_APPROVED_DATE"))) {
                    objRDto.setCopcApproveDate(
                            (Utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVED_DATE").getTime())))
                                    .toUpperCase());
                }
                objRDto.setTaxation(rs.getString("TAXATIONVALUE"));

                objRDto.setComponentInfoID(rs.getInt("COMPONENTINFOID"));
                objRDto.setComponentID(rs.getInt("COMPONENT_ID"));
                objRDto.setComponentName(rs.getString("COMPONENT_NAME"));
                objRDto.setComponentType(rs.getString("COMPONENT_TYPE"));
                objRDto.setComponentRCNRCAmount(rs.getDouble("COMP_AMOUNT"));
                objRDto.setPackageID(rs.getInt("PACKAGE_ID"));
                objRDto.setPackageName(rs.getString("PACKAGE_NAME"));
                objRDto.setChild_act_no(rs.getString("Child_Account_Number"));

            } else {
                objRDto.setRegionName(rs.getString("REGIONNAME"));
                objRDto.setAccountID(rs.getInt("ACCOUNTID"));
                objRDto.setCrm_productname(rs.getString("CRM_PRODUCT_NAME"));
                objRDto.setLogicalCircuitId(rs.getString("LOGICALCKTID"));
                objRDto.setCompanyName(rs.getString("COMPANYNAME"));
                objRDto.setFactory_ckt_id(rs.getString("FACTORY_CKT_ID"));
                objRDto.setLinename(rs.getString("LINENAME"));
                objRDto.setLcompanyname(rs.getString("LICENCECOMPANYNAME"));
                objRDto.setStorename(rs.getString("STORENAME"));
                objRDto.setLine_desc(rs.getString("LINE_ITEM_DESC"));
                objRDto.setActmngname(rs.getString("ACTMNAME"));
                objRDto.setPrjmngname(rs.getString("PMNAME"));
                objRDto.setCopcApproveDate(rs.getString("COPC_APPROVAL_DATE"));
                if (rs.getString("COPC_APPROVAL_DATE") != null
                        && !"".equals(rs.getString("COPC_APPROVAL_DATE"))) {
                    objRDto.setCopcApproveDate(
                            (Utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVAL_DATE").getTime())))
                                    .toUpperCase());
                }
                objRDto.setTaxation(rs.getString("TAXATION"));
                objRDto.setOsp(rs.getString("OSP"));

                objRDto.setAnnual_rate(rs.getDouble("ANNUAL_RATE"));
                objRDto.setChargeAmount(rs.getDouble("CHARGEAMOUNT"));
                objRDto.setChargeName(rs.getString("CHARGE_NAME"));
                objRDto.setChargeTypeName(rs.getString("CYCLICNONCYCLIC"));
                objRDto.setFrequencyName(rs.getString("PAYMENTTERM"));
                objRDto.setChild_act_no(rs.getString("CHILD_ACCOUNT_NO"));
            }

            /// End
            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
                //recordCount = countFlag;
            }
            objUserList.add(objRDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }
    return objUserList;
}

From source file:com.ibm.ioes.dao.ReportsDao.java

public ArrayList<PendingOrderAndBillingReportDTO> viewPendingOrderAndBillingList(
        PendingOrderAndBillingReportDTO objDto) throws Exception {
    //   Nagarjuna
    String methodName = "viewPendingOrderAndBillingList", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end   /* w  w w .java2s. c  o  m*/
    ArrayList<PendingOrderAndBillingReportDTO> objUserList = new ArrayList<PendingOrderAndBillingReportDTO>();
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    PendingOrderAndBillingReportDTO objRDto;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");

    try {

        conn = DbConnection.getReportsConnectionObject();

        proc = conn.prepareCall(sqlPendingOrderAndBillingReport);
        if (objDto.getOrderType() != null && !"".equals(objDto.getOrderType())) {
            proc.setString(1, objDto.getOrderType().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }
        if (objDto.getLOC_Date() != null && !"".equals(objDto.getLOC_Date())) {
            proc.setString(2, objDto.getLOC_Date());
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromAccountNo() != 0 && !"".equals(objDto.getFromAccountNo())) {
            proc.setInt(3, objDto.getFromAccountNo());
        } else {
            proc.setNull(3, java.sql.Types.BIGINT);
        }
        if (objDto.getToAccountNo() != 0 && !"".equals(objDto.getToAccountNo())) {
            proc.setInt(4, objDto.getToAccountNo());
        } else {
            proc.setNull(4, java.sql.Types.BIGINT);
        }
        if (objDto.getFromCopcApprovedDate() != null && !"".equals(objDto.getFromCopcApprovedDate())) {
            SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr = formatter.parse(objDto.getFromCopcApprovedDate());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formatter = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate = formatter.format(date1);
            proc.setString(5, formattedDate);
        } else {
            proc.setNull(5, java.sql.Types.VARCHAR);
        }
        if (objDto.getToCopcApprovedDate() != null && !"".equals(objDto.getToCopcApprovedDate())) {
            SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr1 = formatter1.parse(objDto.getToCopcApprovedDate());
            String formattedDate1 = formatter1.format(dateStr1);
            Date date2 = formatter1.parse(formattedDate1);
            formatter1 = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate1 = formatter1.format(date2);
            proc.setString(6, formattedDate1);
        } else {
            proc.setNull(6, java.sql.Types.VARCHAR);
        }

        if (objDto.getFromOrderNo() != 0 && !"".equals(objDto.getFromOrderNo())) {
            proc.setInt(7, objDto.getFromOrderNo());
        } else {
            proc.setNull(7, java.sql.Types.BIGINT);
        }
        if (objDto.getToOrderNo() != 0 && !"".equals(objDto.getToOrderNo())) {
            proc.setInt(8, objDto.getToOrderNo());
        } else {
            proc.setNull(8, java.sql.Types.BIGINT);
        }

        if (objDto.getActmngname() != null && !"".equals(objDto.getActmngname())) {
            proc.setString(9, objDto.getActmngname().trim());
        } else {
            proc.setNull(9, java.sql.Types.VARCHAR);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(10, pagingSorting.getSortByColumn());// columnName
        proc.setString(11, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(12, pagingSorting.getStartRecordId());// start index
        proc.setInt(13, pagingSorting.getEndRecordId());// end index
        proc.setInt(14, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index
        if (objDto.getOsp() != null && !"".equals(objDto.getOsp())) {
            proc.setString(15, objDto.getOsp().trim());
        } else {
            proc.setNull(15, java.sql.Types.VARCHAR);
        }

        rs = proc.executeQuery();
        int countFlag = 0;
        while (rs.next() != false) {
            countFlag++;

            objDto = new PendingOrderAndBillingReportDTO();
            objDto.setCrmAccountNo(rs.getInt("CRMACCOUNTNO"));
            objDto.setRegionName(rs.getString("REGIONNAME"));
            objDto.setCus_segment(rs.getString("CUST_SEGMENT_CODE"));
            objDto.setAct_category(rs.getString("ACCOUNTCATEGORY_DETAILS"));
            objDto.setAccountID(rs.getInt("ACCOUNTID"));
            objDto.setCrm_productname(rs.getString("CRM_PRODUCT_NAME"));
            objDto.setLogicalCircuitId(rs.getString("LOGICALCKTID"));
            objDto.setCompanyName(rs.getString("COMPANYNAME"));
            objDto.setFactory_ckt_id(rs.getString("FACTORY_CKT_ID"));
            objDto.setOrderNumber(rs.getInt("ORDERNO"));
            objDto.setCustPoDate(rs.getString("CUSTPODATE"));
            if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE"))) {

                Date date = df.parse(objDto.getCustPoDate());
                objDto.setCustPoDate((utility.showDate_Report(date)).toUpperCase());

            }
            objDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objDto.setLinename(rs.getString("LINENAME"));
            objDto.setLcompanyname(rs.getString("LICENCECOMPANYNAME"));
            objDto.setChargeName(rs.getString("CHARGE_NAME"));
            objDto.setChargeTypeName(rs.getString("CYCLICNONCYCLIC"));
            objDto.setStorename(rs.getString("STORENAME"));
            objDto.setM6OrderNo(rs.getInt("M6ORDERNO"));
            objDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objDto.setCurrencyName(rs.getString("CURRENCYNAME"));
            objDto.setAnnualRate(rs.getString("ANNUAL_RATE"));
            if (objDto.getAnnualRate() == null) {
                objDto.setAnnualRate(" ");
            }
            objDto.setChargeAmount_String(BigDecimal.valueOf((rs.getDouble("CHARGEAMOUNT"))).toPlainString());

            if (objDto.getChargeAmount_String() == null) {
                objDto.setChargeAmount_String(" ");
            }
            objDto.setLine_desc(rs.getString("LINE_ITEM_DESC"));
            objDto.setActmngname(rs.getString("ACTMNAME"));
            objDto.setOrderType(rs.getString("ORDERTYPE"));
            objDto.setFrequencyName(rs.getString("PAYMENTTERM"));
            objDto.setLOC_Date(rs.getString("LOCDATE"));
            if (rs.getString("LOCDATE") != null && !"".equals(rs.getString("LOCDATE"))) {

                Date date = df.parse(objDto.getLOC_Date());
                objDto.setLOC_Date((utility.showDate_Report(date)).toUpperCase());

            }
            objDto.setPm_pro_date(rs.getString("PM_PROV_DATE"));
            if (rs.getString("PM_PROV_DATE") != null && !"".equals(rs.getString("PM_PROV_DATE"))) {
                String s1 = rs.getString("PM_PROV_DATE");
                String s3 = s1.substring(0, 7).toUpperCase();
                String s4 = s1.substring(9, 11);
                String s5 = s3.concat(s4);
                objDto.setPm_pro_date(s5);
            }
            objDto.setOrderDate(rs.getString("POCREATEDATE"));
            if (rs.getString("POCREATEDATE") != null && !"".equals(rs.getString("POCREATEDATE"))) {

                objDto.setOrderDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("POCREATEDATE").getTime())))
                                .toUpperCase());

            }

            objDto.setPoNumber(rs.getInt("PONUMBER"));
            objDto.setPrjmngname(rs.getString("PMNAME"));
            objDto.setCopcApproveDate(rs.getString("COPC_APPROVAL_DATE"));
            if (rs.getString("COPC_APPROVAL_DATE") != null && !"".equals(rs.getString("COPC_APPROVAL_DATE"))) {
                objDto.setCopcApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVAL_DATE").getTime())))
                                .toUpperCase());
            }
            objDto.setTaxation(rs.getString("TAXATION"));
            objDto.setUom(rs.getString("UOM"));
            objDto.setBandwaidth(rs.getString("BANDWIDTH"));
            objDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            objDto.setBilling_uom(rs.getString("BILLING_BANDWIDTH_UOM"));
            objDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            //objDto.setOsp(rs.getString("OSP"));

            objDto.setServiceProductId(rs.getString("SERVICEPRODUCTID")); //  StartChange by Anadi's Change
            objDto.setBillingTriggStatus(rs.getString("BILLING_TRIGGER_STATUS"));
            objDto.setChargeInfoId(rs.getString("CHARGEINFOID"));
            objDto.setChangeServiceId(rs.getString("CHANGE_SERVICEID")); //  EndChange By Anadi 

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
                //recordCount = countFlag;
            }
            objUserList.add(objDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }
    return objUserList;
}

From source file:com.ibm.ioes.dao.ReportsDao.java

public ArrayList<CancelledFailedLineReportDTO> viewCancelledFailedLineReport(
        CancelledFailedLineReportDTO objDto) {
    //   Nagarjuna
    String methodName = "viewCancelledFailedLineReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end//  w w  w  .  j a v  a  2s  .  c om
    Connection connection = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    ArrayList<CancelledFailedLineReportDTO> listSearchDetails = new ArrayList<CancelledFailedLineReportDTO>();
    CancelledFailedLineReportDTO objReportsDto = null;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
    SimpleDateFormat formatter2 = new SimpleDateFormat("MM-dd-yyyy");

    try {
        connection = DbConnection.getReportsConnectionObject();
        proc = connection.prepareCall(sqlGetCancelledFailedLineReports);

        if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate())) {
            Date dateStr = formatter.parse(objDto.getFromDate().trim());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formattedDate = formatter2.format(date1);
            proc.setString(1, formattedDate);

        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }

        if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) {
            Date dateStr = formatter.parse(objDto.getToDate().trim());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formattedDate = formatter2.format(date1);
            proc.setString(2, formattedDate);

        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }

        if (objDto.getServiceName() != null && !"".equals(objDto.getServiceName())) {
            proc.setString(3, objDto.getServiceName().trim().toUpperCase());
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(4, pagingSorting.getSortByColumn());// columnName
        proc.setString(5, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(6, pagingSorting.getStartRecordId());// start index
        proc.setInt(7, pagingSorting.getEndRecordId());// end index
        proc.setInt(8, (pagingSorting.isPagingToBeDone() ? 1 : 0));
        // index
        rs = proc.executeQuery();
        while (rs.next()) {
            objReportsDto = new CancelledFailedLineReportDTO();
            objReportsDto.setPartyNo(rs.getInt("PARTY_NO"));
            objReportsDto.setAccountID(rs.getInt("CRMACCOUNTNO"));
            objReportsDto.setPartyName(rs.getString("PARTYNAME"));
            objReportsDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objReportsDto.setRegionName(rs.getString("REGION"));
            objReportsDto.setOrderNumber(rs.getInt("ORDERNO"));
            objReportsDto.setOrder_type(rs.getString("ORDERTYPE"));
            objReportsDto.setServiceName(rs.getString("SERVICENAME"));
            objReportsDto.setCustomer_logicalSINumber(rs.getInt("CUSTOMER_LOGICAL_SI_NO"));
            objReportsDto.setLinename(rs.getString("SERVICEDETDESCRIPTION"));
            objReportsDto.setOrdersubtype(rs.getString("ORDERSUBTYPE"));
            objReportsDto.setCkt_id(rs.getString("CKTID"));
            objReportsDto.setBandwaidth(rs.getString("BANDWIDTH"));
            objReportsDto.setUom(rs.getString("UOM"));
            objReportsDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            objReportsDto.setBilling_uom(rs.getString("BILLING_BANDWIDTH_UOM"));
            objReportsDto.setDistance(rs.getString("DISTANCE"));
            objReportsDto.setRatio(rs.getString("RATIO"));
            objReportsDto.setLocation_from(rs.getString("FROM_ADDRESS"));
            objReportsDto.setLocation_to(rs.getString("TO_ADDRESS"));
            objReportsDto.setPrimarylocation(rs.getString("PRIMARYLOCATION"));
            objReportsDto.setSeclocation(rs.getString("SECONDARYLOCATION"));
            objReportsDto.setProductName(rs.getString("PRODUCTNAME"));
            objReportsDto.setSubProductName(rs.getString("SUBPRODUCTNAME"));
            objReportsDto.setEntity(rs.getString("ENTITYNAME"));
            objReportsDto.setLcompanyname(rs.getString("LCOMPANYNAME"));
            objReportsDto.setCurrencyName(rs.getString("CURRENCYNAME"));
            objReportsDto.setCreditPeriodName(rs.getString("CREDITPERIOD"));
            objReportsDto.setBillingTypeName(rs.getString("BILLING_TYPENAME"));
            objReportsDto.setBillingFormatName(rs.getString("BILLING_FORMATNAME"));
            objReportsDto.setBillingLevel(rs.getString("BILLING_LEVELNAME"));
            objReportsDto.setBillingLevelNo(rs.getLong("BILLING_LEVEL_NO"));
            objReportsDto.setTaxation(rs.getString("TAXATIONVALUE"));
            objReportsDto.setHardwaretypeName(rs.getString("HARDWARETYPENAME"));
            objReportsDto.setHardware_flag(rs.getString("HARDWARE_FLAG"));
            objReportsDto.setStorename(rs.getString("STORENAME"));
            objReportsDto.setSaleType(rs.getString("SALETYPE"));
            objReportsDto.setBill_period(rs.getString("BILL_PERIOD"));
            objReportsDto.setBillingMode(rs.getString("BILLINGMODE"));
            objReportsDto.setPoNumber(rs.getInt("PONUMBER"));
            objReportsDto.setOldLsi(rs.getString("OLD_LSI_CRM"));
            objReportsDto.setBusiness_serial_n(rs.getInt("BUSINESS_SERIAL_NO"));
            objReportsDto.setOpms_Account_Id(rs.getString("OPMS_ACCOUNT_ID"));
            objReportsDto.setPoDate(rs.getString("PODATE"));
            if (rs.getString("PODATE") != null && !"".equals(rs.getString("PODATE"))) {
                Date date = df.parse(objReportsDto.getPoDate());
                objReportsDto.setPoDate((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objReportsDto.setTotalPoAmt(BigDecimal.valueOf((rs.getDouble("TOTALPOAMOUNT"))).toPlainString());

            if (objReportsDto.getTotalPoAmt() == null) {
                objReportsDto.setTotalPoAmt(" ");
            }
            objReportsDto.setPoReceiveDate(rs.getString("PORECEIVEDATE"));
            if (rs.getString("PORECEIVEDATE") != null && !"".equals(rs.getString("PORECEIVEDATE"))) {
                Date date = df.parse(objReportsDto.getPoReceiveDate());
                objReportsDto.setPoReceiveDate((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objReportsDto.setCustPoDate(rs.getString("CUSTPODATE"));
            if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE"))) {
                Date date = df.parse(objReportsDto.getCustPoDate());
                objReportsDto.setCustPoDate((utility.showDate_Report(date)).toUpperCase());
            }
            //objReportsDto.setCust_total_poamt(rs.getDouble("CUST_TOT_PO_AMT"));
            objReportsDto.setChargeTypeName(rs.getString("CHARGE_TYPE"));
            objReportsDto.setChargeName(rs.getString("CHARGE_NAME"));
            objReportsDto.setChargeEndDate(rs.getString("CSTATE_CHARGE_CURRENT_START_DATE"));
            //objReportsDto.setChargeAmount(rs.getDouble("INV_AMT"));
            objReportsDto
                    .setFrequencyAmt(BigDecimal.valueOf((rs.getDouble("CHARGEFREQUENCYAMT"))).toPlainString());

            if (objReportsDto.getFrequencyAmt() == null) {
                objReportsDto.setFrequencyAmt(" ");
            }
            //objReportsDto.setLineamt(rs.getLong("LINEITEMAMOUNT"));
            //objReportsDto.setAmt(rs.getLong("CHARGEAMOUNT"));//particular charge amount
            objReportsDto.setLineItemAmount(BigDecimal.valueOf((rs.getDouble("CHARGEAMOUNT"))).toPlainString());

            if (objReportsDto.getLineItemAmount() == null) {
                objReportsDto.setLineItemAmount(" ");
            }
            objReportsDto.setAnnitation(rs.getString("ANNOTATION"));
            objReportsDto.setTokenno(rs.getString("CSTATE_START_DETAILS_FX_TOKEN_NO"));
            objReportsDto.setFx_status(rs.getString("CSTATE_START_DETAILS_FX_STATUS"));
            objReportsDto.setFx_sd_status(rs.getString("CSTATE_FX_CHARGE_START_STATUS"));
            objReportsDto.setOrderDate(rs.getString("ORDERDATE"));
            if (!(rs.getString("ORDERDATE") == null || rs.getString("ORDERDATE") == "")) {
                objReportsDto.setOrderDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("ORDERDATE").getTime())))
                                .toUpperCase());
            }

            //objReportsDto.setBusiness_serial_no(rs.getString("Business_No"));
            //objReportsDto.setOpms_act_id(rs.getString("Opms_Account_Id"));
            objReportsDto.setLineno(rs.getInt("ORDER_LINE_ID"));

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            listSearchDetails.add(objReportsDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        //ex.printStackTrace();   
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(connection);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            //   e.printStackTrace();
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        }
    }
    return listSearchDetails;
}

From source file:com.ibm.ioes.dao.ReportsDao.java

/**
 * /*  w  w  w .j  a v a  2 s  . c  o  m*/
 * @param objDto
 * @return
 * @throws Exception
 */
public ArrayList<OrderReportNewDetailCwnDTO> viewOrderReportNew(OrderReportNewDetailCwnDTO objDto)
        throws Exception {

    //   Nagarjuna
    String methodName = "viewOrderReportNew", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end   
    ArrayList<OrderReportNewDetailCwnDTO> objUserList = new ArrayList<OrderReportNewDetailCwnDTO>();
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    OrderReportNewDetailCwnDTO objRDto;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");

    try {

        conn = DbConnection.getReportsConnectionObject();

        proc = conn.prepareCall(sqlOrderReportNew);

        if (objDto.getOrderType() != null && !"".equals(objDto.getOrderType())) {
            proc.setString(1, objDto.getOrderType().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate())) {
            SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr = formatter.parse(objDto.getFromDate());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formatter = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate = formatter.format(date1);
            proc.setString(2, formattedDate);
            //proc.setString(2, objDto.getFromDate().trim());
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) {
            SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr1 = formatter1.parse(objDto.getToDate());
            String formattedDate1 = formatter1.format(dateStr1);
            Date date2 = formatter1.parse(formattedDate1);
            formatter1 = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate1 = formatter1.format(date2);
            proc.setString(3, formattedDate1);
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }

        if (objDto.getVerticalDetails() != null && !"".equals(objDto.getVerticalDetails())) {
            proc.setString(4, objDto.getVerticalDetails().trim());
        } else {
            proc.setNull(4, java.sql.Types.VARCHAR);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(5, pagingSorting.getSortByColumn());// columnName
        proc.setString(6, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(7, pagingSorting.getStartRecordId());// start index
        proc.setInt(8, pagingSorting.getEndRecordId());// end index
        proc.setInt(9, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index
        if (objDto.getOsp() != null && !"".equals(objDto.getOsp())) {
            proc.setString(10, objDto.getOsp().trim());
        } else {
            proc.setNull(10, java.sql.Types.VARCHAR);
        }
        rs = proc.executeQuery();
        int countFlag = 0;
        while (rs.next() != false) {
            countFlag++;

            objDto = new OrderReportNewDetailCwnDTO();
            objDto.setPartyName(rs.getString("PARTYNAME"));
            objDto.setOrderNo(rs.getString("ORDERNO"));
            objDto.setCopcApproveDate(rs.getString("COPC_APPROVAL_DATE"));
            if (rs.getString("COPC_APPROVAL_DATE") != null && !"".equals(rs.getString("COPC_APPROVAL_DATE"))) {
                objDto.setCopcApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVAL_DATE").getTime())))
                                .toUpperCase());
            }
            objDto.setLogicalCircuitId(rs.getString("LOGICALCKTID"));
            objDto.setServiceId(rs.getInt("SERVICENO"));
            objDto.setQuoteNo(rs.getString("QUOTENO"));
            objDto.setProductName(rs.getString("PRODUCTNAME"));
            objDto.setSubProductName(rs.getString("SUBPRODUCTNAME"));
            if (rs.getString("FROM_SITE") != null && !"".equals(rs.getString("FROM_SITE"))
                    && rs.getString("PRIMARYLOCATIONTYPE") != null) {
                if (Integer.parseInt(rs.getString("PRIMARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("FROM_SITE").split("~~");
                    objDto.setPrimarylocation(ss[0] + " " + ss[1] + " " + ss[4] + " " + ss[5] + " " + ss[6]
                            + " " + ss[7] + " " + ss[8] + " " + ss[9] + " " + ss[10] + " " + ss[2]);
                } else {
                    String ss[] = rs.getString("FROM_SITE").split("~~");
                    objDto.setPrimarylocation(ss[0] + " " + ss[1] + " " + ss[5] + " " + ss[3]);
                }

                //objDto.setPrimarylocation(rs.getString("FROM_SITE"));
            } else {
                //String ss[] =("A ~~B ~~C ~~D ~~E ~~F ~~G ~~H ~~I").split("~~");
                //objDto.setPrimarylocation(ss[0]+" "+ss[1]+" "+ss[4]+" "+ss[5]+" "+ss[6]+" "+ss[7]+" "+ss[8]+" "+ss[9]+" "+ss[10]+" "+ss[2]);
                objDto.setPrimarylocation("");
            }
            if (rs.getString("TO_SITE") != null && !"".equals(rs.getString("TO_SITE"))
                    && rs.getString("SECONDARYLOCATIONTYPE") != null) {
                if (Integer.parseInt(rs.getString("SECONDARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("TO_SITE").split("~~");
                    objDto.setSeclocation(ss[0] + " " + ss[1] + " " + ss[4] + " " + ss[5] + " " + ss[6] + " "
                            + ss[7] + " " + ss[8] + " " + ss[9] + " " + ss[10] + " " + ss[2]);
                } else {
                    String ss[] = rs.getString("TO_SITE").split("~~");
                    objDto.setSeclocation(ss[0] + " " + ss[1] + " " + ss[5] + " " + ss[3]);
                }
                //objDto.setSeclocation(rs.getString("TO_SITE"));
            } else {
                objDto.setSeclocation("");
            }
            //objDto.setPrimarylocation(rs.getString("FROM_SITE"));
            //objDto.setSeclocation(rs.getString("TO_SITE"));
            objDto.setOrdersubtype(rs.getString("ORDERSUBTYPE"));
            objDto.setChargeAmount(rs.getDouble("CHARGEAMOUNT"));
            objDto.setPrjmngname(rs.getString("PMNAME"));
            objDto.setPrjmgremail(rs.getString("PMEMAIL"));
            objDto.setActmngname(rs.getString("ACTMNAME"));
            objDto.setZoneName(rs.getString("ZONENNAME"));
            objDto.setRegionName(rs.getString("REGIONNAME"));
            objDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objDto.setAct_category(rs.getString("ACCOUNTCATEGORY_DETAILS"));
            objDto.setCustPoDate(rs.getString("CUSTPODATE"));
            if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE"))) {

                objDto.setCustPoDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("CUSTPODATE").getTime())))
                                .toUpperCase());

            }
            objDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objDto.setOrderDate(rs.getString("ORDERDATE"));
            if (rs.getString("ORDERDATE") != null && !"".equals(rs.getString("ORDERDATE"))) {

                objDto.setOrderDate((utility.showDate_Report(new Date(rs.getTimestamp("ORDERDATE").getTime())))
                        .toUpperCase());

            }
            objDto.setAmApproveDate(rs.getString("AM_APPROVAL_DATE"));
            if (rs.getString("AM_APPROVAL_DATE") != null && !"".equals(rs.getString("AM_APPROVAL_DATE"))) {
                objDto.setAmApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("AM_APPROVAL_DATE").getTime())))
                                .toUpperCase());
            }

            objDto.setPmApproveDate(rs.getString("PM_APPROVAL_DATE"));
            if (rs.getString("PM_APPROVAL_DATE") != null && !"".equals(rs.getString("PM_APPROVAL_DATE"))) {
                objDto.setPmApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("PM_APPROVAL_DATE").getTime())))
                                .toUpperCase());
            }
            objDto.setNio_approve_date(rs.getString("NIO_APPROVAL_DATE"));
            if (rs.getString("NIO_APPROVAL_DATE") != null && !"".equals(rs.getString("NIO_APPROVAL_DATE"))) {
                objDto.setNio_approve_date(
                        (utility.showDate_Report(new Date(rs.getTimestamp("NIO_APPROVAL_DATE").getTime())))
                                .toUpperCase());
            }
            objDto.setDemo_infrastartdate(rs.getString("DEMP_INFRA_START_DATE"));
            objDto.setDemo_infra_enddate(rs.getString("DEMO_INFRA_ENDDATE"));
            objDto.setRfs_date(rs.getString("RFS_DATE"));
            if (rs.getString("RFS_DATE") != null && !"".equals(rs.getString("RFS_DATE"))) {

                objDto.setRfs_date((utility.showDate_Report(new Date(rs.getTimestamp("RFS_DATE").getTime())))
                        .toUpperCase());

            }
            objDto.setOrdercategory(rs.getString("ORDERCATEGORY"));
            objDto.setOrderStatus(rs.getString("STATUS"));
            objDto.setLine_desc(rs.getString("LINE_ITEM_DESC"));
            objDto.setLinename(rs.getString("LINENAME"));
            objDto.setSub_linename(rs.getString("ORDER_SUBLINENAME"));
            objDto.setChargeName(rs.getString("CHARGE_NAME"));
            objDto.setChargeinfoID(rs.getString("CHARGEINFOID"));
            objDto.setServiceProductID(rs.getInt("LINENO"));
            objDto.setServiceName(rs.getString("SERVICENAME"));
            objDto.setAccountID(rs.getInt("ACCOUNTID"));
            objDto.setLicCompanyName(rs.getString("LCOMPANYNAME"));
            objDto.setEntity(rs.getString("COMPANYNAME"));
            objDto.setFrequencyName(rs.getString("PAYMENTTERM"));
            objDto.setChargeTypeName(rs.getString("CYCLICNONCYCLIC"));
            objDto.setServiceType(rs.getString("SERVICETYPE"));
            objDto.setUom(rs.getString("UOM"));
            objDto.setBandwaidth(rs.getString("BANDWIDTH"));
            objDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            objDto.setBilling_uom(rs.getString("BILLING_BANDWIDTH_UOM"));
            objDto.setDistance(rs.getString("DISTANCE"));
            if (rs.getString("FROM_CITY") != null && !"".equals(rs.getString("FROM_CITY"))
                    && rs.getString("PRIMARYLOCATIONTYPE") != null) {
                if (Integer.parseInt(rs.getString("PRIMARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("FROM_CITY").split("~~");
                    objDto.setFrom_city(ss[8]);
                } else {
                    objDto.setFrom_city(" ");
                }
                //objDto.setFrom_city(rs.getString("FROM_CITY"));
            } else {
                objDto.setFrom_city("");
            }
            if (rs.getString("TO_CITY") != null && !"".equals(rs.getString("TO_CITY"))
                    && rs.getString("SECONDARYLOCATIONTYPE") != null) {
                if (Integer.parseInt(rs.getString("SECONDARYLOCATIONTYPE")) == 1) {
                    String ss[] = rs.getString("TO_CITY").split("~~");
                    objDto.setTo_city(ss[8]);
                } else {
                    objDto.setTo_city(" ");
                }
                //objDto.setTo_city(rs.getString("TO_CITY"));
            } else {
                objDto.setTo_city("");
            }
            //objDto.setTo_city("");
            //objDto.setTo_city(rs.getString("TO_CITY"));
            objDto.setOldordertotal(rs.getString("OLD_ORDER_TOTAL"));
            objDto.setOldlineamt(rs.getString("OLD_LINE_AMT"));
            objDto.setOld_contract_period(rs.getString("OLD_CONTRACTPERIOD"));
            objDto.setRatio(rs.getString("RATIO"));
            objDto.setTaxation(rs.getString("TAXATIONVALUE"));
            objDto.setFactory_ckt_id(rs.getString("FACTORY_CKT_ID"));
            objDto.setAccountManager(rs.getString("ACTMEMAIL"));
            objDto.setCurrencyCode(rs.getString("CURNAME"));
            objDto.setOrderTotal(rs.getDouble("ORDERTOTAL"));
            objDto.setPoAmount(rs.getString("POAMOUNT"));
            objDto.setBisource(rs.getString("BISOURCE"));
            objDto.setOrderType(rs.getString("ORDERTYPE"));
            objDto.setDispatchAddress1(rs.getString("DISPATCHADDRESS"));
            objDto.setParent_name(rs.getString("PARENTNAME"));
            objDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objDto.setOsp(rs.getString("OSP"));
            //            [404040] Start 
            objDto.setOpportunityId((rs.getString("OPPORTUNITYID")));
            //[404040] End 
            objDto.setChargeRemarks(rs.getString("REMARKS"));

            //shourya start
            objDto.setRE_LOGGED_LSI_NO(rs.getString("RE_LOGGED_LSI_NO"));
            //[003] start
            /*objDto.setPARALLEL_UPGRADE_LSI_NO(rs.getString("PARALLEL_UPGRADE_LSI_NO"));*/
            objDto.setParallellUpgradeLSINo1(rs.getString("PARALLELUPGRADELSINO1"));
            objDto.setParallellUpgradeLSINo2(rs.getString("PARALLELUPGRADELSINO2"));
            objDto.setParallellUpgradeLSINo3(rs.getString("PARALLELUPGRADELSINO3"));
            //[003] end
            objDto.setCHARGEDISCONNECTIONSTATUS(rs.getString("CHARGEDISCONNECTIONSTATUS"));
            objDto.setSubchange_type(rs.getString("NAME_SUBTYPE"));
            objDto.setFxAccountExternalId(rs.getString("FX_ACCOUNT_EXTERNAL_ID"));
            objDto.setOldLsi(rs.getString("OLD_LSI_CRM"));
            //lawkush Start

            objDto.setPartyNo(rs.getInt("PARTY_NO"));
            objDto.setObValue(BigDecimal.valueOf((rs.getDouble("OB_VALUE"))).toPlainString());
            //lawkush End         
            objDto.setCustSeg_Description(rs.getString("DESCRIPTION"));
            objDto.setObValueLastUpdateDate(rs.getString("OB_VALUE_LAST_UPDATE_DATE"));
            //[130] start
            objDto.setSalesForceOpportunityNumber(rs.getString("SF_OPP_ID"));
            objDto.setChannelPartner(rs.getString("PARTNER_NAME"));
            objDto.setNetworkType(rs.getString("NETWORK_SERVICE_TYPE"));
            objDto.setPartnerId(rs.getString("PARTNER_ID"));
            //[130] End
            //[131] start
            objDto.setPartnerCode(rs.getString("PARTNER_CODE"));
            objDto.setFieldEngineer(rs.getString("FIELD_ENGINEER"));
            //[131] end
            //nancy start
            objDto.setePCNNo(rs.getString("EPCN_NO"));
            //nancy end
            objDto.setBillingTriggerCreateDate(rs.getString("BILLING_TRIGGER_CREATEDATE"));
            if (rs.getString("BILLING_TRIGGER_CREATEDATE") != null
                    && !"".equals(rs.getString("BILLING_TRIGGER_CREATEDATE"))) {
                objDto.setBillingTriggerCreateDate((utility
                        .showDate_Report(new Date(rs.getTimestamp("BILLING_TRIGGER_CREATEDATE").getTime())))
                                .toUpperCase());
            }
            //RAHEEM start
            objDto.setIsDifferential(rs.getString("Is_Differential"));
            objDto.setLinkedOldCharge(rs.getLong("OLD_PK_CHARGEID"));
            //RAHEEM END
            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
                //recordCount = countFlag;
            }
            objUserList.add(objDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }

    return objUserList;
}

From source file:com.ibm.ioes.dao.ReportsDao.java

public ArrayList<AdvancePaymentReportDTO> viewAdvancePaymentReport(AdvancePaymentReportDTO objDto)
        throws Exception {
    String methodName = "viewAdvancePaymentReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;

    ArrayList<AdvancePaymentReportDTO> objUserList = new ArrayList<AdvancePaymentReportDTO>();
    AdvancePaymentReportDTO objReportsDto = null;
    Connection conn = null;/*from w  w  w . j av a  2s  .  com*/
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    try {
        conn = DbConnection.getReportsConnectionObject();
        proc = conn.prepareCall(sqlAdvancePayementReport);
        if (objDto.getCrmAccountNo() != null && !"".equals(objDto.getCrmAccountNo())) {
            proc.setString(1, objDto.getCrmAccountNo().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }

        if (objDto.getArcChqNo() != null && !"".equals(objDto.getArcChqNo())) {
            proc.setString(2, objDto.getArcChqNo().trim());
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getOtcChqNo() != null && !"".equals(objDto.getOtcChqNo())) {
            proc.setString(3, objDto.getOtcChqNo().trim());
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromorderCreationDate() != null && !"".equals(objDto.getFromorderCreationDate())) {
            SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy");
            proc.setString(4, objDto.getFromorderCreationDate().trim());
        } else {
            proc.setNull(4, java.sql.Types.VARCHAR);
        }
        if (objDto.getToorderCreationDate() != null && !"".equals(objDto.getToorderCreationDate())) {
            proc.setString(5, objDto.getToorderCreationDate().trim());
        } else {
            proc.setNull(5, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromChqDate() != null && !"".equals(objDto.getFromChqDate())) {
            proc.setString(6, objDto.getFromChqDate().trim());
        } else {
            proc.setNull(6, java.sql.Types.VARCHAR);
        }
        if (objDto.getToChqDate() != null && !"".equals(objDto.getToChqDate())) {
            proc.setString(7, objDto.getToChqDate().trim());
        } else {
            proc.setNull(7, java.sql.Types.VARCHAR);
        }
        if (objDto.getDatetype() != null && !"".equals(objDto.getDatetype())) {
            proc.setString(8, objDto.getDatetype().trim());
        } else {
            proc.setNull(8, java.sql.Types.VARCHAR);
        }

        SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(9, pagingSorting.getSortByColumn());// columnName
        proc.setString(10, PagingSorting.DB_Asc_Desc1(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(11, pagingSorting.getStartRecordId());// start index
        proc.setInt(12, pagingSorting.getEndRecordId());// end index
        proc.setInt(13, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end

        rs = proc.executeQuery();
        int countFlag = 0;
        while (rs.next() != false) {
            countFlag++;
            objReportsDto = new AdvancePaymentReportDTO();
            objReportsDto.setOrderNo(rs.getInt("ORDERNO"));
            objReportsDto.setOrderStatus(rs.getString("ORDER_STATUS"));
            objReportsDto.setOrderCreationDate(rs.getString("ORDER_CREATION_DATE"));
            if (rs.getString("ORDER_CREATION_DATE") != null
                    && !"".equals(rs.getString("ORDER_CREATION_DATE"))) {
                objReportsDto.setOrderCreationDate(
                        (utility.showDate_Report(objReportsDto.getOrderCreationDate())).toUpperCase());
            }

            objReportsDto.setCrmAccountNo(rs.getString("CRMACCOUNTNO"));
            objReportsDto.setCustomerSegment(rs.getString("CUSTOMERSEGMENT"));
            //objReportsDto.setCircle(rs.getString("CIRCLE"));
            objReportsDto.setLicenseCompany(rs.getString("LICENCE_COMPANY"));
            objReportsDto.setCurrencyofOrder(rs.getString("CURRENCY_ORDER"));
            objReportsDto.setAmApprovalDate(rs.getString("AM_APPROVALS"));
            if (rs.getString("AM_APPROVALS") != null && !"".equals(rs.getString("AM_APPROVALS"))) {
                //Date date=df.parse(objReportsDto.getCustPoDate());
                objReportsDto.setAmApprovalDate(
                        utility.showDate_Report(objReportsDto.getAmApprovalDate()).toUpperCase());
            }

            objReportsDto.setPmApprovalDate(rs.getString("PM_APPROVALS"));
            if (rs.getString("PM_APPROVALS") != null && !"".equals(rs.getString("PM_APPROVALS"))) {
                objReportsDto.setPmApprovalDate((utility.showDate_Report(objReportsDto.getPmApprovalDate())));
            }

            objReportsDto.setOrderApprovalDate(rs.getString("COPC_APPROVALS"));
            if (rs.getString("COPC_APPROVALS") != null && !"".equals(rs.getString("COPC_APPROVALS"))) {
                objReportsDto
                        .setOrderApprovalDate((utility.showDate_Report(objReportsDto.getOrderApprovalDate())));
            }
            objReportsDto.setServiceNo(rs.getInt("SERVICE_NO"));
            objReportsDto.setProduct(rs.getString("PRODUCT"));
            objReportsDto.setLsi(rs.getInt("LSI"));
            objReportsDto.setFxChildAccount(rs.getString("FX_CHILD_ACCOUNT"));
            if (rs.getString("LOC_DATE") != null && !"".equals(rs.getString("LOC_DATE"))) {
                Date date = df.parse(rs.getString("LOC_DATE"));
                objReportsDto.setLocDate((utility.showDate_Report(date)).toUpperCase());
            }
            if (rs.getString("BILLINGTRIGGERDATE") != null && !"".equals(rs.getString("BILLINGTRIGGERDATE"))) {
                Date date = df.parse(rs.getString("BILLINGTRIGGERDATE"));
                objReportsDto.setBillingTriggerDate((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setArcChqNo(rs.getString("ARCCHQNO"));
            objReportsDto.setArcChqDate(rs.getString("ARCCHQDATE"));

            if (rs.getString("ARCCHQDATE") != null && !"".equals(rs.getString("ARCCHQDATE"))) {
                Date date = df.parse(objReportsDto.getArcChqDate());
                objReportsDto.setArcChqDate((utility.showDate_Report(date)).toUpperCase());
            }

            objReportsDto.setArcChqAmt(rs.getDouble("ARCCHQAMT"));
            objReportsDto.setArcBankName(rs.getString("ARCBANKNAME"));
            objReportsDto.setArcAmtAjd(rs.getDouble("ARCAMTAJD"));
            //objReportsDto.setArcAmtAjd(rs.getString("ARCAMTAJD"));
            objReportsDto.setOtcChqNo(rs.getString("OTCCHQNO"));
            objReportsDto.setArcExempted(rs.getString("ARCEXEMPTED"));
            objReportsDto.setArcExpreason(rs.getString("ARCEXPREASON"));
            objReportsDto.setOtcExempted(rs.getString("OTCEXEMPTED"));
            objReportsDto.setOtcExpreason(rs.getString("OTCEXPREASON"));
            objReportsDto.setOtcChqDate(rs.getString("OTCCHQDATE"));

            //Start [128]
            objReportsDto.setArcReEnterCheckamount(rs.getDouble("ARCRECHQAMT"));
            objReportsDto.setArcReEnterCheckNumber(rs.getString("ARCRECHQNO"));
            objReportsDto.setArcBankAccountNumber(rs.getString("ARCBANKACNO"));
            objReportsDto.setArcReEnterBankAccountNumber(rs.getString("ARCREBANKACNO"));
            objReportsDto.setArcIfscCode(rs.getString("ARCIFSCCODE"));
            objReportsDto.setArcReEnterIfscCode(rs.getString("ARCREIFSCCODE"));

            objReportsDto.setOtcReEnterCheckamount(rs.getDouble("OTCRECHQAMT"));
            objReportsDto.setOtcReEnterCheckNumber(rs.getString("OTCRECHQNO"));
            objReportsDto.setOtcBankAccountNumber(rs.getString("OTCBANKACNO"));
            objReportsDto.setOtcReEnterBankAccountNumber(rs.getString("OTCREBANKACNO"));
            objReportsDto.setOtcIfscCode(rs.getString("OTCIFSCCODE"));
            objReportsDto.setOtcReEnterIfscCode(rs.getString("OTCREIFSCCODE"));
            //End [128]

            objReportsDto.setLineNo(rs.getString("SPID"));
            objReportsDto.setLineName(rs.getString("LineName"));
            if (rs.getString("OTCCHQDATE") != null && !"".equals(rs.getString("OTCCHQDATE"))) {
                Date date = df.parse(objReportsDto.getOtcChqDate());
                objReportsDto.setOtcChqDate((utility.showDate_Report(date)).toUpperCase());
            }
            objReportsDto.setOtcChqAmt(rs.getDouble("OTCCHQAMT"));
            objReportsDto.setOtcBankName(rs.getString("OTCBANKNAME"));
            objReportsDto.setOtcAmtAjd(rs.getDouble("OTCAMTAJD"));
            objReportsDto.setPartyNo(rs.getString("PARTY_NO"));
            objReportsDto.setAccountName(rs.getString("ACCOUNTNAME"));
            objReportsDto.setBillingTriggerActionDate(rs.getTimestamp("BILLINGTRIGGERDATEACTION"));
            String BillActionDate_String = utility.showDate_Report(objReportsDto.getBillingTriggerActionDate());
            objReportsDto.setBillingTriggerActionDate_string(BillActionDate_String);
            objReportsDto.setProductName(rs.getString("PRODUCTNAME"));
            objReportsDto.setSubproductName(rs.getString("SERVICESUBTYPENAME"));
            objReportsDto.setParty_id(rs.getString("PARTY_ID"));
            objReportsDto.setPodate(rs.getDate("PODATE"));
            String poDate_String = utility.showDate_Report(objReportsDto.getPodate());
            objReportsDto.setPodate_String(poDate_String);
            objReportsDto.setPoRecieveDate(rs.getDate("PORECEIVEDATE"));
            String poRDate_String = utility.showDate_Report(objReportsDto.getPoRecieveDate());
            objReportsDto.setPoRecieveDate_String(poRDate_String);
            objReportsDto.setZoneName(rs.getString("ZONENNAME"));
            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }

            objUserList.add(objReportsDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }

    return objUserList;
}

From source file:com.ibm.ioes.dao.ReportsDao.java

public ArrayList<PerformanceDetailReportDTO> viewPerformanceDetailList(PerformanceDetailReportDTO objDto) {
    //   Nagarjuna
    String methodName = "viewPerformanceDetailList", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end   /*  w ww.  j  a v  a  2  s . co  m*/
    Connection connection = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    ArrayList<PerformanceDetailReportDTO> listSearchDetails = new ArrayList<PerformanceDetailReportDTO>();
    PerformanceDetailReportDTO objReportsDto = null;
    int recordCount = 0;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    try {
        connection = DbConnection.getReportsConnectionObject();
        proc = connection.prepareCall(sqlGetPerformanceDetailReport);

        if (objDto.getOrderType() != null && !"".equals(objDto.getOrderType())) {
            proc.setString(1, objDto.getOrderType().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate())) {
            SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr = formatter.parse(objDto.getFromDate());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formatter = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate = formatter.format(date1);
            proc.setString(2, formattedDate);
            //proc.setString(2, objDto.getFromDate().trim());
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) {
            SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr1 = formatter1.parse(objDto.getToDate());
            String formattedDate1 = formatter1.format(dateStr1);
            Date date2 = formatter1.parse(formattedDate1);
            formatter1 = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate1 = formatter1.format(date2);
            proc.setString(3, formattedDate1);
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }
        /*if (objDto.getFromDate() != null
              && !"".equals(objDto.getFromDate())) {
           proc.setString(2, objDto.getFromDate().trim());
        } else {
           proc.setNull(2, java.sql.Types.VARCHAR);
        }
                
        if (objDto.getToDate() != null 
              && !"".equals(objDto.getToDate())) {
           proc.setString(3, objDto.getToDate().trim());
        } else {
           proc.setNull(3, java.sql.Types.VARCHAR);
        }*/

        if (objDto.getFromOrderNo() != 0 && !"".equals(objDto.getFromOrderNo())) {
            proc.setInt(4, objDto.getFromOrderNo());
        } else {
            proc.setNull(4, java.sql.Types.BIGINT);
        }

        if (objDto.getToOrderNo() != 0 && !"".equals(objDto.getToOrderNo())) {
            proc.setInt(5, objDto.getToOrderNo());
        } else {
            proc.setNull(5, java.sql.Types.BIGINT);
        }

        if (objDto.getFromAccountNo() != 0 && !"".equals(objDto.getFromAccountNo())) {
            proc.setInt(6, objDto.getFromAccountNo());
        } else {
            proc.setNull(6, java.sql.Types.BIGINT);
        }

        if (objDto.getToAccountNo() != 0 && !"".equals(objDto.getToAccountNo())) {
            proc.setInt(7, objDto.getToAccountNo());
        } else {
            proc.setNull(7, java.sql.Types.BIGINT);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(8, pagingSorting.getSortByColumn());// columnName
        proc.setString(9, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(10, pagingSorting.getStartRecordId());// start index
        proc.setInt(11, pagingSorting.getEndRecordId());// end index
        proc.setInt(12, (pagingSorting.isPagingToBeDone() ? 1 : 0));
        if (objDto.getOsp() != null && !"".equals(objDto.getOsp())) {
            proc.setString(13, objDto.getOsp().trim());
        } else {
            proc.setNull(13, java.sql.Types.VARCHAR);
        }
        // index
        rs = proc.executeQuery();
        while (rs.next()) {
            objReportsDto = new PerformanceDetailReportDTO();
            objReportsDto.setPartyNo(rs.getInt("PARTY_NO"));
            objReportsDto.setPartyName(rs.getString("PARTYNAME"));
            objReportsDto.setOrderNumber(rs.getInt("ORDERNO"));
            objReportsDto.setRegionName(rs.getString("REGION"));
            objReportsDto.setZoneName(rs.getString("ZONE"));
            objReportsDto.setCrmACcountNO(rs.getString("CRMACCOUNTNO"));
            objReportsDto.setCus_segment(rs.getString("CUST_SEGMENT_CODE"));
            objReportsDto.setIndustrySegment(rs.getString("INDUSTRYSEGMENT"));
            objReportsDto.setOrder_type(rs.getString("DEMO_TYPE"));
            objReportsDto.setOrderType(rs.getString("ORDERTYPE"));
            objReportsDto.setOrdersubtype(rs.getString("ORDER_SUBTYPE"));
            objReportsDto.setOrderStatus(rs.getString("STAGE"));
            objReportsDto.setOrderDate(rs.getString("ORDERDATE"));

            if (rs.getString("ORDERDATE") != null && !"".equals(rs.getString("ORDERDATE"))) {
                objReportsDto.setOrderDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("ORDERDATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setOrderApproveDate(rs.getString("ORDER_APPROVED_DATE"));

            if (rs.getString("ORDER_APPROVED_DATE") != null
                    && !"".equals(rs.getString("ORDER_APPROVED_DATE"))) {
                objReportsDto.setOrderApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("ORDER_APPROVED_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setPublishedDate(rs.getString("PUBLISHED_DATE"));

            if (rs.getString("PUBLISHED_DATE") != null && !"".equals(rs.getString("PUBLISHED_DATE"))) {
                objReportsDto.setPublishedDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("PUBLISHED_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setAccountManager(rs.getString("ACCOUNTMANAGER"));
            objReportsDto.setProjectManager(rs.getString("PROJECTMANAGER"));
            objReportsDto.setVertical(rs.getString("VERTICAL_DETAILS"));
            objReportsDto.setOrderTotal(rs.getDouble("ORDER_TOTAL"));
            objReportsDto.setTaskName(rs.getString("TASK_NAME"));
            objReportsDto.setActualStartDate(rs.getString("TASKSTARTDATE"));

            if (rs.getString("TASKSTARTDATE") != null && !"".equals(rs.getString("TASKSTARTDATE"))) {
                objReportsDto.setActualStartDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("TASKSTARTDATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setActualEndDate(rs.getString("TASKENDDATE"));

            if (rs.getString("TASKENDDATE") != null && !"".equals(rs.getString("TASKENDDATE"))) {
                objReportsDto.setActualEndDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("TASKENDDATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setTaskNumber(rs.getInt("TASKID"));
            objReportsDto.setOwner(rs.getString("OWNER_NAME"));
            objReportsDto.setAccountMgrPhoneNo(rs.getString("PHONENO"));//changed by kalpana from long to string for bug id HYPR11042013001
            objReportsDto.setEmailId(rs.getString("EMAILID"));
            objReportsDto.setUserName(rs.getString("USER_NAME"));
            objReportsDto.setTotalDays(rs.getString("TASK_DAYS"));
            objReportsDto.setRemarks(rs.getString("ACTION_REMARKS"));
            objReportsDto.setOutCome(rs.getString("OUTCOME"));
            objReportsDto.setOsp(rs.getString("OSP"));
            objReportsDto.setPoNumber(rs.getInt("PODETAILNUMBER"));
            //         [404040] Start 
            objReportsDto.setOpportunityId((rs.getString("OPPORTUNITYID")));
            //[404040] End 
            objReportsDto.setOldLsi(rs.getString("OLD_LSI_CRM"));
            objReportsDto.setGroupName((rs.getString("GROUPNAME")));
            //lawkush start
            objReportsDto.setCopcStartDate(rs.getString("COPC_START_DATE"));
            if (rs.getString("COPC_START_DATE") != null && !"".equals(rs.getString("COPC_START_DATE"))) {
                objReportsDto.setCopcStartDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("COPC_START_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setCopcEndDate(rs.getString("COPC_END_DATE"));
            if (rs.getString("COPC_END_DATE") != null && !"".equals(rs.getString("COPC_END_DATE"))) {
                objReportsDto.setCopcEndDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("COPC_END_DATE").getTime())))
                                .toUpperCase());
            }
            //lawkush End
            //[130] start
            objReportsDto.setSalesForceOpportunityNumber(rs.getString("SF_OPP_ID"));
            objReportsDto.setChannelPartner(rs.getString("PARTNER_NAME"));
            objReportsDto.setPartnerId(rs.getString("PARTNER_ID"));
            //[130] End
            //[131] start
            objReportsDto.setPartnerCode(rs.getString("PARTNER_CODE"));
            objReportsDto.setFieldEngineer(rs.getString("FIELD_ENGINEER"));
            //[131] end
            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            listSearchDetails.add(objReportsDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        //ex.printStackTrace();
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(connection);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            //e.printStackTrace();
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        }
    }
    return listSearchDetails;
}

From source file:com.ibm.ioes.dao.ReportsDao.java

/**
 * /*from  w  w w . j a v a 2s .c om*/
 * @param objDto
 * @return
 * @throws Exception
 */
public ArrayList<OrderDetailChangeReportDTO> viewOrderReportChange(OrderDetailChangeReportDTO objDto)
        throws Exception {
    //   Nagarjuna
    String methodName = "viewOrderReportChange", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end   
    ArrayList<OrderDetailChangeReportDTO> objUserList = new ArrayList<OrderDetailChangeReportDTO>();
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    try {

        conn = DbConnection.getReportsConnectionObject();

        proc = conn.prepareCall(sqlOrderReportChange);

        if (objDto.getOrderType() != null && !"".equals(objDto.getOrderType())) {
            proc.setString(1, objDto.getOrderType().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }

        if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate())) {
            SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr = formatter.parse(objDto.getFromDate());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formatter = new SimpleDateFormat("yyyy-MM-dd");
            formattedDate = formatter.format(date1);
            proc.setString(2, formattedDate);
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) {
            SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr1 = formatter1.parse(objDto.getToDate());
            String formattedDate1 = formatter1.format(dateStr1);
            Date date2 = formatter1.parse(formattedDate1);
            formatter1 = new SimpleDateFormat("yyyy-MM-dd");
            formattedDate1 = formatter1.format(date2);
            proc.setString(3, formattedDate1);
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }

        /*if (objDto.getFromDate() != null
              && !"".equals(objDto.getFromDate())) {
           proc.setString(2, objDto.getFromDate().trim());
        } else {
           proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) {
           proc.setString(3, objDto.getToDate().trim());
        } else {
           proc.setNull(3, java.sql.Types.VARCHAR);
        }*/
        //Company Name
        proc.setNull(4, java.sql.Types.VARCHAR);
        // Logical Si no
        if (objDto.getLogicalSINo() != null && !"".equals(objDto.getLogicalSINo())) {
            proc.setLong(5, new Long(objDto.getLogicalSINo().trim()));
        } else {
            proc.setNull(5, java.sql.Types.BIGINT);
        }

        if (objDto.getFromAccountNo() != 0 && objDto.getToAccountNo() != 0) {
            proc.setLong(6, objDto.getFromAccountNo());
            proc.setLong(7, objDto.getToAccountNo());
        } else {
            proc.setNull(6, java.sql.Types.BIGINT);
            proc.setNull(7, java.sql.Types.BIGINT);
        }

        if (objDto.getFromOrderNo() != 0 && objDto.getToOrderNo() != 0) {
            proc.setLong(8, objDto.getFromOrderNo());
            proc.setLong(9, objDto.getToOrderNo());
        } else {
            proc.setNull(8, java.sql.Types.BIGINT);
            proc.setNull(9, java.sql.Types.BIGINT);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(10, pagingSorting.getSortByColumn());// columnName
        proc.setString(11, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(12, pagingSorting.getStartRecordId());// start index
        proc.setInt(13, pagingSorting.getEndRecordId());// end index
        proc.setInt(14, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index
        if (objDto.getOsp() != null && !"".equals(objDto.getOsp())) {
            proc.setString(15, objDto.getOsp().trim());
        } else {
            proc.setNull(15, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromOrderDate() != null && !"".equals(objDto.getFromOrderDate())
                && objDto.getToOrderDate() != null && !"".equals(objDto.getToOrderDate())) {
            proc.setString(16, objDto.getFromOrderDate());
            proc.setString(17, objDto.getToOrderDate());
        } else {
            proc.setNull(16, java.sql.Types.VARCHAR);
            proc.setNull(17, java.sql.Types.VARCHAR);
        }

        rs = proc.executeQuery();
        int countFlag = 0;
        while (rs.next() != false) {
            countFlag++;

            objDto = new OrderDetailChangeReportDTO();
            objDto.setAccountID(rs.getInt("ACCOUNTID"));
            objDto.setAccountManager(rs.getString("ACCT_MGR_NAME"));
            objDto.setAccountno(rs.getString("CRMACCOUNTNO"));
            objDto.setCustSegmentCode(rs.getString("CUST_SEGMENT_CODE"));
            objDto.setAccountCategory(rs.getString("ACCOUNTCATEGORY_DETAILS"));
            objDto.setServiceSubTypeName(rs.getString("SERVICESTAGE"));
            objDto.setServiceDetDescription(rs.getString("SERVICEDETDESCRIPTION"));
            objDto.setChargeStartDate(rs.getString("START_DATE"));
            if (rs.getString("START_DATE") != null && !"".equals(rs.getString("START_DATE"))) {
                Date date = df.parse(objDto.getChargeStartDate());
                objDto.setChargeStartDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setCancelFlag(rs.getString("CANCELFLAG"));
            objDto.setEntity(rs.getString("ENTITYNAME"));
            objDto.setServiceproductid(rs.getInt("SERVICEPRODUCTID"));
            objDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objDto.setOrderDate(rs.getString("ORDERDATE"));
            if (rs.getDate("ORDERDATE") != null && !"".equals(rs.getDate("ORDERDATE"))) {
                Date date = rs.getDate("ORDERDATE");
                objDto.setOrderDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setOrderNumber(rs.getInt("ORDERNO"));
            objDto.setCurrencyCode(rs.getString("CURNAME"));
            objDto.setCustPoDate(rs.getString("CUSTPODATE"));
            if (rs.getString("CUSTPODATE") != null && !"".equals(rs.getString("CUSTPODATE"))) {
                Date date = df.parse(objDto.getCustPoDate());
                objDto.setCustPoDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setLineItemQuantity(rs.getString("ITEM_QUANTITY"));
            objDto.setBillingBandwidth(rs.getString("BILLING_BANDWIDTH"));
            objDto.setBillingBandwidthUOM(rs.getString("BILLING_BANDWIDTH_UOM"));
            objDto.setDistance(rs.getString("DISTANCE"));
            objDto.setLineItemAmount(BigDecimal.valueOf((rs.getDouble("CHARGEAMOUNT"))).toPlainString());
            objDto.setChargeAnnotation(rs.getString("ANNOTATION"));
            objDto.setLOC_Date(rs.getString("LOCDATE"));
            if (rs.getString("LOCDATE") != null && !"".equals(rs.getString("LOCDATE"))) {
                Date date = df.parse(objDto.getLOC_Date());
                objDto.setLOC_Date((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setCopcApproveDate(rs.getString("COPC_APPROVAL_DATE"));
            if (rs.getString("COPC_APPROVAL_DATE") != null && !"".equals(rs.getString("COPC_APPROVAL_DATE"))) {
                objDto.setCopcApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVAL_DATE").getTime())))
                                .toUpperCase());
            }
            objDto.setRfsDate(rs.getString("RFS_DATE"));
            if (rs.getString("RFS_DATE") != null && !"".equals(rs.getString("RFS_DATE"))) {
                Date date = df.parse(objDto.getRfsDate());
                objDto.setRfsDate((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setRfs_date(rs.getString("CUST_RFS_DATE"));
            if (rs.getString("CUST_RFS_DATE") != null && !"".equals(rs.getString("CUST_RFS_DATE"))) {
                Date date = df.parse(objDto.getRfs_date());
                objDto.setRfs_date((utility.showDate_Report(date)).toUpperCase());
            }
            objDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            objDto.setPoAmount(BigDecimal.valueOf((rs.getDouble("POAMOUNT"))).toPlainString());
            objDto.setOrderTotalAmount(BigDecimal.valueOf((rs.getDouble("TOT_AMOUNT"))).toPlainString());
            objDto.setAmApproveDate(rs.getString("AM_RECEIVE_DATE"));
            if (rs.getString("AM_RECEIVE_DATE") != null && !"".equals(rs.getString("AM_RECEIVE_DATE"))) {
                objDto.setAmApproveDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("AM_RECEIVE_DATE").getTime())))
                                .toUpperCase());
            }
            objDto.setLogicalSINo(rs.getString("LOGICAL_SI_NO"));
            objDto.setStartDate(rs.getString("CHARGE_CRT_ORDERNO"));
            objDto.setEndDate(rs.getString("END_ORDER_NO"));
            objDto.setOrderType(rs.getString("ORDERTYPE"));
            objDto.setFrequencyName(rs.getString("FREQUENCYNAME"));
            objDto.setProjectManager(rs.getString("PRJ_MGR_NAME"));
            objDto.setRegionName(rs.getString("REGIONNAME"));
            objDto.setRatio(rs.getString("RATIO"));
            objDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objDto.setOsp(rs.getString("OSP"));
            // Anadi's   
            objDto.setCopcEndDate(rs.getString("COPC_END_DATE"));

            if (rs.getString("COPC_END_DATE") != null && !"".equals(rs.getString("COPC_END_DATE"))) {
                objDto.setCopcEndDate(
                        (utility.showDate_Report(new Date(rs.getTimestamp("COPC_END_DATE").getTime())))
                                .toUpperCase());

                //Date date=df.parse(objDto.getCopcEndDate());
                //objDto.setCopcEndDate((utility.showDate_Report(date)).toUpperCase());
            }
            // End : Anadi   
            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            objUserList.add(objDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        //ex.printStackTrace();
        throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
            //e.printStackTrace();
            throw new Exception("Exception : " + e.getMessage(), e);
        }
    }

    return objUserList;
}

From source file:com.ibm.ioes.dao.ReportsDao_Usage.java

/**
 * /* w ww  .  j a v a 2s  .co  m*/
 * @param objDto
 * @return
 * @throws Exception
 */
public ArrayList<OrderReportNewDetailCwnDTO> viewOrderReportNew(OrderReportNewDetailCwnDTO objDto)
        throws Exception {
    //Nagarjuna
    String methodName = "viewOrderReportNew", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    ArrayList<OrderReportNewDetailCwnDTO> objUserList = new ArrayList<OrderReportNewDetailCwnDTO>();
    Connection conn = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    int recordCount = 0;
    OrderReportNewDetailCwnDTO objRDto;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    Date tempDate = null;
    Timestamp ts = null;

    try {

        conn = DbConnection.getReportsConnectionObject();

        proc = conn.prepareCall(sqlOrderReportNewForUsage);

        if (objDto.getOrderType() != null && !"".equals(objDto.getOrderType())) {
            proc.setString(1, objDto.getOrderType().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }
        if (objDto.getFromDate() != null && !"".equals(objDto.getFromDate())) {
            SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr = formatter.parse(objDto.getFromDate());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formatter = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate = formatter.format(date1);
            proc.setString(2, formattedDate);
            //proc.setString(2, objDto.getFromDate().trim());
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }
        if (objDto.getToDate() != null && !"".equals(objDto.getToDate())) {
            SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr1 = formatter1.parse(objDto.getToDate());
            String formattedDate1 = formatter1.format(dateStr1);
            Date date2 = formatter1.parse(formattedDate1);
            formatter1 = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate1 = formatter1.format(date2);
            proc.setString(3, formattedDate1);
        } else {
            proc.setNull(3, java.sql.Types.VARCHAR);
        }

        if (objDto.getVerticalDetails() != null && !"".equals(objDto.getVerticalDetails())) {
            proc.setString(4, objDto.getVerticalDetails().trim());
        } else {
            proc.setNull(4, java.sql.Types.VARCHAR);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index

        proc.setString(5, pagingSorting.getSortByColumn());// columnName
        proc.setString(6, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(7, pagingSorting.getStartRecordId());// start index
        proc.setInt(8, pagingSorting.getEndRecordId());// end index
        proc.setInt(9, (pagingSorting.isPagingToBeDone() ? 1 : 0));// end
        // index
        proc.setInt(10, (objDto.getIsUsage()));// end
        if (objDto.getOsp() != null && !"".equals(objDto.getOsp())) {
            proc.setString(11, objDto.getOsp().trim());
        } else {
            proc.setNull(11, java.sql.Types.VARCHAR);
        }

        if (objDto.getFromCopcApprovedDate() != null && !"".equals(objDto.getFromCopcApprovedDate())) {
            SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr = formatter.parse(objDto.getFromCopcApprovedDate());
            String formattedDate = formatter.format(dateStr);
            Date date1 = formatter.parse(formattedDate);
            formatter = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate = formatter.format(date1);
            proc.setString(12, formattedDate);
            //proc.setString(2, objDto.getFromDate().trim());
        } else {
            proc.setNull(12, java.sql.Types.VARCHAR);
        }
        if (objDto.getToCopcApprovedDate() != null && !"".equals(objDto.getToCopcApprovedDate())) {
            SimpleDateFormat formatter1 = new SimpleDateFormat("dd/MM/yyyy");
            Date dateStr1 = formatter1.parse(objDto.getToCopcApprovedDate());
            String formattedDate1 = formatter1.format(dateStr1);
            Date date2 = formatter1.parse(formattedDate1);
            formatter1 = new SimpleDateFormat("MM-dd-yyyy");
            formattedDate1 = formatter1.format(date2);
            proc.setString(13, formattedDate1);
        } else {
            proc.setNull(13, java.sql.Types.VARCHAR);
        }
        rs = proc.executeQuery();
        int countFlag = 0;
        while (rs.next() != false) {
            countFlag++;
            setBlank();
            replaceSeperator("PRIMARYLOCATION", rs.getString("PRIMARYLOCATION"));
            replaceSeperator("SECONDARYLOCATION", rs.getString("SECONDARYLOCATION"));

            objRDto = new OrderReportNewDetailCwnDTO();
            objRDto.setPartyName(rs.getString("PARTYNAME"));
            objRDto.setOrderNo(rs.getString("ORDERNO"));
            //objRDto.setLogicalCircuitId(rs.getString("LOGICALCKTID"));LOGICAL_SI_NO(Commented By :AKS)
            //objRDto.setServiceId(rs.getInt("SERVICENO"));SERVICEID(Commented By :AKS)
            objRDto.setQuoteNo(rs.getString("QUOTENO"));
            objRDto.setProductName(rs.getString("PRODUCTNAME"));
            objRDto.setSubProductName(rs.getString("SUBPRODUCTNAME"));
            //         objRDto.setPrimarylocation(rs.getString("FROM_SITE"));//AKS:Need To Add in Component View:PRIMARYLOCATION
            //         objRDto.setSeclocation(rs.getString("TO_SITE"));//AKS:Need To Add in Component View:SECONDARYLOCATION

            //objRDto.setPrjmngname(rs.getString("PMNAME"));(Commented By :AKS)PROJECTMANAGER
            objRDto.setPrjmgremail(rs.getString("PMEMAIL"));//PMEMAIL:same:(AKS)Need To Add in Component View
            //objRDto.setActmngname(rs.getString("ACTMNAME"));ACCOUNTMANAGER
            objRDto.setZoneName(rs.getString("ZONENNAME"));//(AKS)Need To Add in Component View
            //objRDto.setRegionName(rs.getString("REGIONNAME"));REGION
            objRDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objRDto.setAct_category(rs.getString("ACCOUNTCATEGORY_DETAILS"));

            objRDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            //change
            tempDate = rs.getDate("ORDERDATE");
            if (tempDate != null) {
                objRDto.setOrderDate((Utility.showDate_Report(tempDate)).toUpperCase());
            }
            ts = rs.getTimestamp("AM_APPROVAL_DATE");
            if (ts != null) {
                tempDate = new Date(ts.getTime());
                objRDto.setAmApproveDate((Utility.showDate_Report(tempDate)).toUpperCase());
            }

            ts = rs.getTimestamp("PM_APPROVAL_DATE");
            if (ts != null) {
                tempDate = new Date(ts.getTime());
                objRDto.setPmApproveDate((Utility.showDate_Report(tempDate)).toUpperCase());
            }

            ts = rs.getTimestamp("NIO_APPROVAL_DATE");
            if (ts != null) {
                tempDate = new Date(ts.getTime());
                objRDto.setNio_approve_date((Utility.showDate_Report(tempDate)).toUpperCase());
            }
            objRDto.setDemo_infrastartdate(rs.getString("DEMP_INFRA_START_DATE"));

            objRDto.setDemo_infra_enddate(rs.getString("DEMO_INFRA_ENDDATE"));

            /*objRDto.setRfs_date(rs.getString("RFS_DATE"));SERVICE_RFS_DATE
            if (rs.getString("RFS_DATE") != null && !"".equals(rs.getString("RFS_DATE")))
            {
                       
               objRDto.setRfs_date((utility.showDate_Report(new Date(rs.getTimestamp("RFS_DATE").getTime()))).toUpperCase());
                       
            }*/
            //objRDto.setOrdercategory(rs.getString("ORDERCATEGORY"));ORDERTYPE(Commented By :AKS)
            objRDto.setOrderStatus(rs.getString("STATUS"));

            //objRDto.setLinename(rs.getString("LINENAME"));SERVICEDETDESCRIPTION(Commented By :AKS)

            //objRDto.setServiceProductID(rs.getInt("LINENO"));Order_Line_Id(Commented By :AKS)
            objRDto.setServiceName(rs.getString("SERVICENAME"));
            //objRDto.setAccountID(rs.getInt("ACCOUNTID"));CRMACCOUNTNO(Commented By :AKS)
            objRDto.setLicCompanyName(rs.getString("LCOMPANYNAME"));
            //objRDto.setEntity(rs.getString("COMPANYNAME"));ENTITYNAME

            objRDto.setServiceType(rs.getString("SERVICETYPE"));
            objRDto.setUom(rs.getString("UOM"));
            objRDto.setBandwaidth(rs.getString("BANDWIDTH"));
            objRDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            objRDto.setBilling_uom(rs.getString("BILLING_BANDWIDTH_UOM"));
            objRDto.setDistance(rs.getString("DISTANCE"));
            //objRDto.setFrom_city(rs.getString("FROM_CITY"));//(AKS)Need To Add in Component View
            if (rs.getString("FROM_CITY") != null && !"".equals(rs.getString("FROM_CITY"))) {
                String ss[] = rs.getString("FROM_CITY").split("~~");
                objRDto.setFrom_city(ss[8]);
            } else {
                objRDto.setFrom_city(rs.getString("FROM_CITY"));
            }
            //objRDto.setTo_city(rs.getString("TO_CITY"));//(AKS)Need To Add in Component View
            if (rs.getString("TO_CITY") != null && !"".equals(rs.getString("TO_CITY"))) {
                String ss[] = rs.getString("TO_CITY").split("~~");
                objRDto.setTo_city(ss[8]);
            } else {
                objRDto.setTo_city(rs.getString("TO_CITY"));
            }

            objRDto.setRatio(rs.getString("RATIO"));
            objRDto.setTaxation(rs.getString("TAXATIONVALUE"));

            objRDto.setAccountManager(rs.getString("ACTMEMAIL"));//(AKS)Need To Add in Component View
            //objRDto.setCurrencyCode(rs.getString("CURNAME"));CURRENCYNAME
            objRDto.setOrderTotal(rs.getDouble("ORDERTOTAL"));
            //objRDto.setPoAmount(rs.getString("POAMOUNT"));TOTALPOAMOUNT
            objRDto.setBisource(rs.getString("BISOURCE"));
            objRDto.setOrderType(rs.getString("ORDERTYPE"));

            //objRDto.setParent_name(rs.getString("PARENTNAME"));PARENT_NAME
            objRDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));
            objRDto.setOrdersubtype(rs.getString("ORDERSUBTYPE"));
            //Saurabh : Changes to separate charge related specific column from common
            if (objDto.getIsUsage() == 0) {

                objRDto.setChargeAmount(rs.getDouble("CHARGEAMOUNT"));

                objRDto.setFrequencyName(rs.getString("PAYMENTTERM"));
                objRDto.setChargeTypeName(rs.getString("CYCLICNONCYCLIC"));

                objRDto.setSub_linename(rs.getString("ORDER_SUBLINENAME"));
                objRDto.setChargeName(rs.getString("CHARGE_NAME"));
                objDto.setChargeinfoID(rs.getString("CHARGEINFOID"));

                objRDto.setOldordertotal(rs.getString("OLD_ORDER_TOTAL"));
                objRDto.setOldlineamt(rs.getString("OLD_LINE_AMT"));
                objRDto.setOld_contract_period(rs.getString("OLD_CONTRACTPERIOD"));

                objRDto.setFactory_ckt_id(rs.getString("FACTORY_CKT_ID"));

                objRDto.setDispatchAddress1(rs.getString("DISPATCHADDRESS"));

                objRDto.setLine_desc(rs.getString("LINE_ITEM_DESC"));
                //Start: AKS- Adding Column in Chanrge Section Which are not in View
                objRDto.setCopcApproveDate(rs.getString("COPC_APPROVAL_DATE"));
                if (rs.getString("COPC_APPROVAL_DATE") != null
                        && !"".equals(rs.getString("COPC_APPROVAL_DATE"))) {
                    objRDto.setCopcApproveDate(
                            (utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVAL_DATE").getTime())))
                                    .toUpperCase());
                }
                objRDto.setLogicalCircuitId(rs.getString("LOGICALCKTID"));
                objRDto.setServiceId(rs.getInt("SERVICENO"));
                objRDto.setPrjmngname(rs.getString("PMNAME"));
                objRDto.setActmngname(rs.getString("ACTMNAME"));
                objRDto.setRegionName(rs.getString("REGIONNAME"));
                objRDto.setRfs_date(rs.getString("RFS_DATE"));
                if (rs.getString("RFS_DATE") != null && !"".equals(rs.getString("RFS_DATE"))) {
                    objRDto.setRfs_date(
                            (utility.showDate_Report(new Date(rs.getTimestamp("RFS_DATE").getTime())))
                                    .toUpperCase());
                }
                objRDto.setOrdercategory(rs.getString("ORDERCATEGORY"));
                objRDto.setLinename(rs.getString("LINENAME"));
                objRDto.setServiceProductID(rs.getInt("LINENO"));
                objRDto.setAccountID(rs.getInt("ACCOUNTID"));
                objRDto.setEntity(rs.getString("COMPANYNAME"));
                objRDto.setCurrencyCode(rs.getString("CURNAME"));
                objRDto.setPoAmount(rs.getString("POAMOUNT"));
                objRDto.setParent_name(rs.getString("PARENTNAME"));
                objRDto.setPrimarylocation(rs.getString("FROM_SITE"));//AKS:Need To Add in Component View:PRIMARYLOCATION
                objRDto.setSeclocation(rs.getString("TO_SITE"));//AKS:Need To Add in Component View:SECONDARYLOCATION
                objRDto.setCustPoDate(rs.getString("CUST_PODATE"));
                if (rs.getString("CUST_PODATE") != null && !"".equals(rs.getString("CUST_PODATE"))) {

                    objRDto.setCustPoDate(
                            (utility.showDate_Report(new Date(rs.getTimestamp("CUST_PODATE").getTime())))
                                    .toUpperCase());

                }
                //End AKS
            }

            //Meenakshi : Changes for Usage
            if (objDto.getIsUsage() == 1) {

                objRDto.setFx_external_acc_id(rs.getString("Child_Account_Number"));//FX_ACCOUNT_EXTERNAL_ID
                objRDto.setFxInternalId(rs.getInt("INTERNAL_ID"));
                objRDto.setChild_account_creation_status(rs.getString("Child_Account_FX_Sataus"));//CHILD_ACCOUNT_FX_STATUS
                objRDto.setPackageID(rs.getInt("PACKAGE_ID"));
                objRDto.setPackageName(rs.getString("PACKAGE_NAME"));
                objRDto.setComponentID(rs.getInt("COMPONENT_ID"));
                objRDto.setComponentName(rs.getString("COMPONENT_NAME"));
                objRDto.setComponentInfoID(rs.getInt("COMPONENTINFOID"));
                //Start Adding Column in Component Section Which are present in View
                ts = rs.getTimestamp("COPC_APPROVED_DATE");
                if (ts != null) {
                    tempDate = new Date(ts.getTime());
                    objRDto.setCopcApproveDate((Utility.showDate_Report(tempDate)).toUpperCase());
                }
                objRDto.setLogicalCircuitId(rs.getString("LOGICAL_SI_NO"));
                objRDto.setServiceId(rs.getInt("SERVICE_NO"));
                objRDto.setPrjmngname(rs.getString("PROJECTMANAGER"));
                objRDto.setActmngname(rs.getString("ACCOUNTMANAGER"));
                objRDto.setRegionName(rs.getString("REGION"));
                tempDate = rs.getDate("SERVICE_RFS_DATE");
                if (tempDate != null) {
                    objRDto.setRfs_date((Utility.showDate_Report(tempDate)).toUpperCase());
                }
                objRDto.setOrdercategory(rs.getString("ORDERTYPE"));
                objRDto.setLinename(rs.getString("SERVICEDETDESCRIPTION"));
                objRDto.setServiceProductID(rs.getInt("Order_Line_Id"));
                objRDto.setAccountID(rs.getInt("CRMACCOUNTNO"));
                objRDto.setEntity(rs.getString("ENTITYNAME"));
                objRDto.setCurrencyCode(rs.getString("CURRENCYNAME"));
                objRDto.setPoAmount(rs.getString("TOTALPOAMOUNT"));
                objRDto.setParent_name(rs.getString("PARENT_NAME"));
                objRDto.setPrimarylocation(VAR_PRIMARYLOCATION);//AKS:Need To Add in Component View:PRIMARYLOCATION
                objRDto.setSeclocation(VAR_SECONDARYLOCATION);//AKS:Need To Add in Component View:SECONDARYLOCATION
                objRDto.setRE_LOGGED_LSI_NO(rs.getString("RE_LOGGED_LSI_NO"));
                objRDto.setPARALLEL_UPGRADE_LSI_NO(rs.getString("PARALLEL_UPGRADE_LSI_NO"));
                objRDto.setCHARGEDISCONNECTIONSTATUS(rs.getString("CHARGEDISCONNECTIONSTATUS"));
                objRDto.setSubchange_type(rs.getString("NAME_SUBTYPE"));
                objRDto.setFxAccountExternalId(rs.getString("CHILD_ACCOUNT_NUMBER"));
                tempDate = rs.getDate("CUSTPODATE");
                if (tempDate != null) {
                    objRDto.setCustPoDate((Utility.showDate_Report(tempDate)).toUpperCase());
                }
                //End : AKS

                ComponentsDto dto = new ComponentsDto();
                dto.setComponentType(rs.getString("COMPONENT_TYPE"));
                dto.setComponentAmount(rs.getDouble("COMP_AMOUNT"));
                dto.setComponentStatus(rs.getString("COMPONENT_STATUS"));
                //nagarjuna OB Value Usage
                objDto.setObValue(BigDecimal.valueOf((rs.getDouble("OB_VALUE"))).toPlainString());
                objDto.setObValueLastUpdateDate(rs.getString("OB_VALUE_LAST_UPDATE_DATE"));
                //nagarjuna OB Value Usage END
                //<!--GlobalDataBillingEfficiency BFR7  -->
                objRDto.setTaxExcemption_Reason(rs.getString("TAXEXCEMPTION_REASON"));
                objRDto.setLastApprovalRemarks(rs.getString("LAST_APPROVAL_REMARKS"));
                //NANCY
                objRDto.setePCNNo(rs.getString("EPCN_NO"));
                objRDto.setBillingTriggerCreateDate(rs.getString("BILLING_TRIGGER_CREATEDATE"));
                if (rs.getString("BILLING_TRIGGER_CREATEDATE") != null
                        && !"".equals(rs.getString("BILLING_TRIGGER_CREATEDATE"))) {
                    objRDto.setBillingTriggerCreateDate((utility
                            .showDate_Report(new Date(rs.getTimestamp("BILLING_TRIGGER_CREATEDATE").getTime())))
                                    .toUpperCase());
                }
                objRDto.setComponentDto(dto);
            }

            objRDto.setOsp(rs.getString("OSP"));
            objRDto.setCustSeg_Description(rs.getString("DESCRIPTION"));
            /// End
            objRDto.setOpportunityId((rs.getString("OPPORTUNITYID")));
            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
                //recordCount = countFlag;
            }
            objUserList.add(objRDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        //ex.printStackTrace();
        //throw new Exception("SQL Exception : " + ex.getMessage(), ex);
    } finally {
        try {
            DbConnection.freeConnection(conn);

        } catch (Exception e) {
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
            //e.printStackTrace();
            //throw new Exception("Exception : " + e.getMessage(), e);
        }
    }

    return objUserList;
}

From source file:com.ibm.ioes.dao.ReportsDao_Usage.java

public ArrayList<MigratedApprovedNewOrderDetailReportDTO> viewMigAppNewOrderDetails(
        MigratedApprovedNewOrderDetailReportDTO objDto) {
    //   Nagarjuna
    String methodName = "viewMigAppNewOrderDetails", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end Nagarjuna
    Connection connection = null;
    CallableStatement proc = null;
    ResultSet rs = null;
    ArrayList<MigratedApprovedNewOrderDetailReportDTO> listSearchDetails = new ArrayList<MigratedApprovedNewOrderDetailReportDTO>();
    MigratedApprovedNewOrderDetailReportDTO objReportsDto = null;
    int recordCount = 0;
    Utility utility = new Utility();
    DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    Date tempDate = null;/*from  w w w  .j a  v a 2 s .com*/
    Timestamp ts = null;
    try {
        connection = DbConnection.getReportsConnectionObject();
        proc = connection.prepareCall(sqlGetMigAppNewOrderDetails);

        if (objDto.getOrdermonth() != null && !"".equals(objDto.getOrdermonth())) {
            proc.setString(1, objDto.getOrdermonth().trim());
        } else {
            proc.setNull(1, java.sql.Types.VARCHAR);
        }

        if (objDto.getServiceName() != null && !"".equals(objDto.getServiceName())) {
            proc.setString(2, objDto.getServiceName().trim());
        } else {
            proc.setNull(2, java.sql.Types.VARCHAR);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index
        proc.setString(3, pagingSorting.getSortByColumn());// columnName
        proc.setString(4, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        proc.setInt(5, pagingSorting.getStartRecordId());// start index
        proc.setInt(6, pagingSorting.getEndRecordId());// end index
        proc.setInt(7, (pagingSorting.isPagingToBeDone() ? 1 : 0));
        proc.setInt(8, objDto.getIsUsage());
        if (objDto.getOrderyear() != null && !"".equals(objDto.getOrderyear())) {
            proc.setString(9, objDto.getOrderyear().trim());
        } else {
            proc.setNull(9, java.sql.Types.VARCHAR);
        }
        rs = proc.executeQuery();
        while (rs.next()) {
            objReportsDto = new MigratedApprovedNewOrderDetailReportDTO();
            //[270513]Start : Added by Ashutosh for Billing Address
            setBlank();
            replaceSeperator("BILLING_LOCATION", rs.getString("BILLING_ADDRESS"));
            replaceSeperator("PRIMARYLOCATION", rs.getString("PRIMARYLOCATION"));
            replaceSeperator("SECONDARYLOCATION", rs.getString("SECONDARYLOCATION"));
            objReportsDto.setOrderNumber(rs.getInt("ORDERNO"));
            objReportsDto.setOrderType(rs.getString("ORDERTYPE"));
            objReportsDto.setCrmAccountNoString(rs.getString("CRMACCOUNTNO"));
            objReportsDto.setPartyName(rs.getString("PARTYNAME"));
            objReportsDto.setParty_no(rs.getInt("Party_NO"));
            objReportsDto.setVerticalDetails(rs.getString("VERTICAL_DETAILS"));
            objReportsDto.setRegionName(rs.getString("REGION"));
            objReportsDto.setM6OrderNo(rs.getInt("M6ORDERNO"));
            objReportsDto.setServiceName(rs.getString("SERVICENAME"));
            objReportsDto.setCustomer_logicalSINumber(rs.getInt("CUSTOMER_LOGICAL_SI_NO"));
            objReportsDto.setServiceDetDescription(rs.getString("SERVICEDETDESCRIPTION"));//LineName
            //objReportsDto.setServiceOrderType(rs.getString("SERVICETYPE"));
            objReportsDto.setLogicalCircuitId(rs.getString("CKTID"));
            objReportsDto.setFromLocation(rs.getString("FROM_ADDRESS"));
            objReportsDto.setToLocation(rs.getString("TO_ADDRESS"));
            objReportsDto.setEntity(rs.getString("ENTITYNAME"));//Legal Entity
            objReportsDto.setLcompanyname(rs.getString("LCOMPANYNAME"));
            objReportsDto.setCurrencyName(rs.getString("CURRENCYNAME"));
            objReportsDto.setCreditPeriodName(rs.getString("CREDITPERIOD"));
            objReportsDto.setBillingTypeName(rs.getString("BILLING_TYPENAME"));//Bill Type
            objReportsDto.setBillingFormatName(rs.getString("BILLING_FORMATNAME"));
            objReportsDto.setBillingLevelName(rs.getString("BILLING_LEVELNAME"));
            objReportsDto.setBillingLevelNo(rs.getLong("BILLING_LEVEL_NO"));
            objReportsDto.setTaxation(rs.getString("TAXATIONVALUE"));
            objReportsDto.setBillingMode(rs.getString("BILLINGMODE"));
            objReportsDto.setPonum(rs.getLong("PONUMBER"));
            objReportsDto.setProductName(rs.getString("PRODUCTNAME"));
            objReportsDto.setSubProductName(rs.getString("SUBPRODUCTNAME"));
            tempDate = rs.getDate("PODATE");
            if (tempDate != null) {
                objReportsDto.setPoDate((Utility.showDate_Report(tempDate)).toUpperCase());
            }
            objReportsDto.setContractPeriod(rs.getInt("CONTRACTPERIOD"));//Period In Month
            objReportsDto.setTotalPoAmt(rs.getString("CUST_TOT_PO_AMT"));
            tempDate = rs.getDate("PORECEIVEDATE");
            if (tempDate != null) {
                objReportsDto.setPoRecieveDate((Utility.showDate_Report(tempDate)).toUpperCase());

            }
            objReportsDto.setCustPoDetailNo(rs.getString("CUSTPONUMBER"));
            tempDate = rs.getDate("CUSTPODATE");
            if (tempDate != null) {
                objReportsDto.setCustPoDate((Utility.showDate_Report(tempDate)).toUpperCase());
            }
            objReportsDto.setLOC_No(rs.getString("LOCNO"));
            objReportsDto.setLocDate(rs.getString("LOCDATE"));
            if (!(rs.getString("LOCDATE") == null || rs.getString("LOCDATE") == "")) {

                Date date = df.parse(objReportsDto.getLocDate());
                objReportsDto.setLocDate((Utility.showDate_Report(date)).toUpperCase());

            }
            objReportsDto.setPmApproveDate(rs.getString("Pm_Prov_Date"));
            if (rs.getString("Pm_Prov_Date") != null && !"".equals(rs.getString("Pm_Prov_Date"))) {
                String s1 = rs.getString("Pm_Prov_Date");
                String s3 = s1.substring(0, 7);
                String s4 = s1.substring(9, 11);
                String s5 = s3.concat(s4);
                objReportsDto.setPmApproveDate(s5);
            }
            objReportsDto.setBilling_Trigger_Flag(rs.getString("Billing_Trigger_Flag"));
            objReportsDto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            objReportsDto.setBillUom(rs.getString("BILLING_BANDWIDTH_UOM"));
            objReportsDto.setKmsDistance(rs.getString("DISTANCE"));
            objReportsDto.setBandwaidth(rs.getString("BANDWIDTH"));
            objReportsDto.setOrderLineNumber(rs.getInt("Order_Line_Id"));//Lineitemnumber   
            objReportsDto.setOrdermonth(rs.getString("ORDERMONTH"));
            //objReportsDto.setOpms_Account_Id(rs.getString("OPMS_ACCOUNT_ID"));
            objReportsDto.setPrimaryLocation(VAR_PRIMARYLOCATION);
            objReportsDto.setSecondaryLocation(VAR_SECONDARYLOCATION);
            objReportsDto.setFx_external_acc_id(rs.getString("Child_Account_Number"));
            objReportsDto.setChildAccountFXSataus(rs.getString("Child_Account_FX_Sataus"));
            if (objDto.getIsUsage() == 1) {
                objReportsDto.setBillingTriggerDate(rs.getString("BILLINGTRIGGERDATE"));
                if (!(rs.getString("BILLINGTRIGGERDATE") == null || rs.getString("BILLINGTRIGGERDATE") == "")) {

                    Date date = df.parse(objReportsDto.getBillingTriggerDate());
                    objReportsDto.setBillingTriggerDate((Utility.showDate_Report(date)).toUpperCase());

                }
                ts = rs.getTimestamp("BILLING_TRIGGER_CREATEDATE");
                if (ts != null) {
                    tempDate = new Date(ts.getTime());
                    objReportsDto
                            .setBillingtrigger_createdate((Utility.showDate_Report(tempDate)).toUpperCase());

                }
                objReportsDto.setComponentInfoID(rs.getInt("COMPONENTINFOID"));
                objReportsDto.setComponentID(rs.getInt("COMPONENT_ID"));
                objReportsDto.setComponentName(rs.getString("COMPONENT_NAME"));
                objReportsDto.setPackageID(rs.getInt("PACKAGE_ID"));
                objReportsDto.setPackageName(rs.getString("PACKAGE_NAME"));
                objReportsDto.setCreditPeriodName(rs.getString("CREDIT_PERIODNAME"));
                objReportsDto.setServiceOrderType(rs.getString("SERVICE_ORDER_TYPE_DESC"));

                ComponentsDto dto = new ComponentsDto();
                dto.setComponentStatus(rs.getString("COMPONENT_STATUS"));
                dto.setStartLogic(rs.getString("COMPONENT_START_LOGIC"));
                dto.setStartDate(rs.getString("COMPONENT_START_DATE"));
                if (rs.getString("COMPONENT_START_DATE") != null
                        && !"".equals(rs.getString("COMPONENT_START_DATE"))) {

                    Date date = df.parse(dto.getStartDate());
                    dto.setStartDate((Utility.showDate_Report(date)).toUpperCase());

                }
                dto.setEndLogic(rs.getString("COMPONENT_END_LOGIC"));
                dto.setEnd_date(rs.getString("COMPONENT_END_DATE"));
                if (rs.getString("COMPONENT_END_DATE") != null
                        && !"".equals(rs.getString("COMPONENT_END_DATE"))) {

                    Date date = df.parse(dto.getEnd_date());
                    dto.setEnd_date((Utility.showDate_Report(date)).toUpperCase());

                }
                dto.setFxTokenNo(rs.getString("START_COMPONENT_TOKEN_NO"));
                dto.setFxStartStatus(rs.getString("FX_START_STATUS"));
                dto.setEndTokenNo(rs.getString("LOCAL_END_COMPONENT_TOKEN_NO"));
                dto.setEndFxStatus(rs.getString("FX_END_STATUS"));
                //dto.setComponentFXStatus(rs.getString("FX_STATUS"));
                objReportsDto.setStartDateDays(rs.getInt("COMP_START_DAYS"));
                objReportsDto.setStartDateMonth(rs.getInt("COMP_START_MONTHS"));
                objReportsDto.setEndDateDays(rs.getInt("COMP_END_DAYS"));
                objReportsDto.setEndDateMonth(rs.getInt("COMP_END_MONTHS"));
                objReportsDto.setSourcePartyID(rs.getLong("PARTY_ID"));
                objReportsDto.setAccountID(rs.getInt("CUSTACCOUNTID"));
                objReportsDto.setFx_internal_acc_id(rs.getLong("INTERNAL_ID"));
                dto.setComponentInstanceID(rs.getString("COMPONENT_INST_ID"));
                dto.setComponentType(rs.getString("COMPONENT_TYPE"));
                dto.setComponentAmount(rs.getDouble("COMP_AMOUNT"));

                objReportsDto.setComponentDto(dto);

            } else {
                objReportsDto.setBillingTriggerDate(rs.getString("BILLINGTRIGGERDATE"));
                if (!(rs.getString("BILLINGTRIGGERDATE") == null || rs.getString("BILLINGTRIGGERDATE") == "")) {

                    Date date = df.parse(objReportsDto.getBillingTriggerDate());
                    objReportsDto.setBillingTriggerDate((Utility.showDate_Report(date)).toUpperCase());

                }
                objReportsDto.setBillingtrigger_createdate(rs.getString("BILLING_TRIGGER_CREATEDATE"));
                if (!(rs.getString("BILLING_TRIGGER_CREATEDATE") == null
                        || rs.getString("BILLING_TRIGGER_CREATEDATE") == "")) {

                    //Date date=df.parse(objReportsDto.getBillingtrigger_createdate());
                    objReportsDto.setBillingtrigger_createdate(
                            (Utility.showDate_Report(rs.getDate("BILLING_TRIGGER_CREATEDATE"))).toUpperCase());

                }
                objReportsDto.setRatio(rs.getString("RATIO"));
                objReportsDto.setBlSource(rs.getString("BL_SOURCE"));
                objReportsDto.setFx_St_Chg_Status(rs.getString("CSTATE_FX_CHARGE_START_STATUS"));//Fx_St_Chg_Status
                objReportsDto.setFxStatus(rs.getString("CSTATE_START_DETAILS_FX_STATUS"));//FX_STATUS
                objReportsDto.setChargeName(rs.getString("CHARGE_NAME"));
                objReportsDto.setChargeTypeName(rs.getString("CHARGE_TYPE"));
                objReportsDto.setChargeAmount_String(rs.getString("INV_AMT"));
                objReportsDto.setLineItemAmount(rs.getString("LINEITEMAMOUNT"));//amt
                objReportsDto.setStartDate(rs.getString("START_DATE"));
                if (!(rs.getString("START_DATE") == null || rs.getString("START_DATE") == "")) {

                    Date date = df.parse(objReportsDto.getStartDate());
                    objReportsDto.setStartDate((Utility.showDate_Report(date)).toUpperCase());

                }
                objReportsDto.setChargeAnnotation(rs.getString("ANNOTATION"));
                objReportsDto.setTokenNO(rs.getString("CSTATE_START_DETAILS_FX_TOKEN_NO"));//Token_No
                objReportsDto.setHardwareFlag(rs.getString("HARDWARE_FLAG"));
                objReportsDto.setHardwaretypeName(rs.getString("HARDWARETYPENAME"));
                objReportsDto.setStorename(rs.getString("STORENAME"));
                objReportsDto.setBillPeriod(rs.getString("BILL_PERIOD"));
                objReportsDto.setBusiness_serial_no(rs.getString("BUSINESS_SERIAL_NO"));
                //objReportsDto.setSaleType(rs.getString("SALETYPENAME"));//Type Of Sale
            }

            if (pagingSorting.isPagingToBeDone()) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            listSearchDetails.add(objReportsDto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception ex) {
        //ex.printStackTrace();   
        Utility.onEx_LOG_RET_NEW_EX(ex, methodName, className, msg, logToFile, logToConsole);//nagarjuna
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(proc);
            DbConnection.freeConnection(connection);
        } catch (Exception e) {
            // TODO Auto-generated catch block
            //e.printStackTrace();
            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
        }
    }
    return listSearchDetails;
}

From source file:com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance.java

/**
 * Retrieve a L2PcInstance from the characters table of the database and add it in _allObjects of the L2world.<BR>
 * <BR>//from w ww.j  a v  a  2 s.  c  o m
 * <B><U> Actions</U> :</B><BR>
 * <BR>
 * <li>Retrieve the L2PcInstance from the characters table of the database</li> <li>Add the L2PcInstance object in _allObjects</li> <li>Set the x,y,z position of the L2PcInstance and make it invisible</li> <li>Update the overloaded status of the L2PcInstance</li><BR>
 * <BR>
 * @param objectId Identifier of the object to initialized
 * @return The L2PcInstance loaded from the database
 */
private static L2PcInstance restore(final int objectId) {
    L2PcInstance player = null;
    double curHp = 0;
    double curCp = 0;
    double curMp = 0;

    Connection con = null;
    try {
        // Retrieve the L2PcInstance from the characters table of the database
        con = L2DatabaseFactory.getInstance().getConnection(false);

        final PreparedStatement statement = con.prepareStatement(RESTORE_CHARACTER);
        statement.setInt(1, objectId);
        final ResultSet rset = statement.executeQuery();

        while (rset.next()) {
            final int activeClassId = rset.getInt("classid");
            final boolean female = rset.getInt("sex") != 0;
            final L2PcTemplate template = CharTemplateTable.getInstance().getTemplate(activeClassId);
            PcAppearance app = new PcAppearance(rset.getByte("face"), rset.getByte("hairColor"),
                    rset.getByte("hairStyle"), female);

            player = new L2PcInstance(objectId, template, rset.getString("account_name"), app);
            player.setName(rset.getString("char_name"));
            player._lastAccess = rset.getLong("lastAccess");

            player.getStat().setExp(rset.getLong("exp"));
            player.setExpBeforeDeath(rset.getLong("expBeforeDeath"));
            player.getStat().setLevel(rset.getByte("level"));
            player.getStat().setSp(rset.getInt("sp"));

            player.setWantsPeace(rset.getInt("wantspeace"));

            player.setHeading(rset.getInt("heading"));

            player.setKarma(rset.getInt("karma"));
            player.setPvpKills(rset.getInt("pvpkills"));
            player.setPkKills(rset.getInt("pkkills"));
            player.setOnlineTime(rset.getLong("onlinetime"));
            player.setNewbie(rset.getInt("newbie") == 1);
            player.setNoble(rset.getInt("nobless") == 1);
            player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
            player.setFirstLog(rset.getInt("first_log"));
            player.pcBangPoint = rset.getInt("pc_point");
            app = null;

            if (player.getClanJoinExpiryTime() < System.currentTimeMillis()) {
                player.setClanJoinExpiryTime(0);
            }
            player.setClanCreateExpiryTime(rset.getLong("clan_create_expiry_time"));
            if (player.getClanCreateExpiryTime() < System.currentTimeMillis()) {
                player.setClanCreateExpiryTime(0);
            }

            final int clanId = rset.getInt("clanid");
            player.setPowerGrade((int) rset.getLong("power_grade"));
            player.setPledgeType(rset.getInt("subpledge"));
            player.setLastRecomUpdate(rset.getLong("last_recom_date"));
            // player.setApprentice(rset.getInt("apprentice"));

            if (clanId > 0) {
                player.setClan(ClanTable.getInstance().getClan(clanId));
            }

            if (player.getClan() != null) {
                if (player.getClan().getLeaderId() != player.getObjectId()) {
                    if (player.getPowerGrade() == 0) {
                        player.setPowerGrade(5);
                    }
                    player.setClanPrivileges(player.getClan().getRankPrivs(player.getPowerGrade()));
                } else {
                    player.setClanPrivileges(L2Clan.CP_ALL);
                    player.setPowerGrade(1);
                }
            } else {
                player.setClanPrivileges(L2Clan.CP_NOTHING);
            }

            player.setDeleteTimer(rset.getLong("deletetime"));

            player.setTitle(rset.getString("title"));
            player.setAccessLevel(rset.getInt("accesslevel"));
            player.setFistsWeaponItem(player.findFistsWeaponItem(activeClassId));
            player.setUptime(System.currentTimeMillis());

            curHp = rset.getDouble("curHp");
            curCp = rset.getDouble("curCp");
            curMp = rset.getDouble("curMp");

            /*
             * player.setCurrentHp(rset.getDouble("curHp")); player.setCurrentCp(rset.getDouble("curCp")); player.setCurrentMp(rset.getDouble("curMp"));
             */

            // Check recs
            player.checkRecom(rset.getInt("rec_have"), rset.getInt("rec_left"));

            player._classIndex = 0;
            try {
                player.setBaseClass(rset.getInt("base_class"));
            } catch (final Exception e) {
                if (Config.ENABLE_ALL_EXCEPTIONS)
                    e.printStackTrace();

                player.setBaseClass(activeClassId);
            }

            // Restore Subclass Data (cannot be done earlier in function)
            if (restoreSubClassData(player)) {
                if (activeClassId != player.getBaseClass()) {
                    for (final SubClass subClass : player.getSubClasses().values())
                        if (subClass.getClassId() == activeClassId) {
                            player._classIndex = subClass.getClassIndex();
                        }
                }
            }
            if (player.getClassIndex() == 0 && activeClassId != player.getBaseClass()) {
                // Subclass in use but doesn't exist in DB -
                // a possible restart-while-modifysubclass cheat has been attempted.
                // Switching to use base class
                player.setClassId(player.getBaseClass());
                LOGGER.warn("Player " + player.getName()
                        + " reverted to base class. Possibly has tried a relogin exploit while subclassing.");
            } else {
                player._activeClass = activeClassId;
            }

            player.setApprentice(rset.getInt("apprentice"));
            player.setSponsor(rset.getInt("sponsor"));
            player.setLvlJoinedAcademy(rset.getInt("lvl_joined_academy"));
            player.setIsIn7sDungeon(rset.getInt("isin7sdungeon") == 1 ? true : false);

            player.setPunishLevel(rset.getInt("punish_level"));
            if (player.getPunishLevel() != PunishLevel.NONE)
                player.setPunishTimer(rset.getLong("punish_timer"));
            else
                player.setPunishTimer(0);
            /*
             * player.setInJail(rset.getInt("in_jail") == 1 ? true : false); if(player.isInJail()) { player.setJailTimer(rset.getLong("jail_timer")); } else { player.setJailTimer(0); } player.setChatBanTimer(rset.getLong("banchat_time")); player.updateChatBanState();
             */

            try {
                player.getAppearance().setNameColor(Integer.decode(
                        new StringBuilder().append("0x").append(rset.getString("name_color")).toString())
                        .intValue());
                player.getAppearance().setTitleColor(Integer.decode(
                        new StringBuilder().append("0x").append(rset.getString("title_color")).toString())
                        .intValue());
            } catch (final Exception e) {
                if (Config.ENABLE_ALL_EXCEPTIONS)
                    e.printStackTrace();

                // leave them as default
            }

            CursedWeaponsManager.getInstance().checkPlayer(player);

            player.setAllianceWithVarkaKetra(rset.getInt("varka_ketra_ally"));

            player.setDeathPenaltyBuffLevel(rset.getInt("death_penalty_level"));
            player.setAio(rset.getInt("aio") == 1 ? true : false);
            player.setAioEndTime(rset.getLong("aio_end"));
            // Add the L2PcInstance object in _allObjects
            // L2World.getInstance().storeObject(player);

            // Set the x,y,z position of the L2PcInstance and make it invisible
            player.setXYZInvisible(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));

            // Retrieve the name and ID of the other characters assigned to this account.
            PreparedStatement stmt = con.prepareStatement(
                    "SELECT obj_Id, char_name FROM characters WHERE account_name=? AND obj_Id<>?");
            stmt.setString(1, player._accountName);
            stmt.setInt(2, objectId);
            ResultSet chars = stmt.executeQuery();

            while (chars.next()) {
                final Integer charId = chars.getInt("obj_Id");
                final String charName = chars.getString("char_name");
                player._chars.put(charId, charName);
            }

            chars.close();
            stmt.close();
            chars = null;
            stmt = null;

            break;
        }

        DatabaseUtils.close(rset);
        DatabaseUtils.close(statement);

        if (player == null) {
            // TODO: Log this!
            return null;
        }

        // Retrieve from the database all secondary data of this L2PcInstance
        // and reward expertise/lucky skills if necessary.
        // Note that Clan, Noblesse and Hero skills are given separately and not here.
        player.restoreCharData();
        // reward skill restore mode in order to avoid duplicate storage of already stored skills
        player.rewardSkills(true);

        // Restore pet if exists in the world
        player.setPet(L2World.getInstance().getPet(player.getObjectId()));
        if (player.getPet() != null) {
            player.getPet().setOwner(player);
        }

        // Update the overloaded status of the L2PcInstance
        player.refreshOverloaded();

        player.restoreFriendList();
    } catch (final Exception e) {
        LOGGER.error("Could not restore char data", e);
        e.printStackTrace();
    } finally {
        CloseUtil.close(con);
    }

    if (player != null) {
        player.fireEvent(EventType.LOAD.name, (Object[]) null);

        try {
            Thread.sleep(100);
        } catch (final InterruptedException e) {
            e.printStackTrace();
        }

        // once restored all the skill status, update current CP, MP and HP
        player.setCurrentHpDirect(curHp);
        player.setCurrentCpDirect(curCp);
        player.setCurrentMpDirect(curMp);
        // player.setCurrentCp(curCp);
        // player.setCurrentMp(curMp);
    }
    return player;
}