Package org.jtalks.jcommune.model.dto

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


    @Override
    public Page<Post> getPostsOfUser(JCUser userCreated, String page) {
        JCUser currentUser = userService.getCurrentUser();
        List<Long> allowedBranchesIds = topicDao.getAllowedBranchesIds(currentUser);

        PageRequest pageRequest = new PageRequest(page, currentUser.getPageSize());

        if (allowedBranchesIds.isEmpty()) {
            return new PageImpl<Post>(Collections.<Post>emptyList());
        } else {
            return this.getDao().getUserPosts(userCreated, pageRequest, allowedBranchesIds);
View Full Code Here


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

     * {@inheritDoc}
     */
    @Override
    public Page<PrivateMessage> getInboxForCurrentUser(String page) {
        JCUser currentUser = userService.getCurrentUser();
        PageRequest pageRequest = new PageRequest(page, currentUser.getPageSize());
        return this.getDao().getAllForUser(currentUser, pageRequest);
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public Page<PrivateMessage> getOutboxForCurrentUser(String page) {
        JCUser currentUser = userService.getCurrentUser();
        PageRequest pageRequest = new PageRequest(page, currentUser.getPageSize());
        return this.getDao().getAllFromUser(currentUser, pageRequest);
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public Page<PrivateMessage> getDraftsForCurrentUser(String page) {
        JCUser currentUser = userService.getCurrentUser();
        PageRequest pageRequest = new PageRequest(page, currentUser.getPageSize());
        return this.getDao().getDraftsForUser(currentUser, pageRequest);
    }
View Full Code Here

        int pageCount = 3;
        int pageSize = totalSize / pageCount;
        int messageCount = 50;
        JCUser userTo = PersistedObjectsFactory.getUser("UserTo", "mail2@mail.com");
        JCUser userFrom = PersistedObjectsFactory.getUser("UserFrom", "mail1@mail.com");
        PageRequest pageRequest = new PageRequest("1", pageSize);
        PersistedObjectsFactory.preparePrivateMessages(messageCount, userTo, userFrom);

        Page<PrivateMessage> messagePage = dao.getAllFromUser(userFrom, pageRequest);

        for (PrivateMessage message : messagePage.getContent()) {
View Full Code Here

        int totalSize = 50;
        int pageCount = 2;
        int pageSize = totalSize / pageCount;
        JCUser userTo = PersistedObjectsFactory.getUser("UserTo", "mail2@mail.com");
        JCUser userFrom = PersistedObjectsFactory.getUser("UserFrom", "mail1@mail.com");
        PageRequest pageRequest = new PageRequest("1", pageSize);
        PersistedObjectsFactory.preparePrivateMessages(totalSize, userTo, userFrom);

        Page<PrivateMessage> messagePage = dao.getAllFromUser(userFrom, pageRequest);

        assertEquals(messagePage.getContent().size(), pageSize, "Incorrect count of message in one page.");
View Full Code Here

        int pageCount = 3;
        int pageSize = totalSize / pageCount;
        int messageCount = 50;
        JCUser userTo = PersistedObjectsFactory.getUser("UserTo", "mail2@mail.com");
        JCUser userFrom = PersistedObjectsFactory.getUser("UserFrom", "mail1@mail.com");
        PageRequest pageRequest = new PageRequest("1", pageSize);
        PersistedObjectsFactory.preparePrivateMessages(messageCount, userTo, userFrom);

        Page<PrivateMessage> messagePage = dao.getAllFromUser(userFrom, pageRequest);

        assertEquals(messagePage.getTotalElements(), totalSize, "Incorrect total count.");
View Full Code Here

        int pageCount = 3;
        int pageSize = totalSize / pageCount;
        int messageCount = 50;
        JCUser userTo = PersistedObjectsFactory.getUser("UserTo", "mail2@mail.com");
        JCUser userFrom = PersistedObjectsFactory.getUser("UserFrom", "mail1@mail.com");
        PageRequest pageRequest = new PageRequest("1", pageSize);
        PersistedObjectsFactory.preparePrivateMessages(messageCount, userTo, userFrom);

        Page<PrivateMessage> messagePage = dao.getAllFromUser(userFrom, pageRequest);

        assertEquals(messagePage.getTotalPages(), pageCount, "Incorrect count of pages.");
View Full Code Here

        int pageCount = 3;
        int pageSize = totalSize / pageCount;
        int messageCount = 50;
        JCUser userTo = PersistedObjectsFactory.getUser("UserTo", "mail2@mail.com");
        JCUser userFrom = PersistedObjectsFactory.getUser("UserFrom", "mail1@mail.com");
        PageRequest pageRequest = new PageRequest("0", pageSize);
        PersistedObjectsFactory.preparePrivateMessages(messageCount, userTo, userFrom);

        Page<PrivateMessage> messagePage = dao.getAllFromUser(userFrom, pageRequest);

        assertEquals(messagePage.getTotalPages(), pageCount, "Incorrect count of pages.");
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.