本文整理汇总了Java中org.activiti.engine.identity.User.setFirstName方法的典型用法代码示例。如果您正苦于以下问题:Java User.setFirstName方法的具体用法?Java User.setFirstName怎么用?Java User.setFirstName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.identity.User
的用法示例。
在下文中一共展示了User.setFirstName方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initUserGroupTest
import org.activiti.engine.identity.User; //导入方法依赖的package包/类
@Test
public void initUserGroupTest() {
// deptLeader
Group deptLeader = this.identityService.newGroup("deptLeader");
deptLeader.setName("部门领导");
deptLeader.setType("candidate");
identityService.saveGroup(deptLeader);
// hr
Group hr = this.identityService.newGroup("hr");
hr.setName("人事部领导");
hr.setType("candidate");
identityService.saveGroup(hr);
User admin = this.identityService.newUser("admin");
admin.setFirstName("xia");
admin.setLastName("liang");
admin.setEmail("[email protected]");
identityService.saveUser(admin);
identityService.createMembership("admin", "deptLeader");
identityService.createMembership("admin", "hr");
}
示例2: setUp
import org.activiti.engine.identity.User; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
// 初始化7大Service实例
super.setUp();
// 创建并保存组对象
Group group = identityService.newGroup("deptLeader");
group.setName("部门领导");
group.setType("assignment");
identityService.saveGroup(group);
// 创建并保存用户对象
User user = identityService.newUser("henryyan");
user.setFirstName("Henry");
user.setLastName("Yan");
user.setEmail("[email protected]");
identityService.saveUser(user);
// 把用户henryyan加入到组deptLeader中
identityService.createMembership("henryyan", "deptLeader");
}
示例3: saveUser
import org.activiti.engine.identity.User; //导入方法依赖的package包/类
/**
* 保存User
*
* @param redirectAttributes
* @return
*/
@RequestMapping(value = "user/save", method = RequestMethod.POST)
public String saveUser(@RequestParam("userId") String userId,
@RequestParam("firstName") String firstName,
@RequestParam("lastName") String lastName,
@RequestParam(value = "password", required = false) String password,
@RequestParam(value = "email", required = false) String email,
RedirectAttributes redirectAttributes) {
User user = identityService.createUserQuery().userId(userId).singleResult();
if (user == null) {
user = identityService.newUser(userId);
}
user.setFirstName(firstName);
user.setLastName(lastName);
user.setEmail(email);
if (StringUtils.isNotBlank(password)) {
user.setPassword(password);
}
identityService.saveUser(user);
redirectAttributes.addFlashAttribute("message", "成功添加用户[" + firstName + " " + lastName + "]");
return "redirect:/chapter14/identity/user/list";
}
示例4: testUser
import org.activiti.engine.identity.User; //导入方法依赖的package包/类
/**
* 用户管理API演示
*/
@Test
public void testUser() throws Exception {
// 创建一个用户
User user = identityService.newUser("henryyan");
user.setFirstName("Henry");
user.setLastName("Yan");
user.setEmail("[email protected]");
// 保存用户到数据库
identityService.saveUser(user);
// 验证用户是否保存成功
User userInDb = identityService.createUserQuery().userId("henryyan").singleResult();
assertNotNull(userInDb);
// 删除用户
identityService.deleteUser("henryyan");
// 验证是否删除成功
userInDb = identityService.createUserQuery().userId("henryyan").singleResult();
assertNull(userInDb);
}
示例5: testUpdateUser
import org.activiti.engine.identity.User; //导入方法依赖的package包/类
public void testUpdateUser() {
// First, create a new user
User user = identityService.newUser("johndoe");
user.setFirstName("John");
user.setLastName("Doe");
user.setEmail("[email protected]");
identityService.saveUser(user);
// Fetch and update the user
user = identityService.createUserQuery().userId("johndoe").singleResult();
user.setEmail("[email protected]");
user.setFirstName("Jane");
user.setLastName("Donnel");
identityService.saveUser(user);
user = identityService.createUserQuery().userId("johndoe").singleResult();
assertEquals("Jane", user.getFirstName());
assertEquals("Donnel", user.getLastName());
assertEquals("[email protected]", user.getEmail());
identityService.deleteUser(user.getId());
}
示例6: testMultiCadiateUserInUserTask
import org.activiti.engine.identity.User; //导入方法依赖的package包/类
/**
* 学习一个用户任务有多个候选人
*/
@Test
@Deployment(resources = {"chapter5/candidateUserInUserTask.bpmn"})
public void testMultiCadiateUserInUserTask() throws Exception {
// 添加用户jackchen
User userJackChen = identityService.newUser("jackchen");
userJackChen.setFirstName("Jack");
userJackChen.setLastName("Chen");
userJackChen.setEmail("[email protected]");
identityService.saveUser(userJackChen);
// 添加用户henryyan
User userHenryyan = identityService.newUser("henryyan");
userHenryyan.setFirstName("Henry");
userHenryyan.setLastName("Yan");
userHenryyan.setEmail("[email protected]");
identityService.saveUser(userHenryyan);
// 启动流程
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("candidateUserInUserTask");
assertNotNull(processInstance);
// jackchen作为候选人的任务
Task jackchenTask = taskService.createTaskQuery().taskCandidateUser("jackchen").singleResult();
assertNotNull(jackchenTask);
// henryyan作为候选人的任务
Task henryyanTask = taskService.createTaskQuery().taskCandidateUser("henryyan").singleResult();
assertNotNull(henryyanTask);
// jackchen签收任务
taskService.claim(jackchenTask.getId(), "jackchen");
// 再次查询用户henryyan是否拥有刚刚的候选任务
henryyanTask = taskService.createTaskQuery().taskCandidateUser("henryyan").singleResult();
assertNull(henryyanTask);
}
示例7: createUser
import org.activiti.engine.identity.User; //导入方法依赖的package包/类
private User createUser(String id, String firstName, String lastName, String email) {
User user = identityService.newUser(id);
user.setFirstName(firstName);
user.setLastName(lastName);
user.setEmail(email);
identityService.saveUser(user);
return user;
}
示例8: testUserAndGroupMemership
import org.activiti.engine.identity.User; //导入方法依赖的package包/类
/**
* 组和用户关联关系API演示
*/
@Test
public void testUserAndGroupMemership() throws Exception {
// 创建并保存组对象
Group group = identityService.newGroup("deptLeader");
group.setName("部门领导");
group.setType("assignment");
identityService.saveGroup(group);
// 创建并保存用户对象
User user = identityService.newUser("henryyan");
user.setFirstName("Henry");
user.setLastName("Yan");
user.setEmail("[email protected]");
identityService.saveUser(user);
// 把用户henryyan加入到组deptLeader中
identityService.createMembership("henryyan", "deptLeader");
// 查询属于组deptLeader的用户
User userInGroup = identityService.createUserQuery().memberOfGroup("deptLeader").singleResult();
assertNotNull(userInGroup);
assertEquals("henryyan", userInGroup.getId());
// 查询henryyan所属组
Group groupContainsHenryyan = identityService.createGroupQuery().groupMember("henryyan").singleResult();
assertNotNull(groupContainsHenryyan);
assertEquals("deptLeader", groupContainsHenryyan.getId());
}
示例9: testUserTaskWithGroupContainsTwoUser
import org.activiti.engine.identity.User; //导入方法依赖的package包/类
@Test
@Deployment(resources = {"chapter5/userAndGroupInUserTask.bpmn"})
public void testUserTaskWithGroupContainsTwoUser() throws Exception {
// 在setUp()的基础上再添加一个用户然后加入到组deptLeader中
User user = identityService.newUser("jackchen");
user.setFirstName("Jack");
user.setLastName("Chen");
user.setEmail("[email protected]");
identityService.saveUser(user);
// 把用户henryyan加入到组deptLeader中
identityService.createMembership("jackchen", "deptLeader");
// 启动流程
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("userAndGroupInUserTask");
assertNotNull(processInstance);
// jackchen作为候选人的任务
Task jackchenTask = taskService.createTaskQuery().taskCandidateUser("jackchen").singleResult();
assertNotNull(jackchenTask);
// henryyan作为候选人的任务
Task henryyanTask = taskService.createTaskQuery().taskCandidateUser("henryyan").singleResult();
assertNotNull(henryyanTask);
// jackchen签收任务
taskService.claim(jackchenTask.getId(), "jackchen");
// 再次查询用户henryyan是否拥有刚刚的候选任务
henryyanTask = taskService.createTaskQuery().taskCandidateUser("henryyan").singleResult();
assertNull(henryyanTask);
}
示例10: createUser
import org.activiti.engine.identity.User; //导入方法依赖的package包/类
protected void createUser(String userId, String firstName, String lastName, String password,
String email, String imageResource, List<String> groups, List<String> userInfo) {
if (identityService.createUserQuery().userId(userId).count() == 0) {
// Following data can already be set by demo setup script
User user = identityService.newUser(userId);
user.setFirstName(firstName);
user.setLastName(lastName);
user.setPassword(password);
user.setEmail(email);
identityService.saveUser(user);
if (groups != null) {
for (String group : groups) {
identityService.createMembership(userId, group);
}
}
}
// Following data is not set by demo setup script
// image
if (imageResource != null) {
byte[] pictureBytes = IoUtil.readInputStream(this.getClass().getClassLoader().getResourceAsStream(imageResource), null);
Picture picture = new Picture(pictureBytes, "image/jpeg");
identityService.setUserPicture(userId, picture);
}
// user info
if (userInfo != null) {
for(int i=0; i<userInfo.size(); i+=2) {
identityService.setUserInfo(userId, userInfo.get(i), userInfo.get(i+1));
}
}
}
示例11: testUser
import org.activiti.engine.identity.User; //导入方法依赖的package包/类
public void testUser() {
User user = identityService.newUser("johndoe");
user.setFirstName("John");
user.setLastName("Doe");
user.setEmail("[email protected]");
identityService.saveUser(user);
user = identityService.createUserQuery().userId("johndoe").singleResult();
assertEquals("johndoe", user.getId());
assertEquals("John", user.getFirstName());
assertEquals("Doe", user.getLastName());
assertEquals("[email protected]", user.getEmail());
identityService.deleteUser("johndoe");
}