Package org.eurekastreams.server.action.execution.notification

Examples of org.eurekastreams.server.action.execution.notification.NotificationBatch


        // NOTE: This code assumes that the DAO returns a list which can be safely altered, specifically that it
        // supports removing elements and is not used elsewhere (e.g. stored off).
        List<Long> adminIds = systemAdminsDAO.execute(null);
        adminIds.remove(inRequest.getActorId());

        NotificationBatch batch = new NotificationBatch(NotificationType.FLAG_ACTIVITY, adminIds);
        batch.setProperty(NotificationPropertyKeys.ACTOR, PersonModelView.class, inRequest.getActorId());
        batch.setProperty("activity", activity);
        batch.setProperty("stream", stream);
        batch.setPropertyAlias(NotificationPropertyKeys.SOURCE, "stream");
        batch.setProperty(NotificationPropertyKeys.HIGH_PRIORITY, true);
        batch.setProperty(NotificationPropertyKeys.URL, UiUrlBuilder.relativeUrlForFlaggedActivity());
        return batch;
    }
View Full Code Here


     * {@inheritDoc}
     */
    @Override
    public NotificationBatch translate(final PrebuiltNotificationsRequest inRequest)
    {
        NotificationBatch batch = new NotificationBatch(NotificationType.PASS_THROUGH, inRequest.getRecipientId());
        batch.setProperty(NotificationPropertyKeys.URL, inRequest.getUrl());
        batch.setProperty(NotificationPropertyKeys.HIGH_PRIORITY, inRequest.isHighPriority());
        batch.setProperty("message", inRequest.getMessage());
        batch.setProperty(NotificationPropertyKeys.SOURCE, OAuthConsumer.class, inRequest.getClientId());
        batch.setPropertyAlias(NotificationPropertyKeys.ACTOR, NotificationPropertyKeys.SOURCE);

        return batch;
    }
View Full Code Here

        // supports removing elements and is not used elsewhere (e.g. stored off).
        List<Long> followerIdsToNotify = followersDAO.execute(inRequest.getTargetEntityId());
        followerIdsToNotify.remove(inRequest.getActorId());
        followerIdsToNotify.remove(inRequest.getTargetEntityId());

        NotificationBatch batch = new NotificationBatch();
        if (inRequest.getActorId() != inRequest.getTargetEntityId())
        {
            batch.setRecipient(NotificationType.POST_TO_PERSONAL_STREAM, inRequest.getTargetEntityId());
        }
        if (!followerIdsToNotify.isEmpty())
        {
            batch.getRecipients().put(NotificationType.POST_TO_FOLLOWED_STREAM, followerIdsToNotify);
        }
        if (batch.getRecipients().isEmpty())
        {
            return null;
        }

        batch.setProperty(NotificationPropertyKeys.ACTOR, PersonModelView.class, inRequest.getActorId());
        batch.setProperty("stream", PersonModelView.class, inRequest.getTargetEntityId());
        batch.setProperty("activity", ActivityDTO.class, inRequest.getActivityId());
        batch.setPropertyAlias(NotificationPropertyKeys.SOURCE, "stream");
        batch.setProperty(NotificationPropertyKeys.URL, UiUrlBuilder.relativeUrlForActivity(inRequest.getActivityId()));
        return batch;
    }
View Full Code Here

    {
        DomainGroup group = groupDAO.execute(new FindByIdRequest("DomainGroup", inRequest.getTargetEntityId()));

        List<Long> admins = systemAdminIdsDAO.execute(null);

        NotificationBatch batch = new NotificationBatch(NotificationType.REQUEST_NEW_GROUP, admins);
        batch.setProperty(NotificationPropertyKeys.ACTOR, PersonModelView.class, inRequest.getActorId());
        batch.setProperty("group", group);
        batch.setPropertyAlias(NotificationPropertyKeys.SOURCE, "group");
        batch.setProperty(NotificationPropertyKeys.HIGH_PRIORITY, true);
        batch.setProperty(NotificationPropertyKeys.URL, UiUrlBuilder.relativeUrlForPendingGroupRequest());
        return batch;
    }
View Full Code Here

        {
            return null;
        }
        final long actorId = inRequest.getActorId();

        NotificationBatch batch = new NotificationBatch();

        // Adds post author as recipient
        long postAuthor = activity.getActor().getId();
        if (postAuthor != actorId)
        {
            batch.setRecipient(NotificationType.COMMENT_TO_PERSONAL_POST, postAuthor);
        }

        // Adds recipient who previously commented on this post
        List<Long> commentToCommentedRecipients = new ArrayList<Long>();
        for (long commentorId : commentorsDAO.execute(activityId))
        {
            if (commentorId != postAuthor && commentorId != actorId)
            {
                commentToCommentedRecipients.add(commentorId);

                // this recipient list will keep replacing the old value in the map when new recipients are found
                batch.getRecipients().put(NotificationType.COMMENT_TO_COMMENTED_POST, commentToCommentedRecipients);
            }
        }

        // Add properties
        batch.setProperty(NotificationPropertyKeys.ACTOR, PersonModelView.class, actorId);
        batch.setProperty("stream", activity.getDestinationStream());
        batch.setPropertyAlias(NotificationPropertyKeys.SOURCE, "stream");
        batch.setProperty("activity", activity);
        batch.setProperty("comment", CommentDTO.class, inRequest.getCommentId());
        batch.setProperty(NotificationPropertyKeys.URL, UiUrlBuilder.relativeUrlForActivity(activityId));

        return batch;
    }
View Full Code Here

    public NotificationBatch translate(final TargetEntityNotificationsRequest inRequest)
    {
        DomainGroupModelView group = groupDAO.execute(inRequest.getTargetEntityId());
        Collection<Long> recipientIds = groupCoordinatorDAO.execute(inRequest.getTargetEntityId());

        NotificationBatch batch = new NotificationBatch(NotificationType.REQUEST_NEW_GROUP_APPROVED, recipientIds);
        batch.setProperty("group", group);
        batch.setProperty(NotificationPropertyKeys.HIGH_PRIORITY, true);
        batch.setProperty(NotificationPropertyKeys.URL,
                UiUrlBuilder.relativeUrlForEntity(EntityType.GROUP, group.getUniqueId()));
        return batch;
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public NotificationBatch translate(final GroupRemovedNotificationsRequest inRequest)
    {
        NotificationBatch batch = new NotificationBatch(NotificationType.REQUEST_NEW_GROUP_DENIED,
                inRequest.getCoordinatorIds());
        batch.setProperty("groupName", inRequest.getGroupName());
        batch.setProperty(NotificationPropertyKeys.HIGH_PRIORITY, true);
        return batch;
    }
View Full Code Here

TOP

Related Classes of org.eurekastreams.server.action.execution.notification.NotificationBatch

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.