reportconfigprocessbean.java

来自「OBPM是一个开源」· Java 代码 · 共 45 行

JAVA
45
字号
package cn.myapps.core.report.reportconfig.ejb;

import java.util.Collection;
import java.util.Set;

import org.apache.commons.beanutils.PropertyUtils;

import cn.myapps.base.dao.DAOFactory;
import cn.myapps.base.dao.IBaseDAO;
import cn.myapps.base.dao.PersistenceUtils;
import cn.myapps.base.dao.ValueObject;
import cn.myapps.base.ejb.BaseProcessBean;
import cn.myapps.core.report.reportconfig.dao.ReportConfigDAO;

public class ReportConfigProcessBean extends BaseProcessBean implements ReportConfigProcess{
	protected IBaseDAO getDAO() throws Exception {
		return DAOFactory.getDefaultDAO(ReportConfig.class.getName());
	}
	
	public void doUpdate(ValueObject vo) throws Exception {
		try {
			PersistenceUtils.beginTransaction();

			ReportConfig po = (ReportConfig)getDAO().find(vo.getId());
			if (po != null) {
				Set fields=((ReportConfig)po).getFields();
				PropertyUtils.copyProperties(po, vo);
				po.setFields(fields);
				getDAO().update(po);
			} else {
				getDAO().update(vo);
			}

			PersistenceUtils.commitTransaction();
		} catch (Exception e) {
			e.printStackTrace();
			PersistenceUtils.rollbackTransaction();
		}
	}
	
	public Collection getReportByModule(String moduleid, String application) throws Exception{
		return ((ReportConfigDAO) getDAO()).getReportByModule(moduleid, application);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?