Package org.jtalks.jcommune.model.dto

Examples of org.jtalks.jcommune.model.dto.PageRequest


    public void testPostOfUserWithEnabledPagingPageLessTooLow() {
        int totalSize = 50;
        int pageCount = 2;
        int pageSize = totalSize / pageCount;

        PageRequest pageRequest = new PageRequest(
                PAGE_NUMBER_TOO_LOW, pageSize);
        List<Post> posts = PersistedObjectsFactory.createAndSavePostList(totalSize);
        JCUser author = posts.get(0).getUserCreated();
        List<Long> allowedBranchesIds = new ArrayList<>();
        allowedBranchesIds.add(posts.get(0).getTopic().getBranch().getId());
View Full Code Here


    public void testPostOfUserWithEnabledPagingPageTooBig() {
        int totalSize = 50;
        int pageCount = 2;
        int pageSize = totalSize / pageCount;

        PageRequest pageRequest = new PageRequest(
                PAGE_NUMBER_TOO_BIG, pageSize);
        List<Post> posts = PersistedObjectsFactory.createAndSavePostList(totalSize);
        JCUser author = posts.get(0).getUserCreated();
        List<Long> allowedBranchesIds = new ArrayList<>();
        allowedBranchesIds.add(posts.get(0).getTopic().getBranch().getId());
View Full Code Here

        assertEquals(postsPage.getNumber(), pageCount, "Incorrect page number");
    }

    @Test
    public void testNullPostOfUser() {
        PageRequest pageRequest = new PageRequest("1", 50);
        JCUser user = ObjectsFactory.getDefaultUser();
        session.save(user);
        List<Long> allowedBranchesIds = new ArrayList<>();
        allowedBranchesIds.add(1L);
View Full Code Here

    @Test
    public void testGetPostsWithEnabledPaging() {
        int totalSize = 50;
        int pageCount = 2;
        int pageSize = totalSize / pageCount;
        PageRequest pageRequest = new PageRequest("1", pageSize);
        List<Post> posts = PersistedObjectsFactory.createAndSavePostList(totalSize);
        Topic topic = posts.get(0).getTopic();

        Page<Post> postsPage = dao.getPosts(topic, pageRequest);
View Full Code Here

    @Test
    public void testGetPostsWithEnabledPagingPageTooLow() {
        int totalSize = 50;
        int pageCount = 2;
        int pageSize = totalSize / pageCount;
        PageRequest pageRequest = new PageRequest(PAGE_NUMBER_TOO_LOW, pageSize);
        List<Post> posts = PersistedObjectsFactory.createAndSavePostList(totalSize);
        Topic topic = posts.get(0).getTopic();

        Page<Post> postsPage = dao.getPosts(topic, pageRequest);
View Full Code Here

    @Test
    public void testGetPostsWithEnabledPagingPageTooBig() {
        int totalSize = 50;
        int pageCount = 2;
        int pageSize = totalSize / pageCount;
        PageRequest pageRequest = new PageRequest(PAGE_NUMBER_TOO_BIG, pageSize);
        List<Post> posts = PersistedObjectsFactory.createAndSavePostList(totalSize);
        Topic topic = posts.get(0).getTopic();

        Page<Post> postsPage = dao.getPosts(topic, pageRequest);
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public Page<Topic> getRecentTopics(String page) {
        int pageSize = userService.getCurrentUser().getPageSize();
        PageRequest pageRequest = new PageRequest(page, pageSize);
        DateTime date24HoursAgo = new DateTime().minusDays(1);
        return this.getDao().getTopicsUpdatedSince(date24HoursAgo, pageRequest, userService.getCurrentUser());
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public Page<Topic> getUnansweredTopics(String page) {
        int pageSize = userService.getCurrentUser().getPageSize();
        PageRequest pageRequest = new PageRequest(page, pageSize);
        return this.getDao().getUnansweredTopics(pageRequest, userService.getCurrentUser());
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public Page<Topic> getTopics(Branch branch, String page) {
        int pageSize = userService.getCurrentUser().getPageSize();
        PageRequest pageRequest = new PageRequest(page, pageSize);
        return getDao().getTopics(branch, pageRequest);
    }
View Full Code Here

        List<Long> allowedBranchesIds = this.getDao().getAllowedBranchesIds(currentUser);

        if (!StringUtils.isEmpty(phrase) && !allowedBranchesIds.isEmpty()) {
            int pageSize = currentUser.getPageSize();
            PageRequest pageRequest = new PageRequest(page, pageSize);
            // hibernate search refuses to process long string throwing error
            String normalizedPhrase = StringUtils.left(phrase, 50);

            return searchDao.searchByTitleAndContent(normalizedPhrase, pageRequest, allowedBranchesIds);
        }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.model.dto.PageRequest

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.