18.activiti工作流-业务层面
来源:互联网 发布:vb for 循环语句 编辑:程序博客网 时间:2024/06/05 17:06
1.知识点回顾
2.系统登录(Session)
public Employee findEmployeeByName(String name) { String hql = "from Employee o where o.name=?"; List<Employee> list = this.getHibernateTemplate().find(hql, name); Employee employee = null; if (list != null && list.size() > 0) { employee = list.get(0); } return employee; }
public String login() { // 1:获取用户名 String name = employee.getName(); // 2:使用用户名作为查询条件,查询员工表,获取当前用户名对应的信息 Employee emp = employeeService.findEmployeeByName(name); // 3:将查询的对象(惟一)放置到Session中 SessionContext.setUser(emp); return "success"; }
package cn.itcast.ssh.utils;import org.apache.struts2.ServletActionContext;import cn.itcast.ssh.domain.Employee;public class SessionContext { public static final String GLOBLE_USER_SESSION = "globle_user"; public static void setUser(Employee user){ if(user!=null){ ServletActionContext.getRequest().getSession().setAttribute(GLOBLE_USER_SESSION, user); }else{ ServletActionContext.getRequest().getSession().removeAttribute(GLOBLE_USER_SESSION); } } public static Employee get(){ return (Employee) ServletActionContext.getRequest().getSession().getAttribute(GLOBLE_USER_SESSION); }}
public String logout() { // 清空Session SessionContext.setUser(null); return "login"; }
3.自定义拦截器实现Session验证
package cn.itcast.ssh.utils;import cn.itcast.ssh.domain.Employee;import com.opensymphony.xwork2.ActionInvocation;import com.opensymphony.xwork2.interceptor.Interceptor;/** * 登录验证拦截器 * */@SuppressWarnings("serial")public class LoginInteceptor implements Interceptor { @Override public void destroy() { // TODO Auto-generated method stub } @Override public void init() { // TODO Auto-generated method stub } /** 每次访问action类之前,先执行intercept */ @Override public String intercept(ActionInvocation invocation) throws Exception { //获取当前访问Action的URL String actionName = invocation.getProxy().getActionName(); //如果当前访问Action的URL是"loginAction_login"表示此时还没有Sesion,需要放行 if(!"loginAction_login".equals(actionName)){ //从Session中获取当前用户对象 Employee employee = SessionContext.get(); //如果Session不存在,跳转到登录页面 if(employee==null){ return "login"; } } //放行,访问Action类中方法 return invocation.invoke(); }}
4.部署流程定义(zip文件部署)
5.流程定义和部署对象查询
6.查看流程图和删除流程定义
在前面基础课学习当中,我们知道查询流程图需要传递deploymentId和imageName,我们直接从模型驱动当中拿就行了。
删除
7.请假单业务的查询列表和新增保存
对应a_leavebill
阅读全文
0 0
- 18.activiti工作流-业务层面
- 19.activiti工作流-业务层面(2)
- Activiti(工作流)如何关联业务表
- Activiti-工作流
- activiti工作流
- 工作流activiti
- activiti工作流
- Activiti工作流
- activiti工作流
- 工作流 activiti
- Activiti工作流
- Activiti 工作流
- 工作流Activiti
- activiti工作流
- Activiti工作流
- Activiti 工作流
- Activiti工作流
- activiti工作流
- 类文件结构
- 强连通分量 POJ 3180 The Cow Prom题解
- hdu-1241 Oil Deposits
- java实现二分查找
- 选择排序
- 18.activiti工作流-业务层面
- Javascript中apply、call、bind
- PHP中的求模和自加自减运算符
- linux压缩命令
- Android 技术重温系列 (13)- Style 和 Theme
- 探究活动之--隐式Intent
- ThreadLocal解答
- Consumer与Consumer Group
- 程序插桩-实例