package com.eforce.baby.auth.delegates;
import org.apache.log4j.Logger;
import com.eforce.baby.auth.dao.NotificationAdminDAO;
import com.eforce.baby.auth.vo.NotificationAdminVO;
import com.eforce.baby.common.dao.DAOException;
import com.eforce.baby.common.delegates.BaseDelegate;
import com.eforce.baby.common.delegates.BusinessException;
import com.eforce.baby.common.factory.DAOFactory;
import com.eforce.baby.common.vo.PageInfoVO;
import com.eforce.baby.common.vo.SortInfoVO;
import com.eforce.baby.reports.vo.ReportResultsVO;
import com.eforce.baby.utils.IConstants;
public class NotificationAdminBD extends BaseDelegate {
private Logger log = (Logger) Logger.getInstance("com.eteam.ems.auth.dao.NotificationAdminBD");
/**
* This is called when Notification Queue listing to be displayed
* @param dsName
* @param dbType
* @param linkCol
* @param page
* @param sort
* @param userId
* @param profileRepId
* @return ReportResultsVO
* @throws DAOException
* @throws BusinessException
*/
public ReportResultsVO getNotificationByStatus(String dsName,String dbType,String linkCol,PageInfoVO page,SortInfoVO sort,String userId,String profileRepId)
throws DAOException, BusinessException {
log.debug("dsName: ["+ dsName+ "] "+ "dbType: ["+ dbType+ "] "+ "linkCol: ["+ linkCol+ "]"+ "startPos: ["
+ page.getStartPosition()+ "] "+ "rowCount: ["+ page.getCount()+ "]");
ReportResultsVO reportData = new ReportResultsVO();
//fetch report results
NotificationAdminDAO dao =(NotificationAdminDAO) DAOFactory.getInstance().getDAO("com.eteam.ems.auth.dao.NotificationAdminDAO");
reportData =dao.findNotificationByStatus(dsName,dbType,page,sort,userId,profileRepId);
reportData = super.getDataForDisplay(reportData, linkCol);
// set report specific header keys and their default value keys
reportData.addColumnInfo(1,IConstants.HEADER_KEY_STATUS,IConstants.DEFAULT_DATA_KEY_NR);
reportData.addColumnInfo(2,IConstants.HEADER_KEY_POSTED_DATE,IConstants.DEFAULT_DATA_KEY_NR);
reportData.addColumnInfo(3,IConstants.HEADER_KEY_FORM,IConstants.DEFAULT_DATA_KEY_NR);
return reportData;
}
/**
* This is called when Notification Queue listing by Not Processed
* @param dsName
* @param dbType
* @param linkCol
* @param page
* @param sort
* @param userId
* @param profileRepId
* @return ReportResultsVO
* @throws DAOException
* @throws BusinessException
*/
public ReportResultsVO getNotificationByNotProcessed(String dsName,String dbType,String linkCol,PageInfoVO page,SortInfoVO sort,String userId,String profileRepId)
throws DAOException, BusinessException {
log.debug("dsName: ["+ dsName+ "] "+ "dbType: ["+ dbType+ "] "+ "linkCol: ["+ linkCol+ "]"+ "startPos: ["
+ page.getStartPosition()+ "] "+ "rowCount: ["+ page.getCount()+ "]");
ReportResultsVO reportData = new ReportResultsVO();
//fetch report results
NotificationAdminDAO dao =(NotificationAdminDAO) DAOFactory.getInstance().getDAO("com.eteam.ems.auth.dao.NotificationAdminDAO");
reportData =dao.findNotificationByNotProcessed(dsName,dbType,page,sort,userId,profileRepId);
reportData = super.getDataForDisplay(reportData, linkCol);
// set report specific header keys and their default value keys
reportData.addColumnInfo(1,IConstants.HEADER_KEY_STATUS,IConstants.DEFAULT_DATA_KEY_NR);
reportData.addColumnInfo(2,IConstants.HEADER_KEY_POSTED_DATE,IConstants.DEFAULT_DATA_KEY_NR);
reportData.addColumnInfo(3,IConstants.HEADER_KEY_FORM,IConstants.DEFAULT_DATA_KEY_NR);
return reportData;
}
/**
* This is called to view the Notification Queue
* @param dsName
* @param dbType
* @param groupID
* @return NotificationAdminVO
* @throws DAOException
* @throws BusinessException
*/
public NotificationAdminVO findGroup( String dsName, String dbType, String groupID) throws DAOException, BusinessException
{
NotificationAdminVO notVO = null;
NotificationAdminDAO dao =(NotificationAdminDAO) DAOFactory.getInstance().getDAO("com.eteam.ems.auth.dao.NotificationAdminDAO");
notVO = dao.findGroup(dsName, dbType, groupID);
return notVO;
}
}