Package org.eurekastreams.server.action.request.opensocial

Examples of org.eurekastreams.server.action.request.opensocial.GetUserActivitiesRequest


                        maxActivitiesToReturnByOpenSocialId, securityTrimmer);

        final Principal principal = context.mock(Principal.class);
        final PrincipalActionContext actionContext = context.mock(PrincipalActionContext.class);

        final GetUserActivitiesRequest request = context.mock(GetUserActivitiesRequest.class);

        final List<Long> activityIds = new ArrayList<Long>();
        final Set<String> openSocialIds = new HashSet<String>();

        context.checking(new Expectations()
View Full Code Here


                        maxActivitiesToReturnByOpenSocialId, securityTrimmer);

        final Principal principal = context.mock(Principal.class);
        final PrincipalActionContext actionContext = context.mock(PrincipalActionContext.class);

        final GetUserActivitiesRequest request = context.mock(GetUserActivitiesRequest.class);

        final List<Long> activityIds = null;
        final Set<String> openSocialIds = null;

        context.checking(new Expectations()
View Full Code Here

                        maxActivitiesToReturnByOpenSocialId, securityTrimmer);

        final Principal principal = context.mock(Principal.class);
        final PrincipalActionContext actionContext = context.mock(PrincipalActionContext.class);

        final GetUserActivitiesRequest request = context.mock(GetUserActivitiesRequest.class);

        final List<Long> activityIds = new ArrayList<Long>();
        final Set<String> openSocialIds = new HashSet<String>();
        openSocialIds.add("grape");
        openSocialIds.add("potato");
View Full Code Here

        final Principal principal = context.mock(Principal.class);
        final Long principalId = 1L;
        final PrincipalActionContext actionContext = context.mock(PrincipalActionContext.class);

        final GetUserActivitiesRequest request = context.mock(GetUserActivitiesRequest.class);

        final List<Long> activityIds = new ArrayList<Long>();
        activityIds.add(act1Id);
        activityIds.add(act2Id);
View Full Code Here

        final Principal principal = context.mock(Principal.class);
        final Long principalId = 1L;
        final PrincipalActionContext actionContext = context.mock(PrincipalActionContext.class);

        final GetUserActivitiesRequest request = context.mock(GetUserActivitiesRequest.class);

        final List<Long> activityIds = new ArrayList<Long>();
        activityIds.add(act1Id);

        final Set<String> openSocialIds = new HashSet<String>();
View Full Code Here

        final Principal principal = context.mock(Principal.class);
        final Long principalId = 1L;
        final PrincipalActionContext actionContext = context.mock(PrincipalActionContext.class);

        final GetUserActivitiesRequest request = context.mock(GetUserActivitiesRequest.class);

        final List<Long> activityIds = new ArrayList<Long>();
        activityIds.add(newActId);

        final Set<String> openSocialIds = new HashSet<String>();
View Full Code Here

     * This execute method retrieves the ActivityDTO objects for the parameters passed in.
     */
    @Override
    public LinkedList<ActivityDTO> execute(final PrincipalActionContext inActionContext) throws ExecutionException
    {
        GetUserActivitiesRequest currentRequest = (GetUserActivitiesRequest) inActionContext.getParams();
        LinkedList<ActivityDTO> currentActivityDTOs = new LinkedList<ActivityDTO>();

        if (currentRequest.getOpenSocialIds() != null && currentRequest.getOpenSocialIds().size() > 0)
        {
            List<PersonModelView> users = getPeopleByOpenSocialIds.execute(new ArrayList<String>(currentRequest
                    .getOpenSocialIds()));

            if (users.size() > 0)
            {
                final JSONObject json = new JSONObject();
                json.put("count", maxActivitiesToReturnByOpenSocialId);

                JSONArray recipients = new JSONArray();
                for (PersonModelView user : users)
                {
                    JSONObject recipient = new JSONObject();
                    recipient.put("type", "PERSON");
                    recipient.put("name", user.getAccountId());

                    recipients.add(recipient);
                }
                JSONObject query = new JSONObject();
                query.put("recipient", recipients);
                json.put("query", query);

                PrincipalActionContext context = new PrincipalActionContext()
                {
                    @Override
                    public Principal getPrincipal()
                    {
                        return inActionContext.getPrincipal();
                    }

                    @Override
                    public String getActionId()
                    {
                        return null;
                    }

                    @Override
                    public Serializable getParams()
                    {
                        return json.toString();
                    }

                    @Override
                    public Map<String, Object> getState()
                    {
                        return null;
                    }

                    @Override
                    public void setActionId(final String inActionId)
                    {
                    }
                };

                PagedSet<ActivityDTO> activities = (PagedSet<ActivityDTO>) getActivitiesByRequestExecution
                        .execute(context);

                currentActivityDTOs.addAll(activities.getPagedSet());
            }
        }

        // if the user has provided activities to retrieve in the parameters, retrieve the corresponding
        // ActivityDTO objects.
        if (currentRequest.getActivityIds() != null && currentRequest.getActivityIds().size() > 0)
        {
            List<Long> activityIds = new ArrayList<Long>(currentRequest.getActivityIds());

            // only look for IDs that aren't yet in the list
            for (ActivityDTO act : currentActivityDTOs)
            {
                if (activityIds.contains(act.getId()))
View Full Code Here

                }
            }

            log.debug("Sending getActivities userIdList to action: " + userIdList.toString());

            GetUserActivitiesRequest currentRequest = new GetUserActivitiesRequest(new ArrayList<Long>(), userIdList);
            ServiceActionContext currentContext = new ServiceActionContext(currentRequest,
                    openSocialPrincipalDao.execute(token.getViewerId()));

            LinkedList<ActivityDTO> activities = (LinkedList<ActivityDTO>) serviceActionController.execute(
                    currentContext, getUserActivitiesAction);
View Full Code Here

            }

            Set<String> openSocialIdsForRequest = new HashSet<String>();
            openSocialIdsForRequest.add(userId.getUserId(token));

            GetUserActivitiesRequest currentRequest = new GetUserActivitiesRequest(activityIdsForRequest,
                    openSocialIdsForRequest);
            ServiceActionContext currentContext = new ServiceActionContext(currentRequest,
                    openSocialPrincipalDao.execute(userId.getUserId(token)));

            LinkedList<ActivityDTO> activities = (LinkedList<ActivityDTO>) serviceActionController.execute(
View Full Code Here

TOP

Related Classes of org.eurekastreams.server.action.request.opensocial.GetUserActivitiesRequest

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.