Package org.jtalks.jcommune.plugin.api.exceptions

Examples of org.jtalks.jcommune.plugin.api.exceptions.NotFoundException


     */
    @Override
    public void deleteTopicSilent(long topicId) throws NotFoundException {
        Topic topic = dao.get(topicId);
        if (topic == null) {
            throw new NotFoundException("Topic with given id not exist");
        }
        this.deleteTopicSilent(topic);
    }
View Full Code Here


     * {@inheritDoc}
     */
    @Override
    public List<Branch> getAvailableBranchesInSection(long sectionId, long currentTopicId) throws NotFoundException {
        if (!sectionDao.isExist(sectionId)) {
            throw new NotFoundException("Section with id: " + sectionId + " not found");
        }

        Section section = sectionDao.get(sectionId);
        List<Branch> branches = (List) section.getBranches();
        return getBranchesWithViewPermission(currentTopicId, branches);
View Full Code Here

        SimplePage simplePage = get(simplePageInfoContainer.getId());
        if (simplePage == null) {
            String message = "Simple page with id = " + simplePageInfoContainer.getId() + " not found.";
            logger.info(message);
            throw new NotFoundException(message);
        }

        simplePage.setName(simplePageInfoContainer.getName());
        simplePage.setContent(simplePageInfoContainer.getContent());
View Full Code Here

    public SimplePage getPageByPathName(String pathName) throws NotFoundException {
        SimplePage simplePage = this.getDao().getPageByPathName(pathName);
        if (simplePage == null) {
            String msg = "SimplePage " + pathName + " not found.";
            logger.info(msg);
            throw new NotFoundException(msg);

        }
        return simplePage;
    }
View Full Code Here

    }

    private JCUser getByUsername(String username) throws NotFoundException {
        JCUser user = this.getDao().getByUsername(username);
        if (user == null) {
            throw new NotFoundException();
        }
        return user;
    }
View Full Code Here

    @Override
    @PreAuthorize("hasPermission(#id, 'PRIVATE_MESSAGE', 'GeneralPermission.READ')")
    public PrivateMessage get(Long id) throws NotFoundException {
        PrivateMessage pm = super.get(id);
        if (!hasCurrentUserAccessToPM(pm)) {
            throw new NotFoundException(String.format("current user has no right to read pm %s with id %d",
                    userService.getCurrentUser(), id));
        }
        if (this.ifMessageShouldBeMarkedAsRead(pm)) {
            pm.setRead(true);
            this.getDao().saveOrUpdate(pm);
View Full Code Here

        assertTrue(isValid, "If moderator edits user's profile, we mustn't check current password.");
    }

    @Test
    public void editedNotExistingUserShouldNotCheckPassword() throws NotFoundException {
        when(userService.get(1L)).thenThrow(new NotFoundException());

        boolean isValid = validator.isValid(userSecurityDto, validatorContext);

        assertTrue(isValid, "If someone try to edit not existing user's profile, we shouldn't check current password.");
    }
View Full Code Here

        UserContactType nullPatternContactType = new UserContactType();
        nullPatternContactType.setId(TYPE_ID_NULL_PATTERN);
        nullPatternContactType.setValidationPattern(null);
    when(contactsService.get(TYPE_ID_VALID)).thenReturn(validContactType);
    when(contactsService.get(TYPE_ID_NULL_PATTERN)).thenReturn(nullPatternContactType);
    when(contactsService.get(TYPE_ID_NON_EXISTENT)).thenThrow(new NotFoundException());
    validator = new ValidUserContactValidator();
    validator.setContactsService(contactsService);
    }
View Full Code Here

        assertEqualsSimplePageAndSimplePageDto(actualSimplePage, simplePage);
    }

    @Test (expectedExceptions = NotFoundException.class)
    public void showEditPageFailTest() throws NotFoundException {
        doThrow(new NotFoundException()).when(simplePageService).getPageByPathName(PATH_NAME);
        controller.showEditPage(PATH_NAME);
    }
View Full Code Here

    @Test
    public void showNotExistingPageTest() throws NotFoundException {
        JCUser user = new JCUser("username", "email", "password");
       
        when(simplePageService.getPageByPathName(PATH_NAME)).thenThrow(new NotFoundException());
        when(userService.getCurrentUser()).thenReturn(user);
       
        ModelAndView modelAndView = controller.showPage(PATH_NAME);
       
        assertViewName(modelAndView, SimplePageController.PAGE_NOT_FOUND);
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.plugin.api.exceptions.NotFoundException

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.