753 lines
41 KiB
Java
753 lines
41 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.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.HrmEmpTransCnclApplHdrBean;
|
|
import wenrgise.hrms.vo.HrmATDTransCnclApplQVO;
|
|
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 HrmATDTransCnclApplBO extends HrmBaseBO {
|
|
public HrmATDTransCnclApplBO() {}
|
|
|
|
public HrmATDTransCnclApplBO(UserInfo oUserInfo) {
|
|
super(oUserInfo);
|
|
}
|
|
|
|
public RecordMetaInfo getHrmEmpTransCnclAppHdrMetaInfo(HrmATDTransCnclApplQVO oHrmATDTransCnclApplQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
Timestamp oWhenPicked = null;
|
|
int iCount = 0;
|
|
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, oHrmATDTransCnclApplQVO.getHeaderPrimaryKey()));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmATDTransCnclApplQVO.getEmpId()));
|
|
arylstParameters.add(new DBObject(3, 1, 12, oHrmATDTransCnclApplQVO.getApplnNo()));
|
|
arylstParameters.add(new DBObject(4, 2, -5));
|
|
arylstParameters.add(new DBObject(5, 2, 93));
|
|
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, "HRMEMPTRANSCNCL.proc_GetHrEmpTransCnclHdrCount(?,?,?,?,?,?,?,?)");
|
|
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 getHrmEmpTransCnclAppHeaderInfo(HrmATDTransCnclApplQVO oHrmATDTransCnclApplQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
Timestamp oWhenPicked = null;
|
|
int iCount = 0;
|
|
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
|
|
ArrayList arylstHeaderList = null;
|
|
if (oHrmATDTransCnclApplQVO == null)
|
|
oHrmATDTransCnclApplQVO = new HrmATDTransCnclApplQVO();
|
|
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, oHrmATDTransCnclApplQVO.getHeaderPrimaryKey()));
|
|
arylstParameters.add(new DBObject(4, 1, 12, oHrmATDTransCnclApplQVO.getEmpId()));
|
|
arylstParameters.add(new DBObject(5, 1, 12, oHrmATDTransCnclApplQVO.getApplnNo()));
|
|
arylstParameters.add(new DBObject(6, 2, -10));
|
|
arylstParameters.add(new DBObject(7, 2, 12));
|
|
arylstParameters.add(new DBObject(8, 2, 12));
|
|
arylstParameters.add(new DBObject(9, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMEMPTRANSCNCL.proc_GetHrEmpTransCnclHdr(?,?,?,?,?,?,?,?,?)");
|
|
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 oIt = arylstList.iterator();
|
|
while (oIt.hasNext()) {
|
|
if (iCount == 0)
|
|
arylstHeaderList = new ArrayList();
|
|
iCount++;
|
|
oRow = oIt.next();
|
|
HrmEmpTransCnclApplHdrBean oTransCnclAppHeader = new HrmEmpTransCnclApplHdrBean();
|
|
oTransCnclAppHeader.setHeaderPrimaryKey(oRow.get("ID").getString());
|
|
oTransCnclAppHeader.setApplnNo(oRow.get("APPLICATION_NO").getString());
|
|
oTransCnclAppHeader.setGeneratedBy(oRow.get("SELF_OFFICE_FLAG").getString());
|
|
oTransCnclAppHeader.setEmpNo(oRow.get("EMP_NO").getString());
|
|
oTransCnclAppHeader.setEmpName(oRow.get("EMPNAME").getString());
|
|
oTransCnclAppHeader.setEmpId(oRow.get("EMP_ID").getString());
|
|
oTransCnclAppHeader.setOfcNoteNo(oRow.get("OFFICE_NOTE_NO").getString());
|
|
oTransCnclAppHeader.setOrderDtlId(oRow.get("ORDER_DTL_ID").getString());
|
|
oTransCnclAppHeader.setApplnDate(EnrgiseUtil.convertToString(oRow.get("APPLICATION_DATE").getDate()));
|
|
oTransCnclAppHeader.setOfcNoteDate(EnrgiseUtil.convertToString(oRow.get("OFFICE_ORDER_DATE").getDate()));
|
|
oTransCnclAppHeader.setDeferredDate(EnrgiseUtil.convertToString(oRow.get("DEFER_DATE").getDate()));
|
|
oTransCnclAppHeader.setEffectDate(EnrgiseUtil.convertToString(oRow.get("TRANSFER_EFFECT_DATE").getDate()));
|
|
oTransCnclAppHeader.setOrderDate(EnrgiseUtil.convertToString(oRow.get("TRANSFER_ORDER_DATE").getDate()));
|
|
oTransCnclAppHeader.setCancelDeferFlag(oRow.get("CNCL_DEFR_FLAG").getString());
|
|
oTransCnclAppHeader.setDefermentPeriod(oRow.get("DEFER_PERIOD").getString());
|
|
oTransCnclAppHeader.setDeferredStatus(oRow.get("APPROVED_FLAG").getString());
|
|
oTransCnclAppHeader.setReason(oRow.get("REASON").getString());
|
|
oTransCnclAppHeader.setOrderNo(oRow.get("TRANSFER_ORDER_NO").getString());
|
|
if (oRow.get("TRANS_APP_TYPE").getString().equalsIgnoreCase("L")) {
|
|
oTransCnclAppHeader.setTrnOrderType("Locational");
|
|
} else {
|
|
oTransCnclAppHeader.setTrnOrderType("Sectional");
|
|
}
|
|
oTransCnclAppHeader.setFromSite(oRow.get("FROM_SITE_NAME").getString());
|
|
oTransCnclAppHeader.setToSite(oRow.get("TO_SITE_NAME").getString());
|
|
oTransCnclAppHeader.setFromDesignation(oRow.get("FROM_DESIGNATION").getString());
|
|
oTransCnclAppHeader.setToDesignation(oRow.get("TO_DESIGNATION").getString());
|
|
oTransCnclAppHeader.setFromWorkGroup(oRow.get("FROM_WORKGROUP").getString());
|
|
oTransCnclAppHeader.setToWorkGroup(oRow.get("TO_WORKGROUP").getString());
|
|
arylstHeaderList.add(oTransCnclAppHeader);
|
|
}
|
|
return arylstHeaderList;
|
|
}
|
|
|
|
public LovVO getHrmTrnApplnNoLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("applnNoId");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.applnNo");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int iCount = 0;
|
|
String empId = null;
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
String sQuerySearch1 = new String();
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sQuerySearch1 = oLovQueryVO.getSearchField1();
|
|
if (oLovQueryVO.getProperty("empId") != null) {
|
|
empId = oLovQueryVO.getProperty("empId");
|
|
System.out.println(empId);
|
|
}
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
arylstParameters.add(new DBObject(2, 1, 12, empId));
|
|
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, "HRMTRNSFRLOV.proc_GetHrmTrnsfrApplnLOV1data(?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = arylstList.iterator();
|
|
while (iter.hasNext()) {
|
|
if (iCount == 0)
|
|
arylstList = new ArrayList();
|
|
iCount++;
|
|
oRow = iter.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("APPLICATION_NO").getString());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmTrnCnclOfcNoteNoLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("ofcNoteId");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.ofcNoteNo");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int iCount = 0;
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
String sQuerySearch1 = new String();
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sQuerySearch1 = oLovQueryVO.getSearchField1();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
arylstParameters.add(new DBObject(2, 2, -10));
|
|
arylstParameters.add(new DBObject(3, 2, 12));
|
|
arylstParameters.add(new DBObject(4, 2, 12));
|
|
arylstParameters.add(new DBObject(5, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRNSFRLOV.proc_GetHrmTrnsfrOfcLOV1data(?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = arylstList.iterator();
|
|
while (iter.hasNext()) {
|
|
if (iCount == 0)
|
|
arylstList = new ArrayList();
|
|
iCount++;
|
|
oRow = iter.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("OFFICE_NOTE_NO").getString());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmTrnCnclEmpNoLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("orderDtlId");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.empNo");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.empName");
|
|
arylstHeaderList.add("empId");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.orderNo");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.orderDate");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.fromWorkgroup");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.toWorkgroup");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.fromDesignation");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.toDesignation");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.trnOrderType");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.fromSite");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.toSite");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.effectDate");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
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 iCount = 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, "HRMTRNSFRLOV.proc_GetHrmTrnsEmpNoLOV1data(?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = arylstList.iterator();
|
|
while (iter.hasNext()) {
|
|
if (iCount == 0)
|
|
arylstList = new ArrayList();
|
|
iCount++;
|
|
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());
|
|
oLOVBean.setDetailField4(oRow.get("EMP_ID").getString());
|
|
oLOVBean.setDetailField5(oRow.get("TRANSFER_ORDER_NO").getString());
|
|
oLOVBean.setDetailField6(EnrgiseUtil.convertToString(oRow.get("TRANSFER_ORDER_DATE").getDate()));
|
|
oLOVBean.setDetailField7(oRow.get("FROM_WORKGROUP").getString());
|
|
oLOVBean.setDetailField8(oRow.get("TO_WORKGROUP").getString());
|
|
oLOVBean.setDetailField9(oRow.get("FROM_DESIGNATION").getString());
|
|
oLOVBean.setDetailField10(oRow.get("TO_DESIGNATION").getString());
|
|
oLOVBean.setDetailField11(oRow.get("TRANSFER_ORDER_TYPE").getString());
|
|
oLOVBean.setDetailField12(oRow.get("FROM_SITE_NAME").getString());
|
|
oLOVBean.setDetailField13(oRow.get("TO_SITE_NAME").getString());
|
|
oLOVBean.setDetailField14(EnrgiseUtil.convertToString(oRow.get("TRANSFER_EFFECT_DATE").getDate()));
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmTrnCnclEmpNoInsLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("orderDtlId");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.empNo");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.empName");
|
|
arylstHeaderList.add("empId");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.orderNo");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.orderDate");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.fromWorkgroup");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.toWorkgroup");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.fromDesignation");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.toDesignation");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.trnOrderType");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.fromSite");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.toSite");
|
|
arylstHeaderList.add("hrm.HrmCancApplcn.effectDate");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
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 iCount = 0;
|
|
String empId = 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();
|
|
if (oLovQueryVO.getProperty("empId") != null) {
|
|
empId = oLovQueryVO.getProperty("empId");
|
|
System.out.println(empId);
|
|
}
|
|
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, empId));
|
|
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, "HRMTRNSFRLOV.proc_GetHrmTrnsEmpInsLOV1data(?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = arylstList.iterator();
|
|
while (iter.hasNext()) {
|
|
if (iCount == 0)
|
|
arylstList = new ArrayList();
|
|
iCount++;
|
|
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());
|
|
oLOVBean.setDetailField4(oRow.get("EMP_ID").getString());
|
|
oLOVBean.setDetailField5(oRow.get("TRANSFER_ORDER_NO").getString());
|
|
oLOVBean.setDetailField6(EnrgiseUtil.convertToString(oRow.get("TRANSFER_ORDER_DATE").getDate()));
|
|
oLOVBean.setDetailField7(oRow.get("FROM_WORKGROUP").getString());
|
|
oLOVBean.setDetailField8(oRow.get("TO_WORKGROUP").getString());
|
|
oLOVBean.setDetailField9(oRow.get("FROM_DESIGNATION").getString());
|
|
oLOVBean.setDetailField10(oRow.get("TO_DESIGNATION").getString());
|
|
oLOVBean.setDetailField11(oRow.get("TRANSFER_ORDER_TYPE").getString());
|
|
oLOVBean.setDetailField12(oRow.get("FROM_SITE_NAME").getString());
|
|
oLOVBean.setDetailField13(oRow.get("TO_SITE_NAME").getString());
|
|
oLOVBean.setDetailField14(EnrgiseUtil.convertToString(oRow.get("TRANSFER_EFFECT_DATE").getDate()));
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
arylstList = checkLOVConstraint(arylstList);
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public void initializeBOImpl() {
|
|
this.headerTable = "HRM_EMP_TRANS_CNCL_APPL";
|
|
}
|
|
|
|
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {}
|
|
|
|
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {}
|
|
|
|
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
return "No Save";
|
|
}
|
|
|
|
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();
|
|
if (bHeaderDataChanged)
|
|
if (!sScreenMode.equalsIgnoreCase("D"))
|
|
checkMandatoryHeader((HrmEmpTransCnclApplHdrBean)oBaseHeaderBean);
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
private void checkMandatoryHeader(HrmEmpTransCnclApplHdrBean oHrmEmpTransCnclApplHdrBean) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
ArrayList oErrorList = new ArrayList();
|
|
ArrayList oParams = new ArrayList();
|
|
if (!EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getApplnNo())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmCancApplcn.applnNo");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getApplnDate())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmCancApplcn.applnDate");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getReason())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmCancApplcn.reason");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getEmpNo())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmCancApplcn.employeeNo");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
private void checkHeaderFields(HrmEmpTransCnclApplHdrBean oHrmEmpTransCnclApplHdrBean) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
ArrayList arylstList1 = new ArrayList();
|
|
if (oHrmEmpTransCnclApplHdrBean.getGeneratedBy().equalsIgnoreCase("O"))
|
|
if (!EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getOfcNoteDate()) || !EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getOfcNoteNo()))
|
|
arylstList1.add(new EnrgiseApplicationException("wenrgise.empTransCncl.office.value"));
|
|
if (oHrmEmpTransCnclApplHdrBean.getGeneratedBy().equalsIgnoreCase("S"))
|
|
if (EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getOfcNoteDate()) || EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getOfcNoteNo()))
|
|
arylstList1.add(new EnrgiseApplicationException("wenrgise.common.header.value"));
|
|
if (oHrmEmpTransCnclApplHdrBean.getCancelDeferFlag().equalsIgnoreCase("C"))
|
|
if (EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getDefermentPeriod()) || EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getDeferredDate()))
|
|
arylstList1.add(new EnrgiseApplicationException("wenrgise.common.header.value"));
|
|
if (oHrmEmpTransCnclApplHdrBean.getCancelDeferFlag().equalsIgnoreCase("C"))
|
|
if (EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getDefermentPeriod()) || EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getDeferredDate()))
|
|
arylstList1.add(new EnrgiseApplicationException("wenrgise.common.header.value"));
|
|
if (oHrmEmpTransCnclApplHdrBean.getCancelDeferFlag().equalsIgnoreCase("D"))
|
|
if (!EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getDeferredDate()))
|
|
arylstList1.add(new EnrgiseApplicationException("wenrgise.empTransCncl.defer.value"));
|
|
reportError(arylstList1);
|
|
}
|
|
|
|
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList arylstParam6, 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();
|
|
HrmEmpTransCnclApplHdrBean oHrmEmpTransCnclApplHdrBean = (HrmEmpTransCnclApplHdrBean)oBaseHeaderBean;
|
|
if (bHeaderDataChanged) {
|
|
if (!sScreenMode.equalsIgnoreCase("D")) {
|
|
checkUniqueHeader((HrmEmpTransCnclApplHdrBean)oBaseHeaderBean);
|
|
checkDatesConstraint((HrmEmpTransCnclApplHdrBean)oBaseHeaderBean, arylstErrorList);
|
|
}
|
|
if (sScreenMode.equalsIgnoreCase("D"))
|
|
if (!oHrmEmpTransCnclApplHdrBean.getDeferredStatus().equalsIgnoreCase("N"))
|
|
if (arylstErrorList.isEmpty())
|
|
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.common.deletion.rejected"));
|
|
}
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
private void checkUniqueHeader(HrmEmpTransCnclApplHdrBean oHrmEmpTransCnclApplHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sQuery = String.valueOf(String.valueOf(" Select ID as ID from hrm_emp_trans_cncl_appl where application_no= '").concat(String.valueOf(oHrmEmpTransCnclApplHdrBean.getApplnNo()))).concat(String.valueOf("'"));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstList = oBean.executeQuery(sQuery);
|
|
Iterator oIt = arylstList.iterator();
|
|
if (oIt.hasNext()) {
|
|
QueryRow oRow = oIt.next();
|
|
if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmEmpTransCnclApplHdrBean.getHeaderPrimaryKey()))
|
|
throw new EnrgiseApplicationException("wenrgise.common.header.uniqueConstraintViolated", "M");
|
|
}
|
|
}
|
|
|
|
private void checkDatesConstraint(HrmEmpTransCnclApplHdrBean oHrmEmpTransCnclApplHdrBean, ArrayList arylstErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
|
|
if (EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getOfcNoteDate())) {
|
|
int iDateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmEmpTransCnclApplHdrBean.getOfcNoteDate(), oHrmEmpTransCnclApplHdrBean.getApplnDate());
|
|
if (iDateFlag == -1 && iDateFlag != -2)
|
|
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.empTransCncl.officedateConstraintViolated"));
|
|
}
|
|
if (EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getApplnDate())) {
|
|
int iDateFlag1 = EnrgiseUtil.compareDates(dateFormat, oHrmEmpTransCnclApplHdrBean.getApplnDate(), oHrmEmpTransCnclApplHdrBean.getOrderDate());
|
|
if (iDateFlag1 == -1 && iDateFlag1 != -2)
|
|
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.empTransCncl.appdateConstraintViolated"));
|
|
}
|
|
}
|
|
|
|
public String getHrOrderInfo(String sOrdDtlId) throws EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int iCount = 0;
|
|
String sStatus = null;
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sOrdDtlId));
|
|
arylstParameters.add(new DBObject(2, 2, -10));
|
|
arylstParameters.add(new DBObject(3, 2, 12));
|
|
arylstParameters.add(new DBObject(4, 2, 12));
|
|
arylstParameters.add(new DBObject(5, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRNSFRLOV.proc_GetHrmTrnCnlAppEmpdata(?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
Iterator oIt = arylstList.iterator();
|
|
while (oIt.hasNext()) {
|
|
oRow = oIt.next();
|
|
sStatus = oRow.get("APPROVED_FLAG").getString();
|
|
}
|
|
return sStatus;
|
|
}
|
|
|
|
private ArrayList checkLOVConstraint(ArrayList arylstList) throws EnrgiseSystemException {
|
|
LOVBean def = null;
|
|
ArrayList arylstNewList = new ArrayList();
|
|
Iterator oit = arylstList.iterator();
|
|
while (oit.hasNext()) {
|
|
def = oit.next();
|
|
String Id = def.getDetailField1();
|
|
String sFlag = getHrOrderInfo(Id);
|
|
if (sFlag == null)
|
|
arylstNewList.add(def);
|
|
if (sFlag != null)
|
|
if (!sFlag.equalsIgnoreCase("P") && !sFlag.equalsIgnoreCase("N") && !sFlag.equalsIgnoreCase("A"))
|
|
arylstNewList.add(def);
|
|
}
|
|
return arylstNewList;
|
|
}
|
|
|
|
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
|
|
String returnString = null;
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
DateUtility d = new DateUtility();
|
|
String defPeriod = null;
|
|
HrmEmpTransCnclApplHdrBean oHrmEmpTransCnclApplHdrBean = (HrmEmpTransCnclApplHdrBean)oBaseHeaderBean;
|
|
if (ScreenMode.equalsIgnoreCase("N")) {
|
|
if (EnrgiseUtil.checkString(oHrmEmpTransCnclApplHdrBean.getDeferredDate()))
|
|
oHrmEmpTransCnclApplHdrBean.setDefermentPeriod(defPeriod);
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, "N"));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmEmpTransCnclApplHdrBean.getOrderDtlId()));
|
|
arylstParameters.add(new DBObject(3, 1, 12, oHrmEmpTransCnclApplHdrBean.getApplnNo()));
|
|
arylstParameters.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpTransCnclApplHdrBean.getApplnDate())));
|
|
arylstParameters.add(new DBObject(5, 1, 12, oHrmEmpTransCnclApplHdrBean.getGeneratedBy()));
|
|
arylstParameters.add(new DBObject(6, 1, 12, oHrmEmpTransCnclApplHdrBean.getOfcNoteNo()));
|
|
arylstParameters.add(new DBObject(7, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpTransCnclApplHdrBean.getOfcNoteDate())));
|
|
arylstParameters.add(new DBObject(8, 1, 12, oHrmEmpTransCnclApplHdrBean.getCancelDeferFlag()));
|
|
arylstParameters.add(new DBObject(9, 1, 12, oHrmEmpTransCnclApplHdrBean.getDefermentPeriod()));
|
|
arylstParameters.add(new DBObject(10, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpTransCnclApplHdrBean.getDeferredDate())));
|
|
arylstParameters.add(new DBObject(11, 1, 12, oHrmEmpTransCnclApplHdrBean.getReason()));
|
|
arylstParameters.add(new DBObject(12, 1, 12, "A"));
|
|
arylstParameters.add(new DBObject(13, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpTransCnclApplHdrBean.getEffectDate())));
|
|
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, "HRMEMPTRANSCNCL.proc_UpsertHrEmpTrnsCnclApp(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
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, oHrmEmpTransCnclApplHdrBean.getOrderDtlId()));
|
|
arylstParameters.add(new DBObject(3, 1, 12, oHrmEmpTransCnclApplHdrBean.getApplnNo()));
|
|
arylstParameters.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpTransCnclApplHdrBean.getApplnDate())));
|
|
arylstParameters.add(new DBObject(5, 1, 12, oHrmEmpTransCnclApplHdrBean.getGeneratedBy()));
|
|
arylstParameters.add(new DBObject(6, 1, 12, oHrmEmpTransCnclApplHdrBean.getOfcNoteNo()));
|
|
arylstParameters.add(new DBObject(7, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpTransCnclApplHdrBean.getOfcNoteDate())));
|
|
arylstParameters.add(new DBObject(8, 1, 12, oHrmEmpTransCnclApplHdrBean.getCancelDeferFlag()));
|
|
arylstParameters.add(new DBObject(9, 1, 12, oHrmEmpTransCnclApplHdrBean.getDefermentPeriod()));
|
|
arylstParameters.add(new DBObject(10, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpTransCnclApplHdrBean.getDeferredDate())));
|
|
arylstParameters.add(new DBObject(11, 1, 12, oHrmEmpTransCnclApplHdrBean.getReason()));
|
|
arylstParameters.add(new DBObject(12, 1, 12, oHrmEmpTransCnclApplHdrBean.getDeferredStatus()));
|
|
arylstParameters.add(new DBObject(13, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmEmpTransCnclApplHdrBean.getEffectDate())));
|
|
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, oHrmEmpTransCnclApplHdrBean.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, "HRMEMPTRANSCNCL.proc_UpsertHrEmpTrnsCnclApp(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
returnString = (String)oOutObject.getObject();
|
|
System.out.println(returnString);
|
|
} else if (ScreenMode.equalsIgnoreCase("D")) {
|
|
arylstParameters.add(new DBObject(1, 1, 12, oHrmEmpTransCnclApplHdrBean.getHeaderPrimaryKey()));
|
|
arylstParameters.add(new DBObject(2, 2, 12));
|
|
arylstParameters.add(new DBObject(3, 2, 12));
|
|
arylstParameters.add(new DBObject(4, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMEMPTRANSCNCL.proc_DelHrmEmpTransCnclApplHdr(?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
returnString = null;
|
|
}
|
|
return returnString;
|
|
}
|
|
|
|
public String submitTransferCnclAppln(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = null;
|
|
HrmEmpTransCnclApplHdrBean oHrmEmpTransCnclApplHdrBean = (HrmEmpTransCnclApplHdrBean)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("Pending")) {
|
|
oBean = new DBUtilitiesBean();
|
|
ArrayList arylstParameters = new ArrayList();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sHeaderPrimaryKey));
|
|
arylstParameters.add(new DBObject(2, 2, 12));
|
|
arylstParameters.add(new DBObject(3, 2, 12));
|
|
arylstParameters.add(new DBObject(4, 2, 4));
|
|
ArrayList arrayList = oBean.callProc(arylstParameters, "HRMEMPTRANSCNCL.procSubmitTransferCnclAppl(?,?,?,?)");
|
|
}
|
|
return sHeaderPrimaryKey;
|
|
}
|
|
|
|
public String approveTransferCnclAppln(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = null;
|
|
HrmEmpTransCnclApplHdrBean oHrmEmpTransCnclApplHdrBean = (HrmEmpTransCnclApplHdrBean)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")) {
|
|
oBean = new DBUtilitiesBean();
|
|
ArrayList arylstParameters = new ArrayList();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sHeaderPrimaryKey));
|
|
arylstParameters.add(new DBObject(2, 2, 12));
|
|
arylstParameters.add(new DBObject(3, 2, 12));
|
|
arylstParameters.add(new DBObject(4, 2, 4));
|
|
ArrayList arrayList = oBean.callProc(arylstParameters, "HRMEMPTRANSCNCL.procApproveTransferCnclAppl(?,?,?,?)");
|
|
}
|
|
return sHeaderPrimaryKey;
|
|
}
|
|
|
|
public String rejectTransferCnclAppln(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = null;
|
|
HrmEmpTransCnclApplHdrBean oHrmEmpTransCnclApplHdrBean = (HrmEmpTransCnclApplHdrBean)oBaseHeaderBean;
|
|
String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : "";
|
|
WflStatus status = null;
|
|
if (!EnrgiseUtil.checkString(oBaseHeaderBean.getWorkListId())) {
|
|
status = callWorkFlow(oBaseHeaderBean, arylstDetailBeanArray, "Reject", "Initiated");
|
|
} else {
|
|
status = callWorkFlow(oBaseHeaderBean, arylstDetailBeanArray, "Reject", (String)null);
|
|
}
|
|
if (status.getStatus().equalsIgnoreCase("Rejected")) {
|
|
oBean = new DBUtilitiesBean();
|
|
ArrayList arylstParameters = new ArrayList();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sHeaderPrimaryKey));
|
|
arylstParameters.add(new DBObject(2, 2, 12));
|
|
arylstParameters.add(new DBObject(3, 2, 12));
|
|
arylstParameters.add(new DBObject(4, 2, 4));
|
|
ArrayList arrayList = oBean.callProc(arylstParameters, "HRMEMPTRANSCNCL.procRejectTransferCnclAppl(?,?,?,?)");
|
|
}
|
|
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();
|
|
HrmEmpTransCnclApplHdrBean oHrmEmpTransCnclApplHdrBean = (HrmEmpTransCnclApplHdrBean)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(oHrmEmpTransCnclApplHdrBean.getHeaderPrimaryKey());
|
|
wflDocumentInfoImpl.setDocumentType("Transfer");
|
|
wflDocumentInfoImpl.setInitiatedFlag(initiatedFlag);
|
|
String documentTypeId = workFlowFacade.getDocumentTypeId("TransCncl");
|
|
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("Transfer Cancellation Application No:").concat(String.valueOf(oHrmEmpTransCnclApplHdrBean.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(oHrmEmpTransCnclApplHdrBean.getHeaderPrimaryKey())));
|
|
} else if (!activity.equalsIgnoreCase("Approve")) {
|
|
wflDocumentInfoImpl.setDocumentNumber(String.valueOf(String.valueOf("Transfer Cancellation Application No:").concat(String.valueOf(oHrmEmpTransCnclApplHdrBean.getHeaderPrimaryKey()))).concat(String.valueOf("is pending for rejection")));
|
|
wflDocumentInfoImpl.setDocDesc(String.valueOf("The following document has been pending for rejection:Deputation Application No:").concat(String.valueOf(oHrmEmpTransCnclApplHdrBean.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);
|
|
}
|
|
}
|
|
}
|