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.DateUtility; import wenrgise.common.utility.RecordMetaInfo; import wenrgise.common.utility.UserInfo; import wenrgise.ejb.common.helper.DBObject; import wenrgise.ejb.common.helper.QueryRow; import wenrgise.ejb.common.utility.DBUtilitiesBean; import wenrgise.hrms.bean.HrmGenEligRuleHdrBean; import wenrgise.hrms.vo.HrmGenEligRuleQVO; public class HrmGenEligRuleBO extends HrmBaseBO { public HrmGenEligRuleBO() {} public HrmGenEligRuleBO(UserInfo oUserInfo) { super(oUserInfo); } public HashMap getEligClassInfo() throws EnrgiseApplicationException, EnrgiseSystemException { int count = 0; ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); HashMap mapEligList = null; arylstParam.add(new DBObject(1, 2, -10)); arylstParam.add(new DBObject(2, 2, 12)); arylstParam.add(new DBObject(3, 2, 12)); arylstParam.add(new DBObject(4, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMELIGRULE.proc_GetEligClass(?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); if (arylstList.size() == 0) throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M"); QueryRow oRow = null; HashMap oColumns = null; Iterator itrBean = arylstList.iterator(); while (itrBean.hasNext()) { if (count == 0) mapEligList = new HashMap(); count++; oRow = itrBean.next(); mapEligList.put(oRow.get("ID").getString(), oRow.get("NAME").getString().trim()); } return mapEligList; } public RecordMetaInfo getHrmGenEligRuleHdrMetaInfo(HrmGenEligRuleQVO oHrmGenEligRuleQVO) throws EnrgiseApplicationException, EnrgiseSystemException { RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo(); return oRecordMetaInfo; } public ArrayList getHrmGenEligRuleHeaderInfo(HrmGenEligRuleQVO oHrmGenEligRuleQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList arylstList = new ArrayList(); int count = 0; ArrayList arylstHeaderList = null; QueryRow oRow = null; HashMap oColumns = null; Iterator itrBean = arylstList.iterator(); while (itrBean.hasNext()) { if (count == 0) arylstHeaderList = new ArrayList(); count++; oRow = itrBean.next(); HrmGenEligRuleHdrBean oEligHeader = new HrmGenEligRuleHdrBean(); if (oHrmGenEligRuleQVO.getDocumentType().equalsIgnoreCase("V")) { oEligHeader.setHeaderPrimaryKey("V"); oEligHeader.setDocumentType("V"); } else if (oHrmGenEligRuleQVO.getDocumentType().equalsIgnoreCase("L")) { oEligHeader.setHeaderPrimaryKey("L"); oEligHeader.setDocumentType("L"); } else if (oHrmGenEligRuleQVO.getDocumentType().equalsIgnoreCase("A")) { oEligHeader.setHeaderPrimaryKey("A"); oEligHeader.setDocumentType("A"); } else if (oHrmGenEligRuleQVO.getDocumentType().equalsIgnoreCase("C")) { oEligHeader.setHeaderPrimaryKey("C"); oEligHeader.setDocumentType("C"); } else { oEligHeader.setHeaderPrimaryKey("E"); oEligHeader.setDocumentType("E"); } arylstHeaderList.add(oEligHeader); } return arylstHeaderList; } public void initializeBOImpl() { this.headerTable = "PUM_PO_HDR"; } public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {} public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {} public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException { return " "; } public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException { String returnString = null; String sProcedure = null; DBUtilitiesBean oBean = new DBUtilitiesBean(); DateUtility d = new DateUtility(); HrmGenEligRuleHdrBean oHrmEligBean = (HrmGenEligRuleHdrBean)oBaseHeaderBean; updateTables(oHrmEligBean); ArrayList arylstParam = new ArrayList(); ArrayList arylstOutArray = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, "N")); arylstParam.add(new DBObject(2, 1, 12, oHrmEligBean.getDocumentType())); arylstParam.add(new DBObject(3, 1, 12, oHrmEligBean.getHidDocumentCodeId())); arylstParam.add(new DBObject(4, 1, 12, oHrmEligBean.getFormula())); arylstParam.add(new DBObject(5, 1, 12, this.oUserInfo.getUserTypeId())); arylstParam.add(new DBObject(6, 1, 12, this.oUserInfo.getSiteId())); arylstParam.add(new DBObject(7, 1, 12, null)); arylstParam.add(new DBObject(8, 2, 12)); arylstParam.add(new DBObject(9, 2, 12)); arylstParam.add(new DBObject(10, 2, 12)); arylstParam.add(new DBObject(11, 2, 4)); arylstOutArray = oBean.callProc(arylstParam, "HRMELIGRULE.proc_UpsertHrEligRule(?,?,?,?,?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); returnString = (String)oOutObject.getObject(); return returnString; } 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) {} private void updateTables(HrmGenEligRuleHdrBean oHrmEligBean) throws EnrgiseSystemException { DBUtilitiesBean oBean = new DBUtilitiesBean(); DateUtility d = new DateUtility(); ArrayList arylstParam = new ArrayList(); ArrayList arylstOutArray = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, oHrmEligBean.getEligSql())); arylstParam.add(new DBObject(2, 1, 12, oHrmEligBean.getHidDocumentCodeId())); arylstParam.add(new DBObject(3, 1, 12, this.oUserInfo.getUserTypeId())); arylstParam.add(new DBObject(4, 1, 12, this.oUserInfo.getSiteId())); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 12)); arylstParam.add(new DBObject(7, 2, 4)); if (oHrmEligBean.getDocumentType().equals("V")) arylstOutArray = oBean.callProc(arylstParam, "HRMELIGRULE.proc_UpdateLvAttrDtlElig(?,?,?,?,?,?,?)"); if (oHrmEligBean.getDocumentType().equals("L")) arylstOutArray = oBean.callProc(arylstParam, "HRMELIGRULE.proc_UpdateLoanDtlElig(?,?,?,?,?,?,?)"); if (oHrmEligBean.getDocumentType().equals("A")) arylstOutArray = oBean.callProc(arylstParam, "HRMELIGRULE.proc_UpdateAdvDtlElig(?,?,?,?,?,?,?)"); if (oHrmEligBean.getDocumentType().equals("C")) arylstOutArray = oBean.callProc(arylstParam, "HRMELIGRULE.proc_UpdateClaimDtlElig(?,?,?,?,?,?,?)"); if (oHrmEligBean.getDocumentType().equals("E")) arylstOutArray = oBean.callProc(arylstParam, "HRMELIGRULE.proc_UpdateErngDtlElig(?,?,?,?,?,?,?)"); if (oHrmEligBean.getDocumentType().equals("S")) arylstOutArray = oBean.callProc(arylstParam, "HRMELIGRULE.proc_UpdateSepDtlElig(?,?,?,?,?,?,?)"); } private void updateLeave(HrmGenEligRuleHdrBean oHrmEligBean) throws EnrgiseSystemException {} private void updateLoan(HrmGenEligRuleHdrBean oHrmEligBean) throws EnrgiseSystemException {} private void updateClaim(HrmGenEligRuleHdrBean oHrmEligBean) throws EnrgiseSystemException {} private void updateAdvance(HrmGenEligRuleHdrBean oHrmEligBean) throws EnrgiseSystemException {} private void updateSeparation(HrmGenEligRuleHdrBean oHrmEligBean) throws EnrgiseSystemException {} private void updateEarning(HrmGenEligRuleHdrBean oHrmEligBean) throws EnrgiseSystemException {} }