package wenrgise.hrms.ejb.business; import java.rmi.RemoteException; import java.sql.Timestamp; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import javax.ejb.CreateException; import javax.ejb.RemoveException; import wenrgise.common.bean.BaseHeaderBean; import wenrgise.common.bean.LOVBean; import wenrgise.common.ejb.business.HrmCommonBO; import wenrgise.common.exception.EnrgiseApplicationException; import wenrgise.common.exception.EnrgiseMessageKeyException; import wenrgise.common.exception.EnrgiseSystemException; import wenrgise.common.utility.DateUtility; import wenrgise.common.utility.EnrgiseUtil; import wenrgise.common.utility.MessageKey; import wenrgise.common.utility.RecordMetaInfo; import wenrgise.common.utility.UserInfo; import wenrgise.common.utility.WorkFlowServiceLocator2; import wenrgise.common.vo.BaseDetailVO; import wenrgise.common.vo.LovQueryVO; import wenrgise.common.vo.LovVO; 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.HrmLvApplnDtlBean; import wenrgise.hrms.bean.HrmLvApplnHdrBean; import wenrgise.hrms.bean.HrmLvApplnQueryDtlBean; import wenrgise.hrms.bean.HrmLvMstHdrBean; import wenrgise.hrms.vo.HrmLvApplnQVO; import wenrgise.hrms.vo.HrmLvApplnQueryQVO; import wenrgise.workflow.bean.WflAuthorizationBean; import wenrgise.workflow.core.WflDocumentInfo; import wenrgise.workflow.core.WflResource; import wenrgise.workflow.core.WflSite; import wenrgise.workflow.core.WflStatus; import wenrgise.workflow.core.impl.WflDocumentInfoImpl; import wenrgise.workflow.core.impl.WflResourceImpl; import wenrgise.workflow.core.impl.WflSiteImpl; import wenrgise.workflow.ejb.facade.WorkFlowFacade2; import wenrgise.workflow.ejb.facade.WorkFlowFacade2Home; public class HrmLvApplnBO extends HrmBaseBO { private ArrayList arylstDtlBean; private boolean bNoDetailView = false; public HrmLvApplnBO() {} public HrmLvApplnBO(UserInfo oUserInfo) { super(oUserInfo); } public RecordMetaInfo getEmpLeaveApplicationQueryDetailMetaInfo(HrmLvApplnQueryQVO oHrmLvApplnQueryQVO) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); String lvType = oHrmLvApplnQueryQVO.getLeaveCode(); String empNo = oHrmLvApplnQueryQVO.getEmployeeNo(); String status = oHrmLvApplnQueryQVO.getStatusOfLeave(); arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, empNo)); arylstParam.add(new DBObject(2, 1, 12, lvType)); arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnQueryQVO.getFromDate()))); arylstParam.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnQueryQVO.getToDate()))); arylstParam.add(new DBObject(5, 1, 12, status)); arylstParam.add(new DBObject(6, 2, -5)); arylstParam.add(new DBObject(7, 2, 93)); arylstParam.add(new DBObject(8, 2, 12)); arylstParam.add(new DBObject(9, 2, 12)); arylstParam.add(new DBObject(10, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_HrLeaveAppQueryDtlCount(?,?,?,?,?,?,?,?,?,?)"); RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo(); DBObject oTotalRecord = arylstOutArray.get(0); oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue()); DBObject oTimeObject = arylstOutArray.get(1); oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject()); return oRecordMetaInfo; } public ArrayList getHrEmpLeaveApplicationQueryDetail(HrmLvApplnQueryQVO oHrmLvApplnQueryQVO, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); int count = 0; String lvType = oHrmLvApplnQueryQVO.getLeaveCode(); String empNo = oHrmLvApplnQueryQVO.getEmployeeNo(); String status = oHrmLvApplnQueryQVO.getStatusOfLeave(); QueryRow oRow = null; QueryValue oValue = null; ArrayList arylstList = null; Iterator itrBean = null; ArrayList arylstEmpLeaveApplQueryDetail = null; arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, -5, new Long(lDetailFirstPosition))); arylstParam.add(new DBObject(2, 1, -5, new Long(lDetailLastPosition))); arylstParam.add(new DBObject(3, 1, 12, empNo)); arylstParam.add(new DBObject(4, 1, 12, lvType)); arylstParam.add(new DBObject(5, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnQueryQVO.getFromDate()))); arylstParam.add(new DBObject(6, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnQueryQVO.getToDate()))); arylstParam.add(new DBObject(7, 1, 12, status)); arylstParam.add(new DBObject(8, 2, -10)); arylstParam.add(new DBObject(9, 2, 12)); arylstParam.add(new DBObject(10, 2, 12)); arylstParam.add(new DBObject(11, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_HrLeaveAppQueryDtl(?,?,?,?,?,?,?,?,?,?,?)"); arylstList = (ArrayList)((DBObject)arylstOutArray.get(0)).getObject(); if (arylstList.size() == 0) throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M"); count = 0; itrBean = arylstList.iterator(); while (itrBean.hasNext()) { if (count == 0) arylstEmpLeaveApplQueryDetail = new ArrayList(); count++; oRow = itrBean.next(); HrmLvApplnQueryDtlBean oHrmLvApplnQueryDtlBean = new HrmLvApplnQueryDtlBean(); oHrmLvApplnQueryDtlBean.setTxtTransId(oRow.get("ID").getString()); oHrmLvApplnQueryDtlBean.setTxtLeaveCodes(oRow.get("LEAVE_DESCRIPTION").getString()); oHrmLvApplnQueryDtlBean.setTxtLeaveStatus(oRow.get("APPROVED_FLAG").getString()); oHrmLvApplnQueryDtlBean.setTxtAppliedLeaveDate(EnrgiseUtil.convertToString(oRow.get("DATE_APPLIED").getDate())); arylstEmpLeaveApplQueryDetail.add(oHrmLvApplnQueryDtlBean); } return arylstEmpLeaveApplQueryDetail; } public RecordMetaInfo getEmpLeaveApplicationQueryScreenDetailMetaInfo(HrmLvApplnQVO oHrmLvApplnQVO) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); String sTransId = oHrmLvApplnQVO.getTransId(); arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, oHrmLvApplnQVO.getHeaderPrimaryKey())); arylstParam.add(new DBObject(2, 1, 12, sTransId)); arylstParam.add(new DBObject(3, 1, 12, oHrmLvApplnQVO.getLeaveCodes())); arylstParam.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnQVO.getFromAppDate()))); arylstParam.add(new DBObject(5, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnQVO.getToAppDate()))); arylstParam.add(new DBObject(6, 1, 12, oHrmLvApplnQVO.getEmployeeNumber())); arylstParam.add(new DBObject(7, 2, -5)); arylstParam.add(new DBObject(8, 2, 93)); arylstParam.add(new DBObject(9, 2, 12)); arylstParam.add(new DBObject(10, 2, 12)); arylstParam.add(new DBObject(11, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_HrLeaveAppQryScreenDtlCnt(?,?,?,?,?,?,?,?,?,?,?)"); RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo(); DBObject oTotalRecord = arylstOutArray.get(0); oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue()); DBObject oTimeObject = arylstOutArray.get(1); oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject()); return oRecordMetaInfo; } public ArrayList getHrEmpLeaveApplicationQueryScreenDetail(HrmLvApplnQVO oHrmLvApplnQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); int count = 0; String sTransId = oHrmLvApplnQVO.getTransId(); QueryRow oRow = null; QueryValue oValue = null; ArrayList arylstList = null; Iterator itrBean = null; ArrayList arylstEmpLeaveApplQueryScreenDetail = null; arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, -5, new Long(lStartPosition))); arylstParam.add(new DBObject(2, 1, -5, new Long(lLastPosition))); arylstParam.add(new DBObject(3, 1, 12, oHrmLvApplnQVO.getHeaderPrimaryKey())); arylstParam.add(new DBObject(4, 1, 12, sTransId)); arylstParam.add(new DBObject(5, 1, 12, oHrmLvApplnQVO.getLeaveCodes())); arylstParam.add(new DBObject(6, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnQVO.getFromAppDate()))); arylstParam.add(new DBObject(7, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnQVO.getToAppDate()))); arylstParam.add(new DBObject(8, 1, 12, oHrmLvApplnQVO.getEmployeeNumber())); arylstParam.add(new DBObject(9, 2, -10)); arylstParam.add(new DBObject(10, 2, 12)); arylstParam.add(new DBObject(11, 2, 12)); arylstParam.add(new DBObject(12, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_HrLeaveAppQueryScreenDtl(?,?,?,?,?,?,?,?,?,?,?,?)"); arylstList = (ArrayList)((DBObject)arylstOutArray.get(0)).getObject(); if (arylstList.size() == 0) throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M"); count = 0; itrBean = arylstList.iterator(); SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); while (itrBean.hasNext()) { if (count == 0) arylstEmpLeaveApplQueryScreenDetail = new ArrayList(); count++; oRow = itrBean.next(); HrmLvApplnHdrBean oHrmLvApplnHdrBean = new HrmLvApplnHdrBean(); oHrmLvApplnHdrBean.setEmployeeNumber(oRow.get("EMP_NO").getString()); oHrmLvApplnHdrBean.setFirstName(oRow.get("FIRST_NAME").getString()); oHrmLvApplnHdrBean.setMiddleName(oRow.get("MIDDLE_NAME").getString()); oHrmLvApplnHdrBean.setLastName(oRow.get("LAST_NAME").getString()); oHrmLvApplnHdrBean.setGrade(oRow.get("GRADE").getString()); oHrmLvApplnHdrBean.setLocation(oRow.get("LOCATION").getString()); oHrmLvApplnHdrBean.setDesignation(oRow.get("DESIGNATION").getString()); oHrmLvApplnHdrBean.setSiteId(oRow.get("SITE_ID").getString()); oHrmLvApplnHdrBean.setHeaderPrimaryKey(oRow.get("ID").getString()); oHrmLvApplnHdrBean.setTransacId(oRow.get("ID").getString()); oHrmLvApplnHdrBean.setLeaveCodes(oRow.get("LEAVE_DESCRIPTION").getString()); oHrmLvApplnHdrBean.setLeaveTypeId(oRow.get("lv_attr_id").getString()); oHrmLvApplnHdrBean.setDescription(oRow.get("NAME").getString()); oHrmLvApplnHdrBean.setEligAmount(oRow.get("ELIG_AMT").getString()); oHrmLvApplnHdrBean.setDateApplied(EnrgiseUtil.convertToString(oRow.get("DATE_APPLIED").getDate())); oHrmLvApplnHdrBean.setFromAppDate(EnrgiseUtil.convertToString(oRow.get("FROM_DATE").getDate())); oHrmLvApplnHdrBean.setToAppDate(EnrgiseUtil.convertToString(oRow.get("TO_DATE").getDate())); double dDays = Double.parseDouble(oRow.get("NO_OF_DAYS").getString()); oHrmLvApplnHdrBean.setDays(String.valueOf(dDays)); oHrmLvApplnHdrBean.setEmployeeId(oRow.get("E_PER_DTL_ID").getString()); oHrmLvApplnHdrBean.setPurpose(oRow.get("PURPOSE").getString()); oHrmLvApplnHdrBean.setStatusOfLeaves(oRow.get("APPROVED_FLAG").getString()); oHrmLvApplnHdrBean.setRemarks(oRow.get("REJECTION_REMARK").getString()); oHrmLvApplnHdrBean.setAddress(oRow.get("ADDRESS_FOR_COMM").getString()); oHrmLvApplnHdrBean.setPhone(oRow.get("PHONE").getString()); oHrmLvApplnHdrBean.setLtaFlag(String.valueOf(oRow.get("LTA_FLAG").getString()).equalsIgnoreCase("Y") ? "on" : "off"); oHrmLvApplnHdrBean.setLtaAmount(oRow.get("LTA_AMT").getString()); oHrmLvApplnHdrBean.setItPercentage(oRow.get("IT_PERC").getString()); oHrmLvApplnHdrBean.setOptedFor(oRow.get("OPTED_FOR").getString()); oHrmLvApplnHdrBean.setFromYear(oRow.get("LTA_FROM_YEAR").getString()); oHrmLvApplnHdrBean.setMedFlag(String.valueOf(oRow.get("MED_FLAG").getString()).equalsIgnoreCase("Y") ? "on" : "off"); arylstEmpLeaveApplQueryScreenDetail.add(oHrmLvApplnHdrBean); } return arylstEmpLeaveApplQueryScreenDetail; } public void initializeBOImpl() { this.headerTable = "HRM_EMP_LEAVE_TXN"; } public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException { ArrayList oParameters = null; DBUtilitiesBean oBean = null; Iterator oIt = arylstDetailBeanArray.iterator(); oBean = new DBUtilitiesBean(); oBean.createBatch("HRMLVAPPLN.proc_InsertLvApplnBreakup(?,?,?,?,?,?)"); while (oIt.hasNext()) { HrmLvApplnDtlBean oDtlBean = oIt.next(); oParameters = new ArrayList(); oParameters.add(new DBObject(1, 1, 12, sHeaderPrimaryKey)); oParameters.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(oDtlBean.getTxtDate()))); oParameters.add(new DBObject(3, 1, 12, oDtlBean.getTxtHolidayFlag())); oParameters.add(new DBObject(4, 1, 4, oDtlBean.getTxtHalfDayFlag())); oParameters.add(new DBObject(5, 1, 12, this.oUserInfo.getUserTypeId())); oParameters.add(new DBObject(6, 1, 12, this.oUserInfo.getSiteId())); oBean.addToBatch(oParameters); } oBean.executeBatch(); } public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {} public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException { return new String(); } public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {} public void additionalBusinessValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList arylstErrorList = new ArrayList(); HrmLvApplnHdrBean oHrmLvApplnHdrBean = (HrmLvApplnHdrBean)oBaseHeaderBean; this.arylstDtlBean = oHrmLvApplnHdrBean.getDetailArray(); if (this.arylstDtlBean.size() == 0) { arylstErrorList.add(new EnrgiseApplicationException("hrm.HrmLvAppln.checkBreakUp")); } else { processSaveValidation(arylstErrorList, oHrmLvApplnHdrBean.getEmployeeId(), oHrmLvApplnHdrBean.getLeaveTypeId(), oHrmLvApplnHdrBean.getDays(), oHrmLvApplnHdrBean); } if (arylstErrorList.size() != 0) reportError(arylstErrorList); if (bHeaderDataChanged) { if (!sScreenMode.equalsIgnoreCase("D")) { checkUniqueHeader((HrmLvApplnHdrBean)oBaseHeaderBean); checkDatesConstraint((HrmLvApplnHdrBean)oBaseHeaderBean, arylstErrorList); checkHeaderConstraint((HrmLvApplnHdrBean)oBaseHeaderBean, arylstErrorList); if (EnrgiseUtil.checkString(oHrmLvApplnHdrBean.getLtaFlag())) if (String.valueOf(oHrmLvApplnHdrBean.getLtaFlag()).equalsIgnoreCase("on")) checkLtaEligibility((HrmLvApplnHdrBean)oBaseHeaderBean, arylstErrorList); } if (sScreenMode.equalsIgnoreCase("D")) if (!oHrmLvApplnHdrBean.getStatusOfLeaves().equalsIgnoreCase("N")) if (arylstErrorList.isEmpty()) arylstErrorList.add(new EnrgiseApplicationException("wenrgise.common.deletion.rejected")); } if (arylstErrorList.size() != 0) reportError(arylstErrorList); } private void checkUniqueHeader(HrmLvApplnHdrBean oHrmLvApplnHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {} public LovVO getHrmLvAppQryEmpNoLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException { LovVO oLovVO = new LovVO(); ArrayList arylstHeaderList = new ArrayList(); arylstHeaderList.add("ID"); arylstHeaderList.add("hrm.HrmLeaveApplicationQuery.employeeNo"); arylstHeaderList.add("hrm.HrmLeaveApplicationQuery.employeeName"); oLovVO.setHeaderList(arylstHeaderList); ArrayList arylstVisibility = new ArrayList(); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("V"); oLovVO.setVisibilityList(arylstVisibility); int count = 0; ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); String sQuerySearch1 = new String(); String sQuerySearch2 = new String(); if (oLovQueryVO.getSearchField1() != null) sQuerySearch1 = oLovQueryVO.getSearchField1(); if (oLovQueryVO.getSearchField2() != null) sQuerySearch2 = oLovQueryVO.getSearchField2(); arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1)); arylstParam.add(new DBObject(2, 1, 12, sQuerySearch2)); arylstParam.add(new DBObject(3, 2, -10)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVLOV.proc_GetLvAppQryEmpLOV(?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; Iterator iter = arylstList.iterator(); while (iter.hasNext()) { if (count == 0) arylstList = new ArrayList(); count++; oRow = iter.next(); LOVBean oLOVBean = new LOVBean(); oLOVBean.setDetailField1(oRow.get("ID").getString()); oLOVBean.setDetailField2(oRow.get("EMP_NO").getString()); oLOVBean.setDetailField3(oRow.get("EMPNAME").getString()); arylstList.add(oLOVBean); } oLovVO.setDetailList(arylstList); return oLovVO; } public LovVO getHrmLvAppQryLvCdLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException { LovVO oLovVO = new LovVO(); ArrayList arylstHeaderList = new ArrayList(); arylstHeaderList.add("ID"); arylstHeaderList.add("hrm.HrmLeaveApplicationQuery.leaveCode"); arylstHeaderList.add("hrm.HrmLeaveApplicationQuery.leaveDescription"); oLovVO.setHeaderList(arylstHeaderList); ArrayList arylstVisibility = new ArrayList(); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("V"); oLovVO.setVisibilityList(arylstVisibility); int count = 0; ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); String sQuerySearch1 = new String(); String sQuerySearch2 = new String(); if (oLovQueryVO.getSearchField1() != null) sQuerySearch1 = oLovQueryVO.getSearchField1(); if (oLovQueryVO.getSearchField2() != null) sQuerySearch2 = oLovQueryVO.getSearchField2(); arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1)); arylstParam.add(new DBObject(2, 1, 12, sQuerySearch2)); arylstParam.add(new DBObject(3, 2, -10)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVLOV.proc_GetLvAppQryLeaveCdLOV(?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; Iterator iter = arylstList.iterator(); while (iter.hasNext()) { if (count == 0) arylstList = new ArrayList(); count++; oRow = iter.next(); LOVBean oLOVBean = new LOVBean(); oLOVBean.setDetailField1(oRow.get("ID").getString()); oLOVBean.setDetailField2(oRow.get("LEAVE_DESCRIPTION").getString()); oLOVBean.setDetailField3(oRow.get("NAME").getString()); arylstList.add(oLOVBean); } oLovVO.setDetailList(arylstList); return oLovVO; } public LovVO getHrmEmpLvAppLvCdLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException { LovVO oLovVO = new LovVO(); ArrayList arylstHeaderList = new ArrayList(); arylstHeaderList.add("ID"); arylstHeaderList.add("hrm.HrmLeaveApplicationQuery.leaveCode"); arylstHeaderList.add("hrm.HrmLeaveApplicationQuery.leaveDescription"); oLovVO.setHeaderList(arylstHeaderList); ArrayList arylstVisibility = new ArrayList(); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("V"); oLovVO.setVisibilityList(arylstVisibility); int count = 0; String employeeNumber = null; ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); String sQuerySearch1 = new String(); String sQuerySearch2 = new String(); if (oLovQueryVO.getSearchField1() != null) sQuerySearch1 = oLovQueryVO.getSearchField1(); if (oLovQueryVO.getSearchField2() != null) sQuerySearch2 = oLovQueryVO.getSearchField2(); if (oLovQueryVO.getProperty("empId") != null) employeeNumber = oLovQueryVO.getProperty("empId"); arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1)); arylstParam.add(new DBObject(2, 1, 12, sQuerySearch2)); arylstParam.add(new DBObject(3, 1, 12, employeeNumber)); arylstParam.add(new DBObject(4, 2, -10)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 12)); arylstParam.add(new DBObject(7, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVLOV.proc_GetEmpLvAppLeaveCdLOV(?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; Iterator iter = arylstList.iterator(); while (iter.hasNext()) { if (count == 0) arylstList = new ArrayList(); count++; oRow = iter.next(); LOVBean oLOVBean = new LOVBean(); oLOVBean.setDetailField1(oRow.get("ID").getString()); oLOVBean.setDetailField2(oRow.get("LEAVE_DESCRIPTION").getString()); oLOVBean.setDetailField3(oRow.get("NAME").getString()); arylstList.add(oLOVBean); } oLovVO.setDetailList(arylstList); return oLovVO; } public String getGenderInfo(String sEmpNo) throws EnrgiseSystemException { ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); int count = 0; String sGender = null; arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sEmpNo)); arylstParam.add(new DBObject(2, 2, -10)); arylstParam.add(new DBObject(3, 2, 12)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_GetGenderInfo(?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; QueryValue oValue = null; HashMap oColumns = null; Iterator itrBean = arylstList.iterator(); while (itrBean.hasNext()) { oRow = itrBean.next(); sGender = oRow.get("SEX").getString(); } return sGender; } public LovVO getHrmEmpLvAppLvCdInsLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException { String sEmpNo = oLovQueryVO.getProperty("empId"); String sSex = getGenderInfo(sEmpNo); DateUtility d = new DateUtility(); String str = d.getSysDate(); String monOfSysDate = str.substring(3, 5); String yearOfSysDate = str.substring(6, 10); String yyyymm = String.valueOf(yearOfSysDate).concat(String.valueOf(monOfSysDate)); LovVO oLovVO = new LovVO(); ArrayList arylstHeaderList = new ArrayList(); arylstHeaderList.add("ID"); arylstHeaderList.add("hrm.HrmLeaveApplicationQuery.leaveCode"); arylstHeaderList.add("hrm.HrmLeaveApplicationQuery.leaveDescription"); oLovVO.setHeaderList(arylstHeaderList); ArrayList arylstVisibility = new ArrayList(); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("V"); oLovVO.setVisibilityList(arylstVisibility); int count = 0; String employeeNumber = null; ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); String sQuerySearch1 = new String(); String sQuerySearch2 = new String(); if (oLovQueryVO.getSearchField1() != null) sQuerySearch1 = oLovQueryVO.getSearchField1(); if (oLovQueryVO.getSearchField2() != null) sQuerySearch2 = oLovQueryVO.getSearchField2(); arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1)); arylstParam.add(new DBObject(2, 1, 12, sQuerySearch2)); arylstParam.add(new DBObject(3, 1, 12, sSex)); arylstParam.add(new DBObject(4, 1, 12, yyyymm)); arylstParam.add(new DBObject(5, 1, 12, sEmpNo)); arylstParam.add(new DBObject(6, 2, -10)); arylstParam.add(new DBObject(7, 2, 12)); arylstParam.add(new DBObject(8, 2, 12)); arylstParam.add(new DBObject(9, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVLOV.proc_GetLvAppQryLeaveCdInsLOV(?,?,?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; Iterator iter = arylstList.iterator(); while (iter.hasNext()) { if (count == 0) arylstList = new ArrayList(); count++; oRow = iter.next(); LOVBean oLOVBean = new LOVBean(); oLOVBean.setDetailField1(oRow.get("ID").getString()); oLOVBean.setDetailField2(oRow.get("CODE").getString()); oLOVBean.setDetailField3(oRow.get("NAME").getString()); arylstList.add(oLOVBean); } arylstList = checkLOVConstraint(arylstList, oLovQueryVO); oLovVO.setDetailList(arylstList); return oLovVO; } public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseApplicationException, EnrgiseSystemException { String returnString = null; String errorMsgFromDB = null; String sNetAmount = new String(); String sLTAAmount = new String(); ArrayList arylstErrorList = new ArrayList(); ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); DateUtility d = new DateUtility(); HrmLvApplnHdrBean oHrmLvApplnHdrBean = (HrmLvApplnHdrBean)oBaseHeaderBean; if (String.valueOf(oHrmLvApplnHdrBean.getLtaFlag()).equalsIgnoreCase("on")) { sLTAAmount = calculateLTA(oHrmLvApplnHdrBean); if (EnrgiseUtil.checkString(oHrmLvApplnHdrBean.getItPercentage())) { String sIT = oHrmLvApplnHdrBean.getItPercentage(); sNetAmount = String.valueOf(Double.parseDouble(sLTAAmount) - Double.parseDouble(sIT)); } else { sNetAmount = String.valueOf(Double.parseDouble(sLTAAmount)); } } ArrayList arylstDetailArray = oHrmLvApplnHdrBean.getDetailArray(); if (arylstDetailArray.size() == 0) try { arylstDetailArray = getLeaveDates(oHrmLvApplnHdrBean); oHrmLvApplnHdrBean.setDays(getHolidayCount(arylstDetailArray)); this.bNoDetailView = true; } catch (EnrgiseApplicationException enrgiseApplicationException) {} if (ScreenMode.equalsIgnoreCase("N")) { arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, "N")); arylstParam.add(new DBObject(2, 1, 12, oHrmLvApplnHdrBean.getEmployeeId())); arylstParam.add(new DBObject(3, 1, 12, oHrmLvApplnHdrBean.getLeaveTypeId())); arylstParam.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnHdrBean.getDateApplied()))); arylstParam.add(new DBObject(5, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnHdrBean.getFromAppDate()))); arylstParam.add(new DBObject(6, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnHdrBean.getToAppDate()))); arylstParam.add(new DBObject(7, 1, 12, oHrmLvApplnHdrBean.getDays())); arylstParam.add(new DBObject(8, 1, 12, oHrmLvApplnHdrBean.getAddress())); arylstParam.add(new DBObject(9, 1, 12, oHrmLvApplnHdrBean.getPhone())); arylstParam.add(new DBObject(10, 1, 12, oHrmLvApplnHdrBean.getPurpose())); arylstParam.add(new DBObject(11, 1, 12, oHrmLvApplnHdrBean.getRemarks())); arylstParam.add(new DBObject(12, 1, 12, String.valueOf(oHrmLvApplnHdrBean.getLtaFlag()).equalsIgnoreCase("on") ? "Y" : "N")); arylstParam.add(new DBObject(13, 1, 12, oHrmLvApplnHdrBean.getOptedFor())); arylstParam.add(new DBObject(14, 1, 12, oHrmLvApplnHdrBean.getFromYear())); arylstParam.add(new DBObject(15, 1, 12, oHrmLvApplnHdrBean.getItPercentage())); arylstParam.add(new DBObject(16, 1, 12, sNetAmount)); arylstParam.add(new DBObject(17, 1, 12, sLTAAmount)); arylstParam.add(new DBObject(18, 1, 12, String.valueOf(oHrmLvApplnHdrBean.getMedFlag()).equalsIgnoreCase("on") ? "Y" : "N")); arylstParam.add(new DBObject(19, 1, 12, this.oUserInfo.getUserTypeId())); arylstParam.add(new DBObject(20, 1, 12, this.oUserInfo.getSiteId())); arylstParam.add(new DBObject(21, 1, 12, null)); arylstParam.add(new DBObject(22, 2, 12)); arylstParam.add(new DBObject(23, 2, 12)); arylstParam.add(new DBObject(24, 2, 12)); arylstParam.add(new DBObject(25, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_UpsertHrEmpLeaveAppHdr(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); returnString = (String)oOutObject.getObject(); errorMsgFromDB = (String)((DBObject)arylstOutArray.get(2)).getObject(); } else if (ScreenMode.equalsIgnoreCase("U")) { arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, "u")); arylstParam.add(new DBObject(2, 1, 12, oHrmLvApplnHdrBean.getEmployeeId())); arylstParam.add(new DBObject(3, 1, 12, oHrmLvApplnHdrBean.getLeaveTypeId())); arylstParam.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnHdrBean.getDateApplied()))); arylstParam.add(new DBObject(5, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnHdrBean.getFromAppDate()))); arylstParam.add(new DBObject(6, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnHdrBean.getToAppDate()))); arylstParam.add(new DBObject(7, 1, 12, oHrmLvApplnHdrBean.getDays())); arylstParam.add(new DBObject(8, 1, 12, oHrmLvApplnHdrBean.getAddress())); arylstParam.add(new DBObject(9, 1, 12, oHrmLvApplnHdrBean.getPhone())); arylstParam.add(new DBObject(10, 1, 12, oHrmLvApplnHdrBean.getPurpose())); arylstParam.add(new DBObject(11, 1, 12, oHrmLvApplnHdrBean.getRemarks())); arylstParam.add(new DBObject(12, 1, 12, String.valueOf(oHrmLvApplnHdrBean.getLtaFlag()).equalsIgnoreCase("on") ? "Y" : "N")); arylstParam.add(new DBObject(13, 1, 12, oHrmLvApplnHdrBean.getOptedFor())); arylstParam.add(new DBObject(14, 1, 12, oHrmLvApplnHdrBean.getFromYear())); arylstParam.add(new DBObject(15, 1, 12, oHrmLvApplnHdrBean.getItPercentage())); arylstParam.add(new DBObject(16, 1, 12, sNetAmount)); arylstParam.add(new DBObject(17, 1, 12, sLTAAmount)); arylstParam.add(new DBObject(18, 1, 12, String.valueOf(oHrmLvApplnHdrBean.getMedFlag()).equalsIgnoreCase("on") ? "Y" : "N")); arylstParam.add(new DBObject(19, 1, 12, this.oUserInfo.getUserTypeId())); arylstParam.add(new DBObject(20, 1, 12, this.oUserInfo.getSiteId())); arylstParam.add(new DBObject(21, 1, 12, null)); arylstParam.add(new DBObject(22, 2, 12)); arylstParam.add(new DBObject(23, 2, 12)); arylstParam.add(new DBObject(24, 2, 12)); arylstParam.add(new DBObject(25, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_UpsertHrEmpLeaveAppHdr(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); returnString = (String)oOutObject.getObject(); errorMsgFromDB = (String)((DBObject)arylstOutArray.get(2)).getObject(); } else if (ScreenMode.equalsIgnoreCase("D")) { arylstParam.add(new DBObject(1, 1, 12, oHrmLvApplnHdrBean.getHeaderPrimaryKey())); 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, "HRMLVAPPLN.proc_DelHrEmpLeaveAppHdr(?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); returnString = null; } System.out.println(String.valueOf("value of error msg from database :").concat(String.valueOf(errorMsgFromDB))); if (errorMsgFromDB != null && errorMsgFromDB.equalsIgnoreCase("NtElgLTA")) { arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLeaveApplication.notEligibleLTA", null, "E")); } else if (errorMsgFromDB != null && errorMsgFromDB.equalsIgnoreCase("NtElig2YrLTA")) { arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLeaveApplication.notEligible2YearLTA", null, "E")); } else if (errorMsgFromDB != null && errorMsgFromDB.equalsIgnoreCase("DupLTA")) { arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLeaveApplication.duplicateLTA", null, "E")); } else { oBaseHeaderBean.setHeaderPrimaryKey(returnString); saveDetailImpl(returnString, (String)null, arylstDetailArray); } if (arylstErrorList.size() != 0) reportError(arylstErrorList); return returnString; } private String calculateLTA(HrmLvApplnHdrBean oHrmLvApplnHdrBean) throws EnrgiseSystemException { String sLtaAmount = new String(); String sGrossLtaAmount = new String(); int iTotal = 0; ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstList = null; arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, oHrmLvApplnHdrBean.getEmployeeId())); arylstParam.add(new DBObject(2, 1, 12, oHrmLvApplnHdrBean.getOptedFor())); arylstParam.add(new DBObject(3, 2, 12)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proccalculateltaamount(?,?,?,?,?,?)"); DBObject oLta = arylstOutArray.get(0); sLtaAmount = ((String)oLta.getObject()).toString(); return sLtaAmount; } public void additionalFieldValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList arylstErrorList = new ArrayList(); checkMandatoryHeader((HrmLvApplnHdrBean)oBaseHeaderBean); if (arylstErrorList.size() != 0) reportError(arylstErrorList); } private void checkMandatoryHeader(HrmLvApplnHdrBean oHrmLvApplnHdrBean) throws EnrgiseSystemException, EnrgiseApplicationException { ArrayList arylstErrorList = new ArrayList(); ArrayList arylstParams = new ArrayList(); if (!EnrgiseUtil.checkString(oHrmLvApplnHdrBean.getLeaveCodes())) { MessageKey oMessageKey = new MessageKey("hrm.HrmLvAppln.leaveCodes"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", arylstParams, "E")); } if (!EnrgiseUtil.checkString(oHrmLvApplnHdrBean.getDateApplied())) { MessageKey oMessageKey = new MessageKey("hrm.HrmLvAppln.dateApplied"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", arylstParams, "E")); } if (!EnrgiseUtil.checkString(oHrmLvApplnHdrBean.getFromAppDate())) { MessageKey oMessageKey = new MessageKey("hrm.HrmLvAppln.fromAppDate"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", arylstParams, "E")); } if (!EnrgiseUtil.checkString(oHrmLvApplnHdrBean.getToAppDate())) { MessageKey oMessageKey = new MessageKey("hrm.HrmLvAppln.toAppDate"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", arylstParams, "E")); } if (EnrgiseUtil.checkString(oHrmLvApplnHdrBean.getLtaFlag())) if (oHrmLvApplnHdrBean.getLtaFlag().equalsIgnoreCase("on")) { if (!EnrgiseUtil.checkString(oHrmLvApplnHdrBean.getOptedFor())) { MessageKey oMessageKey = new MessageKey("hrm.HrmLvAppln.optedFor"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", arylstParams, "E")); } String dateAppliedYear = oHrmLvApplnHdrBean.getDateApplied().substring(7, 11); int prevYear = Integer.valueOf(dateAppliedYear).intValue() - 1; String fromYear = oHrmLvApplnHdrBean.getFromYear(); String optedFor = oHrmLvApplnHdrBean.getOptedFor(); if (fromYear.equals(dateAppliedYear) && optedFor.equals("2")) { MessageKey oMessageKey = new MessageKey("hrm.HrmLvAppln.dateApplied"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstParams.add(new MessageKey("hrm.HrmLvAppln.fromYear")); arylstParams.add(new MessageKey("hrm.HrmLvAppln.optedFor")); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLeaveApplication.fromYear.optedFor.validation", arylstParams, "E")); } if (!fromYear.equalsIgnoreCase(dateAppliedYear) && !fromYear.equalsIgnoreCase(String.valueOf(prevYear))) { arylstParams = new ArrayList(); arylstParams.add(new MessageKey("hrm.HrmLvAppln.fromYear")); arylstParams.add(String.valueOf(prevYear)); arylstParams.add(dateAppliedYear); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLeaveApplication.fromYear.prevYear.validation", arylstParams, "E")); } if (!EnrgiseUtil.checkString(oHrmLvApplnHdrBean.getFromYear())) { MessageKey oMessageKey = new MessageKey("hrm.HrmLvAppln.fromYear"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", arylstParams, "E")); } } if (arylstErrorList.size() != 0) reportError(arylstErrorList); } private void checkLtaEligibility(HrmLvApplnHdrBean oHrmLvApplnHdrBean, ArrayList arylstErrorList) throws EnrgiseApplicationException, EnrgiseSystemException { if (Float.parseFloat(oHrmLvApplnHdrBean.getDays()) < 5.0D) arylstErrorList.add(new EnrgiseApplicationException("hrm.HrmLvAppln.ltaElig")); } private void checkDatesConstraint(HrmLvApplnHdrBean oHrmLvApplnHdrBean, ArrayList arylstErrorList) throws EnrgiseApplicationException, EnrgiseSystemException { DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy"); String sAttrId = oHrmLvApplnHdrBean.getLeaveTypeId(); String sCalId = getCalId(sAttrId); HrmCommonBO oBO = new HrmCommonBO(); String sStartDate = oBO.getStartDate(sCalId, oHrmLvApplnHdrBean.getDateApplied()); String sEndDate = oBO.getEndDate(sCalId, oHrmLvApplnHdrBean.getDateApplied()); if (!oHrmLvApplnHdrBean.getDateApplied().equals(sStartDate)) { int dateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmLvApplnHdrBean.getDateApplied(), sStartDate); if (dateFlag == -1 && dateFlag != -2) arylstErrorList.add(new EnrgiseApplicationException("wenrgise.dateApplied.dateConstraintViolated")); if (!oHrmLvApplnHdrBean.getDateApplied().equals(sEndDate)) { int dateFlag1 = EnrgiseUtil.compareDates(dateFormat, sEndDate, oHrmLvApplnHdrBean.getDateApplied()); if (dateFlag1 == -1 && dateFlag1 != -2) arylstErrorList.add(new EnrgiseApplicationException("wenrgise.dateApplied.dateConstraintViolated")); } } if (!oHrmLvApplnHdrBean.getToAppDate().equals(oHrmLvApplnHdrBean.getFromAppDate())) { int dateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmLvApplnHdrBean.getToAppDate(), oHrmLvApplnHdrBean.getFromAppDate()); if (dateFlag == -1 && dateFlag != -2) arylstErrorList.add(new EnrgiseApplicationException("wenrgise.common.dateConstraintViolated")); } if (EnrgiseUtil.checkString(oHrmLvApplnHdrBean.getDateApplied())) { int dateFlag2 = EnrgiseUtil.compareDates(dateFormat, EnrgiseUtil.convertToString(EnrgiseUtil.getSysDate()), oHrmLvApplnHdrBean.getDateApplied()); if (dateFlag2 == -1 && dateFlag2 != -2) arylstErrorList.add(new EnrgiseApplicationException("hrm.HrmEmpEncash.dateConstraintViolated2")); } } public String getAllFlagInfo(String sAttrId) throws EnrgiseSystemException { ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); int count = 0; String sAllFlag = null; arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sAttrId)); arylstParam.add(new DBObject(2, 2, -10)); arylstParam.add(new DBObject(3, 2, 12)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_GetAllFlag(?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; QueryValue oValue = null; HashMap oColumns = null; Iterator itrBean = arylstList.iterator(); while (itrBean.hasNext()) { oRow = itrBean.next(); sAllFlag = oRow.get("ALL_FLAG").getString(); } return sAllFlag; } private String getCalId(String sAttrId) throws EnrgiseSystemException { ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); int count = 0; String sCalId = null; arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sAttrId)); arylstParam.add(new DBObject(2, 2, -10)); arylstParam.add(new DBObject(3, 2, 12)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_GetCalId(?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; QueryValue oValue = null; HashMap oColumns = null; Iterator itrBean = arylstList.iterator(); while (itrBean.hasNext()) { oRow = itrBean.next(); sCalId = oRow.get("CAL_MST_ID").getString(); } return sCalId; } private ArrayList checkLOVConstraint(ArrayList arylstList, LovQueryVO oLovQueryVO) throws EnrgiseSystemException { LOVBean oLOVBean = null; ArrayList arylstNewList = new ArrayList(); Iterator itrBean = arylstList.iterator(); while (itrBean.hasNext()) { oLOVBean = itrBean.next(); String sId = oLOVBean.getDetailField1(); String sCode = oLOVBean.getDetailField2(); String sAllFlag = getAllFlagInfo(sId); if (sAllFlag.equalsIgnoreCase("Y")) { arylstNewList.add(oLOVBean); continue; } if (sCode.equalsIgnoreCase("CL")) { arylstNewList.add(oLOVBean); continue; } String sAttrId = oLOVBean.getDetailField1(); String sQuery = String.valueOf(" Select ELIG_SQL as ELIG_SQL from HRM_LEAVE_ATTR_DTL where ID= ").concat(String.valueOf(sAttrId)); DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstList1 = oBean.executeQuery(sQuery); Iterator itrBean1 = arylstList1.iterator(); if (itrBean1.hasNext()) { QueryRow oRow = itrBean1.next(); String sSql = oRow.get("ELIG_SQL").getString(); if (EnrgiseUtil.checkString(sSql)) { String sEmpNo = oLovQueryVO.getProperty("employeeNumber"); HrmCommonBO oBO = new HrmCommonBO(); String sEmpId = oBO.getRefList1("HRM_EMP_PERS", "EMP_NO", sEmpNo, "ID"); StringBuffer s = new StringBuffer(sSql); s.replace(s.lastIndexOf("?"), s.lastIndexOf("?") + 1, sEmpId); ArrayList arylstList2 = oBean.executeQuery(s.toString()); if (arylstList2.size() != 0) arylstNewList.add(oLOVBean); } } } return arylstNewList; } public ArrayList getHrLeaveFlagInfo(String sAttrId) throws EnrgiseApplicationException, EnrgiseSystemException { ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); int count = 0; BaseDetailVO oBaseDetailVO = null; ArrayList arylstFlagDetail = null; arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sAttrId)); arylstParam.add(new DBObject(2, 2, -10)); arylstParam.add(new DBObject(3, 2, 12)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_GetPreSufIntFlag(?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); if (arylstList.size() == 0) arylstFlagDetail = new ArrayList(); QueryRow oRow = null; QueryValue oValue = null; HashMap oColumns = null; Iterator itrBean = arylstList.iterator(); while (itrBean.hasNext()) { if (count == 0) arylstFlagDetail = new ArrayList(); count++; oRow = itrBean.next(); HrmLvMstHdrBean oHrmLvMstHdrBean = new HrmLvMstHdrBean(); oHrmLvMstHdrBean.setIntermediateHoliday(oRow.get("intrmdt_hldy_allwd").getString()); oHrmLvMstHdrBean.setPrefixSuffix(oRow.get("prefix_flag").getString()); oHrmLvMstHdrBean.setSuffix(oRow.get("suffix_flag").getString()); oHrmLvMstHdrBean.setMinLeave(oRow.get("min_leave").getString()); arylstFlagDetail.add(oHrmLvMstHdrBean); } return arylstFlagDetail; } private ArrayList getPrefixDates(String sEmpId, String sWrkgrpId, String sSiteId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException { HrmCommonBO oBo = new HrmCommonBO(); ArrayList arylstPrefixList = new ArrayList(); String sPrefixDt = sDate; Date dDate = oBo.getPreviousDay(sPrefixDt, 1); sPrefixDt = EnrgiseUtil.convertToString(dDate); int iHolidayType = 0; while ((iHolidayType = isHoliday(sEmpId, sWrkgrpId, sSiteId, sPrefixDt)) != 0) { HrmLvApplnDtlBean oDtlBean = new HrmLvApplnDtlBean(); oDtlBean.setTxtDate(sPrefixDt); oDtlBean.setDisabtxtDate("true"); String sHolType = Integer.toString(iHolidayType); oDtlBean.setTxtHalfDayFlag(sHolType); oDtlBean.setDisabtxtHalfDayFlag("true"); oDtlBean.setTxtHolidayFlag("P"); oDtlBean.setDisabtxtHolidayFlag("true"); oDtlBean.setStatus("N"); arylstPrefixList.add(oDtlBean); dDate = oBo.getPreviousDay(sPrefixDt, 1); sPrefixDt = EnrgiseUtil.convertToString(dDate); } return arylstPrefixList; } private ArrayList getSuffixDates(String sEmpId, String sWrkgrpId, String sSiteId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException { HrmCommonBO oBo = new HrmCommonBO(); ArrayList arylstSuffixList = new ArrayList(); String sSuffixDt = sDate; Date dDate = oBo.getNextDay(sSuffixDt, 1); sSuffixDt = EnrgiseUtil.convertToString(dDate); int iHolidayType = 0; while ((iHolidayType = isHoliday(sEmpId, sWrkgrpId, sSiteId, sSuffixDt)) != 0) { HrmLvApplnDtlBean oDtlBean = new HrmLvApplnDtlBean(); oDtlBean.setTxtDate(sSuffixDt); oDtlBean.setDisabtxtDate("true"); String sHolType = Integer.toString(iHolidayType); oDtlBean.setTxtHalfDayFlag(sHolType); oDtlBean.setDisabtxtHalfDayFlag("true"); oDtlBean.setTxtHolidayFlag("S"); oDtlBean.setDisabtxtHolidayFlag("true"); oDtlBean.setStatus("N"); arylstSuffixList.add(oDtlBean); dDate = oBo.getNextDay(sSuffixDt, 1); sSuffixDt = EnrgiseUtil.convertToString(dDate); } return arylstSuffixList; } private ArrayList getInterDates(String sEmpId, String sWrkgrpId, String sSiteId, String sDate, int iDateDiff, double dMinLeave, String sInterFlag) throws EnrgiseApplicationException, EnrgiseSystemException { HrmCommonBO oBO = new HrmCommonBO(); ArrayList arylstInterDtlList = new ArrayList(); DateUtility oDateUtil = new DateUtility(); String sInterDate = sDate; Date dDate = oBO.getNextDay(sInterDate, 0); while (iDateDiff-- >= 0) { int iHolidayType = isHoliday(sEmpId, sWrkgrpId, sSiteId, sInterDate); if (iHolidayType != 0) { HrmLvApplnDtlBean oDtlBean = new HrmLvApplnDtlBean(); sInterDate = EnrgiseUtil.convertToString(dDate); if (sInterFlag.equalsIgnoreCase("Y")) { oDtlBean.setTxtDate(sInterDate); oDtlBean.setDisabtxtDate("true"); oDtlBean.setTxtHalfDayFlag(Integer.toString(iHolidayType)); if (dMinLeave < 1.0D) { oDtlBean.setDisabtxtHalfDayFlag("true"); } else { oDtlBean.setDisabtxtHalfDayFlag("true"); } oDtlBean.setDisabtxtHalfDayFlag("true"); oDtlBean.setTxtHolidayFlag("I"); oDtlBean.setDisabtxtHolidayFlag("true"); oDtlBean.setStatus("N"); } else { oDtlBean.setTxtDate(sInterDate); oDtlBean.setDisabtxtDate("true"); oDtlBean.setTxtHalfDayFlag("3"); oDtlBean.setDisabtxtHalfDayFlag("true"); oDtlBean.setTxtHolidayFlag("H"); oDtlBean.setDisabtxtHolidayFlag("true"); oDtlBean.setStatus("N"); } arylstInterDtlList.add(oDtlBean); } else { HrmLvApplnDtlBean oDtlBean = new HrmLvApplnDtlBean(); sInterDate = EnrgiseUtil.convertToString(dDate); oDtlBean.setTxtDate(sInterDate); oDtlBean.setTxtHalfDayFlag("3"); oDtlBean.setTxtHolidayFlag("W"); oDtlBean.setStatus("N"); arylstInterDtlList.add(oDtlBean); } dDate = oBO.getNextDay(sInterDate, 1); sInterDate = EnrgiseUtil.convertToString(dDate); } return arylstInterDtlList; } public String getHolCalMstId(String sSiteId, String sFromDate, String sToDate) throws EnrgiseSystemException { ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); int count = 0; String sHolCalMstId = null; arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sSiteId)); arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(sFromDate))); arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sToDate))); arylstParam.add(new DBObject(4, 2, -10)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 12)); arylstParam.add(new DBObject(7, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_GetHolCalId(?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; QueryValue oValue = null; HashMap oColumns = null; Iterator itrBean = arylstList.iterator(); while (itrBean.hasNext()) { oRow = itrBean.next(); sHolCalMstId = oRow.get("ID").getString(); } return sHolCalMstId; } public String getBetHolCount(String sHolCalId, String sFromDate, String sToDate) throws EnrgiseSystemException { ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); int count = 0; String sCount = null; arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sHolCalId)); arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(sFromDate))); arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sToDate))); arylstParam.add(new DBObject(4, 2, -10)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 12)); arylstParam.add(new DBObject(7, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_GetBetHolCount(?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; QueryValue oValue = null; HashMap oColumns = null; Iterator itrBean = arylstList.iterator(); while (itrBean.hasNext()) { oRow = itrBean.next(); sCount = oRow.get("COUNT").getString(); } return sCount; } public String getOutStandingLeaves(String sEmpId, String sLeaveId) throws EnrgiseSystemException { ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); int count = 0; String sCount = null; arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sEmpId)); arylstParam.add(new DBObject(2, 1, 12, sLeaveId)); arylstParam.add(new DBObject(3, 2, -10)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.procgetempleaves(?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; QueryValue oValue = null; HashMap oColumns = null; Iterator itrBean = arylstList.iterator(); if (arylstList.size() == 0) { sCount = "0"; } else { while (itrBean.hasNext()) { oRow = itrBean.next(); sCount = oRow.get("COUNT").getString(); } } return sCount; } private void checkHeaderConstraint(HrmLvApplnHdrBean oHrmLvApplnHdrBean, ArrayList arylstErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {} public String approveLeaveAppln(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException { String sLeaveAppl = null; String sStatus = null; ArrayList arylstErrorList = new ArrayList(); ArrayList arylstParameters = new ArrayList(); HrmLvApplnHdrBean oHdrBean = (HrmLvApplnHdrBean)oBaseHeaderBean; DBUtilitiesBean oBean = new DBUtilitiesBean(); arylstParameters.add(new DBObject(1, 1, 12, oBaseHeaderBean.getHeaderPrimaryKey())); arylstParameters.add(new DBObject(2, 1, 12, oHdrBean.getButtonName())); arylstParameters.add(new DBObject(3, 1, 12, this.oUserInfo.getUserTypeId())); arylstParameters.add(new DBObject(4, 1, 12, this.oUserInfo.getSiteId())); arylstParameters.add(new DBObject(5, 2, 12)); arylstParameters.add(new DBObject(6, 2, 12)); arylstParameters.add(new DBObject(7, 2, 4)); ArrayList arylstPK = oBean.callProc(arylstParameters, "HRMLVAPPLN.proc_ApproveEmpLeave(?,?,?,?,?,?,?)"); sLeaveAppl = oBaseHeaderBean.getHeaderPrimaryKey(); return sLeaveAppl; } private void processApproveValidation(ArrayList arylstErrorList, String sEmpId, String sLeaveAttrId, String sDays) throws EnrgiseApplicationException, EnrgiseSystemException { String sStartDate = ((HrmLvApplnDtlBean)this.arylstDtlBean.get(0)).getTxtDate(); String sEndDate = ((HrmLvApplnDtlBean)this.arylstDtlBean.get(this.arylstDtlBean.size() - 1)).getTxtDate(); if (isLeaveOverlappingApprove(sEmpId, sStartDate, sEndDate)) { ArrayList arylstParams = new ArrayList(); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.overlappingLeave", arylstParams, "E")); } } public String cancelLeaveAppln(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException { String sLeaveAppl = null; String sStatus = null; HrmLvApplnHdrBean oHdrBean = (HrmLvApplnHdrBean)oBaseHeaderBean; if (oHdrBean.getButtonName().equalsIgnoreCase("R")) { ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList oErrorList = new ArrayList(); arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, oHdrBean.getHeaderPrimaryKey())); arylstParam.add(new DBObject(2, 2, 12)); arylstParam.add(new DBObject(3, 2, 12)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proccheckcancellation(?,?,?,?,?)"); DBObject oErr = arylstOutArray.get(0); String sErr = ((String)oErr.getObject()).toString(); if (Integer.parseInt(sErr) == 0) { MessageKey oMessageKey = new MessageKey("hrm.HrmEmpEncash.daysEncashed"); ArrayList oParams = new ArrayList(); oParams.add(oMessageKey); oErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.cancellationError", oParams, "E")); reportError(oErrorList); } else { sLeaveAppl = cancelLeaveApplnTxn(oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, arylstDetailBeanArray, bDetailDataChanged, oDetailPicked); } } return sLeaveAppl; } private String cancelLeaveApplnTxn(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = null; HrmLvApplnHdrBean oHrmLvApplnHdrBean = (HrmLvApplnHdrBean)oBaseHeaderBean; String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : ""; oBean = new DBUtilitiesBean(); ArrayList arylstParameters = new ArrayList(); arylstParameters.add(new DBObject(1, 1, 12, sHeaderPrimaryKey)); arylstParameters.add(new DBObject(2, 1, 12, oHrmLvApplnHdrBean.getEmployeeId())); arylstParameters.add(new DBObject(3, 1, 12, oHrmLvApplnHdrBean.getLeaveTypeId())); arylstParameters.add(new DBObject(4, 1, 12, oHrmLvApplnHdrBean.getDays())); arylstParameters.add(new DBObject(5, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmLvApplnHdrBean.getDateApplied()))); arylstParameters.add(new DBObject(6, 2, 12)); arylstParameters.add(new DBObject(7, 2, 12)); arylstParameters.add(new DBObject(8, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMLVAPPLN.cancelLeave(?,?,?,?,?,?,?,?)"); return sHeaderPrimaryKey; } private String approveLeaveApplHdr(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = null; HrmLvApplnHdrBean oHrmLvApplnHdrBean = (HrmLvApplnHdrBean)oBaseHeaderBean; String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : ""; oBean = new DBUtilitiesBean(); ArrayList arylstParameters = new ArrayList(); arylstParameters.add(new DBObject(1, 1, 12, sHeaderPrimaryKey)); arylstParameters.add(new DBObject(2, 1, 12, oHrmLvApplnHdrBean.getEmployeeId())); arylstParameters.add(new DBObject(3, 1, 12, oHrmLvApplnHdrBean.getLeaveTypeId())); arylstParameters.add(new DBObject(4, 1, 12, oHrmLvApplnHdrBean.getDays())); arylstParameters.add(new DBObject(5, 2, 12)); arylstParameters.add(new DBObject(6, 2, 12)); arylstParameters.add(new DBObject(7, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMLVAPPLN.proc_UpsertApproveLvApplnHdr(?,?,?,?,?,?,?)"); return sHeaderPrimaryKey; } private void approveLeaveApplTxn(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = null; HrmLvApplnHdrBean oHrmLvApplnHdrBean = (HrmLvApplnHdrBean)oBaseHeaderBean; String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : ""; oBean = new DBUtilitiesBean(); ArrayList arylstParameters = new ArrayList(); String sFlag = oHrmLvApplnHdrBean.getButtonName(); arylstParameters.add(new DBObject(1, 1, 12, sHeaderPrimaryKey)); arylstParameters.add(new DBObject(2, 1, 12, oHrmLvApplnHdrBean.getEmployeeId())); arylstParameters.add(new DBObject(3, 1, 12, oHrmLvApplnHdrBean.getLeaveTypeId())); arylstParameters.add(new DBObject(4, 1, 12, oHrmLvApplnHdrBean.getButtonName())); arylstParameters.add(new DBObject(5, 2, 12)); arylstParameters.add(new DBObject(6, 2, 12)); arylstParameters.add(new DBObject(7, 2, 4)); ArrayList arylstPK = oBean.callProc(arylstParameters, "HRMLVAPPLN.proc_UpsertApproveLvApplnTxn(?,?,?,?,?,?,?)"); } public ArrayList getLeaveDates(HrmLvApplnHdrBean oHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException { if (oHdrBean.getStatusOfLeaves() != null) if (!oHdrBean.getStatusOfLeaves().equals("N")) return getAppliedLeaves(oHdrBean.getHeaderPrimaryKey()); HrmCommonBO oBO = new HrmCommonBO(); ArrayList arylstPrefixDtlBean = new ArrayList(); ArrayList arylstIntDtlBean = new ArrayList(); ArrayList arylstSuffixDtlBean = new ArrayList(); ArrayList arylstErrorList = new ArrayList(); ArrayList arylstParams = new ArrayList(); String sFromDate = oHdrBean.getFromAppDate(); String sToDate = oHdrBean.getToAppDate(); String sWrkgrpId = oHdrBean.getDepartment(); String sLeaveAttrId = oHdrBean.getLeaveTypeId(); String sLeaveCode = oHdrBean.getLeaveCodes(); String sCalId = getCalId(sLeaveAttrId); String sEmpId = oHdrBean.getEmployeeId(); String sSiteId = oHdrBean.getSiteId(); DateUtility oDateUtil = new DateUtility(); int iDateDiff = oDateUtil.dateDiff(oBO.getddmmyyyyDateFormat(sFromDate), oBO.getddmmyyyyDateFormat(sToDate)); if (sFromDate.equals(sToDate)) iDateDiff = 0; if (arylstErrorList.size() != 0) reportError(arylstErrorList); ArrayList arylstFlags = getHrLeaveFlagInfo(sLeaveAttrId); if (arylstFlags != null) { HrmLvMstHdrBean oHrmLvMstHdrBean = arylstFlags.get(0); if (oHrmLvMstHdrBean != null) { double dMinLeave = Double.parseDouble((oHrmLvMstHdrBean.getMinLeave() == null) ? "0" : oHrmLvMstHdrBean.getMinLeave()); if (oHrmLvMstHdrBean.getPrefixSuffix().equals("Y")) arylstPrefixDtlBean = getPrefixDates(sEmpId, sWrkgrpId, sSiteId, sFromDate); if (oHrmLvMstHdrBean.getSuffix().equals("Y")) arylstSuffixDtlBean = getSuffixDates(sEmpId, sWrkgrpId, sSiteId, sToDate); String sInterFlag = oHrmLvMstHdrBean.getIntermediateHoliday(); arylstIntDtlBean = getInterDates(sEmpId, sWrkgrpId, sSiteId, sFromDate, iDateDiff, dMinLeave, sInterFlag); } } this.arylstDtlBean = new ArrayList(); for (int iIndex = arylstPrefixDtlBean.size() - 1; iIndex >= 0; iIndex--) this.arylstDtlBean.add(arylstPrefixDtlBean.get(iIndex)); this.arylstDtlBean.addAll(arylstIntDtlBean); this.arylstDtlBean.addAll(arylstSuffixDtlBean); return this.arylstDtlBean; } private int isHoliday(String sEmpId, String sWrkgrpId, String sSiteId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException { if (isCalendarHoliday(sEmpId, sDate)) return 3; return isEmployeeHoliday(sEmpId, sDate); } private boolean isCalendarHoliday(String sEmpId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sEmpId)); arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(sDate))); arylstParam.add(new DBObject(3, 2, 4)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_getcalhol(?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); int iHolCount = ((Integer)oOutObject.getObject()).intValue(); boolean sReturnValue = !(iHolCount == 0); return sReturnValue; } private int isEmployeeHoliday(String sEmpId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sEmpId)); arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(sDate))); arylstParam.add(new DBObject(3, 2, -10)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_GetEmpHol(?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); if (arylstList == null); QueryRow oRow = null; QueryValue oValue = null; HashMap oColumns = null; Iterator itrBean = arylstList.iterator(); HrmCommonBO oComBO = new HrmCommonBO(); int iDayOfWeek = oComBO.getDayOfWeek(sDate); int iWeekOfMonth = oComBO.getWeekOfMonth(sDate); while (itrBean.hasNext()) { oRow = itrBean.next(); if (iDayOfWeek == Integer.parseInt(oRow.get("rest_day1").getString())) return 3; if (iDayOfWeek == Integer.parseInt(oRow.get("rest_day2").getString())) return 3; if (iDayOfWeek == Integer.parseInt(oRow.get("half_day1").getString())) return 2; if (iDayOfWeek == Integer.parseInt(oRow.get("half_day2").getString())) return 2; if (iDayOfWeek == Integer.parseInt(oRow.get("rest_week_day1").getString()) && iWeekOfMonth == Integer.parseInt(oRow.get("rest_week1").getString())) return 3; if (iDayOfWeek == Integer.parseInt(oRow.get("rest_week_day2").getString()) && iWeekOfMonth == Integer.parseInt(oRow.get("rest_week2").getString())) return 3; } return 0; } private int isWorkgroupHoliday(String sWrkgrpId, String sSiteId, String sDate) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sWrkgrpId)); arylstParam.add(new DBObject(2, 1, 12, sSiteId)); arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sDate))); arylstParam.add(new DBObject(4, 2, -10)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 12)); arylstParam.add(new DBObject(7, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_GetWrkgrpHol(?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); if (arylstList == null); QueryRow oRow = null; QueryValue oValue = null; HashMap oColumns = null; Iterator itrBean = arylstList.iterator(); HrmCommonBO oComBO = new HrmCommonBO(); int iDayOfWeek = oComBO.getDayOfWeek(sDate); int iWeekOfMonth = oComBO.getWeekOfMonth(sDate); while (itrBean.hasNext()) { oRow = itrBean.next(); if (iDayOfWeek == oRow.get("rest_day1").getInt()) return 3; if (iDayOfWeek == oRow.get("rest_day2").getInt()) return 3; if (iDayOfWeek == oRow.get("half_day1").getInt()) return 2; if (iDayOfWeek == oRow.get("half_day2").getInt()) return 2; if (iDayOfWeek == oRow.get("rest_week_day1").getInt() && iWeekOfMonth == oRow.get("rest_week1").getInt()) return 3; if (iDayOfWeek == oRow.get("rest_week_day2").getInt() && iWeekOfMonth == oRow.get("rest_week2").getInt()) return 3; } return 0; } private void processSaveValidation(ArrayList arylstErrorList, String sEmpId, String sLeaveAttrId, String sDays, HrmLvApplnHdrBean oHrmLvApplnHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException { if (this.arylstDtlBean == null) return; if (this.arylstDtlBean.size() == 0) return; if (sLeaveAttrId.equalsIgnoreCase("100200500000662") || sLeaveAttrId.equalsIgnoreCase("200608000000682") || sLeaveAttrId.equalsIgnoreCase("200609000000705")) if (Float.parseFloat(getOutStandingLeaves(sEmpId, sLeaveAttrId)) < Float.parseFloat(sDays)) { ArrayList arrayList = new ArrayList(); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.leaveBalance", arrayList, "E")); } if (sLeaveAttrId.equalsIgnoreCase("100200500000662")) if (Float.parseFloat(sDays) > 4.0D) { ArrayList arrayList = new ArrayList(); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.clError", arrayList, "E")); } if (sLeaveAttrId.equalsIgnoreCase("200609000000705")) if (Float.parseFloat(sDays) > 3.0D) if (!EnrgiseUtil.checkString(oHrmLvApplnHdrBean.getMedFlag()) || !oHrmLvApplnHdrBean.getMedFlag().equalsIgnoreCase("on")) { ArrayList arrayList = new ArrayList(); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.slMedError", arrayList, "E")); } String sStartDate = ((HrmLvApplnDtlBean)this.arylstDtlBean.get(0)).getTxtDate(); String sEndDate = ((HrmLvApplnDtlBean)this.arylstDtlBean.get(this.arylstDtlBean.size() - 1)).getTxtDate(); if (isLeaveOverlapping(sEmpId, sStartDate, sEndDate)) { ArrayList arrayList = new ArrayList(); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.overlappingLeave", arrayList, "E")); } if (!isPrefixAssociated(arylstErrorList, sEmpId, sStartDate, sLeaveAttrId, sDays, oHrmLvApplnHdrBean)) { ArrayList arrayList = new ArrayList(); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.prefixAssocNotAllowed", arrayList, "E")); } if (!isSuffixAssociated(arylstErrorList, sEmpId, sEndDate, sLeaveAttrId, sDays, oHrmLvApplnHdrBean)) { ArrayList arrayList = new ArrayList(); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.suffixAssocNotAllowed", arrayList, "E")); } String sFromDate = oHrmLvApplnHdrBean.getFromAppDate(); String sToDate = oHrmLvApplnHdrBean.getToAppDate(); String sWrkgrpId = oHrmLvApplnHdrBean.getDepartment(); String sCalId = getCalId(sLeaveAttrId); String sSiteId = oHrmLvApplnHdrBean.getSiteId(); ArrayList arylstParams = new ArrayList(); HrmCommonBO oBO = new HrmCommonBO(); if (EnrgiseUtil.checkString(sDays)) if (Double.parseDouble(sDays) <= 4) { if (EnrgiseUtil.compareDates(new SimpleDateFormat("dd-MMM-yyyy"), sToDate, sFromDate) < 0) { MessageKey oMessageKey = new MessageKey("hrm.HrmLvAppln.fromAppDate"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.header.dateValidation", arylstParams, "E")); } String sCalStartDtForFromDate = oBO.getStartDate(sCalId, sFromDate); String sCalStartDtForToDate = oBO.getStartDate(sCalId, sToDate); if (isHoliday(sEmpId, sWrkgrpId, sSiteId, sFromDate) != 0) { MessageKey oMessageKey = new MessageKey("hrm.HrmLvAppln.fromAppDate"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.header.startDateHoliday", arylstParams, "E")); } if (isHoliday(sEmpId, sWrkgrpId, sSiteId, sToDate) != 0) { MessageKey oMessageKey = new MessageKey("hrm.HrmLvAppln.fromAppDate"); arylstParams = new ArrayList(); arylstParams.add(oMessageKey); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.header.endDateHoliday", arylstParams, "E")); } } if (isApproverAbsent(sEmpId)) arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.approverNotFound", arylstParams, "E")); if (isNotEligible(sEmpId, sStartDate, sLeaveAttrId)) arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.notEligible", arylstParams, "E")); Iterator itrDtlArray = this.arylstDtlBean.iterator(); while (itrDtlArray.hasNext()) { HrmLvApplnDtlBean oDtlBean = itrDtlArray.next(); oDtlBean.getTxtDate(); } } private boolean isNotEligible(String sEmpId, String sStartDate, String sLeaveAttrId) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sEmpId)); arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(sStartDate))); arylstParam.add(new DBObject(3, 1, 12, sLeaveAttrId)); arylstParam.add(new DBObject(4, 2, 4)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 12)); arylstParam.add(new DBObject(7, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.procGetEligibility(?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); int iVal = ((Integer)oOutObject.getObject()).intValue(); boolean sReturnValue = (iVal == 0); return sReturnValue; } private boolean isApproverAbsent(String sEmpId) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sEmpId)); arylstParam.add(new DBObject(2, 2, 4)); arylstParam.add(new DBObject(3, 2, 12)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_GetApproverId(?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); int iVal = ((Integer)oOutObject.getObject()).intValue(); boolean sReturnValue = (iVal == 0); return sReturnValue; } private boolean isLeaveOverlappingApprove(String sEmpId, String sStartDate, String sEndDate) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sEmpId)); arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(sStartDate))); arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sEndDate))); arylstParam.add(new DBObject(4, 2, 4)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 12)); arylstParam.add(new DBObject(7, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_GetOverlappingHolApprove(?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); int iVal = ((Integer)oOutObject.getObject()).intValue(); boolean sReturnValue = !(iVal == 0); return sReturnValue; } private boolean isLeaveOverlapping(String sEmpId, String sStartDate, String sEndDate) throws EnrgiseApplicationException, EnrgiseSystemException { DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sEmpId)); arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(sStartDate))); arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sEndDate))); arylstParam.add(new DBObject(4, 2, 4)); arylstParam.add(new DBObject(5, 2, 12)); arylstParam.add(new DBObject(6, 2, 12)); arylstParam.add(new DBObject(7, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_GetOverlappingHol(?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); int iVal = ((Integer)oOutObject.getObject()).intValue(); boolean sReturnValue = !(iVal == 0); return sReturnValue; } private boolean isPrefixAssociated(ArrayList arylstErrorList, String sEmpId, String sStartDate, String sLeaveAttrId, String sDays, HrmLvApplnHdrBean oHrmLvApplnHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException { HrmCommonBO oBo = new HrmCommonBO(); Date dDate = oBo.getPreviousDay(sStartDate, 1); String sDate = EnrgiseUtil.convertToString(dDate); DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sEmpId)); arylstParam.add(new DBObject(2, 1, 12, sLeaveAttrId)); arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sDate))); arylstParam.add(new DBObject(4, 1, 12, sDays)); arylstParam.add(new DBObject(5, 1, 12, String.valueOf(oHrmLvApplnHdrBean.getMedFlag()).equalsIgnoreCase("on") ? "Y" : "N")); arylstParam.add(new DBObject(6, 2, 4)); arylstParam.add(new DBObject(7, 2, 12)); arylstParam.add(new DBObject(8, 2, 12)); arylstParam.add(new DBObject(9, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_getassociatedholPref(?,?,?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); int iVal = ((Integer)oOutObject.getObject()).intValue(); boolean sReturnValue = !(iVal == 0); if (iVal == 2) { ArrayList arylstParams = new ArrayList(); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.prefixAssocNotAllowedCL", arylstParams, "E")); } if (iVal == 3) { ArrayList arylstParams = new ArrayList(); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.MedicalErr", arylstParams, "E")); } return sReturnValue; } private boolean isSuffixAssociated(ArrayList arylstErrorList, String sEmpId, String sEndDate, String sLeaveAttrId, String sDays, HrmLvApplnHdrBean oHrmLvApplnHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException { HrmCommonBO oBo = new HrmCommonBO(); Date dDate = oBo.getNextDay(sEndDate, 1); String sDate = EnrgiseUtil.convertToString(dDate); DBUtilitiesBean oBean = new DBUtilitiesBean(); ArrayList arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sEmpId)); arylstParam.add(new DBObject(2, 1, 12, sLeaveAttrId)); arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(sDate))); arylstParam.add(new DBObject(4, 1, 12, sDays)); arylstParam.add(new DBObject(5, 1, 12, String.valueOf(oHrmLvApplnHdrBean.getMedFlag()).equalsIgnoreCase("on") ? "Y" : "N")); arylstParam.add(new DBObject(6, 2, 4)); arylstParam.add(new DBObject(7, 2, 12)); arylstParam.add(new DBObject(8, 2, 12)); arylstParam.add(new DBObject(9, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_getassociatedholSuf(?,?,?,?,?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); int iVal = ((Integer)oOutObject.getObject()).intValue(); boolean sReturnValue = !(iVal == 0); if (iVal == 2) { ArrayList arylstParams = new ArrayList(); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.suffixAssocNotAllowedCL", arylstParams, "E")); } if (iVal == 3) { ArrayList arylstParams = new ArrayList(); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.MedicalErr", arylstParams, "E")); } if (iVal == 4) { ArrayList arylstParams = new ArrayList(); arylstErrorList.add(new EnrgiseMessageKeyException("hrm.HrmLvAppln.onlysicklvallowed", arylstParams, "E")); } return sReturnValue; } public ArrayList getAppliedLeaves(String sHdrPK) throws EnrgiseSystemException { ArrayList arylstParam = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); arylstParam = new ArrayList(); arylstParam.add(new DBObject(1, 1, 12, sHdrPK)); arylstParam.add(new DBObject(2, 2, -10)); arylstParam.add(new DBObject(3, 2, 12)); arylstParam.add(new DBObject(4, 2, 12)); arylstParam.add(new DBObject(5, 2, 4)); ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMLVAPPLN.proc_GetAppliedLeaves(?,?,?,?,?)"); DBObject oOutObject = arylstOutArray.get(0); ArrayList arylstList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; QueryValue oValue = null; HashMap oColumns = null; Iterator itrBean = arylstList.iterator(); ArrayList arylstDtlBean = new ArrayList(); while (itrBean.hasNext()) { oRow = itrBean.next(); HrmLvApplnDtlBean oDtlBean = new HrmLvApplnDtlBean(); oDtlBean.setDisabtxtDate("true"); oDtlBean.setDisabtxtHolidayFlag("true"); oDtlBean.setDisabtxtHalfDayFlag("true"); oDtlBean.setDetailId(oRow.get("ID").getString()); oDtlBean.setTxtDate(EnrgiseUtil.convertToString(oRow.get("EFFECT_DATE").getDate())); oDtlBean.setTxtHolidayFlag(oRow.get("WORK_DAY_FLAG").getString()); oDtlBean.setTxtHalfDayFlag(oRow.get("PART_FLAG").getString()); arylstDtlBean.add(oDtlBean); } return arylstDtlBean; } private String getHolidayCount(ArrayList arylstDtl) { double dHolidayCount = 0.0D; if (arylstDtl != null) { Iterator itrDtlList = arylstDtl.iterator(); while (itrDtlList.hasNext()) { HrmLvApplnDtlBean oDtlBean = itrDtlList.next(); if (!oDtlBean.getTxtHolidayFlag().equalsIgnoreCase("H")) { if (!oDtlBean.getTxtHalfDayFlag().equalsIgnoreCase("3")) { dHolidayCount += 0.5D; continue; } dHolidayCount++; } } } return Double.toString(dHolidayCount); } public WflStatus callWorkFlow(BaseHeaderBean oBaseHeaderBean, ArrayList arylstDetailBeanArray, String activity, String initiatedFlag) throws EnrgiseApplicationException, EnrgiseSystemException { try { WorkFlowFacade2Home oHome = (WorkFlowFacade2Home)WorkFlowServiceLocator2.getLocator().getService("WorkFlowFacade2"); WorkFlowFacade2 workFlowFacade = oHome.create(); HrmLvApplnHdrBean oHdrBean = (HrmLvApplnHdrBean)oBaseHeaderBean; WflResourceImpl wflResourceImpl = new WflResourceImpl(); wflResourceImpl.setEmployeeId(this.oUserInfo.getUserTypeId()); WflSiteImpl wflSiteImpl = new WflSiteImpl(); wflSiteImpl.setSiteId(this.oUserInfo.getSiteId()); wflResourceImpl.setLoginSite((WflSite)wflSiteImpl); WflDocumentInfoImpl wflDocumentInfoImpl = new WflDocumentInfoImpl(); wflDocumentInfoImpl.setRequester((WflResource)wflResourceImpl); wflDocumentInfoImpl.setDocumentId(oHdrBean.getHeaderPrimaryKey()); wflDocumentInfoImpl.setDocumentType("Leave"); wflDocumentInfoImpl.setInitiatedFlag(initiatedFlag); String documentTypeId = workFlowFacade.getDocumentTypeId("Leave"); if (documentTypeId == null) throw new EnrgiseSystemException(); if (!EnrgiseUtil.checkString(initiatedFlag)) wflDocumentInfoImpl.setWorkListId(oBaseHeaderBean.getWorkListId()); String activityId = workFlowFacade.getActivityId(activity); if (activityId == null) throw new EnrgiseSystemException(); wflDocumentInfoImpl.setDocumentTypeId(documentTypeId); if (!activity.equalsIgnoreCase("Reject")) { wflDocumentInfoImpl.setDocumentNumber(String.valueOf(String.valueOf("Leave Application For: ").concat(String.valueOf(oHdrBean.getHeaderPrimaryKey()))).concat(String.valueOf(" is pending for approval"))); wflDocumentInfoImpl.setDocDesc(String.valueOf("The following document has been pending for approval: Leave Application For:").concat(String.valueOf(oHdrBean.getHeaderPrimaryKey()))); } else if (!activity.equalsIgnoreCase("Approve")) { wflDocumentInfoImpl.setDocumentNumber(String.valueOf(String.valueOf("Leave Application For: ").concat(String.valueOf(oHdrBean.getHeaderPrimaryKey()))).concat(String.valueOf(" is pending for rejection"))); wflDocumentInfoImpl.setDocDesc(String.valueOf("The following document has been pending for rejection: Leave Application For:").concat(String.valueOf(oHdrBean.getHeaderPrimaryKey()))); } wflDocumentInfoImpl.setModuleId("8"); wflDocumentInfoImpl.setCreator((WflResource)wflResourceImpl); wflDocumentInfoImpl.setRequesterAction(activityId); HashMap oProp = new HashMap(); oProp.put("Leave", oHdrBean.getLeaveTypeId()); wflDocumentInfoImpl.setDocumentAttributes(oProp); WflAuthorizationBean wflAuthBean = workFlowFacade.canDo((WflDocumentInfo)wflDocumentInfoImpl); if (EnrgiseUtil.checkString(wflAuthBean.getErrorCode())) throw new EnrgiseApplicationException(wflAuthBean.getErrorCode()); if (!wflAuthBean.isAuthStatus()) throw new EnrgiseApplicationException("wenrgise.workflow.submit.notauthorized"); WflStatus wflStatus = workFlowFacade.process((WflDocumentInfo)wflDocumentInfoImpl); if (wflStatus.getStatus().equals("Error")) throw new EnrgiseSystemException(); workFlowFacade.remove(); return wflStatus; } catch (RemoteException oRtEx) { System.out.println(String.valueOf(String.valueOf(String.valueOf("The prblem is ").concat(String.valueOf(oRtEx.getMessage()))).concat(String.valueOf(" the type is "))).concat(String.valueOf(oRtEx.getClass().getName()))); throw new EnrgiseSystemException("wenrgise.workflow.connect", oRtEx); } catch (CreateException oCx) { System.out.println(String.valueOf(String.valueOf(String.valueOf("The prblem is ").concat(String.valueOf(oCx.getMessage()))).concat(String.valueOf(" the type is "))).concat(String.valueOf(oCx.getClass().getName()))); throw new EnrgiseSystemException("wenrgise.workflow.connect", oCx); } catch (RemoveException oRx) { System.out.println(String.valueOf(String.valueOf(String.valueOf("The prblem is ").concat(String.valueOf(oRx.getMessage()))).concat(String.valueOf(" the type is "))).concat(String.valueOf(oRx.getClass().getName()))); throw new EnrgiseSystemException("wenrgise.workflow.connect", oRx); } catch (Exception oEx) { System.out.println(String.valueOf(String.valueOf(String.valueOf("The prblem is ").concat(String.valueOf(oEx.getMessage()))).concat(String.valueOf(" the type is "))).concat(String.valueOf(oEx.getClass().getName()))); throw new EnrgiseSystemException("wenrgise.workflow.connect", oEx); } } public LovVO getHrmLvApplnEmpNoNLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException { LovVO oLovVO = new LovVO(); ArrayList arylstHeaderList = new ArrayList(); arylstHeaderList.add("ID"); arylstHeaderList.add("hrm.HrmEmpPersonalDetails.employeeNo"); arylstHeaderList.add("hrm.HrmEmpPersonalDetails.firstName"); arylstHeaderList.add("hrm.HrmEmpPersonalDetails.middleName"); arylstHeaderList.add("hrm.HrmEmpPersonalDetails.lastName"); arylstHeaderList.add("hrm.HrmEmpLoanAppln.grade"); arylstHeaderList.add("hrm.HrmEmpLoanAppln.designation"); arylstHeaderList.add("hrm.HrmEmpLoanAppln.location"); oLovVO.setHeaderList(arylstHeaderList); ArrayList arylstVisibility = new ArrayList(); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); oLovVO.setVisibilityList(arylstVisibility); int count = 0; ArrayList oParameters = new ArrayList(); ArrayList oList = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); String sQuerySearch1 = new String(); String sQuerySearch2 = new String(); if (oLovQueryVO.getSearchField1() != null) sQuerySearch1 = oLovQueryVO.getSearchField1(); if (oLovQueryVO.getSearchField2() != null) sQuerySearch2 = oLovQueryVO.getSearchField2(); String sSiteId = oLovQueryVO.getProperty("ListSiteId"); oParameters = new ArrayList(); oParameters.add(new DBObject(1, 1, 12, sQuerySearch1)); oParameters.add(new DBObject(2, 1, 12, sQuerySearch2)); oParameters.add(new DBObject(3, 1, 12, sSiteId)); oParameters.add(new DBObject(4, 2, -10)); oParameters.add(new DBObject(5, 2, 12)); oParameters.add(new DBObject(6, 2, 12)); oParameters.add(new DBObject(7, 2, 4)); ArrayList oOutArray = oBean.callProc(oParameters, "hrmlvappln.procGetEmpLOVN(?,?,?,?,?,?,?)"); DBObject oOutObject = oOutArray.get(0); oList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; Iterator iter = oList.iterator(); while (iter.hasNext()) { if (count == 0) oList = new ArrayList(); count++; oRow = iter.next(); LOVBean oLOVBean = new LOVBean(); oLOVBean.setDetailField1(oRow.get("ID").getString()); oLOVBean.setDetailField2(oRow.get("EMP_NO").getString()); oLOVBean.setDetailField3(oRow.get("FIRST_NAME").getString()); oLOVBean.setDetailField4(oRow.get("MIDDLE_NAME").getString()); oLOVBean.setDetailField5(oRow.get("LAST_NAME").getString()); oLOVBean.setDetailField6(oRow.get("GRADE").getString()); oLOVBean.setDetailField7(oRow.get("DESIGNATION").getString()); oLOVBean.setDetailField8(oRow.get("LOCATION").getString()); oList.add(oLOVBean); } oLovVO.setDetailList(oList); return oLovVO; } public LovVO getHrmLvApplnEmpNoQLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException { LovVO oLovVO = new LovVO(); ArrayList arylstHeaderList = new ArrayList(); arylstHeaderList.add("ID"); arylstHeaderList.add("hrm.HrmEmpPersonalDetails.employeeNo"); arylstHeaderList.add("hrm.HrmEmpPersonalDetails.firstName"); arylstHeaderList.add("hrm.HrmEmpPersonalDetails.middleName"); arylstHeaderList.add("hrm.HrmEmpPersonalDetails.lastName"); arylstHeaderList.add("hrm.HrmEmpLoanAppln.grade"); arylstHeaderList.add("hrm.HrmEmpLoanAppln.designation"); arylstHeaderList.add("hrm.HrmEmpLoanAppln.location"); oLovVO.setHeaderList(arylstHeaderList); ArrayList arylstVisibility = new ArrayList(); arylstVisibility.add("H"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); arylstVisibility.add("V"); oLovVO.setVisibilityList(arylstVisibility); int count = 0; ArrayList oParameters = new ArrayList(); ArrayList oList = new ArrayList(); DBUtilitiesBean oBean = new DBUtilitiesBean(); String sQuerySearch1 = new String(); String sQuerySearch2 = new String(); String sSiteId = new String(); if (oLovQueryVO.getSearchField1() != null) sQuerySearch1 = oLovQueryVO.getSearchField1(); if (oLovQueryVO.getSearchField2() != null) sQuerySearch2 = oLovQueryVO.getSearchField2(); sSiteId = oLovQueryVO.getProperty("ListSiteId"); oParameters = new ArrayList(); oParameters.add(new DBObject(1, 1, 12, sQuerySearch1)); oParameters.add(new DBObject(2, 1, 12, sQuerySearch2)); oParameters.add(new DBObject(3, 1, 12, sSiteId)); oParameters.add(new DBObject(4, 2, -10)); oParameters.add(new DBObject(5, 2, 12)); oParameters.add(new DBObject(6, 2, 12)); oParameters.add(new DBObject(7, 2, 4)); ArrayList oOutArray = oBean.callProc(oParameters, "hrmlvappln.procGetEmpLOVQ(?,?,?,?,?,?,?)"); DBObject oOutObject = oOutArray.get(0); oList = (ArrayList)oOutObject.getObject(); QueryRow oRow = null; Iterator iter = oList.iterator(); while (iter.hasNext()) { if (count == 0) oList = new ArrayList(); count++; oRow = iter.next(); LOVBean oLOVBean = new LOVBean(); oLOVBean.setDetailField1(oRow.get("ID").getString()); oLOVBean.setDetailField2(oRow.get("EMP_NO").getString()); oLOVBean.setDetailField3(oRow.get("FIRST_NAME").getString()); oLOVBean.setDetailField4(oRow.get("MIDDLE_NAME").getString()); oLOVBean.setDetailField5(oRow.get("LAST_NAME").getString()); oLOVBean.setDetailField6(oRow.get("GRADE").getString()); oLOVBean.setDetailField7(oRow.get("DESIGNATION").getString()); oLOVBean.setDetailField8(oRow.get("LOCATION").getString()); oList.add(oLOVBean); } oLovVO.setDetailList(oList); return oLovVO; } }