package wenrgise.hrms.businessdelegate; import java.rmi.RemoteException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import javax.ejb.CreateException; import wenrgise.common.bean.BaseHeaderBean; import wenrgise.common.exception.EnrgiseApplicationException; import wenrgise.common.exception.EnrgiseSystemException; import wenrgise.common.utility.EnrgiseUtil; import wenrgise.common.utility.RecordMetaInfo; import wenrgise.common.vo.BaseQueryVO; import wenrgise.common.vo.ThisPageVO; import wenrgise.ejb.common.utility.ServiceLocator; import wenrgise.hrms.bean.HrmLnAppHdrBean; import wenrgise.hrms.ejb.facade.HrmFacade; import wenrgise.hrms.ejb.facade.HrmFacadeHome; import wenrgise.hrms.vo.HrmLnAppQVO; public class HrmLnAppBD extends HrmBaseBD { public RecordMetaInfo getHeaderMetaImpl(BaseQueryVO oQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException { try { HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade"); HrmFacade oHrmFacade = oHome.create(); return oHrmFacade.getHrmLoanAppHdrMetaInfo((HrmLnAppQVO)oQueryVO, this.oUserInfo); } catch (RemoteException oRe) { throw new EnrgiseSystemException(oRe); } catch (CreateException oCrt) { throw new EnrgiseSystemException(oCrt); } } public ArrayList getHeaderRecordImpl(BaseQueryVO oQueryVO, long lStartPosition, long lLastPosition) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException { try { HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade"); HrmFacade oHrmFacade = oHome.create(); ArrayList oHeaderList = oHrmFacade.getHrmLoanAppHdrInfo((HrmLnAppQVO)oQueryVO, lStartPosition, lLastPosition, this.oUserInfo); return oHeaderList; } catch (RemoteException oRe) { throw new EnrgiseSystemException(oRe); } catch (CreateException oCrt) { throw new EnrgiseSystemException(oCrt); } } public RecordMetaInfo getTotalDetailRecordCountImpl(String lPrimaryKey, String sScreenName) throws EnrgiseApplicationException, EnrgiseSystemException { try { HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade"); HrmFacade oHrmFacade = oHome.create(); if (sScreenName.equalsIgnoreCase("HrmLnApp")) return oHrmFacade.getHrmLnDisDtlMetaInfo(lPrimaryKey, this.oUserInfo); if (sScreenName.equalsIgnoreCase("HrmLnDisDtl")) return oHrmFacade.getHrmLnDisDtlMetaInfo(lPrimaryKey, this.oUserInfo); if (sScreenName.equalsIgnoreCase("HrmLnAppHblIntRate")) return oHrmFacade.getHrmLnHblIntRateMetaInfo(lPrimaryKey, this.oUserInfo); RecordMetaInfo obj = new RecordMetaInfo(); return obj; } catch (RemoteException oRe) { throw new EnrgiseSystemException(oRe); } catch (CreateException oCrt) { throw new EnrgiseSystemException(oCrt); } } public ArrayList getDetailRecordImpl(String lPrimaryKey, String sScreenName, long lAbsoluteStart, long lAbsoluteEnd) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException { try { HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade"); HrmFacade oHrmFacade = oHome.create(); if (sScreenName.equalsIgnoreCase("HrmLnApp")) return oHrmFacade.getHrmLnDisDtl(lPrimaryKey, lAbsoluteStart, lAbsoluteEnd, this.oUserInfo); if (sScreenName.equalsIgnoreCase("HrmLnDisDtl")) return oHrmFacade.getHrmLnDisDtl(lPrimaryKey, lAbsoluteStart, lAbsoluteEnd, this.oUserInfo); if (sScreenName.equalsIgnoreCase("HrmLnAppHblIntRate")) return oHrmFacade.getHrmLnHblIntRateDtl(lPrimaryKey, lAbsoluteStart, lAbsoluteEnd, this.oUserInfo); ArrayList obj = new ArrayList(); return obj; } catch (RemoteException oRe) { throw new EnrgiseSystemException(oRe); } catch (CreateException oCrt) { throw new EnrgiseSystemException(oCrt); } } public boolean updateHeaderRecordImpl(BaseHeaderBean oBaseHeaderBean) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException { return true; } public String saveImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException { try { HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade"); HrmFacade oHrmFacade = oHome.create(); if (sScreenName.equalsIgnoreCase("HrmLnApp")) return oHrmFacade.saveHrmLnDisDtl((HrmLnAppHdrBean)oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, oDetailBeanArray, bDetailDataChanged, oDetailPicked, this.oUserInfo); if (sScreenName.equalsIgnoreCase("HrmLnAppHblIntRate")) return oHrmFacade.saveHrmLnHblIntRateDtl((HrmLnAppHdrBean)oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, oDetailBeanArray, bDetailDataChanged, oDetailPicked, this.oUserInfo); } catch (CreateException oCrt) { throw new EnrgiseSystemException(oCrt); } return null; } public String getInsertDataImpl(BaseQueryVO oQueryVO) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException { return "Only Implementation"; } public Map getDisabledFieldsImpl(ThisPageVO oThisPageVO) throws EnrgiseApplicationException, EnrgiseSystemException { HashMap oHashMap = new HashMap(); ArrayList arylstEnableList = new ArrayList(); ArrayList arylstDisableList = new ArrayList(); ArrayList test = new ArrayList(); HrmLnAppHdrBean oHrmLnAppHdrBean = (HrmLnAppHdrBean)oThisPageVO.getOHeaderBean(); ArrayList oList = oThisPageVO.getODetailList(); if (oThisPageVO.getScreenMode().equals("Q")) { arylstEnableList.add("butEmployeeNo"); if (EnrgiseUtil.checkString(oHrmLnAppHdrBean.getEmpId())) { arylstEnableList.add("butLoanCode"); } else { arylstDisableList.add("butLoanCode"); } arylstDisableList.add("butApproverNo"); arylstDisableList.add("remarks"); arylstDisableList.add("instAmount"); arylstDisableList.add("totalInterestInst"); arylstDisableList.add("totalPrincipalInst"); arylstDisableList.add("totalInst"); arylstDisableList.add("payrollMonth"); arylstDisableList.add("appliedAmount"); arylstDisableList.add("loanDetails"); arylstDisableList.add("hblAppliedFor"); arylstDisableList.add("hblBranhConst"); arylstDisableList.add("hblDocSubmitted"); arylstDisableList.add("hblCity"); arylstDisableList.add("hblPO"); arylstDisableList.add("hblDistrict"); arylstDisableList.add("hblMouza"); arylstDisableList.add("hblKhatian"); arylstDisableList.add("hblDag"); arylstDisableList.add("hblNoOfDeed"); arylstDisableList.add("hblParentDeed"); arylstDisableList.add("hblVolOfDeed"); arylstDisableList.add("hblBookNo"); arylstDisableList.add("hblPageNo"); arylstDisableList.add("hblRegisteredAt"); arylstDisableList.add("sanctionedAmount"); arylstDisableList.add("butApplnDate"); arylstDisableList.add("butSanctionDate"); arylstDisableList.add("bulkAmount"); arylstDisableList.add("butBulkPayment"); arylstDisableList.add("butBulkPaymentDate"); } if (oThisPageVO.getScreenMode().equals("N")) { arylstEnableList.add("butEmployeeNo"); if (EnrgiseUtil.checkString(oHrmLnAppHdrBean.getEmpId())) { arylstEnableList.add("butLoanCode"); } else { arylstDisableList.add("butLoanCode"); } arylstEnableList.add("butApproverNo"); arylstEnableList.add("sanctionedAmount"); arylstEnableList.add("remarks"); arylstEnableList.add("instAmount"); arylstEnableList.add("totalInterestInst"); arylstEnableList.add("totalPrincipalInst"); arylstEnableList.add("totalInst"); arylstEnableList.add("payrollMonth"); arylstEnableList.add("appliedAmount"); arylstEnableList.add("loanDetails"); arylstEnableList.add("butApplnDate"); arylstEnableList.add("butSanctionDate"); arylstDisableList.add("bulkAmount"); arylstDisableList.add("butBulkPayment"); arylstDisableList.add("butBulkPaymentDate"); if (EnrgiseUtil.checkString(oHrmLnAppHdrBean.getLoanCode())) { if (oHrmLnAppHdrBean.getLoanCode().equalsIgnoreCase("99")) { arylstEnableList.add("hblAppliedFor"); arylstEnableList.add("hblBranhConst"); arylstEnableList.add("hblDocSubmitted"); arylstEnableList.add("hblCity"); arylstEnableList.add("hblPO"); arylstEnableList.add("hblDistrict"); arylstEnableList.add("hblMouza"); arylstEnableList.add("hblKhatian"); arylstEnableList.add("hblDag"); arylstEnableList.add("hblNoOfDeed"); arylstEnableList.add("hblParentDeed"); arylstEnableList.add("hblVolOfDeed"); arylstEnableList.add("hblBookNo"); arylstEnableList.add("hblPageNo"); arylstEnableList.add("hblRegisteredAt"); } else { arylstDisableList.add("hblAppliedFor"); arylstDisableList.add("hblBranhConst"); arylstDisableList.add("hblDocSubmitted"); arylstDisableList.add("hblCity"); arylstDisableList.add("hblPO"); arylstDisableList.add("hblDistrict"); arylstDisableList.add("hblMouza"); arylstDisableList.add("hblKhatian"); arylstDisableList.add("hblDag"); arylstDisableList.add("hblNoOfDeed"); arylstDisableList.add("hblParentDeed"); arylstDisableList.add("hblVolOfDeed"); arylstDisableList.add("hblBookNo"); arylstDisableList.add("hblPageNo"); arylstDisableList.add("hblRegisteredAt"); } } else { arylstDisableList.add("hblAppliedFor"); arylstDisableList.add("hblBranhConst"); arylstDisableList.add("hblDocSubmitted"); arylstDisableList.add("hblCity"); arylstDisableList.add("hblPO"); arylstDisableList.add("hblDistrict"); arylstDisableList.add("hblMouza"); arylstDisableList.add("hblKhatian"); arylstDisableList.add("hblDag"); arylstDisableList.add("hblNoOfDeed"); arylstDisableList.add("hblParentDeed"); arylstDisableList.add("hblVolOfDeed"); arylstDisableList.add("hblBookNo"); arylstDisableList.add("hblPageNo"); arylstDisableList.add("hblRegisteredAt"); } } if (oThisPageVO.getScreenMode().equals("U")) { if (EnrgiseUtil.checkString(oHrmLnAppHdrBean.getFullyRepaid())) if (String.valueOf(oHrmLnAppHdrBean.getFullyRepaid()).equalsIgnoreCase("on")) { arylstDisableList.add("butBulkPayment"); arylstDisableList.add("bulkAmount"); arylstDisableList.add("butBulkPaymentDate"); } else if (EnrgiseUtil.checkString(oHrmLnAppHdrBean.getMode())) { if (oHrmLnAppHdrBean.getMode().equalsIgnoreCase("B")) { arylstDisableList.add("butBulkPayment"); arylstEnableList.add("bulkAmount"); arylstEnableList.add("butBulkPaymentDate"); } else { arylstEnableList.add("butBulkPayment"); arylstDisableList.add("bulkAmount"); arylstDisableList.add("butBulkPaymentDate"); } } else { arylstEnableList.add("butBulkPayment"); arylstDisableList.add("bulkAmount"); arylstDisableList.add("butBulkPaymentDate"); } arylstDisableList.add("butEmployeeNo"); if (EnrgiseUtil.checkString(oHrmLnAppHdrBean.getEmpId())) { arylstEnableList.add("butLoanCode"); } else { arylstDisableList.add("butLoanCode"); } arylstEnableList.add("butApproverNo"); arylstEnableList.add("remarks"); arylstEnableList.add("instAmount"); arylstEnableList.add("totalInterestInst"); arylstEnableList.add("totalPrincipalInst"); arylstEnableList.add("totalInst"); if (EnrgiseUtil.checkString(oHrmLnAppHdrBean.getNoOfInstPaid())) { if (Integer.parseInt(oHrmLnAppHdrBean.getNoOfInstPaid()) > 0) { arylstDisableList.add("payrollMonth"); } else { arylstEnableList.add("payrollMonth"); } } else { arylstEnableList.add("payrollMonth"); } arylstEnableList.add("appliedAmount"); arylstEnableList.add("loanDetails"); arylstEnableList.add("butApplnDate"); arylstEnableList.add("butSanctionDate"); if (EnrgiseUtil.checkString(oHrmLnAppHdrBean.getLoanCode())) { if (oHrmLnAppHdrBean.getLoanCode().equalsIgnoreCase("99")) { arylstEnableList.add("hblAppliedFor"); arylstEnableList.add("hblBranhConst"); arylstEnableList.add("hblDocSubmitted"); arylstEnableList.add("hblCity"); arylstEnableList.add("hblPO"); arylstEnableList.add("hblDistrict"); arylstEnableList.add("hblMouza"); arylstEnableList.add("hblKhatian"); arylstEnableList.add("hblDag"); arylstEnableList.add("hblNoOfDeed"); arylstEnableList.add("hblParentDeed"); arylstEnableList.add("hblVolOfDeed"); arylstEnableList.add("hblBookNo"); arylstEnableList.add("hblPageNo"); arylstEnableList.add("hblRegisteredAt"); arylstDisableList.add("disabtabHblIntRate"); } else { arylstDisableList.add("hblAppliedFor"); arylstDisableList.add("hblBranhConst"); arylstDisableList.add("hblDocSubmitted"); arylstDisableList.add("hblCity"); arylstDisableList.add("hblPO"); arylstDisableList.add("hblDistrict"); arylstDisableList.add("hblMouza"); arylstDisableList.add("hblKhatian"); arylstDisableList.add("hblDag"); arylstDisableList.add("hblNoOfDeed"); arylstDisableList.add("hblParentDeed"); arylstDisableList.add("hblVolOfDeed"); arylstDisableList.add("hblBookNo"); arylstDisableList.add("hblPageNo"); arylstDisableList.add("hblRegisteredAt"); arylstEnableList.add("disabtabHblIntRate"); } } else { arylstDisableList.add("hblAppliedFor"); arylstDisableList.add("hblBranhConst"); arylstDisableList.add("hblDocSubmitted"); arylstDisableList.add("hblCity"); arylstDisableList.add("hblPO"); arylstDisableList.add("hblDistrict"); arylstDisableList.add("hblMouza"); arylstDisableList.add("hblKhatian"); arylstDisableList.add("hblDag"); arylstDisableList.add("hblNoOfDeed"); arylstDisableList.add("hblParentDeed"); arylstDisableList.add("hblVolOfDeed"); arylstDisableList.add("hblBookNo"); arylstDisableList.add("hblPageNo"); arylstDisableList.add("hblRegisteredAt"); arylstEnableList.add("disabtabHblIntRate"); } } oHashMap.put("D", arylstDisableList); oHashMap.put("E", arylstEnableList); return oHashMap; } public String submitImpl(String sButtonName, BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException { try { String sHeaderPrimaryKey = null; HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade"); HrmFacade oHrmFacade = oHome.create(); if (sButtonName.equalsIgnoreCase("butBulkPayment")) sHeaderPrimaryKey = oHrmFacade.loanAppBulkPayment((HrmLnAppHdrBean)oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, oDetailBeanArray, bDetailDataChanged, oDetailPicked, this.oUserInfo); return sHeaderPrimaryKey; } catch (RemoteException oRe) { throw new EnrgiseSystemException(oRe); } catch (CreateException oCrt) { throw new EnrgiseSystemException(oCrt); } } }