Activities Implementation

(November 2012 working on Liferay versions 6.0.x, 6.1.x & 6.2.x)

 

     Activities are part of the social features of Liferay and basically tracks down users portal activities like posting in forums, creating a wiki page, etc.  

     Until now if you wanted to implement user activity on your own portlets you had to adapt your programs to access Liferay's API. from now on, with XMLPortletFactory's portlets you will just add <generateActivity> tag to your xml definition, no more programming.

     Let me show you an example; imagine you have a portlet just with activityId and activityName fields, and you want to implement activities on it. Well just add the before mentioned tag inside <classDef> like this:

 

<classDef>
<name>Activities</name>
<title>Activities</title>
<generateActivity>true</generateActivity>       <!-- Just this line does the magic -->
</classDef>

 

       Generate and deploy the portlet as usual, remember to add Liferay's activities portlet to the page, that will show users activities.

       Now we have a normal portlet where we are going to add a new row, like this:

 

 

Pressing submit will insert the row in the table and also upgrade the user activities as shown here:

 

Easy uh?  find here the xml definition used  ActivitiesImplementation.xml and the generated war file Activities-portlet-6.1.1.1.war

Another programming magic brought to you with the collaboration of Davide Rossi. From here, thanks again.