Files
HRMS/hrmsEjb/wenrgise/hrms/ejb/business/HrmATDDptnOrderForSingleEmpBO.java
2025-07-28 13:56:49 +05:30

635 lines
37 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.HrmATDDeputOrderSngEmpHdrBean;
import wenrgise.hrms.vo.HrmATDDptnOrderSingleEmpQVO;
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 HrmATDDptnOrderForSingleEmpBO extends HrmBaseBO {
public HrmATDDptnOrderForSingleEmpBO() {}
public HrmATDDptnOrderForSingleEmpBO(UserInfo oUserInfo) {
super(oUserInfo);
}
public void initializeBOImpl() {
this.headerTable = "HRM_EMP_DEPUT_ORDER_HDR";
}
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {}
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {}
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
return new String();
}
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList arylstParam6, boolean param7, Timestamp param8) {}
private void checkHeaderFields(HrmATDDeputOrderSngEmpHdrBean oHrmATDDeputOrderSngEmpHdrBean) throws EnrgiseSystemException, EnrgiseApplicationException {}
public RecordMetaInfo getHrmDeputOrderSngEmpHdrMetaInfo(HrmATDDptnOrderSingleEmpQVO oHrmATDDptnOrderSingleEmpQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList arylstParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
Timestamp oWhenPicked = null;
int iCount = 0;
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
if (EnrgiseUtil.checkString(oHrmATDDptnOrderSingleEmpQVO.getHeaderPrimaryKey())) {
String[] sPrimaryKey = oHrmATDDptnOrderSingleEmpQVO.getHeaderPrimaryKey().split(",");
oHrmATDDptnOrderSingleEmpQVO.setHeaderPrimaryKey(sPrimaryKey[0]);
oHrmATDDptnOrderSingleEmpQVO.setHeaderPrimaryKey1(sPrimaryKey[1]);
System.out.println(sPrimaryKey[0]);
System.out.println(sPrimaryKey[1]);
}
arylstParameters = new ArrayList();
arylstParameters.add(new DBObject(1, 1, 12, oHrmATDDptnOrderSingleEmpQVO.getHeaderPrimaryKey()));
arylstParameters.add(new DBObject(2, 1, 12, oHrmATDDptnOrderSingleEmpQVO.getHeaderPrimaryKey1()));
arylstParameters.add(new DBObject(3, 1, 12, oHrmATDDptnOrderSingleEmpQVO.getOrderNo()));
arylstParameters.add(new DBObject(4, 1, 12, oHrmATDDptnOrderSingleEmpQVO.getApplnNo()));
arylstParameters.add(new DBObject(5, 1, 12, oHrmATDDptnOrderSingleEmpQVO.getEmployeeNoId()));
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));
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMDEPTNORDERSNGEMP.proc_HrmEmpDeptnOrdHdrCount(?,?,?,?,?,?,?,?,?,?)");
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 getHrmDeputOrderSngEmpHeaderInfo(HrmATDDptnOrderSingleEmpQVO oHrmATDDptnOrderSingleEmpQVO, 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 (oHrmATDDptnOrderSingleEmpQVO == null)
oHrmATDDptnOrderSingleEmpQVO = new HrmATDDptnOrderSingleEmpQVO();
if (EnrgiseUtil.checkString(oHrmATDDptnOrderSingleEmpQVO.getHeaderPrimaryKey())) {
String[] sPrimaryKey = oHrmATDDptnOrderSingleEmpQVO.getHeaderPrimaryKey().split(",");
oHrmATDDptnOrderSingleEmpQVO.setHeaderPrimaryKey(sPrimaryKey[0]);
oHrmATDDptnOrderSingleEmpQVO.setHeaderPrimaryKey1(sPrimaryKey[1]);
System.out.println(sPrimaryKey[0]);
System.out.println(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, oHrmATDDptnOrderSingleEmpQVO.getHeaderPrimaryKey()));
arylstParameters.add(new DBObject(4, 1, 12, oHrmATDDptnOrderSingleEmpQVO.getHeaderPrimaryKey1()));
arylstParameters.add(new DBObject(5, 1, 12, oHrmATDDptnOrderSingleEmpQVO.getOrderNo()));
arylstParameters.add(new DBObject(6, 1, 12, oHrmATDDptnOrderSingleEmpQVO.getApplnNo()));
arylstParameters.add(new DBObject(7, 1, 12, oHrmATDDptnOrderSingleEmpQVO.getEmployeeNoId()));
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, "HRMDEPTNORDERSNGEMP.proc_HrmEmpDeptnOrdSngEmpHdr(?,?,?,?,?,?,?,?,?,?,?)");
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();
HrmATDDeputOrderSngEmpHdrBean oHrmATDDeputOrderSngEmpHdrBean = new HrmATDDeputOrderSngEmpHdrBean();
oHrmATDDeputOrderSngEmpHdrBean.setApplnNoId(oRow.get("APP_ID").getString());
oHrmATDDeputOrderSngEmpHdrBean.setApplnNo(oRow.get("APPLICATION_NO").getString());
oHrmATDDeputOrderSngEmpHdrBean.setApplicationDate(EnrgiseUtil.convertToString(oRow.get("APPLICATION_DATE").getDate()));
oHrmATDDeputOrderSngEmpHdrBean.setEmployeeName(oRow.get("EMPNAME").getString());
oHrmATDDeputOrderSngEmpHdrBean.setToOrg(oRow.get("ORG_NAME").getString());
oHrmATDDeputOrderSngEmpHdrBean.setToPost(oRow.get("POST_NAME").getString());
oHrmATDDeputOrderSngEmpHdrBean.setOrderNo(oRow.get("DEPUTN_ORDER_NO").getString());
oHrmATDDeputOrderSngEmpHdrBean.setOrderDate(EnrgiseUtil.convertToString(oRow.get("DEPUTN_ORDER_DATE").getDate()));
oHrmATDDeputOrderSngEmpHdrBean.setHeaderPrimaryKey(oRow.get("DEPUT_ORDER_HDR_ID").getString());
oHrmATDDeputOrderSngEmpHdrBean.setDeputType(oRow.get("DEPUTN_ORDER_TYPE").getString());
oHrmATDDeputOrderSngEmpHdrBean.setOrderStatus(oRow.get("APPROVED_FLAG").getString());
oHrmATDDeputOrderSngEmpHdrBean.setDeptnEffectDate(EnrgiseUtil.convertToString(oRow.get("DEPUTN_EFFECT_DATE").getDate()));
oHrmATDDeputOrderSngEmpHdrBean.setReportingDate(EnrgiseUtil.convertToString(oRow.get("REPORTING_DATE").getDate()));
oHrmATDDeputOrderSngEmpHdrBean.setRemarks(oRow.get("REMARKS").getString());
oHrmATDDeputOrderSngEmpHdrBean.setHeaderPrimaryKey1(oRow.get("DEPUT_ORDER_DTL_ID").getString());
oHrmATDDeputOrderSngEmpHdrBean.setPhone(oRow.get("PHONE").getString());
oHrmATDDeputOrderSngEmpHdrBean.setMobilePhone(oRow.get("MOBILE_PHONE").getString());
oHrmATDDeputOrderSngEmpHdrBean.setFax(oRow.get("FAX").getString());
oHrmATDDeputOrderSngEmpHdrBean.setEmail(oRow.get("EMAIL").getString());
oHrmATDDeputOrderSngEmpHdrBean.setReptBackDate(EnrgiseUtil.convertToString(oRow.get("REPORTING_BACK_DATE").getDate()));
arylstHeaderList.add(oHrmATDDeputOrderSngEmpHdrBean);
}
return arylstHeaderList;
}
public LovVO getHrmDeputationOrderNoLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
LovVO oLovVO = new LovVO();
ArrayList arylstHeaderList = new ArrayList();
arylstHeaderList.add("ID");
arylstHeaderList.add("hrm.HrmDeputationOrder.orderNo");
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, "HRMDEPTNLOV.proc_GetHrmDeputNoLOVdata(?,?,?,?,?)");
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("DEPUTN_ORDER_NO").getString());
arylstList.add(oLOVBean);
}
oLovVO.setDetailList(arylstList);
return oLovVO;
}
public LovVO getHrmDeputApplcnNoLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
LovVO oLovVO = new LovVO();
ArrayList arylstHeaderList = new ArrayList();
arylstHeaderList.add("ID");
arylstHeaderList.add("hrm.HrmDeputationOrder.applnNo");
arylstHeaderList.add("hrm.HrmDeputationOrder.employeeName");
arylstHeaderList.add("hrm.HrmDeputationOrder.applicationDate");
arylstHeaderList.add("hrm.HrmDeputationOrder.toOrg");
arylstHeaderList.add("hrm.HrmDeputationOrder.toPost");
arylstHeaderList.add("hrm.HrmDeputationOrder.deputType");
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");
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, "HRMDEPTNLOV.proc_GetHrmDeputApplnNoLOVdata(?,?,?,?,?)");
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());
oLOVBean.setDetailField3(oRow.get("EMPNAME").getString());
oLOVBean.setDetailField4(EnrgiseUtil.convertToString(oRow.get("APPLICATION_DATE").getDate()));
oLOVBean.setDetailField5(oRow.get("ORG_NAME").getString());
oLOVBean.setDetailField6(oRow.get("POST_NAME").getString());
oLOVBean.setDetailField7(oRow.get("DEPUT_TYPE").getString());
arylstList.add(oLOVBean);
}
oLovVO.setDetailList(arylstList);
return oLovVO;
}
public LovVO getHrmDeputApplcnNoQLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
LovVO oLovVO = new LovVO();
ArrayList arylstHeaderList = new ArrayList();
arylstHeaderList.add("ID");
arylstHeaderList.add("hrm.HrmDeputationOrder.applnNo");
arylstHeaderList.add("hrm.HrmDeputationOrder.employeeName");
arylstHeaderList.add("hrm.HrmDeputationOrder.applicationDate");
arylstHeaderList.add("hrm.HrmDeputationOrder.toOrg");
arylstHeaderList.add("hrm.HrmDeputationOrder.toPost");
arylstHeaderList.add("hrm.HrmDeputationOrder.deputType");
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");
oLovVO.setVisibilityList(arylstVisibility);
int iCount = 0;
String sQuerySearch2 = null;
ArrayList arylstParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
String sQuerySearch1 = new String();
if (oLovQueryVO.getSearchField1() != null)
sQuerySearch1 = oLovQueryVO.getSearchField1();
if (oLovQueryVO.getSearchField1() != 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, "HRMDEPTNLOV.proc_GetHrmDeputApplnQLOVdata(?,?,?,?,?,?)");
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());
oLOVBean.setDetailField3(oRow.get("EMPNAME").getString());
oLOVBean.setDetailField4(EnrgiseUtil.convertToString(oRow.get("APPLICATION_DATE").getDate()));
oLOVBean.setDetailField5(oRow.get("ORG_NAME").getString());
oLOVBean.setDetailField6(oRow.get("POST_NAME").getString());
oLOVBean.setDetailField7(oRow.get("DEPUT_TYPE").getString());
arylstList.add(oLOVBean);
}
oLovVO.setDetailList(arylstList);
return oLovVO;
}
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
String returnString = null;
ArrayList arylstParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
DateUtility d = new DateUtility();
HrmATDDeputOrderSngEmpHdrBean oHrmATDDeputOrderSngEmpHdrBean = (HrmATDDeputOrderSngEmpHdrBean)oBaseHeaderBean;
if (ScreenMode.equalsIgnoreCase("N")) {
arylstParameters = new ArrayList();
arylstParameters.add(new DBObject(1, 1, 12, "N"));
arylstParameters.add(new DBObject(2, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getApplnNoId()));
arylstParameters.add(new DBObject(3, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getOrderNo()));
arylstParameters.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmATDDeputOrderSngEmpHdrBean.getOrderDate())));
arylstParameters.add(new DBObject(5, 1, 12, "A"));
arylstParameters.add(new DBObject(6, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmATDDeputOrderSngEmpHdrBean.getDeptnEffectDate())));
arylstParameters.add(new DBObject(7, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmATDDeputOrderSngEmpHdrBean.getReportingDate())));
arylstParameters.add(new DBObject(8, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getRemarks()));
arylstParameters.add(new DBObject(9, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getPhone()));
arylstParameters.add(new DBObject(10, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getMobilePhone()));
arylstParameters.add(new DBObject(11, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getFax()));
arylstParameters.add(new DBObject(12, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getEmail()));
arylstParameters.add(new DBObject(13, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmATDDeputOrderSngEmpHdrBean.getReptBackDate())));
arylstParameters.add(new DBObject(14, 1, 12, null));
arylstParameters.add(new DBObject(15, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getDeputType()));
arylstParameters.add(new DBObject(16, 1, 12, this.oUserInfo.getUserTypeId()));
arylstParameters.add(new DBObject(17, 1, 12, this.oUserInfo.getSiteId()));
arylstParameters.add(new DBObject(18, 1, 12, null));
arylstParameters.add(new DBObject(19, 1, 12, null));
arylstParameters.add(new DBObject(20, 2, 12));
arylstParameters.add(new DBObject(21, 2, 12));
arylstParameters.add(new DBObject(22, 2, 12));
arylstParameters.add(new DBObject(23, 2, 12));
arylstParameters.add(new DBObject(24, 2, 4));
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMDEPTNORDERSNGEMP.proc_UpsertHrDeputOrderSngEmp(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = arylstOutArray.get(0);
String String1 = (String)oOutObject.getObject();
System.out.println(String1);
DBObject oOutObject1 = arylstOutArray.get(1);
String String2 = (String)oOutObject1.getObject();
System.out.println(String2);
returnString = String.valueOf(String.valueOf(String1).concat(String.valueOf(","))).concat(String.valueOf(String2));
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, oHrmATDDeputOrderSngEmpHdrBean.getApplnNoId()));
arylstParameters.add(new DBObject(3, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getOrderNo()));
arylstParameters.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmATDDeputOrderSngEmpHdrBean.getOrderDate())));
arylstParameters.add(new DBObject(5, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getOrderStatus()));
arylstParameters.add(new DBObject(6, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmATDDeputOrderSngEmpHdrBean.getDeptnEffectDate())));
arylstParameters.add(new DBObject(7, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmATDDeputOrderSngEmpHdrBean.getReportingDate())));
arylstParameters.add(new DBObject(8, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getRemarks()));
arylstParameters.add(new DBObject(9, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getPhone()));
arylstParameters.add(new DBObject(10, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getMobilePhone()));
arylstParameters.add(new DBObject(11, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getFax()));
arylstParameters.add(new DBObject(12, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getEmail()));
arylstParameters.add(new DBObject(13, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmATDDeputOrderSngEmpHdrBean.getReptBackDate())));
arylstParameters.add(new DBObject(14, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getHeaderPrimaryKey()));
arylstParameters.add(new DBObject(15, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getDeputType()));
arylstParameters.add(new DBObject(16, 1, 12, this.oUserInfo.getUserTypeId()));
arylstParameters.add(new DBObject(17, 1, 12, this.oUserInfo.getSiteId()));
arylstParameters.add(new DBObject(18, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getHeaderPrimaryKey()));
arylstParameters.add(new DBObject(19, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.getHeaderPrimaryKey1()));
arylstParameters.add(new DBObject(20, 2, 12));
arylstParameters.add(new DBObject(21, 2, 12));
arylstParameters.add(new DBObject(22, 2, 12));
arylstParameters.add(new DBObject(23, 2, 12));
arylstParameters.add(new DBObject(24, 2, 4));
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMDEPTNORDERSNGEMP.proc_UpsertHrDeputOrderSngEmp(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = arylstOutArray.get(0);
String String1 = (String)oOutObject.getObject();
System.out.println(String1);
DBObject oOutObject1 = arylstOutArray.get(1);
String String2 = (String)oOutObject1.getObject();
System.out.println(String2);
returnString = String.valueOf(String.valueOf(String1).concat(String.valueOf(","))).concat(String.valueOf(String2));
System.out.println(returnString);
} else if (ScreenMode.equalsIgnoreCase("D")) {
HrmCommonBO oCommonBO = new HrmCommonBO();
System.out.println(oHrmATDDeputOrderSngEmpHdrBean.getHeaderPrimaryKey());
oCommonBO.deleteChildDetailRec("HRM_EMP_DEPUT_ORDER_DTL", "DEPUT_ORDER_HDR_ID", oHrmATDDeputOrderSngEmpHdrBean.getHeaderPrimaryKey(), null);
System.out.println(oHrmATDDeputOrderSngEmpHdrBean.getHeaderPrimaryKey());
arylstParameters.add(new DBObject(1, 1, 12, oHrmATDDeputOrderSngEmpHdrBean.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, "HRMDEPTNORDERSNGEMP.proc_DelHrDeputOrdHdr(?,?,?,?)");
DBObject oOutObject = arylstOutArray.get(0);
returnString = null;
}
return returnString;
}
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((HrmATDDeputOrderSngEmpHdrBean)oBaseHeaderBean);
reportError(arylstErrorList);
}
private void checkMandatoryHeader(HrmATDDeputOrderSngEmpHdrBean oHrmATDDeputOrderSngEmpHdrBean) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oErrorList = new ArrayList();
ArrayList oParams = new ArrayList();
if (!EnrgiseUtil.checkString(oHrmATDDeputOrderSngEmpHdrBean.getApplnNo())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmDeputationOrder.applnNo");
oParams = new ArrayList();
oParams.add(oMessageKey);
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
}
if (!EnrgiseUtil.checkString(oHrmATDDeputOrderSngEmpHdrBean.getOrderNo())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmDeputationOrder.orderNo");
oParams = new ArrayList();
oParams.add(oMessageKey);
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
}
if (!EnrgiseUtil.checkString(oHrmATDDeputOrderSngEmpHdrBean.getDeptnEffectDate())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmDeputationOrder.deptnEffectDate");
oParams = new ArrayList();
oParams.add(oMessageKey);
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
}
if (!EnrgiseUtil.checkString(oHrmATDDeputOrderSngEmpHdrBean.getReportingDate())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmDeputationOrder.reportingDate");
oParams = new ArrayList();
oParams.add(oMessageKey);
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
}
if (!EnrgiseUtil.checkString(oHrmATDDeputOrderSngEmpHdrBean.getOrderDate())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmDeputationOrder.orderDate");
oParams = new ArrayList();
oParams.add(oMessageKey);
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
}
reportError(oErrorList);
}
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();
HrmATDDeputOrderSngEmpHdrBean oHrmATDDeputOrderSngEmpHdrBean = (HrmATDDeputOrderSngEmpHdrBean)oBaseHeaderBean;
if (bHeaderDataChanged) {
if (!sScreenMode.equalsIgnoreCase("D")) {
checkUniqueHeader((HrmATDDeputOrderSngEmpHdrBean)oBaseHeaderBean);
checkDatesConstraint((HrmATDDeputOrderSngEmpHdrBean)oBaseHeaderBean, arylstErrorList);
}
if (sScreenMode.equalsIgnoreCase("D")) {
HrmCommonBO oCommonBO = new HrmCommonBO();
if (!oHrmATDDeputOrderSngEmpHdrBean.getOrderStatus().equalsIgnoreCase("N"))
if (arylstErrorList.isEmpty())
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.common.deletion.rejected"));
}
}
reportError(arylstErrorList);
}
private void checkDatesConstraint(HrmATDDeputOrderSngEmpHdrBean oHrmATDDeputOrderSngEmpHdrBean, ArrayList arylstErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
if (EnrgiseUtil.checkString(oHrmATDDeputOrderSngEmpHdrBean.getOrderDate())) {
int iDateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmATDDeputOrderSngEmpHdrBean.getOrderDate(), oHrmATDDeputOrderSngEmpHdrBean.getApplicationDate());
if (iDateFlag == -1 && iDateFlag != -2)
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.common.dateConstraintViolated"));
}
if (EnrgiseUtil.checkString(oHrmATDDeputOrderSngEmpHdrBean.getDeptnEffectDate())) {
int iDateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmATDDeputOrderSngEmpHdrBean.getDeptnEffectDate(), oHrmATDDeputOrderSngEmpHdrBean.getOrderDate());
if (iDateFlag == -1 && iDateFlag != -2)
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.common.dateConstraintViolated"));
}
if (EnrgiseUtil.checkString(oHrmATDDeputOrderSngEmpHdrBean.getReportingDate())) {
int iDateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmATDDeputOrderSngEmpHdrBean.getReportingDate(), oHrmATDDeputOrderSngEmpHdrBean.getDeptnEffectDate());
if (iDateFlag == -1 && iDateFlag != -2)
arylstErrorList.add(new EnrgiseApplicationException("wenrgise.common.dateConstraintViolated"));
}
}
private void checkUniqueHeader(HrmATDDeputOrderSngEmpHdrBean oHrmATDDeputOrderSngEmpHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
String sQuery = String.valueOf(String.valueOf(" Select ID as ID from HRM_EMP_DEPUT_ORDER_HDR where DEPUTN_ORDER_NO= '").concat(String.valueOf(oHrmATDDeputOrderSngEmpHdrBean.getOrderNo()))).concat(String.valueOf("'"));
System.out.println(sQuery);
DBUtilitiesBean oBean = new DBUtilitiesBean();
System.out.println(oHrmATDDeputOrderSngEmpHdrBean.getHeaderPrimaryKey());
ArrayList arylstList = oBean.executeQuery(sQuery);
Iterator oIt = arylstList.iterator();
if (oIt.hasNext()) {
QueryRow oRow = oIt.next();
if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmATDDeputOrderSngEmpHdrBean.getHeaderPrimaryKey()))
throw new EnrgiseApplicationException("wenrgise.common.header.uniqueConstraintViolated", "M");
}
}
public String submitDeputOrder(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
DBUtilitiesBean oBean = null;
HrmATDDeputOrderSngEmpHdrBean oHrmATDDeputOrderSngEmpHdrBean = (HrmATDDeputOrderSngEmpHdrBean)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, "HRMDEPTNORDERSNGEMP.procSubmitDeputOrder(?,?,?,?)");
}
return sHeaderPrimaryKey;
}
public String approveDeputOrder(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
DBUtilitiesBean oBean = null;
HrmATDDeputOrderSngEmpHdrBean oHrmATDDeputOrderSngEmpHdrBean = (HrmATDDeputOrderSngEmpHdrBean)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, "HRMDEPTNORDERSNGEMP.procApproveDeputOrder(?,?,?,?)");
}
return sHeaderPrimaryKey;
}
public String rejectDeputOrder(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
DBUtilitiesBean oBean = null;
HrmATDDeputOrderSngEmpHdrBean oHrmATDDeputOrderSngEmpHdrBean = (HrmATDDeputOrderSngEmpHdrBean)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, "HRMDEPTNORDERSNGEMP.procRejectDeputOrder(?,?,?,?)");
}
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();
HrmATDDeputOrderSngEmpHdrBean oHrmATDDeputOrderSngEmpHdrBean = (HrmATDDeputOrderSngEmpHdrBean)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(oHrmATDDeputOrderSngEmpHdrBean.getHeaderPrimaryKey());
wflDocumentInfoImpl.setDocumentType("Deputation");
wflDocumentInfoImpl.setInitiatedFlag(initiatedFlag);
String documentTypeId = workFlowFacade.getDocumentTypeId("DeputOrderSngEmp");
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("Deputation Order No:").concat(String.valueOf(oHrmATDDeputOrderSngEmpHdrBean.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(oHrmATDDeputOrderSngEmpHdrBean.getHeaderPrimaryKey())));
} else if (!activity.equalsIgnoreCase("Approve")) {
wflDocumentInfoImpl.setDocumentNumber(String.valueOf(String.valueOf("Deputation Order No:").concat(String.valueOf(oHrmATDDeputOrderSngEmpHdrBean.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(oHrmATDDeputOrderSngEmpHdrBean.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);
}
}
}