📄 newshelper.java
字号:
package com.eline.wap.resource.client;
import com.eline.wap.common.model.Page;
import com.eline.wap.resource.dao.NewsDAO;
import com.eline.wap.resource.dao.ResourceDAOFactory;
import com.eline.wap.resource.exceptions.ResourceDAOSysException;
import com.eline.wap.resource.exceptions.ResourceException;
import com.eline.wap.resource.model.News;
import com.eline.wap.resource.model.NewsCondition;
public class NewsHelper {
private NewsDAO dao = null;
public Page searchNews(NewsCondition condition, int start, int count) throws ResourceException {
try {
if (dao == null)
dao = ResourceDAOFactory.getNewsDAO();
return dao.searchNews(condition, start, count);
} catch (ResourceDAOSysException e) {
throw new ResourceException(e.getMessage());
}
}
public News getNews(int newsId) throws ResourceException {
try {
if (dao == null)
dao = ResourceDAOFactory.getNewsDAO();
return dao.getNews(newsId);
} catch (ResourceDAOSysException e) {
throw new ResourceException(e.getMessage());
}
}
public void createNews(News item) throws ResourceException {
try {
if (dao == null)
dao = ResourceDAOFactory.getNewsDAO();
dao.createNews(item);
} catch (ResourceDAOSysException e) {
throw new ResourceException(e.getMessage());
}
}
public void updateNews(News item) throws ResourceException{
try{
if (dao == null)
dao = ResourceDAOFactory.getNewsDAO();
dao.updateNews(item);
}catch (ResourceDAOSysException e) {
throw new ResourceException(e.getMessage());
}
}
public void deleteItem(int itemId) throws ResourceException {
try {
if (dao == null)
dao = ResourceDAOFactory.getNewsDAO();
dao.deleteNews(itemId);
} catch (ResourceDAOSysException e) {
throw new ResourceException(e.getMessage());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -