java 代码
- <aop:config> </aop:config>
- ref="workflowHistoryImpl">
- expression="execution(* cn.grgbanking.view..*Impl.saveData(..)) and args(request)" />
- method="saveHistory" />
- "workflowHistoryImpl"
- class="cn.grgbanking.wfms.impl.WorkflowHistoryImpl">
说明:
这是个添加工作流历史记录的拦截类.当执行cn.grgbanking.view下面的所有节点业务类提交保存数据方法的时都会拦截到执行添加工作流历史记录的方法.
执行这个添加的类bean是 workflowHistoryImpl,方法是saveHistory
java 代码
- public class WorkflowHistoryImpl extends HibernateGenericDao implements
- IWorkflowHistory {
- /**
- * @description 保存历史记录
- * @param
- * @return
- * @exception
- * @athor
- */
- public boolean saveHistory(HttpServletRequest request) {
- String taskId = request.getParameter("TASKINSTANCEID");
- String businessid = request.getParameter("businessKey"); // TODO
- // Auto-generated
- // method
- WfmsHistory wfmsHistory = new WfmsHistory();
- if (taskId != null) {
- long tid = Long.parseLong(taskId);
- wfmsHistory.setTaskinstanceid(tid);
- }
- if (businessid != null) {
- wfmsHistory.setBusinessid(businessid);
- }
- this.save(wfmsHistory);
- return true;
- }
- }
第二种写在bean里面
java 代码
- @Aspect
- public class WorkflowHistoryImpl extends HibernateGenericDao {
- @After("execution(* cn.grgbanking.view..*Impl.saveData(..)) && args(request,..)")
- public void saveHistory( HttpServletRequest request) {
- System.out.println("aspect-------------------------successfull");
- }
- }