Package org.eurekastreams.commons.server

Examples of org.eurekastreams.commons.server.UserActionRequest


        // get the message content
        String content = messageContentExtractor.extract(message);

        // choose action to execute
        UserActionRequest actionSelection = actionSelector.select(tokenData, content, person);

        // execute action
        executeAction(message, actionSelection, person, inResponseMessages);
        return true;
    }
View Full Code Here


        // clear cache for the updated item
        String key = cacheKeyPrefix + cacheKeyParameterSupplier.transform(realContext);
        cache.delete(key);
        inActionContext.getUserActionRequests().add(
                new UserActionRequest("deleteCacheKeysAction", null, (Serializable) Collections.singleton(key)));

        return result;
    }
View Full Code Here

        if (request.getLikeActionType() == LikeActionType.ADD_LIKE)
        {
            insertLikedActivity.execute(likeActivityData);

            inActionContext.getUserActionRequests().add(
                    new UserActionRequest("loadLikedActivityIdsByUserId", null, userId));

            CreateNotificationsRequest notificationRequest = new ActivityNotificationsRequest(RequestType.LIKE,
                    userId, 0L, request.getActivityId());
            inActionContext.getUserActionRequests().add(
                    new UserActionRequest(CreateNotificationsRequest.ACTION_NAME, null, notificationRequest));
        }
        else
        {
            deleteLikedActivity.execute(likeActivityData);
        }
View Full Code Here

        {
            CommentDTO comment = new CommentDTO();
            comment.setBody(content);
            comment.setActivityId(tokenData.get(TokenContentFormatter.META_KEY_ACTIVITY));

            return new UserActionRequest("postSplitActivityCommentsAction", null, comment);
        }
        // ID of person -> Post to personal stream
        else if (tokenData.containsKey(TokenContentFormatter.META_KEY_PERSON_STREAM))
        {
            return new UserActionRequest("postSplitActivityAndCommentsAction", null,
                    new PostSplitActivityAndCommentsRequest(EntityType.PERSON,
                            tokenData.get(TokenContentFormatter.META_KEY_PERSON_STREAM), content));
        }
        // ID of group -> Post to group stream
        else if (tokenData.containsKey(TokenContentFormatter.META_KEY_GROUP_STREAM))
        {
            return new UserActionRequest("postSplitActivityAndCommentsAction", null,
                    new PostSplitActivityAndCommentsRequest(EntityType.GROUP,
                            tokenData.get(TokenContentFormatter.META_KEY_GROUP_STREAM), content));
        }
        else
        {
View Full Code Here

        if (requestType != null)
        {
            CreateNotificationsRequest notificationRequest = new ActivityNotificationsRequest(requestType, actorId,
                    destinationId, persistedActivityDTO.getEntityId());
            queueRequests
                    .add(new UserActionRequest(CreateNotificationsRequest.ACTION_NAME, null, notificationRequest));
        }
        // TODO: fix this so activityDTO fields related to specific user
        // are not saved in cache.

        queueRequests.add(new UserActionRequest("postActivityAsyncAction", null, new PostActivityRequest(
                persistedActivityDTO)));

        inActionContext.getUserActionRequests().addAll(queueRequests);

        PersonModelView person = getPersonModelViewByAccountIdMapper.execute(actorAccountName);
View Full Code Here

                            + "', then queuing it up for post-transaction cleanup to avoid race.");
                    cache.delete(cacheKey);

                    // queue up a cache delete for after this transaction is
                    // closed - to prevent race condition
                    inUserActionRequestList.add(new UserActionRequest("deleteCacheKeysAction", null,
                            (Serializable) Collections.singleton(cacheKey)));
                }
            }
        }
View Full Code Here

                {
                    log.trace("Pushing UserActionRequest to queue for deleteActivitiesByIds with "
                            + chunkActivityIds.size() + " activities");
                }
                inActionContext.getUserActionRequests().add(
                        new UserActionRequest("deleteActivitiesByIds", null, chunkActivityIds));

                expired.subList(0, count).clear();
            }
        }
        return Boolean.TRUE;
View Full Code Here

            logger.trace("Add new following to the list of following.");
            mapper.addFollower(followerPersonId, followedPersonId);
            addCachedFollowerMapper.execute(followerPersonId, followedPersonId);

            // Queue async action to remove the newly followed person from cache (to sync follower counts)
            asyncRequests.add(new UserActionRequest("deleteCacheKeysAction", null, (Serializable) Collections
                    .singleton(CacheKeys.PERSON_BY_ID + followedPersonId)));

            logger.trace("Submit async action to update all cached activities.");

            // Post an async action to update the cache for the user's list of following activity ids.
            asyncRequests.add(new UserActionRequest("refreshFollowedByActivities", null, followerPersonId));

            // queues up new follower notifications.
            asyncRequests
                    .add(new UserActionRequest(CreateNotificationsRequest.ACTION_NAME, null,
                            new TargetEntityNotificationsRequest(RequestType.FOLLOW_PERSON, followerPersonId,
                                    followedPersonId)));

            break;
        case NOTFOLLOWING:
            logger.trace("Remove new following from the list of following.");

            mapper.removeFollower(followerPersonId, followedPersonId);

            // Queue async action to remove the newly followed person from cache (to sync follower counts)
            asyncRequests.add(new UserActionRequest("deleteCacheKeysAction", null, (Serializable) Collections
                    .singleton(CacheKeys.PERSON_BY_ID + followedPersonId)));

            // Remove the current user that is severing a relationship with the target
            // from the list of followers for that target user.
            asyncRequests.add(new UserActionRequest("deleteIdsFromLists", null, new DeleteIdsFromListsRequest(
                    Collections.singletonList(CacheKeys.FOLLOWERS_BY_PERSON + followedPersonId), Collections
                            .singletonList(followerPersonId))));

            // Remove the target user the current user is no longer following from the list of
            // users that the current is already following.
            asyncRequests.add(new UserActionRequest("deleteIdsFromLists", null, new DeleteIdsFromListsRequest(
                    Collections.singletonList(CacheKeys.PEOPLE_FOLLOWED_BY_PERSON + followerPersonId), Collections
                            .singletonList(followedPersonId))));

            // Post an async action to update the cache for the user's list of following activity ids.
            asyncRequests.add(new UserActionRequest("refreshFollowedByActivities", null, followerPersonId));
            break;
        default:
            // do nothing.
        }
View Full Code Here

        mapper.execute(request);

        // send notification
        inActionContext.getUserActionRequests().add(
                new UserActionRequest(CreateNotificationsRequest.ACTION_NAME, null,
                        new GroupMembershipResponseNotificationsRequest(RequestType.REQUEST_GROUP_ACCESS_DENIED,
                                inActionContext.getActionContext().getPrincipal().getId(), request.getGroupId(),
                                request.getPersonId())));

        return null;
View Full Code Here

            }
        }

        // submit request for additional cache updates due to activity deletion.
        inActionContext.getUserActionRequests().add(
                new UserActionRequest("deleteActivityCacheUpdate", null, new DeleteActivityCacheUpdateRequest(
                        activity, commentIds, personIdsWithActivityStarred)));

        // Put an action on the queue to delete the activity from search index.
        inActionContext.getUserActionRequests().add(
                new UserActionRequest("deleteFromSearchIndexAction", null, new DeleteFromSearchIndexRequest(
                        Activity.class, activityId)));

        return Boolean.TRUE;
    }
View Full Code Here

TOP

Related Classes of org.eurekastreams.commons.server.UserActionRequest

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.