loginaction.java

来自「workflow first jbpm」· Java 代码 · 共 82 行

JAVA
82
字号
package com.yuyanshan.struts;

import java.util.List;

import org.jbpm.graph.exe.Token;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springmodules.workflow.jbpm31.JbpmTemplate;

import com.yuyanshan.service.BeanService;
import com.yuyanshan.service.JbpmServiceImpl;
import com.yuyanshan.service.User;

/** 
 * @author yuyanshan E-mail: yuyanshan1@163.com 
 * @version 1.0 create_time:Jul 22, 2008 4:36:51 PM 
 * @class_explain: 
 */

public class LoginAction extends BaseAction {
	
	private String userName;
	private String password;
	private JbpmTemplate jbpmTemplate;
	public JbpmTemplate getJbpmTemplate() {
		return jbpmTemplate;
	}

	public void setJbpmTemplate(JbpmTemplate jbpmTemplate) {
		this.jbpmTemplate = jbpmTemplate;
	}

	public String login() {
		User user = new User();
//		List list = this.jbpmTemplate.findProcessInstances();
//		List list = this.jbpmService.getBaseDao().querySql("from org.jbpm.graph.exe.Token as pd where pd.id = 50");
//		JbpmServiceImpl simp = (JbpmServiceImpl) this.jbpmService.getBaseDao();
//
//		ApplicationContext ac = new ClassPathXmlApplicationContext("classpath*:applicationContext.xml");
//		Object o = ac.getBean("myBaseDao");
//		List list = this.jbpmService.getBaseDao().querySql("from org.jbpm.graph.def.Transition as pd  ");
		
		user.setId(userName);
		user.setUserName(userName);
		String back = "pass" ;
		this.getSession().setAttribute("type", "0");
		if("manager".equals(userName) && "manager".equals(password)) {
//			this.setErrorMessage("欢迎部门经理登录");
			user.setId("DepartmentManager");
			user.setUserName("DepartmentManager");
			this.getSession().setAttribute("type", "1");
//			back = "manager";
		}
		if("boss".equals(userName) && "boss".equals(password)) {
			user.setId("President");
			user.setId("President");
			this.getSession().setAttribute("type", "2");
//			this.setErrorMessage("欢迎老板登录");
//			back = "boss";
		}
////		this.setErrorMessage("欢迎员工登录");
		this.getSession().setAttribute("user", user);
		return back;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
}

⌨️ 快捷键说明

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