0
votes

Im working in Liferay 5.2.3 and i need to load data (create page, add portlet in some page, create some structure, add web content in the structure..).

I heard that a way to do that is to use hook to deploy this script (java class which user liferay api to load data), but i think that a hook project liferay must not be use in this way, the data should be load one time and not always, the load data doesn't modify the behavior liferay, just load data...

Do you think Using Hook for this case is a good way ? Or I should use a normal project java to load data which i will launch by a executable file.

Thank you.

1

1 Answers

0
votes

Have a look at the sevencogs-hook code: This does exactly what you're asking for (and neatly documents the use of the API)

Careful though: In 5.2.3 it checks if "Bruno" exists in the database (the sevencogs administrator) - if he's not there, it will wipe out the contents and populate it with the sevencogs data. Later versions use an upgrade action that is a lot safer, e.g. running only once.

And - you really want to upgrade to the latest version: 5.2.3 is ancient