903 lines
47 KiB
Java
903 lines
47 KiB
Java
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.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.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.WorkFlowServiceLocator;
|
|
import wenrgise.common.vo.BaseDetailVO;
|
|
import wenrgise.common.vo.BaseHeaderVO;
|
|
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.HrmOrgClassDtlBean;
|
|
import wenrgise.hrms.bean.HrmTrngEmpReqDtlBean;
|
|
import wenrgise.hrms.bean.HrmTrngEmpReqHdrBean;
|
|
import wenrgise.hrms.vo.HrmTrngEmpReqQVO;
|
|
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.WorkFlowFacade;
|
|
import wenrgise.workflow.ejb.facade.WorkFlowFacadeHome;
|
|
|
|
public class HrmTrngEmpReqBO extends HrmBaseBO {
|
|
String checkFullPart = "";
|
|
|
|
public HrmTrngEmpReqBO() {}
|
|
|
|
public HrmTrngEmpReqBO(UserInfo oUserInfo) {
|
|
super(oUserInfo);
|
|
}
|
|
|
|
public RecordMetaInfo getHrmEmpTrngReqHdrMetaInfo(HrmTrngEmpReqQVO oHrmTrngEmpReqQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
Timestamp oWhenPicked = null;
|
|
int count = 0;
|
|
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, oHrmTrngEmpReqQVO.getHeaderPrimaryKey()));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmTrngEmpReqQVO.getEmpId()));
|
|
arylstParameters.add(new DBObject(3, 2, -5));
|
|
arylstParameters.add(new DBObject(4, 2, 93));
|
|
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, "HRMTRNGREQBAT.proc_HrTrngReqHdrCount(?,?,?,?,?,?,?)");
|
|
RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo();
|
|
DBObject oTimeObject = arylstOutArray.get(1);
|
|
oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject());
|
|
DBObject oTotalRecord = arylstOutArray.get(0);
|
|
oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue());
|
|
return oRecordMetaInfo;
|
|
}
|
|
|
|
public ArrayList getHrmEmpTrngReqHeaderInfo(HrmTrngEmpReqQVO oHrmTrngEmpReqQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
Timestamp oWhenPicked = null;
|
|
int count = 0;
|
|
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
|
|
ArrayList arylstHeaderList = null;
|
|
if (oHrmTrngEmpReqQVO == null)
|
|
oHrmTrngEmpReqQVO = new HrmTrngEmpReqQVO();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, -5, new Long(lStartPosition)));
|
|
arylstParameters.add(new DBObject(2, 1, -5, new Long(lLastPosition)));
|
|
arylstParameters.add(new DBObject(3, 1, 12, oHrmTrngEmpReqQVO.getHeaderPrimaryKey()));
|
|
arylstParameters.add(new DBObject(4, 1, 12, oHrmTrngEmpReqQVO.getEmpId()));
|
|
arylstParameters.add(new DBObject(5, 2, -10));
|
|
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, "HRMTRNGREQBAT.proc_HrTrngReqHdr(?,?,?,?,?,?,?,?)");
|
|
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();
|
|
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
|
|
while (itrBean.hasNext()) {
|
|
if (count == 0)
|
|
arylstHeaderList = new ArrayList();
|
|
count++;
|
|
oRow = itrBean.next();
|
|
HrmTrngEmpReqHdrBean oHrmTrngEmpReqHdrBean = new HrmTrngEmpReqHdrBean();
|
|
oHrmTrngEmpReqHdrBean.setHeaderPrimaryKey(oRow.get("ID").getString());
|
|
String empId = oRow.get("EMPID").getString();
|
|
oHrmTrngEmpReqHdrBean.setEmpId(oRow.get("EMPID").getString());
|
|
oHrmTrngEmpReqHdrBean.setEmployeeNumber(oRow.get("EMP_NO").getString());
|
|
oHrmTrngEmpReqHdrBean.setFirstName(oRow.get("FIRST_NAME").getString());
|
|
oHrmTrngEmpReqHdrBean.setMiddleName(oRow.get("MIDDLE_NAME").getString());
|
|
oHrmTrngEmpReqHdrBean.setLastName(oRow.get("LAST_NAME").getString());
|
|
oHrmTrngEmpReqHdrBean.setGrade(oRow.get("GRADE").getString());
|
|
oHrmTrngEmpReqHdrBean.setDesig(oRow.get("DESIGNATION").getString());
|
|
oHrmTrngEmpReqHdrBean.setLocation(oRow.get("LOCATION").getString());
|
|
oHrmTrngEmpReqHdrBean.setCourseId(oRow.get("COURSEID").getString());
|
|
oHrmTrngEmpReqHdrBean.setCourseName(oRow.get("CRS_NAME").getString());
|
|
oHrmTrngEmpReqHdrBean.setCalId(oRow.get("CALID").getString());
|
|
oHrmTrngEmpReqHdrBean.setTrainingCalendar(oRow.get("CAL_NAME").getString());
|
|
oHrmTrngEmpReqHdrBean.setInstitutionName(oRow.get("INST_NAME").getString());
|
|
oHrmTrngEmpReqHdrBean.setNature(oRow.get("NATURE").getString());
|
|
oHrmTrngEmpReqHdrBean.setPurpose(oRow.get("PURPOSE").getString());
|
|
oHrmTrngEmpReqHdrBean.setRecommenderId(oRow.get("RECOMENDER").getString());
|
|
oHrmTrngEmpReqHdrBean.setRecommender(oRow.get("RECONAME").getString());
|
|
oHrmTrngEmpReqHdrBean.setApprovalStatus(oRow.get("APPROVED_FLAG").getString());
|
|
oHrmTrngEmpReqHdrBean.setRejectionRemarks(oRow.get("REJECTION_REMARK").getString());
|
|
ArrayList empInfo = new ArrayList();
|
|
HrmOrgClassDtlBean def = null;
|
|
HrmEmpPersBO oHrmEmpPersBO = new HrmEmpPersBO();
|
|
empInfo = oHrmEmpPersBO.getHrEmpInfoByclass(empId, "10");
|
|
Iterator itrBean10 = empInfo.iterator();
|
|
while (itrBean10.hasNext()) {
|
|
def = itrBean10.next();
|
|
oHrmTrngEmpReqHdrBean.setDesignation(def.getTxtDescription());
|
|
}
|
|
empInfo = new ArrayList();
|
|
empInfo = oHrmEmpPersBO.getHrEmpInfoByclass(empId, "15");
|
|
Iterator itrBean2 = empInfo.iterator();
|
|
while (itrBean2.hasNext()) {
|
|
def = itrBean2.next();
|
|
oHrmTrngEmpReqHdrBean.setScaleOfPay(def.getTxtDescription());
|
|
}
|
|
String fullPartFlg = oRow.get("FULL_PART").getString();
|
|
if (fullPartFlg.equalsIgnoreCase("Y")) {
|
|
fullPartFlg = "On";
|
|
} else {
|
|
fullPartFlg = "Off";
|
|
}
|
|
oHrmTrngEmpReqHdrBean.setFullPart(fullPartFlg);
|
|
oHrmTrngEmpReqHdrBean.setDateSubmitted(EnrgiseUtil.convertToString(oRow.get("DATE_SUBMITTED").getDate()));
|
|
oHrmTrngEmpReqHdrBean.setStartDate(EnrgiseUtil.convertToString(oRow.get("START_DATE").getDate()));
|
|
oHrmTrngEmpReqHdrBean.setEndDate(EnrgiseUtil.convertToString(oRow.get("END_DATE").getDate()));
|
|
arylstHeaderList.add(oHrmTrngEmpReqHdrBean);
|
|
}
|
|
return arylstHeaderList;
|
|
}
|
|
|
|
public RecordMetaInfo getHrmEmpReqDetailMetaInfo(String lPrimaryKey) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, lPrimaryKey));
|
|
arylstParameters.add(new DBObject(2, 2, -5));
|
|
arylstParameters.add(new DBObject(3, 2, 93));
|
|
arylstParameters.add(new DBObject(4, 2, 12));
|
|
arylstParameters.add(new DBObject(5, 2, 12));
|
|
arylstParameters.add(new DBObject(6, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRNGREQBAT.proc_HrEmpTrngReqDtlCount(?,?,?,?,?,?)");
|
|
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 getHrmEmpReqDetail(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
BaseDetailVO oBaseDetailVO = null;
|
|
ArrayList arylstHrmTrngReqDetail = null;
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, -5, new Long(lDetailFirstPosition)));
|
|
arylstParameters.add(new DBObject(2, 1, -5, new Long(lDetailLastPosition)));
|
|
arylstParameters.add(new DBObject(3, 1, 12, lPrimaryKey));
|
|
arylstParameters.add(new DBObject(4, 2, -10));
|
|
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, "HRMTRNGREQBAT.proc_GetHrEmpTrngReqDtl(?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
if (arylstList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
Iterator itrBean = arylstList.iterator();
|
|
while (itrBean.hasNext()) {
|
|
if (count == 0)
|
|
arylstHrmTrngReqDetail = new ArrayList();
|
|
count++;
|
|
oRow = itrBean.next();
|
|
HrmTrngEmpReqDtlBean oHrmTrngEmpReqDtlBean = new HrmTrngEmpReqDtlBean();
|
|
oHrmTrngEmpReqDtlBean.setDetailId(oRow.get("HRM_TRNG_PART_ID").getString());
|
|
oHrmTrngEmpReqDtlBean.setDate(EnrgiseUtil.convertToString(oRow.get("TRAINING_DATE").getDate()));
|
|
oHrmTrngEmpReqDtlBean.setParticipation(oRow.get("PARTICIPATION").getString());
|
|
arylstHrmTrngReqDetail.add(oHrmTrngEmpReqDtlBean);
|
|
}
|
|
return arylstHrmTrngReqDetail;
|
|
}
|
|
|
|
public LovVO getHrmTrgReqCalLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderNames = new ArrayList();
|
|
arylstHeaderNames.add("Cal Id");
|
|
arylstHeaderNames.add("hrm.HrmEmpTrngReq.trainingCalendar");
|
|
arylstHeaderNames.add("hrm.HrmEmpTrngReq.courseName");
|
|
arylstHeaderNames.add("hrm.HrmEmpTrngReq.institutionName");
|
|
arylstHeaderNames.add("hrm.HrmEmpTrngReq.startDate");
|
|
arylstHeaderNames.add("hrm.HrmEmpTrngReq.endDate");
|
|
oLovVO.setHeaderList(arylstHeaderNames);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
ArrayList arylstParameters = new ArrayList();
|
|
String courseId = null;
|
|
String startDate = null;
|
|
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("courseId") != null)
|
|
courseId = oLovQueryVO.getProperty("courseId");
|
|
if (oLovQueryVO.getProperty("startDate") != null)
|
|
startDate = oLovQueryVO.getProperty("startDate");
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
arylstParameters.add(new DBObject(2, 1, 12, sQuerySearch2));
|
|
arylstParameters.add(new DBObject(3, 1, 12, courseId));
|
|
arylstParameters.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(startDate)));
|
|
arylstParameters.add(new DBObject(5, 2, -10));
|
|
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, "HRMTRNGLOV.proc_GetTrngReqCalLOV(?,?,?,?,?,?,?,?)");
|
|
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("CALNAME").getString());
|
|
oLOVBean.setDetailField3(oRow.get("NAME").getString());
|
|
oLOVBean.setDetailField4(oRow.get("INST_NAME").getString());
|
|
oLOVBean.setDetailField5(EnrgiseUtil.convertToString(oRow.get("START_DATE").getDate()));
|
|
oLOVBean.setDetailField6(EnrgiseUtil.convertToString(oRow.get("END_DATE").getDate()));
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmTrgReqRecoLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("ID");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.employeeNumber");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.recoName");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
ArrayList arylstParameters = 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();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
arylstParameters.add(new DBObject(2, 1, 12, sQuerySearch2));
|
|
arylstParameters.add(new DBObject(3, 2, -10));
|
|
arylstParameters.add(new DBObject(4, 2, 12));
|
|
arylstParameters.add(new DBObject(5, 2, 12));
|
|
arylstParameters.add(new DBObject(6, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRNGLOV.proc_GetHrmTrngReqEmpLOVdata(?,?,?,?,?,?)");
|
|
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("RECONAME").getString());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmTrgReqCourseLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("Course Id");
|
|
arylstHeaderList.add("hrm.HrmTrnInCoDtl.course");
|
|
arylstHeaderList.add("hrm.HrmTrnInCoDtl.courseName");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
String countryId = null;
|
|
String calId = null;
|
|
ArrayList arylstParameters = 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();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
arylstParameters.add(new DBObject(2, 1, 12, sQuerySearch2));
|
|
arylstParameters.add(new DBObject(3, 2, -10));
|
|
arylstParameters.add(new DBObject(4, 2, 12));
|
|
arylstParameters.add(new DBObject(5, 2, 12));
|
|
arylstParameters.add(new DBObject(6, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRNGLOV.proc_GetTrgReqCourseLOV(?,?,?,?,?,?)");
|
|
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("COURSE").getString());
|
|
oLOVBean.setDetailField3(oRow.get("NAME").getString());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmTrgReqEmpLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("ID");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.employeeNumber");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.firstName");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.middleName");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.lastName");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.courseName");
|
|
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");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
ArrayList arylstParameters = 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();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
arylstParameters.add(new DBObject(2, 1, 12, sQuerySearch2));
|
|
arylstParameters.add(new DBObject(3, 2, -10));
|
|
arylstParameters.add(new DBObject(4, 2, 12));
|
|
arylstParameters.add(new DBObject(5, 2, 12));
|
|
arylstParameters.add(new DBObject(6, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRNGLOV.proc_GetHrmTrngEmpLOVdata(?,?,?,?,?,?)");
|
|
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("FIRST_NAME").getString());
|
|
oLOVBean.setDetailField4(oRow.get("MIDDLE_NAME").getString());
|
|
oLOVBean.setDetailField5(oRow.get("LAST_NAME").getString());
|
|
oLOVBean.setDetailField6(oRow.get("NAME").getString());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public void initializeBOImpl() {
|
|
this.headerTable = "HRM_TRNG_REQ";
|
|
}
|
|
|
|
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
|
|
if (sScreenName.equals("HrmTrngEmpReq"))
|
|
saveHrEmpTrngReqDtl(sHeaderPrimaryKey, arylstDetailBeanArray);
|
|
}
|
|
|
|
private void saveHrEmpTrngReqDtl(String sHeaderPrimaryKey, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
|
|
boolean bInsert = false;
|
|
boolean bUpdate = false;
|
|
boolean bDelete = false;
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = null;
|
|
DBUtilitiesBean oBean1 = null;
|
|
Iterator itrBean = arylstDetailBeanArray.iterator();
|
|
while (itrBean.hasNext()) {
|
|
HrmTrngEmpReqDtlBean oHrmTrngEmpReqDtlBean = itrBean.next();
|
|
if (!oHrmTrngEmpReqDtlBean.getStatus().equals("N"))
|
|
if (oHrmTrngEmpReqDtlBean.getStatus().equals("U")) {
|
|
if (!bUpdate) {
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMTRNGREQBAT.proc_UpsertHrEmpTrngReqDtl(?,?,?,?,?,?)");
|
|
bUpdate = true;
|
|
}
|
|
if (this.checkFullPart.equalsIgnoreCase("On"))
|
|
oHrmTrngEmpReqDtlBean.setParticipation("Y");
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, "U"));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmTrngEmpReqDtlBean.getDetailId()));
|
|
arylstParameters.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
|
|
arylstParameters.add(new DBObject(4, 1, 12, oHrmTrngEmpReqDtlBean.getParticipation()));
|
|
arylstParameters.add(new DBObject(5, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParameters.add(new DBObject(6, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean.addToBatch(arylstParameters);
|
|
} else if (oHrmTrngEmpReqDtlBean.getStatus().equals("D")) {
|
|
|
|
}
|
|
if (bUpdate)
|
|
oBean.executeBatch();
|
|
}
|
|
}
|
|
|
|
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
System.out.println("Update ille!");
|
|
}
|
|
|
|
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
return "saveNewHeaderImpl ille!";
|
|
}
|
|
|
|
public void additionalFieldValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstList = new ArrayList();
|
|
if (bHeaderDataChanged)
|
|
if (!sScreenMode.equalsIgnoreCase("D"))
|
|
checkMandatoryHeader((HrmTrngEmpReqHdrBean)oBaseHeaderBean);
|
|
}
|
|
|
|
private void checkMandatoryHeader(HrmTrngEmpReqHdrBean oHrmTrngEmpReqHdrBean) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
ArrayList oParams = new ArrayList();
|
|
ArrayList oErrorList = new ArrayList();
|
|
if (!EnrgiseUtil.checkString(oHrmTrngEmpReqHdrBean.getNature())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmEmpTrngReq.nature");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmTrngEmpReqHdrBean.getCourseName())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmEmpTrngReq.courseName");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmTrngEmpReqHdrBean.getDateSubmitted())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmEmpTrngReq.dateSubmitted");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmTrngEmpReqHdrBean.getTrainingCalendar())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmEmpTrngReq.trainingCalendar");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
|
|
|
|
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
|
|
String returnString = null;
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
DateUtility d = new DateUtility();
|
|
HrmTrngEmpReqHdrBean oHrmTrngEmpReqHdrBean = (HrmTrngEmpReqHdrBean)oBaseHeaderBean;
|
|
String fullPart = "";
|
|
if (oHrmTrngEmpReqHdrBean.getFullPart().equalsIgnoreCase("On")) {
|
|
fullPart = "Y";
|
|
this.checkFullPart = "Y";
|
|
} else {
|
|
fullPart = "N";
|
|
}
|
|
if (ScreenMode.equalsIgnoreCase("N")) {
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, "i"));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmTrngEmpReqHdrBean.getCalId()));
|
|
arylstParameters.add(new DBObject(3, 1, 12, oHrmTrngEmpReqHdrBean.getCourseId()));
|
|
arylstParameters.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmTrngEmpReqHdrBean.getDateSubmitted())));
|
|
arylstParameters.add(new DBObject(5, 1, 12, oHrmTrngEmpReqHdrBean.getEmpId()));
|
|
arylstParameters.add(new DBObject(6, 1, 12, oHrmTrngEmpReqHdrBean.getRecommenderId()));
|
|
arylstParameters.add(new DBObject(7, 1, 12, oHrmTrngEmpReqHdrBean.getNature()));
|
|
arylstParameters.add(new DBObject(8, 1, 12, oHrmTrngEmpReqHdrBean.getPurpose()));
|
|
arylstParameters.add(new DBObject(9, 1, 12, oHrmTrngEmpReqHdrBean.getApprovalStatus()));
|
|
arylstParameters.add(new DBObject(10, 1, 12, oHrmTrngEmpReqHdrBean.getRejectionRemarks()));
|
|
arylstParameters.add(new DBObject(11, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmTrngEmpReqHdrBean.getStartDate())));
|
|
arylstParameters.add(new DBObject(12, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmTrngEmpReqHdrBean.getEndDate())));
|
|
arylstParameters.add(new DBObject(13, 1, 12, fullPart));
|
|
arylstParameters.add(new DBObject(14, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParameters.add(new DBObject(15, 1, 12, this.oUserInfo.getSiteId()));
|
|
arylstParameters.add(new DBObject(16, 1, 12, null));
|
|
arylstParameters.add(new DBObject(17, 2, 12));
|
|
arylstParameters.add(new DBObject(18, 2, 12));
|
|
arylstParameters.add(new DBObject(19, 2, 12));
|
|
arylstParameters.add(new DBObject(20, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRNGREQBAT.proc_UpsertHrmEmpTrngReqHdr(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
returnString = (String)oOutObject.getObject();
|
|
System.out.println(returnString);
|
|
} else if (ScreenMode.equalsIgnoreCase("U")) {
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, "u"));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmTrngEmpReqHdrBean.getCalId()));
|
|
arylstParameters.add(new DBObject(3, 1, 12, oHrmTrngEmpReqHdrBean.getCourseId()));
|
|
arylstParameters.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmTrngEmpReqHdrBean.getDateSubmitted())));
|
|
arylstParameters.add(new DBObject(5, 1, 12, oHrmTrngEmpReqHdrBean.getEmpId()));
|
|
arylstParameters.add(new DBObject(6, 1, 12, oHrmTrngEmpReqHdrBean.getRecommenderId()));
|
|
arylstParameters.add(new DBObject(7, 1, 12, oHrmTrngEmpReqHdrBean.getNature()));
|
|
arylstParameters.add(new DBObject(8, 1, 12, oHrmTrngEmpReqHdrBean.getPurpose()));
|
|
arylstParameters.add(new DBObject(9, 1, 12, oHrmTrngEmpReqHdrBean.getApprovalStatus()));
|
|
arylstParameters.add(new DBObject(10, 1, 12, oHrmTrngEmpReqHdrBean.getRejectionRemarks()));
|
|
arylstParameters.add(new DBObject(11, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmTrngEmpReqHdrBean.getStartDate())));
|
|
arylstParameters.add(new DBObject(12, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmTrngEmpReqHdrBean.getEndDate())));
|
|
arylstParameters.add(new DBObject(13, 1, 12, fullPart));
|
|
arylstParameters.add(new DBObject(14, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParameters.add(new DBObject(15, 1, 12, this.oUserInfo.getSiteId()));
|
|
arylstParameters.add(new DBObject(16, 1, 12, oHrmTrngEmpReqHdrBean.getHeaderPrimaryKey()));
|
|
arylstParameters.add(new DBObject(17, 2, 12));
|
|
arylstParameters.add(new DBObject(18, 2, 12));
|
|
arylstParameters.add(new DBObject(19, 2, 12));
|
|
arylstParameters.add(new DBObject(20, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRNGREQBAT.proc_UpsertHrmEmpTrngReqHdr(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
returnString = (String)oOutObject.getObject();
|
|
System.out.println(returnString);
|
|
}
|
|
return returnString;
|
|
}
|
|
|
|
public String approveEmpTrngReq(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = null;
|
|
HrmTrngEmpReqHdrBean oHrmTrngEmpReqHdrBean = (HrmTrngEmpReqHdrBean)oBaseHeaderBean;
|
|
String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : "";
|
|
WflStatus status = null;
|
|
if (!EnrgiseUtil.checkString(oBaseHeaderBean.getWorkListId())) {
|
|
status = callWorkFlow(oBaseHeaderBean, arylstDetailBeanArray, "Approve", "Initiated");
|
|
} else {
|
|
status = callWorkFlow(oBaseHeaderBean, arylstDetailBeanArray, "Approve", (String)null);
|
|
}
|
|
if (status.getStatus().equalsIgnoreCase("FinallyApproved")) {
|
|
Iterator itrBean = arylstDetailBeanArray.iterator();
|
|
HrmTrngEmpReqDtlBean oHrmTrngEmpReqDtlBean = itrBean.next();
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMTRNGREQBAT.proc_UpsertApproveDtl(?,?,?,?,?,?,?,?,?,?)");
|
|
ArrayList arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, "U"));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmTrngEmpReqDtlBean.getDetailId()));
|
|
arylstParameters.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
|
|
arylstParameters.add(new DBObject(4, 1, 12, oHrmTrngEmpReqHdrBean.getEmpId()));
|
|
arylstParameters.add(new DBObject(5, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmTrngEmpReqDtlBean.getDate())));
|
|
arylstParameters.add(new DBObject(6, 1, 12, oHrmTrngEmpReqHdrBean.getCalId()));
|
|
arylstParameters.add(new DBObject(7, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmTrngEmpReqHdrBean.getStartDate())));
|
|
arylstParameters.add(new DBObject(8, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmTrngEmpReqHdrBean.getEndDate())));
|
|
arylstParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean.addToBatch(arylstParameters);
|
|
oBean.executeBatch();
|
|
}
|
|
return sHeaderPrimaryKey;
|
|
}
|
|
|
|
public String submitEmpTrngReq(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = null;
|
|
HrmTrngEmpReqHdrBean oHrmTrngEmpReqHdrBean = (HrmTrngEmpReqHdrBean)oBaseHeaderBean;
|
|
String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : "";
|
|
Iterator itrBean = arylstDetailBeanArray.iterator();
|
|
HrmTrngEmpReqDtlBean oHrmTrngEmpReqDtlBean = itrBean.next();
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMTRNGREQBAT.proc_UpsertApproveDtl(?,?,?,?,?,?,?,?,?,?)");
|
|
ArrayList arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, "U"));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmTrngEmpReqDtlBean.getDetailId()));
|
|
arylstParameters.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
|
|
arylstParameters.add(new DBObject(4, 1, 12, oHrmTrngEmpReqHdrBean.getEmpId()));
|
|
arylstParameters.add(new DBObject(5, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmTrngEmpReqDtlBean.getDate())));
|
|
arylstParameters.add(new DBObject(6, 1, 12, oHrmTrngEmpReqHdrBean.getCalId()));
|
|
arylstParameters.add(new DBObject(7, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmTrngEmpReqHdrBean.getStartDate())));
|
|
arylstParameters.add(new DBObject(8, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmTrngEmpReqHdrBean.getEndDate())));
|
|
arylstParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean.addToBatch(arylstParameters);
|
|
oBean.executeBatch();
|
|
return sHeaderPrimaryKey;
|
|
}
|
|
|
|
public String rejectEmpTrngReq(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = null;
|
|
HrmTrngEmpReqHdrBean oHrmTrngEmpReqHdrBean = (HrmTrngEmpReqHdrBean)oBaseHeaderBean;
|
|
String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : "";
|
|
WflStatus status = null;
|
|
status = callWorkFlow(oBaseHeaderBean, arylstDetailBeanArray, "Reject", (String)null);
|
|
if (status.getStatus().equalsIgnoreCase("Rejected")) {
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMTRNGREQBAT.proc_rejectEmpReq(?,?,?,?)");
|
|
ArrayList arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, "U"));
|
|
arylstParameters.add(new DBObject(2, 1, 12, sHeaderPrimaryKey));
|
|
arylstParameters.add(new DBObject(3, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParameters.add(new DBObject(4, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean.addToBatch(arylstParameters);
|
|
oBean.executeBatch();
|
|
}
|
|
return sHeaderPrimaryKey;
|
|
}
|
|
|
|
public WflStatus callWorkFlow(BaseHeaderBean oBaseHeaderBean, ArrayList arylstDetailBeanArray, String activity, String initiatedFlag) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
try {
|
|
WorkFlowFacadeHome oHome = (WorkFlowFacadeHome)WorkFlowServiceLocator.getLocator().getService("WorkFlowFacade");
|
|
WorkFlowFacade workFlowFacade = oHome.create();
|
|
HrmTrngEmpReqHdrBean oHrmTrngEmpReqHdrBean = (HrmTrngEmpReqHdrBean)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(oHrmTrngEmpReqHdrBean.getHeaderPrimaryKey());
|
|
wflDocumentInfoImpl.setDocumentType("Training");
|
|
wflDocumentInfoImpl.setInitiatedFlag(initiatedFlag);
|
|
String documentTypeId = workFlowFacade.getDocumentTypeId("TrngReq");
|
|
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("Training Requirement:").concat(String.valueOf(oHrmTrngEmpReqHdrBean.getHeaderPrimaryKey()))).concat(String.valueOf("is pending for approval")));
|
|
wflDocumentInfoImpl.setDocDesc(String.valueOf("The following document has been pending for approval:Training Requirement:").concat(String.valueOf(oHrmTrngEmpReqHdrBean.getHeaderPrimaryKey())));
|
|
} else if (!activity.equalsIgnoreCase("Approve")) {
|
|
wflDocumentInfoImpl.setDocumentNumber(String.valueOf(String.valueOf("Training Requirement:").concat(String.valueOf(oHrmTrngEmpReqHdrBean.getHeaderPrimaryKey()))).concat(String.valueOf("is pending for rejection")));
|
|
wflDocumentInfoImpl.setDocDesc(String.valueOf("The following document has been pending for rejection:Training Requirement:").concat(String.valueOf(oHrmTrngEmpReqHdrBean.getHeaderPrimaryKey())));
|
|
}
|
|
wflDocumentInfoImpl.setModuleId("8");
|
|
wflDocumentInfoImpl.setCreator((WflResource)wflResourceImpl);
|
|
wflDocumentInfoImpl.setRequesterAction(activityId);
|
|
HashMap oProp = new HashMap();
|
|
oProp.put("1", "1");
|
|
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) {
|
|
throw new EnrgiseSystemException("wenrgise.workflow.connect", oRtEx);
|
|
} catch (CreateException oCx) {
|
|
throw new EnrgiseSystemException("wenrgise.workflow.connect", oCx);
|
|
} catch (RemoveException oRx) {
|
|
throw new EnrgiseSystemException("wenrgise.workflow.connect", oRx);
|
|
}
|
|
}
|
|
|
|
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();
|
|
HrmTrngEmpReqHdrBean oHrmTrngEmpReqHdrBean = (HrmTrngEmpReqHdrBean)oBaseHeaderBean;
|
|
if (bHeaderDataChanged)
|
|
if (!sScreenMode.equalsIgnoreCase("D"))
|
|
checkDatesConstraint((HrmTrngEmpReqHdrBean)oBaseHeaderBean, arylstErrorList);
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
private void checkDatesConstraint(HrmTrngEmpReqHdrBean oHrmTrngEmpReqHdrBean, ArrayList arylstErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
|
|
if (EnrgiseUtil.checkString(oHrmTrngEmpReqHdrBean.getEndDate())) {
|
|
int iDateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmTrngEmpReqHdrBean.getEndDate(), oHrmTrngEmpReqHdrBean.getStartDate());
|
|
if (iDateFlag == -1 && iDateFlag != -2)
|
|
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.common.dateConstraintViolated"));
|
|
}
|
|
if (EnrgiseUtil.checkString(oHrmTrngEmpReqHdrBean.getEndDate())) {
|
|
int iDateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmTrngEmpReqHdrBean.getEndDate(), oHrmTrngEmpReqHdrBean.getDateSubmitted());
|
|
if (iDateFlag == -1 && iDateFlag != -2)
|
|
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.common.dateConstraintViolated"));
|
|
}
|
|
}
|
|
|
|
public LovVO getEmpCodeLOVdataQ(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
String sEmpId = null;
|
|
if (oLovQueryVO.getProperty("employeeId") != null)
|
|
sEmpId = oLovQueryVO.getProperty("employeeId");
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("ID");
|
|
arylstHeaderList.add("hrm.HrmLeaveLedger.employeeNo");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.firstName");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.middleName");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.lastName");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.grade");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.desig");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.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 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, sEmpId));
|
|
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, "HRMTRNGREQBAT.getEmpCodeQuery(?,?,?,?,?,?,?)");
|
|
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("empNo").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());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getEmpCodeLOVdataN(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
String sEmpId = null;
|
|
if (oLovQueryVO.getProperty("employeeId") != null)
|
|
sEmpId = oLovQueryVO.getProperty("employeeId");
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("ID");
|
|
arylstHeaderList.add("hrm.HrmLeaveLedger.employeeNo");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.firstName");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.middleName");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.lastName");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.grade");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.desig");
|
|
arylstHeaderList.add("hrm.HrmEmpTrngReq.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 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, sEmpId));
|
|
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, "HRMTRNGREQBAT.getEmpCodeNew(?,?,?,?,?,?,?)");
|
|
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("empNo").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());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public String getGroupInfo(String oUserTypeId) throws EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
int count = 0;
|
|
String groupStatus = null;
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, oUserTypeId));
|
|
arylstParam.add(new DBObject(2, 2, 12));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMTRNGREQBAT.getGroupId(?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
groupStatus = (String)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
return groupStatus;
|
|
}
|
|
}
|