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

574 lines
29 KiB
Java

package wenrgise.hrms.ejb.business;
import java.lang.reflect.Array;
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.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.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.HrmPrmExperienceDtlBean;
import wenrgise.hrms.bean.HrmPrmExperienceHdrBean;
import wenrgise.hrms.bean.HrmPrmTestScoreHdrBean;
import wenrgise.hrms.vo.HrmPrmExperienceScoreQVO;
public class HrmPrmExperienceScoreBO extends HrmBaseBO {
public HrmPrmExperienceScoreBO() {}
public HrmPrmExperienceScoreBO(UserInfo oUserinfo) {
super(oUserinfo);
}
public RecordMetaInfo getHrmPrmESDtlMetaInfo(HrmPrmExperienceScoreQVO oHrmPrmExperienceScoreQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oHrmPrmExperienceScoreQVO.getHeaderPrimaryKey()));
oParameters.add(new DBObject(2, 1, 12, oHrmPrmExperienceScoreQVO.getDesignationId()));
oParameters.add(new DBObject(3, 2, -5));
oParameters.add(new DBObject(4, 2, 93));
oParameters.add(new DBObject(5, 2, 12));
oParameters.add(new DBObject(6, 2, 12));
oParameters.add(new DBObject(7, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "HRMPRMMONEXP.proc_GetHrmPrmMonExpCount(?,?,?,?,?,?,?)");
RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo();
DBObject oTotalRecord = oOutArray.get(0);
oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue());
DBObject oTimeObject = oOutArray.get(1);
oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject());
return oRecordMetaInfo;
}
public ArrayList getHrmPrmESDtlInfo(HrmPrmExperienceScoreQVO oHrmPrmExperienceScoreQVO, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
BaseDetailVO oBaseDetailVO = null;
ArrayList oHrmPosKPAPtsDetail = null;
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, -5, new Long(lDetailFirstPosition)));
oParameters.add(new DBObject(2, 1, -5, new Long(lDetailLastPosition)));
oParameters.add(new DBObject(3, 1, 12, oHrmPrmExperienceScoreQVO.getHeaderPrimaryKey()));
oParameters.add(new DBObject(4, 1, 12, oHrmPrmExperienceScoreQVO.getDesignationId()));
oParameters.add(new DBObject(5, 2, -10));
oParameters.add(new DBObject(6, 2, 12));
oParameters.add(new DBObject(7, 2, 12));
oParameters.add(new DBObject(8, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "HRMPRMMONEXP.proc_GetHrmPrmMonExpDtls(?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
if (oList.size() == 0)
throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M");
QueryRow oRow = null;
QueryValue oValue = null;
HashMap oColumns = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
if (count == 0)
oHrmPosKPAPtsDetail = new ArrayList();
count++;
oRow = oIt.next();
HrmPrmExperienceDtlBean oHrmPrmExperienceDtlBean = new HrmPrmExperienceDtlBean();
oHrmPrmExperienceDtlBean.setDetailId(oRow.get("ID").getString());
oHrmPrmExperienceDtlBean.setStartField(oRow.get("MIN_EXPERIENCE").getString());
oHrmPrmExperienceDtlBean.setEndField(oRow.get("MAX_EXPERIENCE").getString());
oHrmPrmExperienceDtlBean.setTxtAccBasis(oRow.get("FLAT_MONTH_FLAG").getString());
oHrmPrmExperienceDtlBean.setTxtMonthsExp(oRow.get("MONTHS_EXPERIENCE").getString());
oHrmPrmExperienceDtlBean.setTxtPointsAwarded(oRow.get("POINTS_ACCUMULATED").getString());
oHrmPosKPAPtsDetail.add(oHrmPrmExperienceDtlBean);
}
return oHrmPosKPAPtsDetail;
}
public void initializeBOImpl() {
this.headerTable = "HRM_POS_MTH_EXP_DTL";
}
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {}
public void saveDetailImpl(BaseHeaderBean oBaseHeaderBean, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {
if (sScreenName.equalsIgnoreCase("HrmPrmExperienceScore"))
saveHrmESDtl(oBaseHeaderBean, oDetailBeanArray);
}
private void saveHrmESDtl(BaseHeaderBean oBaseHeaderBean, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
boolean bInsert = false;
boolean bDelete = false;
HrmPrmExperienceHdrBean oHrmPrmExperienceHdrBean = (HrmPrmExperienceHdrBean)oBaseHeaderBean;
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = null;
DBUtilitiesBean oBean1 = null;
Iterator oIt = oDetailBeanArray.iterator();
while (oIt.hasNext()) {
HrmPrmExperienceDtlBean oHrmPrmExperienceDtlBean = oIt.next();
if (oHrmPrmExperienceDtlBean.getStatus().equals("N")) {
if (!bInsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("HRMPRMMONEXP.proc_UpsertHrmPrmMonExpDtl(?,?,?,?,?,?,?,?,?,?,?,?)");
bInsert = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "N"));
oParameters.add(new DBObject(2, 1, 12, null));
oParameters.add(new DBObject(3, 1, 12, oHrmPrmExperienceDtlBean.getStartField()));
oParameters.add(new DBObject(4, 1, 12, oHrmPrmExperienceDtlBean.getEndField()));
oParameters.add(new DBObject(5, 1, 12, oHrmPrmExperienceDtlBean.getTxtAccBasis()));
oParameters.add(new DBObject(6, 1, 12, oHrmPrmExperienceDtlBean.getTxtPointsAwarded()));
oParameters.add(new DBObject(7, 1, 12, oHrmPrmExperienceDtlBean.getTxtMonthsExp()));
oParameters.add(new DBObject(8, 1, 12, oHrmPrmExperienceHdrBean.getHeaderPrimaryKey()));
oParameters.add(new DBObject(9, 1, 12, oHrmPrmExperienceHdrBean.getDesignationId()));
oParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(11, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(12, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oHrmPrmExperienceDtlBean.getStatus().equals("U")) {
if (!bInsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("HRMPRMMONEXP.proc_UpsertHrmPrmMonExpDtl(?,?,?,?,?,?,?,?,?,?,?,?)");
bInsert = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oHrmPrmExperienceDtlBean.getDetailId()));
oParameters.add(new DBObject(3, 1, 12, oHrmPrmExperienceDtlBean.getStartField()));
oParameters.add(new DBObject(4, 1, 12, oHrmPrmExperienceDtlBean.getEndField()));
oParameters.add(new DBObject(5, 1, 12, oHrmPrmExperienceDtlBean.getTxtAccBasis()));
oParameters.add(new DBObject(6, 1, 12, oHrmPrmExperienceDtlBean.getTxtPointsAwarded()));
oParameters.add(new DBObject(7, 1, 12, oHrmPrmExperienceDtlBean.getTxtMonthsExp()));
oParameters.add(new DBObject(8, 1, 12, oHrmPrmExperienceHdrBean.getHeaderPrimaryKey()));
oParameters.add(new DBObject(9, 1, 12, oHrmPrmExperienceHdrBean.getDesignationId()));
oParameters.add(new DBObject(10, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(11, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(12, 1, 12, this.oUserInfo.getSiteId()));
oBean.addToBatch(oParameters);
continue;
}
if (oHrmPrmExperienceDtlBean.getStatus().equals("D")) {
if (!bDelete) {
oBean1 = new DBUtilitiesBean();
oBean1.createBatch("HRMPRMMONEXP.proc_DeleteHrmPrmMonExpDtl(?)");
bDelete = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oHrmPrmExperienceDtlBean.getDetailId()));
oBean1.addToBatch(oParameters);
}
}
if (bInsert)
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 oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oErrorList = new ArrayList();
if (bHeaderDataChanged);
if (bDetailDataChanged)
if (sScreenName.equalsIgnoreCase("HrmPrmExperienceScore")) {
Iterator oIt1 = oDetailBeanArray.iterator();
int rowCount = 1;
while (oIt1.hasNext()) {
HrmPrmExperienceDtlBean oHrmPrmExperienceDtlBean = oIt1.next();
if (!oHrmPrmExperienceDtlBean.getStatus().equalsIgnoreCase("D")) {
checkMandatoryDtls(oHrmPrmExperienceDtlBean, rowCount);
checkforNumericfields(oHrmPrmExperienceDtlBean, rowCount);
rowCount++;
}
}
}
}
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
return null;
}
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();
if (bHeaderDataChanged);
if (bDetailDataChanged) {
if (sScreenName.equalsIgnoreCase("HrmPrmExperienceScore")) {
Iterator oIt1 = oDetailBeanArray.iterator();
exclusiveItemMatGrp(oDetailBeanArray, oErrorList);
checkPointOrder(oDetailBeanArray, oErrorList);
int rowcount = 1;
while (oIt1.hasNext()) {
HrmPrmExperienceDtlBean oHrmPrmExperienceDtlBean = oIt1.next();
if (!oHrmPrmExperienceDtlBean.getStatus().equalsIgnoreCase("D")) {
if (EnrgiseUtil.checkString(oHrmPrmExperienceDtlBean.getTxtMonthsExp()))
checkMonExp(oHrmPrmExperienceDtlBean, rowcount);
checkScoreValue(oHrmPrmExperienceDtlBean, rowcount);
}
rowcount++;
}
}
reportError(oErrorList);
}
}
public LovVO getClassDataLOV(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
QueryRow oRow = null;
LovVO oLovVO = new LovVO();
ArrayList oList = null;
Iterator oIt = null;
String code = oLovQueryVO.getProperty("code");
String sQuery = "Select clsd.ID, clsd.NAME from HRM_CLASS_DTL clsd, HRM_CLASS_MST clsm where clsd.CLS_MST_ID = clsm.ID and clsm.CODE =";
sQuery = String.valueOf(sQuery).concat(String.valueOf(code));
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField2()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" And upper(clsd.NAME) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField2()))).concat(String.valueOf("%') "));
oBean = new DBUtilitiesBean();
oList = new ArrayList();
oList = oBean.executeQuery(sQuery);
oIt = oList.iterator();
ArrayList oHeaderList = new ArrayList();
oHeaderList.add("");
oHeaderList.add("hrm.HrmAdvertiesmentMaintenance.description");
oLovVO.setHeaderList(oHeaderList);
ArrayList arylstVisibility = new ArrayList();
arylstVisibility.add("H");
arylstVisibility.add("V");
oLovVO.setVisibilityList(arylstVisibility);
while (oIt.hasNext()) {
if (count == 0)
oList = new ArrayList();
count++;
oRow = oIt.next();
LOVBean oLOVBean = new LOVBean();
oLOVBean.setDetailField1(oRow.get("ID").getString());
oLOVBean.setDetailField2(oRow.get("NAME").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
public LovVO getRefNoLOV(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
QueryRow oRow = null;
LovVO oLovVO = new LovVO();
ArrayList oList = null;
Iterator oIt = null;
String sQuery = "select distinct advh.id,advh.ref_no from hrm_advt_hdr advh where 1=1";
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(advh.ref_no) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') "));
oBean = new DBUtilitiesBean();
oList = new ArrayList();
oList = oBean.executeQuery(sQuery);
oIt = oList.iterator();
ArrayList oHeaderList = new ArrayList();
oHeaderList.add("");
oHeaderList.add("hrm.HrmAdvertiesmentMaintenance.referenceNo");
oLovVO.setHeaderList(oHeaderList);
ArrayList arylstVisibility = new ArrayList();
arylstVisibility.add("H");
arylstVisibility.add("V");
oLovVO.setVisibilityList(arylstVisibility);
while (oIt.hasNext()) {
if (count == 0)
oList = new ArrayList();
count++;
oRow = oIt.next();
LOVBean oLOVBean = new LOVBean();
oLOVBean.setDetailField1(oRow.get("ID").getString());
oLOVBean.setDetailField2(oRow.get("ref_no").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
public LovVO getPositionCodeLOV(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
QueryRow oRow = null;
LovVO oLovVO = new LovVO();
ArrayList oList = null;
Iterator oIt = null;
String sQuery = "SELECT A.ID, A.DESCRIPTION, B.ID as desigid, B.name as PositionDesc FROM HRM_POS_INF_HDR A, HRM_CLASS_DTL B WHERE A.DESIGNATION_ID=B.ID(+)";
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(DESCRIPTION) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') "));
oBean = new DBUtilitiesBean();
oList = new ArrayList();
oList = oBean.executeQuery(sQuery);
oIt = oList.iterator();
ArrayList oHeaderList = new ArrayList();
oHeaderList.add("");
oHeaderList.add("hrm.HrmAdvertiesmentMaintenance.forPosition");
oHeaderList.add("");
oHeaderList.add("hrm.HrmAdvertiesmentMaintenance.description");
oLovVO.setHeaderList(oHeaderList);
ArrayList arylstVisibility = new ArrayList();
arylstVisibility.add("H");
arylstVisibility.add("V");
arylstVisibility.add("H");
arylstVisibility.add("V");
oLovVO.setVisibilityList(arylstVisibility);
while (oIt.hasNext()) {
if (count == 0)
oList = new ArrayList();
count++;
oRow = oIt.next();
LOVBean oLOVBean = new LOVBean();
oLOVBean.setDetailField1(oRow.get("ID").getString());
oLOVBean.setDetailField2(oRow.get("DESCRIPTION").getString());
oLOVBean.setDetailField3(oRow.get("desigid").getString());
oLOVBean.setDetailField4(oRow.get("PositionDesc").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
private void checkMandatoryHeader(HrmPrmTestScoreHdrBean oHrmPrmTestScoreHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {}
private void checkMandatoryDtls(HrmPrmExperienceDtlBean oHrmPrmExperienceDtlBean, int rowCount) throws EnrgiseSystemException, EnrgiseApplicationException {
ArrayList oErrorList = new ArrayList();
if (!EnrgiseUtil.checkString(oHrmPrmExperienceDtlBean.getTxtAccBasis())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmExperienceScore.txtAccBasis");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oHrmPrmExperienceDtlBean.getStartField())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmExperienceScore.txtMinExp");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oHrmPrmExperienceDtlBean.getEndField())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmExperienceScore.txtMaxExp");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oHrmPrmExperienceDtlBean.getTxtMonthsExp()) && oHrmPrmExperienceDtlBean.getTxtAccBasis().equalsIgnoreCase("M")) {
MessageKey oMessageKey = new MessageKey("hrm.HrmExperienceScore.txtMonthsExp");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParam, "E"));
}
if (!EnrgiseUtil.checkString(oHrmPrmExperienceDtlBean.getTxtPointsAwarded())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmExperienceScore.txtPointsAwarded");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParam, "E"));
}
reportError(oErrorList);
}
private void checkUniqueHeader(HrmPrmTestScoreHdrBean oHrmPrmTestScoreHdrBean) throws EnrgiseApplicationException, EnrgiseSystemException {}
private void exclusiveItemMatGrp(ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
String[] sArgs = (String[])Array.newInstance(Class.forName("java.lang.String"), 2);
sArgs[0] = "startField";
sArgs[1] = "endField";
Iterator oIt1 = oDetailBeanArray.iterator();
EnrgiseUtil.checkDuplicate(oDetailBeanArray, sArgs, "hrm.HrmExperienceScore.detail.exclusive", oErrorList);
}
private void checkMonExp(HrmPrmExperienceDtlBean oHrmPrmExperienceDtlBean, int rowCount) throws EnrgiseApplicationException, EnrgiseSystemException {
if (Double.parseDouble(oHrmPrmExperienceDtlBean.getEndField()) < Double.parseDouble(oHrmPrmExperienceDtlBean.getTxtMonthsExp()) || Double.parseDouble(oHrmPrmExperienceDtlBean.getStartField()) > Double.parseDouble(oHrmPrmExperienceDtlBean.getTxtMonthsExp())) {
ArrayList oParam = new ArrayList();
oParam.add(new Integer(rowCount));
throw new EnrgiseApplicationException("hrm.HrmExperienceScore.errorinmonths", oParam, "E");
}
}
public LovVO getESPositionCodeLOVQuery(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
QueryRow oRow = null;
LovVO oLovVO = new LovVO();
ArrayList oList = null;
Iterator oIt = null;
String sQuery = "Select distinct a.ID, a.CODE, a.Description, b.NAME as designation, c.NAME as scale From HRM_POS_INF_HDR a, HRM_CLASS_DTL b, HRM_CLASS_DTL c, HRM_POS_MTH_EXP_DTL d ";
sQuery = String.valueOf(sQuery).concat(String.valueOf(" WHERE a.DESIGNATION_ID = b.ID(+) and a.SCALE_ID = c.id(+) And d.POS_INF_HDr_ID = a.ID "));
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(a.CODE) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') "));
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField2()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(a.Description) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField2()))).concat(String.valueOf("%') "));
oBean = new DBUtilitiesBean();
oList = new ArrayList();
oList = oBean.executeQuery(sQuery);
oIt = oList.iterator();
ArrayList oHeaderList = new ArrayList();
oHeaderList.add("");
oHeaderList.add("hrm.HrmTestScore.positionCode");
oHeaderList.add("hrm.HrmTestScore.desc");
oHeaderList.add("hrm.HrmTestScore.designation");
oHeaderList.add("hrm.HrmTestScore.scale");
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);
while (oIt.hasNext()) {
if (count == 0)
oList = new ArrayList();
count++;
oRow = oIt.next();
LOVBean oLOVBean = new LOVBean();
oLOVBean.setDetailField1(oRow.get("id").getString());
oLOVBean.setDetailField2(oRow.get("CODE").getString());
oLOVBean.setDetailField3(oRow.get("Description").getString());
oLOVBean.setDetailField4(oRow.get("designation").getString());
oLOVBean.setDetailField5(oRow.get("scale").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
public LovVO getESPositionCodeLOVNew(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
QueryRow oRow = null;
LovVO oLovVO = new LovVO();
ArrayList oList = null;
Iterator oIt = null;
String sQuery = "Select distinct posHdr.ID,posHdr.CODE, posHdr.Description,desigDtl.NAME as designation,scaleDtl.NAME as scale from HRM_POS_INF_HDR posHdr, HRM_CLASS_DTL desigDtl, HRM_CLASS_DTL scaleDtl ";
sQuery = String.valueOf(sQuery).concat(String.valueOf(" WHERE posHdr.DESIGNATION_ID = desigDtl.ID(+) and posHdr.scale_id = scaleDtl.id(+) and posHdr.id not in(select distinct pos_inf_hdr_id from HRM_POS_MTH_EXP_DTL) "));
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField1()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(a.CODE) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') "));
if (EnrgiseUtil.checkString(oLovQueryVO.getSearchField2()))
sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" and upper(a.Description) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField2()))).concat(String.valueOf("%') "));
oBean = new DBUtilitiesBean();
oList = new ArrayList();
oList = oBean.executeQuery(sQuery);
oIt = oList.iterator();
ArrayList oHeaderList = new ArrayList();
oHeaderList.add("");
oHeaderList.add("hrm.HrmExperienceScore.positionCode");
oHeaderList.add("hrm.HrmExperienceScore.desc");
oHeaderList.add("hrm.HrmExperienceScore.designation");
oHeaderList.add("hrm.HrmExperienceScore.scale");
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);
while (oIt.hasNext()) {
if (count == 0)
oList = new ArrayList();
count++;
oRow = oIt.next();
LOVBean oLOVBean = new LOVBean();
oLOVBean.setDetailField1(oRow.get("id").getString());
oLOVBean.setDetailField2(oRow.get("code").getString());
oLOVBean.setDetailField3(oRow.get("Description").getString());
oLOVBean.setDetailField4(oRow.get("designation").getString());
oLOVBean.setDetailField5(oRow.get("scale").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
private void checkforNumericfields(HrmPrmExperienceDtlBean oHrmPrmExperienceDtlBean, int rowCount) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oErrList = new ArrayList();
if (!EnrgiseUtil.checkNumber(oHrmPrmExperienceDtlBean.getStartField(), 3, 0, "P")) {
MessageKey oMessageKey = new MessageKey("hrm.HrmExperienceScore.txtMinExp");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrList.add(new EnrgiseMessageKeyException("hrm.HrmTestScore.detail.nonnumeric", oParam));
}
if (!EnrgiseUtil.checkNumber(oHrmPrmExperienceDtlBean.getEndField(), 3, 0, "P")) {
MessageKey oMessageKey = new MessageKey("hrm.HrmExperienceScore.txtMaxExp");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrList.add(new EnrgiseMessageKeyException("hrm.HrmTestScore.detail.nonnumeric", oParam));
}
if (!EnrgiseUtil.checkNumber(oHrmPrmExperienceDtlBean.getTxtMonthsExp(), 3, 0, "P")) {
MessageKey oMessageKey = new MessageKey("hrm.HrmExperienceScore.txtMonthsExp");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrList.add(new EnrgiseMessageKeyException("hrm.HrmTestScore.detail.nonnumeric", oParam));
}
if (!EnrgiseUtil.checkNumber(oHrmPrmExperienceDtlBean.getTxtPointsAwarded(), 3, 2, "P")) {
MessageKey oMessageKey = new MessageKey("hrm.HrmExperienceScore.txtPointsAwarded");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(rowCount));
oErrList.add(new EnrgiseMessageKeyException("hrm.HrmTestScore.detail.nonnumeric", oParam));
}
reportError(oErrList);
}
private void checkScoreValue(HrmPrmExperienceDtlBean oHrmPrmExperienceDtlBean, int rowCount) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oErrList = new ArrayList();
if (EnrgiseUtil.checkString(oHrmPrmExperienceDtlBean.getStartField()) && EnrgiseUtil.checkString(oHrmPrmExperienceDtlBean.getEndField()))
if (Double.parseDouble(oHrmPrmExperienceDtlBean.getStartField()) >= Double.parseDouble(oHrmPrmExperienceDtlBean.getEndField())) {
ArrayList oParam = new ArrayList();
oParam.add(new Integer(rowCount));
throw new EnrgiseApplicationException("hrm.HrmExperienceScore.errorinscore", oParam, "E");
}
reportError(oErrList);
}
private void checkPointOrder(ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
Iterator oIt = oDetailBeanArray.iterator();
int i = 1;
while (oIt.hasNext()) {
int rowCount = 1;
HrmPrmExperienceDtlBean oHrmPrmExperienceDtlBean = oIt.next();
if (i != 1) {
Iterator oIt1 = oDetailBeanArray.iterator();
while (oIt1.hasNext()) {
HrmPrmExperienceDtlBean oHrmPrmExperienceDtlBean1 = oIt1.next();
if (Double.parseDouble(oHrmPrmExperienceDtlBean.getStartField()) > Double.parseDouble(oHrmPrmExperienceDtlBean1.getStartField()) && Double.parseDouble(oHrmPrmExperienceDtlBean.getTxtPointsAwarded()) < Double.parseDouble(oHrmPrmExperienceDtlBean1.getTxtPointsAwarded())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmExperienceScore.txtPointsAwarded");
ArrayList oParam = new ArrayList();
oParam.add(oMessageKey);
oParam.add(new Integer(i));
throw new EnrgiseApplicationException("hrm.HrmExperienceScore.errorinPoints", oParam, "E");
}
rowCount++;
}
}
i++;
}
}
}