?? contentserviceimp.java
字號:
/**
*文件功能:文件管理; InnoDB free: 0 kB
*/
package com.tech.service.imp;
import java.util.List;
import com.common.dao.DaoSupport;
import com.common.exception.BusinessException;
import com.common.util.BeanUtils;
import com.tech.model.Content;
import com.tech.service.ContentService;
/**
*文件管理; InnoDB free: 0 kB
* @作者 徐建協(xié)
* @日期 2009-03-06
*/
public class ContentServiceImp implements ContentService {
private DaoSupport<Content,Long> contentDao;
public void setContentDao(DaoSupport<Content,Long> contentDao) {
this.contentDao = contentDao;
}
/* (non-Javadoc)
* @see com.common.service.BaseService#getEntity(java.io.Serializable)
*/
public Content getEntity(Long id) throws BusinessException {
try {
return contentDao.getEntity(id);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("ContentServiceImp 不能獲取主鍵為:" + id
+ "的數(shù)據(jù)" + e.toString());
}
}
/* (non-Javadoc)
* @see com.common.service.BaseService#loadEntity(java.io.Serializable)
*/
public Content loadEntity(Long id) throws BusinessException {
try {
return contentDao.loadEntity(id);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("ContentServiceImp 不能獲取主鍵為:" + id
+ "的數(shù)據(jù)" + e.toString());
}
}
/* (non-Javadoc)
* @see com.common.service.BaseService#removeEntity(java.lang.Object)
*/
public void removeEntity(Content entity) throws BusinessException {
try {
contentDao.removeEntity(entity);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("刪除異常:"
+ e.getMessage());
}
}
/* (non-Javadoc)
* @see com.common.service.BaseService#removeEntity(T[])
*/
public void removeEntity(Content[] array) throws BusinessException {
try {
contentDao.removeEntity(array);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("刪除異常:"
+ e.getMessage());
}
}
/* (non-Javadoc)
* @see com.common.service.BaseService#saveEntity(java.lang.Object)
*/
public void saveEntity(Content entity) throws BusinessException {
try {
contentDao.saveEntity(entity);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("添加異常:"
+ e.getMessage());
}
}
/* (non-Javadoc)
* @see com.common.service.BaseService#saveEntity(T[])
*/
public void saveEntity(Content[] array) throws BusinessException {
try {
contentDao.saveEntity(array);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("添加異常:"
+ e.getMessage());
}
}
/* (non-Javadoc)
* @see com.common.service.BaseService#updateEntity(java.lang.Object)
*/
public void updateEntity(Content entity) throws BusinessException {
try {
Content entityLoad = contentDao.getEntity(entity.getId());
// 拷貝不需要更新的字段內(nèi)容
//PropertyUtils.copyProperties(entityLoad,entity);
BeanUtils.copyProperties(entityLoad,entity);
contentDao.updateEntity(entityLoad);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("更新異常:"
+ e.getMessage());
}
}
/* (non-Javadoc)
* @see com.common.service.BaseService#updateEntity(T[])
*/
public void updateEntity(Content[] array) throws BusinessException {
try {
contentDao.updateEntity(array);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("更新異常:"
+ e.getMessage());
}
}
public boolean isExists(Content t,List<String> names) throws BusinessException{
try {
return contentDao.isExists(t,names);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("查找異常:"
+ e.getMessage());
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -