Domanda

I have a hook where to add an organization and few custom field variables (Expando Variables) automatically to a liferay portal. How do I run that hook or a method in the hook during liferay setup or the first time I start a liferay portal? Does anyone have any links or codes for this?

Thanks

È stato utile?

Soluzione

To reiterate your requirement you need to do some custom actions when Liferay server is started, so from what I understand you need a startup custom action hook.

This is nothing but a simple hook where you would override some porperties from portal.properties and provide a custom action class like MyCustomStartupAction or MyCustomGlobalAction in that property and implement it.

In the user-guide here is a list of some properties you can configure: Startup Events

This SO Answer gives more information about creating a hook with such properties.

Altri suggerimenti

When you deploy that Hook (war file) into your server and restart it, in the (bin) logs, you could see one log statement which says that your particular Hook is available for use. This means your Hook has been successfully deployed into your Liferay portal.

To run the Hook or invoke a particular method inside your Hook, you need to invoke the flow for which your Hook was written.

For eg., if you have written a hook for logout.events.post= and if you want to invoke this, then you need to logout from your portal.

In your case you have written a Hook for registration. So, you need to do registration. Remember your Hook method should have extended Action class.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top