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

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


        // request the data to get the counts
        // We need the counts for both of the lists, but at most one list will perform an initial data load, we need to
        // force the load. (Only the list which is visible will load; if the tab is inactive then there are zero
        // visible lists.)
        FlaggedActivityModel.getInstance().fetch(new GetFlaggedActivitiesRequest(0, 1), false);
        PendingGroupsModel.getInstance().fetch(new GetPendingGroupsRequest(0, 1), false);

        // wire up events to refresh the list when something is removed
        eventBus.addObserver(UpdatedActivityFlagResponseEvent.class, new Observer<UpdatedActivityFlagResponseEvent>()
        {
            public void update(final UpdatedActivityFlagResponseEvent ev)
            {
                eventBus.notifyObservers(new ShowNotificationEvent(new Notification(
                        "The flagged activity has been allowed")));
                adminTabContent.reload();
            }
        });

        eventBus.addObserver(UpdatedReviewPendingGroupResponseEvent.class,
                new Observer<UpdatedReviewPendingGroupResponseEvent>()
                {
                    public void update(final UpdatedReviewPendingGroupResponseEvent ev)
                    {
                        adminTabContent.reload();
                    }
                });

        eventBus.addObserver(DeletedActivityResponseEvent.class, new Observer<DeletedActivityResponseEvent>()
        {
            public void update(final DeletedActivityResponseEvent ev)
            {
                adminTabContent.reload();
            }
        });

        // prepare the StaticResourceBundle.INSTANCE.coreCss().filters()
        // flagged content StaticResourceBundle.INSTANCE.coreCss().filter()
        StreamMessageItemRenderer flaggedRenderer = new StreamMessageItemRenderer(ShowRecipient.YES);
        flaggedRenderer.setShowManageFlagged(true);
        flaggedRenderer.setShowComment(true);

        BaseActivityLinkBuilder activityLinkBuilder = new InContextActivityLinkBuilder();
        activityLinkBuilder.addExtraParameter("manageFlagged", "true");
        flaggedRenderer.setActivityLinkBuilder(activityLinkBuilder);
        adminTabContent.addSet(flaggedActivitiesFilterName, FlaggedActivityModel.getInstance(), flaggedRenderer,
                new GetFlaggedActivitiesRequest(0, 0));
        // pending groups StaticResourceBundle.INSTANCE.coreCss().filter()
        adminTabContent.addSet(pendingGroupsFilterName, PendingGroupsModel.getInstance(), new PendingGroupRenderer(),
                new GetPendingGroupsRequest(0, 0));

        return adminTabContent;
View Full Code Here


    @Test
    @SuppressWarnings("unchecked")
    public void testExecute()
    {
        final String accountId = "sldfjkds";
        final GetFlaggedActivitiesRequest rqst = new GetFlaggedActivitiesRequest(3, 5);
        final PagedSet<ActivityDTO> pagedSet = context.mock(PagedSet.class);
        final List<ActivityDTO> activities = new ArrayList<ActivityDTO>();

        context.checking(new Expectations()
        {
            {
                // mapper should get a request with the same values as the one passed to the action.
                oneOf(mapper).execute(with(equalInternally(rqst)));
                will(returnValue(pagedSet));

                allowing(actionCtx).getParams();
                will(returnValue(rqst));

                allowing(actionCtx).getPrincipal();
                will(returnValue(principal));

                allowing(principal).getAccountId();
                will(returnValue(accountId));

                oneOf(getPersonModelViewByAccountIdMapper).execute(accountId);
                will(returnValue(pmv));

                allowing(pagedSet).getPagedSet();
                will(returnValue(activities));

                oneOf(activityDeletabilityFilter).filter(activities, pmv);
            }
        });

        Serializable result = sut.execute(actionCtx);
        context.assertIsSatisfied();
        assertSame(pagedSet, result);

        assertEquals(accountId, rqst.getRequestingUserAccountId());
    }
View Full Code Here

                oneOf(bulkActivitiesMapper).execute(expectedFlaggedActivities);
                will(returnValue(activityDTOs));
            }
        });

        GetFlaggedActivitiesRequest request = new GetFlaggedActivitiesRequest(startIndex, endIndex);
        request.setRequestingUserAccountId(userName);

        // perform SUT
        PagedSet<ActivityDTO> flaggedActivities = sut.execute(request);

        // verify
View Full Code Here

     * Test getting activities without a user account.
     */
    @Test(expected = RuntimeException.class)
    public void testExecuteWithoutUserAccountId()
    {
        PagedSet<ActivityDTO> flaggedActivities = sut.execute(new GetFlaggedActivitiesRequest(0, 9));
        assertEquals(1, flaggedActivities.getPagedSet().size());
    }
View Full Code Here

     */
    @Override
    public Serializable execute(final PrincipalActionContext inActionContext)
    {
        String userName = inActionContext.getPrincipal().getAccountId();
        GetFlaggedActivitiesRequest request = (GetFlaggedActivitiesRequest) inActionContext.getParams();

        if (log.isInfoEnabled())
        {
            log.info("scoping the request for flagged activities with the requesting user account: " + userName);
        }
        request.setRequestingUserAccountId(userName);
        PagedSet<ActivityDTO> activities = mapper.execute(request);

        activityDeletabilityFilter.filter(activities.getPagedSet(), getPersonModelViewByAccountIdMapper
                .execute(inActionContext.getPrincipal().getAccountId()));

View Full Code Here

TOP

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

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.