Fórum

creating hook for StartupAction in liferay

Abhi Ed, modificado 11 Anos atrás.

creating hook for StartupAction in liferay

Regular Member Postagens: 118 Data de Entrada: 04/06/12 Postagens Recentes
Hello friends ,

I have a requirement to create a hook for StartupAction for adding a custom field to User table in liferay .
But, i have only created hooks with jsp files. Can anyone tell me the steps for creating hook in this case ?
And where can I find that file StartupAction .java ?

Regards
Ed
thumbnail
Antoine Comble, modificado 10 Anos atrás.

RE: creating hook for StartupAction in liferay

Regular Member Postagens: 232 Data de Entrada: 07/09/12 Postagens Recentes
Hi,

You can override this properties in portal.properties :

# Global startup event that runs once when the portal initializes.
#
global.startup.events=com.liferay.portal.events.GlobalStartupAction


# Application startup event that runs once for every web site instance of
# the portal that initializes.
#
application.startup.events=com.liferay.portal.events.AppStartupAction

After doing this, you create a class like com.liferay.portal.events.AppStartupAction and when liferay starts up, your code will be executed.

To hook portal.properties, in your liferay-hook.xml add this :

<portal-properties>portal.properties</portal-properties>


The, create a portal.properties file in project classpath and should be work.

Antoine