Alfresco Activities is part of Alfresco's open source social computing platform. Alfresco v3.0 provides support for a news/activity feed in the context of an enterprise generating and acting upon content within a site. The activities will be raised (i.e. posted) by certain components within the context of a site. The activity service will then generate corresponding activity feeds for each member of that site. This document outlines the steps for a component developer to post a new activity type.
As a developer, you can post an activity (which in turn will generate a corresponding activity feed) by simply following three basic steps.
Update your component to post one or more activity types with specific activity data.
Define one or more activity type templates to display the activity data for your chosen feed formats.
Test your activities by retrieving the generated activity feeds for each of the supported formats.
You should create corresponding activity templates (using FreeMarker format) for your new activity type, and drop them into the activity template store. The templates could be running out-of-process (eg. if the activity service has been distributed to a grid) so you can only access activity data that is either supplied during the post (or looked-up based on supplied nodeRef). The templates can access the activity data, since the activity service will auto-convert the JSON activity data to a FreeMarker data model. A JSON object will be converted to a FreeMarker 'hash' (map) and a JSON array will be converted to a FreeMarker 'sequence' (list). Also, date strings in the format ISO8601 format (YYYY-MM-DDThh:mm:ss.sssTZD) will be accessible as dates. Additional data accessible to the template, includes:
userId (of posting user, eg. jsmith123)
firstName (of posting user, eg. John)
lastName (of posting user, eg. Smith)
name (name of item/node, eg. my spreadsheet.xls)
siteNetwork (site short name. eg. mysite1)
xmldate(date) (posting date in ISO8601 format, eg. )
activityType (activity type id, eg. org.alfresco.site.user-joined)
In general, each activity type will have one or more activity type templates corresponding to each supported format. However, if an activity type template is missing then the activity service will attempt to fall-back to a ... TODO
Samples: pre-built Alfresco activity type templates
Alfresco pre-built activity type templates can also acts as samples. These will be included on the classpath under:
Alfresco currently also includes pre-built generic templates under:
The basic templates for the three activity types are under:
(in SVN) /projects/remote-api/config/alfresco/templates/activities (on server) alfresco/WEB-INF/classes/alfresco/templates/activities /org/alfresco/site/user-joined.atomentry.ftl /org/alfresco/site/user-left.atomentry.ftl /org/alfresco/site/user-role-changed.atomentry.ftl
Sample 2: Calendar Events
The Share Calendar Component currently posts activities when calendar events are created. The current activity types are:
In order to test your activity, you can retrieve the activity feed using your favourite app that has in-built support for reading ATOM/RSS feeds. In future versions of the 3.0 slingshot app, you will also be able to use the in-built activities dashlet (TBC).
Note: the activity service is asynchronous, hence it may take a few minutes for the posted activity to appear in the activity feed.
Site activity feed
To see the activity feed for site 'mysite1', you can access: