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

544 lines
27 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.HrmOrgRatingMstDtlBean;
import wenrgise.hrms.bean.HrmOrgRatingMstHdrBean;
import wenrgise.hrms.vo.HrmOrgRatingMstQVO;
public class HrmOrgRatingMstBO extends HrmBaseBO {
public HrmOrgRatingMstBO() {}
public HrmOrgRatingMstBO(UserInfo oUserInfo) {
super(oUserInfo);
}
public RecordMetaInfo getHrmRatingHdrMetaInfo(HrmOrgRatingMstQVO oHrmOrgRatingMstQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList arylstParam = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
Timestamp oWhenPicked = null;
int count = 0;
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
arylstParam = new ArrayList();
arylstParam.add(new DBObject(1, 1, 12, oHrmOrgRatingMstQVO.getHeaderPrimaryKey()));
arylstParam.add(new DBObject(2, 1, 12, oHrmOrgRatingMstQVO.getRatingHeaderCode()));
arylstParam.add(new DBObject(3, 2, -5));
arylstParam.add(new DBObject(4, 2, 93));
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, "HRMORGRATING.proc_HrRatingCount(?,?,?,?,?,?,?)");
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 getHrmRatingHeaderInfo(HrmOrgRatingMstQVO oHrmOrgRatingMstQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList arylstParam = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
Timestamp oWhenPicked = null;
int count = 0;
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
ArrayList arylstHeaderList = null;
if (oHrmOrgRatingMstQVO == null)
oHrmOrgRatingMstQVO = new HrmOrgRatingMstQVO();
arylstParam = new ArrayList();
arylstParam.add(new DBObject(1, 1, -5, new Long(lStartPosition)));
arylstParam.add(new DBObject(2, 1, -5, new Long(lLastPosition)));
arylstParam.add(new DBObject(3, 1, 12, oHrmOrgRatingMstQVO.getHeaderPrimaryKey()));
arylstParam.add(new DBObject(4, 1, 12, oHrmOrgRatingMstQVO.getRatingHeaderCode()));
arylstParam.add(new DBObject(5, 2, -10));
arylstParam.add(new DBObject(6, 2, 12));
arylstParam.add(new DBObject(7, 2, 12));
arylstParam.add(new DBObject(8, 2, 4));
ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMORGRATING.proc_GetHrRatingHdrInfo(?,?,?,?,?,?,?,?)");
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();
HrmOrgRatingMstHdrBean oRatingHeader = new HrmOrgRatingMstHdrBean();
oRatingHeader.setRatingHeaderCode(oRow.get("CODE").getString());
oRatingHeader.setHeaderPrimaryKey(oRow.get("ID").getString());
oRatingHeader.setMaximumRating(oRow.get("MAX_RATING").getString());
oRatingHeader.setMinimumRating(oRow.get("MIN_RATING").getString());
oRatingHeader.setQualifyingRating(oRow.get("QUALIFYING_RATING").getString());
arylstHeaderList.add(oRatingHeader);
}
return arylstHeaderList;
}
public RecordMetaInfo getHrmRatingDtlMetaInfo(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, "HRMORGRATING.proc_HrRatingDtlCount(?,?,?,?,?,?)");
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 getHrmRatingDetailInfo(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList arylstParam = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
BaseDetailVO oBaseDetailVO = null;
ArrayList arylstHrmRatingDetail = 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, "HRMORGRATING.proc_GetHrRatingDtlInfo(?,?,?,?,?,?,?)");
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;
Iterator itrBean = arylstList.iterator();
while (itrBean.hasNext()) {
if (count == 0)
arylstHrmRatingDetail = new ArrayList();
count++;
oRow = itrBean.next();
HrmOrgRatingMstDtlBean oRatingDetailBean = new HrmOrgRatingMstDtlBean();
oRatingDetailBean.setDetailId(oRow.get("ID").getString());
oRatingDetailBean.setTxtDescription(oRow.get("DESCRIPTION").getString());
oRatingDetailBean.setTxtRatingFrom(oRow.get("RATING_FROM").getString());
oRatingDetailBean.setTxtRatingGrade(oRow.get("GRADE").getString());
oRatingDetailBean.setTxtRatingTo(oRow.get("RATING_TO").getString());
arylstHrmRatingDetail.add(oRatingDetailBean);
}
return arylstHrmRatingDetail;
}
public LovVO getHrmRatingCodeLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
LovVO oLovVO = new LovVO();
ArrayList arylstHeaderList = new ArrayList();
arylstHeaderList.add("Code ID");
arylstHeaderList.add("hrm.HrmRatingMaster.ratingHeaderCode");
arylstHeaderList.add("hrm.HrmRatingMaster.minimumRating");
arylstHeaderList.add("hrm.HrmRatingMaster.qualifyingRating");
arylstHeaderList.add("hrm.HrmRatingMaster.maximumRating");
oLovVO.setHeaderList(arylstHeaderList);
ArrayList arylstVisibility = new ArrayList();
arylstVisibility.add("H");
arylstVisibility.add("V");
arylstVisibility.add("V");
arylstVisibility.add("V");
arylstVisibility.add("V");
oLovVO.setVisibilityList(arylstVisibility);
int count = 0;
ArrayList arylstParam = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
String sQuerySearch1 = new String();
if (oLovQueryVO.getSearchField1() != null)
sQuerySearch1 = oLovQueryVO.getSearchField1();
arylstParam = new ArrayList();
arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1));
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, "HRMORGSETUPLOV.proc_GetRatingCodeLOV(?,?,?,?,?)");
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("MIN_RATING").getString());
oLOVBean.setDetailField4(oRow.get("QUALIFYING_RATING").getString());
oLOVBean.setDetailField5(oRow.get("MAX_RATING").getString());
arylstList.add(oLOVBean);
}
oLovVO.setDetailList(arylstList);
return oLovVO;
}
public void initializeBOImpl() {
this.headerTable = "HRM_RATING_HDR";
}
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
String returnString = null;
ArrayList arylstParam = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
DateUtility d = new DateUtility();
HrmOrgRatingMstHdrBean oHrmOrgRatingMstHdrBean = (HrmOrgRatingMstHdrBean)oBaseHeaderBean;
if (ScreenMode.equalsIgnoreCase("N")) {
arylstParam = new ArrayList();
arylstParam.add(new DBObject(1, 1, 12, "i"));
arylstParam.add(new DBObject(2, 1, 12, oHrmOrgRatingMstHdrBean.getRatingHeaderCode()));
arylstParam.add(new DBObject(3, 1, 12, oHrmOrgRatingMstHdrBean.getMinimumRating()));
arylstParam.add(new DBObject(4, 1, 12, oHrmOrgRatingMstHdrBean.getMaximumRating()));
arylstParam.add(new DBObject(5, 1, 12, oHrmOrgRatingMstHdrBean.getQualifyingRating()));
arylstParam.add(new DBObject(6, 1, 12, this.oUserInfo.getSiteId()));
arylstParam.add(new DBObject(7, 1, 12, this.oUserInfo.getUserTypeId()));
arylstParam.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
arylstParam.add(new DBObject(9, 1, 12, null));
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, "HRMORGRATING.proc_UpsertHrratingHdr(?,?,?,?,?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = arylstOutArray.get(0);
returnString = (String)oOutObject.getObject();
System.out.println(returnString);
} else if (ScreenMode.equalsIgnoreCase("U")) {
arylstParam = new ArrayList();
arylstParam.add(new DBObject(1, 1, 12, "u"));
arylstParam.add(new DBObject(2, 1, 12, oHrmOrgRatingMstHdrBean.getRatingHeaderCode()));
arylstParam.add(new DBObject(3, 1, 12, oHrmOrgRatingMstHdrBean.getMinimumRating()));
arylstParam.add(new DBObject(4, 1, 12, oHrmOrgRatingMstHdrBean.getMaximumRating()));
arylstParam.add(new DBObject(5, 1, 12, oHrmOrgRatingMstHdrBean.getQualifyingRating()));
arylstParam.add(new DBObject(6, 1, 12, this.oUserInfo.getSiteId()));
arylstParam.add(new DBObject(7, 1, 12, this.oUserInfo.getUserTypeId()));
arylstParam.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
arylstParam.add(new DBObject(9, 1, 12, oHrmOrgRatingMstHdrBean.getHeaderPrimaryKey()));
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, "HRMORGRATING.proc_UpsertHrratingHdr(?,?,?,?,?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = arylstOutArray.get(0);
returnString = (String)oOutObject.getObject();
System.out.println(returnString);
}
return returnString;
}
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
if (sScreenName.equalsIgnoreCase("HrmOrgRatingMst"))
saveHrmRatingDetail(sHeaderPrimaryKey, arylstDetailBeanArray);
}
private void saveHrmRatingDetail(String sHeaderPrimaryKey, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
boolean bInsert = false;
boolean bUpdate = false;
boolean bDelete = false;
ArrayList arylstParam = new ArrayList();
DBUtilitiesBean oBean = null;
DBUtilitiesBean oBean1 = null;
String sNumericEq = null;
Iterator itrBean = arylstDetailBeanArray.iterator();
while (itrBean.hasNext()) {
HrmOrgRatingMstDtlBean oHrmOrgRatingMstDtlBean = itrBean.next();
if (oHrmOrgRatingMstDtlBean.getStatus().equals("N")) {
if (!bInsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("HRMORGRATING.proc_UpsertHrRatingDtl(?,?,?,?,?,?,?,?,?,?)");
bInsert = true;
}
arylstParam = new ArrayList();
arylstParam.add(new DBObject(1, 1, 12, "I"));
arylstParam.add(new DBObject(2, 1, 12, null));
arylstParam.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
arylstParam.add(new DBObject(4, 1, 12, this.oUserInfo.getSiteId()));
arylstParam.add(new DBObject(5, 1, 12, oHrmOrgRatingMstDtlBean.getTxtRatingFrom()));
arylstParam.add(new DBObject(6, 1, 12, oHrmOrgRatingMstDtlBean.getTxtRatingTo()));
arylstParam.add(new DBObject(7, 1, 12, oHrmOrgRatingMstDtlBean.getTxtRatingGrade()));
arylstParam.add(new DBObject(8, 1, 12, oHrmOrgRatingMstDtlBean.getTxtDescription()));
arylstParam.add(new DBObject(9, 1, 12, this.oUserInfo.getUserTypeId()));
arylstParam.add(new DBObject(10, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(arylstParam);
continue;
}
if (oHrmOrgRatingMstDtlBean.getStatus().equals("U")) {
if (!bUpdate) {
oBean = new DBUtilitiesBean();
oBean.createBatch("HRMORGRATING.proc_UpsertHrRatingDtl(?,?,?,?,?,?,?,?,?,?)");
bUpdate = true;
}
arylstParam = new ArrayList();
arylstParam.add(new DBObject(1, 1, 12, "U"));
arylstParam.add(new DBObject(2, 1, 12, oHrmOrgRatingMstDtlBean.getDetailId()));
arylstParam.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
arylstParam.add(new DBObject(4, 1, 12, this.oUserInfo.getSiteId()));
arylstParam.add(new DBObject(5, 1, 12, oHrmOrgRatingMstDtlBean.getTxtRatingFrom()));
arylstParam.add(new DBObject(6, 1, 12, oHrmOrgRatingMstDtlBean.getTxtRatingTo()));
arylstParam.add(new DBObject(7, 1, 12, oHrmOrgRatingMstDtlBean.getTxtRatingGrade()));
arylstParam.add(new DBObject(8, 1, 12, oHrmOrgRatingMstDtlBean.getTxtDescription()));
arylstParam.add(new DBObject(9, 1, 12, this.oUserInfo.getUserTypeId()));
arylstParam.add(new DBObject(10, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(arylstParam);
continue;
}
if (oHrmOrgRatingMstDtlBean.getStatus().equals("D")) {
if (!bDelete) {
oBean1 = new DBUtilitiesBean();
oBean1.createBatch("HRMORGRATING.proc_DeleteRatingDtl(?)");
bDelete = true;
}
arylstParam = new ArrayList();
arylstParam.add(new DBObject(1, 1, 12, oHrmOrgRatingMstDtlBean.getDetailId()));
oBean1.addToBatch(arylstParam);
}
}
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 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((HrmOrgRatingMstHdrBean)oBaseHeaderBean);
if (bDetailDataChanged)
if (sScreenName.equalsIgnoreCase("HrmOrgRatingMst")) {
Iterator itrBean1 = arylstDetailBeanArray.iterator();
int iCount = 1;
while (itrBean1.hasNext()) {
HrmOrgRatingMstDtlBean oHrmOrgRatingMstDtlBean = itrBean1.next();
if (!oHrmOrgRatingMstDtlBean.getStatus().equalsIgnoreCase("D"))
checkMandatory(oHrmOrgRatingMstDtlBean, iCount, arylstErrorList);
iCount++;
}
}
reportError(arylstErrorList);
}
private void checkMandatory(HrmOrgRatingMstDtlBean oHrmOrgRatingMstDtlBean, int iCount, ArrayList arylstErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
if (!EnrgiseUtil.checkString(oHrmOrgRatingMstDtlBean.getTxtRatingFrom())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmRatingMaster.txtRatingFrom");
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(oHrmOrgRatingMstDtlBean.getTxtRatingTo())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmRatingMaster.txtRatingTo");
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(oHrmOrgRatingMstDtlBean.getTxtDescription())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmRatingMaster.txtDescription");
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(oHrmOrgRatingMstDtlBean.getTxtRatingGrade())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmRatingMaster.txtRatingGrade");
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(HrmOrgRatingMstHdrBean oHrmOrgRatingMstHdrBean) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oErrorList = new ArrayList();
ArrayList oParams = new ArrayList();
if (!EnrgiseUtil.checkString(oHrmOrgRatingMstHdrBean.getRatingHeaderCode())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmRatingMaster.ratingHeaderCode");
oParams = new ArrayList();
oParams.add(oMessageKey);
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
}
if (!EnrgiseUtil.checkString(oHrmOrgRatingMstHdrBean.getMinimumRating())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmRatingMaster.minimumRating");
oParams = new ArrayList();
oParams.add(oMessageKey);
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
}
if (!EnrgiseUtil.checkString(oHrmOrgRatingMstHdrBean.getMaximumRating())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmRatingMaster.maximumRating");
oParams = new ArrayList();
oParams.add(oMessageKey);
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
}
if (!EnrgiseUtil.checkString(oHrmOrgRatingMstHdrBean.getQualifyingRating())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmRatingMaster.qualifyingRating");
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();
HrmOrgRatingMstHdrBean oHrmOrgRatingMstHdrBean = (HrmOrgRatingMstHdrBean)oBaseHeaderBean;
if (bHeaderDataChanged)
if (!sScreenMode.equalsIgnoreCase("D")) {
checkUniqueHeader((HrmOrgRatingMstHdrBean)oBaseHeaderBean);
checkHeaderFields((HrmOrgRatingMstHdrBean)oBaseHeaderBean);
}
if (bDetailDataChanged)
if (!sScreenMode.equalsIgnoreCase("D"))
if (sScreenName.equalsIgnoreCase("HrmOrgRatingMst")) {
Iterator itrBean1 = arylstDetailBeanArray.iterator();
while (itrBean1.hasNext()) {
HrmOrgRatingMstDtlBean oHrmOrgRatingMstDtlBean = itrBean1.next();
if (!oHrmOrgRatingMstDtlBean.getStatus().equalsIgnoreCase("D")) {
checkRatingTo(arylstDetailBeanArray);
checkDtlFieldsConsistency(arylstDetailBeanArray);
}
}
}
reportError(arylstErrorList);
}
private void checkHeaderFields(HrmOrgRatingMstHdrBean oHrmOrgRatingMstHdrBean) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList arylstList1 = new ArrayList();
ArrayList arylstParam = new ArrayList();
int maxRating = Integer.parseInt(oHrmOrgRatingMstHdrBean.getMaximumRating());
int minRating = Integer.parseInt(oHrmOrgRatingMstHdrBean.getMinimumRating());
int qualRating = Integer.parseInt(oHrmOrgRatingMstHdrBean.getQualifyingRating());
if (maxRating < qualRating) {
arylstParam = new ArrayList();
arylstParam.add("");
arylstParam.add(new Integer(0));
arylstList1.add(new EnrgiseMessageKeyException("hrm.HrmRatingMaster.header.maxRating", arylstParam));
}
if (qualRating < minRating) {
arylstParam = new ArrayList();
arylstParam.add("");
arylstParam.add(new Integer(0));
arylstList1.add(new EnrgiseMessageKeyException("hrm.HrmRatingMaster.header.qualRating", arylstParam));
}
if (maxRating < minRating) {
arylstParam = new ArrayList();
arylstParam.add("");
arylstParam.add(new Integer(0));
arylstList1.add(new EnrgiseMessageKeyException("hrm.HrmRatingMaster.header.minRating", arylstParam));
}
reportError(arylstList1);
}
private void checkDtlFieldsConsistency(ArrayList oDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList arylstList = new ArrayList();
ArrayList arylstParam = new ArrayList();
int count = 0;
Iterator oIt = oDetailBeanArray.iterator();
int n = oDetailBeanArray.size();
if (n > 1)
while (oIt.hasNext()) {
oIt.next();
HrmOrgRatingMstDtlBean oHrmOrgRatingMstDtlBean = oDetailBeanArray.get(count);
Float fRatingTo = Float.valueOf(oHrmOrgRatingMstDtlBean.getTxtRatingTo());
if (count < n - 1) {
count++;
HrmOrgRatingMstDtlBean oHrmOrgRatingMstDtlBean1 = oDetailBeanArray.get(count);
Float fNextRatingFrom = Float.valueOf(oHrmOrgRatingMstDtlBean1.getTxtRatingFrom());
if (fNextRatingFrom.floatValue() != fRatingTo.floatValue() + (new Float("0.01")).floatValue()) {
arylstParam = new ArrayList();
arylstParam.add("");
arylstParam.add(new Integer(0));
arylstList.add(new EnrgiseMessageKeyException("hrm.HrmRatingMaster.detail.ratingFromValidation", arylstParam));
}
}
}
reportError(arylstList);
}
private void checkRatingTo(ArrayList oDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList arylstList = new ArrayList();
ArrayList arylstParam = new ArrayList();
int count = 0;
Iterator oIt = oDetailBeanArray.iterator();
int n = oDetailBeanArray.size();
while (oIt.hasNext()) {
oIt.next();
HrmOrgRatingMstDtlBean oHrmOrgRatingMstDtlBean = oDetailBeanArray.get(count);
Float fRatingTo = Float.valueOf(oHrmOrgRatingMstDtlBean.getTxtRatingTo());
Float fRatingFrom = Float.valueOf(oHrmOrgRatingMstDtlBean.getTxtRatingFrom());
if (fRatingFrom.floatValue() >= fRatingTo.floatValue()) {
arylstParam = new ArrayList();
arylstParam.add("");
arylstParam.add(new Integer(count));
arylstList.add(new EnrgiseMessageKeyException("hrm.HrmRatingMaster.detail.ratingToValidation", arylstParam));
}
count++;
}
reportError(arylstList);
}
private void checkUniqueHeader(HrmOrgRatingMstHdrBean oHrmOrgRatingMstHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList arylstList1 = new ArrayList();
ArrayList arylstParam = new ArrayList();
String sQuery = String.valueOf(String.valueOf(" Select ID as ID from HRM_RATING_HDR where CODE='").concat(String.valueOf(oHrmOrgRatingMstHdrBean.getRatingHeaderCode()))).concat(String.valueOf("'"));
System.out.println(sQuery);
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(oHrmOrgRatingMstHdrBean.getHeaderPrimaryKey())) {
arylstParam = new ArrayList();
arylstParam.add("");
arylstParam.add(new Integer(0));
arylstList1.add(new EnrgiseMessageKeyException("wenrgise.common.uniqueConstraintViolated", arylstParam));
}
}
reportError(arylstList1);
}
public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
}