531 lines
27 KiB
Java
531 lines
27 KiB
Java
package wenrgise.hrms.ejb.business;
|
|
|
|
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 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.HrmOrgIncrementDtlBean;
|
|
import wenrgise.hrms.bean.HrmOrgIncrementHdrBean;
|
|
import wenrgise.hrms.vo.HrmOrgIncrementQVO;
|
|
|
|
public class HrmOrgIncrementBO extends HrmBaseBO {
|
|
public HrmOrgIncrementBO() {}
|
|
|
|
public HrmOrgIncrementBO(UserInfo oUserInfo) {
|
|
super(oUserInfo);
|
|
}
|
|
|
|
public RecordMetaInfo getHrmIncrHdrMetaInfo(HrmOrgIncrementQVO oHrmOrgIncrementQVO) 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, oHrmOrgIncrementQVO.getHeaderPrimaryKey()));
|
|
arylstParameters.add(new DBObject(2, 1, 12, oHrmOrgIncrementQVO.getRatingHdrId()));
|
|
arylstParameters.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmOrgIncrementQVO.getStartDate())));
|
|
arylstParameters.add(new DBObject(4, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmOrgIncrementQVO.getEndDate())));
|
|
arylstParameters.add(new DBObject(5, 2, -5));
|
|
arylstParameters.add(new DBObject(6, 2, 93));
|
|
arylstParameters.add(new DBObject(7, 2, 12));
|
|
arylstParameters.add(new DBObject(8, 2, 12));
|
|
arylstParameters.add(new DBObject(9, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMORGINCRMST.proc_HrIncrHdrCount(?,?,?,?,?,?,?,?,?)");
|
|
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 getHrmIncrHeaderInfo(HrmOrgIncrementQVO oHrmOrgIncrementQVO, 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 (oHrmOrgIncrementQVO == null)
|
|
oHrmOrgIncrementQVO = new HrmOrgIncrementQVO();
|
|
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, oHrmOrgIncrementQVO.getHeaderPrimaryKey()));
|
|
arylstParameters.add(new DBObject(4, 1, 12, oHrmOrgIncrementQVO.getRatingHdrId()));
|
|
arylstParameters.add(new DBObject(5, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmOrgIncrementQVO.getStartDate())));
|
|
arylstParameters.add(new DBObject(6, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmOrgIncrementQVO.getEndDate())));
|
|
arylstParameters.add(new DBObject(7, 2, -10));
|
|
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, "HRMORGINCRMST.proc_GetHrIncrHdrInfo(?,?,?,?,?,?,?,?,?,?)");
|
|
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();
|
|
HrmOrgIncrementHdrBean oHrmOrgIncrementHdrBean = new HrmOrgIncrementHdrBean();
|
|
oHrmOrgIncrementHdrBean.setHeaderPrimaryKey(oRow.get("ID").getString());
|
|
oHrmOrgIncrementHdrBean.setStartDate(EnrgiseUtil.convertToString(oRow.get("START_DATE").getDate()));
|
|
oHrmOrgIncrementHdrBean.setEndDate(EnrgiseUtil.convertToString(oRow.get("END_DATE").getDate()));
|
|
oHrmOrgIncrementHdrBean.setClsHdrId(oRow.get("clsMstId").getString());
|
|
oHrmOrgIncrementHdrBean.setClsHdr(oRow.get("clsMstCode").getString());
|
|
oHrmOrgIncrementHdrBean.setClsHdrDesc(oRow.get("clsMstDesc").getString());
|
|
oHrmOrgIncrementHdrBean.setClsDtlId(oRow.get("clsDtlId").getString());
|
|
oHrmOrgIncrementHdrBean.setClsDtl(oRow.get("clsDtlCode").getString());
|
|
oHrmOrgIncrementHdrBean.setClsDtlDesc(oRow.get("clsDtlDesc").getString());
|
|
oHrmOrgIncrementHdrBean.setRatingHdrId(oRow.get("ratingHdrId").getString());
|
|
oHrmOrgIncrementHdrBean.setRatingCode(oRow.get("ratingHdrCode").getString());
|
|
arylstHeaderList.add(oHrmOrgIncrementHdrBean);
|
|
}
|
|
return arylstHeaderList;
|
|
}
|
|
|
|
public RecordMetaInfo getHrmIncrDtlMetaInfo(String lPrimaryKey) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, lPrimaryKey));
|
|
arylstParam.add(new DBObject(2, 2, -5));
|
|
arylstParam.add(new DBObject(3, 2, 93));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMORGINCRMST.proc_HrIncrDtlCount(?,?,?,?,?,?)");
|
|
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 getHrmIncrDetailInfo(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
BaseDetailVO oBaseDetailVO = null;
|
|
ArrayList arylstHrmIncrDetail = null;
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, -5, new Long(lDetailFirstPosition)));
|
|
arylstParam.add(new DBObject(2, 1, -5, new Long(lDetailLastPosition)));
|
|
arylstParam.add(new DBObject(3, 1, 12, lPrimaryKey));
|
|
arylstParam.add(new DBObject(4, 2, -10));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 12));
|
|
arylstParam.add(new DBObject(7, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMORGINCRMST.proc_GetHrIncrDtlInfo(?,?,?,?,?,?,?)");
|
|
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 oIt = arylstList.iterator();
|
|
while (oIt.hasNext()) {
|
|
if (count == 0)
|
|
arylstHrmIncrDetail = new ArrayList();
|
|
count++;
|
|
oRow = oIt.next();
|
|
HrmOrgIncrementDtlBean oHrmOrgIncrementDtlBean = new HrmOrgIncrementDtlBean();
|
|
oHrmOrgIncrementDtlBean.setDetailId(oRow.get("ID").getString());
|
|
oHrmOrgIncrementDtlBean.setRatingDtlId(oRow.get("RATING_DTL_ID").getString());
|
|
oHrmOrgIncrementDtlBean.setTxtIncrement(oRow.get("INCR_PERC").getString());
|
|
oHrmOrgIncrementDtlBean.setTxtRatingFrom(oRow.get("rating_from").getString());
|
|
oHrmOrgIncrementDtlBean.setTxtRatingTo(oRow.get("rating_to").getString());
|
|
oHrmOrgIncrementDtlBean.setTxtRatingGrade(oRow.get("grade").getString());
|
|
oHrmOrgIncrementDtlBean.setTxtRatingDescription(oRow.get("description").getString());
|
|
arylstHrmIncrDetail.add(oHrmOrgIncrementDtlBean);
|
|
}
|
|
return arylstHrmIncrDetail;
|
|
}
|
|
|
|
public ArrayList getRatingDetail(String sRatingHdrId) throws EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
QueryRow oRow = null;
|
|
QueryValue oValue = null;
|
|
ArrayList arylstList = null;
|
|
Iterator oIt = null;
|
|
ArrayList arylstRatingDetail = null;
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sRatingHdrId));
|
|
arylstParam.add(new DBObject(2, 2, -10));
|
|
arylstParam.add(new DBObject(3, 2, 12));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMORGINCRMST.procRatingDtlInfo(?,?,?,?,?)");
|
|
arylstList = (ArrayList)((DBObject)arylstOutArray.get(0)).getObject();
|
|
if (arylstList.size() == 0);
|
|
count = 0;
|
|
oIt = arylstList.iterator();
|
|
while (oIt.hasNext()) {
|
|
if (count == 0)
|
|
arylstRatingDetail = new ArrayList();
|
|
count++;
|
|
oRow = oIt.next();
|
|
HrmOrgIncrementDtlBean oHrmOrgIncrementDtlBean = new HrmOrgIncrementDtlBean();
|
|
oHrmOrgIncrementDtlBean.setRatingDtlId(oRow.get("id").getString());
|
|
arylstRatingDetail.add(oHrmOrgIncrementDtlBean);
|
|
}
|
|
return arylstRatingDetail;
|
|
}
|
|
|
|
public void insertIncrementDetail(String sRatingHdrId, String sHdrId) throws EnrgiseSystemException {
|
|
boolean bInsert = false;
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = null;
|
|
ArrayList oDetailBeanArray = getRatingDetail(sRatingHdrId);
|
|
Iterator oIt = oDetailBeanArray.iterator();
|
|
while (oIt.hasNext()) {
|
|
HrmOrgIncrementDtlBean oHrmOrgIncrementDtlBean = oIt.next();
|
|
String sRatingDtlId = oHrmOrgIncrementDtlBean.getRatingDtlId();
|
|
if (!bInsert) {
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMORGINCRMST.proc_UpsertHrIncrDtl(?,?,?,?,?,?,?)");
|
|
bInsert = true;
|
|
}
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, "N"));
|
|
arylstParam.add(new DBObject(2, 1, 12, null));
|
|
arylstParam.add(new DBObject(3, 1, 12, sHdrId));
|
|
arylstParam.add(new DBObject(4, 1, 12, sRatingDtlId));
|
|
arylstParam.add(new DBObject(5, 1, 12, null));
|
|
arylstParam.add(new DBObject(6, 1, 12, this.oUserInfo.getUserId()));
|
|
arylstParam.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean.addToBatch(arylstParam);
|
|
}
|
|
if (bInsert)
|
|
oBean.executeBatch();
|
|
}
|
|
|
|
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
|
|
String returnString = null;
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
DateUtility d = new DateUtility();
|
|
HrmOrgIncrementHdrBean oHrmOrgIncrementHdrBean = (HrmOrgIncrementHdrBean)oBaseHeaderBean;
|
|
if (ScreenMode.equalsIgnoreCase("N")) {
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, "N"));
|
|
arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmOrgIncrementHdrBean.getStartDate())));
|
|
arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmOrgIncrementHdrBean.getEndDate())));
|
|
arylstParam.add(new DBObject(4, 1, 12, oHrmOrgIncrementHdrBean.getClsHdrId()));
|
|
arylstParam.add(new DBObject(5, 1, 12, oHrmOrgIncrementHdrBean.getClsDtlId()));
|
|
arylstParam.add(new DBObject(6, 1, 12, oHrmOrgIncrementHdrBean.getRatingHdrId()));
|
|
arylstParam.add(new DBObject(7, 1, 12, null));
|
|
arylstParam.add(new DBObject(8, 1, 12, this.oUserInfo.getUserId()));
|
|
arylstParam.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
|
|
arylstParam.add(new DBObject(10, 2, 12));
|
|
arylstParam.add(new DBObject(11, 2, 12));
|
|
arylstParam.add(new DBObject(12, 2, 12));
|
|
arylstParam.add(new DBObject(13, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMORGINCRMST.proc_UpsertHrIncrHdr(?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
returnString = (String)oOutObject.getObject();
|
|
System.out.println(returnString);
|
|
insertIncrementDetail(oHrmOrgIncrementHdrBean.getRatingHdrId(), returnString);
|
|
}
|
|
if (ScreenMode.equalsIgnoreCase("U")) {
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, "U"));
|
|
arylstParam.add(new DBObject(2, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmOrgIncrementHdrBean.getStartDate())));
|
|
arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmOrgIncrementHdrBean.getEndDate())));
|
|
arylstParam.add(new DBObject(4, 1, 12, oHrmOrgIncrementHdrBean.getClsHdrId()));
|
|
arylstParam.add(new DBObject(5, 1, 12, oHrmOrgIncrementHdrBean.getClsDtlId()));
|
|
arylstParam.add(new DBObject(6, 1, 12, oHrmOrgIncrementHdrBean.getRatingHdrId()));
|
|
arylstParam.add(new DBObject(7, 1, 12, oHrmOrgIncrementHdrBean.getHeaderPrimaryKey()));
|
|
arylstParam.add(new DBObject(8, 1, 12, this.oUserInfo.getUserId()));
|
|
arylstParam.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
|
|
arylstParam.add(new DBObject(10, 2, 12));
|
|
arylstParam.add(new DBObject(11, 2, 12));
|
|
arylstParam.add(new DBObject(12, 2, 12));
|
|
arylstParam.add(new DBObject(13, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMORGINCRMST.proc_UpsertHrIncrHdr(?,?,?,?,?,?,?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.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("HrmOrgIncrement"))
|
|
saveIncrementDetail(sHeaderPrimaryKey, oDetailBeanArray);
|
|
}
|
|
|
|
private void saveIncrementDetail(String sHeaderPrimaryKey, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
|
|
boolean bUpdate = false;
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = null;
|
|
Iterator oIt = oDetailBeanArray.iterator();
|
|
while (oIt.hasNext()) {
|
|
HrmOrgIncrementDtlBean oHrmOrgIncrementDtlBean = oIt.next();
|
|
if (oHrmOrgIncrementDtlBean.getStatus().equals("U")) {
|
|
if (!bUpdate) {
|
|
oBean = new DBUtilitiesBean();
|
|
oBean.createBatch("HRMORGINCRMST.proc_UpsertHrIncrDtl(?,?,?,?,?,?,?)");
|
|
bUpdate = true;
|
|
}
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, "U"));
|
|
arylstParam.add(new DBObject(2, 1, 12, oHrmOrgIncrementDtlBean.getDetailId()));
|
|
arylstParam.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
|
|
arylstParam.add(new DBObject(4, 1, 12, oHrmOrgIncrementDtlBean.getRatingDtlId()));
|
|
arylstParam.add(new DBObject(5, 1, 12, oHrmOrgIncrementDtlBean.getTxtIncrement()));
|
|
arylstParam.add(new DBObject(6, 1, 12, this.oUserInfo.getUserId()));
|
|
arylstParam.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
|
|
oBean.addToBatch(arylstParam);
|
|
}
|
|
}
|
|
if (bUpdate)
|
|
oBean.executeBatch();
|
|
}
|
|
|
|
public void initializeBOImpl() {
|
|
this.headerTable = "HRM_INCREMENT_MST";
|
|
}
|
|
|
|
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
System.out.println("Update ille!");
|
|
}
|
|
|
|
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
|
|
return "saveNewHeaderImpl ille!";
|
|
}
|
|
|
|
public void additionalFieldValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstErrorList = new ArrayList();
|
|
if (bHeaderDataChanged)
|
|
if (!sScreenMode.equalsIgnoreCase("D"))
|
|
checkMandatoryHeader((HrmOrgIncrementHdrBean)oBaseHeaderBean, arylstErrorList);
|
|
if (bDetailDataChanged)
|
|
if (sScreenName.equalsIgnoreCase("HrmOrgIncrement")) {
|
|
Iterator itrBean1 = arylstDetailBeanArray.iterator();
|
|
int iCount = 1;
|
|
while (itrBean1.hasNext()) {
|
|
HrmOrgIncrementDtlBean oHrmOrgIncrementDtlBean = itrBean1.next();
|
|
if (!oHrmOrgIncrementDtlBean.getStatus().equalsIgnoreCase("D")) {
|
|
checkMandatory(oHrmOrgIncrementDtlBean, iCount, arylstErrorList);
|
|
checkNumericFields(oHrmOrgIncrementDtlBean, iCount, arylstErrorList);
|
|
}
|
|
iCount++;
|
|
}
|
|
}
|
|
reportError(arylstErrorList);
|
|
}
|
|
|
|
private void checkMandatoryHeader(HrmOrgIncrementHdrBean oHrmOrgIncrementHdrBean, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
ArrayList oParams = new ArrayList();
|
|
if (!EnrgiseUtil.checkString(oHrmOrgIncrementHdrBean.getStartDate())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmOrgIncrement.startDate");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmOrgIncrementHdrBean.getClsHdr())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmOrgIncrement.classHeaderCode");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmOrgIncrementHdrBean.getClsDtl())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmOrgIncrement.classDetailCode");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
if (!EnrgiseUtil.checkString(oHrmOrgIncrementHdrBean.getRatingCode())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmOrgIncrement.ratingCode");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
}
|
|
|
|
private void checkMandatory(HrmOrgIncrementDtlBean oHrmOrgIncrementDtlBean, int iCount, ArrayList arylstErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
|
|
if (!EnrgiseUtil.checkString(oHrmOrgIncrementDtlBean.getTxtIncrement())) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmOrgIncrement.increment");
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(iCount));
|
|
arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
|
|
}
|
|
}
|
|
|
|
private void checkNumericFields(HrmOrgIncrementDtlBean oHrmOrgIncrementDtlBean, int rowCount, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oParams = new ArrayList();
|
|
if (!EnrgiseUtil.checkNumber(oHrmOrgIncrementDtlBean.getTxtIncrement(), 3, 2, "P")) {
|
|
MessageKey oMessageKey = new MessageKey("hrm.HrmOrgIncrement.increment");
|
|
oParams = new ArrayList();
|
|
oParams.add(oMessageKey);
|
|
oParams.add(new Integer(rowCount));
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.invalidNumber", oParams));
|
|
}
|
|
}
|
|
|
|
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
|
|
|
|
public void additionalBusinessValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList oErrorList = new ArrayList();
|
|
HrmOrgIncrementHdrBean oHrmOrgIncrementHdrBean = (HrmOrgIncrementHdrBean)oBaseHeaderBean;
|
|
if (bHeaderDataChanged)
|
|
if (!sScreenMode.equalsIgnoreCase("D")) {
|
|
if (sScreenMode.equalsIgnoreCase("N"))
|
|
getLastEndDate(oHrmOrgIncrementHdrBean.getRatingHdrId(), oErrorList, oHrmOrgIncrementHdrBean);
|
|
checkEndDate((HrmOrgIncrementHdrBean)oBaseHeaderBean, oErrorList);
|
|
}
|
|
reportError(oErrorList);
|
|
}
|
|
|
|
public LovVO getIncrRatingLOVNData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sQuery = "select hrh.id,hrh.CODE,hrh.MIN_RATING,hrh.MAX_RATING,hrh.QUALIFYING_RATING from hrm_rating_hdr hrh ";
|
|
sQuery = String.valueOf(sQuery).concat(String.valueOf(" where 1=1 "));
|
|
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
|
|
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(hrh.CODE) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') "));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList oResultList = oBean.executeQuery(sQuery);
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
ArrayList oList = new ArrayList();
|
|
oHeaderList.add("ratingId");
|
|
oHeaderList.add("hrm.HrmOrgIncrement.ratingCode");
|
|
oHeaderList.add("hrm.HrmRatingMaster.minimumRating");
|
|
oHeaderList.add("hrm.HrmRatingMaster.maximumRating");
|
|
oHeaderList.add("hrm.HrmRatingMaster.qualifyingRating");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
QueryRow oRow = null;
|
|
Iterator oIt = oResultList.iterator();
|
|
while (oIt.hasNext()) {
|
|
oRow = oIt.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("id").getString());
|
|
oLOVBean.setDetailField2(oRow.get("CODE").getString());
|
|
oLOVBean.setDetailField3(oRow.get("MIN_RATING").getString());
|
|
oLOVBean.setDetailField4(oRow.get("MAX_RATING").getString());
|
|
oLOVBean.setDetailField5(oRow.get("QUALIFYING_RATING").getString());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public LovVO getIncrRatingLOVQData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
String sQuery = "select distinct hrh.id,hrh.CODE,hrh.MIN_RATING,hrh.MAX_RATING,hrh.QUALIFYING_RATING from hrm_rating_hdr hrh,hrm_increment_mst him ";
|
|
sQuery = String.valueOf(sQuery).concat(String.valueOf(" where him.RATING_HDR_ID=hrh.id "));
|
|
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
|
|
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(hrh.CODE) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') "));
|
|
System.out.println(sQuery);
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
ArrayList oResultList = oBean.executeQuery(sQuery);
|
|
LovVO oLovVO = new LovVO();
|
|
ArrayList oHeaderList = new ArrayList();
|
|
ArrayList oList = new ArrayList();
|
|
oHeaderList.add("ratingId");
|
|
oHeaderList.add("hrm.HrmOrgIncrement.ratingCode");
|
|
oHeaderList.add("hrm.HrmRatingMaster.minimumRating");
|
|
oHeaderList.add("hrm.HrmRatingMaster.maximumRating");
|
|
oHeaderList.add("hrm.HrmRatingMaster.qualifyingRating");
|
|
oLovVO.setHeaderList(oHeaderList);
|
|
ArrayList arylstVisibility = new ArrayList();
|
|
arylstVisibility.add("H");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
arylstVisibility.add("V");
|
|
oLovVO.setVisibilityList(arylstVisibility);
|
|
QueryRow oRow = null;
|
|
Iterator oIt = oResultList.iterator();
|
|
while (oIt.hasNext()) {
|
|
oRow = oIt.next();
|
|
LOVBean oLOVBean = new LOVBean();
|
|
oLOVBean.setDetailField1(oRow.get("id").getString());
|
|
oLOVBean.setDetailField2(oRow.get("CODE").getString());
|
|
oLOVBean.setDetailField3(oRow.get("MIN_RATING").getString());
|
|
oLOVBean.setDetailField4(oRow.get("MAX_RATING").getString());
|
|
oLOVBean.setDetailField5(oRow.get("QUALIFYING_RATING").getString());
|
|
oList.add(oLOVBean);
|
|
}
|
|
oLovVO.setDetailList(oList);
|
|
return oLovVO;
|
|
}
|
|
|
|
public void getLastEndDate(String sRatingHdrId, ArrayList oErrorList, HrmOrgIncrementHdrBean oHrmOrgIncrementHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
ArrayList arylstParam = new ArrayList();
|
|
DBUtilitiesBean oBean = new DBUtilitiesBean();
|
|
int count = 0;
|
|
BaseDetailVO oBaseDetailVO = null;
|
|
String sLastEndDate = null;
|
|
arylstParam = new ArrayList();
|
|
arylstParam.add(new DBObject(1, 1, 12, sRatingHdrId));
|
|
arylstParam.add(new DBObject(2, 1, 12, oHrmOrgIncrementHdrBean.getClsHdrId()));
|
|
arylstParam.add(new DBObject(3, 1, 12, oHrmOrgIncrementHdrBean.getClsDtlId()));
|
|
arylstParam.add(new DBObject(4, 2, 12));
|
|
arylstParam.add(new DBObject(5, 2, 12));
|
|
arylstParam.add(new DBObject(6, 2, 12));
|
|
arylstParam.add(new DBObject(7, 2, 4));
|
|
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMORGINCRMST.procLastEndDate(?,?,?,?,?,?,?)");
|
|
DBObject oOutObject = arylstOutArray.get(0);
|
|
String sArylstParam = (String)oOutObject.getObject();
|
|
if (!EnrgiseUtil.checkString(sArylstParam)) {
|
|
oErrorList.add(new EnrgiseApplicationException("wenrgise.hrms.incr.enddate.value"));
|
|
} else {
|
|
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
|
|
int dateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmOrgIncrementHdrBean.getStartDate(), sLastEndDate);
|
|
if (dateFlag == -1 && dateFlag != -2) {
|
|
ArrayList oParams = new ArrayList();
|
|
oParams.add(sLastEndDate);
|
|
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.hrms.stdateConstraintViolated", oParams));
|
|
}
|
|
}
|
|
}
|
|
|
|
private void checkEndDate(HrmOrgIncrementHdrBean oHrmOrgIncrementHdrBean, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
|
|
DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
|
|
if (EnrgiseUtil.checkString(oHrmOrgIncrementHdrBean.getEndDate())) {
|
|
int dateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmOrgIncrementHdrBean.getEndDate(), oHrmOrgIncrementHdrBean.getStartDate());
|
|
if (dateFlag == -1 && dateFlag != -2)
|
|
oErrorList.add(new EnrgiseApplicationException("wenrgise.hrms.endDateConstraintViolated"));
|
|
}
|
|
}
|
|
}
|