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.vo.BaseQueryVO;
import wenrgise.common.vo.ThisPageVO;
import wenrgise.ejb.common.utility.ServiceLocator;
import wenrgise.hrms.bean.HrmAttShiftMstHdrBean;
import wenrgise.hrms.businessdelegate.HrmBaseBD;
import wenrgise.hrms.ejb.facade.HrmSecondFacade;
import wenrgise.hrms.ejb.facade.HrmSecondFacadeHome;
import wenrgise.hrms.vo.HrmAttShiftMstQVO;

public class HrmAttShiftMstBD extends HrmBaseBD {
  public RecordMetaInfo getTotalDetailRecordCountImpl(String sPrimaryKey, String sScreenName) throws EnrgiseApplicationException, EnrgiseSystemException {
    return null;
  }
  
  public ArrayList getDetailRecordImpl(String sPrimaryKey, String sScreenName, long lAbsoluteStart, long lAbsoluteEnd) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
    return null;
  }
  
  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 oShiftAttMstFacade = oHome.create();
      return oShiftAttMstFacade.saveAttShiftMstData((HrmAttShiftMstHdrBean)oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, oDetailBeanArray, bDetailDataChanged, oDetailPicked, this.oUserInfo);
    } 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 RecordMetaInfo getHeaderMetaImpl(BaseQueryVO oQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException {
    try {
      HrmSecondFacadeHome oHome = (HrmSecondFacadeHome)ServiceLocator.getLocator().getService("HrmSecondFacade");
      HrmSecondFacade oShiftAttMstFacade = oHome.create();
      return oShiftAttMstFacade.getAttShiftMstHeaderMetaInfo((HrmAttShiftMstQVO)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 oShiftAttMstFacade = oHome.create();
      ArrayList oHeaderList = oShiftAttMstFacade.getAttShiftMstHeader((HrmAttShiftMstQVO)oQueryVO, lStartPosition, lLastPosition);
      return oHeaderList;
    } catch (RemoteException oRe) {
      throw new EnrgiseSystemException(oRe);
    } catch (CreateException oCrt) {
      throw new EnrgiseSystemException(oCrt);
    } 
  }
  
  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 null;
  }
  
  public String getInsertDataImpl(BaseQueryVO oBaseQueryVO) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException {
    return null;
  }
  
  public Map getDisabledFieldsImpl(ThisPageVO oThisPageVO) throws EnrgiseApplicationException, EnrgiseSystemException {
    HashMap oHashMap = new HashMap();
    ArrayList oEnableList = new ArrayList();
    ArrayList oDisableList = new ArrayList();
    oDisableList.add("butDelete");
    if (oThisPageVO.getScreenMode().equals("Q")) {
      oEnableList.add("butShiftCode");
      oDisableList.add("shiftCode");
      oDisableList.add("startTime");
      oDisableList.add("endTime");
      oDisableList.add("relaxationTime");
      oDisableList.add("startTolerenceTime");
      oDisableList.add("endTolerenceTime");
      oDisableList.add("overlapTime");
      oDisableList.add("txtDayOverlapFlag");
    } 
    if (oThisPageVO.getScreenMode().equals("U")) {
      oEnableList.add("butRefresh");
      oEnableList.add("butSave");
      oDisableList.add("butShiftCode");
      oDisableList.add("startTime");
      oDisableList.add("endTime");
      oDisableList.add("shiftCode");
      oEnableList.add("relaxationTime");
      oEnableList.add("startTolerenceTime");
      oEnableList.add("endTolerenceTime");
      oEnableList.add("overlapTime");
      oEnableList.add("txtDayOverlapFlag");
    } 
    if (oThisPageVO.getScreenMode().equals("N")) {
      oDisableList.add("butShiftCode");
      oEnableList.add("shiftCode");
      oEnableList.add("startTime");
      oEnableList.add("endTime");
      oEnableList.add("relaxationTime");
      oEnableList.add("startTolTime");
      oEnableList.add("endTolTime");
      oEnableList.add("overlapTime");
      oEnableList.add("overlapDayFlag");
    } 
    oHashMap.put("D", oDisableList);
    oHashMap.put("E", oEnableList);
    return oHashMap;
  }
}
