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

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


                allowing(idToUniqueIdDAO).execute(ACTOR_ID);
                will(returnValue("somebody"));
            }
        });

        NotificationBatch results = sut.translate(new TargetEntityNotificationsRequest(null, ACTOR_ID, FOLLOWED_ID));

        // check recipients
        assertEquals(1, results.getRecipients().size());
        TranslatorTestHelper.assertRecipients(results, NotificationType.FOLLOW_PERSON, FOLLOWED_ID);

        // check properties
        PropertyMap<Object> props = results.getProperties();
        assertEquals(4, props.size());
        PropertyMapTestHelper.assertPlaceholder(props, "actor", PersonModelView.class, ACTOR_ID);
        PropertyMapTestHelper.assertPlaceholder(props, "stream", PersonModelView.class, FOLLOWED_ID);
        PropertyMapTestHelper.assertAlias(props, "source", "stream");
        PropertyMapTestHelper.assertValue(props, NotificationPropertyKeys.URL, "#activity/person/somebody");
View Full Code Here


            }
        });

        CommentNotificationsRequest request = new CommentNotificationsRequest(null, ACTOR_ID, DESTINATION_ID,
                ACTIVITY_ID, COMMENT_ID);
        NotificationBatch results = sut.translate(request);

        context.assertIsSatisfied();

        // check recipients
        assertEquals(2, results.getRecipients().size());
        TranslatorTestHelper.assertRecipients(results, NotificationType.COMMENT_TO_PERSONAL_POST, AUTHOR_ID);
        TranslatorTestHelper.assertRecipients(results, NotificationType.COMMENT_TO_COMMENTED_POST, STREAM_OWNER_ID,
                COMMENTOR1, COMMENTOR2);

        // check properties
        PropertyMap<Object> props = results.getProperties();
        assertEquals(6, props.size());
        PropertyMapTestHelper.assertPlaceholder(props, "actor", PersonModelView.class, ACTOR_ID);
        PropertyMapTestHelper.assertValue(props, "stream", activity.getDestinationStream());
        PropertyMapTestHelper.assertAlias(props, "source", "stream");
        PropertyMapTestHelper.assertValue(props, "activity", activity);
View Full Code Here

            }
        });

        CommentNotificationsRequest request = new CommentNotificationsRequest(null, AUTHOR_ID, DESTINATION_ID,
                ACTIVITY_ID, COMMENT_ID);
        NotificationBatch results = sut.translate(request);

        context.assertIsSatisfied();

        // check recipients
        assertEquals(0, results.getRecipients().size());
    }
View Full Code Here

            }
        });

        CommentNotificationsRequest request = new CommentNotificationsRequest(null, ACTOR_ID, DESTINATION_ID,
                ACTIVITY_ID, COMMENT_ID);
        NotificationBatch results = sut.translate(request);

        context.assertIsSatisfied();
        assertNull(results);
    }
View Full Code Here

        if (idsToNotify.isEmpty())
        {
            return null;
        }

        NotificationBatch batch = new NotificationBatch(NotificationType.POST_TO_FOLLOWED_STREAM, idsToNotify);
        batch.setProperty(NotificationPropertyKeys.ACTOR, PersonModelView.class, inRequest.getActorId());
        batch.setProperty("stream", DomainGroupModelView.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

        if (coordinatorIds.contains(inRequest.getActorId()))
        {
            return null;
        }

        NotificationBatch batch = new NotificationBatch(NotificationType.FOLLOW_GROUP, coordinatorIds);
        batch.setProperty(NotificationPropertyKeys.ACTOR, PersonModelView.class, inRequest.getActorId());
        batch.setProperty("stream", DomainGroupModelView.class, inRequest.getTargetEntityId());
        batch.setPropertyAlias(NotificationPropertyKeys.SOURCE, "stream");

        batch.setProperty(NotificationPropertyKeys.URL,
                UiUrlBuilder.relativeUrlForEntity(EntityType.PERSON, idToUniqueIdDAO.execute(inRequest.getActorId())));

        return batch;
    }
View Full Code Here

    {
        List<Long> coordinatorIds = coordinatorDAO.execute(inRequest.getTargetEntityId());
        // actor cannot be a recipient - if they were a group coordinator, they wouldn't and couldn't be asking for
        // access, hence we don't need to filter

        NotificationBatch batch = new NotificationBatch(NotificationType.REQUEST_GROUP_ACCESS, coordinatorIds);
        batch.setProperty(NotificationPropertyKeys.ACTOR, PersonModelView.class, inRequest.getActorId());
        batch.setProperty("group", DomainGroupModelView.class, inRequest.getTargetEntityId());
        batch.setPropertyAlias(NotificationPropertyKeys.SOURCE, "group");
        batch.setProperty(NotificationPropertyKeys.HIGH_PRIORITY, true);
        batch.setProperty(NotificationPropertyKeys.URL,
                UiUrlBuilder.relativeUrlForGroupAccessRequest(idToUniqueIdDAO.execute(inRequest.getTargetEntityId())));
        return batch;
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public NotificationBatch translate(final GroupMembershipResponseNotificationsRequest inRequest)
    {
        NotificationBatch batch = new NotificationBatch(type, inRequest.getRequestorId());
        batch.setProperty("group", DomainGroupModelView.class, inRequest.getTargetEntityId());
        batch.setPropertyAlias(NotificationPropertyKeys.ACTOR, "group");
        batch.setPropertyAlias(NotificationPropertyKeys.SOURCE, "group");

        if (inRequest.getType() == RequestType.REQUEST_GROUP_ACCESS_APPROVED)
        {
            batch.setProperty(
                    NotificationPropertyKeys.URL,
                    UiUrlBuilder.relativeUrlForEntity(EntityType.GROUP,
                            idToUniqueIdDAO.execute(inRequest.getTargetEntityId())));
        }

View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public NotificationBatch translate(final TargetEntityNotificationsRequest inRequest)
    {
        NotificationBatch batch = new NotificationBatch(NotificationType.FOLLOW_PERSON, inRequest.getTargetEntityId());
        batch.setProperty(NotificationPropertyKeys.ACTOR, PersonModelView.class, inRequest.getActorId());
        batch.setProperty("stream", PersonModelView.class, inRequest.getTargetEntityId());
        batch.setPropertyAlias(NotificationPropertyKeys.SOURCE, "stream");

        batch.setProperty(NotificationPropertyKeys.URL, UiUrlBuilder.relativeUrlForEntity(EntityType.PERSON,
                idToUniqueIdDAO.execute(inRequest.getActorId())));

        return batch;
    }
View Full Code Here

        if (recipients.isEmpty())
        {
            return null;
        }

        NotificationBatch batch = new NotificationBatch(NotificationType.LIKE_ACTIVITY, recipients);
        batch.setProperty(NotificationPropertyKeys.ACTOR, PersonModelView.class, inRequest.getActorId());
        batch.setProperty("stream", activity.getDestinationStream());
        batch.setProperty("activity", activity);
        batch.setPropertyAlias(NotificationPropertyKeys.SOURCE, "stream");
        batch.setProperty(NotificationPropertyKeys.URL, UiUrlBuilder.relativeUrlForActivity(inRequest.getActivityId()));
        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.