839 lines
45 KiB
Java
839 lines
45 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.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.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.utility.DBUtilitiesBean;
|
|
import wenrgise.hrms.bean.HrmATDTransOrderForSingleEmpBean;
|
|
import wenrgise.hrms.bean.HrmTransferApplicationHdrBean;
|
|
import wenrgise.hrms.vo.HrmATDTransSingleEmpQVO;
|
|
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 HrmATDTransOrderForSingleEmpBO extends HrmBaseBO {
|
|
public HrmATDTransOrderForSingleEmpBO() {}
|
|
|
|
public HrmATDTransOrderForSingleEmpBO(UserInfo oUserInfo) {
|
|
super(oUserInfo);
|
|
}
|
|
|
|
public RecordMetaInfo getHrmTransSingleEmpRecordMetaInfo(HrmATDTransSingleEmpQVO oHrmATDTransSingleEmpQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
Timestamp oWhenPicked = null;
|
|
int iCount = 0;
|
|
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
|
|
if (EnrgiseUtil.checkString(oHrmATDTransSingleEmpQVO.getHeaderPrimaryKey())) {
|
|
String[] sPrimaryKey = oHrmATDTransSingleEmpQVO.getHeaderPrimaryKey().split(",");
|
|
System.out.println(sPrimaryKey[0]);
|
|
System.out.println(sPrimaryKey[1]);
|
|
oHrmATDTransSingleEmpQVO.setHeaderPrimaryKey(sPrimaryKey[0]);
|
|
oHrmATDTransSingleEmpQVO.setHeaderPrimaryKey1(sPrimaryKey[1]);
|
|
}
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, oHrmATDTransSingleEmpQVO.getHeaderPrimaryKey()));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmATDTransSingleEmpQVO.getHeaderPrimaryKey1()));
|
|
arylstParameters.add(new DBObject(3, 1, 12, oHrmATDTransSingleEmpQVO.getOrderNo()));
|
|
arylstParameters.add(new DBObject(4, 1, 12, null));
|
|
arylstParameters.add(new DBObject(5, 1, 12, oHrmATDTransSingleEmpQVO.getApplnNo()));
|
|
arylstParameters.add(new DBObject(6, 2, -5));
|
|
arylstParameters.add(new DBObject(7, 2, 93));
|
|
arylstParameters.add(new DBObject(8, 2, 12));
|
|
arylstParameters.add(new DBObject(9, 2, 12));
|
|
arylstParameters.add(new DBObject(10, 2, 4));
|
|
System.out.println(String.valueOf("transfer status :-").concat(String.valueOf(oHrmATDTransSingleEmpQVO.getOrderStatus())));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRANSSINGLEEMP.proc_HrTransSingleEmpHdrCount(?,?,?,?,?,?,?,?,?,?)");
|
|
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 getHrmTransSingleEmpHeaderInfo(HrmATDTransSingleEmpQVO oHrmATDTransSingleEmpQVO, 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();
|
|
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
|
|
ArrayList arylstHeaderList = null;
|
|
if (oHrmATDTransSingleEmpQVO == null)
|
|
oHrmATDTransSingleEmpQVO = new HrmATDTransSingleEmpQVO();
|
|
if (EnrgiseUtil.checkString(oHrmATDTransSingleEmpQVO.getHeaderPrimaryKey())) {
|
|
String[] sPrimaryKey = oHrmATDTransSingleEmpQVO.getHeaderPrimaryKey().split(",");
|
|
oHrmATDTransSingleEmpQVO.setHeaderPrimaryKey(sPrimaryKey[0]);
|
|
oHrmATDTransSingleEmpQVO.setHeaderPrimaryKey1(sPrimaryKey[1]);
|
|
}
|
|
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, oHrmATDTransSingleEmpQVO.getHeaderPrimaryKey()));
|
|
arylstParameters.add(new DBObject(4, 1, 12, oHrmATDTransSingleEmpQVO.getHeaderPrimaryKey1()));
|
|
arylstParameters.add(new DBObject(5, 1, 12, oHrmATDTransSingleEmpQVO.getOrderNo()));
|
|
arylstParameters.add(new DBObject(6, 1, 12, null));
|
|
arylstParameters.add(new DBObject(7, 1, 12, oHrmATDTransSingleEmpQVO.getApplnNo()));
|
|
arylstParameters.add(new DBObject(8, 2, -10));
|
|
arylstParameters.add(new DBObject(9, 2, 12));
|
|
arylstParameters.add(new DBObject(10, 2, 12));
|
|
arylstParameters.add(new DBObject(11, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRANSSINGLEEMP.proc_HrTransSingleEmpHdr(?,?,?,?,?,?,?,?,?,?,?)");
|
|
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();
|
|
HrmATDTransOrderForSingleEmpBean oSingleEmpHeader = new HrmATDTransOrderForSingleEmpBean();
|
|
oSingleEmpHeader.setHeaderPrimaryKey(oRow.get("ID").getString());
|
|
oSingleEmpHeader.setHeaderPrimaryKey1(oRow.get("trans_dtl_id").getString());
|
|
oSingleEmpHeader.setOrderNo(oRow.get("transfer_order_no").getString());
|
|
oSingleEmpHeader.setOrderDate(EnrgiseUtil.convertToString(oRow.get("TRANSFER_ORDER_DATE").getDate()));
|
|
oSingleEmpHeader.setOrderType(oRow.get("TRANSFER_ORDER_TYPE").getString());
|
|
oSingleEmpHeader.setOrderStatus(oRow.get("APPROVED_FLAG").getString());
|
|
oSingleEmpHeader.setEmpID(oRow.get("e_per_dtl_id").getString());
|
|
oSingleEmpHeader.setEmpName(oRow.get("emp_name").getString());
|
|
oSingleEmpHeader.setFromSite(oRow.get("from_loc").getString());
|
|
oSingleEmpHeader.setToSite(oRow.get("to_loc").getString());
|
|
oSingleEmpHeader.setFromSiteID(oRow.get("FROM_SITE_ID").getString());
|
|
oSingleEmpHeader.setToSiteID(oRow.get("TO_SITE_ID").getString());
|
|
oSingleEmpHeader.setReportingEmpId(oRow.get("rep_emp_name").getString());
|
|
oSingleEmpHeader.setReptEmpID(oRow.get("rep_emp_id").getString());
|
|
oSingleEmpHeader.setReportingDate(EnrgiseUtil.convertToString(oRow.get("REPORTING_DATE").getDate()));
|
|
oSingleEmpHeader.setRemarks(oRow.get("REMARKS").getString());
|
|
arylstHeaderList.add(oSingleEmpHeader);
|
|
}
|
|
return arylstHeaderList;
|
|
}
|
|
|
|
public void initializeBOImpl() {
|
|
this.headerTable = "HRM_EMP_TRANS_ORDER_HDR";
|
|
}
|
|
|
|
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 sToSiteId = new String();
|
|
HrmATDTransOrderForSingleEmpBean oHrmATDTransOrderForSingleEmpBean = (HrmATDTransOrderForSingleEmpBean)oBaseHeaderBean;
|
|
if (ScreenMode.equalsIgnoreCase("N")) {
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, "N"));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmATDTransOrderForSingleEmpBean.getOrderNo()));
|
|
arylstParameters.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmATDTransOrderForSingleEmpBean.getOrderDate())));
|
|
arylstParameters.add(new DBObject(4, 1, 12, oHrmATDTransOrderForSingleEmpBean.getOrderType()));
|
|
arylstParameters.add(new DBObject(5, 1, 12, "A"));
|
|
arylstParameters.add(new DBObject(6, 1, 12, oHrmATDTransOrderForSingleEmpBean.getEmpID()));
|
|
arylstParameters.add(new DBObject(7, 1, 12, oHrmATDTransOrderForSingleEmpBean.getFromSiteID()));
|
|
arylstParameters.add(new DBObject(8, 1, 12, oHrmATDTransOrderForSingleEmpBean.getToSiteID()));
|
|
arylstParameters.add(new DBObject(9, 1, 12, oHrmATDTransOrderForSingleEmpBean.getReptEmpID()));
|
|
arylstParameters.add(new DBObject(10, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmATDTransOrderForSingleEmpBean.getReportingDate())));
|
|
arylstParameters.add(new DBObject(11, 1, 12, oHrmATDTransOrderForSingleEmpBean.getRemarks()));
|
|
arylstParameters.add(new DBObject(12, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParameters.add(new DBObject(13, 1, 12, this.oUserInfo.getSiteId()));
|
|
arylstParameters.add(new DBObject(14, 1, 12, null));
|
|
arylstParameters.add(new DBObject(15, 1, 12, null));
|
|
arylstParameters.add(new DBObject(16, 2, 12));
|
|
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));
|
|
String str = oHrmATDTransOrderForSingleEmpBean.getReptEmpID();
|
|
String str2 = oHrmATDTransOrderForSingleEmpBean.getToSiteID();
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMTRANSSINGLEEMP.proc_UpsertHrTransSingleEmp(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
String String1 = (String)oOutObject.getObject();
|
|
DBObject oOutObject1 = arylstOutArray.get(1);
|
|
String String2 = (String)oOutObject1.getObject();
|
|
returnString = String.valueOf(String.valueOf(String1).concat(String.valueOf(","))).concat(String.valueOf(String2));
|
|
} else if (ScreenMode.equalsIgnoreCase("U")) {
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, "N"));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmATDTransOrderForSingleEmpBean.getOrderNo()));
|
|
arylstParameters.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmATDTransOrderForSingleEmpBean.getOrderDate())));
|
|
arylstParameters.add(new DBObject(4, 1, 12, oHrmATDTransOrderForSingleEmpBean.getOrderType()));
|
|
arylstParameters.add(new DBObject(5, 1, 12, "A"));
|
|
arylstParameters.add(new DBObject(6, 1, 12, oHrmATDTransOrderForSingleEmpBean.getEmpID()));
|
|
arylstParameters.add(new DBObject(7, 1, 12, oHrmATDTransOrderForSingleEmpBean.getFromSiteID()));
|
|
arylstParameters.add(new DBObject(8, 1, 12, oHrmATDTransOrderForSingleEmpBean.getToSiteID()));
|
|
arylstParameters.add(new DBObject(9, 1, 12, oHrmATDTransOrderForSingleEmpBean.getReportingEmpId()));
|
|
arylstParameters.add(new DBObject(10, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmATDTransOrderForSingleEmpBean.getReportingDate())));
|
|
arylstParameters.add(new DBObject(11, 1, 12, oHrmATDTransOrderForSingleEmpBean.getRemarks()));
|
|
arylstParameters.add(new DBObject(12, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
arylstParameters.add(new DBObject(13, 1, 12, this.oUserInfo.getSiteId()));
|
|
arylstParameters.add(new DBObject(14, 1, 12, oHrmATDTransOrderForSingleEmpBean.getHeaderPrimaryKey()));
|
|
arylstParameters.add(new DBObject(15, 1, 12, oHrmATDTransOrderForSingleEmpBean.getHeaderPrimaryKey1()));
|
|
arylstParameters.add(new DBObject(16, 2, 12));
|
|
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, "HRMTRANSSINGLEEMP.proc_UpsertHrTransSingleEmp(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
String String1 = (String)oOutObject.getObject();
|
|
DBObject oOutObject1 = arylstOutArray.get(1);
|
|
String String2 = (String)oOutObject1.getObject();
|
|
returnString = String.valueOf(String.valueOf(String1).concat(String.valueOf(","))).concat(String.valueOf(String2));
|
|
} else if (ScreenMode.equalsIgnoreCase("D")) {
|
|
|
|
}
|
|
return returnString;
|
|
}
|
|
|
|
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 new String();
|
|
}
|
|
|
|
public LovVO getHrmTransOrderNoLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("ID");
|
|
arylstHeaderList.add("hrm.HrmATDTransOrderForSingleEmp.orderNo");
|
|
arylstHeaderList.add("hrm.HrmATDTransOrderForSingleEmp.orderDate");
|
|
arylstHeaderList.add("hrm.HrmATDTransOrderForSingleEmp.orderStatus");
|
|
arylstHeaderList.add("hrm.HrmATDTransOrderForSingleEmp.orderType");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
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_GetTransOrderNoLOV(?,?,?,?,?,?)");
|
|
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("TRANSFER_ORDER_NO").getString());
|
|
String orderDate = null;
|
|
if (String.valueOf(oRow.get("TRANSFER_ORDER_DATE")).equalsIgnoreCase("null")) {
|
|
orderDate = "";
|
|
} else {
|
|
orderDate = formatter.format(oRow.get("TRANSFER_ORDER_DATE").getDate());
|
|
}
|
|
oLOVBean.setDetailField3(orderDate);
|
|
oLOVBean.setDetailField4(oRow.get("TRANSFER_ORDER_TYPE").getString());
|
|
oLOVBean.setDetailField5(oRow.get("APPROVED_FLAG").getString());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmToSiteCodeLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("ID");
|
|
arylstHeaderList.add("hrm.HrmTransferOrder.SiteCode");
|
|
arylstHeaderList.add("hrm.HrmTransferOrder.SiteName");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
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();
|
|
String applId = 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, 1, 12, applId));
|
|
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_GetTransferToSiteLOV(?,?,?,?,?,?,?)");
|
|
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("NAME").getString());
|
|
oLOVBean.setDetailField3(oRow.get("CODE").getString());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmTransAplnNoLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("hrm.HrmTransferOrder.empNo");
|
|
arylstHeaderList.add("hrm.HrmTransferApplcn.employeeName");
|
|
arylstHeaderList.add("hrm.HrmATDTransOrderForSingleEmp.fromSite");
|
|
arylstHeaderList.add("fromSiteID");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("H");
|
|
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();
|
|
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_getTrnsOrderEmpNoLov(?,?,?,?,?,?)");
|
|
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("EMP_NO").getString());
|
|
oLOVBean.setDetailField2(oRow.get("EMP_NAME").getString());
|
|
oLOVBean.setDetailField3(oRow.get("FROM_LOC").getString());
|
|
oLOVBean.setDetailField4(oRow.get("from_loc_id").getString());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmTransAplnNoQLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("hrm.HrmTransferOrder.empNo");
|
|
arylstHeaderList.add("hrm.HrmTransferApplcn.employeeName");
|
|
arylstHeaderList.add("hrm.HrmATDTransOrderForSingleEmp.fromSite");
|
|
arylstHeaderList.add("fromSiteID");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("H");
|
|
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();
|
|
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_getTrnsOrderEmpNoLov(?,?,?,?,?,?)");
|
|
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("EMP_NO").getString());
|
|
oLOVBean.setDetailField2(oRow.get("EMP_NAME").getString());
|
|
oLOVBean.setDetailField3(oRow.get("FROM_LOC").getString());
|
|
oLOVBean.setDetailField4(oRow.get("from_loc_id").getString());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmTransReptEmpNoLOV(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
|
|
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderList = new ArrayList();
|
|
arylstHeaderList.add("ID");
|
|
arylstHeaderList.add("hrm.HrmTransferOrder.empName");
|
|
arylstHeaderList.add("hrm.HrmTransferOrder.RepEmpGrade");
|
|
oLovVO.setHeaderList(arylstHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
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();
|
|
String toSiteID = null;
|
|
if (oLovQueryVO.getProperty("toSiteID") != null)
|
|
toSiteID = oLovQueryVO.getProperty("toSiteID");
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sQuerySearch1 = oLovQueryVO.getSearchField1();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sQuerySearch1));
|
|
arylstParameters.add(new DBObject(2, 1, 12, toSiteID));
|
|
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_GetTransRptEmpNoLOV(?,?,?,?,?,?)");
|
|
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("EMPID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("EMPNAME").getString());
|
|
oLOVBean.setDetailField3(oRow.get("empGrade").getString());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList arylstParam6, boolean param7, Timestamp param8) {}
|
|
|
|
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((HrmATDTransOrderForSingleEmpBean)oBaseHeaderBean);
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
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();
|
|
HrmATDTransOrderForSingleEmpBean oHrmATDTransOrderForSingleEmpBean = (HrmATDTransOrderForSingleEmpBean)oBaseHeaderBean;
|
|
if (bHeaderDataChanged) {
|
|
if (!sScreenMode.equalsIgnoreCase("D")) {
|
|
checkUniqueHeader((HrmATDTransOrderForSingleEmpBean)oBaseHeaderBean);
|
|
checkDatesConstraintHdr((HrmATDTransOrderForSingleEmpBean)oBaseHeaderBean, arylstErrorList);
|
|
checkNextDatesConstraintHdr((HrmATDTransOrderForSingleEmpBean)oBaseHeaderBean, arylstErrorList);
|
|
checkReportingDatesConstraintHdr((HrmATDTransOrderForSingleEmpBean)oBaseHeaderBean, arylstErrorList);
|
|
}
|
|
if (sScreenMode.equalsIgnoreCase("D")) {
|
|
HrmCommonBO oCommonBO = new HrmCommonBO();
|
|
String sRefId = oCommonBO.getRefList("HRM_EMP_TRANS_ORDER_DTL", "TRANS_ORDER_HDR_ID ", oHrmATDTransOrderForSingleEmpBean.getHeaderPrimaryKey(), "ID");
|
|
if (EnrgiseUtil.checkString(sRefId))
|
|
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.common.deletion"));
|
|
if (!oHrmATDTransOrderForSingleEmpBean.getOrderStatus().equalsIgnoreCase("N"))
|
|
if (arylstErrorList.isEmpty())
|
|
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.common.deletion.rejected"));
|
|
}
|
|
}
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
private ArrayList checkLOVConstraint(ArrayList arylstList) throws EnrgiseSystemException {
|
|
LOVBean def = null;
|
|
HrmATDTransOrderForSingleEmpBean abc = null;
|
|
ArrayList arylstNewList = new ArrayList();
|
|
Iterator oit = arylstList.iterator();
|
|
while (oit.hasNext()) {
|
|
def = oit.next();
|
|
String Id = def.getDetailField1();
|
|
ArrayList transAppList = getHrTransAppDtlInfo(Id);
|
|
if (transAppList.size() == 0) {
|
|
arylstNewList.add(def);
|
|
continue;
|
|
}
|
|
Iterator oit1 = transAppList.iterator();
|
|
while (oit1.hasNext()) {
|
|
abc = oit1.next();
|
|
String sAppDtlId = abc.getHeaderPrimaryKey1();
|
|
String sFlag = getHrStatusInfo(sAppDtlId);
|
|
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 ArrayList getHrTransAppDtlInfo(String sAppDtlId) throws EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int iCount = 0;
|
|
ArrayList arylstHrDetail = null;
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sAppDtlId));
|
|
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, "HRMTRANSORDER.proc_GetHrmApplDataById(?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
if (arylstList.size() == 0)
|
|
arylstHrDetail = new ArrayList();
|
|
QueryRow oRow = null;
|
|
HashMap oColumns = null;
|
|
Iterator oIt = arylstList.iterator();
|
|
while (oIt.hasNext()) {
|
|
if (iCount == 0)
|
|
arylstHrDetail = new ArrayList();
|
|
iCount++;
|
|
oRow = oIt.next();
|
|
HrmATDTransOrderForSingleEmpBean oHrmATDTransOrderForSingleEmpBean = new HrmATDTransOrderForSingleEmpBean();
|
|
oHrmATDTransOrderForSingleEmpBean.setHeaderPrimaryKey1(oRow.get("ID").getString());
|
|
arylstHrDetail.add(oHrmATDTransOrderForSingleEmpBean);
|
|
}
|
|
return arylstHrDetail;
|
|
}
|
|
|
|
public String getHrStatusInfo(String sAppDtlId) 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, sAppDtlId));
|
|
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, "HRMTRANSORDER.proc_GetHrmApplData(?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
HashMap oColumns = null;
|
|
Iterator oIt = arylstList.iterator();
|
|
while (oIt.hasNext()) {
|
|
oRow = oIt.next();
|
|
sStatus = oRow.get("APPROVED_FLAG").getString();
|
|
}
|
|
return sStatus;
|
|
}
|
|
|
|
public String getMaxTransOrderDate() throws EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int iCount = 0;
|
|
String sMaxTransOrderdate = null;
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 2, -10));
|
|
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, "HRMRLSEORDERLOV.proc_GetMaxTransOrderDate(?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
HashMap oColumns = null;
|
|
Iterator oIt = arylstList.iterator();
|
|
while (oIt.hasNext()) {
|
|
oRow = oIt.next();
|
|
sMaxTransOrderdate = EnrgiseUtil.convertToString(oRow.get("TRANSFER_ORDER_DATE").getDate());
|
|
}
|
|
return sMaxTransOrderdate;
|
|
}
|
|
|
|
private void checkDatesConstraintHdr(HrmATDTransOrderForSingleEmpBean oHrmATDTransOrderForSingleEmpBean, ArrayList arylstErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
|
|
if (EnrgiseUtil.checkString(oHrmATDTransOrderForSingleEmpBean.getOrderDate())) {
|
|
String sMaxTrnsOrdDate = getMaxTransOrderDate();
|
|
int iDateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmATDTransOrderForSingleEmpBean.getOrderDate(), sMaxTrnsOrdDate);
|
|
if (iDateFlag == -1 && iDateFlag != -2)
|
|
if (arylstErrorList.isEmpty())
|
|
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.HrmTransferOrder.transferOrderDateConstraintViolated"));
|
|
}
|
|
}
|
|
|
|
private void checkNextDatesConstraintHdr(HrmATDTransOrderForSingleEmpBean oHrmATDTransOrderForSingleEmpBean, ArrayList arylstErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
|
|
if (EnrgiseUtil.checkString(oHrmATDTransOrderForSingleEmpBean.getOrderDate())) {
|
|
String sMaxTrnsOrdDate = getMaxTransOrderDate();
|
|
int iDateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmATDTransOrderForSingleEmpBean.getTrnsfrEffectDate(), oHrmATDTransOrderForSingleEmpBean.getOrderDate());
|
|
if (iDateFlag == -1 && iDateFlag != -2)
|
|
if (arylstErrorList.isEmpty())
|
|
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.HrmTransferOrder.transdateConstraintViolated"));
|
|
}
|
|
}
|
|
|
|
private void checkReportingDatesConstraintHdr(HrmATDTransOrderForSingleEmpBean oHrmATDTransOrderForSingleEmpBean, ArrayList arylstErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
|
|
if (EnrgiseUtil.checkString(oHrmATDTransOrderForSingleEmpBean.getTrnsfrEffectDate())) {
|
|
int iDateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmATDTransOrderForSingleEmpBean.getReportingDate(), oHrmATDTransOrderForSingleEmpBean.getTrnsfrEffectDate());
|
|
if (iDateFlag == -1 && iDateFlag != -2)
|
|
if (arylstErrorList.isEmpty())
|
|
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.HrmTransferOrder.transReportingDateConstraintViolated"));
|
|
}
|
|
}
|
|
|
|
private void checkMandatoryHeader(HrmATDTransOrderForSingleEmpBean oHrmATDTransOrderForSingleEmpBean) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
ArrayList oErrorList = new ArrayList();
|
|
ArrayList oParams = new ArrayList();
|
|
if (!EnrgiseUtil.checkString(oHrmATDTransOrderForSingleEmpBean.getOrderNo())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmATDTransOrderForSingleEmp.orderNo");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmATDTransOrderForSingleEmpBean.getOrderDate())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmATDTransOrderForSingleEmp.orderDate");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
private void checkUniqueHeader(HrmATDTransOrderForSingleEmpBean oHrmATDTransOrderForSingleEmpBean) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sQuery = String.valueOf(String.valueOf(" Select ID as ID from hrm_emp_trans_order_hdr where TRANSFER_ORDER_NO= '").concat(String.valueOf(oHrmATDTransOrderForSingleEmpBean.getOrderNo()))).concat(String.valueOf("'"));
|
|
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(oHrmATDTransOrderForSingleEmpBean.getHeaderPrimaryKey()))
|
|
throw new EnrgiseApplicationException("wenrgise.common.header.uniqueConstraintViolated", "M");
|
|
}
|
|
}
|
|
|
|
public String approveTranOrderSingleEmp(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = null;
|
|
HrmATDTransOrderForSingleEmpBean oHrmATDTransOrderForSingleEmpBean = (HrmATDTransOrderForSingleEmpBean)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, "HRMTRANSSINGLEEMP.procApproveTranOrderSingleEmp(?,?,?,?)");
|
|
}
|
|
return sHeaderPrimaryKey;
|
|
}
|
|
|
|
public String rejectTranOrderSingleEmp(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = null;
|
|
HrmATDTransOrderForSingleEmpBean oHrmATDTransOrderForSingleEmpBean = (HrmATDTransOrderForSingleEmpBean)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, "HRMTRANSSINGLEEMP.procRejectTranOrderSingleEmp(?,?,?,?)");
|
|
}
|
|
return sHeaderPrimaryKey;
|
|
}
|
|
|
|
public String submitTranOrderSingleEmp(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = null;
|
|
HrmATDTransOrderForSingleEmpBean oHrmATDTransOrderForSingleEmpBean = (HrmATDTransOrderForSingleEmpBean)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, "HRMTRANSSINGLEEMP.procSubmitTranOrderSingleEmp(?,?,?,?)");
|
|
}
|
|
return sHeaderPrimaryKey;
|
|
}
|
|
|
|
public String cancelTransfer(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, ArrayList arylstDetailBeanArray, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DBUtilitiesBean oBean = null;
|
|
HrmATDTransOrderForSingleEmpBean oHrmATDTransOrderForSingleEmpBean = (HrmATDTransOrderForSingleEmpBean)oBaseHeaderBean;
|
|
String returnString = null;
|
|
String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : "";
|
|
String sHeaderPrimaryKey1 = (null != oHrmATDTransOrderForSingleEmpBean) ? oHrmATDTransOrderForSingleEmpBean.getHeaderPrimaryKey1() : "";
|
|
oBean = new DBUtilitiesBean();
|
|
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 arylstOutArray = oBean.callProc(arylstParameters, "hrmtranssingleemp.proccanceltranordersingleemp(?,?,?,?)");
|
|
returnString = String.valueOf(String.valueOf(sHeaderPrimaryKey).concat(String.valueOf(","))).concat(String.valueOf(sHeaderPrimaryKey1));
|
|
return returnString;
|
|
}
|
|
|
|
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();
|
|
HrmTransferApplicationHdrBean oHrmTransferApplicationHdrBean = (HrmTransferApplicationHdrBean)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(oHrmTransferApplicationHdrBean.getHeaderPrimaryKey());
|
|
wflDocumentInfoImpl.setDocumentType("Training");
|
|
wflDocumentInfoImpl.setInitiatedFlag(initiatedFlag);
|
|
String documentTypeId = workFlowFacade.getDocumentTypeId("TransOrder");
|
|
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 Order No:").concat(String.valueOf(oHrmTransferApplicationHdrBean.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(oHrmTransferApplicationHdrBean.getHeaderPrimaryKey())));
|
|
} else if (!activity.equalsIgnoreCase("Approve")) {
|
|
wflDocumentInfoImpl.setDocumentNumber(String.valueOf(String.valueOf("Transfer Order No:").concat(String.valueOf(oHrmTransferApplicationHdrBean.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(oHrmTransferApplicationHdrBean.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);
|
|
}
|
|
}
|
|
}
|