package wenrgise.workflow.ejb.facade;

import java.sql.Timestamp;
import java.util.ArrayList;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import wenrgise.common.bean.BaseHeaderBean;
import wenrgise.common.exception.EnrgiseApplicationException;
import wenrgise.common.exception.EnrgiseSystemException;
import wenrgise.common.utility.RecordMetaInfo;
import wenrgise.common.utility.UserInfo;
import wenrgise.workflow.ejb.business.WflActivityMstBO;

public class WflActivityMstFacadeBean implements SessionBean {
  SessionContext ctx;
  
  public void ejbCreate() {}
  
  public void ejbActivate() {}
  
  public void ejbPassivate() {}
  
  public void ejbRemove() {}
  
  public void setSessionContext(SessionContext ctx) {
    this.ctx = ctx;
  }
  
  public RecordMetaInfo getWflActivityDtlMetaInfo(UserInfo oUserInfo) throws EnrgiseApplicationException, EnrgiseSystemException {
    WflActivityMstBO oWflActivityMstBO = new WflActivityMstBO(oUserInfo);
    return oWflActivityMstBO.getWflActivityDtlMetaInfo();
  }
  
  public ArrayList getWflActivityDtlInfo(long lStartPosition, long lLastPosition, UserInfo oUserInfo) throws EnrgiseApplicationException, EnrgiseSystemException {
    WflActivityMstBO oWflActivityMstBO = new WflActivityMstBO(oUserInfo);
    return oWflActivityMstBO.getWflActivityDtlInfo(lStartPosition, lLastPosition);
  }
  
  public String saveWflActivityDtls(BaseHeaderBean oBaseHeaderBean, Timestamp oWhenPicked, String sScreenName, String sScreenMode, boolean bHeaderDataChanged, ArrayList oDetailBeanArray, boolean bDetailDataChanged, Timestamp oDetailPicked, UserInfo oUserInfo) throws EnrgiseApplicationException, EnrgiseSystemException {
    try {
      WflActivityMstBO oWflActivityMstBO = new WflActivityMstBO(oUserInfo);
      return oWflActivityMstBO.saveData(oBaseHeaderBean, oWhenPicked, sScreenName, sScreenMode, bHeaderDataChanged, oDetailBeanArray, bDetailDataChanged, oDetailPicked);
    } catch (EnrgiseSystemException oSysEx) {
      this.ctx.setRollbackOnly();
      throw oSysEx;
    } catch (EnrgiseApplicationException oAppEx) {
      this.ctx.setRollbackOnly();
      throw oAppEx;
    } 
  }
}
