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

522 lines
25 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.EnrgiseUtil;
import wenrgise.common.utility.MessageKey;
import wenrgise.common.utility.RecordMetaInfo;
import wenrgise.common.utility.UserInfo;
import wenrgise.common.vo.BaseHeaderVO;
import wenrgise.common.vo.LovQueryVO;
import wenrgise.common.vo.LovVO;
import wenrgise.ejb.common.helper.DBObject;
import wenrgise.ejb.common.helper.QueryRow;
import wenrgise.ejb.common.utility.DBUtilitiesBean;
import wenrgise.hrms.bean.HrmAppraisalKPADtlBean;
import wenrgise.hrms.bean.HrmAppraisalKPAHdrBean;
import wenrgise.hrms.vo.HrmAppraisalKPAQVO;
public class HrmApprisalKPABO extends HrmBaseBO {
public HrmApprisalKPABO() {}
public void initializeBOImpl() {
this.headerTable = "HRM_APRSL_KPA_HDR";
}
public HrmApprisalKPABO(UserInfo oUserInfo) {
super(oUserInfo);
}
public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {}
public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
if (sScreenName.equals("HrmAppraisalKPA"))
ApprisalKpaDetails(sHeaderPrimaryKey, oDetailBeanArray);
}
public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
return null;
}
public RecordMetaInfo getHrmAppRaisalKpaHeaderMetaInfo(HrmAppraisalKPAQVO oHrmAppraisalKPAQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
Timestamp oWhenPicked = null;
int count = 0;
BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oHrmAppraisalKPAQVO.getHeaderPrimaryKey()));
oParameters.add(new DBObject(2, 1, 12, oHrmAppraisalKPAQVO.getKpaGroupCode()));
oParameters.add(new DBObject(3, 1, 12, oHrmAppraisalKPAQVO.getDescription()));
oParameters.add(new DBObject(4, 2, -5));
oParameters.add(new DBObject(5, 2, 93));
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, "HRMAPPRISALKPA.proc_HrPerAppKPAHdrCount(?,?,?,?,?,?,?,?)");
RecordMetaInfo oRecordMetaInfo = new RecordMetaInfo();
DBObject oTimeObject = oOutArray.get(1);
oRecordMetaInfo.setOWhenPicked((Timestamp)oTimeObject.getObject());
DBObject oTotalRecord = oOutArray.get(0);
oRecordMetaInfo.setRecordCount(((Long)oTotalRecord.getObject()).longValue());
return oRecordMetaInfo;
}
public ArrayList getHrmAppRaisalKpaHeader(HrmAppraisalKPAQVO oHrmAppraisalKPAQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
int count = 0;
if (oHrmAppraisalKPAQVO == null)
oHrmAppraisalKPAQVO = new HrmAppraisalKPAQVO();
ArrayList oHeaderList = null;
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, -5, new Long(lStartPosition)));
oParameters.add(new DBObject(2, 1, -5, new Long(lLastPosition)));
oParameters.add(new DBObject(3, 1, 12, oHrmAppraisalKPAQVO.getHeaderPrimaryKey()));
oParameters.add(new DBObject(4, 1, 12, oHrmAppraisalKPAQVO.getKpaGroupCode()));
oParameters.add(new DBObject(5, 1, 12, oHrmAppraisalKPAQVO.getDescription()));
oParameters.add(new DBObject(6, 2, -10));
oParameters.add(new DBObject(7, 2, 12));
oParameters.add(new DBObject(8, 2, 12));
oParameters.add(new DBObject(9, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "HRMAPPRISALKPA.proc_GetHrPerAppKPAHdr(?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
if (oList.size() == 0)
throw new EnrgiseApplicationException("wenrgise.common.norecordfound", "M");
count = 0;
QueryRow oRow = null;
HashMap oColumns = null;
Iterator oIt = oList.iterator();
while (oIt.hasNext()) {
if (count == 0)
oHeaderList = new ArrayList();
count++;
oRow = oIt.next();
HrmAppraisalKPAHdrBean oHrmAppraisalKPAHdrBean = new HrmAppraisalKPAHdrBean();
oHrmAppraisalKPAHdrBean.setHeaderPrimaryKey(oRow.get("ID").getString());
oHrmAppraisalKPAHdrBean.setKpaGroupCode(oRow.get("CODE").getString());
oHrmAppraisalKPAHdrBean.setDescription(oRow.get("DESCRIPTION").getString());
if (EnrgiseUtil.checkString(oRow.get("HEADER_FLAG").getString()))
if (oRow.get("HEADER_FLAG").getString().equalsIgnoreCase("F"))
oHrmAppraisalKPAHdrBean.setStatusOfHeader("Freezed");
oHrmAppraisalKPAHdrBean.setRatingRequired(String.valueOf(oRow.get("RATING_REQUIRED").getString()).equalsIgnoreCase("Y") ? "on" : "off");
oHrmAppraisalKPAHdrBean.setTxtAppraiserType(oRow.get("APPRAISER_TYPE").getString());
oHeaderList.add(oHrmAppraisalKPAHdrBean);
}
return oHeaderList;
}
public RecordMetaInfo getHrmAppRaisalKpaDetailMetaInfo(String sPrimaryKey) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, sPrimaryKey));
oParameters.add(new DBObject(2, 2, -5));
oParameters.add(new DBObject(3, 2, 93));
oParameters.add(new DBObject(4, 2, 12));
oParameters.add(new DBObject(5, 2, 12));
oParameters.add(new DBObject(6, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "HRMAPPRISALKPA.proc_HrPerAppKPADtlCount(?,?,?,?,?,?)");
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());
System.out.println(oRecordMetaInfo);
return oRecordMetaInfo;
}
public ArrayList getHrmAppRaisalKpaDetail(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
QueryRow oRow = null;
ArrayList oList = null;
Iterator oIt = null;
ArrayList oAppKpaDetail = null;
int count = 0;
oParameters.add(new DBObject(1, 1, 12, new Long(lDetailFirstPosition)));
oParameters.add(new DBObject(2, 1, -5, new Long(lDetailLastPosition)));
oParameters.add(new DBObject(3, 1, 12, lPrimaryKey));
oParameters.add(new DBObject(4, 2, -10));
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, "HRMAPPRISALKPA.proc_GetHrPerAppKPADtl(?,?,?,?,?,?,?)");
oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
if (oList.size() == 0)
throw new EnrgiseApplicationException("wenrgise.common.norecordfound", "M");
count = 0;
oIt = oList.iterator();
while (oIt.hasNext()) {
if (count == 0)
oAppKpaDetail = new ArrayList();
count++;
oRow = oIt.next();
HrmAppraisalKPADtlBean oHrmAppraisalKPADtlBean = new HrmAppraisalKPADtlBean();
oHrmAppraisalKPADtlBean.setDetailId(oRow.get("ID").getString());
oHrmAppraisalKPADtlBean.setTxtSrlNo(oRow.get("SRL_NO").getString());
oHrmAppraisalKPADtlBean.setTxtKpaCode(oRow.get("CODE").getString());
oHrmAppraisalKPADtlBean.setTxtDescription(oRow.get("DESCRIPTION").getString());
oHrmAppraisalKPADtlBean.setMandatoryFlag(String.valueOf(oRow.get("MANDATORY_FLAG").getString()).equalsIgnoreCase("Y") ? "on" : "off");
oHrmAppraisalKPADtlBean.setTxtWeightage(oRow.get("WEIGHTAGE").getString());
oHrmAppraisalKPADtlBean.setStatus("Q");
oAppKpaDetail.add(oHrmAppraisalKPADtlBean);
}
return oAppKpaDetail;
}
public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String sScreenMode) throws EnrgiseSystemException {
String returnString = null;
DBUtilitiesBean oBean = new DBUtilitiesBean();
ArrayList oParameters = new ArrayList();
HrmAppraisalKPAHdrBean oHrmAppraisalKPAHdrBean = (HrmAppraisalKPAHdrBean)oBaseHeaderBean;
String sRatingRequired = String.valueOf(oHrmAppraisalKPAHdrBean.getRatingRequired()).equalsIgnoreCase("on") ? "Y" : "N";
if (sScreenMode.equalsIgnoreCase("N")) {
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, new String(oHrmAppraisalKPAHdrBean.getKpaGroupCode())));
oParameters.add(new DBObject(4, 1, 12, new String(oHrmAppraisalKPAHdrBean.getDescription())));
oParameters.add(new DBObject(5, 1, 12, new String(oHrmAppraisalKPAHdrBean.getTxtAppraiserType())));
oParameters.add(new DBObject(6, 1, 12, sRatingRequired));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(9, 2, 12, oHrmAppraisalKPAHdrBean.getHeaderPrimaryKey()));
oParameters.add(new DBObject(10, 2, 12));
oParameters.add(new DBObject(11, 2, 12));
oParameters.add(new DBObject(12, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "HRMAPPRISALKPA.proc_UpsertHrAppKPAHdr(?,?,?,?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
returnString = (String)oOutObject.getObject();
} else if (sScreenMode.equalsIgnoreCase("U")) {
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oHrmAppraisalKPAHdrBean.getHeaderPrimaryKey()));
oParameters.add(new DBObject(3, 1, 12, new String(oHrmAppraisalKPAHdrBean.getKpaGroupCode())));
oParameters.add(new DBObject(4, 1, 12, new String(oHrmAppraisalKPAHdrBean.getDescription())));
oParameters.add(new DBObject(5, 1, 12, new String(oHrmAppraisalKPAHdrBean.getTxtAppraiserType())));
oParameters.add(new DBObject(6, 1, 12, sRatingRequired));
oParameters.add(new DBObject(7, 1, 12, this.oUserInfo.getUserId()));
oParameters.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
oParameters.add(new DBObject(9, 2, 12, oHrmAppraisalKPAHdrBean.getHeaderPrimaryKey()));
oParameters.add(new DBObject(10, 2, 12));
oParameters.add(new DBObject(11, 2, 12));
oParameters.add(new DBObject(12, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "HRMAPPRISALKPA.proc_UpsertHrAppKPAHdr(?,?,?,?,?,?,?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
returnString = (String)oOutObject.getObject();
} else if (sScreenMode.equalsIgnoreCase("D")) {
}
return returnString;
}
private void ApprisalKpaDetails(String sPrimaryKey, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
boolean bInsert = false;
boolean bDelete = false;
boolean bUpdate = false;
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = null;
DBUtilitiesBean oBean1 = null;
Iterator oIt = oDetailBeanArray.iterator();
while (oIt.hasNext()) {
HrmAppraisalKPADtlBean oHrmAppraisalKPADtlBean = oIt.next();
String sMandatoryFlag = String.valueOf(oHrmAppraisalKPADtlBean.getMandatoryFlag()).equalsIgnoreCase("on") ? "Y" : "N";
if (oHrmAppraisalKPADtlBean.getStatus().equals("N")) {
if (!bInsert) {
oBean = new DBUtilitiesBean();
oBean.createBatch("HRMAPPRISALKPA.proc_UpsertHrAppKPADtl(?,?,?,?,?,?,?,?,?,?)");
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, sPrimaryKey));
oParameters.add(new DBObject(4, 1, 12, oHrmAppraisalKPADtlBean.getTxtKpaCode()));
oParameters.add(new DBObject(5, 1, 12, oHrmAppraisalKPADtlBean.getTxtDescription()));
oParameters.add(new DBObject(6, 1, 12, oHrmAppraisalKPADtlBean.getTxtSrlNo()));
oParameters.add(new DBObject(7, 1, 12, sMandatoryFlag));
oParameters.add(new DBObject(8, 1, 12, oHrmAppraisalKPADtlBean.getTxtWeightage()));
oParameters.add(new DBObject(9, 1, 12, "200"));
oParameters.add(new DBObject(10, 1, 12, "200"));
oBean.addToBatch(oParameters);
continue;
}
if (oHrmAppraisalKPADtlBean.getStatus().equals("U")) {
if (!bUpdate) {
oBean = new DBUtilitiesBean();
oBean.createBatch("HRMAPPRISALKPA.proc_UpsertHrAppKPADtl(?,?,?,?,?,?,?,?,?,?)");
bUpdate = true;
}
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, "U"));
oParameters.add(new DBObject(2, 1, 12, oHrmAppraisalKPADtlBean.getDetailId()));
oParameters.add(new DBObject(3, 1, 12, sPrimaryKey));
oParameters.add(new DBObject(4, 1, 12, oHrmAppraisalKPADtlBean.getTxtKpaCode()));
oParameters.add(new DBObject(5, 1, 12, oHrmAppraisalKPADtlBean.getTxtDescription()));
oParameters.add(new DBObject(6, 1, 12, oHrmAppraisalKPADtlBean.getTxtSrlNo()));
oParameters.add(new DBObject(7, 1, 12, sMandatoryFlag));
oParameters.add(new DBObject(8, 1, 12, oHrmAppraisalKPADtlBean.getTxtWeightage()));
oParameters.add(new DBObject(9, 1, 12, "200"));
oParameters.add(new DBObject(10, 1, 12, "200"));
oBean.addToBatch(oParameters);
continue;
}
if (oHrmAppraisalKPADtlBean.getStatus().equals("D"));
}
if (bUpdate)
oBean.executeBatch();
if (bDelete)
oBean1.executeBatch();
if (bInsert)
oBean.executeBatch();
}
public LovVO getQueryAppraisalWorkGrpLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
LovVO oLovVO = new LovVO();
ArrayList arylstHeaderNames = new ArrayList();
arylstHeaderNames.add("kpaGrpId");
arylstHeaderNames.add("hrm.HrmHrmAppraisalKPA.kpaGroupCode");
arylstHeaderNames.add("hrm.HrmHrmAppraisalKPA.description");
oLovVO.setHeaderList(arylstHeaderNames);
ArrayList arylstVisibility = new ArrayList();
arylstVisibility.add("H");
arylstVisibility.add("V");
arylstVisibility.add("V");
oLovVO.setVisibilityList(arylstVisibility);
int count = 0;
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, oLovQueryVO.getSearchField1()));
oParameters.add(new DBObject(2, 1, 12, oLovQueryVO.getSearchField2()));
oParameters.add(new DBObject(3, 2, -10));
oParameters.add(new DBObject(4, 2, 12));
oParameters.add(new DBObject(5, 2, 12));
oParameters.add(new DBObject(6, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "HRMAPRSLLOV.proc_GetApprKPAGrpCodeLOV(?,?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
QueryRow oRow = null;
Iterator iter = oList.iterator();
while (iter.hasNext()) {
if (count == 0)
oList = 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("DESCRIPTION").getString());
oList.add(oLOVBean);
}
oLovVO.setDetailList(oList);
return oLovVO;
}
public String checkWeightageValidation(String sHeaderPrimKey) throws EnrgiseSystemException, EnrgiseApplicationException {
int count = 0;
String sId = "";
String sWtg = "";
String sNWtg = "";
String sCnt = "";
String sCode = "";
long lWeightage = 0L;
long lCount = 0L;
boolean flag = true;
ArrayList oErrorList = new ArrayList();
ArrayList oParameters = new ArrayList();
DBUtilitiesBean oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, sHeaderPrimKey));
oParameters.add(new DBObject(2, 2, -10));
oParameters.add(new DBObject(3, 2, 12));
oParameters.add(new DBObject(4, 2, 12));
oParameters.add(new DBObject(5, 2, 4));
ArrayList oOutArray = oBean.callProc(oParameters, "HRMAPPRISALKPA.proc_ProperWtg(?,?,?,?,?)");
DBObject oOutObject = oOutArray.get(0);
ArrayList oList = (ArrayList)oOutObject.getObject();
QueryRow oRow = null;
Iterator iter = oList.iterator();
while (iter.hasNext()) {
if (count == 0)
oList = new ArrayList();
count++;
oRow = iter.next();
sWtg = oRow.get("totWtg").getString();
sCnt = oRow.get("totCnt").getString();
lWeightage = Long.parseLong(sWtg);
lCount = Long.parseLong(sCnt);
ArrayList arylstDetailList = new ArrayList();
arylstDetailList = getHrmAppRaisalKpaDetail(sHeaderPrimKey, 1L, getHrmAppRaisalKpaDetailMetaInfo(sHeaderPrimKey).getRecordCount());
if (lWeightage != 0L)
if (checkifEmpty(arylstDetailList) && checkTotalSum(arylstDetailList)) {
flag = true;
} else {
flag = false;
}
if (lWeightage == 0L) {
lWeightage = 100L / lCount;
sWtg = String.valueOf(lWeightage);
oParameters = new ArrayList();
oBean = new DBUtilitiesBean();
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, sWtg));
oParameters.add(new DBObject(2, 1, 12, sHeaderPrimKey));
oParameters.add(new DBObject(3, 2, 12));
oParameters.add(new DBObject(4, 2, 12));
oParameters.add(new DBObject(5, 2, 4));
oOutArray = oBean.callProc(oParameters, "HRMAPPRISALKPA.proc_UpdateWtg(?,?,?,?,?)");
}
if (flag) {
oParameters = new ArrayList();
oParameters.add(new DBObject(1, 1, 12, sHeaderPrimKey));
oParameters.add(new DBObject(2, 2, 12));
oParameters.add(new DBObject(3, 2, 12));
oParameters.add(new DBObject(4, 2, 4));
oOutArray = oBean.callProc(oParameters, "HRMAPPRISALKPA.proc_updateStatus(?,?,?,?)");
}
}
return sHeaderPrimKey;
}
private boolean checkTotalSum(ArrayList oDetailList) throws EnrgiseSystemException, EnrgiseApplicationException {
boolean flag = true;
HrmAppraisalKPADtlBean oHrmAppraisalKPADtlBean = null;
int iKpa = 0;
Iterator oIt1 = oDetailList.iterator();
ArrayList oErrorList = new ArrayList();
while (oIt1.hasNext()) {
oHrmAppraisalKPADtlBean = oIt1.next();
if (!oHrmAppraisalKPADtlBean.getStatus().equalsIgnoreCase("N"))
if (EnrgiseUtil.checkString(oHrmAppraisalKPADtlBean.getTxtWeightage()))
iKpa += Integer.parseInt(oHrmAppraisalKPADtlBean.getTxtWeightage());
}
if (iKpa != 100) {
flag = false;
ArrayList oParams = new ArrayList();
oParams.add("");
oParams.add(new Integer(0));
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.hrms.aprsl.wt.value", oParams));
}
reportError(oErrorList);
return flag;
}
private boolean checkifEmpty(ArrayList oDetailList) throws EnrgiseSystemException, EnrgiseApplicationException {
boolean flag = true;
Iterator itiDetailList = oDetailList.iterator();
ArrayList oErrorList = new ArrayList();
int rowCount = 1;
while (itiDetailList.hasNext()) {
HrmAppraisalKPADtlBean oBean = itiDetailList.next();
if (!EnrgiseUtil.checkString(oBean.getTxtWeightage())) {
flag = false;
ArrayList oParams = new ArrayList();
oParams.add(new Integer(rowCount));
oErrorList.add(new EnrgiseMessageKeyException("hrms.hrmapp.kpa.wt", oParams, "E"));
}
rowCount++;
}
reportError(oErrorList);
return flag;
}
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();
checkMandatoryHdr((HrmAppraisalKPAHdrBean)oBaseHeaderBean, arylstErrorList);
if (bDetailDataChanged)
if (sScreenName.equalsIgnoreCase("HrmAppraisalKPA")) {
Iterator itrBean1 = arylstDetailBeanArray.iterator();
int iCount = 1;
while (itrBean1.hasNext()) {
HrmAppraisalKPADtlBean oHrmAppraisalKPADtlBean = itrBean1.next();
if (!oHrmAppraisalKPADtlBean.getStatus().equalsIgnoreCase("D"))
checkMandatoryDtl(oHrmAppraisalKPADtlBean, iCount, arylstErrorList);
iCount++;
}
}
reportError(arylstErrorList);
}
public void additionalTimestampValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {}
public void additionalBusinessValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
int iKPAWt = 0;
ArrayList oList = new ArrayList();
if (bDetailDataChanged);
if (bDetailDataChanged)
if (sScreenName.equalsIgnoreCase("HrmAppraisalKPA")) {
EnrgiseUtil.checkDuplicate(oDetailBeanArray, "txtSrlNo", "hrm.HrmAppraisalKPA.srlNo", oList, true);
EnrgiseUtil.checkDuplicate(oDetailBeanArray, "txtKpaCode", "hrm.HrmAppraisalKPA.sectionCode", oList, true);
HrmAppraisalKPADtlBean oHrmAppraisalKPADtlBean = null;
float iKpa = 0.0F;
Iterator oIt1 = oDetailBeanArray.iterator();
while (oIt1.hasNext()) {
oHrmAppraisalKPADtlBean = oIt1.next();
if (!oHrmAppraisalKPADtlBean.getStatus().equalsIgnoreCase("N"))
if (EnrgiseUtil.checkString(oHrmAppraisalKPADtlBean.getTxtWeightage())) {
iKpa += Float.parseFloat(oHrmAppraisalKPADtlBean.getTxtWeightage());
if (iKpa > 100)
oList.add(new EnrgiseApplicationException("wenrgise.hrms.aprsl.wt.value"));
}
if (oHrmAppraisalKPADtlBean.getStatus().equalsIgnoreCase("N"))
if (EnrgiseUtil.checkString(oHrmAppraisalKPADtlBean.getTxtWeightage())) {
iKpa += Float.parseFloat(oHrmAppraisalKPADtlBean.getTxtWeightage());
if (iKpa > 100)
oList.add(new EnrgiseApplicationException("wenrgise.hrms.aprsl.wt.value"));
}
}
}
reportError(oList);
}
private void checkMandatoryHdr(HrmAppraisalKPAHdrBean oHrmAppraisalKPAHdrBean, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
if (!EnrgiseUtil.checkString(oHrmAppraisalKPAHdrBean.getKpaGroupCode())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmHrmAppraisalKPA.kpaGroupCode");
ArrayList oParams = new ArrayList();
oParams.add(oMessageKey);
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
}
if (!EnrgiseUtil.checkString(oHrmAppraisalKPAHdrBean.getTxtAppraiserType())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmHrmAppraisalKPA.txtAppraiserType");
ArrayList oParams = new ArrayList();
oParams.add(oMessageKey);
oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
}
reportError(oErrorList);
}
private void checkMandatoryDtl(HrmAppraisalKPADtlBean oHrmAppraisalKPADtlBean, int iCount, ArrayList arylstErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
if (!EnrgiseUtil.checkString(oHrmAppraisalKPADtlBean.getTxtSrlNo())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmHrmAppraisalKPA.txtSrlNo");
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(oHrmAppraisalKPADtlBean.getTxtKpaCode())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmHrmAppraisalKPA.txtKpaCode");
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(oHrmAppraisalKPADtlBean.getTxtDescription())) {
MessageKey oMessageKey = new MessageKey("hrm.HrmHrmAppraisalKPA.txtDescription");
ArrayList oParams = new ArrayList();
oParams.add(oMessageKey);
oParams.add(new Integer(iCount));
arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
}
}
}