Package org.eurekastreams.server.action.request.stream

Examples of org.eurekastreams.server.action.request.stream.GetStreamsUserIsFollowingRequest


     * Initialize.
     */
    public void init()
    {
        pager = new BasicPager();
        model.fetch(new GetStreamsUserIsFollowingRequest(entityKey, pager.getStartItem(), pager.getEndItem()), false);
    }
View Full Code Here


     * Next.
     */
    public void next()
    {
        pager.nextPage();
        model.fetch(new GetStreamsUserIsFollowingRequest(entityKey, pager.getStartItem(), pager.getEndItem()), false);

    }
View Full Code Here

     * Prev.
     */
    public void prev()
    {
        pager.previousPage();
        model.fetch(new GetStreamsUserIsFollowingRequest(entityKey, pager.getStartItem(), pager.getEndItem()), false);
    }
View Full Code Here

                        with(any(FollowerStatus.class)));
            }
        });

        PrincipalActionContext actionContext = TestContextCreator.createPrincipalActionContext(
                new GetStreamsUserIsFollowingRequest(userAccountId, startIndex, endIndex), null, currentUserId);
        List<StreamDTO> results = sut.execute(actionContext).getPagedSet();
        assertEquals(6, results.size());
        assertEquals("a", results.get(0).getDisplayName());
        assertEquals("b", results.get(1).getDisplayName());
View Full Code Here

    }

    @Override
    public PagedSet<StreamDTO> execute(final PrincipalActionContext inActionContext) throws ExecutionException
    {
        GetStreamsUserIsFollowingRequest request = (GetStreamsUserIsFollowingRequest) inActionContext.getParams();
        Long start = System.currentTimeMillis();
        Long userId = getPersonIdByAccountIdMapper.execute(request.getAccountId());
        log.debug("Lookup requested user id time: " + (System.currentTimeMillis() - start) + "(ms).");
        Long currentUserId = inActionContext.getPrincipal().getId();

        ArrayList<StreamDTO> results = new ArrayList<StreamDTO>();
        PagedSet<StreamDTO> pagedResults = new PagedSet<StreamDTO>();

        // get person/group ModelViews, which implement StreamDTO, and add to results;
        start = System.currentTimeMillis();
        results.addAll(personModelViewsMapper.execute(personIdsUserIsFollowingMapper.execute(userId)));
        results.addAll(groupModelViewsMapper.execute(groupIdsUserIsFollowingMapper.execute(userId)));
        log.debug("Data retrieval time: " + (System.currentTimeMillis() - start) + "(ms).");

        // if no results, short-circuit here.
        if (results.isEmpty())
        {
            return pagedResults;
        }

        // sort results;
        start = System.currentTimeMillis();
        Collections.sort(results, STREAMDTO_DISPLAYNAME_COMPARATOR);
        log.debug("Data sort time:" + (System.currentTimeMillis() - start) + "(ms).");

        // set up PagedSet result and return.
        int total = results.size();
        int startIndex = request.getStartIndex();
        int endIndex = request.getEndIndex() >= total ? total - 1 : request.getEndIndex();

        // Note that the end index in the request is INCLUSIVE but the end index for subList() is EXCLUSIVE, so account
        // for the difference.
        ArrayList<StreamDTO> trimmedResults = new ArrayList<StreamDTO>(results.subList(startIndex, endIndex + 1));
        start = System.currentTimeMillis();
View Full Code Here

TOP

Related Classes of org.eurekastreams.server.action.request.stream.GetStreamsUserIsFollowingRequest

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.