package wenrgise.hrms.businessdelegate; import java.lang.reflect.InvocationTargetException; import java.rmi.RemoteException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.ejb.CreateException; import org.apache.commons.beanutils.BeanUtils; import wenrgise.common.bean.BaseHeaderBean; import wenrgise.common.exception.EnrgiseApplicationException; import wenrgise.common.exception.EnrgiseSystemException; import wenrgise.common.utility.EnrgiseUtil; 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.HrmEmpClaimDtlBean; import wenrgise.hrms.bean.HrmEmpClaimHdrBean; import wenrgise.hrms.ejb.facade.HrmFacade; import wenrgise.hrms.ejb.facade.HrmFacadeHome; import wenrgise.hrms.vo.HrmEmpClaimQVO; public class HrmEmpClaimBD extends HrmBaseBD { public RecordMetaInfo getHeaderMetaImpl(BaseQueryVO oQueryVO) throws EnrgiseApplicationException, EnrgiseSystemException { RecordMetaInfo oInfo = new RecordMetaInfo(); try { HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade"); HrmFacade oHrmFacade = oHome.create(); oInfo.setRecordCount(1L); oInfo.setOWhenPicked(null); return null; } 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 { ArrayList oHeaderList = null; HrmEmpClaimQVO oVo = (HrmEmpClaimQVO)oQueryVO; HrmEmpClaimHdrBean oBean = new HrmEmpClaimHdrBean(); BeanUtils.copyProperties(oBean, oVo); oHeaderList.add(oBean); return oHeaderList; } catch (InvocationTargetException oEx) { throw new EnrgiseSystemException(oEx); } catch (IllegalAccessException oEx) { throw new EnrgiseSystemException(oEx); } } public RecordMetaInfo getTotalDetailRecordCountImpl(String lPrimaryKey, String sScreenName) throws EnrgiseApplicationException, EnrgiseSystemException { return null; } public RecordMetaInfo getTotalDetailRecordCountImpl(BaseQueryVO oQVO, String sScreenName) throws EnrgiseApplicationException, EnrgiseSystemException { try { HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade"); HrmFacade oHrmFacade = oHome.create(); return oHrmFacade.getHrmEmpClaimDetailMetaInfo((HrmEmpClaimQVO)oQVO); } catch (RemoteException oRe) { throw new EnrgiseSystemException(oRe); } catch (CreateException oCrt) { throw new EnrgiseSystemException(oCrt); } } public ArrayList getDetailRecordImpl(String lPrimaryKey, String sScreenName, long lAbsoluteStart, long lAbsoluteEnd) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException { return null; } public ArrayList getDetailRecordImpl(BaseQueryVO oQVO, String sScreenName, long lAbsoluteStart, long lAbsoluteEnd) throws RemoteException, EnrgiseApplicationException, EnrgiseSystemException { try { HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade"); HrmFacade oHrmFacade = oHome.create(); return oHrmFacade.getHrmEmpClaimDetailInfo((HrmEmpClaimQVO)oQVO, lAbsoluteStart, lAbsoluteEnd); } 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 { HrmFacadeHome oHome = (HrmFacadeHome)ServiceLocator.getLocator().getService("HrmFacade"); HrmFacade oHrmFacade = oHome.create(); return oHrmFacade.saveHrmEmpClaim(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 Map getDisabledFieldsImpl(ThisPageVO oThisPageVO) throws EnrgiseApplicationException, EnrgiseSystemException { HashMap oHashMap = new HashMap(); ArrayList arylstEnab = new ArrayList(); ArrayList arylstDisab = new ArrayList(); HrmEmpClaimHdrBean oHrmEmpClaimHdrBean = (HrmEmpClaimHdrBean)oThisPageVO.getOHeaderBean(); ArrayList oList = oThisPageVO.getODetailList(); arylstEnab.add("butSave"); arylstEnab.add("butQuery"); arylstDisab.add("butExecute"); arylstDisab.add("butDelete"); arylstDisab.add("butInsert"); arylstDisab.add("butDelRow"); if (oThisPageVO.getScreenMode().equals("U")) { arylstDisab.add("butGetDetail"); arylstDisab.add("butStartDate"); arylstDisab.add("butEndDate"); arylstDisab.add("butClaimNo"); arylstDisab.add("butEmpNo"); arylstDisab.add("butClaimCode"); } else if (oThisPageVO.getScreenMode().equals("Q")) { if (EnrgiseUtil.checkString(oHrmEmpClaimHdrBean.getPeriod())) { arylstEnab.add("butGetDetail"); } else { arylstDisab.add("butGetDetail"); } } oHashMap.put("E", arylstEnab); oHashMap.put("D", arylstDisab); 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(""); } public void onLoadAction(ThisPageVO oThisPageVO) { ArrayList oList = oThisPageVO.getODetailList(); if (oList != null) { Iterator oIt = oList.iterator(); while (oIt.hasNext()) { HrmEmpClaimDtlBean oHrmEmpClaimDtlBean = oIt.next(); oHrmEmpClaimDtlBean.setTxtRemarks(oHrmEmpClaimDtlBean.getTxtNewRemarks()); } } } }