Package org.nuxeo.ecm.activity

Examples of org.nuxeo.ecm.activity.Activity


    private void addNewActivity(Principal principal,
            SocialWorkspace socialWorkspace, RelationshipKind kind) {
        ActivityStreamService activityStreamService = Framework.getLocalService(ActivityStreamService.class);
        // Activity without context
        Activity activity = createActivity(principal, socialWorkspace, kind,
                false);
        activityStreamService.addActivity(activity);
        // with Social Workspace as context
        activity = createActivity(principal, socialWorkspace, kind, true);
        activityStreamService.addActivity(activity);
View Full Code Here


    }

    @Override
    public MiniMessage addMiniMessage(Principal principal, String message,
            Date publishedDate, String contextActivityObject) {
        Activity activity = new ActivityBuilder().actor(
                ActivityHelper.createUserActivityObject(principal)).displayActor(
                ActivityHelper.generateDisplayName(principal)).verb(VERB).object(
                message).publishedDate(publishedDate).context(
                contextActivityObject).build();
        activity = getActivityStreamService().addActivity(activity);
View Full Code Here

    }

    @Override
    public void removeMiniMessage(MiniMessage miniMessage) {
        ActivityStreamService activityStreamService = getActivityStreamService();
        Activity activity = activityStreamService.getActivity(miniMessage.getId());
        activityStreamService.removeActivities(Collections.singleton(activity));
    }
View Full Code Here

            activity.setDisplayTarget(oldDisplayActor);
            activity.setContext(oldDisplayActor);
            em.merge(activity);

            // Store activity without context
            Activity newActivity = new ActivityBuilder(activity).context(null).build();
            em.persist(newActivity);
        }
    }
View Full Code Here

    protected void addMakeDocumentPublicActivity(DocumentModel doc,
            Principal principal) {
        String socialWorkspaceActivityObject = ActivityHelper.createDocumentActivityObject(socialWorkspace.getDocument());
        ActivityStreamService activityStreamService = Framework.getLocalService(ActivityStreamService.class);
        Activity activity = new ActivityBuilder().verb(
                MAKE_DOCUMENT_PUBLIC_VERB).actor(
                ActivityHelper.createUserActivityObject(principal)).displayActor(
                ActivityHelper.generateDisplayName(principal)).object(
                ActivityHelper.createDocumentActivityObject(doc)).displayObject(
                ActivityHelper.getDocumentTitle(doc)).target(
View Full Code Here

        assertNotNull(relationshipService);
    }

    @Test
    public void shouldStoreAMiniMessageActivity() {
        Activity activity = new ActivityImpl();
        activity.setActor("bender");
        activity.setVerb(MiniMessageActivityStreamFilter.VERB);
        activity.setObject("My first message");
        activity.setPublishedDate(new Date());
        activityStreamService.addActivity(activity);

        List<Activity> activities = activityStreamService.query(
                ActivityStreamService.ALL_ACTIVITIES, null);
        assertEquals(1, activities.size());
        Activity storedActivity = activities.get(0);
        assertEquals(activity.getActor(), storedActivity.getActor());
        assertEquals(activity.getVerb(), storedActivity.getVerb());
        assertEquals(activity.getObject(), storedActivity.getObject());
    }
View Full Code Here

        parameters.put(ACTOR_PARAMETER, "Leela");
        List<Activity> activities = activityStreamService.query(
                UserActivityStreamFilter.ID, parameters);
        assertEquals(5, activities.size());

        Activity activity = activities.get(0);
        assertEquals(benderActivityObject, activity.getActor());
        assertEquals(DOCUMENT_REMOVED, activity.getVerb());
        assertEquals("doc:default:docId1", activity.getObject());
        activity = activities.get(1);
        assertEquals(benderActivityObject, activity.getActor());
        assertEquals(CIRCLE_RELATIONSHIP_KIND_GROUP, activity.getVerb());
        assertEquals(zappActivityObject, activity.getObject());
        activity = activities.get(2);
        assertEquals(fryActivityObject, activity.getActor());
        assertEquals(CIRCLE_RELATIONSHIP_KIND_GROUP, activity.getVerb());
        assertEquals(benderActivityObject, activity.getObject());
    }
View Full Code Here

        initializeRelationsActivities();
    }

    protected void initializeRelationsActivities() {
        DateTime now = new DateTime();
        Activity activity = new ActivityImpl();
        activity.setActor(fryActivityObject);
        activity.setObject(benderActivityObject);
        activity.setVerb(CIRCLE_RELATIONSHIP_KIND_GROUP);
        activity.setPublishedDate(now.plusHours(2).toDate());
        activityStreamService.addActivity(activity);
        activity = new ActivityImpl();
        activity.setActor(benderActivityObject);
        activity.setObject(zappActivityObject);
        activity.setVerb(CIRCLE_RELATIONSHIP_KIND_GROUP);
        activity.setPublishedDate(now.plusHours(3).toDate());
        activityStreamService.addActivity(activity);
    }
View Full Code Here

        activityStreamService.addActivity(activity);
    }

    protected void initializeDummyDocumentRelatedActivities() {
        DateTime now = new DateTime();
        Activity activity = new ActivityImpl();
        activity.setActor(benderActivityObject);
        activity.setObject("doc:default:docId1");
        activity.setVerb(DOCUMENT_CREATED);
        activity.setPublishedDate(now.toDate());
        activityStreamService.addActivity(activity);
        activity = new ActivityImpl();
        activity.setActor(benderActivityObject);
        activity.setObject("doc:default:docId1");
        activity.setVerb(DOCUMENT_UPDATED);
        activity.setPublishedDate(now.plusHours(1).toDate());
        activityStreamService.addActivity(activity);
        activity = new ActivityImpl();
        activity.setActor(benderActivityObject);
        activity.setObject("doc:default:docId1");
        activity.setVerb(DOCUMENT_REMOVED);
        activity.setPublishedDate(now.plusHours(4).toDate());
        activityStreamService.addActivity(activity);
    }
View Full Code Here

        }
    }

    protected void addNewRelationActivity(String actorActivityObject,
            String targetActivityObject, RelationshipKind relationshipKind) {
        Activity activity = new ActivityBuilder().actor(actorActivityObject).displayActor(
                Functions.userFullName(ActivityHelper.getUsername(actorActivityObject))).verb(
                relationshipKind.getGroup()).object(targetActivityObject).displayObject(
                Functions.userFullName(ActivityHelper.getUsername(targetActivityObject))).build();
        Framework.getLocalService(ActivityStreamService.class).addActivity(
                activity);
View Full Code Here

TOP

Related Classes of org.nuxeo.ecm.activity.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.