本文整理汇总了Java中org.activiti.engine.identity.User类的典型用法代码示例。如果您正苦于以下问题:Java User类的具体用法?Java User怎么用?Java User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
User类属于org.activiti.engine.identity包,在下文中一共展示了User类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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");
}
开发者ID:KayuraTeam,项目名称:kayura-activiti,代码行数:26,代码来源:InitUserGroupTest.java
示例2: getTaskCandidate
import org.activiti.engine.identity.User; //导入依赖的package包/类
/**
* 获取任务候选人
*
* @param taskId 任务ID
* @return
*/
@Override
public Set<User> getTaskCandidate(String taskId) {
Set<User> users = new HashSet();
List identityLinkList = taskService.getIdentityLinksForTask(taskId);
if (identityLinkList != null && identityLinkList.size() > 0) {
for (Iterator iterator = identityLinkList.iterator(); iterator.hasNext(); ) {
IdentityLink identityLink = (IdentityLink) iterator.next();
if (identityLink.getUserId() != null) {
User user = identityPageService.getUser(identityLink.getUserId());
if (user != null)
users.add(user);
}
if (identityLink.getGroupId() != null) {
// 根据组获得对应人员
List userList = identityService.createUserQuery()
.memberOfGroup(identityLink.getGroupId()).list();
if (userList != null && userList.size() > 0)
users.addAll(userList);
}
}
}
return users;
}
开发者ID:bill1012,项目名称:AdminEAP,代码行数:31,代码来源:TaskPageServiceImpl.java
示例3: getTaskCandidateUser
import org.activiti.engine.identity.User; //导入依赖的package包/类
/**
* 获取候选用户
*
* @param taskId
* @return Map names ids
*/
@Override
public Map<String, String> getTaskCandidateUser(String taskId) {
Set<User> users = getTaskCandidate(taskId);
String[] names = new String[users.size()];
String[] ids = new String[users.size()];
Map<String, String> map = new HashMap<>();
int i = 0;
for (User user : users) {
names[i] = user.getFirstName();
ids[i] = user.getId();
i++;
}
map.put("names", StrUtil.join(names));
map.put("ids", StrUtil.join(ids));
return map;
}
开发者ID:bill1012,项目名称:AdminEAP,代码行数:24,代码来源:TaskPageServiceImpl.java
示例4: getUserList
import org.activiti.engine.identity.User; //导入依赖的package包/类
@Override
public List<User> getUserList(QueryCondition condition, PageInfo pageInfo) {
String name = null;
String groupId = null;
if (condition != null) {
name = condition.getConditionMap().get("name").toString();
if (condition.getConditionMap().containsKey("groupId")) {
groupId = condition.getConditionMap().get("groupId").toString();
}
}
List<User> userList;
long count;
UserQuery query = identityService.createUserQuery();
if (!StrUtil.isEmpty(name)) {
query = query.userFirstNameLike(name);
}
if (!StrUtil.isEmpty(groupId)) {
query = query.memberOfGroup(groupId);
}
count = query.count();
userList = query.orderByUserId().asc().listPage((pageInfo.getPageNum() - 1) * pageInfo.getPageSize(),
pageInfo.getPageSize());
pageInfo.setCount((int) count);
return userList;
}
开发者ID:bill1012,项目名称:AdminEAP,代码行数:26,代码来源:IdentityPageServiceImpl.java
示例5: findUserById
import org.activiti.engine.identity.User; //导入依赖的package包/类
@Override
public User findUserById(String userId) {
String sql = "select id,name,login_name,email,password from tbl_user where id=:id";
Map<String, Object> param = new HashMap<>();
param.put("id", userId);
List<Map<String, Object>> maps = super.findMapBySql(sql, param);
if (maps == null || maps.isEmpty())
return null;
Map<String, Object> map = maps.get(0);
UserEntity userEntity = new UserEntity();
userEntity.setId(map.get("id").toString());
userEntity.setFirstName(map.get("name").toString());
userEntity.setLastName(map.get("login_name").toString());
userEntity.setEmail(map.get("email").toString());
userEntity.setPassword(map.get("password").toString());
return userEntity;
}
开发者ID:bill1012,项目名称:AdminEAP,代码行数:19,代码来源:IdentityPageServiceImpl.java
示例6: loadUsers
import org.activiti.engine.identity.User; //导入依赖的package包/类
public synchronized void loadUsers() {
long nrOfUsers = identityService.createUserQuery().count();
long usersAdded = 0;
userTrie = new RadixTreeImpl<List<User>>();
userCache = new HashMap<String, User>();
keyCache = new HashMap<String, List<String>>();
while (usersAdded < nrOfUsers) {
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Caching users " + usersAdded + " to " + (usersAdded+25));
}
List<User> users = identityService.createUserQuery().listPage((int) usersAdded, 25);
for (User user : users) {
addTrieItem(user);
addUserCacheItem(user);
usersAdded++;
}
}
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:24,代码来源:TrieBasedUserCache.java
示例7: setCandidateUserAndGroups
import org.activiti.engine.identity.User; //导入依赖的package包/类
/**
* 读取流程定义的相关候选启动人、组,根据link信息转换并封装为User、Group对象
* @param processDefinitionList
* @return
*/
private Map<String, Map<String, List<? extends Object>>> setCandidateUserAndGroups(List<ProcessDefinition> processDefinitionList) {
Map<String, Map<String, List<? extends Object>>> linksMap = new HashMap<String, Map<String, List<? extends Object>>>();
for (ProcessDefinition processDefinition : processDefinitionList) {
List<IdentityLink> identityLinks = repositoryService.getIdentityLinksForProcessDefinition(processDefinition.getId());
Map<String, List<? extends Object>> single = new Hashtable<String, List<? extends Object>>();
List<User> linkUsers = new ArrayList<User>();
List<Group> linkGroups = new ArrayList<Group>();
for (IdentityLink link : identityLinks) {
if (StringUtils.isNotBlank(link.getUserId())) {
linkUsers.add(identityService.createUserQuery().userId(link.getUserId()).singleResult());
} else if (StringUtils.isNotBlank(link.getGroupId())) {
linkGroups.add(identityService.createGroupQuery().groupId(link.getGroupId()).singleResult());
}
}
single.put("user", linkUsers);
single.put("group", linkGroups);
linksMap.put(processDefinition.getId(), single);
}
return linksMap;
}
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:31,代码来源:DeploymentController.java
示例8: todoTasks
import org.activiti.engine.identity.User; //导入依赖的package包/类
/**
* 读取启动流程的表单字段
*/
@RequestMapping(value = "task/list")
public ModelAndView todoTasks(HttpSession session) throws Exception {
String viewName = "chapter6/task-list";
ModelAndView mav = new ModelAndView(viewName);
User user = UserUtil.getUserFromSession(session);
/*// 读取直接分配给当前人或者已经签收的任务
List<Task> doingTasks = taskService.createTaskQuery().taskAssignee(user.getId()).list();
// 等待签收的任务
List<Task> waitingClaimTasks = taskService.createTaskQuery().taskCandidateUser(user.getId()).list();
// 合并两种任务
List<Task> allTasks = new ArrayList<Task>();
allTasks.addAll(doingTasks);
allTasks.addAll(waitingClaimTasks);*/
// 5.16版本可以使用一下代码待办查询
List<Task> allTasks = taskService.createTaskQuery().taskCandidateOrAssigned(user.getId()).list();
mav.addObject("tasks", allTasks);
return mav;
}
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:27,代码来源:TaskController.java
示例9: handleFormSubmit
import org.activiti.engine.identity.User; //导入依赖的package包/类
protected void handleFormSubmit() {
try {
// create user
form.commit(); // will throw exception in case validation is false
User user = createUser();
// close popup and navigate to fresh user
close();
ExplorerApp.get().getViewManager().showUserPage(user.getId());
// Update user cache
ExplorerApp.get().getUserCache().notifyUserDataChanged(user.getId());
} catch (InvalidValueException e) {
// Do nothing: the Form component will render the errormsgs automatically
setHeight(340, UNITS_PIXELS);
}
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:NewUserPopupWindow.java
示例10: setCurrentTaskInfo
import org.activiti.engine.identity.User; //导入依赖的package包/类
/**
* 获取当前节点信息
*
* @return
*/
private void setCurrentTaskInfo(String executionId, String activityId, Map<String, Object> vars) {
Task currentTask = taskService.createTaskQuery().executionId(executionId)
.taskDefinitionKey(activityId).singleResult();
logger.debug("current task for processInstance: {}", ToStringBuilder.reflectionToString(currentTask));
if (currentTask == null) return;
String assignee = currentTask.getAssignee();
if (assignee != null) {
User assigneeUser = identityService.createUserQuery().userId(assignee).singleResult();
String userInfo = assigneeUser.getFirstName() + " " + assigneeUser.getLastName() + "/" + assigneeUser.getId();
vars.put("当前处理人", userInfo);
vars.put("创建时间", new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(currentTask.getCreateTime()));
} else {
vars.put("任务状态", "未签收");
}
}
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:24,代码来源:TraceProcessController.java
示例11: 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";
}
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:28,代码来源:IdentityController.java
示例12: testAddCandidateUserDuplicate
import org.activiti.engine.identity.User; //导入依赖的package包/类
public void testAddCandidateUserDuplicate() {
// Check behavior when adding the same user twice as candidate
User user = identityService.newUser("user");
identityService.saveUser(user);
Task task = taskService.newTask();
taskService.saveTask(task);
taskService.addCandidateUser(task.getId(), user.getId());
// Add as candidate the second time
taskService.addCandidateUser(task.getId(), user.getId());
identityService.deleteUser(user.getId());
taskService.deleteTask(task.getId(), true);
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:17,代码来源:TaskServiceTest.java
示例13: testUnClaimTask
import org.activiti.engine.identity.User; //导入依赖的package包/类
public void testUnClaimTask() {
Task task = taskService.newTask();
taskService.saveTask(task);
User user = identityService.newUser("user");
identityService.saveUser(user);
// Claim task the first time
taskService.claim(task.getId(), user.getId());
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
assertEquals(user.getId(), task.getAssignee());
// Unclaim the task
taskService.claim(task.getId(), null);
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
assertNull(task.getAssignee());
taskService.deleteTask(task.getId(), true);
identityService.deleteUser(user.getId());
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:TaskServiceTest.java
示例14: 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);
}
开发者ID:barudisshu,项目名称:activiti-in-action-codes,代码行数:26,代码来源:IdentityServiceTest.java
示例15: testSetAssignee
import org.activiti.engine.identity.User; //导入依赖的package包/类
public void testSetAssignee() {
User user = identityService.newUser("user");
identityService.saveUser(user);
Task task = taskService.newTask();
assertNull(task.getAssignee());
taskService.saveTask(task);
// Set assignee
taskService.setAssignee(task.getId(), user.getId());
// Fetch task again
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
assertEquals(user.getId(), task.getAssignee());
identityService.deleteUser(user.getId());
taskService.deleteTask(task.getId(), true);
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:TaskServiceTest.java
示例16: testClaimAlreadyClaimedTaskBySameUser
import org.activiti.engine.identity.User; //导入依赖的package包/类
public void testClaimAlreadyClaimedTaskBySameUser() {
Task task = taskService.newTask();
taskService.saveTask(task);
User user = identityService.newUser("user");
identityService.saveUser(user);
// Claim task the first time
taskService.claim(task.getId(), user.getId());
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
// Claim the task again with the same user. No exception should be thrown
taskService.claim(task.getId(), user.getId());
taskService.deleteTask(task.getId(), true);
identityService.deleteUser(user.getId());
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:17,代码来源:TaskServiceTest.java
示例17: addTrieCacheItem
import org.activiti.engine.identity.User; //导入依赖的package包/类
protected void addTrieCacheItem(String key, User user) {
key = key.toLowerCase();
// Trie update
List<User> value = null;
if (!userTrie.contains(key)) {
value = new ArrayList<User>();
} else {
value = userTrie.find(key);
}
value.add(user);
userTrie.delete(key);
userTrie.insert(key, value);
// Key map update
if (!keyCache.containsKey(user.getId())) {
keyCache.put(user.getId(), new ArrayList<String>());
}
keyCache.get(user.getId()).add(key);
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:22,代码来源:TrieBasedUserCache.java
示例18: persistUser
import org.activiti.engine.identity.User; //导入依赖的package包/类
static void persistUser(IdentityService identityService, String userId) {
User user = identityService.createUserQuery().userId(userId).singleResult();
if (user == null) {
user = identityService.newUser(userId);
identityService.saveUser(user);
}
}
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:8,代码来源:ResourcesUtil.java
示例19: setCurrentTaskAssignee
import org.activiti.engine.identity.User; //导入依赖的package包/类
/**
* 设置当前处理人信息
*
* @param vars
* @param currentTask
*/
private void setCurrentTaskAssignee(Map<String, Object> vars, Task currentTask) {
String assignee = currentTask.getAssignee();
if (assignee != null) {
User assigneeUser = identityService.createUserQuery().userId(assignee).singleResult();
String userInfo = assigneeUser.getFirstName() + " " + assigneeUser.getLastName();
vars.put("当前处理人", userInfo);
}
}
开发者ID:batizhao,项目名称:microservice,代码行数:15,代码来源:WorkflowTraceService.java
示例20: submitForm
import org.activiti.engine.identity.User; //导入依赖的package包/类
@RequestMapping(method=RequestMethod.POST)
public RedirectView submitForm(Model model, @ModelAttribute LoginForm signupForm, BindingResult bindingResult){
model.addAttribute("signupForm", signupForm);
RedirectView redirectView = new RedirectView();
redirectView.setContextRelative(true);
if(bindingResult.hasErrors()) {
signupForm = new LoginForm();
redirectView.setUrl("/ocs/signup");
references(model);
model.addAttribute("signupForm", signupForm);
} else{
loginService.addAccount(signupForm);
IdentityService identityService = processEngine.getIdentityService();
User user = identityService.newUser(signupForm.getUsername());
user.setPassword(signupForm.getPassword());
identityService.saveUser(user);
try{
identityService.saveGroup(identityService.newGroup("payor"));
identityService.saveGroup(identityService.newGroup("shipper"));
identityService.saveGroup(identityService.newGroup("shopper"));
identityService.saveGroup(identityService.newGroup("buyer"));
}catch(Exception e){
System.out.println("Groups already exists....");
}
identityService.createMembership(signupForm.getUsername(), "shopper");
identityService.createMembership(signupForm.getUsername(), "buyer");
identityService.createMembership(signupForm.getUsername(), "payor");
identityService.createMembership(signupForm.getUsername(), "shipper");
redirectView.setUrl("/ocs/login");
}
return redirectView;
}
开发者ID:PacktPublishing,项目名称:Spring-MVC-Blueprints,代码行数:38,代码来源:SignUpController.java
注:本文中的org.activiti.engine.identity.User类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论