Package org.eurekastreams.server.domain.stream

Examples of org.eurekastreams.server.domain.stream.Activity


    public void testExecuteInvalidDestinationType()
    {
        PostCachedActivity sut = new PostCachedActivity(personFollowersMapper, getPersonModelViewByAccountIdMapper);
        sut.setCache(cache);

        final Activity act = context.mock(Activity.class);
        final StreamScope recipStreamScope = context.mock(StreamScope.class);

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


        final EntityManager entityManager = context.mock(EntityManager.class);
        final QueryOptimizer queryOptimizer = context.mock(QueryOptimizer.class);
        final FindByIdRequest req = context.mock(FindByIdRequest.class);
        final Query query = context.mock(Query.class);
        final List<Activity> activities = context.mock(List.class);
        final Activity activity = context.mock(Activity.class);

        FindByIdMapper<Activity> sut = new FindByIdMapper();
        sut.setEntityManager(entityManager);
        sut.setQueryOptimizer(queryOptimizer);
View Full Code Here

     * @return the input Message object with the ID of the author.
     */
    @Override
    public String objectToString(final Object msgObject)
    {
        Activity activity = (Activity) msgObject;
        EntityType actorType = activity.getActorType();

        String result = null;

        switch (actorType)
        {
        case GROUP:
            result = "g" + getDomainGroupsByShortNames.fetchId(activity.getActorId());
            break;
        case PERSON:
            result = "p" + getPersonIdByAccountIdMapper.execute(activity.getActorId());
            break;
        default:
            throw new RuntimeException("Unknown/unhandled recipient type: " + actorType);
        }

        if (log.isInfoEnabled())
        {
            log.info("Bridge converted activity with actorId " + activity.getActorId() + " to " + result);
        }
        return result;
    }
View Full Code Here

     *            the activity.
     * @return the interestingness.
     */
    public String objectToString(final Object msgObject)
    {
        Activity activity = (Activity) msgObject;

        return Long.toString(interstingnessStrategy.computeInterestingness(activity));
    }
View Full Code Here

     *            the activity.
     * @return the interestingness.
     */
    public String objectToString(final Object msgObject)
    {
        Activity activity = (Activity) msgObject;

        return Long.toString(interstingnessStrategy.computeInterestingness(activity));
    }
View Full Code Here

        {
            log.error("Found either null Activity or wrong type.");
            return null;
        }

        Activity activity = (Activity) inActivityObj;
        return activity.getIsDestinationStreamPublic() ? "t" : "f";
    }
View Full Code Here

     * @return a string containing the title and body of the input Message
     */
    @Override
    public String objectToString(final Object activityObject)
    {
        Activity activity = (Activity) activityObject;

        List<CommentDTO> commentList = commentsByIdDAO.execute(commentIdsByActivityIdDAO.execute(activity.getId()));

        final StringBuilder contentAsString = new StringBuilder();

        String content = contentExtractor.extractContent(activity.getBaseObjectType(), activity.getBaseObject());

        if (null != content)
        {
            contentAsString.append(content);
        }
View Full Code Here

     * @return the input Message object with name of the source app.
     */
    @Override
    public String objectToString(final Object msgObject)
    {
        Activity activity = (Activity) msgObject;
        EntityType appType = activity.getAppType();
        Long appId = activity.getAppId();

        if (appType != null && appId != null)
        {
            char prefix;
            switch (appType)
            {
            case APPLICATION:
                prefix = APPLICATION_PREFIX;
                break;
            case PLUGIN:
                prefix = PLUGIN_PREFIX;
                break;
            default:
                return "0";
            }
            return prefix + Long.toString(activity.getAppId());
        }

        return "0";
    }
View Full Code Here

     *            the activity to process for the index.
     * @return the last comment ID as a string.
     */
    public String objectToString(final Object msgObject)
    {
        Activity activity = (Activity) msgObject;

        Long lastCommentTime = 0L;

        List<Long> commentList = commentIdsByActivityIdDAO.execute(activity.getId());

        if (commentList != null && commentList.size() > 0)
        {
            lastCommentTime = commentList.get(commentList.size() - 1);
        }
View Full Code Here

    @Test
    public void test()
    {
        final Long activityId = 6789L;

        Activity a = (Activity) getEntityManager().createQuery("FROM Activity WHERE id = :activityId").setParameter(
                "activityId", activityId).getSingleResult();

        assertTrue(a.getShowInStream());

        context.checking(new Expectations()
        {
            {
                oneOf(cache).removeFromList(CacheKeys.EVERYONE_ACTIVITY_IDS, activityId);

                oneOf(cache).delete(CacheKeys.ACTIVITY_BY_ID + activityId);

                oneOf(cache).delete(CacheKeys.ACTIVITY_SECURITY_BY_ID + activityId);
            }
        });

        sut.execute(activityId);

        getEntityManager().flush();
        getEntityManager().clear();

        a = (Activity) getEntityManager().createQuery("FROM Activity WHERE id = :activityId").setParameter(
                "activityId", activityId).getSingleResult();

        assertFalse(a.getShowInStream());

        context.assertIsSatisfied();

    }
View Full Code Here

TOP

Related Classes of org.eurekastreams.server.domain.stream.Activity

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.