Package org.eurekastreams.commons.server

Examples of org.eurekastreams.commons.server.UserActionRequest


        // when locking, just kill cache; when unlocking, reload
        if (request.getLockedStatus())
        {
            inActionContext.getUserActionRequests().add(
                    new UserActionRequest("deleteCacheKeysAction", null, (Serializable) Collections
                            .singleton(CacheKeys.PERSON_BY_ID + personId)));
        }
        else
        {
            inActionContext.getUserActionRequests().add(new UserActionRequest("cachePerson", null, personId));
        }

        return null;
    }
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
        inActionContext.getUserActionRequests().add(
                new UserActionRequest("deleteCacheKeysAction", null, (Serializable) Collections.singleton(cacheKey)));

        return new Boolean(true);
    }
View Full Code Here

        // Send email notification if necessary
        if (createRequest.getSendEmail() && sendWelcomeEmailAction != null && !sendWelcomeEmailAction.isEmpty())
        {
            inActionContext.getUserActionRequests().add(
                    new UserActionRequest(sendWelcomeEmailAction, null, new SendWelcomeEmailRequest(
                            inPerson.getEmail(), inPerson.getAccountId())));
        }

        return person;
    }
View Full Code Here

        setFeedsAsPendingMapper.execute(request);

        for (Long id : feedIds)
        {
             inActionContext.getUserActionRequests().add(
                        new UserActionRequest("refreshFeedAction", null, new RefreshFeedRequest(id)));
        }

        return null;
    }
View Full Code Here

        // Queue async action to update cache if necessary
        if (response.wasUserUpdated())
        {
            log.debug("Person " + ldapPerson.getAccountId() + " was updated - updating cache");
            inActionContext.getUserActionRequests().add(
                    new UserActionRequest("cachePerson", null, response.getPersonId()));
        }

        if (response.wasDisplayNameUpdated())
        {
            log.debug("Person " + ldapPerson.getAccountId()
View Full Code Here

        // send notification
        // Note: doesn't check whether the request was freshly added or whether it was already found, thus allowing a
        // user to "nag" the coordinators for access
        inActionContext.getUserActionRequests().add(
                new UserActionRequest(CreateNotificationsRequest.ACTION_NAME, null,
                        new TargetEntityNotificationsRequest(RequestType.REQUEST_GROUP_ACCESS, personId, target
                                .getId())));

        return null;
    }
View Full Code Here

        hideResourceActivityMapper.execute(activityId);

        // submit request for additional cache updates due to activity hide.
        inActionContext.getUserActionRequests().add(
                new UserActionRequest("hideResourceActivityCacheUpdate", null, activityId));

        return true;
    }
View Full Code Here

            domainGroupMapper.addFollower(followerId, targetId);
            // Update the cache list of followers
            addCachedGroupFollowerMapper.execute(followerId, targetId);

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

            // remove any requests from the user for group membership
            if (deleteRequestForGroupMembershipMapper
                    .execute(new RequestForGroupMembershipRequest(targetId, followerId)))
            {
                // if any requests were present, then user was just approved for access
                asyncRequests.add(new UserActionRequest(CreateNotificationsRequest.ACTION_NAME, null,
                        new GroupMembershipResponseNotificationsRequest(RequestType.REQUEST_GROUP_ACCESS_APPROVED,
                                inActionContext.getActionContext().getPrincipal().getId(), targetId, followerId)));
            }

            // remove person modelview from cache as groupstreamhiddenlineindex will be changed.
            deleteCacheKeyMapper.execute(Collections.singleton(CacheKeys.PERSON_BY_ID + followerId));

            // Sends new follower notifications.
            asyncRequests.add(new UserActionRequest(CreateNotificationsRequest.ACTION_NAME, null,
                    new TargetEntityNotificationsRequest(RequestType.FOLLOW_GROUP, followerId, targetId)));

            // Posts a message to the user's personal stream unless this is a new pending group
            if (!isPending)
            {
                String targetStream = "";

                if (params instanceof SetFollowingStatusRequest)
                {
                    SetFollowingStatusRequest currentRequest = (SetFollowingStatusRequest) params;
                    targetStream = currentRequest.getTargetUniqueId();
                }
                else if (params instanceof SetFollowingStatusByGroupCreatorRequest)
                {
                    SetFollowingStatusByGroupCreatorRequest currentRequest = // \n
                    (SetFollowingStatusByGroupCreatorRequest) params;
                    targetStream = currentRequest.getTargetUniqueId();
                }

                StreamEntityDTO destination = new StreamEntityDTO();
                destination.setUniqueIdentifier(followerAccountId);
                destination.setType(EntityType.PERSON);

                ActivityDTO activity = new ActivityDTO();
                HashMap<String, String> props = new HashMap<String, String>();
                activity.setBaseObjectProperties(props);

                String content = "";

                if (targetStream.length() > 0)
                {
                    content = "%EUREKA:ACTORNAME% is now following the [" + targetName + "](#activity/group/"
                            + targetStream + ") group";
                }
                else
                {
                    content = "%EUREKA:ACTORNAME% is now following the " + targetName + " group";
                }

                activity.getBaseObjectProperties().put("content", content);
                activity.setDestinationStream(destination);
                activity.setBaseObjectType(BaseObjectType.NOTE);
                activity.setVerb(ActivityVerb.POST);

                // Note: create a principal for the follower: we want to post on the follower's stream as the
                // follower.
                // The current principal will be different from the follower in some cases, namely when following a
                // private group (the current principal / actor is the coordinator who approved access).
                new InlineExecutionStrategyExecutor().execute(postActivityExecutor, new PostActivityRequest(activity),
                        new DefaultPrincipal(followerAccountId, null, followerId),
                        inActionContext.getUserActionRequests());
            }
            break;

        case NOTFOLLOWING:

            // Check if the User to be removed is a Group Coordinator.
            boolean isToBeRemovedUserGroupCoordinator = domainGroupMapper.isInputUserGroupCoordinator(followerId,
                    targetId);

            // Do not remove the last Group Coordinator.
            if ((domainGroupMapper.getGroupCoordinatorCount(targetId) == 1) && isToBeRemovedUserGroupCoordinator)
            {
                log.error("Cannot remove followerId: " + followerId + " " + "from targetId:" + targetId
                        + " since there's " + "only a single Group Coordinator remaining " + "in the Group");
                throw new ExecutionException("Cannot remove followerId: " + followerId + " " + "from targetId:"
                        + targetId + " since there's " + "only a single Group Coordinator remaining " + "in the Group");
            }

            // Update the db for list of followers and following.
            domainGroupMapper.removeFollower(followerId, targetId);

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

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

            // Remove the target group the current user is now following from the list of
            // groups that the current user is already following.
            asyncRequests.add(new UserActionRequest("deleteIdsFromLists", null, new DeleteIdsFromListsRequest(
                    Collections.singletonList(CacheKeys.GROUPS_FOLLOWED_BY_PERSON + followerId), Collections
                            .singletonList(targetId))));

            if (isToBeRemovedUserGroupCoordinator)
            {
                // delete group coordinator from db
                domainGroupMapper.removeGroupCoordinator(followerId, targetId);

                // queue the removal of the target group's coordinator
                asyncRequests.add(new UserActionRequest("deleteCacheKeysAction", null, (Serializable) Collections
                        .singleton(CacheKeys.COORDINATOR_PERSON_IDS_BY_GROUP_ID + targetId)));

                // Update the 'PRIVATE_GROUP_IDS_VIEWABLE_BY_PERSON_AS_COORDINATOR' cache if Private Group
                if (domainGroupMapper.isGroupPrivate(targetId))
                {
                    // queue the removal the person's list of followed group ids
                    asyncRequests.add(new UserActionRequest("deleteCacheKeysAction", null, (Serializable) Collections
                            .singleton(CacheKeys.PRIVATE_GROUP_IDS_VIEWABLE_BY_PERSON_AS_COORDINATOR + followerId)));
                }
            }

            break;
View Full Code Here

                String address = entry.getKey();
                userEmail.setToRecipient(address);
                // set the description (for logging / debugging)
                userEmail.setDescription(inType + " with token to " + address);

                requests.add(new UserActionRequest("sendEmailNotificationAction", null, userEmail));
            }
        }
        if (!addresses.isEmpty())
        {
            email.setTextBody(noReplyTextBody);
            if (noReplyHtmlBody != null)
            {
                email.setHtmlBody(noReplyHtmlBody);
            }

            if (addresses.size() == 1)
            {
                final String address = addresses.get(0);
                email.setToRecipient(address);
                // set the description (for logging / debugging)
                email.setDescription(inType + " to " + address);
            }
            else
            {
                email.setBccRecipients(StringUtils.join(addresses, ','));
                // set the description (for logging / debugging)
                email.setDescription(inType + " to " + inRecipients.size() + " recipients");
            }

            // set the reply-to to the actor (so replies to emails go to the actor, not the system)

            if (template.getReplyAddressType() == ReplyAction.ACTOR)
            {
                Object obj = inProperties.get(NotificationPropertyKeys.ACTOR);
                if (obj instanceof HasEmail)
                {
                    HasEmail actor = (HasEmail) obj;
                    String actorEmail = actor.getEmail();
                    if (StringUtils.isNotBlank(actorEmail))
                    {
                        email.setReplyTo(actorEmail);
                    }
                }
            }

            requests.add(new UserActionRequest("sendEmailNotificationAction", null, email));
        }
        return requests;
    }
View Full Code Here

            log.info("Queuing UserActionRequest for removing expired activities from index (num of ids): "
                    + response.getActivityIds().size());
        }
        // Put an action on the queue to delete the activities from search index
        inActionContext.getUserActionRequests().add(
                new UserActionRequest("deleteFromSearchIndexAction", null, new DeleteFromSearchIndexRequest(
                        Activity.class, response.getActivityIds())));

        if (log.isInfoEnabled())
        {
            log.info("Queuing UserActionRequest for removing expired activity ids from lists cache keys: " + keys);
        }
        inActionContext.getUserActionRequests().add(
                new UserActionRequest("deleteIdsFromLists", null, new DeleteIdsFromListsRequest(keys, response
                        .getActivityIds())));

        if (log.isInfoEnabled())
        {
            log.info("Queuing UserActionRequests for removing expired activity ids from cache: "
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.