Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
mickael bruna
Document library - AfterUpdateDocument
October 14, 2013 9:00 AM
Answer

mickael bruna

Rank: Junior Member

Posts: 66

Join Date: October 14, 2013

Recent Posts

Hy,

I would like execute a code when a document is modify by a user.

I try to create liferay-hook with a systemListener who implements ModelListener<DLFileVersion>, but this method "onAfterUpdate" is call a lot of time during modification and I don't know if the document is really modify or not. I don't know if it's a new version or the same.

I try with ModelListener<DLFileEntry> and it's the same problem : when I open my document for modify, the method "onAfterUpdate" is call 3 times. I don't want execute my code 3 times, I just want execute when the document is realy modify.

Do you have a solution for execute a code only the document is modify by a user?

Thank for your answers.
Amos Fong
RE: Document library - AfterUpdateDocument
October 16, 2013 4:29 PM
Answer

Amos Fong

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1913

Join Date: October 7, 2008

Recent Posts

Hi Mickael,

I think what you want to do is hook the DLFileEntryLocalServiceImpl.update method. That method should only be called once when a document is modified.

More info here:
https://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/overriding-a-portal-service