java实现的可配置的工作流引擎,采用jsp+javabean实现
源代码在线查看: formutils.java
package com.hongsoft.res.formbean;
import com.hongsoft.res.pojo.*;
import com.hongsoft.res.util.*;
public class FormUtils {
/**
* 通过UserFormBean获得User对象
* @param bean UserFormBeanIterator
* @return User
*/
public static User getUser(UserFormBean bean) {
User user = new User();
user.setEmail(bean.getEmail());
user.setId(bean.getUid());
user.setLoginName(bean.getLoginName());
user.setName(bean.getName());
//密码以MD5加密
user.setPassword(Encrypter.hashByMD5(bean.getPassword()));
user.setPhone(bean.getPhone());
return user;
}
/**
* 通过User对象获得UserFormBean对象
* @param user User
* @return UserFormBean
*/
public static UserFormBean getUserFormBean(User user) {
UserFormBean retbean = new UserFormBean();
retbean.setUid(user.getId());
retbean.setName(user.getName());
retbean.setLoginName(user.getLoginName());
retbean.setEmail(user.getEmail());
retbean.setPassword(user.getPassword());
retbean.setPhone(user.getPhone());
return retbean;
}
/**
* 通过RoleFormBean获得Role对象
* @param bean RoleFormBeanIterator
* @return Role
*/
public static Role getRole(RoleFormBean bean) {
Role role = new Role();
role.setDescription(bean.getDescription());
role.setId(bean.getRoleID());
role.setName(bean.getName());
return role;
}
/**
* 通过Role对象获得RoleFormBean对象
* @param role Role
* @return RoleFormBean
*/
public static RoleFormBean getRoleFormBean(Role role) {
RoleFormBean retbean = new RoleFormBean();
retbean.setRoleID(role.getId());
retbean.setName(role.getName());
retbean.setDescription(role.getDescription());
return retbean;
}
/**
* 通过OrgFormBean获得OrgUnit对象
* @param bean OrgFormBeanIterator
* @return Org
*/
public static OrgUnit getOrg(OrgFormBean bean) {
OrgUnit org = new OrgUnit();
org.setDescription(bean.getDescription());
org.setId(bean.getOrgID());
org.setName(bean.getName());
return org;
}
/**
* 通过OrgUnit对象获得OrgFormBean对象
* @param org OrgUnit
* @return OrgFormBean
*/
public static OrgFormBean getOrgFormBean(OrgUnit org) {
OrgFormBean retbean = new OrgFormBean();
retbean.setOrgID(org.getId());
retbean.setName(org.getName());
retbean.setDescription(org.getDescription());
return retbean;
}
}