@Test(dataProvider = "dataProvider", groups = {"activiti-test"}) public void getUserById(String id) { User user = identityPageService.findUserById(id); Assert.assertEquals(user.getId(), id); }
/** * 获取候选用户 * * @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; }
public String getId() { if(user != null) { return user.getId(); } return alternativeId; } public String getFirstName() {
public String apply(User u) { return u.getId(); } }, literalAndLike(id, null)),
protected String getValidKeyFromRequest(User user, String key) { String existingValue = identityService.getUserInfo(user.getId(), key); if (existingValue == null) { throw new ActivitiObjectNotFoundException("User info with key '" + key + "' does not exists for user '" + user.getId() + "'.", null); } return key; } }
public void click(ClickEvent event) { viewManager.showProfilePopup(user.getId()); } });
@ApiOperation(value = "Delete a user", tags = {"Users"}) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the user was found and has been deleted. Response-body is intentionally empty."), @ApiResponse(code = 404, message = "Indicates the requested user was not found.") }) @RequestMapping(value = "/identity/users/{userId}", method = RequestMethod.DELETE) public void deleteUser(@ApiParam(name = "userId", value="The id of the user to delete.") @PathVariable String userId, HttpServletResponse response) { User user = getUserFromRequest(userId); identityService.deleteUser(user.getId()); response.setStatus(HttpStatus.NO_CONTENT.value()); } }
@ApiOperation(value = "List a user’s info", tags = {"Users"}, nickname = "listUsersInfo") @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the user was found and list of info (key and url) is returned."), @ApiResponse(code = 404, message = "Indicates the requested user was not found.") }) @RequestMapping(value = "/identity/users/{userId}/info", method = RequestMethod.GET, produces = "application/json") public List<UserInfoResponse> getUserInfo(@ApiParam(name="userId", value="The id of the user to get the info for.") @PathVariable String userId, HttpServletRequest request) { User user = getUserFromRequest(userId); return restResponseFactory.createUserInfoKeysResponse(identityService.getUserInfoKeys(user.getId()), user.getId()); }
@Override public List<User> meetCriteria(final List<User> users) { final List<User> usersOfGroup = new ArrayList<User>(); for (final User user : users) { final List<Group> groupsOfUser = this.groupsByUser.get(user.getId()); for (final Group groupOfUser : groupsOfUser) { if (groupOfUser != null && this.expectedGroupId.equals(groupOfUser.getId())) { usersOfGroup.add(user); break; } } } return usersOfGroup; }
@ApiOperation(value = "Delete a user’s info", tags = {"Users"}) @ApiResponses(value = { @ApiResponse(code = 204, message = "Indicates the user was found and the info for the given key has been deleted. Response body is left empty intentionally."), @ApiResponse(code = 404, message = "Indicates the requested user was not found or the user doesn’t have info for the given key. Status description contains additional information about the error.") }) @RequestMapping(value = "/identity/users/{userId}/info/{key}", method = RequestMethod.DELETE) public void deleteUserInfo(@ApiParam(name = "userId", value="The id of the user to delete the info for.") @PathVariable("userId") String userId,@ApiParam(name = "key", value="The key of the user info to delete.") @PathVariable("key") String key, HttpServletResponse response) { User user = getUserFromRequest(userId); String validKey = getValidKeyFromRequest(user, key); identityService.setUserInfo(user.getId(), validKey, null); response.setStatus(HttpStatus.NO_CONTENT.value()); }
@ApiOperation(value = "Get a user’s info", tags = {"Users"}) @ApiResponses(value = { @ApiResponse(code = 200, message = "Indicates the user was found and the user has info for the given key."), @ApiResponse(code = 404, message = "Indicates the requested user was not found or the user doesn’t have info for the given key. Status description contains additional information about the error.") }) @RequestMapping(value = "/identity/users/{userId}/info/{key}", method = RequestMethod.GET, produces = "application/json") public UserInfoResponse getUserInfo(@ApiParam(name = "userId", value="The id of the user to get the info for.") @PathVariable("userId") String userId,@ApiParam(name = "key", value="The key of the user info to get.") @PathVariable("key") String key, HttpServletRequest request) { User user = getUserFromRequest(userId); String existingValue = identityService.getUserInfo(user.getId(), key); if (existingValue == null) { throw new ActivitiObjectNotFoundException("User info with key '" + key + "' does not exists for user '" + user.getId() + "'.", null); } return restResponseFactory.createUserInfoResponse(key, existingValue, user.getId()); }
protected void loadProfileData() { this.user = identityService.createUserQuery().userId(userId).singleResult(); this.picture = identityService.getUserPicture(user.getId()); this.birthDate = identityService.getUserInfo(user.getId(), Constants.USER_INFO_BIRTH_DATE); this.jobTitle = identityService.getUserInfo(user.getId(), Constants.USER_INFO_JOB_TITLE); this.location = identityService.getUserInfo(user.getId(), Constants.USER_INFO_LOCATION); this.phone = identityService.getUserInfo(user.getId(), Constants.USER_INFO_PHONE); this.twitterName = identityService.getUserInfo(user.getId(), Constants.USER_INFO_TWITTER); this.skypeId = identityService.getUserInfo(user.getId(), Constants.USER_INFO_SKYPE); }
protected List<String> getCurrentMembers() { List<User> users = identityService.createUserQuery().memberOfGroup(group.getId()).list(); List<String> userIds = new ArrayList<String>(); for (User user : users) { userIds.add(user.getId()); } return userIds; }
public void buttonClick(ClickEvent event) { ExplorerApp.get().getViewManager().showUserPage(user.getId()); } });
@Override protected Object doExecute() throws Exception { List<User> users = getProcessEngine().getIdentityService() .createUserQuery().orderByUserId().asc().list(); if (users.isEmpty()) { err().println("No users found."); } for (User user : users) { out().printf("%s\t%s\t%s\n", user.getId(), user.getEmail(), user.getPassword()); } return null; } }
@Override protected Object doExecute() throws Exception { List<User> users = getProcessEngine().getIdentityService() .createUserQuery().orderByUserId().asc().list(); if (users.isEmpty()) { err().println("No users found."); } for (User user : users) { out().printf("%s\t%s\t%s\n", user.getId(), user.getEmail(), user.getPassword()); } return null; } }
public UserResponse createUserResponse(User user, boolean incudePassword, RestUrlBuilder urlBuilder) { UserResponse response = new UserResponse(); response.setFirstName(user.getFirstName()); response.setLastName(user.getLastName()); response.setId(user.getId()); response.setEmail(user.getEmail()); response.setUrl(urlBuilder.buildUrl(RestUrls.URL_USER, user.getId())); if (incudePassword) { response.setPassword(user.getPassword()); } if (user.isPictureSet()) { response.setPictureUrl(urlBuilder.buildUrl(RestUrls.URL_USER_PICTURE, user.getId())); } return response; }
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()); } catch (InvalidValueException e) { // Do nothing: the Form component will render the errormsgs automatically setHeight(340, UNITS_PIXELS); } }