package wenrgise.hrms.ejb.business;

import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.bean.LOVBean;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseMessageKeyException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.utility.DateUtility;
import wenrgise.common.utility.EnrgiseUtil;
import wenrgise.common.utility.MessageKey;
import wenrgise.common.utility.RecordMetaInfo;
import wenrgise.common.utility.UserInfo;
import wenrgise.common.vo.BaseDetailVO;
import wenrgise.common.vo.BaseHeaderVO;
import wenrgise.common.vo.LovQueryVO;
import wenrgise.common.vo.LovVO;
import wenrgise.ejb.common.helper.DBObject;
import wenrgise.ejb.common.helper.QueryRow;
import wenrgise.ejb.common.helper.QueryValue;
import wenrgise.ejb.common.utility.DBUtilitiesBean;
import wenrgise.hrms.bean.HrmSepApplnDtlBean;
import wenrgise.hrms.bean.HrmSepApplnHdrBean;
import wenrgise.hrms.vo.HrmSepApplnQVO;

public class HrmSepApplnBO extends HrmBaseBO {
  public HrmSepApplnBO() {}
  
  public HrmSepApplnBO(UserInfo oUserInfo) {
    super(oUserInfo);
  }
  
  public RecordMetaInfo getHrmSepApplnHdrMetaInfo(HrmSepApplnQVO oHrmSepApplnQVO) throws EnrgiseApplicationException, EnrgiseSystemException {
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    arylstParam = new ArrayList();
    arylstParam.add(new DBObject(1, 1, 12, oHrmSepApplnQVO.getHeaderPrimaryKey()));
    arylstParam.add(new DBObject(2, 1, 12, oHrmSepApplnQVO.getApplicationNo()));
    arylstParam.add(new DBObject(3, 1, 12, oHrmSepApplnQVO.getEmpId()));
    arylstParam.add(new DBObject(4, 2, -5));
    arylstParam.add(new DBObject(5, 2, 93));
    arylstParam.add(new DBObject(6, 2, 12));
    arylstParam.add(new DBObject(7, 2, 12));
    arylstParam.add(new DBObject(8, 2, 4));
    ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMSEPAPPLN.proc_HrSepApplnHdrCount(?,?,?,?,?,?,?,?)");
    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 getHrmSepApplnHeaderInfo(HrmSepApplnQVO oHrmSepApplnQVO, long lStartPosition, long lLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    Timestamp oWhenPicked = null;
    int count = 0;
    BaseHeaderVO oBaseHeaderVO = new BaseHeaderVO();
    ArrayList arylstHeaderList = null;
    if (oHrmSepApplnQVO == null)
      oHrmSepApplnQVO = new HrmSepApplnQVO(); 
    arylstParam = new ArrayList();
    arylstParam.add(new DBObject(1, 1, -5, new Long(lStartPosition)));
    arylstParam.add(new DBObject(2, 1, -5, new Long(lLastPosition)));
    arylstParam.add(new DBObject(3, 1, 12, oHrmSepApplnQVO.getHeaderPrimaryKey()));
    arylstParam.add(new DBObject(4, 1, 12, oHrmSepApplnQVO.getApplicationNo()));
    arylstParam.add(new DBObject(5, 1, 12, oHrmSepApplnQVO.getEmpId()));
    arylstParam.add(new DBObject(6, 2, -10));
    arylstParam.add(new DBObject(7, 2, 12));
    arylstParam.add(new DBObject(8, 2, 12));
    arylstParam.add(new DBObject(9, 2, 4));
    ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMSEPAPPLN.proc_HrSepApplnHdr(?,?,?,?,?,?,?,?,?)");
    DBObject oOutObject = arylstOutArray.get(0);
    ArrayList arylstList = (ArrayList)oOutObject.getObject();
    if (arylstList.size() == 0)
      throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M"); 
    QueryRow oRow = null;
    HashMap oColumns = null;
    Iterator itrBean = arylstList.iterator();
    while (itrBean.hasNext()) {
      if (count == 0)
        arylstHeaderList = new ArrayList(); 
      count++;
      oRow = itrBean.next();
      HrmSepApplnHdrBean oSepAppln = new HrmSepApplnHdrBean();
      oSepAppln.setHeaderPrimaryKey(oRow.get("ID").getString());
      oSepAppln.setApplicationNo(oRow.get("APPLICATION_NO").getString());
      oSepAppln.setDateApplied(EnrgiseUtil.convertToString(oRow.get("APPLICATION_DATE").getDate()));
      oSepAppln.setInitiatedBy(oRow.get("INITIATED_BY").getString());
      oSepAppln.setEmpId(oRow.get("E_PER_DTL_ID").getString());
      oSepAppln.setEmployeeNo(oRow.get("emp_no").getString());
      oSepAppln.setFirstName(oRow.get("first_name").getString());
      oSepAppln.setMiddleName(oRow.get("middle_name").getString());
      oSepAppln.setLastName(oRow.get("last_name").getString());
      oSepAppln.setLocation(oRow.get("location").getString());
      oSepAppln.setGrade(oRow.get("grade").getString());
      oSepAppln.setDesignation(oRow.get("designation").getString());
      oSepAppln.setSepCat(oRow.get("sepCat").getString());
      if (oRow.get("IMMEDIATE_EFFECT").getString().equalsIgnoreCase("Y")) {
        oSepAppln.setImEffect("on");
      } else {
        oSepAppln.setImEffect("off");
      } 
      if (oRow.get("WITHDRAW_FLAG").getString().equalsIgnoreCase("Y")) {
        oSepAppln.setWithFlag("on");
      } else {
        oSepAppln.setWithFlag("off");
      } 
      oSepAppln.setReqSepDate(EnrgiseUtil.convertToString(oRow.get("REQUESTED_SEP_DATE").getDate()));
      oSepAppln.setActSepDate(EnrgiseUtil.convertToString(oRow.get("ACTUAL_SEP_DATE").getDate()));
      oSepAppln.setReason(oRow.get("REASON").getString());
      arylstHeaderList.add(oSepAppln);
    } 
    return arylstHeaderList;
  }
  
  public void updateHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {}
  
  public String saveNewHeaderImpl(BaseHeaderBean oBaseHeaderBean) throws EnrgiseSystemException {
    return new String();
  }
  
  public void additionalTimestampValidationImpl(BaseHeaderBean param1, Timestamp param2, String param3, String param4, boolean param5, ArrayList param6, boolean param7, Timestamp param8) {}
  
  public RecordMetaInfo getHrmSepApplnDtlMetaInfo(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, "HRMSEPAPPLN.proc_HrSepApplnDtlCount(?,?,?,?,?,?)");
    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 getHrmSepApplnDetailInfo(String lPrimaryKey, long lDetailFirstPosition, long lDetailLastPosition) throws EnrgiseApplicationException, EnrgiseSystemException {
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    int count = 0;
    BaseDetailVO oBaseDetailVO = null;
    ArrayList arylstSepAppln = null;
    arylstParam = new ArrayList();
    arylstParam.add(new DBObject(1, 1, -5, new Long(lDetailFirstPosition)));
    arylstParam.add(new DBObject(2, 1, -5, new Long(lDetailLastPosition)));
    arylstParam.add(new DBObject(3, 1, 12, lPrimaryKey));
    arylstParam.add(new DBObject(4, 2, -10));
    arylstParam.add(new DBObject(5, 2, 12));
    arylstParam.add(new DBObject(6, 2, 12));
    arylstParam.add(new DBObject(7, 2, 4));
    ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMSEPAPPLN.proc_GetSepApplnDtl(?,?,?,?,?,?,?)");
    DBObject oOutObject = arylstOutArray.get(0);
    ArrayList arylstList = (ArrayList)oOutObject.getObject();
    if (arylstList.size() == 0)
      throw new EnrgiseApplicationException("wenrgise.hrms.norecordfound", "M"); 
    QueryRow oRow = null;
    QueryValue oValue = null;
    HashMap oColumns = null;
    Iterator itrBean = arylstList.iterator();
    while (itrBean.hasNext()) {
      if (count == 0)
        arylstSepAppln = new ArrayList(); 
      count++;
      oRow = itrBean.next();
      HrmSepApplnDtlBean oHrmSepApplnDtlBean = new HrmSepApplnDtlBean();
      oHrmSepApplnDtlBean.setDetailId(oRow.get("ID").getString());
      oHrmSepApplnDtlBean.setTxtEmployeeNo(oRow.get("EMP_NO").getString());
      oHrmSepApplnDtlBean.setTxtEmpId(oRow.get("EMP_ID").getString());
      oHrmSepApplnDtlBean.setTxtSepId(oRow.get("SEP_ID").getString());
      oHrmSepApplnDtlBean.setTxtEmployeeName(oRow.get("EMPNAME").getString());
      oHrmSepApplnDtlBean.setTxtSeparationCategory(oRow.get("DESCRIPTION").getString());
      String immEffectFlag = oRow.get("IMMEDIATE_EFFECT").getString();
      if (immEffectFlag.equalsIgnoreCase("null")) {
        immEffectFlag = "off";
      } else {
        if (immEffectFlag.equalsIgnoreCase("Y"))
          immEffectFlag = "on"; 
        if (immEffectFlag.equalsIgnoreCase("N"))
          immEffectFlag = "off"; 
      } 
      oHrmSepApplnDtlBean.setTxtImmediateEffect(immEffectFlag);
      oHrmSepApplnDtlBean.setTxtRequestedSepDate(EnrgiseUtil.convertToString(oRow.get("REQUESTED_SEP_DATE").getDate()));
      oHrmSepApplnDtlBean.setTxtActualSepDate(EnrgiseUtil.convertToString(oRow.get("ACTUAL_SEP_DATE").getDate()));
      oHrmSepApplnDtlBean.setTxtReason(oRow.get("REASON").getString());
      oHrmSepApplnDtlBean.setTxtRejectionRemarks(oRow.get("REJECTION_REMARK").getString());
      oHrmSepApplnDtlBean.setTxtApprovedFlag(oRow.get("APPROVED_FLAG").getString());
      String withDrawFlag = oRow.get("WITHDRAW_FLAG").getString();
      if (withDrawFlag.equalsIgnoreCase("null")) {
        withDrawFlag = "off";
      } else {
        if (withDrawFlag.equalsIgnoreCase("Y"))
          withDrawFlag = "on"; 
        if (withDrawFlag.equalsIgnoreCase("N"))
          withDrawFlag = "off"; 
      } 
      oHrmSepApplnDtlBean.setTxtWithdrawalFlag(withDrawFlag);
      arylstSepAppln.add(oHrmSepApplnDtlBean);
    } 
    return arylstSepAppln;
  }
  
  public LovVO getHrmSepApplnNoLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
    LovVO oLovVO = new LovVO();
    ArrayList arylstHeaderList = new ArrayList();
    arylstHeaderList.add("ID");
    arylstHeaderList.add("hrm.HrmSepApplication.applicationNo");
    oLovVO.setHeaderList(arylstHeaderList);
    ArrayList arylstVisibility = new ArrayList();
    arylstVisibility.add("H");
    arylstVisibility.add("V");
    oLovVO.setVisibilityList(arylstVisibility);
    int count = 0;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    String sQuerySearch1 = new String();
    if (oLovQueryVO.getSearchField1() != null)
      sQuerySearch1 = oLovQueryVO.getSearchField1(); 
    arylstParam = new ArrayList();
    arylstParam.add(new DBObject(1, 1, 12, sQuerySearch1));
    arylstParam.add(new DBObject(2, 2, -10));
    arylstParam.add(new DBObject(3, 2, 12));
    arylstParam.add(new DBObject(4, 2, 12));
    arylstParam.add(new DBObject(5, 2, 4));
    ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMSEPAPPLN.proc_GetHrmSepApplnNoLOVdata(?,?,?,?,?)");
    DBObject oOutObject = arylstOutArray.get(0);
    ArrayList arylstList = (ArrayList)oOutObject.getObject();
    QueryRow oRow = null;
    Iterator iter = arylstList.iterator();
    while (iter.hasNext()) {
      if (count == 0)
        arylstList = new ArrayList(); 
      count++;
      oRow = iter.next();
      LOVBean oLOVBean = new LOVBean();
      oLOVBean.setDetailField1(oRow.get("ID").getString());
      oLOVBean.setDetailField2(oRow.get("APPLICATION_NO").getString());
      arylstList.add(oLOVBean);
    } 
    oLovVO.setDetailList(arylstList);
    return oLovVO;
  }
  
  public LovVO getHrmSepCategoryLOVdata(LovQueryVO oLovQueryVO) throws EnrgiseSystemException {
    LovVO oLovVO = new LovVO();
    ArrayList arylstHeaderList = new ArrayList();
    arylstHeaderList.add("ID");
    arylstHeaderList.add("hrm.HrmSepApplication.sepName");
    oLovVO.setHeaderList(arylstHeaderList);
    ArrayList arylstVisibility = new ArrayList();
    arylstVisibility.add("H");
    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();
    String initBy = null;
    if (oLovQueryVO.getProperty("initiatedBy") != null)
      initBy = oLovQueryVO.getProperty("initiatedBy"); 
    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, 1, 12, initBy));
    arylstParam.add(new DBObject(4, 2, -10));
    arylstParam.add(new DBObject(5, 2, 12));
    arylstParam.add(new DBObject(6, 2, 12));
    arylstParam.add(new DBObject(7, 2, 4));
    ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMSEPAPPLN.proc_GetHrmSepCategoryLOVdata(?,?,?,?,?,?,?)");
    DBObject oOutObject = arylstOutArray.get(0);
    ArrayList arylstList = (ArrayList)oOutObject.getObject();
    QueryRow oRow = null;
    Iterator iter = arylstList.iterator();
    while (iter.hasNext()) {
      if (count == 0)
        arylstList = new ArrayList(); 
      count++;
      oRow = iter.next();
      LOVBean oLOVBean = new LOVBean();
      oLOVBean.setDetailField1(oRow.get("ID").getString());
      oLOVBean.setDetailField2(oRow.get("DESCRIPTION").getString());
      arylstList.add(oLOVBean);
    } 
    oLovVO.setDetailList(arylstList);
    return oLovVO;
  }
  
  public String saveHeaderImpl(BaseHeaderBean oBaseHeaderBean, String ScreenMode) throws EnrgiseSystemException {
    String returnString = null;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    DateUtility d = new DateUtility();
    HrmSepApplnHdrBean oHrmSepApplnHdrBean = (HrmSepApplnHdrBean)oBaseHeaderBean;
    if (ScreenMode.equalsIgnoreCase("N")) {
      arylstParam = new ArrayList();
      arylstParam.add(new DBObject(1, 1, 12, "i"));
      arylstParam.add(new DBObject(2, 1, 12, oHrmSepApplnHdrBean.getApplicationNo()));
      arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmSepApplnHdrBean.getDateApplied())));
      arylstParam.add(new DBObject(4, 1, 12, oHrmSepApplnHdrBean.getInitiatedBy()));
      arylstParam.add(new DBObject(5, 1, 12, oHrmSepApplnHdrBean.getEmpId()));
      arylstParam.add(new DBObject(6, 1, 12, oHrmSepApplnHdrBean.getSepCatId()));
      if (String.valueOf(oHrmSepApplnHdrBean.getImEffect()).equalsIgnoreCase("on")) {
        arylstParam.add(new DBObject(7, 1, 12, "Y"));
      } else {
        arylstParam.add(new DBObject(7, 1, 12, "N"));
      } 
      if (String.valueOf(oHrmSepApplnHdrBean.getWithFlag()).equalsIgnoreCase("on")) {
        arylstParam.add(new DBObject(8, 1, 12, "Y"));
      } else {
        arylstParam.add(new DBObject(8, 1, 12, "N"));
      } 
      arylstParam.add(new DBObject(9, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmSepApplnHdrBean.getReqSepDate())));
      arylstParam.add(new DBObject(10, 1, 12, oHrmSepApplnHdrBean.getReason()));
      arylstParam.add(new DBObject(11, 1, 12, this.oUserInfo.getUserTypeId()));
      arylstParam.add(new DBObject(12, 1, 12, this.oUserInfo.getSiteId()));
      arylstParam.add(new DBObject(13, 1, 12, null));
      arylstParam.add(new DBObject(14, 2, 12));
      arylstParam.add(new DBObject(15, 2, 12));
      arylstParam.add(new DBObject(16, 2, 12));
      arylstParam.add(new DBObject(17, 2, 4));
      ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMSEPAPPLN.proc_UpsertHrSepApplnHdr(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
      DBObject oOutObject = arylstOutArray.get(0);
      returnString = (String)oOutObject.getObject();
      System.out.println(returnString);
    } else if (ScreenMode.equalsIgnoreCase("U")) {
      arylstParam = new ArrayList();
      arylstParam.add(new DBObject(1, 1, 12, "u"));
      arylstParam.add(new DBObject(2, 1, 12, oHrmSepApplnHdrBean.getApplicationNo()));
      arylstParam.add(new DBObject(3, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmSepApplnHdrBean.getDateApplied())));
      arylstParam.add(new DBObject(4, 1, 12, oHrmSepApplnHdrBean.getInitiatedBy()));
      arylstParam.add(new DBObject(5, 1, 12, oHrmSepApplnHdrBean.getEmpId()));
      arylstParam.add(new DBObject(6, 1, 12, oHrmSepApplnHdrBean.getSepCatId()));
      if (String.valueOf(oHrmSepApplnHdrBean.getImEffect()).equalsIgnoreCase("on")) {
        arylstParam.add(new DBObject(7, 1, 12, "Y"));
      } else {
        arylstParam.add(new DBObject(7, 1, 12, "N"));
      } 
      if (String.valueOf(oHrmSepApplnHdrBean.getWithFlag()).equalsIgnoreCase("on")) {
        arylstParam.add(new DBObject(8, 1, 12, "Y"));
      } else {
        arylstParam.add(new DBObject(8, 1, 12, "N"));
      } 
      arylstParam.add(new DBObject(9, 1, 93, EnrgiseUtil.convertToSqlDate(oHrmSepApplnHdrBean.getReqSepDate())));
      arylstParam.add(new DBObject(10, 1, 12, oHrmSepApplnHdrBean.getReason()));
      arylstParam.add(new DBObject(11, 1, 12, this.oUserInfo.getUserTypeId()));
      arylstParam.add(new DBObject(12, 1, 12, this.oUserInfo.getSiteId()));
      arylstParam.add(new DBObject(13, 1, 12, null));
      arylstParam.add(new DBObject(14, 2, 12));
      arylstParam.add(new DBObject(15, 2, 12));
      arylstParam.add(new DBObject(16, 2, 12));
      arylstParam.add(new DBObject(17, 2, 4));
      ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMSEPAPPLN.proc_UpsertHrSepApplnHdr(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
      DBObject oOutObject = arylstOutArray.get(0);
      returnString = (String)oOutObject.getObject();
      System.out.println(returnString);
    } else if (ScreenMode.equalsIgnoreCase("D")) {
      arylstParam.add(new DBObject(1, 1, 12, oHrmSepApplnHdrBean.getHeaderPrimaryKey()));
      arylstParam.add(new DBObject(2, 2, 12));
      arylstParam.add(new DBObject(3, 2, 12));
      arylstParam.add(new DBObject(4, 2, 4));
      ArrayList arylstOutArray = oBean.callProc(arylstParam, "HRMSEPAPPLN.proc_DelHrSepApplnHdr(?,?,?,?)");
      DBObject oOutObject = arylstOutArray.get(0);
      returnString = null;
    } 
    return returnString;
  }
  
  public void initializeBOImpl() {
    this.headerTable = "HRM_EMP_SEP_HDR";
  }
  
  public void saveDetailImpl(String sHeaderPrimaryKey, String sScreenName, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
    if (sScreenName.equalsIgnoreCase("HrmSeparationAppln"))
      saveHrmSepAppln(sHeaderPrimaryKey, arylstDetailBeanArray); 
  }
  
  private void saveHrmSepAppln(String sHeaderPrimaryKey, ArrayList arylstDetailBeanArray) throws EnrgiseSystemException {
    boolean bInsert = false;
    boolean bUpdate = false;
    boolean bDelete = false;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = null;
    DBUtilitiesBean oBean1 = null;
    Iterator itrBean = arylstDetailBeanArray.iterator();
    while (itrBean.hasNext()) {
      HrmSepApplnDtlBean oHrmSepApplnDtlBean = itrBean.next();
      if (oHrmSepApplnDtlBean.getStatus().equals("N")) {
        if (!bInsert) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMSEPAPPLN.proc_UpsertHrSepApplnDtl(?,?,?,?,?,?,?,?,?,?,?,?,?)");
          bInsert = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, "I"));
        arylstParam.add(new DBObject(2, 1, 12, null));
        arylstParam.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
        arylstParam.add(new DBObject(4, 1, 12, oHrmSepApplnDtlBean.getTxtEmpId()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmSepApplnDtlBean.getTxtSepId()));
        String immediateEffect = String.valueOf(oHrmSepApplnDtlBean.getTxtImmediateEffect());
        if (immediateEffect.equalsIgnoreCase("on")) {
          immediateEffect = "Y";
        } else {
          immediateEffect = "N";
        } 
        arylstParam.add(new DBObject(6, 1, 12, immediateEffect));
        arylstParam.add(new DBObject(7, 1, 12, oHrmSepApplnDtlBean.getTxtRequestedSepDate()));
        arylstParam.add(new DBObject(8, 1, 12, oHrmSepApplnDtlBean.getTxtActualSepDate()));
        arylstParam.add(new DBObject(9, 1, 12, oHrmSepApplnDtlBean.getTxtReason()));
        arylstParam.add(new DBObject(10, 1, 12, oHrmSepApplnDtlBean.getTxtRejectionRemarks()));
        String withdrawFlag = String.valueOf(oHrmSepApplnDtlBean.getTxtWithdrawalFlag());
        if (withdrawFlag.equalsIgnoreCase("on")) {
          withdrawFlag = "Y";
        } else {
          withdrawFlag = "N";
        } 
        arylstParam.add(new DBObject(11, 1, 12, withdrawFlag));
        arylstParam.add(new DBObject(12, 1, 12, this.oUserInfo.getUserTypeId()));
        arylstParam.add(new DBObject(13, 1, 12, this.oUserInfo.getSiteId()));
        oBean.addToBatch(arylstParam);
        continue;
      } 
      if (oHrmSepApplnDtlBean.getStatus().equals("U")) {
        if (!bUpdate) {
          oBean = new DBUtilitiesBean();
          oBean.createBatch("HRMSEPAPPLN.proc_UpsertHrSepApplnDtl(?,?,?,?,?,?,?,?,?,?,?,?,?)");
          bUpdate = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, "U"));
        arylstParam.add(new DBObject(2, 1, 12, oHrmSepApplnDtlBean.getDetailId()));
        arylstParam.add(new DBObject(3, 1, 12, sHeaderPrimaryKey));
        arylstParam.add(new DBObject(4, 1, 12, oHrmSepApplnDtlBean.getTxtEmpId()));
        arylstParam.add(new DBObject(5, 1, 12, oHrmSepApplnDtlBean.getTxtSepId()));
        String immediateEffect = String.valueOf(oHrmSepApplnDtlBean.getTxtImmediateEffect());
        if (immediateEffect.equalsIgnoreCase("on")) {
          immediateEffect = "Y";
        } else {
          immediateEffect = "N";
        } 
        arylstParam.add(new DBObject(6, 1, 12, immediateEffect));
        arylstParam.add(new DBObject(7, 1, 12, oHrmSepApplnDtlBean.getTxtRequestedSepDate()));
        arylstParam.add(new DBObject(8, 1, 12, oHrmSepApplnDtlBean.getTxtActualSepDate()));
        arylstParam.add(new DBObject(9, 1, 12, oHrmSepApplnDtlBean.getTxtReason()));
        arylstParam.add(new DBObject(10, 1, 12, oHrmSepApplnDtlBean.getTxtRejectionRemarks()));
        String withdrawFlag = String.valueOf(oHrmSepApplnDtlBean.getTxtWithdrawalFlag());
        if (withdrawFlag.equalsIgnoreCase("on")) {
          withdrawFlag = "Y";
        } else {
          withdrawFlag = "N";
        } 
        arylstParam.add(new DBObject(11, 1, 12, withdrawFlag));
        arylstParam.add(new DBObject(12, 1, 12, this.oUserInfo.getUserTypeId()));
        arylstParam.add(new DBObject(13, 1, 12, this.oUserInfo.getSiteId()));
        oBean.addToBatch(arylstParam);
        continue;
      } 
      if (oHrmSepApplnDtlBean.getStatus().equals("D")) {
        if (!bDelete) {
          oBean1 = new DBUtilitiesBean();
          oBean1.createBatch("HRMSEPAPPLN.proc_DeleteHrSepApplnDtl(?)");
          bDelete = true;
        } 
        arylstParam = new ArrayList();
        arylstParam.add(new DBObject(1, 1, 12, oHrmSepApplnDtlBean.getDetailId()));
        oBean1.addToBatch(arylstParam);
      } 
    } 
    if (bInsert)
      oBean.executeBatch(); 
    if (bUpdate)
      oBean.executeBatch(); 
    if (bDelete)
      oBean1.executeBatch(); 
  }
  
  public void additionalFieldValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
    ArrayList arylstErrorList = new ArrayList();
    if (bHeaderDataChanged)
      if (!sScreenMode.equalsIgnoreCase("D"))
        checkMandatoryHeader((HrmSepApplnHdrBean)oBaseHeaderBean, arylstErrorList);  
    if (bDetailDataChanged)
      if (sScreenName.equalsIgnoreCase("HrmSeparationAppln")) {
        Iterator itrBean1 = arylstDetailBeanArray.iterator();
        int iCount = 1;
        while (itrBean1.hasNext()) {
          HrmSepApplnDtlBean oHrmSepApplnDtlBean = itrBean1.next();
          if (!oHrmSepApplnDtlBean.getStatus().equalsIgnoreCase("D")) {
            checkMandatory(oHrmSepApplnDtlBean, iCount, arylstErrorList);
            EnrgiseUtil.checkDuplicate(arylstDetailBeanArray, "txtEmployeeNo", "hrm.HrmSepApplication.employeeNo", arylstErrorList, true);
          } 
          iCount++;
        } 
      }  
    reportError(arylstErrorList);
  }
  
  private void checkMandatoryHeader(HrmSepApplnHdrBean oHrmSepApplnHdrBean, ArrayList oErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
    ArrayList oParams = new ArrayList();
    if (!EnrgiseUtil.checkString(oHrmSepApplnHdrBean.getApplicationNo())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmSepApplication.applicationNo");
      oParams = new ArrayList();
      oParams.add(oMessageKey);
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
    } 
    if (!EnrgiseUtil.checkString(oHrmSepApplnHdrBean.getInitiatedBy())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmSepApplication.initiatedBy");
      oParams = new ArrayList();
      oParams.add(oMessageKey);
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
    } 
    if (!EnrgiseUtil.checkString(oHrmSepApplnHdrBean.getEmpId())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmSepApplication.employeeNo");
      oParams = new ArrayList();
      oParams.add(oMessageKey);
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
    } 
    if (!EnrgiseUtil.checkString(oHrmSepApplnHdrBean.getSepCatId())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmSepApplication.sepCat");
      oParams = new ArrayList();
      oParams.add(oMessageKey);
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
    } 
    if (!EnrgiseUtil.checkString(oHrmSepApplnHdrBean.getDateApplied())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmSepApplication.dateApplied");
      oParams = new ArrayList();
      oParams.add(oMessageKey);
      oErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.header.mandatoryFieldMissing", oParams, "E"));
    } 
  }
  
  private void checkMandatory(HrmSepApplnDtlBean oHrmSepApplnDtlBean, int iCount, ArrayList arylstErrorList) throws EnrgiseSystemException, EnrgiseApplicationException {
    if (!EnrgiseUtil.checkString(oHrmSepApplnDtlBean.getTxtEmployeeNo())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmSepApplication.employeeNo");
      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(oHrmSepApplnDtlBean.getTxtSeparationCategory())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmSepApplication.separationCategory");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(String.valueOf(iCount));
      arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
    if (!EnrgiseUtil.checkString(oHrmSepApplnDtlBean.getTxtRequestedSepDate())) {
      MessageKey oMessageKey = new MessageKey("hrm.HrmSepApplication.requestedSepDate");
      ArrayList oParams = new ArrayList();
      oParams.add(oMessageKey);
      oParams.add(String.valueOf(iCount));
      arylstErrorList.add(new EnrgiseMessageKeyException("wenrgise.common.detail.mandatoryFieldMissing", oParams, "E"));
    } 
    reportError(arylstErrorList);
  }
  
  public void additionalBusinessValidationImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
    ArrayList arylstErrorList = new ArrayList();
    HrmSepApplnHdrBean oHrmSepApplnHdrBean = (HrmSepApplnHdrBean)oBaseHeaderBean;
    if (bHeaderDataChanged)
      if (!sScreenMode.equalsIgnoreCase("D")) {
        checkUniqueHeader((HrmSepApplnHdrBean)oBaseHeaderBean, arylstErrorList);
        checkDates((HrmSepApplnHdrBean)oBaseHeaderBean, arylstErrorList);
      }  
    if (bDetailDataChanged)
      if (sScreenName.equalsIgnoreCase("HrmSeparationAppln")); 
    reportError(arylstErrorList);
  }
  
  private void checkDates(HrmSepApplnHdrBean oHrmSepApplnHdrBean, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
    DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");
    if (EnrgiseUtil.checkString(oHrmSepApplnHdrBean.getReqSepDate())) {
      int dateFlag = EnrgiseUtil.compareDates(dateFormat, oHrmSepApplnHdrBean.getReqSepDate(), oHrmSepApplnHdrBean.getDateApplied());
      if (dateFlag == -1 && dateFlag != -2)
        oErrorList.add(new EnrgiseApplicationException("wenrgise.empSepAppl.dateConstraintViolated")); 
    } 
  }
  
  private void checkUniqueHeader(HrmSepApplnHdrBean oHrmSepApplnHdrBean, ArrayList oErrorList) throws EnrgiseApplicationException, EnrgiseSystemException {
    String sQuery = String.valueOf(String.valueOf(" Select ID as ID from HRM_EMP_SEP_HDR where APPLICATION_NO='").concat(String.valueOf(oHrmSepApplnHdrBean.getApplicationNo()))).concat(String.valueOf("'"));
    System.out.println(sQuery);
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    ArrayList arylstList = oBean.executeQuery(sQuery);
    Iterator itrBean = arylstList.iterator();
    if (itrBean.hasNext()) {
      QueryRow oRow = itrBean.next();
      if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmSepApplnHdrBean.getHeaderPrimaryKey())) {
        MessageKey oMessageKey = new MessageKey("hrm.HrmSepApplication.applicationNo");
        ArrayList oParams = new ArrayList();
        oParams.add(oMessageKey);
        oErrorList.add(new EnrgiseMessageKeyException("wenrgise.sepappln.uniqueConstraintViolated", oParams, "E"));
      } 
    } 
  }
  
  private void checkUniqueDtl(String sHeaderPrimaryKey, ArrayList arylstDetailBeanArray) throws EnrgiseApplicationException, EnrgiseSystemException {
    int count = 0;
    Iterator itrBean1 = arylstDetailBeanArray.iterator();
    while (itrBean1.hasNext()) {
      HrmSepApplnDtlBean oHrmSepApplnDtlBean = itrBean1.next();
      String sQuery = String.valueOf(String.valueOf(String.valueOf(" Select ID as ID from HRM_EMP_SEP_DTL where E_PER_DTL_ID= ").concat(String.valueOf(oHrmSepApplnDtlBean.getTxtEmpId()))).concat(String.valueOf(" and SEP_HDR_ID="))).concat(String.valueOf(sHeaderPrimaryKey));
      System.out.println(sQuery);
      DBUtilitiesBean oBean = new DBUtilitiesBean();
      ArrayList arylstList = oBean.executeQuery(sQuery);
      Iterator itrBean = arylstList.iterator();
      if (itrBean.hasNext()) {
        QueryRow oRow = itrBean.next();
        if (!oRow.get("ID").getString().equalsIgnoreCase(oHrmSepApplnDtlBean.getDetailId()))
          throw new EnrgiseApplicationException("wenrgise.common.uniqueConstraintViolated", "M"); 
      } 
    } 
  }
  
  public String approveSepAppln(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
    ArrayList arylstParameters = new ArrayList();
    DBUtilitiesBean oBean = null;
    HrmSepApplnHdrBean oHrmSepApplnHdrBean = (HrmSepApplnHdrBean)oBaseHeaderBean;
    String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : "";
    oBean = new DBUtilitiesBean();
    oBean.createBatch("HRMSEPAPPLN.procApproveSepAppln(?)");
    Iterator itrDtlBean = arylstDetailBeanArray.iterator();
    int rowCount = 0;
    int n = arylstDetailBeanArray.size();
    while (itrDtlBean.hasNext()) {
      HrmSepApplnDtlBean oDtlBean = itrDtlBean.next();
      System.out.println(oDtlBean.getDetailId());
      if (oDtlBean.getStatus().equalsIgnoreCase("A"))
        arylstParameters.add(new DBObject(1, 1, 12, oDtlBean.getDetailId())); 
      if (!arylstParameters.isEmpty())
        oBean.addToBatch(arylstParameters); 
      if (rowCount < n)
        rowCount++; 
    } 
    oBean.executeBatch();
    return sHeaderPrimaryKey;
  }
  
  public String rejectSepAppln(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList arylstDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws EnrgiseApplicationException, EnrgiseSystemException {
    ArrayList arylstParameters = new ArrayList();
    DBUtilitiesBean oBean = null;
    HrmSepApplnHdrBean oHrmSepApplnHdrBean = (HrmSepApplnHdrBean)oBaseHeaderBean;
    String sHeaderPrimaryKey = (null != oBaseHeaderBean) ? oBaseHeaderBean.getHeaderPrimaryKey() : "";
    oBean = new DBUtilitiesBean();
    oBean.createBatch("HRMSEPAPPLN.procRejectSepAppln(?)");
    Iterator itrDtlBean = arylstDetailBeanArray.iterator();
    int rowCount = 1;
    int n = arylstDetailBeanArray.size();
    while (itrDtlBean.hasNext()) {
      HrmSepApplnDtlBean oDtlBean = itrDtlBean.next();
      System.out.println(oDtlBean.getDetailId());
      if (oDtlBean.getStatus().equalsIgnoreCase("R"))
        arylstParameters.add(new DBObject(1, 1, 12, oDtlBean.getDetailId())); 
      oBean.addToBatch(arylstParameters);
      if (rowCount < n)
        rowCount++; 
    } 
    oBean.executeBatch();
    return sHeaderPrimaryKey;
  }
  
  public LovVO getSepEmpNoQLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
    LovVO oLovVO = new LovVO();
    ArrayList oHeaderList = new ArrayList();
    ArrayList oList = new ArrayList();
    oHeaderList.add("id");
    oHeaderList.add("hrm.HrmSepApplication.employeeNo");
    oHeaderList.add("hrm.HrmSepApplication.firstName");
    oHeaderList.add("hrm.HrmSepApplication.middleName");
    oHeaderList.add("hrm.HrmSepApplication.lastName");
    oHeaderList.add("hrm.HrmSepApplication.grade");
    oHeaderList.add("hrm.HrmSepApplication.designation");
    oHeaderList.add("hrm.HrmSepApplication.location");
    oLovVO.setHeaderList(oHeaderList);
    ArrayList arylstVisibility = new ArrayList();
    arylstVisibility.add("H");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    oLovVO.setVisibilityList(arylstVisibility);
    int count = 0;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    String sQuerySearch1 = new String();
    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, "HRMSEPAPPLN.proc_GetHrmSepEmpNoQLOVdata(?,?,?,?,?,?)");
    DBObject oOutObject = arylstOutArray.get(0);
    ArrayList arylstList = (ArrayList)oOutObject.getObject();
    QueryRow oRow = null;
    Iterator oIt = arylstList.iterator();
    while (oIt.hasNext()) {
      oRow = oIt.next();
      LOVBean oLOVBean = new LOVBean();
      oLOVBean.setDetailField1(oRow.get("id").getString());
      oLOVBean.setDetailField2(oRow.get("emp_no").getString());
      oLOVBean.setDetailField3(oRow.get("first_name").getString());
      oLOVBean.setDetailField4(oRow.get("middle_name").getString());
      oLOVBean.setDetailField5(oRow.get("last_name").getString());
      oLOVBean.setDetailField6(oRow.get("grade").getString());
      oLOVBean.setDetailField7(oRow.get("designation").getString());
      oLOVBean.setDetailField8(oRow.get("location").getString());
      oList.add(oLOVBean);
    } 
    oLovVO.setDetailList(oList);
    return oLovVO;
  }
  
  public LovVO getSepEmpNoNLOVData(LovQueryVO oLovQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
    LovVO oLovVO = new LovVO();
    ArrayList oHeaderList = new ArrayList();
    ArrayList oList = new ArrayList();
    oHeaderList.add("id");
    oHeaderList.add("hrm.HrmSepApplication.employeeNo");
    oHeaderList.add("hrm.HrmSepApplication.firstName");
    oHeaderList.add("hrm.HrmSepApplication.middleName");
    oHeaderList.add("hrm.HrmSepApplication.lastName");
    oHeaderList.add("hrm.HrmSepApplication.grade");
    oHeaderList.add("hrm.HrmSepApplication.designation");
    oHeaderList.add("hrm.HrmSepApplication.location");
    oLovVO.setHeaderList(oHeaderList);
    ArrayList arylstVisibility = new ArrayList();
    arylstVisibility.add("H");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    arylstVisibility.add("V");
    oLovVO.setVisibilityList(arylstVisibility);
    int count = 0;
    ArrayList arylstParam = new ArrayList();
    DBUtilitiesBean oBean = new DBUtilitiesBean();
    String sQuerySearch1 = new String();
    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, "HRMSEPAPPLN.proc_GetHrmSepEmpNoLOVdata(?,?,?,?,?,?)");
    DBObject oOutObject = arylstOutArray.get(0);
    ArrayList arylstList = (ArrayList)oOutObject.getObject();
    QueryRow oRow = null;
    Iterator oIt = arylstList.iterator();
    while (oIt.hasNext()) {
      oRow = oIt.next();
      LOVBean oLOVBean = new LOVBean();
      oLOVBean.setDetailField1(oRow.get("id").getString());
      oLOVBean.setDetailField2(oRow.get("emp_no").getString());
      oLOVBean.setDetailField3(oRow.get("first_name").getString());
      oLOVBean.setDetailField4(oRow.get("middle_name").getString());
      oLOVBean.setDetailField5(oRow.get("last_name").getString());
      oLOVBean.setDetailField6(oRow.get("grade").getString());
      oLOVBean.setDetailField7(oRow.get("designation").getString());
      oLOVBean.setDetailField8(oRow.get("location").getString());
      oList.add(oLOVBean);
    } 
    oLovVO.setDetailList(oList);
    return oLovVO;
  }
}
