package wenrgise.hrms.ejb.business; import java.sql.Timestamp; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import wenrgise.common.bean.BaseHeaderBean; import wenrgise.common.exception.EnrgiseApplicationException; import wenrgise.common.exception.EnrgiseSystemException; import wenrgise.common.utility.RecordMetaInfo; import wenrgise.common.utility.UserInfo; import wenrgise.common.vo.BaseDetailVO; import wenrgise.common.vo.BaseQueryVO; import wenrgise.ejb.common.helper.DBObject; import wenrgise.ejb.common.helper.QueryRow; import wenrgise.ejb.common.helper.QueryValue; import wenrgise.ejb.common.utility.DBUtilitiesBean; import wenrgise.hrms.bean.HrmGenEligRuleQueryDtlBean; import wenrgise.hrms.bean.HrmGenEligRuleQueryHdrBean; import wenrgise.hrms.vo.HrmGenEligRuleQueryQVO; public class HrmGenEligRuleQueryBO extends HrmBaseBO { public HrmGenEligRuleQueryBO() {} public HrmGenEligRuleQueryBO(UserInfo oUserInfo) { super(oUserInfo); } public void initializeBOImpl() { this.headerTable = "HRM_LEAVE_ATTR_DTL"; } public String saveNewHeaderImpl(BaseHeaderBean oBaseHdrBean) throws EnrgiseSystemException { return null; } public String saveHeaderImpl(BaseHeaderBean oBaseHdrBean, String ScreenMode) throws EnrgiseSystemException { return null; } public void updateHeaderImpl(BaseHeaderBean oBaseHdrBean) throws EnrgiseSystemException { System.out.println("Update ille!"); } public RecordMetaInfo getHrmGenEligRuleQueryDetailMetaInfo(BaseQueryVO oBaseQVO) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList oParameters = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList oOutArray = null; HrmGenEligRuleQueryQVO oQVO = (HrmGenEligRuleQueryQVO)oBaseQVO; if (oQVO.getDocType().equals("V")) { oParameters = new ArrayList(); oParameters.add(new DBObject(1, 2, -5)); oParameters.add(new DBObject(2, 2, 93)); oParameters.add(new DBObject(3, 2, 12)); oParameters.add(new DBObject(4, 2, 12)); oParameters.add(new DBObject(5, 2, 4)); oOutArray = oBean.callProc(oParameters, "HRMELIGRULEQUERY.proc_LeaveQueryDtlCount(?,?,?,?,?)"); } if (oQVO.getDocType().equals("L")) { oParameters = new ArrayList(); oParameters.add(new DBObject(1, 2, -5)); oParameters.add(new DBObject(2, 2, 93)); oParameters.add(new DBObject(3, 2, 12)); oParameters.add(new DBObject(4, 2, 12)); oParameters.add(new DBObject(5, 2, 4)); oOutArray = oBean.callProc(oParameters, "HRMELIGRULEQUERY.proc_LoanQueryDtlCount(?,?,?,?,?)"); } if (oQVO.getDocType().equals("A")) { oParameters = new ArrayList(); oParameters.add(new DBObject(1, 2, -5)); oParameters.add(new DBObject(2, 2, 93)); oParameters.add(new DBObject(3, 2, 12)); oParameters.add(new DBObject(4, 2, 12)); oParameters.add(new DBObject(5, 2, 4)); oOutArray = oBean.callProc(oParameters, "HRMELIGRULEQUERY.proc_AdvanceQueryDtlCount(?,?,?,?,?)"); } if (oQVO.getDocType().equals("S")) { oParameters = new ArrayList(); oParameters.add(new DBObject(1, 2, -5)); oParameters.add(new DBObject(2, 2, 93)); oParameters.add(new DBObject(3, 2, 12)); oParameters.add(new DBObject(4, 2, 12)); oParameters.add(new DBObject(5, 2, 4)); oOutArray = oBean.callProc(oParameters, "HRMELIGRULEQUERY.proc_SeparationQueryDtlCount(?,?,?,?,?)"); } if (oQVO.getDocType().equals("C")) { oParameters = new ArrayList(); oParameters.add(new DBObject(1, 2, -5)); oParameters.add(new DBObject(2, 2, 93)); oParameters.add(new DBObject(3, 2, 12)); oParameters.add(new DBObject(4, 2, 12)); oParameters.add(new DBObject(5, 2, 4)); oOutArray = oBean.callProc(oParameters, "HRMELIGRULEQUERY.proc_ClaimQueryDtlCount(?,?,?,?,?)"); } RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo(); DBObject oTotalRecord = oOutArray.get(0); oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue()); DBObject oTimeObject = oOutArray.get(1); oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject()); return oRecordMetaInfo; } public ArrayList getHrmGenEligRuleQueryDetail(BaseQueryVO oBaseQVO, long lAbsoluteStart, long lAbsoluteEnd) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList oParameters = new ArrayList(); HrmGenEligRuleQueryQVO oQVO = (HrmGenEligRuleQueryQVO)oBaseQVO; DBUtilitiesBean oBean = new DBUtilitiesBean(); int count = 0; ArrayList oOutArray = null; BaseDetailVO oBaseDetailVO = null; ArrayList arylstDetail = null; if (oQVO.getDocType().equals("V")) { oParameters = new ArrayList(); oParameters.add(new DBObject(1, 1, -5, new Long(lAbsoluteStart))); oParameters.add(new DBObject(2, 1, -5, new Long(lAbsoluteEnd))); oParameters.add(new DBObject(3, 2, -10)); oParameters.add(new DBObject(4, 2, 12)); oParameters.add(new DBObject(5, 2, 12)); oParameters.add(new DBObject(6, 2, 4)); oOutArray = oBean.callProc(oParameters, "HRMELIGRULEQUERY.proc_LeaveQueryDtlInfo(?,?,?,?,?,?)"); } if (oQVO.getDocType().equals("L")) { oParameters = new ArrayList(); oParameters.add(new DBObject(1, 1, -5, new Long(lAbsoluteStart))); oParameters.add(new DBObject(2, 1, -5, new Long(lAbsoluteEnd))); oParameters.add(new DBObject(3, 2, -10)); oParameters.add(new DBObject(4, 2, 12)); oParameters.add(new DBObject(5, 2, 12)); oParameters.add(new DBObject(6, 2, 4)); oOutArray = oBean.callProc(oParameters, "HRMELIGRULEQUERY.proc_LoanQueryDtlInfo(?,?,?,?,?,?)"); } if (oQVO.getDocType().equals("A")) { oParameters = new ArrayList(); oParameters.add(new DBObject(1, 1, -5, new Long(lAbsoluteStart))); oParameters.add(new DBObject(2, 1, -5, new Long(lAbsoluteEnd))); oParameters.add(new DBObject(3, 2, -10)); oParameters.add(new DBObject(4, 2, 12)); oParameters.add(new DBObject(5, 2, 12)); oParameters.add(new DBObject(6, 2, 4)); oOutArray = oBean.callProc(oParameters, "HRMELIGRULEQUERY.proc_AdvanceQueryDtlInfo(?,?,?,?,?,?)"); } if (oQVO.getDocType().equals("S")) { oParameters = new ArrayList(); oParameters.add(new DBObject(1, 1, -5, new Long(lAbsoluteStart))); oParameters.add(new DBObject(2, 1, -5, new Long(lAbsoluteEnd))); oParameters.add(new DBObject(3, 2, -10)); oParameters.add(new DBObject(4, 2, 12)); oParameters.add(new DBObject(5, 2, 12)); oParameters.add(new DBObject(6, 2, 4)); oOutArray = oBean.callProc(oParameters, "HRMELIGRULEQUERY.proc_SeparationQueryDtlInfo(?,?,?,?,?,?)"); } if (oQVO.getDocType().equals("C")) { oParameters = new ArrayList(); oParameters.add(new DBObject(1, 1, -5, new Long(lAbsoluteStart))); oParameters.add(new DBObject(2, 1, -5, new Long(lAbsoluteEnd))); oParameters.add(new DBObject(3, 2, -10)); oParameters.add(new DBObject(4, 2, 12)); oParameters.add(new DBObject(5, 2, 12)); oParameters.add(new DBObject(6, 2, 4)); oOutArray = oBean.callProc(oParameters, "HRMELIGRULEQUERY.proc_ClaimQueryDtlInfo(?,?,?,?,?,?)"); } DBObject oOutObject = oOutArray.get(0); ArrayList oList = (ArrayList)oOutObject.getObject(); if (oList.size() == 0) throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M"); QueryRow oRow = null; QueryValue oValue = null; HashMap oColumns = null; Iterator oIt = oList.iterator(); while (oIt.hasNext()) { if (count == 0) arylstDetail = new ArrayList(); count++; oRow = oIt.next(); HrmGenEligRuleQueryDtlBean oDtlBean = new HrmGenEligRuleQueryDtlBean(); oDtlBean.setDetailId(oRow.get("ID").getString()); oDtlBean.setTxtdocCode(oRow.get("description").getString()); String sElig = oRow.get("ELIG_SQL").getString(); if (sElig.equalsIgnoreCase("Y")) { sElig = "Applicable for All"; } else { sElig = oRow.get("eligibility").getString(); } oDtlBean.setTxteligSql(sElig); arylstDetail.add(oDtlBean); } return arylstDetail; } public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {} public void saveDetailImpl(BaseHeaderBean oBaseHdrBean, String sScreenName, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException { boolean bDelete = false; ArrayList arylstParameters = new ArrayList(); DBUtilitiesBean oBean = null; DBUtilitiesBean oBean1 = null; HrmGenEligRuleQueryHdrBean oHrmGenEligRuleQueryHdrBean = (HrmGenEligRuleQueryHdrBean)oBaseHdrBean; oBean1 = new DBUtilitiesBean(); if (oHrmGenEligRuleQueryHdrBean.getDocType().equalsIgnoreCase("V")) oBean1.createBatch("HRMELIGRULEQUERY.proc_DeleteLeaveEligQuery(?)"); if (oHrmGenEligRuleQueryHdrBean.getDocType().equalsIgnoreCase("L")) oBean1.createBatch("HRMELIGRULEQUERY.proc_DeleteLoanEligQuery(?)"); if (oHrmGenEligRuleQueryHdrBean.getDocType().equalsIgnoreCase("A")) oBean1.createBatch("HRMELIGRULEQUERY.proc_DeleteAdvanceEligQuery(?)"); if (oHrmGenEligRuleQueryHdrBean.getDocType().equalsIgnoreCase("S")) oBean1.createBatch("HRMELIGRULEQUERY.proc_DeleteSeparationEligQuery(?)"); if (oHrmGenEligRuleQueryHdrBean.getDocType().equalsIgnoreCase("C")) oBean1.createBatch("HRMELIGRULEQUERY.proc_DeleteClaimEligQuery(?)"); Iterator itrBean = arylstDetailBeanArray.iterator(); while (itrBean.hasNext()) { HrmGenEligRuleQueryDtlBean oHrmGenEligRuleQueryDtlBean = itrBean.next(); if (oHrmGenEligRuleQueryDtlBean.getStatus().equals("D")) { arylstParameters.add(new DBObject(1, 1, 12, oHrmGenEligRuleQueryDtlBean.getDetailId())); oBean1.addToBatch(arylstParameters); } } oBean1.executeBatch(); } public void additionalFieldValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {} public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {} public void additionalBusinessValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {} }