package WEB-INF.classes.wenrgise.hrms.businessdelegate;

import java.rmi.RemoteException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.ejb.CreateException;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.utility.RecordMetaInfo;
import wenrgise.common.utility.ServiceLocator;
import wenrgise.common.vo.BaseQueryVO;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.hrms.bean.HrmRecEmpRecCreationHdrBean;
import wenrgise.hrms.businessdelegate.HrmBaseBD;
import wenrgise.hrms.ejb.facade.HrmSecondFacade;
import wenrgise.hrms.ejb.facade.HrmSecondFacadeHome;
import wenrgise.hrms.vo.HrmRecEmpRecCreationQVO;

public class HrmRecEmpRecCreationBD extends HrmBaseBD {
  public RecordMetaInfo getHeaderMetaImpl(BaseQueryVO oQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
    try {
      HrmSecondFacadeHome oHome = (HrmSecondFacadeHome)ServiceLocator.getLocator().getService("HrmSecondFacade");
      HrmSecondFacade oHrmSecondFacade = oHome.create();
      return oHrmSecondFacade.getHrmEmpRecCrtnHdrMetaInfo((HrmRecEmpRecCreationQVO)oQueryVO);
    } catch (RemoteException oRe) {
      throw new EnrgiseSystemException(oRe);
    } catch (CreateException oCrt) {
      throw new EnrgiseSystemException(oCrt);
    } 
  }
  
  public ArrayList getHeaderRecordImpl(BaseQueryVO oQueryVO, long lStartPosition, long lLastPosition) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
    try {
      HrmSecondFacadeHome oHome = (HrmSecondFacadeHome)ServiceLocator.getLocator().getService("HrmSecondFacade");
      HrmSecondFacade oHrmSecondFacade = oHome.create();
      ArrayList oHeaderList = oHrmSecondFacade.getHrmEmpRecCrtnHeaderInfo((HrmRecEmpRecCreationQVO)oQueryVO, lStartPosition, lLastPosition);
      return oHeaderList;
    } catch (RemoteException oRe) {
      throw new EnrgiseSystemException(oRe);
    } catch (CreateException oCrt) {
      throw new EnrgiseSystemException(oCrt);
    } 
  }
  
  public boolean updateHeaderRecordImpl(BaseHeaderBean oBaseHeaderBean) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
    return true;
  }
  
  public String saveImpl(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
    try {
      HrmSecondFacadeHome oHome = (HrmSecondFacadeHome)ServiceLocator.getLocator().getService("HrmSecondFacade");
      HrmSecondFacade oHrmSecondFacade = oHome.create();
      return oHrmSecondFacade.saveData((HrmRecEmpRecCreationHdrBean)oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, oDetailBeanArray, bDetailDataChanged, oDetailPicked, this.oUserInfo);
    } catch (CreateException oCrtExcep) {
      throw new EnrgiseSystemException(oCrtExcep);
    } 
  }
  
  public String getInsertDataImpl(BaseQueryVO oQueryVO) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
    return "Only Implementation";
  }
  
  public RecordMetaInfo getTotalDetailRecordCountImpl(String lPrimaryKey, String sScreenName) throws EnrgiseApplicationException, EnrgiseSystemException {
    RecordMetaInfo oRecordMetaInfo = null;
    return oRecordMetaInfo;
  }
  
  public ArrayList getDetailRecordImpl(String lPrimaryKey, String sScreenName, long lAbsoluteStart, long lAbsoluteEnd) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
    ArrayList oRet = null;
    return oRet;
  }
  
  public Map getDisabledFieldsImpl(ThisPageVO oThisPageVO) throws EnrgiseApplicationException, EnrgiseSystemException {
    HashMap oHashMap = new HashMap();
    ArrayList arylstEnableList = new ArrayList();
    ArrayList arylstDisableList = new ArrayList();
    HrmRecEmpRecCreationHdrBean oHrmRecEmpRecCreationHdrBean = (HrmRecEmpRecCreationHdrBean)oThisPageVO.getOHeaderBean();
    ArrayList oList = oThisPageVO.getODetailList();
    if (oThisPageVO.getScreenMode().equals("Q")) {
      arylstEnableList.add("butApplicationNo");
      arylstDisableList.add("butCountryOfficeAddress");
      arylstDisableList.add("butStateOfficeAddress");
      arylstDisableList.add("butAppointmentOrderDate");
      arylstDisableList.add("butCompanyJoiningDate");
      arylstDisableList.add("butLocationJoiningDate");
      arylstDisableList.add("butTentativeConfirmDate");
      arylstDisableList.add("butBaseSite");
      arylstDisableList.add("butGrade");
      arylstDisableList.add("butDesignation");
      arylstDisableList.add("butJoiningGroup");
      arylstDisableList.add("officeAddress");
      arylstDisableList.add("cityOfficeAddress");
      arylstDisableList.add("pinCodeOfficeAddress");
      arylstDisableList.add("appointmentOrder");
      arylstDisableList.add("phoneOfficeAddress");
      arylstDisableList.add("employeeType");
    } 
    if (oThisPageVO.getScreenMode().equals("U")) {
      arylstDisableList.add("butApplicationNo");
      arylstEnableList.add("butCountryOfficeAddress");
      arylstEnableList.add("butStateOfficeAddress");
      arylstEnableList.add("butAppointmentOrderDate");
      arylstEnableList.add("butCompanyJoiningDate");
      arylstEnableList.add("butLocationJoiningDate");
      arylstEnableList.add("butTentativeConfirmDate");
      arylstEnableList.add("butBaseSite");
      arylstEnableList.add("butGrade");
      arylstEnableList.add("butDesignation");
      arylstEnableList.add("butJoiningGroup");
      arylstEnableList.add("officeAddress");
      arylstEnableList.add("cityOfficeAddress");
      arylstEnableList.add("pinCodeOfficeAddress");
      arylstEnableList.add("appointmentOrder");
      arylstEnableList.add("phoneOfficeAddress");
      arylstEnableList.add("employeeType");
    } 
    if (oThisPageVO.getScreenMode().equals("N")) {
      arylstDisableList.add("butApplicationNo");
      arylstDisableList.add("butCountryOfficeAddress");
      arylstDisableList.add("butStateOfficeAddress");
      arylstDisableList.add("butAppointmentOrderDate");
      arylstDisableList.add("butCompanyJoiningDate");
      arylstDisableList.add("butLocationJoiningDate");
      arylstDisableList.add("butTentativeConfirmDate");
      arylstDisableList.add("butBaseSite");
      arylstDisableList.add("butGrade");
      arylstDisableList.add("butDesignation");
      arylstDisableList.add("butJoiningGroup");
      arylstDisableList.add("officeAddress");
      arylstDisableList.add("cityOfficeAddress");
      arylstDisableList.add("pinCodeOfficeAddress");
      arylstDisableList.add("appointmentOrder");
      arylstDisableList.add("phoneOfficeAddress");
      arylstDisableList.add("employeeType");
    } 
    oHashMap.put("D", arylstDisableList);
    oHashMap.put("E", arylstEnableList);
    return oHashMap;
  }
  
  public String submitImpl(String sButtonName, BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
    return new String("");
  }
}
