Message Boards

How to implement the versioning in liferay custom service.

Amit Sharma, modified 4 Years ago.

How to implement the versioning in liferay custom service.

Junior Member Posts: 35 Join Date: 10/17/18 Recent Posts
Hi Everyone,

First of all I would like to thanks everyone. I got a lot of solution from here. Thanks all of you to take your time answer my question.
I am using liferay7.1.2 CE GA3 release.I have custom service. This service is workflow compatible. My requirement is if any user updated the approved content and when new content still in pending approved content in portlet.As soon as Approver approve the content new portlet should start displaying updated content.
I am aware of versioning of record at database level. 
Just want to know if liferay also support something similar. If yes please guide me how can I Implement in my custom service.
Thanks
-Amit
thumbnail
David H Nebinger, modified 4 Years ago.

RE: How to implement the versioning in liferay custom service. (Answer)

Liferay Legend Posts: 14917 Join Date: 9/2/06 Recent Posts
Well, it's not referred to as just "versioning", but really is more of a version and a status.  You must manage your own versions (just like journal articles and documents do).

Each "add" will become a new version at pending status. Workflow will transition statuses from pending to approved, but on an individual row by row record. Version really isn't used for anything more than providing the necessary part of a compound key.

Your view portlet, well that should often select the latest record in the approved status, regardless of version (since workflow will not force you to approve 1.0 before you approve 1.1 before you approve 1.2,...).
Amit Sharma, modified 4 Years ago.

RE: How to implement the versioning in liferay custom service.

Junior Member Posts: 35 Join Date: 10/17/18 Recent Posts
Thanks for reply David.
I was also planning the same as you explained.  Just want to know before implementing it. Does liferay provides something similar or not.
If not than i am pretty much clear on approach even you have explain same.Thanks for your reply.
thumbnail
David H Nebinger, modified 4 Years ago.

RE: How to implement the versioning in liferay custom service.

Liferay Legend Posts: 14917 Join Date: 9/2/06 Recent Posts
No, AFAIK there is no support for handling versioning for you. I think because Liferay only needed it for journal articles and files, there was no need to build an infrastructure to serve two implementations, it was likely just easier to do the version management separately.

Plus, when you look at the Liferay version handling for these entities, it can get quite complicated in the features they allow for, etc., but even between journal articles and files there are differences in what they both implement.

It will end up being up to you to roll your own solution. I would just recommend completing the analysis and design up front and clearly documenting for yourself, your team, your client, etc. what is going to be supported and how and why... You'd be amazed at how many bugs get opened because of ambiguity in what the Liferay versions are for, etc., and without a documented design you won't really be able to push back on things like "works as designed", etc.
Amit Sharma, modified 4 Years ago.

RE: How to implement the versioning in liferay custom service.

Junior Member Posts: 35 Join Date: 10/17/18 Recent Posts
Sure.  I will look into this. 
Thanks for your prompt reply