package wenrgise.hrms.ejb.business;

import java.sql.Timestamp;
import java.util.ArrayList;
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.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.HrmRecAdvAttrJobDescDtlBean;
import wenrgise.hrms.bean.HrmRecAdvAttrLngReqDtlBean;
import wenrgise.hrms.bean.HrmRecAdvAttrLocVacencyDtlBean;
import wenrgise.hrms.bean.HrmRecAdvAttrQualReqDtlBean;
import wenrgise.hrms.bean.HrmRecAdvAttrSkillReqDtlBean;
import wenrgise.hrms.bean.HrmRecAdvAttrWorkExpDtlBean;

public class HrmRecAdvAttrBO extends HrmBaseBO {
  public HrmRecAdvAttrBO() {}
  
  public HrmRecAdvAttrBO(UserInfo oUserInfo) {
    super(oUserInfo);
  }
  
  public RecordMetaInfo getRecLocVacencyDetailMetaInfo(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, "HRMRECADVATTRDTL.proc_LocVacencyDtlCount(?,?,?,?,?,?)");
    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 RecordMetaInfo getRecLngReqDetailMetaInfo(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, "HRMRECADVATTRDTL.proc_LngReqDtlCount(?,?,?,?,?,?)");
    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 RecordMetaInfo getRecQualReqDetailMetaInfo(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, "HRMRECADVATTRDTL.proc_QualReqDtlCount(?,?,?,?,?,?)");
    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 RecordMetaInfo getRecSkillReqDetailMetaInfo(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, "HRMRECADVATTRDTL.proc_SkillReqDtlCount(?,?,?,?,?,?)");
    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 RecordMetaInfo getRecWorkExpDetailMetaInfo(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, "HRMRECADVATTRDTL.proc_WorkExpDtlCount(?,?,?,?,?,?)");
    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 RecordMetaInfo getRecJobDescDetailMetaInfo(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, "HRMRECADVATTRDTL.proc_jobdescdtlcount(?,?,?,?,?,?)");
    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 getRecLocVacencyDetail(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    QueryRow oRow = null;
    ArrayList oList = null;
    Iterator oIt = null;
    ArrayList oLocVavancyDetail = new ArrayList();
    ArrayList oParameters = new ArrayList();
    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, "HRMRECADVATTRDTL.proc_LocVacencyDetail(?,?,?,?,?,?,?)");
    oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
    oIt = oList.iterator();
    while (oIt.hasNext()) {
      oRow = oIt.next();
      HrmRecAdvAttrLocVacencyDtlBean oHrmRecAdvAttrLocVacencyDtlBean = new HrmRecAdvAttrLocVacencyDtlBean();
      oHrmRecAdvAttrLocVacencyDtlBean.setDetailId(oRow.get("ID").getString());
      oHrmRecAdvAttrLocVacencyDtlBean.setHdnLocationId(oRow.get("gen_site_id").getString());
      oHrmRecAdvAttrLocVacencyDtlBean.setHdnPrevDtlId(oRow.get("adt_dt_id").getString());
      oHrmRecAdvAttrLocVacencyDtlBean.setTxtLocCode(oRow.get("code").getString());
      oHrmRecAdvAttrLocVacencyDtlBean.setTxtLocDesc(oRow.get("name").getString());
      oHrmRecAdvAttrLocVacencyDtlBean.setTxtState(oRow.get("GLOBAL_CODE_DESC").getString());
      oHrmRecAdvAttrLocVacencyDtlBean.setTxtStateCode(oRow.get("STATE_CODE").getString());
      oHrmRecAdvAttrLocVacencyDtlBean.setTxtStateId(oRow.get("GLOBAL_CODE_TYPE").getString());
      oHrmRecAdvAttrLocVacencyDtlBean.setTxtCity(oRow.get("CITY").getString());
      oHrmRecAdvAttrLocVacencyDtlBean.setTxtNoOfVacancy(oRow.get("vac_no").getString());
      oHrmRecAdvAttrLocVacencyDtlBean.setStatus("Q");
      oLocVavancyDetail.add(oHrmRecAdvAttrLocVacencyDtlBean);
    } 
    return oLocVavancyDetail;
  }
  
  public ArrayList getRecLngReqDetail(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    QueryRow oRow = null;
    ArrayList oList = null;
    Iterator oIt = null;
    ArrayList oLngReqDetail = new ArrayList();
    ArrayList oParameters = new ArrayList();
    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, "HRMRECADVATTRDTL.proc_LngReqDetail(?,?,?,?,?,?,?)");
    oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
    oIt = oList.iterator();
    while (oIt.hasNext()) {
      oRow = oIt.next();
      HrmRecAdvAttrLngReqDtlBean oHrmRecAdvAttrLngReqDtlBean = new HrmRecAdvAttrLngReqDtlBean();
      oHrmRecAdvAttrLngReqDtlBean.setDetailId(oRow.get("ID").getString());
      oHrmRecAdvAttrLngReqDtlBean.setHdnLanguageId(oRow.get("lang_mst_id").getString());
      oHrmRecAdvAttrLngReqDtlBean.setHdnPrevDtlId(oRow.get("adt_dt_id").getString());
      oHrmRecAdvAttrLngReqDtlBean.setTxtLangCode(oRow.get("code").getString());
      oHrmRecAdvAttrLngReqDtlBean.setTxtLangDesc(oRow.get("description").getString());
      oHrmRecAdvAttrLngReqDtlBean.setTxtReqType(oRow.get("requirement_type").getString());
      oHrmRecAdvAttrLngReqDtlBean.setStatus("Q");
      oLngReqDetail.add(oHrmRecAdvAttrLngReqDtlBean);
    } 
    return oLngReqDetail;
  }
  
  public ArrayList getRecQualReqDetail(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    QueryRow oRow = null;
    ArrayList oList = null;
    Iterator oIt = null;
    ArrayList oQuaReqDetail = new ArrayList();
    ArrayList oParameters = new ArrayList();
    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, "HRMRECADVATTRDTL.proc_QualReqDetail(?,?,?,?,?,?,?)");
    oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
    oIt = oList.iterator();
    while (oIt.hasNext()) {
      oRow = oIt.next();
      HrmRecAdvAttrQualReqDtlBean oHrmRecAdvAttrQualReqDtlBean = new HrmRecAdvAttrQualReqDtlBean();
      oHrmRecAdvAttrQualReqDtlBean.setDetailId(oRow.get("ID").getString());
      oHrmRecAdvAttrQualReqDtlBean.setHdnQualificationId(oRow.get("qual_mst_id").getString());
      oHrmRecAdvAttrQualReqDtlBean.setHdnPrevDtlId(oRow.get("adt_dt_id").getString());
      oHrmRecAdvAttrQualReqDtlBean.setTxtQualCode(oRow.get("code").getString());
      oHrmRecAdvAttrQualReqDtlBean.setTxtQualDesc(oRow.get("name").getString());
      oHrmRecAdvAttrQualReqDtlBean.setTxtMandatoryFlag(oRow.get("mandatory_flag").getString());
      oHrmRecAdvAttrQualReqDtlBean.setTxtMaxmQualFlag(oRow.get("max_qual_flag").getString());
      oHrmRecAdvAttrQualReqDtlBean.setTxtExposureIn(oRow.get("exposure").getString());
      oHrmRecAdvAttrQualReqDtlBean.setTxtSpecialisation(oRow.get("specilisation").getString());
      oHrmRecAdvAttrQualReqDtlBean.setStatus("Q");
      oQuaReqDetail.add(oHrmRecAdvAttrQualReqDtlBean);
    } 
    return oQuaReqDetail;
  }
  
  public ArrayList getRecSkillReqDetail(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    QueryRow oRow = null;
    ArrayList oList = null;
    Iterator oIt = null;
    ArrayList oSkillReqDetail = new ArrayList();
    ArrayList oParameters = new ArrayList();
    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, "HRMRECADVATTRDTL.proc_SkillReqDetail(?,?,?,?,?,?,?)");
    oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
    oIt = oList.iterator();
    while (oIt.hasNext()) {
      oRow = oIt.next();
      HrmRecAdvAttrSkillReqDtlBean oHrmRecAdvAttrSkillReqDtlBean = new HrmRecAdvAttrSkillReqDtlBean();
      oHrmRecAdvAttrSkillReqDtlBean.setDetailId(oRow.get("ID").getString());
      oHrmRecAdvAttrSkillReqDtlBean.setHdnSkillId(oRow.get("skill_mst_id").getString());
      oHrmRecAdvAttrSkillReqDtlBean.setHdnPrevDtlId(oRow.get("adt_dt_id").getString());
      oHrmRecAdvAttrSkillReqDtlBean.setTxtSkillCode(oRow.get("code").getString());
      oHrmRecAdvAttrSkillReqDtlBean.setTxtSkillDesc(oRow.get("name").getString());
      oHrmRecAdvAttrSkillReqDtlBean.setTxtSkill(oRow.get("SKILL_DESC").getString());
      oHrmRecAdvAttrSkillReqDtlBean.setTxtRemarks(oRow.get("REMARKS").getString());
      oHrmRecAdvAttrSkillReqDtlBean.setStatus("Q");
      oSkillReqDetail.add(oHrmRecAdvAttrSkillReqDtlBean);
    } 
    return oSkillReqDetail;
  }
  
  public ArrayList getRecWorkExpDetail(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    QueryRow oRow = null;
    ArrayList oList = null;
    Iterator oIt = null;
    ArrayList oWorkExpDetail = new ArrayList();
    ArrayList oParameters = new ArrayList();
    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, "HRMRECADVATTRDTL.proc_WorkExpDetail(?,?,?,?,?,?,?)");
    oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
    oIt = oList.iterator();
    while (oIt.hasNext()) {
      oRow = oIt.next();
      HrmRecAdvAttrWorkExpDtlBean oHrmRecAdvAttrWorkExpDtlBean = new HrmRecAdvAttrWorkExpDtlBean();
      oHrmRecAdvAttrWorkExpDtlBean.setDetailId(oRow.get("ID").getString());
      oHrmRecAdvAttrWorkExpDtlBean.setWorkId(oRow.get("designation_id").getString());
      oHrmRecAdvAttrWorkExpDtlBean.setHdnPrevDtlId(oRow.get("adt_dt_id").getString());
      oHrmRecAdvAttrWorkExpDtlBean.setTxtMaxWrkExp(oRow.get("max_work_exp").getString());
      oHrmRecAdvAttrWorkExpDtlBean.setTxtMinWrkExp(oRow.get("min_work_exp").getString());
      oHrmRecAdvAttrWorkExpDtlBean.setTxtReqExp(oRow.get("code").getString());
      oHrmRecAdvAttrWorkExpDtlBean.setTxtWorkDesc(oRow.get("name").getString());
      oHrmRecAdvAttrWorkExpDtlBean.setTxtExpArea(oRow.get("EXPERIENCE_AREA").getString());
      oHrmRecAdvAttrWorkExpDtlBean.setTxtExpIn(oRow.get("EXPOSURE_IN").getString());
      oHrmRecAdvAttrWorkExpDtlBean.setStatus("Q");
      oWorkExpDetail.add(oHrmRecAdvAttrWorkExpDtlBean);
    } 
    return oWorkExpDetail;
  }
  
  public ArrayList getRecJobDescDetail(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    QueryRow oRow = null;
    ArrayList oList = null;
    Iterator oIt = null;
    ArrayList oWorkExpDetail = new ArrayList();
    ArrayList oParameters = new ArrayList();
    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, "HRMRECADVATTRDTL.proc_JobDescDetail(?,?,?,?,?,?,?)");
    oList = (ArrayList)((DBObject)oOutArray.get(0)).getObject();
    oIt = oList.iterator();
    while (oIt.hasNext()) {
      oRow = oIt.next();
      HrmRecAdvAttrJobDescDtlBean oHrmRecAdvAttrJobDescDtlBean = new HrmRecAdvAttrJobDescDtlBean();
      oHrmRecAdvAttrJobDescDtlBean.setDetailId(oRow.get("ID").getString());
      oHrmRecAdvAttrJobDescDtlBean.setTxtSrlNo(oRow.get("SRL_NO").getString());
      oHrmRecAdvAttrJobDescDtlBean.setHdnPrevDtlId(oRow.get("adt_dt_id").getString());
      oHrmRecAdvAttrJobDescDtlBean.setTxtJobDesc(oRow.get("JOB_REQ").getString());
      oHrmRecAdvAttrJobDescDtlBean.setStatus("Q");
      oWorkExpDetail.add(oHrmRecAdvAttrJobDescDtlBean);
    } 
    return oWorkExpDetail;
  }
  
  public void initializeBOImpl() {
    this.headerTable = "HRM_ADVT_DTL";
  }
  
  public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {}
  
  public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
    return new String();
  }
  
  public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String param1) throws EnrgiseSystemException {
    return new String();
  }
  
  public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList oDetailBeanArray) throws EnrgiseSystemException {
    if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrLocVacencyDtl")) {
      saveLocVacencyDetails(oDetailBeanArray);
    } else if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrLngReqDtl")) {
      saveLanguageReqDetails(oDetailBeanArray);
    } else if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrQualReqDtl")) {
      saveQuaReqDetails(oDetailBeanArray);
    } else if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrSkillReqDtl")) {
      saveSkillReqDetails(oDetailBeanArray);
    } else if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrJobDesc")) {
      saveJobDescDetails(oDetailBeanArray);
    } else {
      saveWorkExpDetails(oDetailBeanArray);
    } 
  }
  
  private void saveLocVacencyDetails(ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
    boolean bUpsert = false;
    boolean bDelete = false;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = null;
    DBUtilitiesBean oBean1 = null;
    Iterator itrBean = arylstDetailBeanArray.iterator();
    while (itrBean.hasNext()) {
      HrmRecAdvAttrLocVacencyDtlBean oHrmRecAdvAttrLocVacencyDtlBean = itrBean.next();
      if (oHrmRecAdvAttrLocVacencyDtlBean.getStatus().equals("N")) {
        if (!bUpsert) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMRECADVATTRDTL.proc_UpsertLocVacencyDtl(?,?,?,?,?,?,?,?,?)");
          bUpsert = 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, oHrmRecAdvAttrLocVacencyDtlBean.getHdnLocationId()));
        arylstParam.add(new DBObject(4, 1, 12, oHrmRecAdvAttrLocVacencyDtlBean.getHdnPrevDtlId()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmRecAdvAttrLocVacencyDtlBean.getTxtStateCode()));
        arylstParam.add(new DBObject(6, 1, 12, oHrmRecAdvAttrLocVacencyDtlBean.getTxtCity()));
        arylstParam.add(new DBObject(7, 1, 12, oHrmRecAdvAttrLocVacencyDtlBean.getTxtNoOfVacancy()));
        arylstParam.add(new DBObject(8, 1, 12, this.oUserInfo.getUserTypeId()));
        arylstParam.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
        oBean.addToBatch(arylstParam);
        continue;
      } 
      if (oHrmRecAdvAttrLocVacencyDtlBean.getStatus().equals("U")) {
        if (!bUpsert) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMRECADVATTRDTL.proc_UpsertLocVacencyDtl(?,?,?,?,?,?,?,?,?)");
          bUpsert = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, "U"));
        arylstParam.add(new DBObject(2, 1, 12, oHrmRecAdvAttrLocVacencyDtlBean.getDetailId()));
        arylstParam.add(new DBObject(3, 1, 12, oHrmRecAdvAttrLocVacencyDtlBean.getHdnLocationId()));
        arylstParam.add(new DBObject(4, 1, 12, oHrmRecAdvAttrLocVacencyDtlBean.getHdnPrevDtlId()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmRecAdvAttrLocVacencyDtlBean.getTxtStateCode()));
        arylstParam.add(new DBObject(6, 1, 12, oHrmRecAdvAttrLocVacencyDtlBean.getTxtCity()));
        arylstParam.add(new DBObject(7, 1, 12, oHrmRecAdvAttrLocVacencyDtlBean.getTxtNoOfVacancy()));
        arylstParam.add(new DBObject(8, 1, 12, this.oUserInfo.getUserTypeId()));
        arylstParam.add(new DBObject(9, 1, 12, this.oUserInfo.getSiteId()));
        oBean.addToBatch(arylstParam);
        continue;
      } 
      if (oHrmRecAdvAttrLocVacencyDtlBean.getStatus().equals("D")) {
        if (!bDelete) {
          oBean1 = new DBUtilitiesBean();
          oBean1.createBatch("HRMRECADVATTRDTL.proc_DeleteLocationDtl(?)");
          bDelete = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, oHrmRecAdvAttrLocVacencyDtlBean.getDetailId()));
        oBean1.addToBatch(arylstParam);
      } 
    } 
    if (bUpsert)
      oBean.executeBatch(); 
    if (bDelete)
      oBean1.executeBatch(); 
  }
  
  private void saveLanguageReqDetails(ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
    boolean bUpsert = false;
    boolean bDelete = false;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = null;
    DBUtilitiesBean oBean1 = null;
    Iterator itrBean = arylstDetailBeanArray.iterator();
    while (itrBean.hasNext()) {
      HrmRecAdvAttrLngReqDtlBean oHrmRecAdvAttrLngReqDtlBean = itrBean.next();
      if (oHrmRecAdvAttrLngReqDtlBean.getStatus().equals("N")) {
        if (!bUpsert) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMRECADVATTRDTL.proc_UpsertLngReqDtl(?,?,?,?,?,?,?)");
          bUpsert = 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, oHrmRecAdvAttrLngReqDtlBean.getHdnLanguageId()));
        arylstParam.add(new DBObject(4, 1, 12, oHrmRecAdvAttrLngReqDtlBean.getHdnPrevDtlId()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmRecAdvAttrLngReqDtlBean.getTxtReqType()));
        arylstParam.add(new DBObject(6, 1, 12, this.oUserInfo.getUserTypeId()));
        arylstParam.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
        oBean.addToBatch(arylstParam);
        continue;
      } 
      if (oHrmRecAdvAttrLngReqDtlBean.getStatus().equals("U")) {
        if (!bUpsert) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMRECADVATTRDTL.proc_UpsertLngReqDtl(?,?,?,?,?,?,?)");
          bUpsert = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, "U"));
        arylstParam.add(new DBObject(2, 1, 12, oHrmRecAdvAttrLngReqDtlBean.getDetailId()));
        arylstParam.add(new DBObject(3, 1, 12, oHrmRecAdvAttrLngReqDtlBean.getHdnLanguageId()));
        arylstParam.add(new DBObject(4, 1, 12, oHrmRecAdvAttrLngReqDtlBean.getHdnPrevDtlId()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmRecAdvAttrLngReqDtlBean.getTxtReqType()));
        arylstParam.add(new DBObject(6, 1, 12, this.oUserInfo.getUserTypeId()));
        arylstParam.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
        oBean.addToBatch(arylstParam);
        continue;
      } 
      if (oHrmRecAdvAttrLngReqDtlBean.getStatus().equals("D")) {
        if (!bDelete) {
          oBean1 = new DBUtilitiesBean();
          oBean1.createBatch("HRMRECADVATTRDTL.proc_DeleteLanguageDtl(?)");
          bDelete = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, oHrmRecAdvAttrLngReqDtlBean.getDetailId()));
        oBean1.addToBatch(arylstParam);
      } 
    } 
    if (bUpsert)
      oBean.executeBatch(); 
    if (bDelete)
      oBean1.executeBatch(); 
  }
  
  private void saveQuaReqDetails(ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
    boolean bUpsert = false;
    boolean bDelete = false;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = null;
    DBUtilitiesBean oBean1 = null;
    Iterator itrBean = arylstDetailBeanArray.iterator();
    while (itrBean.hasNext()) {
      HrmRecAdvAttrQualReqDtlBean oHrmRecAdvAttrQualReqDtlBean = itrBean.next();
      if (oHrmRecAdvAttrQualReqDtlBean.getStatus().equals("N")) {
        if (!bUpsert) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMRECADVATTRDTL.proc_UpsertQuaReqDtl(?,?,?,?,?,?,?,?,?,?)");
          bUpsert = 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, oHrmRecAdvAttrQualReqDtlBean.getHdnQualificationId()));
        arylstParam.add(new DBObject(4, 1, 12, oHrmRecAdvAttrQualReqDtlBean.getHdnPrevDtlId()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmRecAdvAttrQualReqDtlBean.getTxtSpecialisation()));
        arylstParam.add(new DBObject(6, 1, 12, oHrmRecAdvAttrQualReqDtlBean.getTxtExposureIn()));
        arylstParam.add(new DBObject(7, 1, 12, oHrmRecAdvAttrQualReqDtlBean.getTxtMandatoryFlag()));
        arylstParam.add(new DBObject(8, 1, 12, oHrmRecAdvAttrQualReqDtlBean.getTxtMaxmQualFlag()));
        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 (oHrmRecAdvAttrQualReqDtlBean.getStatus().equals("U")) {
        if (!bUpsert) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMRECADVATTRDTL.proc_UpsertQuaReqDtl(?,?,?,?,?,?,?,?,?,?)");
          bUpsert = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, "U"));
        arylstParam.add(new DBObject(2, 1, 12, oHrmRecAdvAttrQualReqDtlBean.getDetailId()));
        arylstParam.add(new DBObject(3, 1, 12, oHrmRecAdvAttrQualReqDtlBean.getHdnQualificationId()));
        arylstParam.add(new DBObject(4, 1, 12, oHrmRecAdvAttrQualReqDtlBean.getHdnPrevDtlId()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmRecAdvAttrQualReqDtlBean.getTxtSpecialisation()));
        arylstParam.add(new DBObject(6, 1, 12, oHrmRecAdvAttrQualReqDtlBean.getTxtExposureIn()));
        arylstParam.add(new DBObject(7, 1, 12, oHrmRecAdvAttrQualReqDtlBean.getTxtMandatoryFlag()));
        arylstParam.add(new DBObject(8, 1, 12, oHrmRecAdvAttrQualReqDtlBean.getTxtMaxmQualFlag()));
        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 (oHrmRecAdvAttrQualReqDtlBean.getStatus().equals("D")) {
        if (!bDelete) {
          oBean1 = new DBUtilitiesBean();
          oBean1.createBatch("HRMRECADVATTRDTL.proc_DeleteQualificationDtl(?)");
          bDelete = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, oHrmRecAdvAttrQualReqDtlBean.getDetailId()));
        oBean1.addToBatch(arylstParam);
      } 
    } 
    if (bUpsert)
      oBean.executeBatch(); 
    if (bDelete)
      oBean1.executeBatch(); 
  }
  
  private void saveSkillReqDetails(ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
    boolean bUpsert = false;
    boolean bDelete = false;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = null;
    DBUtilitiesBean oBean1 = null;
    Iterator itrBean = arylstDetailBeanArray.iterator();
    while (itrBean.hasNext()) {
      HrmRecAdvAttrSkillReqDtlBean oHrmRecAdvAttrSkillReqDtlBean = itrBean.next();
      if (oHrmRecAdvAttrSkillReqDtlBean.getStatus().equals("N")) {
        if (!bUpsert) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMRECADVATTRDTL.proc_UpsertSkillReqDtl(?,?,?,?,?,?,?,?)");
          bUpsert = 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, oHrmRecAdvAttrSkillReqDtlBean.getHdnSkillId()));
        arylstParam.add(new DBObject(4, 1, 12, oHrmRecAdvAttrSkillReqDtlBean.getHdnPrevDtlId()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmRecAdvAttrSkillReqDtlBean.getTxtSkill()));
        arylstParam.add(new DBObject(6, 1, 12, oHrmRecAdvAttrSkillReqDtlBean.getTxtRemarks()));
        arylstParam.add(new DBObject(7, 1, 12, this.oUserInfo.getUserTypeId()));
        arylstParam.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
        oBean.addToBatch(arylstParam);
        continue;
      } 
      if (oHrmRecAdvAttrSkillReqDtlBean.getStatus().equals("U")) {
        if (!bUpsert) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMRECADVATTRDTL.proc_UpsertSkillReqDtl(?,?,?,?,?,?,?,?)");
          bUpsert = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, "U"));
        arylstParam.add(new DBObject(2, 1, 12, oHrmRecAdvAttrSkillReqDtlBean.getDetailId()));
        arylstParam.add(new DBObject(3, 1, 12, oHrmRecAdvAttrSkillReqDtlBean.getHdnSkillId()));
        arylstParam.add(new DBObject(4, 1, 12, oHrmRecAdvAttrSkillReqDtlBean.getHdnPrevDtlId()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmRecAdvAttrSkillReqDtlBean.getTxtSkill()));
        arylstParam.add(new DBObject(6, 1, 12, oHrmRecAdvAttrSkillReqDtlBean.getTxtRemarks()));
        arylstParam.add(new DBObject(7, 1, 12, this.oUserInfo.getUserTypeId()));
        arylstParam.add(new DBObject(8, 1, 12, this.oUserInfo.getSiteId()));
        oBean.addToBatch(arylstParam);
        continue;
      } 
      if (oHrmRecAdvAttrSkillReqDtlBean.getStatus().equals("D")) {
        if (!bDelete) {
          oBean1 = new DBUtilitiesBean();
          oBean1.createBatch("HRMRECADVATTRDTL.proc_DeleteSkillsDtl(?)");
          bDelete = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, oHrmRecAdvAttrSkillReqDtlBean.getDetailId()));
        oBean1.addToBatch(arylstParam);
      } 
    } 
    if (bUpsert)
      oBean.executeBatch(); 
    if (bDelete)
      oBean1.executeBatch(); 
  }
  
  private void saveWorkExpDetails(ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
    boolean bUpsert = false;
    boolean bDelete = false;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = null;
    DBUtilitiesBean oBean1 = null;
    Iterator itrBean = arylstDetailBeanArray.iterator();
    while (itrBean.hasNext()) {
      HrmRecAdvAttrWorkExpDtlBean oHrmRecAdvAttrWorkExpDtlBean = itrBean.next();
      if (oHrmRecAdvAttrWorkExpDtlBean.getStatus().equals("N")) {
        if (!bUpsert) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMRECADVATTRDTL.proc_UpsertWorkExpDtl(?,?,?,?,?,?,?,?,?,?)");
          bUpsert = 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, oHrmRecAdvAttrWorkExpDtlBean.getWorkId()));
        arylstParam.add(new DBObject(4, 1, 12, oHrmRecAdvAttrWorkExpDtlBean.getHdnPrevDtlId()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmRecAdvAttrWorkExpDtlBean.getTxtMinWrkExp()));
        arylstParam.add(new DBObject(6, 1, 12, oHrmRecAdvAttrWorkExpDtlBean.getTxtMaxWrkExp()));
        arylstParam.add(new DBObject(7, 1, 12, oHrmRecAdvAttrWorkExpDtlBean.getTxtExpArea()));
        arylstParam.add(new DBObject(8, 1, 12, oHrmRecAdvAttrWorkExpDtlBean.getTxtExpIn()));
        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 (oHrmRecAdvAttrWorkExpDtlBean.getStatus().equals("U")) {
        if (!bUpsert) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMRECADVATTRDTL.proc_UpsertWorkExpDtl(?,?,?,?,?,?,?,?,?,?)");
          bUpsert = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, "U"));
        arylstParam.add(new DBObject(2, 1, 12, oHrmRecAdvAttrWorkExpDtlBean.getDetailId()));
        arylstParam.add(new DBObject(3, 1, 12, oHrmRecAdvAttrWorkExpDtlBean.getWorkId()));
        arylstParam.add(new DBObject(4, 1, 12, oHrmRecAdvAttrWorkExpDtlBean.getHdnPrevDtlId()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmRecAdvAttrWorkExpDtlBean.getTxtMinWrkExp()));
        arylstParam.add(new DBObject(6, 1, 12, oHrmRecAdvAttrWorkExpDtlBean.getTxtMaxWrkExp()));
        arylstParam.add(new DBObject(7, 1, 12, oHrmRecAdvAttrWorkExpDtlBean.getTxtExpArea()));
        arylstParam.add(new DBObject(8, 1, 12, oHrmRecAdvAttrWorkExpDtlBean.getTxtExpIn()));
        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 (oHrmRecAdvAttrWorkExpDtlBean.getStatus().equals("D")) {
        if (!bDelete) {
          oBean1 = new DBUtilitiesBean();
          oBean1.createBatch("HRMRECADVATTRDTL.proc_DeleteWorkDtl(?)");
          bDelete = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, oHrmRecAdvAttrWorkExpDtlBean.getDetailId()));
        oBean1.addToBatch(arylstParam);
      } 
    } 
    if (bUpsert)
      oBean.executeBatch(); 
    if (bDelete)
      oBean1.executeBatch(); 
  }
  
  private void saveJobDescDetails(ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
    boolean bUpsert = false;
    boolean bDelete = false;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = null;
    DBUtilitiesBean oBean1 = null;
    Iterator itrBean = arylstDetailBeanArray.iterator();
    while (itrBean.hasNext()) {
      HrmRecAdvAttrJobDescDtlBean oHrmRecAdvAttrJobDescDtlBean = itrBean.next();
      if (oHrmRecAdvAttrJobDescDtlBean.getStatus().equals("N")) {
        if (!bUpsert) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMRECADVATTRDTL.proc_upsertjobdescdtl(?,?,?,?,?,?,?)");
          bUpsert = 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, oHrmRecAdvAttrJobDescDtlBean.getHdnPrevDtlId()));
        arylstParam.add(new DBObject(4, 1, 12, oHrmRecAdvAttrJobDescDtlBean.getTxtJobDesc()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmRecAdvAttrJobDescDtlBean.getTxtSrlNo()));
        arylstParam.add(new DBObject(6, 1, 12, this.oUserInfo.getUserTypeId()));
        arylstParam.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
        oBean.addToBatch(arylstParam);
        continue;
      } 
      if (oHrmRecAdvAttrJobDescDtlBean.getStatus().equals("U")) {
        if (!bUpsert) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMRECADVATTRDTL.proc_upsertjobdescdtl(?,?,?,?,?,?,?)");
          bUpsert = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, "U"));
        arylstParam.add(new DBObject(2, 1, 12, oHrmRecAdvAttrJobDescDtlBean.getDetailId()));
        arylstParam.add(new DBObject(3, 1, 12, oHrmRecAdvAttrJobDescDtlBean.getHdnPrevDtlId()));
        arylstParam.add(new DBObject(4, 1, 12, oHrmRecAdvAttrJobDescDtlBean.getTxtJobDesc()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmRecAdvAttrJobDescDtlBean.getTxtSrlNo()));
        arylstParam.add(new DBObject(6, 1, 12, this.oUserInfo.getUserTypeId()));
        arylstParam.add(new DBObject(7, 1, 12, this.oUserInfo.getSiteId()));
        oBean.addToBatch(arylstParam);
        continue;
      } 
      if (oHrmRecAdvAttrJobDescDtlBean.getStatus().equals("D")) {
        if (!bDelete) {
          oBean1 = new DBUtilitiesBean();
          oBean1.createBatch("HRMRECADVATTRDTL.proc_deletejobdesc(?)");
          bDelete = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, oHrmRecAdvAttrJobDescDtlBean.getDetailId()));
        oBean1.addToBatch(arylstParam);
      } 
    } 
    if (bUpsert)
      oBean.executeBatch(); 
    if (bDelete)
      oBean1.executeBatch(); 
  }
  
  public LovVO getHrmRecAttrLocationLOVData(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
    LovVO oLovVO = new LovVO();
    ArrayList arylstHeaderList = new ArrayList();
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.id");
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.locCode");
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.locDesc");
    oLovVO.setHeaderList(arylstHeaderList);
    ArrayList arylstVisibility = new ArrayList();
    arylstVisibility.add("H");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    oLovVO.setVisibilityList(arylstVisibility);
    int count = 0;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    String sQuerySearch1 = new String();
    String sQuerySearch2 = new String();
    if (oLovQueryVO.getSearchField1() != null)
      sQuerySearch1 = oLovQueryVO.getSearchField1(); 
    if (oLovQueryVO.getSearchField2() != null)
      sQuerySearch2 = oLovQueryVO.getSearchField2(); 
    arylstParam = new ArrayList();
    arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1));
    arylstParam.add(new DBObject(2, 1, 12, sQuerySearch2));
    arylstParam.add(new DBObject(3, 2, -10));
    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, "HRMRECADVATTRDTL.proc_GetAdvLocationLOVdata(?,?,?,?,?,?)");
    DBObject oOutObject = arylstOutArray.get(0);
    arylstParam = (ArrayList)oOutObject.getObject();
    QueryRow oRow = null;
    Iterator iter = arylstParam.iterator();
    while (iter.hasNext()) {
      if (count == 0)
        arylstParam = new ArrayList(); 
      count++;
      oRow = (QueryRow)iter.next();
      LOVBean oLOVBean = new LOVBean();
      oLOVBean.setDetailField1(oRow.get("ID").getString());
      oLOVBean.setDetailField2(oRow.get("CODE").getString());
      oLOVBean.setDetailField3(oRow.get("NAME").getString());
      arylstParam.add(oLOVBean);
    } 
    oLovVO.setDetailList(arylstParam);
    return oLovVO;
  }
  
  public LovVO getHrmRecAttrQualificationLOVData(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
    LovVO oLovVO = new LovVO();
    ArrayList arylstHeaderList = new ArrayList();
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.id");
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.qualCode");
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.qualdescription");
    oLovVO.setHeaderList(arylstHeaderList);
    ArrayList arylstVisibility = new ArrayList();
    arylstVisibility.add("H");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    oLovVO.setVisibilityList(arylstVisibility);
    int count = 0;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    String sQuerySearch1 = new String();
    String sQuerySearch2 = new String();
    if (oLovQueryVO.getSearchField1() != null)
      sQuerySearch1 = oLovQueryVO.getSearchField1(); 
    if (oLovQueryVO.getSearchField2() != null)
      sQuerySearch2 = oLovQueryVO.getSearchField2(); 
    arylstParam = new ArrayList();
    arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1));
    arylstParam.add(new DBObject(2, 1, 12, sQuerySearch2));
    arylstParam.add(new DBObject(3, 2, -10));
    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, "HRMRECADVATTRDTL.proc_GetQualificationLOVdata(?,?,?,?,?,?)");
    DBObject oOutObject = arylstOutArray.get(0);
    arylstParam = (ArrayList)oOutObject.getObject();
    QueryRow oRow = null;
    Iterator iter = arylstParam.iterator();
    while (iter.hasNext()) {
      if (count == 0)
        arylstParam = new ArrayList(); 
      count++;
      oRow = (QueryRow)iter.next();
      LOVBean oLOVBean = new LOVBean();
      oLOVBean.setDetailField1(oRow.get("ID").getString());
      oLOVBean.setDetailField2(oRow.get("CODE").getString());
      oLOVBean.setDetailField3(oRow.get("NAME").getString());
      arylstParam.add(oLOVBean);
    } 
    oLovVO.setDetailList(arylstParam);
    return oLovVO;
  }
  
  public LovVO getHrmRecAttrLanguageLOVData(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
    LovVO oLovVO = new LovVO();
    ArrayList arylstHeaderList = new ArrayList();
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.id");
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.langCode");
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.langDesc");
    oLovVO.setHeaderList(arylstHeaderList);
    ArrayList arylstVisibility = new ArrayList();
    arylstVisibility.add("H");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    oLovVO.setVisibilityList(arylstVisibility);
    int count = 0;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    String sQuerySearch1 = new String();
    String sQuerySearch2 = new String();
    if (oLovQueryVO.getSearchField1() != null)
      sQuerySearch1 = oLovQueryVO.getSearchField1(); 
    if (oLovQueryVO.getSearchField2() != null)
      sQuerySearch2 = oLovQueryVO.getSearchField2(); 
    arylstParam = new ArrayList();
    arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1));
    arylstParam.add(new DBObject(2, 1, 12, sQuerySearch2));
    arylstParam.add(new DBObject(3, 2, -10));
    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, "HRMRECADVATTRDTL.proc_GetLanguageLOVdata(?,?,?,?,?,?)");
    DBObject oOutObject = arylstOutArray.get(0);
    arylstParam = (ArrayList)oOutObject.getObject();
    QueryRow oRow = null;
    Iterator iter = arylstParam.iterator();
    while (iter.hasNext()) {
      if (count == 0)
        arylstParam = new ArrayList(); 
      count++;
      oRow = (QueryRow)iter.next();
      LOVBean oLOVBean = new LOVBean();
      oLOVBean.setDetailField1(oRow.get("ID").getString());
      oLOVBean.setDetailField2(oRow.get("CODE").getString());
      oLOVBean.setDetailField3(oRow.get("DESCRIPTION").getString());
      arylstParam.add(oLOVBean);
    } 
    oLovVO.setDetailList(arylstParam);
    return oLovVO;
  }
  
  public LovVO getHrmRecAttrSkillLOVData(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
    LovVO oLovVO = new LovVO();
    ArrayList arylstHeaderList = new ArrayList();
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.id");
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.skillCode");
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.skillDesc");
    oLovVO.setHeaderList(arylstHeaderList);
    ArrayList arylstVisibility = new ArrayList();
    arylstVisibility.add("H");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    oLovVO.setVisibilityList(arylstVisibility);
    int count = 0;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    String sQuerySearch1 = new String();
    String sQuerySearch2 = new String();
    if (oLovQueryVO.getSearchField1() != null)
      sQuerySearch1 = oLovQueryVO.getSearchField1(); 
    if (oLovQueryVO.getSearchField2() != null)
      sQuerySearch2 = oLovQueryVO.getSearchField2(); 
    arylstParam = new ArrayList();
    arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1));
    arylstParam.add(new DBObject(2, 1, 12, sQuerySearch2));
    arylstParam.add(new DBObject(3, 2, -10));
    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, "HRMRECADVATTRDTL.proc_GetSkillLOVdata(?,?,?,?,?,?)");
    DBObject oOutObject = arylstOutArray.get(0);
    arylstParam = (ArrayList)oOutObject.getObject();
    QueryRow oRow = null;
    Iterator iter = arylstParam.iterator();
    while (iter.hasNext()) {
      if (count == 0)
        arylstParam = new ArrayList(); 
      count++;
      oRow = (QueryRow)iter.next();
      LOVBean oLOVBean = new LOVBean();
      oLOVBean.setDetailField1(oRow.get("ID").getString());
      oLOVBean.setDetailField2(oRow.get("CODE").getString());
      oLOVBean.setDetailField3(oRow.get("NAME").getString());
      arylstParam.add(oLOVBean);
    } 
    oLovVO.setDetailList(arylstParam);
    return oLovVO;
  }
  
  public LovVO getHrmRecAttrWorkLOVData(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
    LovVO oLovVO = new LovVO();
    ArrayList arylstHeaderList = new ArrayList();
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.id");
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.reqExp");
    arylstHeaderList.add("hrm.HrmAdvertisementAttribute.Desc");
    oLovVO.setHeaderList(arylstHeaderList);
    ArrayList arylstVisibility = new ArrayList();
    arylstVisibility.add("H");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    oLovVO.setVisibilityList(arylstVisibility);
    int count = 0;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    String sQuerySearch1 = new String();
    String sQuerySearch2 = new String();
    if (oLovQueryVO.getSearchField1() != null)
      sQuerySearch1 = oLovQueryVO.getSearchField1(); 
    if (oLovQueryVO.getSearchField2() != null)
      sQuerySearch2 = oLovQueryVO.getSearchField2(); 
    arylstParam = new ArrayList();
    arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1));
    arylstParam.add(new DBObject(2, 1, 12, sQuerySearch2));
    arylstParam.add(new DBObject(3, 2, -10));
    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, "HRMRECADVATTRDTL.proc_GetWorkExpLOVdata(?,?,?,?,?,?)");
    DBObject oOutObject = arylstOutArray.get(0);
    arylstParam = (ArrayList)oOutObject.getObject();
    QueryRow oRow = null;
    Iterator iter = arylstParam.iterator();
    while (iter.hasNext()) {
      if (count == 0)
        arylstParam = new ArrayList(); 
      count++;
      oRow = (QueryRow)iter.next();
      LOVBean oLOVBean = new LOVBean();
      oLOVBean.setDetailField1(oRow.get("ID").getString());
      oLOVBean.setDetailField2(oRow.get("CODE").getString());
      oLOVBean.setDetailField3(oRow.get("NAME").getString());
      arylstParam.add(oLOVBean);
    } 
    oLovVO.setDetailList(arylstParam);
    return oLovVO;
  }
  
  public void additionalFieldValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
    ArrayList oErrorList = new ArrayList();
    if (bDetailDataChanged)
      if (!sScreenMode.equalsIgnoreCase("D"))
        if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrLocVacencyDtl")) {
          Iterator oIt1 = arylstDetailBeanArray.iterator();
          int rowCount = 1;
          while (oIt1.hasNext()) {
            HrmRecAdvAttrLocVacencyDtlBean oHrmRecAdvAttrLocVacencyDtlBean = oIt1.next();
            if (!oHrmRecAdvAttrLocVacencyDtlBean.getStatus().equalsIgnoreCase("D"))
              checkMandatoryLocationDtls(oHrmRecAdvAttrLocVacencyDtlBean, rowCount, oErrorList); 
            rowCount++;
          } 
        } else if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrLngReqDtl")) {
          Iterator oIt1 = arylstDetailBeanArray.iterator();
          int rowCount = 1;
          while (oIt1.hasNext()) {
            HrmRecAdvAttrLngReqDtlBean oHrmRecAdvAttrLngReqDtlBean = oIt1.next();
            if (!oHrmRecAdvAttrLngReqDtlBean.getStatus().equalsIgnoreCase("D"))
              checkMandatoryLanguageDtls(oHrmRecAdvAttrLngReqDtlBean, rowCount, oErrorList); 
            rowCount++;
          } 
        } else if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrQualReqDtl")) {
          Iterator oIt1 = arylstDetailBeanArray.iterator();
          int rowCount = 1;
          while (oIt1.hasNext()) {
            HrmRecAdvAttrQualReqDtlBean oHrmRecAdvAttrQualReqDtlBean = oIt1.next();
            if (!oHrmRecAdvAttrQualReqDtlBean.getStatus().equalsIgnoreCase("D"))
              checkMandatoryQualificationDtls(oHrmRecAdvAttrQualReqDtlBean, rowCount, oErrorList); 
            rowCount++;
          } 
        } else if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrSkillReqDtl")) {
          Iterator oIt1 = arylstDetailBeanArray.iterator();
          int rowCount = 1;
          while (oIt1.hasNext()) {
            HrmRecAdvAttrSkillReqDtlBean oHrmRecAdvAttrSkillReqDtlBean = oIt1.next();
            if (!oHrmRecAdvAttrSkillReqDtlBean.getStatus().equalsIgnoreCase("D"))
              checkMandatorySkillDtls(oHrmRecAdvAttrSkillReqDtlBean, rowCount, oErrorList); 
            rowCount++;
          } 
        } else if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrWorkExpDtl")) {
          Iterator oIt1 = arylstDetailBeanArray.iterator();
          int rowCount = 1;
          while (oIt1.hasNext()) {
            HrmRecAdvAttrWorkExpDtlBean oHrmRecAdvAttrWorkExpDtlBean = oIt1.next();
            if (!oHrmRecAdvAttrWorkExpDtlBean.getStatus().equalsIgnoreCase("D"))
              checkMandatoryWorkDtls(oHrmRecAdvAttrWorkExpDtlBean, rowCount, oErrorList); 
            rowCount++;
          } 
        } else if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrJobDesc")) {
          Iterator oIt1 = arylstDetailBeanArray.iterator();
          int rowCount = 1;
          while (oIt1.hasNext()) {
            HrmRecAdvAttrJobDescDtlBean oHrmRecAdvAttrJobDescDtlBean = oIt1.next();
            if (!oHrmRecAdvAttrJobDescDtlBean.getStatus().equalsIgnoreCase("D"))
              checkMandatoryJobDesc(oHrmRecAdvAttrJobDescDtlBean, rowCount, oErrorList); 
            rowCount++;
          } 
        }   
    reportError(oErrorList);
  }
  
  private void checkMandatoryLocationDtls(HrmRecAdvAttrLocVacencyDtlBean oHrmRecAdvAttrLocVacencyDtlBean, int rowCount, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
    if (!EnrgiseUtil.checkString(oHrmRecAdvAttrLocVacencyDtlBean.getTxtLocCode())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.locCode");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(new Integer(rowCount));
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
    if (!EnrgiseUtil.checkString(oHrmRecAdvAttrLocVacencyDtlBean.getTxtNoOfVacancy())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.noOfVacancy");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(new Integer(rowCount));
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
  }
  
  private void checkMandatoryLanguageDtls(HrmRecAdvAttrLngReqDtlBean oHrmRecAdvAttrLngReqDtlBean, int rowCount, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
    if (!EnrgiseUtil.checkString(oHrmRecAdvAttrLngReqDtlBean.getTxtLangCode())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.langCode");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(new Integer(rowCount));
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
    if (!EnrgiseUtil.checkString(oHrmRecAdvAttrLngReqDtlBean.getTxtReqType())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.reqType");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(new Integer(rowCount));
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
  }
  
  private void checkMandatoryQualificationDtls(HrmRecAdvAttrQualReqDtlBean oHrmRecAdvAttrQualReqDtlBean, int rowCount, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
    if (!EnrgiseUtil.checkString(oHrmRecAdvAttrQualReqDtlBean.getTxtMandatoryFlag())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.mandatoryFlag");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(new Integer(rowCount));
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
    if (!EnrgiseUtil.checkString(oHrmRecAdvAttrQualReqDtlBean.getTxtQualCode())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.qualCode");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(new Integer(rowCount));
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
    if (!EnrgiseUtil.checkString(oHrmRecAdvAttrQualReqDtlBean.getTxtMaxmQualFlag())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.maxmQualFlag");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(new Integer(rowCount));
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
  }
  
  private void checkMandatorySkillDtls(HrmRecAdvAttrSkillReqDtlBean oHrmRecAdvAttrSkillReqDtlBean, int rowCount, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
    if (!EnrgiseUtil.checkString(oHrmRecAdvAttrSkillReqDtlBean.getTxtSkillCode())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.skillCode");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(new Integer(rowCount));
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
  }
  
  private void checkMandatoryWorkDtls(HrmRecAdvAttrWorkExpDtlBean oHrmRecAdvAttrWorkExpDtlBean, int rowCount, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
    if (!EnrgiseUtil.checkString(oHrmRecAdvAttrWorkExpDtlBean.getTxtReqExp())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.reqExp");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(new Integer(rowCount));
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
    if (!EnrgiseUtil.checkString(oHrmRecAdvAttrWorkExpDtlBean.getTxtMinWrkExp())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.minWrkExp");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(new Integer(rowCount));
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
  }
  
  private void checkMandatoryJobDesc(HrmRecAdvAttrJobDescDtlBean oHrmRecAdvAttrJobDescDtlBean, int rowCount, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
    if (!EnrgiseUtil.checkString(oHrmRecAdvAttrJobDescDtlBean.getTxtSrlNo())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.srlNo");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(new Integer(rowCount));
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
    if (!EnrgiseUtil.checkString(oHrmRecAdvAttrJobDescDtlBean.getTxtJobDesc())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.jobDesc");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(new Integer(rowCount));
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
  }
  
  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 (bDetailDataChanged)
      if (!sScreenMode.equalsIgnoreCase("D"))
        if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrLocVacencyDtl")) {
          Iterator oIt1 = oDetailBeanArray.iterator();
          EnrgiseUtil.checkDuplicate(oDetailBeanArray, "txtLocCode", "hrm.HrmAdvertisementAttribute.locCode", oErrorList, true);
          checkUniqueLocationDtl(oDetailBeanArray, oErrorList);
          checkNumericLocationDtl(oDetailBeanArray, oErrorList);
        } else if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrLngReqDtl")) {
          Iterator oIt1 = oDetailBeanArray.iterator();
          EnrgiseUtil.checkDuplicate(oDetailBeanArray, "txtLangCode", "hrm.HrmAdvertisementAttribute.langCode", oErrorList, true);
          checkUniqueLanguageDtl(oDetailBeanArray, oErrorList);
        } else if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrQualReqDtl")) {
          Iterator oIt1 = oDetailBeanArray.iterator();
          EnrgiseUtil.checkDuplicate(oDetailBeanArray, "txtQualCode", "hrm.HrmAdvertisementAttribute.qualCode", oErrorList, true);
          checkUniqueQualificationDtl(oDetailBeanArray, oErrorList);
        } else if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrSkillReqDtl")) {
          Iterator oIt1 = oDetailBeanArray.iterator();
          EnrgiseUtil.checkDuplicate(oDetailBeanArray, "txtSkillCode", "hrm.HrmAdvertisementAttribute.skillCode", oErrorList, true);
          checkUniqueSkillDtl(oDetailBeanArray, oErrorList);
        } else if (sScreenName.equalsIgnoreCase("HrmRecAdvAttrWorkExpDtl")) {
          Iterator oIt1 = oDetailBeanArray.iterator();
          EnrgiseUtil.checkDuplicate(oDetailBeanArray, "txtReqExp", "hrm.HrmAdvertisementAttribute.reqExp", oErrorList, true);
          checkUniqueWorkDtl(oDetailBeanArray, oErrorList);
          checkNumericWorkDtl(oDetailBeanArray, oErrorList);
          checkExp(oDetailBeanArray);
        }   
    reportError(oErrorList);
  }
  
  private void checkExp(ArrayList oDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {
    ArrayList arylstList = new ArrayList();
    ArrayList arylstParam = new ArrayList();
    int count = 0;
    float fMaxExp = 0.0F;
    Iterator itrBean = oDetailBeanArray.iterator();
    int totalDuration = 0;
    while (itrBean.hasNext()) {
      HrmRecAdvAttrWorkExpDtlBean oHrmRecAdvAttrWorkExpDtlBean = oDetailBeanArray.get(count);
      float fMinExp = Float.parseFloat(oHrmRecAdvAttrWorkExpDtlBean.getTxtMinWrkExp());
      if (EnrgiseUtil.checkString(oHrmRecAdvAttrWorkExpDtlBean.getTxtMaxWrkExp()))
        fMaxExp = Float.parseFloat(oHrmRecAdvAttrWorkExpDtlBean.getTxtMaxWrkExp()); 
      if (fMinExp > 30) {
        arylstParam = new ArrayList();
        arylstParam.add("");
        arylstParam.add(new Integer(0));
        arylstList.add(new EnrgiseMessageKeyException("hrm.HrmAdvertisementAttribute.checkMinExp", arylstParam));
      } 
      if (fMaxExp > 30) {
        arylstParam = new ArrayList();
        arylstParam.add("");
        arylstParam.add(new Integer(0));
        arylstList.add(new EnrgiseMessageKeyException("hrm.HrmAdvertisementAttribute.checkMaxExp", arylstParam));
      } 
      count++;
      itrBean.next();
    } 
    reportError(arylstList);
  }
  
  private void checkUniqueLocationDtl(ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
    int count = 1;
    Iterator oIt1 = oDetailBeanArray.iterator();
    while (oIt1.hasNext()) {
      HrmRecAdvAttrLocVacencyDtlBean oHrmRecAdvAttrLocVacencyDtlBean = oIt1.next();
      String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(" Select id as ID from HRM_ADVT_LOC_DTL where gen_site_id= '").concat(String.valueOf(oHrmRecAdvAttrLocVacencyDtlBean.getHdnLocationId()))).concat(String.valueOf("' and adt_dt_id='"))).concat(String.valueOf(oHrmRecAdvAttrLocVacencyDtlBean.getHdnPrevDtlId()))).concat(String.valueOf("'"));
      System.out.println(sQuery);
      DBUtilitiesBean oBean = new DBUtilitiesBean();
      ArrayList oList = oBean.executeQuery(sQuery);
      Iterator oIt = oList.iterator();
      if (oIt.hasNext()) {
        QueryRow oRow = oIt.next();
        if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmRecAdvAttrLocVacencyDtlBean.getDetailId())) {
          ArrayList oParams = new ArrayList();
          MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.locCode");
          oParams.add(oMessageKey);
          oParams.add(new Integer(count));
          oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.uniqueKeyViolated", oParams, "E"));
        } 
      } 
      count++;
    } 
  }
  
  private void checkUniqueLanguageDtl(ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
    int count = 1;
    Iterator oIt1 = oDetailBeanArray.iterator();
    while (oIt1.hasNext()) {
      HrmRecAdvAttrLngReqDtlBean oHrmRecAdvAttrLngReqDtlBean = oIt1.next();
      String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(" Select id as ID from HRM_ADVT_LANG_RQMT_DTL where lang_mst_id= '").concat(String.valueOf(oHrmRecAdvAttrLngReqDtlBean.getHdnLanguageId()))).concat(String.valueOf("' and adt_dt_id='"))).concat(String.valueOf(oHrmRecAdvAttrLngReqDtlBean.getHdnPrevDtlId()))).concat(String.valueOf("'"));
      System.out.println(sQuery);
      DBUtilitiesBean oBean = new DBUtilitiesBean();
      ArrayList oList = oBean.executeQuery(sQuery);
      Iterator oIt = oList.iterator();
      if (oIt.hasNext()) {
        QueryRow oRow = oIt.next();
        if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmRecAdvAttrLngReqDtlBean.getDetailId())) {
          ArrayList oParams = new ArrayList();
          MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.langCode");
          oParams.add(oMessageKey);
          oParams.add(new Integer(count));
          oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.uniqueKeyViolated", oParams, "E"));
        } 
      } 
      count++;
    } 
  }
  
  private void checkUniqueQualificationDtl(ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
    int count = 1;
    Iterator oIt1 = oDetailBeanArray.iterator();
    while (oIt1.hasNext()) {
      HrmRecAdvAttrQualReqDtlBean oHrmRecAdvAttrQualReqDtlBean = oIt1.next();
      String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(" Select id as ID from HRM_ADVT_QUAL_DTL where qual_mst_id= '").concat(String.valueOf(oHrmRecAdvAttrQualReqDtlBean.getHdnQualificationId()))).concat(String.valueOf("' and adt_dt_id='"))).concat(String.valueOf(oHrmRecAdvAttrQualReqDtlBean.getHdnPrevDtlId()))).concat(String.valueOf("'"));
      System.out.println(sQuery);
      DBUtilitiesBean oBean = new DBUtilitiesBean();
      ArrayList oList = oBean.executeQuery(sQuery);
      Iterator oIt = oList.iterator();
      if (oIt.hasNext()) {
        QueryRow oRow = oIt.next();
        if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmRecAdvAttrQualReqDtlBean.getDetailId())) {
          ArrayList oParams = new ArrayList();
          MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.qualCode");
          oParams.add(oMessageKey);
          oParams.add(new Integer(count));
          oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.uniqueKeyViolated", oParams, "E"));
        } 
      } 
      count++;
    } 
  }
  
  private void checkUniqueSkillDtl(ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
    int count = 1;
    Iterator oIt1 = oDetailBeanArray.iterator();
    while (oIt1.hasNext()) {
      HrmRecAdvAttrSkillReqDtlBean oHrmRecAdvAttrSkillReqDtlBean = oIt1.next();
      String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(" Select id as ID from HRM_ADVT_SKILLS where skill_mst_id= '").concat(String.valueOf(oHrmRecAdvAttrSkillReqDtlBean.getHdnSkillId()))).concat(String.valueOf("' and adt_dt_id='"))).concat(String.valueOf(oHrmRecAdvAttrSkillReqDtlBean.getHdnPrevDtlId()))).concat(String.valueOf("'"));
      System.out.println(sQuery);
      DBUtilitiesBean oBean = new DBUtilitiesBean();
      ArrayList oList = oBean.executeQuery(sQuery);
      Iterator oIt = oList.iterator();
      if (oIt.hasNext()) {
        QueryRow oRow = oIt.next();
        if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmRecAdvAttrSkillReqDtlBean.getDetailId())) {
          ArrayList oParams = new ArrayList();
          MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.skillCode");
          oParams.add(oMessageKey);
          oParams.add(new Integer(count));
          oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.uniqueKeyViolated", oParams, "E"));
        } 
      } 
      count++;
    } 
  }
  
  private void checkUniqueWorkDtl(ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
    int count = 1;
    Iterator oIt1 = oDetailBeanArray.iterator();
    while (oIt1.hasNext()) {
      HrmRecAdvAttrWorkExpDtlBean oHrmRecAdvAttrWorkExpDtlBean = oIt1.next();
      String sQuery = String.valueOf(String.valueOf(String.valueOf(String.valueOf(" Select id as ID from HRM_ADVT_WORK_EXP where designation_id= '").concat(String.valueOf(oHrmRecAdvAttrWorkExpDtlBean.getWorkId()))).concat(String.valueOf("' and adt_dt_id='"))).concat(String.valueOf(oHrmRecAdvAttrWorkExpDtlBean.getHdnPrevDtlId()))).concat(String.valueOf("'"));
      System.out.println(sQuery);
      DBUtilitiesBean oBean = new DBUtilitiesBean();
      ArrayList oList = oBean.executeQuery(sQuery);
      Iterator oIt = oList.iterator();
      if (oIt.hasNext()) {
        QueryRow oRow = oIt.next();
        if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmRecAdvAttrWorkExpDtlBean.getDetailId())) {
          ArrayList oParams = new ArrayList();
          MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.reqExp");
          oParams.add(oMessageKey);
          oParams.add(new Integer(count));
          oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.uniqueKeyViolated", oParams, "E"));
        } 
      } 
      count++;
    } 
  }
  
  private void checkNumericWorkDtl(ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
    int count = 1;
    Iterator oIt1 = oDetailBeanArray.iterator();
    while (oIt1.hasNext()) {
      HrmRecAdvAttrWorkExpDtlBean oHrmRecAdvAttrWorkExpDtlBean = oIt1.next();
      if (!oHrmRecAdvAttrWorkExpDtlBean.getTxtMinWrkExp().equalsIgnoreCase("")) {
        MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.minWrkExp");
        ArrayList oParam = new ArrayList();
        oParam.add(oMessageKey);
        oParam.add(new Integer(count));
        if (!EnrgiseUtil.checkNumber(oHrmRecAdvAttrWorkExpDtlBean.getTxtMinWrkExp(), 3, 2, "P")) {
          oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.invalidNumber", oParam));
        } else if (Double.parseDouble(oHrmRecAdvAttrWorkExpDtlBean.getTxtMinWrkExp()) <= false) {
          oErrorList.add(new EnrgiseMessageKeyException("hrm.recadvattrwork.numberZero", oParam));
        } 
      } 
      if (!oHrmRecAdvAttrWorkExpDtlBean.getTxtMaxWrkExp().equalsIgnoreCase("")) {
        MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.maxWrkExp");
        ArrayList oParam = new ArrayList();
        oParam.add(oMessageKey);
        oParam.add(new Integer(count));
        if (!EnrgiseUtil.checkNumber(oHrmRecAdvAttrWorkExpDtlBean.getTxtMaxWrkExp(), 3, 2, "P")) {
          oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.invalidNumber", oParam));
        } else if (Double.parseDouble(oHrmRecAdvAttrWorkExpDtlBean.getTxtMaxWrkExp()) <= false) {
          oErrorList.add(new EnrgiseMessageKeyException("hrm.recadvattrwork.numberZero", oParam));
        } 
      } 
      if (!oHrmRecAdvAttrWorkExpDtlBean.getTxtMaxWrkExp().equalsIgnoreCase("")) {
        ArrayList oParam = new ArrayList();
        oParam.add(new Integer(count));
        if (Double.parseDouble(oHrmRecAdvAttrWorkExpDtlBean.getTxtMinWrkExp()) > Double.parseDouble(oHrmRecAdvAttrWorkExpDtlBean.getTxtMaxWrkExp()))
          oErrorList.add(new EnrgiseMessageKeyException("hrm.recadvattrwork.minmaxworkexp", oParam)); 
      } 
      count++;
    } 
    reportError(oErrorList);
  }
  
  private void checkNumericLocationDtl(ArrayList oDetailBeanArray, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
    int count = 1;
    Iterator oIt1 = oDetailBeanArray.iterator();
    while (oIt1.hasNext()) {
      HrmRecAdvAttrLocVacencyDtlBean oHrmRecAdvAttrLocVacencyDtlBean = oIt1.next();
      if (!oHrmRecAdvAttrLocVacencyDtlBean.getTxtNoOfVacancy().equalsIgnoreCase("")) {
        MessageKey oMessageKey = new MessageKey("hrm.HrmAdvertisementAttribute.noOfVacancy");
        ArrayList oParam = new ArrayList();
        oParam.add(oMessageKey);
        oParam.add(new Integer(count));
        if (!EnrgiseUtil.checkNumber(oHrmRecAdvAttrLocVacencyDtlBean.getTxtNoOfVacancy(), 4, 0, "P")) {
          oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.invalidNumber", oParam));
        } else if (Double.parseDouble(oHrmRecAdvAttrLocVacencyDtlBean.getTxtNoOfVacancy()) <= false) {
          oErrorList.add(new EnrgiseMessageKeyException("hrm.recadvattrwork.numberZero", oParam));
        } 
      } 
      count++;
    } 
    reportError(oErrorList);
  }
  
  public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
  
  public LovVO getHrmRecAttrRefLOVData(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
    String sQuery = "SELECT distinct hah.id,hah.ref_no  from hrm_advt_hdr hah   ";
    if (oLovQueryVO.getSearchField1() != null)
      sQuery = String.valueOf(String.valueOf(String.valueOf(sQuery).concat(String.valueOf(" where upper(hah.ref_no) LIKE upper('%"))).concat(String.valueOf(oLovQueryVO.getSearchField1()))).concat(String.valueOf("%') ")); 
    System.out.println(sQuery);
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    ArrayList oList = oBean.executeQuery(sQuery);
    LovVO oLovVO = new LovVO();
    ArrayList oHeaderList = new ArrayList();
    oHeaderList.add("hrm.HrmAdvertisementAttribute.id");
    oHeaderList.add("hrm.HrmAdvertisementAttribute.refNo");
    oLovVO.setHeaderList(oHeaderList);
    ArrayList arylstVisibility = new ArrayList();
    arylstVisibility.add("H");
    arylstVisibility.add("V");
    oLovVO.setVisibilityList(arylstVisibility);
    int count = 0;
    QueryRow oRow = null;
    Iterator oIt = oList.iterator();
    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 getHrmRecAttrPositionLOVData(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
    LovVO oLovVO = new LovVO();
    ArrayList oHeaderList = new ArrayList();
    oHeaderList.add("hrm.HrmAdvertisementAttribute.id");
    oHeaderList.add("hrm.HrmAdvertisementAttribute.grade");
    oHeaderList.add("hrm.HrmAdvertisementAttribute.design");
    oLovVO.setHeaderList(oHeaderList);
    ArrayList arylstVisibility = new ArrayList();
    arylstVisibility.add("H");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    oLovVO.setVisibilityList(arylstVisibility);
    int iCount = 0;
    ArrayList arylstParameters = new ArrayList();
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    String sQuerySearch1 = new String();
    String sQuerySearch2 = new String();
    String sRefNo = new String();
    if (oLovQueryVO.getSearchField1() != null)
      sQuerySearch1 = oLovQueryVO.getSearchField1(); 
    if (oLovQueryVO.getSearchField2() != null)
      sQuerySearch2 = oLovQueryVO.getSearchField2(); 
    if (oLovQueryVO.getProperty("RefNo") != null)
      sRefNo = oLovQueryVO.getProperty("RefNo"); 
    arylstParameters = new ArrayList();
    arylstParameters.add(new DBObject(1, 1, 12, sQuerySearch1));
    arylstParameters.add(new DBObject(2, 1, 12, sQuerySearch2));
    arylstParameters.add(new DBObject(3, 1, 12, sRefNo));
    arylstParameters.add(new DBObject(4, 2, -10));
    arylstParameters.add(new DBObject(5, 2, 12));
    arylstParameters.add(new DBObject(6, 2, 12));
    arylstParameters.add(new DBObject(7, 2, 4));
    ArrayList arylstOutArray = oBean.callProc(arylstParameters, "HRMRECADVATTRDTL.procGetGradeDesigLOV(?,?,?,?,?,?,?)");
    DBObject oOutObject = arylstOutArray.get(0);
    ArrayList arylstList = (ArrayList)oOutObject.getObject();
    QueryRow oRow = null;
    Iterator iter = arylstList.iterator();
    while (iter.hasNext()) {
      if (iCount == 0)
        arylstList = new ArrayList(); 
      iCount++;
      oRow = iter.next();
      LOVBean oLOVBean = new LOVBean();
      oLOVBean.setDetailField1(oRow.get("id").getString());
      oLOVBean.setDetailField2(oRow.get("acatcode").getString());
      oLOVBean.setDetailField3(oRow.get("category").getString());
      arylstList.add(oLOVBean);
    } 
    oLovVO.setDetailList(arylstList);
    return oLovVO;
  }
}
