Package org.jtalks.jcommune.model.entity

Examples of org.jtalks.jcommune.model.entity.JCUser


        verify(pmDao, times(2)).delete(any(PrivateMessage.class));
    }

    @Test
    public void testHandleDraft() throws Exception{
        JCUser currentUser = new JCUser(USERNAME, "email", "password");
        when(userService.getCurrentUser()).thenReturn(currentUser);

    }
View Full Code Here


    @Override
    public List<Section> getAllAvailableSections(long currentTopicId) {
        List<Section> result = new ArrayList<>();
        Topic topic = topicDao.get(currentTopicId);
        List<Section> sections = this.getDao().getAll();
        JCUser user = userService.getCurrentUser();
        for (Section section : sections) {
            List<Branch> branches = new ArrayList<>(section.getBranches());
            for (Branch branch : branches) {
                if (branch.equals(topic.getBranch())) {
                    branches.remove(branch);
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public List<Post> getLastPostsForSection(Section section, int postsCount) {
        JCUser user = userService.getCurrentUser();
        List<Branch> branches = new ArrayList<>(section.getBranches());
        List<Long> branchIds = getDao().getAvailableBranchIds(user, branches);

        return postDao.getLastPostsFor(branchIds, postsCount);
    }
View Full Code Here

     *
     * @return user details view with {@link org.jtalks.jcommune.model.entity.JCUser} object.
     */
    @RequestMapping(value = "/user", method = RequestMethod.GET)
    public ModelAndView showCurrentUserProfilePage() {
        JCUser user = userService.getCurrentUser();
        return getUserProfileModelAndView(user, PROFILE);
    }
View Full Code Here

     * @throws org.jtalks.jcommune.plugin.api.exceptions.NotFoundException
     *          throws if current logged in user was not found
     */
    @RequestMapping(value = {"/users/{editedUserId}/profile", "/users/{editedUserId}"}, method = RequestMethod.GET)
    public ModelAndView showUserProfile(@PathVariable Long editedUserId) throws NotFoundException {
        JCUser editedUser = userService.get(editedUserId);
        return getUserProfileModelAndView(editedUser, PROFILE);
    }
View Full Code Here

     * @throws org.jtalks.jcommune.plugin.api.exceptions.NotFoundException
     *          throws if current logged in user was not found
     */
    @RequestMapping(value = "/users/{editedUserId}/contacts", method = RequestMethod.GET)
    public ModelAndView showUserContacts(@PathVariable Long editedUserId) throws NotFoundException {
        JCUser editedUser = userService.get(editedUserId);
        return getUserProfileModelAndView(editedUser, CONTACTS);
    }
View Full Code Here

     *          throws if current logged in user was not found
     */
    @RequestMapping(value = "/users/{editedUserId}/notifications", method = RequestMethod.GET)
    public ModelAndView showUserNotificationSettings(@PathVariable Long editedUserId) throws NotFoundException {
        checkPermissionForEditNotificationsOrSecurity(editedUserId);
        JCUser editedUser = userService.get(editedUserId);
        return getUserProfileModelAndView(editedUser, NOTIFICATIONS);
    }
View Full Code Here

     */
    @RequestMapping(value = "/users/{editedUserId}/security", method = RequestMethod.GET)
    public ModelAndView showUserSecuritySettings(@PathVariable Long editedUserId)
            throws NotFoundException {
        checkPermissionForEditNotificationsOrSecurity(editedUserId);
        JCUser editedUser = userService.get(editedUserId);
        return getUserProfileModelAndView(editedUser, SECURITY);
    }
View Full Code Here

        if (result.hasErrors()) {
            return new ModelAndView(EDIT_PROFILE, EDITED_USER, editedProfileDto);
        }
        long editedUserId = editedProfileDto.getUserProfileDto().getUserId();
        checkPermissionsToEditProfile(editedUserId);
        JCUser user = saveEditedProfileWithLockHandling(editedUserId, editedProfileDto, PROFILE);
        //redirect to the view profile page
        return new ModelAndView("redirect:/users/" + user.getId() + "/" + PROFILE);
    }
View Full Code Here

        if (result.hasErrors()) {
            return new ModelAndView(EDIT_PROFILE, EDITED_USER, editedProfileDto);
        }
        long editedUserId = editedProfileDto.getUserNotificationsDto().getUserId();
        checkPermissionForEditNotificationsOrSecurity(editedUserId);
        JCUser user = saveEditedProfileWithLockHandling(editedUserId, editedProfileDto, NOTIFICATIONS);
        //redirect to the view profile page
        return new ModelAndView("redirect:/users/" + user.getId() + "/" + NOTIFICATIONS);
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.model.entity.JCUser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.