654 lines
31 KiB
Java
654 lines
31 KiB
Java
package wenrgise.hrms.ejb.business;
|
|
|
|
import java.sql.Timestamp;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
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.vo.BaseDetailVO;
|
|
import wenrgise.common.vo.BaseHeaderVO;
|
|
import wenrgise.common.vo.LovQueryVO;
|
|
import wenrgise.common.vo.LovVO;
|
|
import wenrgise.ejb.common.helper.DBObject;
|
|
import wenrgise.ejb.common.helper.QueryRow;
|
|
import wenrgise.ejb.common.helper.QueryValue;
|
|
import wenrgise.ejb.common.utility.DBUtilitiesBean;
|
|
import wenrgise.hrms.bean.HrmOrgClassDtlBean;
|
|
import wenrgise.hrms.bean.HrmOrgClassHdrBean;
|
|
import wenrgise.hrms.vo.HrmOrgClassDtlQVO;
|
|
|
|
public class HrmOrgClassDtlBO extends HrmBaseBO {
|
|
public HrmOrgClassDtlBO() {}
|
|
|
|
public HrmOrgClassDtlBO(UserInfo oUserInfo) {
|
|
super(oUserInfo);
|
|
}
|
|
|
|
public RecordMetaInfo getHrmClassHdrMetaInfo(HrmOrgClassDtlQVO oHrmOrgClassDtlQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
Timestamp oWhenPicked = null;
|
|
int count = 0;
|
|
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, oHrmOrgClassDtlQVO.getHeaderPrimaryKey()));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmOrgClassDtlQVO.getCode()));
|
|
arylstParameters.add(new DBObject(3, 2, -5));
|
|
arylstParameters.add(new DBObject(4, 2, 93));
|
|
arylstParameters.add(new DBObject(5, 2, 12));
|
|
arylstParameters.add(new DBObject(6, 2, 12));
|
|
arylstParameters.add(new DBObject(7, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMORGCLASSDTL.proc_ClassHdrCount(?,?,?,?,?,?,?)");
|
|
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 getHrmClassHeaderInfo(HrmOrgClassDtlQVO oHrmOrgClassDtlQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
Timestamp oWhenPicked = null;
|
|
int count = 0;
|
|
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
|
|
ArrayList arylstHeaderList = null;
|
|
if (oHrmOrgClassDtlQVO == null)
|
|
oHrmOrgClassDtlQVO = new HrmOrgClassDtlQVO();
|
|
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, oHrmOrgClassDtlQVO.getHeaderPrimaryKey()));
|
|
arylstParameters.add(new DBObject(4, 1, 12, oHrmOrgClassDtlQVO.getCode()));
|
|
arylstParameters.add(new DBObject(5, 2, -10));
|
|
arylstParameters.add(new DBObject(6, 2, 12));
|
|
arylstParameters.add(new DBObject(7, 2, 12));
|
|
arylstParameters.add(new DBObject(8, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMORGCLASSDTL.proc_GetClassHdr(?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
if (arylstList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
|
|
QueryRow oRow = null;
|
|
HashMap oColumns = null;
|
|
Iterator itrBean = arylstList.iterator();
|
|
while (itrBean.hasNext()) {
|
|
if (count == 0)
|
|
arylstHeaderList = new ArrayList();
|
|
count++;
|
|
oRow = itrBean.next();
|
|
HrmOrgClassHdrBean oClassHeader = new HrmOrgClassHdrBean();
|
|
oClassHeader.setHeaderPrimaryKey(oRow.get("ID").getString());
|
|
oClassHeader.setCode(oRow.get("CODE").getString());
|
|
oClassHeader.setClassificationType(oRow.get("NAME").getString());
|
|
arylstHeaderList.add(oClassHeader);
|
|
}
|
|
return arylstHeaderList;
|
|
}
|
|
|
|
public RecordMetaInfo getHrmClassDtlMetaInfo(String lPrimaryKey) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, lPrimaryKey));
|
|
arylstParameters.add(new DBObject(2, 2, -5));
|
|
arylstParameters.add(new DBObject(3, 2, 93));
|
|
arylstParameters.add(new DBObject(4, 2, 12));
|
|
arylstParameters.add(new DBObject(5, 2, 12));
|
|
arylstParameters.add(new DBObject(6, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMORGCLASSDTL.proc_ClassDtlCount(?,?,?,?,?,?)");
|
|
RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo();
|
|
DBObject oTotalRecord = arylstOutArray.get(0);
|
|
oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue());
|
|
DBObject oTimeObject = arylstOutArray.get(1);
|
|
oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject());
|
|
return oRecordMetaInfo;
|
|
}
|
|
|
|
public ArrayList getHrmClassDetailInfo(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
BaseDetailVO oBaseDetailVO = null;
|
|
ArrayList arylstHrmClassDetail = null;
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, -5, new Long(lDetailFirstPosition)));
|
|
arylstParameters.add(new DBObject(2, 1, -5, new Long(lDetailLastPosition)));
|
|
arylstParameters.add(new DBObject(3, 1, 12, lPrimaryKey));
|
|
arylstParameters.add(new DBObject(4, 2, -10));
|
|
arylstParameters.add(new DBObject(5, 2, 12));
|
|
arylstParameters.add(new DBObject(6, 2, 12));
|
|
arylstParameters.add(new DBObject(7, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMORGCLASSDTL.proc_GetClassDtl(?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
if (arylstList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
Iterator itrBean = arylstList.iterator();
|
|
while (itrBean.hasNext()) {
|
|
if (count == 0)
|
|
arylstHrmClassDetail = new ArrayList();
|
|
count++;
|
|
oRow = itrBean.next();
|
|
HrmOrgClassDtlBean oClassDetailBean = new HrmOrgClassDtlBean();
|
|
oClassDetailBean.setDetailId(oRow.get("ID").getString());
|
|
oClassDetailBean.setTxtClassificationCode(oRow.get("CODE").getString());
|
|
oClassDetailBean.setTxtDescription(oRow.get("NAME").getString());
|
|
oClassDetailBean.setTxtHierarchy(oRow.get("HIERARCHY_LEVEL").getString());
|
|
oClassDetailBean.setTxtTypeCode(oRow.get("PARENTCODE").getString());
|
|
oClassDetailBean.setTxtParentCode(oRow.get("PARENTNAME").getString());
|
|
arylstHrmClassDetail.add(oClassDetailBean);
|
|
}
|
|
return arylstHrmClassDetail;
|
|
}
|
|
|
|
public ArrayList getHrClassHeaderInfoByHdrId(String sId) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
Timestamp oWhenPicked = null;
|
|
int count = 0;
|
|
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
|
|
ArrayList arylstHeaderList = null;
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sId));
|
|
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, "HRMORGCLASSDTL.proc_GetClassHdrById(?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
if (arylstList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
|
|
QueryRow oRow = null;
|
|
HashMap oColumns = null;
|
|
Iterator itrBean = arylstList.iterator();
|
|
while (itrBean.hasNext()) {
|
|
if (count == 0)
|
|
arylstHeaderList = new ArrayList();
|
|
count++;
|
|
oRow = itrBean.next();
|
|
HrmOrgClassHdrBean oClassHeader = new HrmOrgClassHdrBean();
|
|
oClassHeader.setHeaderPrimaryKey(oRow.get("ID").getString());
|
|
oClassHeader.setCode(oRow.get("CODE").getString());
|
|
oClassHeader.setClassificationType(oRow.get("NAME").getString());
|
|
arylstHeaderList.add(oClassHeader);
|
|
}
|
|
return arylstHeaderList;
|
|
}
|
|
|
|
public ArrayList getHrClassDetailByDtlId(String sId) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
BaseDetailVO oBaseDetailVO = null;
|
|
ArrayList arylstHrClassDetail = null;
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sId));
|
|
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, "HRMORGCLASSDTL.proc_GetClassDtlById(?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
if (arylstList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
Iterator itrBean = arylstList.iterator();
|
|
while (itrBean.hasNext()) {
|
|
if (count == 0)
|
|
arylstHrClassDetail = new ArrayList();
|
|
count++;
|
|
oRow = itrBean.next();
|
|
HrmOrgClassDtlBean oClassDetailBean = new HrmOrgClassDtlBean();
|
|
oClassDetailBean.setDetailId(oRow.get("ID").getString());
|
|
oClassDetailBean.setTxtClassificationCode(oRow.get("CODE").getString());
|
|
oClassDetailBean.setTxtDescription(oRow.get("NAME").getString());
|
|
oClassDetailBean.setTxtHierarchy(oRow.get("HIERARCHY_LEVEL").getString());
|
|
oClassDetailBean.setTxtParentCode(oRow.get("PARENT_ID").getString());
|
|
arylstHrClassDetail.add(oClassDetailBean);
|
|
}
|
|
return arylstHrClassDetail;
|
|
}
|
|
|
|
public ArrayList getHrClassDetailByHdrIdDtlCd(String sId, String sCode) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
BaseDetailVO oBaseDetailVO = null;
|
|
ArrayList arylstHrClassDetail = null;
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sId));
|
|
arylstParameters.add(new DBObject(2, 1, 12, sCode));
|
|
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, "HRMORGCLASSDTL.proc_GetClassDtlByCd(?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
if (arylstList.size() == 0)
|
|
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
HashMap oColumns = null;
|
|
Iterator itrBean = arylstList.iterator();
|
|
while (itrBean.hasNext()) {
|
|
if (count == 0)
|
|
arylstHrClassDetail = new ArrayList();
|
|
count++;
|
|
oRow = itrBean.next();
|
|
HrmOrgClassDtlBean oClassDetailBean = new HrmOrgClassDtlBean();
|
|
oClassDetailBean.setDetailId(oRow.get("ID").getString());
|
|
oClassDetailBean.setTxtClassificationCode(oRow.get("CODE").getString());
|
|
oClassDetailBean.setTxtDescription(oRow.get("NAME").getString());
|
|
oClassDetailBean.setTxtHierarchy(oRow.get("HIERARCHY_LEVEL").getString());
|
|
oClassDetailBean.setTxtParentCode(oRow.get("PARENT_ID").getString());
|
|
arylstHrClassDetail.add(oClassDetailBean);
|
|
}
|
|
return arylstHrClassDetail;
|
|
}
|
|
|
|
public void initializeBOImpl() {
|
|
this.headerTable = "HRM_CALENDAR_MST";
|
|
}
|
|
|
|
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
|
|
String returnString = null;
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
DateUtility d = new DateUtility();
|
|
HrmOrgClassHdrBean oHrmOrgClassHdrBean = (HrmOrgClassHdrBean)oBaseHeaderBean;
|
|
if (ScreenMode.equalsIgnoreCase("N")) {
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, "i"));
|
|
oParameters.add(new DBObject(2, 1, 12, oHrmOrgClassHdrBean.getCode()));
|
|
oParameters.add(new DBObject(3, 1, 12, oHrmOrgClassHdrBean.getClassificationType()));
|
|
oParameters.add(new DBObject(4, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
oParameters.add(new DBObject(5, 1, 12, this.oUserInfo.getSiteId()));
|
|
oParameters.add(new DBObject(6, 1, 12, null));
|
|
oParameters.add(new DBObject(7, 2, 12));
|
|
oParameters.add(new DBObject(8, 2, 12));
|
|
oParameters.add(new DBObject(9, 2, 12));
|
|
oParameters.add(new DBObject(10, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMORGCLASSDTL.proc_UpsertHrmOrngClassHdr(?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
returnString = (String)oOutObject.getObject();
|
|
System.out.println(returnString);
|
|
} else if (ScreenMode.equalsIgnoreCase("U")) {
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, "u"));
|
|
oParameters.add(new DBObject(2, 1, 12, oHrmOrgClassHdrBean.getCode()));
|
|
oParameters.add(new DBObject(3, 1, 12, oHrmOrgClassHdrBean.getClassificationType()));
|
|
oParameters.add(new DBObject(4, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
oParameters.add(new DBObject(5, 1, 12, this.oUserInfo.getSiteId()));
|
|
oParameters.add(new DBObject(6, 1, 12, oHrmOrgClassHdrBean.getHeaderPrimaryKey()));
|
|
oParameters.add(new DBObject(7, 2, 12));
|
|
oParameters.add(new DBObject(8, 2, 12));
|
|
oParameters.add(new DBObject(9, 2, 12));
|
|
oParameters.add(new DBObject(10, 2, 4));
|
|
ArrayList oOutArray = oBean.callProc(oParameters, "HRMORGCLASSDTL.proc_UpsertHrmOrngClassHdr(?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = oOutArray.get(0);
|
|
returnString = (String)oOutObject.getObject();
|
|
System.out.println(returnString);
|
|
}
|
|
return returnString;
|
|
}
|
|
|
|
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
|
|
if (sScreenName.equalsIgnoreCase("HrmOrgClassDtl"))
|
|
saveHrmOrgClassDetail(sHeaderPrimaryKey, oDetailBeanArray);
|
|
}
|
|
|
|
private void saveHrmOrgClassDetail(String sHeaderPrimaryKey, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
|
|
boolean bInsert = false;
|
|
boolean bUpdate = false;
|
|
boolean bDelete = false;
|
|
ArrayList oParameters = new ArrayList();
|
|
DBUtilitiesBean oBean = null;
|
|
DBUtilitiesBean oBean1 = null;
|
|
Iterator oIt = oDetailBeanArray.iterator();
|
|
while (oIt.hasNext()) {
|
|
HrmOrgClassDtlBean oHrmOrgClassDtlBean = oIt.next();
|
|
if (oHrmOrgClassDtlBean.getStatus().equals("N")) {
|
|
if (!bInsert) {
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMORGCLASSDTL.proc_UpsertHrClassDtl(?,?,?,?,?,?,?,?,?)");
|
|
bInsert = true;
|
|
}
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, "I"));
|
|
oParameters.add(new DBObject(2, 1, 12, null));
|
|
oParameters.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
|
|
oParameters.add(new DBObject(4, 1, 12, oHrmOrgClassDtlBean.getTxtClassificationCode()));
|
|
oParameters.add(new DBObject(5, 1, 12, oHrmOrgClassDtlBean.getTxtDescription()));
|
|
oParameters.add(new DBObject(6, 1, 12, oHrmOrgClassDtlBean.getTxtHierarchy()));
|
|
oParameters.add(new DBObject(7, 1, 12, oHrmOrgClassDtlBean.getTxtParentCodeId()));
|
|
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean.addToBatch(oParameters);
|
|
continue;
|
|
}
|
|
if (oHrmOrgClassDtlBean.getStatus().equals("U")) {
|
|
if (!bUpdate) {
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMORGCLASSDTL.proc_UpsertHrClassDtl(?,?,?,?,?,?,?,?,?)");
|
|
bUpdate = true;
|
|
}
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, "U"));
|
|
oParameters.add(new DBObject(2, 1, 12, oHrmOrgClassDtlBean.getDetailId()));
|
|
oParameters.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
|
|
oParameters.add(new DBObject(4, 1, 12, oHrmOrgClassDtlBean.getTxtClassificationCode()));
|
|
oParameters.add(new DBObject(5, 1, 12, oHrmOrgClassDtlBean.getTxtDescription()));
|
|
oParameters.add(new DBObject(6, 1, 12, oHrmOrgClassDtlBean.getTxtHierarchy()));
|
|
oParameters.add(new DBObject(7, 1, 12, oHrmOrgClassDtlBean.getTxtParentCodeId()));
|
|
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getUserTypeId()));
|
|
oParameters.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean.addToBatch(oParameters);
|
|
continue;
|
|
}
|
|
if (oHrmOrgClassDtlBean.getStatus().equals("D")) {
|
|
if (!bDelete) {
|
|
oBean1 = new DBUtilitiesBean();
|
|
oBean1.createBatch("HRMORGCLASSDTL.proc_HrOrgClassDelete(?)");
|
|
bDelete = true;
|
|
}
|
|
oParameters = new ArrayList();
|
|
oParameters.add(new DBObject(1, 1, 12, oHrmOrgClassDtlBean.getDetailId()));
|
|
oBean1.addToBatch(oParameters);
|
|
}
|
|
}
|
|
if (bInsert)
|
|
oBean.executeBatch();
|
|
if (bUpdate)
|
|
oBean.executeBatch();
|
|
if (bDelete)
|
|
oBean1.executeBatch();
|
|
}
|
|
|
|
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
System.out.println("Update ille!");
|
|
}
|
|
|
|
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
return "saveNewHeaderImpl ille!";
|
|
}
|
|
|
|
public LovVO getHrmClassDtlLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderNames = new ArrayList();
|
|
arylstHeaderNames.add("ID");
|
|
arylstHeaderNames.add("hrm.HrmClassificationDtls.code");
|
|
arylstHeaderNames.add("hrm.HrmTrainingCourseMst.name");
|
|
oLovVO.setHeaderList(arylstHeaderNames);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
ArrayList arylstParameters = new ArrayList();
|
|
String sHierarchy = null;
|
|
String sCode = null;
|
|
if (oLovQueryVO.getProperty("txtHierarchy") != null) {
|
|
sHierarchy = oLovQueryVO.getProperty("txtHierarchy");
|
|
System.out.println(sHierarchy);
|
|
}
|
|
if (oLovQueryVO.getProperty("code") != null) {
|
|
sCode = oLovQueryVO.getProperty("code");
|
|
System.out.println(sCode);
|
|
}
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sHierarchy));
|
|
arylstParameters.add(new DBObject(2, 1, 12, sCode));
|
|
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, "HRMORGSETUPLOV.proc_GetClassDtlLOV(?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = arylstList.iterator();
|
|
while (iter.hasNext()) {
|
|
if (count == 0)
|
|
arylstList = new ArrayList();
|
|
count++;
|
|
oRow = iter.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("CODE").getString());
|
|
oLOVBean.setDetailField3(oRow.get("NAME").getString());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmClassTypeLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderNames = new ArrayList();
|
|
arylstHeaderNames.add("ID");
|
|
arylstHeaderNames.add("hrm.HrmClassificationDtls.code");
|
|
arylstHeaderNames.add("hrm.HrmClassificationDtls.classificationType");
|
|
oLovVO.setHeaderList(arylstHeaderNames);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
ArrayList arylstParameters = new ArrayList();
|
|
String sSearchField1 = null;
|
|
String sSearchField2 = null;
|
|
if (oLovQueryVO.getSearchField1() != null)
|
|
sSearchField1 = oLovQueryVO.getSearchField1();
|
|
if (oLovQueryVO.getSearchField2() != null)
|
|
sSearchField2 = oLovQueryVO.getSearchField2();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
arylstParameters = new ArrayList();
|
|
arylstParameters.add(new DBObject(1, 1, 12, sSearchField1));
|
|
arylstParameters.add(new DBObject(2, 1, 12, sSearchField2));
|
|
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, "HRMORGSETUPLOV.proc_GetClassDtlTypeCodeLOV(?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
ArrayList arylstList = (ArrayList)oOutObject.getObject();
|
|
QueryRow oRow = null;
|
|
Iterator iter = arylstList.iterator();
|
|
while (iter.hasNext()) {
|
|
if (count == 0)
|
|
arylstList = new ArrayList();
|
|
count++;
|
|
oRow = iter.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("ID").getString());
|
|
oLOVBean.setDetailField2(oRow.get("CODE").getString());
|
|
oLOVBean.setDetailField3(oRow.get("NAME").getString());
|
|
arylstList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(arylstList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getHrmClassDetailLOVInfo(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList arylstHeaderNames = new ArrayList();
|
|
arylstHeaderNames.add("ID");
|
|
arylstHeaderNames.add("hrm.HrmClassificationDtls.name");
|
|
arylstHeaderNames.add("hrm.HrmClassificationDtls.code");
|
|
arylstHeaderNames.add("hrm.HrmClassificationDtls.txtHierarchy");
|
|
oLovVO.setHeaderList(arylstHeaderNames);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
int count = 0;
|
|
HrmOrgClassDtlBean oRow = null;
|
|
ArrayList arylstDetailList = getHrmClassDetailInfo(oLovQueryVO.getProperty("eligibilityClass"), 1L, 999999L);
|
|
Iterator iterDetailList = arylstDetailList.iterator();
|
|
ArrayList arylstBeanList = null;
|
|
while (iterDetailList.hasNext()) {
|
|
if (count == 0)
|
|
arylstBeanList = new ArrayList();
|
|
count++;
|
|
oRow = iterDetailList.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.getDetailId());
|
|
oLOVBean.setDetailField2(oRow.getTxtDescription());
|
|
oLOVBean.setDetailField3(oRow.getTxtClassificationCode());
|
|
oLOVBean.setDetailField4(oRow.getTxtHierarchy());
|
|
arylstBeanList.add(oLOVBean);
|
|
}
|
|
System.out.println(arylstBeanList);
|
|
oLovVO.setDetailList(arylstBeanList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, 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((HrmOrgClassHdrBean)oBaseHeaderBean);
|
|
if (bDetailDataChanged)
|
|
if (sScreenName.equalsIgnoreCase("HrmOrgClassDtl")) {
|
|
Iterator itrBean1 = arylstDetailBeanArray.iterator();
|
|
int iCount = 1;
|
|
while (itrBean1.hasNext()) {
|
|
HrmOrgClassDtlBean oHrmOrgClassDtlBean = itrBean1.next();
|
|
if (!oHrmOrgClassDtlBean.getStatus().equalsIgnoreCase("D"))
|
|
checkMandatory(oHrmOrgClassDtlBean, iCount, arylstErrorList);
|
|
iCount++;
|
|
}
|
|
}
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
private void checkMandatory(HrmOrgClassDtlBean oHrmOrgClassDtlBean, int iCount, ArrayList arylstErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
if (!EnrgiseUtil.checkString(oHrmOrgClassDtlBean.getTxtClassificationCode())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmClassificationDtls.txtClassificationCode");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(iCount));
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmOrgClassDtlBean.getTxtDescription())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmClassificationDtls.txtDescription");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(iCount));
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
private void checkMandatoryHeader(HrmOrgClassHdrBean oHrmOrgClassHdrBean) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
ArrayList oErrorList = new ArrayList();
|
|
ArrayList oParams = new ArrayList();
|
|
if (!EnrgiseUtil.checkString(oHrmOrgClassHdrBean.getCode())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmClassificationDtls.code");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmOrgClassHdrBean.getClassificationType())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmClassificationDtls.classificationType");
|
|
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();
|
|
HrmOrgClassHdrBean oHrmOrgClassHdrBean = (HrmOrgClassHdrBean)oBaseHeaderBean;
|
|
if (bHeaderDataChanged)
|
|
if (!sScreenMode.equalsIgnoreCase("D"))
|
|
checkUniqueHeader((HrmOrgClassHdrBean)oBaseHeaderBean);
|
|
if (bDetailDataChanged)
|
|
if (!sScreenMode.equalsIgnoreCase("D"))
|
|
if (sScreenName.equalsIgnoreCase("HrmOrgClassDtl")) {
|
|
Iterator oIt1 = arylstDetailBeanArray.iterator();
|
|
while (oIt1.hasNext()) {
|
|
HrmOrgClassDtlBean oHrmOrgClassDtlBean = oIt1.next();
|
|
if (!oHrmOrgClassDtlBean.getStatus().equalsIgnoreCase("D")) {
|
|
EnrgiseUtil.checkDuplicate(arylstDetailBeanArray, "txtClassificationCode", "hrm.HrmClassificationDtls.txtClassificationCode", arylstErrorList, true);
|
|
EnrgiseUtil.checkDuplicate(arylstDetailBeanArray, "txtDescription", "hrm.HrmClassificationDtls.txtDescription", arylstErrorList, true);
|
|
checkUniqueClassDtl(oBaseHeaderBean.getHeaderPrimaryKey(), arylstDetailBeanArray);
|
|
}
|
|
}
|
|
}
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
private void checkUniqueHeader(HrmOrgClassHdrBean oHrmOrgClassHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sQuery = String.valueOf(String.valueOf(" Select ID as ID from HRM_CLASS_MST where CODE='").concat(String.valueOf(oHrmOrgClassHdrBean.getCode()))).concat(String.valueOf("'"));
|
|
System.out.println(sQuery);
|
|
ArrayList arylstList1 = new ArrayList();
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList arylstList = oBean.executeQuery(sQuery);
|
|
Iterator itrBean = arylstList.iterator();
|
|
if (itrBean.hasNext()) {
|
|
QueryRow oRow = itrBean.next();
|
|
if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmOrgClassHdrBean.getHeaderPrimaryKey())) {
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add("");
|
|
arylstParam.add(new Integer(0));
|
|
arylstList1.add(new EnrgiseMessageKeyException("wenrgise.common.uniqueConstraintViolated", arylstParam));
|
|
}
|
|
}
|
|
reportError(arylstList1);
|
|
}
|
|
|
|
private void checkUniqueClassDtl(String sHeaderPrimaryKey, ArrayList oDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oParams = new ArrayList();
|
|
ArrayList oErrorList = new ArrayList();
|
|
int count = 0;
|
|
Iterator oIt1 = oDetailBeanArray.iterator();
|
|
while (oIt1.hasNext()) {
|
|
HrmOrgClassDtlBean oHrmOrgClassDtlBean = oIt1.next();
|
|
String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(String.valueOf(" Select ID from HRM_CLASS_DTL where CODE='").concat(String.valueOf(oHrmOrgClassDtlBean.getTxtClassificationCode()))).concat(String.valueOf("'"))).concat(String.valueOf(" and CLS_MST_ID='"))).concat(String.valueOf(sHeaderPrimaryKey))).concat(String.valueOf("'"));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList oList = oBean.executeQuery(sQuery);
|
|
Iterator oIt = oList.iterator();
|
|
if (oIt.hasNext()) {
|
|
QueryRow oRow = oIt.next();
|
|
if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmOrgClassDtlBean.getDetailId())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmClassificationDtls.classificationType");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.uniqueConstraintViolated", oParams, "E"));
|
|
}
|
|
}
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
}
|