Package org.eurekastreams.server.domain.stream

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


        getEntityManager().flush();

        scope.setDestinationEntityId(sr.getId());
        getEntityManager().flush();

        Activity act = getEntityManager().find(Activity.class, activityId);
        act.setSharedLink(sr);

        getEntityManager().flush();

        // an activity that came from the shared resource
        act = getEntityManager().find(Activity.class, activityId2);
        act.setRecipientStreamScope(scope);

        getEntityManager().flush();

        final List<Long> request = new ArrayList<Long>();
        request.add(scope.getId());
View Full Code Here


     */
    @Test
    public void testExecute()
    {
        // set up activity with two comments posted same day, quickest comment is 10 min
        Activity a1 = (Activity) getEntityManager().createQuery("FROM Activity WHERE id = 6789").getSingleResult();
        Comment a1c1 = (Comment) getEntityManager().createQuery("FROM Comment WHERE id = 1").getSingleResult();
        Comment a1c2 = (Comment) getEntityManager().createQuery("FROM Comment WHERE id = 2").getSingleResult();

        a1.setPostedTime(new Date(year, 4, 1, 7, 0, 0));
        a1c1.setTimeSent(new Date(year, 4, 1, 7, 2, 0));
        a1c2.setTimeSent(new Date(year, 4, 1, 7, 4, 0));

        // set up another activity with two comments post same day, quickest comment is 20 min.
        Activity a2 = (Activity) getEntityManager().createQuery("FROM Activity WHERE id = 6790").getSingleResult();
        Comment a2c1 = (Comment) getEntityManager().createQuery("FROM Comment WHERE id = 5").getSingleResult();
        Comment a2c2 = (Comment) getEntityManager().createQuery("FROM Comment WHERE id = 6").getSingleResult();

        a2.setPostedTime(new Date(year, 4, 1, 8, 0, 0));
        a2c1.setTimeSent(new Date(year, 4, 1, 8, 6, 0));
        a2c2.setTimeSent(new Date(year, 4, 1, 8, 8, 0));

        getEntityManager().flush();
        getEntityManager().clear();
View Full Code Here

     */
    @Test
    public void testExecuteDifferentDays()
    {
        // set up activity with two comments posted same day, quickest comment is 10 min
        Activity a1 = (Activity) getEntityManager().createQuery("FROM Activity WHERE id = 6789").getSingleResult();
        Comment a1c1 = (Comment) getEntityManager().createQuery("FROM Comment WHERE id = 1").getSingleResult();
        Comment a1c2 = (Comment) getEntityManager().createQuery("FROM Comment WHERE id = 2").getSingleResult();

        a1.setPostedTime(new Date(year, 4, 1, 7, 0, 0));
        a1c1.setTimeSent(new Date(year, 4, 1, 7, 2, 0));
        a1c2.setTimeSent(new Date(year, 4, 1, 7, 4, 0));

        // set up another activity with two comments post different day, quickest comment is 20 min.
        Activity a2 = (Activity) getEntityManager().createQuery("FROM Activity WHERE id = 6790").getSingleResult();
        Comment a2c1 = (Comment) getEntityManager().createQuery("FROM Comment WHERE id = 5").getSingleResult();
        Comment a2c2 = (Comment) getEntityManager().createQuery("FROM Comment WHERE id = 6").getSingleResult();

        a2.setPostedTime(new Date(year, 4, 2, 8, 0, 0));
        a2c1.setTimeSent(new Date(year, 4, 2, 8, 6, 0));
        a2c2.setTimeSent(new Date(year, 4, 2, 8, 8, 0));

        getEntityManager().flush();
        getEntityManager().clear();
View Full Code Here

     * Test execute(). Make sure activities with comments not posted same day are not calculated.
     */
    @Test
    public void testExecuteActivityDayOld()
    {
        Activity a1 = (Activity) getEntityManager().createQuery("FROM Activity WHERE id = 6789").getSingleResult();
        Comment a1c1 = (Comment) getEntityManager().createQuery("FROM Comment WHERE id = 1").getSingleResult();
        Comment a1c2 = (Comment) getEntityManager().createQuery("FROM Comment WHERE id = 2").getSingleResult();

        a1.setPostedTime(new Date(year, 4, 1, 7, 0, 0));
        a1c1.setTimeSent(new Date(year, 4, 2, 7, 2, 0));
        a1c2.setTimeSent(new Date(year, 4, 2, 7, 4, 0));

        getEntityManager().flush();
        getEntityManager().clear();
View Full Code Here

     * Setup - set 2 activities and 1 comment to april 4th, 2011.
     */
    @Before
    public void setup()
    {
        Activity act;
        Comment comment;
        Date april4th = new Date(april4th2011);

        sut = new GetDailyMessageCountDbMapper();
        sut.setEntityManager(getEntityManager());

        final long actId1 = 6789L;
        act = getEntityManager().find(Activity.class, actId1);
        act.setPostedTime(april4th);
        act.setAppType(EntityType.APPLICATION);
        getEntityManager().persist(act);

        final long actId2 = 6790L;
        act = getEntityManager().find(Activity.class, actId2);
        act.setPostedTime(april4th);
        act.setAppType(null);
        getEntityManager().persist(act);

        // an activity not by a person - this should be ignored
        final long actId3 = 6791L;
        act = getEntityManager().find(Activity.class, actId3);
        act.setAppType(EntityType.PLUGIN);
        act.setPostedTime(april4th);
        getEntityManager().persist(act);

        // an activity not by a person - this should be ignored
        final long actId4 = 6793L;
        act = getEntityManager().find(Activity.class, actId4);
        act.setAppType(EntityType.PLUGIN);
        act.setPostedTime(april4th);
        getEntityManager().persist(act);

        final long commentId = 9;
        comment = getEntityManager().find(Comment.class, commentId);
        comment.setTimeSent(april4th);
View Full Code Here

            final FeedObjectActivityBuilder inSelectedObjectMapper)
    {
        SyndEntryImpl entry = inEntry;
        FeedObjectActivityBuilder selectedObjectMapper = inSelectedObjectMapper;

        Activity activity = new Activity();
        activity.setAppType(EntityType.PLUGIN);
        activity.setAppId(feed.getPlugin().getId());
        activity.setAppSource(feed.getUrl());
        final Map<String, GeneralGadgetDefinition> gadgetDefs = //
        new HashMap<String, GeneralGadgetDefinition>();
        gadgetDefs.put(feed.getPlugin().getUrl(), feed.getPlugin());
        try
        {
            List<GadgetMetaDataDTO> meta = metaDataFetcher.getGadgetsMetaData(gadgetDefs);

            if (meta.size() > 0)
            {
                activity.setAppName(meta.get(0).getTitle());
            }
        }
        catch (Exception ex)
        {
            log.error("Error getting plugin definition");
            activity.setAppName(feed.getTitle());
        }
        activity.setPostedTime(entry.getPublishedDate());
        activity.setUpdated(entry.getUpdatedDate());
        activity.setVerb(ActivityVerb.POST);
        if (selectedObjectMapper == null)
        {
            BaseObjectType type = feed.getPlugin().getObjectType();

            ActivityStreamsModule activityModule = (ActivityStreamsModule) entry.getModule(ActivityStreamsModule.URI);
View Full Code Here

    @Override
    public Serializable execute(final AsyncActionContext inActionContext) throws ExecutionException
    {
        ActivityDTO currentActivity = ((PostActivityRequest) inActionContext.getParams()).getActivityDTO();

        Activity activity = findByIdMapper.execute(new FindByIdRequest("Activity", currentActivity.getId()));
        if (activity != null)
        {
            log.info("Updating caches for activity #" + currentActivity.getId());
            postCachedActivityMapper.execute(activity);
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.