"Publish Version" Hook Plugin

Publish Version Hook  Plugin

Thiss article is described about the Custom Publish Version hook which is available in Community plugins. Using this hook, we can revert back old version of journal aticle easily.

Journal Portlet:

The Journal portlet provides a user interface to the admin or content owner to add , edit , delete ,expire  the articles and displaying all the versions of  article.

All versions will be displayed in the list of available Journal Articles as shown below:

(Edit Article --> View History)

A new version will be generated automatically if article is modified

Version Handling

Managing version is having  some limitations in Liferay that users cannot publish the old version of the article. If user s want to publish the old version, they should expire all the versions of the article which we cannot revert back once done. 

eg.,  a  article has more than 100  versions since  it has been modified for 100 times, but  user wants to re-publish   1.1 version which is initial version of the article. Then, they have to expire all  99 versions [ 1.2  to  1.100 ]  which is hectic and not safe for expiring all the articles  in a huge content management portal as anytime we may need to revert back  some version of the article.

Publish Version Hook

 I have developed  struts action Hook plugin by customizing jsp(s)  and action files of the  journal article  for publishing any version of the article.

This  PublishVersion-Hook  plugin helps  article’s admin or content owner to re-publish the article without expiring the old versions.  User cannot publish the Multi Articles or Expired article  and Latest version.



Use Cases :


  1. Update the Article through web content display portlet  or control panel.

     2.   A new version will be generated automatically if article is modified each time.

     3.   Click  View History section where all the version of the articles will be displayed as shown below



4.    Select old version of the article and click Publish.



5.  You cannot publish Latest / Expired / Multiple articles at a time .



Technical Explanation:

I have developed this plug-in in Struts Action Hook.   Reason for developing Struts Action Hook is, I was planning to learn Struts Action Hook for long time since this new feature introduced. So, finally done it. J

I have overridden the existing Struts Action /journal/edit_article which extends BaseStrutsPortletAction and    In View History Page [view_article_history.jsp &   article_version_action.jsp], new Publish buttons are added to publish the selected version.   

When publishing  the  selected version, it is redirecting to Custom Struts Action class where I have written my logic to change the selected version’s count  as latest version by increasing 1 with latest version.   So automatically latest version will be displayed.


JournalArticle selectedVersionObject = JournalArticleLocalServiceUtil.getArticle(selectedId);

selectedVersionObject.setVersion(MathUtil.format(lVersion + 0.1, 1, 1));   //increasing 1 with latest version


Download URL


/for 6.2.0 GA2 release :



If any queries / suggestion about this hook, Please feel free to reach me : gnaniyar@gmail.com


-  Gnaniyar Zubair



0 Attachments
Average (6 Votes)
The average rating is 4.666666666666667 stars out of 5.
Threaded Replies Author Date
Super Job.... Mr.Gnaniyar zubair Really I like... DarshanKumar N Bhatia June 20, 2012 10:39 PM
Great job Gnaniyar zubair !!! Nice add on... Tejas Kanani June 20, 2012 10:49 PM
Great Work...!!!!! Awesome... Amey Panke June 20, 2012 11:35 PM
Gr8 Effort.Sooper Job !!! Tanweer . June 21, 2012 6:42 AM
Excellent work Zubair . Its working fine.. !!!... Navin Agarwal June 21, 2012 7:14 AM

Super Job.... Mr.Gnaniyar zubair
Really I like it .....
Posted on 6/20/12 10:39 PM.
Great job Gnaniyar zubair !!!
Nice add on feature !!!
Posted on 6/20/12 10:49 PM.
Great Work...!!!!! Awesome...
Posted on 6/20/12 11:35 PM.
Gr8 Effort.Sooper Job !!!
Posted on 6/21/12 6:42 AM in reply to Amey Panke.
Excellent work Zubair . Its working fine.. !!! superb
Posted on 6/21/12 7:14 AM.