RE: Liferay 7.2 - Getting pages deleted logs

Fabio Carvalho, modified 6 Years ago. Junior Member Posts: 81 Join Date: 6/25/19 Recent Posts
Hello,

I was wondering if I can somehow get the logs in my custom portlet of the pages deleted. Lets suppose  the User A creates a page, and then deletes it. Can I somehow get that deletion log on my custom portlet?

Thank you for your future answers!
thumbnail
Christoph Rabel, modified 6 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
I am not sure if there is a better way, but I would implement a LayoutModelListener and store the actions like create/update/delete somewhere, e.g. using servicebuilder in my own "audit table". Then you can easily use the data in your own portlet.
https://portal.liferay.dev/docs/7-1/tutorials/-/knowledge_base/t/model-listeners
Fabio Carvalho, modified 6 Years ago. Junior Member Posts: 81 Join Date: 6/25/19 Recent Posts
Hello Christoph,

So the solution would be to create a new table on my database using servicebuilder and each time a page is deleted I would add an entry to this table. Later I could get the values of this table to check the pages deleted. Did I understand correctly?

Thank you for your answer!
thumbnail
Christoph Rabel, modified 6 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
Yes. It is probably the easiest solution.
Fabio Carvalho, modified 6 Years ago. Junior Member Posts: 81 Join Date: 6/25/19 Recent Posts
I tried to create a Service Builder using this tutorial but I am getting an error on some generated classes. I can solve most of them, but there is one that I can't solve for nothing. The IDE cannot resolve "import com.liferay.portal.aop.AopService;". Probably its a depency left, but I can't seem to find which one.

PS: I have already posted this here, but until now I didn't find a solution.

EDIT: OK! I found what dependency I needed. I added compileOnly group: "com.liferay", name: "com.liferay.portal.aop.api" and it started working.