Example usage for java.sql CallableStatement setDate

List of usage examples for java.sql CallableStatement setDate

Introduction

In this page you can find the example usage for java.sql CallableStatement setDate.

Prototype

void setDate(String parameterName, java.sql.Date x) throws SQLException;

Source Link

Document

Sets the designated parameter to the given java.sql.Date value using the default time zone of the virtual machine that is running the application.

Usage

From source file:com.mimp.hibernate.HiberEtapa.java

public void crearEvaluacionAdopcion(Evaluacion temp) {

    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();//from   ww w.j ava 2s  .  c  o m

    final Long idExp = temp.getExpedienteFamilia().getIdexpedienteFamilia();
    final Long idPer = temp.getPersonal().getIdpersonal();
    final String tipoEval = temp.getTipo();
    final Date fechaAsig = temp.getFechaAsignacion();
    final String result = temp.getResultado();
    final Date fechaResul = temp.getFechaResultado();
    final String obs = temp.getObservacion();
    final String sust = temp.getSustento();
    final String ndesig = temp.getNDesignacion();
    final String numEval = temp.getNumEval();
    final String persInt = temp.getPersInt();
    final Long numPersInte = temp.getNumPersInt();

    Work work = new Work() {
        @Override
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HE_CREAR_EVAL_ADOP(?,?,?,?,?,?,?,?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idExp);
            statement.setLong(2, idPer);
            statement.setString(3, tipoEval);
            statement.setDate(4, (java.sql.Date) fechaAsig);
            statement.setString(5, result);
            statement.setDate(6, (java.sql.Date) fechaResul);
            statement.setString(7, obs);
            statement.setString(8, sust);
            statement.setString(9, ndesig);
            statement.setString(10, numEval);
            statement.setString(11, persInt);
            statement.setLong(12, numPersInte);
            statement.execute();
            statement.close();
        }
    };

    session.doWork(work);

}

From source file:com.mimp.hibernate.HiberEtapa.java

public void crearDesignacion(Designacion temp) {

    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();//from  www  .j  av a 2  s. co m

    final Long idEx = temp.getExpedienteFamilia().getIdexpedienteFamilia();
    final Long idNna = temp.getNna().getIdnna();
    final Long idPer = temp.getPersonal().getIdpersonal();
    final String nDesig = temp.getNDesignacion();
    final Date fechaPro = temp.getFechaPropuesta();
    final Date fechaCon = temp.getFechaConsejo();
    final short acepCon = temp.getAceptacionConsejo();
    final String tipo = temp.getTipoPropuesta();
    final String obs = temp.getObs();

    Work work = new Work() {
        @Override
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HE_CREAR_DESIG(?,?,?,?,?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idEx);
            statement.setLong(2, idNna);
            statement.setLong(3, idPer);
            statement.setString(4, nDesig);
            statement.setDate(5, (java.sql.Date) fechaPro);
            statement.setDate(6, (java.sql.Date) fechaCon);
            statement.setShort(7, acepCon);
            statement.setString(8, tipo);
            statement.setString(9, obs);
            statement.execute();
            statement.close();
        }
    };

    session.doWork(work);

}

From source file:com.mimp.hibernate.HiberEtapa.java

public void updateResolEvaluacion(Resolucion temp) {

    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();/*from   w  w  w.  j a va 2  s  .com*/

    final Long idRes = temp.getIdresolucion();
    final Long idEv = temp.getEvaluacion().getIdevaluacion();
    final String tipoResol = temp.getTipo();
    final String numResol = temp.getNumero();
    final Date fechaRes = temp.getFechaResol();
    final Date fechaNot = temp.getFechaNotificacion();

    Work work = new Work() {
        @Override
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HE_UPDATE_RESOL(?,?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idRes);
            statement.setLong(2, idEv);
            statement.setString(3, tipoResol);
            statement.setString(4, numResol);
            statement.setDate(5, (java.sql.Date) fechaRes);
            statement.setDate(6, (java.sql.Date) fechaNot);

            statement.execute();
            statement.close();
        }
    };

    session.doWork(work);

}

From source file:com.mimp.hibernate.HiberEtapa.java

public void updateEvaluacion(Evaluacion temp) {

    Session session = sessionFactory.getCurrentSession();
    session.beginTransaction();//  w  w  w  . j a  v  a2 s.c o  m

    final Long idEval = temp.getIdevaluacion();
    final Long idExp = temp.getExpedienteFamilia().getIdexpedienteFamilia();
    final Long idPer = temp.getPersonal().getIdpersonal();
    final String tipoEval = temp.getTipo();
    final Date fechaAsig = temp.getFechaAsignacion();
    final String result = temp.getResultado();
    final Date fechaResul = temp.getFechaResultado();
    final String obs = temp.getObservacion();
    final String sust = temp.getSustento();
    final String ndesig = temp.getNDesignacion();
    final String numEval = temp.getNumEval();

    Work work = new Work() {
        @Override
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HE_UPDATE_EVAL(?,?,?,?,?,?,?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idEval);
            statement.setLong(2, idExp);
            statement.setLong(3, idPer);
            statement.setString(4, tipoEval);
            statement.setDate(5, (java.sql.Date) fechaAsig);
            statement.setString(6, result);
            statement.setDate(7, (java.sql.Date) fechaResul);
            statement.setString(8, obs);
            statement.setString(9, sust);
            statement.setString(10, ndesig);
            statement.setString(11, numEval);

            statement.execute();
            statement.close();
        }
    };

    session.doWork(work);

}

From source file:com.mimp.hibernate.HiberEtapa.java

public void crearInformePost(InformePostAdoptivo temp) {

    Session session = sessionFactory.getCurrentSession();

    final Long idpost = temp.getPostAdopcion().getIdpostAdopcion();
    final Long idpersonal = temp.getPersonal().getIdpersonal();
    final String estado = temp.getEstado();
    final String numero_informe = temp.getNumeroInforme();
    final Date fecha_rec_proy = temp.getFechaRecepcionProyectado();
    final Date fecha_rec = temp.getFechaRecepcion();
    final Date fecha_info = temp.getFechaInforme();
    final Date fecha_act = temp.getFechaActa();
    final String obs = temp.getObs();

    Work work = new Work() {
        @Override/*  ww  w  .  ja v a2 s  .  c  o  m*/
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HE_SAVE_INFORME_POST(?,?,?,?,?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idpost);
            statement.setLong(2, idpersonal);
            statement.setString(3, estado);
            statement.setString(4, numero_informe);
            statement.setDate(5, (java.sql.Date) fecha_rec_proy);
            statement.setDate(6, (java.sql.Date) fecha_rec);
            statement.setDate(7, (java.sql.Date) fecha_info);
            statement.setDate(8, (java.sql.Date) fecha_act);
            statement.setString(9, obs);
            statement.execute();
            statement.close();
        }
    };

    session.doWork(work);

}

From source file:com.mimp.hibernate.HiberEtapa.java

public void updateInformePost(InformePostAdoptivo temp) {

    Session session = sessionFactory.getCurrentSession();

    final Long idinfo_post = temp.getIdinformePostAdoptivo();
    final Long idpost = temp.getPostAdopcion().getIdpostAdopcion();
    final Long idpersonal = temp.getPersonal().getIdpersonal();
    final String estado = temp.getEstado();
    final String numero_informe = temp.getNumeroInforme();
    final Date fecha_rec_proy = temp.getFechaRecepcionProyectado();
    final Date fecha_rec = temp.getFechaRecepcion();
    final Date fecha_info = temp.getFechaInforme();
    final Date fecha_act = temp.getFechaActa();
    final String obs = temp.getObs();

    Work work = new Work() {
        @Override/*  www  .  ja va2 s.  c o  m*/
        public void execute(Connection connection) throws SQLException {

            String hql = "{call HE_UPDATE_INFO_POST(?,?,?,?,?,?,?,?,?,?)}";
            CallableStatement statement = connection.prepareCall(hql);
            statement.setLong(1, idinfo_post);
            statement.setLong(2, idpost);
            statement.setLong(3, idpersonal);
            statement.setString(4, estado);
            statement.setString(5, numero_informe);
            statement.setDate(6, (java.sql.Date) fecha_rec_proy);
            statement.setDate(7, (java.sql.Date) fecha_rec);
            statement.setDate(8, (java.sql.Date) fecha_info);
            statement.setDate(9, (java.sql.Date) fecha_act);
            statement.setString(10, obs);
            statement.execute();
            statement.close();
        }
    };

    session.doWork(work);

}

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

public ArrayList<UserAccessMatrixDto> viewAccessMatrixReport(UserAccessMatrixDto objDto) {
    //start/*  w w  w  .j a  va  2  s . c  o  m*/
    String methodName = "viewAccessMatrixReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end
    Connection connection = null;
    CallableStatement cstmt = null;
    ResultSet rs = null;
    ArrayList<UserAccessMatrixDto> docListDetails = new ArrayList<UserAccessMatrixDto>();
    int recordCount = 0;
    UserAccessMatrixDto objReportsDto = null;
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    String copcFromDate = objDto.getFromCOPCDate();
    String cocpToDate = objDto.getToCOPCDate();

    try {
        connection = DbConnection.getReportsConnectionObject();
        cstmt = connection.prepareCall(sqlGetAccesstMatrixReport);

        if (copcFromDate != null && !"".equals(copcFromDate)) {

            Date fromDate = df.parse(copcFromDate);
            cstmt.setDate(1, new java.sql.Date(fromDate.getTime()));

        } else {
            cstmt.setNull(1, java.sql.Types.DATE);
        }

        if (cocpToDate != null && !"".equals(cocpToDate)) {

            Date toDate = df.parse(cocpToDate);
            cstmt.setDate(2, new java.sql.Date(toDate.getTime()));

        } else {
            cstmt.setNull(2, java.sql.Types.DATE);
        }

        PagingSorting pagingSorting = objDto.getPagingSorting();
        pagingSorting.sync();
        // To calculate start index and Enc Index
        /*
                 cstmt.setString(3,  pagingSorting.getSortByColumn());// columnName
                 cstmt.setString(4, PagingSorting.DB_Asc_Desc(pagingSorting
                       .getSortByOrder()));// sort order
        */ cstmt.setInt(3, pagingSorting.getStartRecordId());// start index
        cstmt.setInt(4, pagingSorting.getEndRecordId());// end index
        cstmt.setInt(5, (pagingSorting.isPagingToBeDone() ? 1 : 0));

        rs = cstmt.executeQuery();
        long i = 1;
        while (rs.next()) {
            objReportsDto = new UserAccessMatrixDto();
            objReportsDto.setSrno(i++);
            objReportsDto.setUserId(rs.getString("USERID"));
            objReportsDto.setUserName(rs.getString("USERNAME"));
            objReportsDto.setRoleId(rs.getLong("ROLEID"));
            objReportsDto.setRoleName(rs.getString("ROLENAME"));
            objReportsDto.setAccessOrDenied(rs.getString("STATUS"));
            objReportsDto.setDateOfmofification(rs.getString("DATEOFMODIFICATION"));
            objReportsDto.setModifiedByUserId(rs.getString("MODIFIEDBYUSERID"));
            objReportsDto.setModifiedByUserName(rs.getString("MODIFIEDBYUSERNAME"));
            objReportsDto.setOldCustSegmentName(rs.getString("OLDCUSTOMERSEGMENT"));
            objReportsDto.setCus_segment(rs.getString("NEWCUSTOMERSEGMENT"));

            docListDetails.add(objReportsDto);
            if (pagingSorting.isPagingToBeDone() && recordCount == 0) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception e) {

        Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(cstmt);
            DbConnection.freeConnection(connection);
        } catch (Exception e) {

            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);
        }
    }

    return docListDetails;

}

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

/**
 * Method::viewDocumentMatrixReport/*from  ww w. j  a v  a  2  s.com*/
 * @param DocumentMatrixReportDTO
 * @author Gunjan Singla
 * @return ArrayList
 */
public ArrayList<DocumentMatrixReportDTO> viewDocumentMatrixReport(DocumentMatrixReportDTO objDto) {
    //start
    String methodName = "viewDocumentMatrixReport", className = this.getClass().getName(), msg = "";
    boolean logToFile = true, logToConsole = true;
    //end
    Connection connection = null;
    CallableStatement cstmt = null;
    ResultSet rs = null;
    int recordCount = 0;
    ArrayList<DocumentMatrixReportDTO> docListDetails = new ArrayList<DocumentMatrixReportDTO>();
    DocumentMatrixReportDTO objReportsDto = null;
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    String copcFromDate = objDto.getFromCOPCDate();
    String cocpToDate = objDto.getToCOPCDate();
    String custSegment = objDto.getCustSegment();

    try {
        connection = DbConnection.getReportsConnectionObject();
        cstmt = connection.prepareCall(sqlGetDocumentMatrixReport);

        if (copcFromDate != null && !"".equals(copcFromDate)) {

            Date fromDate = df.parse(copcFromDate);
            cstmt.setDate(1, new java.sql.Date(fromDate.getTime()));

        } else {
            cstmt.setNull(1, java.sql.Types.DATE);
        }

        if (cocpToDate != null && !"".equals(cocpToDate)) {

            Date toDate = df.parse(cocpToDate);
            cstmt.setDate(2, new java.sql.Date(toDate.getTime()));

        } else {
            cstmt.setNull(2, java.sql.Types.DATE);
        }
        if (custSegment != null && !"".equals(custSegment)) {
            cstmt.setString(3, custSegment.trim().toUpperCase());
        } else {
            cstmt.setNull(3, java.sql.Types.VARCHAR);
        }

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

        cstmt.setString(4, pagingSorting.getSortByColumn());// columnName
        cstmt.setString(5, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));// sort order
        cstmt.setInt(6, pagingSorting.getStartRecordId());// start index
        cstmt.setInt(7, pagingSorting.getEndRecordId());// end index
        cstmt.setInt(8, (pagingSorting.isPagingToBeDone() ? 1 : 0));

        rs = cstmt.executeQuery();
        while (rs.next()) {
            objReportsDto = new DocumentMatrixReportDTO();
            objReportsDto.setAccountNo(rs.getString("CRMACCOUNTNO"));
            objReportsDto.setAccountName(rs.getString("ACCOUNTNAME"));
            objReportsDto.setAccntMgr(rs.getString("ACCT_MGR_NAME"));
            objReportsDto.setCopcApprovr(rs.getString("COPC_APPROVER_NAME"));
            objReportsDto.setCopcApprovrID(rs.getString("COPC_APPROVER_ID"));
            objReportsDto.setCopcAprDate(rs.getString("COPC_APPROVAL_DATE"));
            if (rs.getString("COPC_APPROVAL_DATE") != null && !"".equals(rs.getString("COPC_APPROVAL_DATE"))) {
                objReportsDto.setCopcAprDate(
                        (Utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVAL_DATE").getTime())))
                                .toUpperCase());
            }
            objReportsDto.setCopcApprovrRemarks(rs.getString("COPC_APPROVER_REMARKS"));
            objReportsDto.setCustSegment(rs.getString("CUST_SEGMENT_CODE"));
            objReportsDto.setLsiNo(rs.getString("LOGICAL_SI_NO"));
            objReportsDto.setOrderNo(rs.getString("ORDERNO"));
            objReportsDto.setOrdSubType(rs.getString("NAME_SUBTYPE"));
            objReportsDto.setOrdType(rs.getString("ORDERTYPE"));
            objReportsDto.setRegion(rs.getString("REGIONNAME"));
            objReportsDto.setSalesCo(rs.getString("SALES_CORD_NAME"));
            objReportsDto.setServiceNo(rs.getString("SERVICEID"));
            objReportsDto.setStage(rs.getString("STAGE"));
            objReportsDto.setDocCAF((rs.getBoolean("CAF")) ? "Yes" : "No");
            objReportsDto.setDocCustAgreemnt((rs.getBoolean("Customer_Agreement")) ? "Yes" : "No");
            objReportsDto.setDocFeasibility((rs.getBoolean("Feasibility")) ? "Yes" : "No");
            objReportsDto.setDocISP((rs.getBoolean("ISP")) ? "Yes" : "No");
            objReportsDto.setDocNtwrk((rs.getBoolean("Network_Diagram")) ? "Yes" : "No");
            objReportsDto.setDocOFS((rs.getBoolean("OFS")) ? "Yes" : "No");
            objReportsDto.setDocOther((rs.getBoolean("OTHERS")) ? "Yes" : "No");
            objReportsDto.setDocPCD((rs.getBoolean("PCD")) ? "Yes" : "No");
            objReportsDto.setDocPCN((rs.getBoolean("e_PCN_NFA")) ? "Yes" : "No");
            objReportsDto.setDocPO((rs.getBoolean("PO_Order_form")) ? "Yes" : "No");
            objReportsDto.setDocRFP((rs.getBoolean("RFP")) ? "Yes" : "No");
            objReportsDto.setDocSOW((rs.getBoolean("SOW")) ? "Yes" : "No");
            objReportsDto.setDocThirdParty((rs.getBoolean("PI_Third_Party_Related")) ? "Yes" : "No");
            objReportsDto.setDocTnC((rs.getBoolean("TandC")) ? "Yes" : "No");
            objReportsDto.setDocLOU((rs.getBoolean("LOU")) ? "Yes" : "No");
            objReportsDto.setDocAnyDeviation((rs.getBoolean("Any_deviation")) ? "Yes" : "No");
            objReportsDto.setDocNonIndiaTouchLink((rs.getBoolean("NonIndia_touch_link")) ? "Yes" : "No");
            //[132]
            objReportsDto.setDocPMTA((rs.getBoolean("PMTA")) ? "Yes" : "No");

            docListDetails.add(objReportsDto);
            if (pagingSorting.isPagingToBeDone() && recordCount == 0) {
                recordCount = rs.getInt("FULL_REC_COUNT");

            }
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception e) {

        Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);//nagarjuna
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(cstmt);
            DbConnection.freeConnection(connection);
        } catch (Exception e) {

            Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);
        }
    }

    return docListDetails;

}

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

public ArrayList<ArchivalReportDto> reportDraftOrder(ArchivalReportDto reportsDto) {

    String methodName = "reportDraftOrder";
    String className = this.getClass().getName();
    String msg = "";
    boolean logToFile = true, logToConsole = true;

    Connection connection = null;
    CallableStatement cstmt = null;
    ResultSet rs = null;// ww w  .  ja  va  2  s .c  om
    ArrayList docListDetails = new ArrayList();
    int recordCount = 0;
    ArchivalReportDto dto = null;
    Utility utility = new Utility();
    SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy");
    String fromDate = reportsDto.getFromdate();
    String toDate = reportsDto.getTodate();

    try {
        PagingSorting pagingSorting = reportsDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index
        connection = DbConnection.getConnectionObject();
        cstmt = connection.prepareCall(sqlGetDraftReport);

        if (fromDate != null && !"".equals(fromDate)) {
            Date fDate = df.parse(fromDate);
            cstmt.setDate(1, new java.sql.Date(fDate.getTime()));
        } else {
            cstmt.setNull(1, java.sql.Types.DATE);
        }

        if (toDate != null && !"".equals(toDate)) {
            Date tDate = df.parse(toDate);
            cstmt.setDate(2, new java.sql.Date(tDate.getTime()));
        } else {
            cstmt.setNull(2, java.sql.Types.DATE);
        }
        cstmt.setString(3, reportsDto.getAccount_number());
        cstmt.setString(4, reportsDto.getOrder_no());
        cstmt.setString(5, reportsDto.getLogical_si_no());
        cstmt.setString(6, reportsDto.getLine_it_no());
        cstmt.setString(7, reportsDto.getCkt_id());
        cstmt.setString(8, reportsDto.getM6orderno());
        cstmt.setString(9, pagingSorting.getSortByColumn());
        cstmt.setString(10, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));
        cstmt.setInt(11, pagingSorting.getStartRecordId());
        cstmt.setInt(12, pagingSorting.getEndRecordId());
        cstmt.setInt(13, (pagingSorting.isPagingToBeDone() ? 1 : 0));

        rs = cstmt.executeQuery();
        while (rs.next()) {
            dto = new ArchivalReportDto();
            dto.setService_stage_description(rs.getString("SERVICE_STAGE_DESCRIPTION"));
            dto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            dto.setLogical_si_no(rs.getString("LOGICAL_SI_NO"));
            dto.setAccount_id(rs.getString("ACCOUNT_ID"));
            dto.setLine_it_no(rs.getString("LINE_IT_NO"));
            dto.setAccount_manager(rs.getString("ACCOUNT_MANAGER"));
            dto.setAccount_number(rs.getString("ACCOUNT_NUMBER"));
            dto.setPo_amount(rs.getDouble("PO_AMOUNT"));
            dto.setCustomer_segment(rs.getString("CUSTOMER_SEGMENT"));
            dto.setAccount_category(rs.getString("ACCOUNT_CATEGORY"));
            dto.setVertical(rs.getString("VERTICAL"));
            dto.setBilling_charge_start_date(rs.getString("BILLING_CHARGE_START_DATE"));

            if (rs.getString("BILLING_CHARGE_START_DATE") != null
                    && !"".equals(rs.getString("BILLING_CHARGE_START_DATE"))) {
                dto.setBilling_charge_start_date(
                        (utility.showDate_Report2(dto.getBilling_charge_start_date())).toUpperCase());
            }

            dto.setLine_name(rs.getString("SERVICE_NAME"));
            dto.setOrder_line_no(rs.getString("ORDER_LINE_NO"));
            dto.setCharge_name(rs.getString("LINE_NAME"));
            dto.setCancel_flag(rs.getString("CANCEL_FLAG"));
            dto.setProvision_bandwidth(rs.getString("PROVISION_BANDWIDTH"));
            dto.setUom(rs.getString("UOM"));
            dto.setBill_uom(rs.getString("BILL_UOM"));
            dto.setCategory_of_order(rs.getString("CATEGORY_OF_ORDER"));
            dto.setContract_period(rs.getString("CONTRACT_PERIOD"));
            dto.setCompany_name(rs.getString("COMPANY_NAME"));
            dto.setOrder_creation_date(rs.getString("ORDER_CREATION_DATE"));

            if (rs.getString("ORDER_CREATION_DATE") != null
                    && !"".equals(rs.getString("ORDER_CREATION_DATE"))) {

                dto.setOrder_creation_date(
                        (utility.showDate_Report(dto.getOrder_creation_date())).toUpperCase());
            }

            dto.setCustomer_service_rfs_date(rs.getString("CUSTOMER_SERVICE_RFS_DATE"));

            if (rs.getString("CUSTOMER_SERVICE_RFS_DATE") != null
                    && !"".equals(rs.getString("CUSTOMER_SERVICE_RFS_DATE"))) {
                dto.setCustomer_service_rfs_date(
                        (utility.showDate_Report2(dto.getCustomer_service_rfs_date())).toUpperCase());
            }

            dto.setCurrency(rs.getString("CURRENCY"));
            dto.setCharge_name(rs.getString("CHARGE_NAME"));
            dto.setCustomer_po_date(rs.getString("CUSTOMER_PO_DATE"));

            if (rs.getString("CUSTOMER_PO_DATE") != null && !"".equals(rs.getString("CUSTOMER_PO_DATE"))) {

                dto.setCustomer_po_date((utility.showDate_Report2(dto.getCustomer_po_date())).toUpperCase());
            }

            dto.setCustomer_po_number(rs.getString("CUSTOMER_PO_NUMBER"));
            dto.setCyclic_or_non_cyclic(rs.getString("CYCLIC_OR_NON_CYCLIC"));
            dto.setChallen_no(rs.getString("CHALLEN_NO"));
            dto.setOrder_no(rs.getString("ORDER_NO"));
            dto.setFrom_site(rs.getString("FROM_SITE"));
            dto.setTo_site(rs.getString("TO_SITE"));
            dto.setItem_quantity(rs.getString("ITEM_QUANTITY"));
            dto.setKms_distance(rs.getString("KMS_DISTANCE"));
            dto.setLine_item_amount(rs.getDouble("LINE_ITEM_AMOUNT"));
            dto.setCopc_approved_date(rs.getString("COPC_APPROVED_DATE"));

            if (rs.getString("COPC_APPROVED_DATE") != null && !"".equals(rs.getString("COPC_APPROVED_DATE"))) {
                dto.setCopc_approved_date(
                        utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVED_DATE").getTime())));
            }

            dto.setLine_item_description(rs.getString("LINE_ITEM_DESCRIPTION"));
            dto.setLoc_date(rs.getString("LOC_Date"));

            if (rs.getString("LOC_Date") != null && !"".equals(rs.getString("LOC_Date"))) {
                dto.setLoc_date((utility.showDate_Report2(dto.getLoc_date())).toUpperCase());
            }

            dto.setAccount_manager_receive_date(rs.getString("ACCOUNT_MANAGER_RECEIVE_DATE"));
            if (rs.getString("ACCOUNT_MANAGER_RECEIVE_DATE") != null
                    && !"".equals(rs.getString("ACCOUNT_MANAGER_RECEIVE_DATE"))) {
                dto.setAccount_manager_receive_date(
                        (utility.showDate_Report2(dto.getAccount_manager_receive_date())).toUpperCase());
            }

            dto.setOrder_total(rs.getDouble("ORDER_TOTAL"));
            dto.setTaxation(rs.getString("TAXATION"));
            dto.setTaxexemption_reason(rs.getString("TAXEXEMPTION_REASON"));
            dto.setLicence_company(rs.getString("LICENCE_COMPANY"));
            dto.setLogical_circuit_id(rs.getString("LOGICAL_CIRCUIT_ID"));
            dto.setOrder_type(rs.getString("ORDER_TYPE"));
            dto.setPayment_term(rs.getString("PAYMENT_TERM"));
            dto.setProject_mgr(rs.getString("PROJECT_MGR"));
            dto.setRegion_name(rs.getString("REGION_NAME"));
            dto.setOld_line_item_amount(rs.getString("OLD_LINE_ITEM_AMOUNT"));
            dto.setDemo_type(rs.getString("DEMO_TYPE"));
            dto.setParty_name(rs.getString("PARTY_NAME"));
            dto.setOrder_stage_description(rs.getString("ORDER_STAGE_DESCRIPTION"));
            dto.setCharge_end_date(rs.getString("CHARGE_END_DATE"));

            if (rs.getString("CHARGE_END_DATE") != null && !"".equals(rs.getString("CHARGE_END_DATE"))) {
                dto.setCharge_end_date((utility.showDate_Report2(dto.getCharge_end_date())).toUpperCase());
            }

            dto.setEnd_date_logic(rs.getString("END_DATE_LOGIC"));
            dto.setNew_order_remark(rs.getString("NEW_ORDER_REMARK"));
            dto.setRemarks(rs.getString("REMARKS"));
            dto.setService_order_type(rs.getString("SERVICE_ORDER_TYPE"));
            dto.setOsp(rs.getString("OSP"));
            dto.setOpportunity_id(rs.getString("OPPORTUNITY_ID"));
            dto.setStore_address(rs.getString("STORE_ADDRESS"));
            dto.setCustomer_rfs_date(rs.getString("CUSTOMER_RFS_DATE"));
            if (rs.getString("CUSTOMER_RFS_DATE") != null && !"".equals(rs.getString("CUSTOMER_RFS_DATE"))) {
                dto.setCustomer_rfs_date((utility.showDate_Report2(dto.getCustomer_rfs_date())).toUpperCase());
            }

            dto.setOrder_entry_date(rs.getString("ORDER_ENTRY_DATE"));
            if (rs.getString("ORDER_ENTRY_DATE") != null && !"".equals(rs.getString("ORDER_ENTRY_DATE"))) {
                dto.setOrder_entry_date((utility.showDate_Report2(dto.getOrder_entry_date())).toUpperCase());
            }

            dto.setCkt_id(rs.getString("CKT_ID"));
            dto.getInterfaceid();

            if (pagingSorting.isPagingToBeDone() && recordCount == 0) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            docListDetails.add(dto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception e) {

        Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(cstmt);
            DbConnection.freeConnection(connection);
        } catch (Exception e) {
            System.out.println(">>>>>>>>>>>.");
        }
    }

    System.out.println("DTO_>>>>>>>>>>>>>>>end>>>>>>>>>>>>>");
    return docListDetails;

}

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

public ArrayList<ArchivalReportDto> cancelledReportOrder(ArchivalReportDto reportsDto) {

    String methodName = "cancelledReportOrder";
    String className = this.getClass().getName();
    String msg = "";
    boolean logToFile = true, logToConsole = true;

    Connection connection = null;
    CallableStatement cstmt = null;
    ResultSet rs = null;/*  w  w w . j  a v a  2 s  .c o  m*/
    ArrayList docListDetails = new ArrayList();
    int recordCount = 0;
    ArchivalReportDto dto = null;
    Utility utility = new Utility();
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    String fromDate = reportsDto.getFromdate();
    String toDate = reportsDto.getTodate();

    try {

        PagingSorting pagingSorting = reportsDto.getPagingSorting();
        pagingSorting.sync();// To calculate start index and Enc Index
        connection = DbConnection.getConnectionObject();
        cstmt = connection.prepareCall(sqlGetCancelledtReport);

        if (fromDate != null && !"".equals(fromDate)) {
            Date fDate = df.parse(fromDate);
            cstmt.setDate(1, new java.sql.Date(fDate.getTime()));
        } else {
            cstmt.setNull(1, java.sql.Types.DATE);
        }
        if (toDate != null && !"".equals(toDate)) {
            Date tDate = df.parse(toDate);
            cstmt.setDate(2, new java.sql.Date(tDate.getTime()));
        } else {
            cstmt.setNull(2, java.sql.Types.DATE);
        }

        cstmt.setString(3, reportsDto.getAccount_id());
        cstmt.setString(4, reportsDto.getOrder_no());
        cstmt.setString(5, reportsDto.getLogical_si_no());
        cstmt.setString(6, reportsDto.getLine_it_no());
        cstmt.setString(7, reportsDto.getCkt_id());
        cstmt.setString(8, reportsDto.getM6orderno());
        cstmt.setString(9, pagingSorting.getSortByColumn());
        cstmt.setString(10, PagingSorting.DB_Asc_Desc(pagingSorting.getSortByOrder()));
        cstmt.setInt(11, pagingSorting.getStartRecordId());
        cstmt.setInt(12, pagingSorting.getEndRecordId());
        cstmt.setInt(13, (pagingSorting.isPagingToBeDone() ? 1 : 0));

        rs = cstmt.executeQuery();
        while (rs.next()) {
            dto = new ArchivalReportDto();

            dto.setAccount_id(rs.getString("ACCOUNT_ID"));
            dto.setAccount_manager(rs.getString("ACCOUNT_MANAGER"));
            dto.setAccount_number(rs.getString("ACCOUNT_NUMBER"));
            dto.setPo_amount(rs.getDouble("PO_AMOUNT"));
            dto.setCustomer_segment(rs.getString("CUSTOMER_SEGMENT"));
            dto.setAccount_category(rs.getString("ACCOUNT_CATEGORY"));
            dto.setVertical(rs.getString("VERTICAL"));
            dto.setBilling_charge_start_date(rs.getString("BILLING_CHARGE_START_DATE"));
            if (rs.getString("BILLING_CHARGE_START_DATE") != null
                    && !"".equals(rs.getString("BILLING_CHARGE_START_DATE"))) {
                dto.setBilling_charge_start_date(
                        (utility.showDate_Report(dto.getBilling_charge_start_date())).toUpperCase());
            }

            dto.setService_name(rs.getString("SERVICE_NAME"));
            dto.setOrder_line_no(rs.getString("ORDER_LINE_NO"));
            dto.setLine_name(rs.getString("LINE_NAME"));
            dto.setCancel_flag(rs.getString("CANCEL_FLAG"));
            dto.setProvision_bandwidth(rs.getString("PROVISION_BANDWIDTH"));
            dto.setUom(rs.getString("UOM"));
            dto.setBilling_bandwidth(rs.getString("BILLING_BANDWIDTH"));
            dto.setStore_address(rs.getString("STORE_ADDRESS"));
            dto.setBill_uom(rs.getString("BILL_UOM"));
            dto.setCategory_of_order(rs.getString("CATEGORY_OF_ORDER"));
            dto.setContract_period(rs.getString("CONTRACT_PERIOD"));
            dto.setCompany_name(rs.getString("COMPANY_NAME"));
            dto.setCustomer_rfs_date(rs.getString("CUSTOMER_RFS_DATE"));

            if (rs.getString("CUSTOMER_RFS_DATE") != null && !"".equals(rs.getString("CUSTOMER_RFS_DATE"))) {
                dto.setCustomer_rfs_date((utility.showDate_Report3(dto.getCustomer_rfs_date())).toUpperCase());// issuee gui
            }

            dto.setCustomer_service_rfs_date(rs.getString("CUSTOMER_SERVICE_RFS_DATE"));

            if (rs.getString("CUSTOMER_SERVICE_RFS_DATE") != null
                    && !"".equals(rs.getString("CUSTOMER_SERVICE_RFS_DATE"))) {
                dto.setCustomer_service_rfs_date(
                        (utility.showDate_Report2(dto.getCustomer_service_rfs_date())).toUpperCase()); // issue GUI
            }

            dto.setCurrency(rs.getString("CURRENCY"));
            dto.setCharge_name(rs.getString("CHARGE_NAME"));
            dto.setCustomer_po_date(rs.getString("CUSTOMER_PO_DATE"));

            if (rs.getString("CUSTOMER_PO_DATE") != null && !"".equals(rs.getString("CUSTOMER_PO_DATE"))) {

                dto.setCustomer_po_date((utility.showDate_Report2(dto.getCustomer_po_date())).toUpperCase());
            }

            dto.setCustomer_po_number(rs.getString("CUSTOMER_PO_NUMBER"));
            dto.setCyclic_or_non_cyclic(rs.getString("CYCLIC_OR_NON_CYCLIC"));
            dto.setChallen_no(rs.getString("CHALLEN_NO"));
            dto.setOrder_no(rs.getString("ORDER_NO"));
            dto.setFrom_site(rs.getString("FROM_SITE"));
            dto.setTo_site(rs.getString("TO_SITE"));
            dto.setItem_quantity(rs.getString("ITEM_QUANTITY"));
            dto.setKms_distance(rs.getString("KMS_DISTANCE"));
            dto.setLine_item_amount(rs.getDouble("LINE_ITEM_AMOUNT"));
            dto.setCopc_approved_date(rs.getString("COPC_APPROVED_DATE"));

            if (rs.getString("COPC_APPROVED_DATE") != null && !"".equals(rs.getString("COPC_APPROVED_DATE"))) {
                dto.setCopc_approved_date(
                        utility.showDate_Report(new Date(rs.getTimestamp("COPC_APPROVED_DATE").getTime())));
            }

            dto.setLine_item_description(rs.getString("LINE_ITEM_DESCRIPTION"));
            dto.setLoc_date(rs.getString("LOC_DATE"));

            if (rs.getString("LOC_Date") != null && !"".equals(rs.getString("LOC_Date"))) {
                dto.setLoc_date((utility.showDate_Report2(dto.getLoc_date())).toUpperCase());
            }

            dto.setAccount_manager_receive_date(rs.getString("ACCOUNT_MANAGER_RECEIVE_DATE"));

            if (rs.getString("ACCOUNT_MANAGER_RECEIVE_DATE") != null
                    && !"".equals(rs.getString("ACCOUNT_MANAGER_RECEIVE_DATE"))) {
                dto.setAccount_manager_receive_date(
                        (utility.showDate_Report2(dto.getAccount_manager_receive_date())).toUpperCase());
            }

            dto.setOrder_total(rs.getDouble("ORDER_TOTAL"));
            dto.setOrder_entry_date(rs.getString("ORDER_ENTRY_DATE"));

            if (rs.getString("ORDER_ENTRY_DATE") != null && !"".equals(rs.getString("ORDER_ENTRY_DATE"))) {
                dto.setOrder_entry_date((utility.showDate_Report2(dto.getOrder_entry_date())).toUpperCase());
            }

            dto.setTaxation(rs.getString("TAXATION"));
            dto.setTaxexemption_reason(rs.getString("TAXEXEMPTION_REASON"));
            dto.setLicence_company(rs.getString("LICENCE_COMPANY"));
            dto.setLogical_circuit_id(rs.getString("LOGICAL_CIRCUIT_ID"));
            dto.setOrder_type(rs.getString("ORDER_TYPE"));
            dto.setPayment_term(rs.getString("PAYMENT_TERM"));
            dto.setProject_mgr(rs.getString("PROJECT_MGR"));
            dto.setRegion_name(rs.getString("REGION_NAME"));
            dto.setOld_line_item_amount(rs.getString("OLD_LINE_ITEM_AMOUNT"));
            dto.setDemo_type(rs.getString("DEMO_TYPE"));
            dto.setParty_name(rs.getString("PARTY_NAME"));
            dto.setOrder_stage_description(rs.getString("ORDER_STAGE_DESCRIPTION"));
            dto.setService_stage_description(rs.getString("SERVICE_STAGE_DESCRIPTION"));
            dto.setCharge_end_date(rs.getString("CHARGE_END_DATE"));

            if (rs.getString("CHARGE_END_DATE") != null && !"".equals(rs.getString("CHARGE_END_DATE"))) {
                dto.setCharge_end_date((utility.showDate_Report2(dto.getCharge_end_date())).toUpperCase());
            }

            dto.setEnd_date_logic(rs.getString("END_DATE_LOGIC"));
            dto.setNew_order_remark(rs.getString("NEW_ORDER_REMARK"));
            dto.setRemarks(rs.getString("REMARKS"));
            dto.setService_order_type(rs.getString("SERVICE_ORDER_TYPE"));
            dto.setOsp(rs.getString("OSP"));
            dto.setOpportunity_id(rs.getString("OPPORTUNITY_ID"));
            dto.setLogical_si_no(rs.getString("LOGICAL_SI_NO"));
            dto.setLine_it_no(rs.getString("LINE_IT_NO"));
            dto.setOrder_creation_date(rs.getString("ORDER_CREATION_DATE"));
            if (rs.getString("ORDER_CREATION_DATE") != null
                    && !"".equals(rs.getString("ORDER_CREATION_DATE"))) {
                dto.setOrder_creation_date(
                        (utility.showDate_Report(dto.getOrder_creation_date())).toUpperCase());
            }
            dto.setCkt_id(rs.getString("CKT_ID"));
            dto.setM6orderno(rs.getString("M6_ORDER_NO"));
            dto.setService_id(rs.getString("SERVICEID"));
            dto.setOldLsi(rs.getString("OLD_LSI"));
            dto.setCancel_reason(rs.getString("CANCEL_REASON"));
            dto.setCancel_date(rs.getString("CANCEL_DATE"));

            if (rs.getString("CANCEL_DATE") != null && !"".equals(rs.getString("CANCEL_DATE"))) {
                dto.setCancel_date((utility.showDate_Report2(dto.getCancel_date())).toUpperCase());
            }

            dto.setProduct(rs.getString("PRODUCT"));
            dto.setSub_product(rs.getString("SUB_PRODUCT"));
            dto.setEffective_start_data(rs.getString("EFFECTIVE_START_DATA"));

            if (rs.getString("EFFECTIVE_START_DATA") != null
                    && !"".equals(rs.getString("EFFECTIVE_START_DATA"))) {
                dto.setEffective_start_data(
                        (utility.showDate_Report(dto.getEffective_start_data())).toUpperCase());
            }
            dto.getInterfaceid();
            docListDetails.add(dto);
            if (pagingSorting.isPagingToBeDone() && recordCount == 0) {
                recordCount = rs.getInt("FULL_REC_COUNT");
            }
            docListDetails.add(dto);
        }
        pagingSorting.setRecordCount(recordCount);
    } catch (Exception e) {

        Utility.onEx_LOG_RET_NEW_EX(e, methodName, className, msg, logToFile, logToConsole);
    } finally {
        try {
            DbConnection.closeResultset(rs);
            DbConnection.closeCallableStatement(cstmt);
            DbConnection.freeConnection(connection);
        } catch (Exception e) {
        }
    }

    return docListDetails;

}