0

I define a UserEntryListener in liferay hook:

package com.ggd543.liferay.listener;

public class UserEntryListener extends BaseModelListener<User> {


    @Override
    public void onAfterCreate(User model) throws ModelListenerException {
        System.out.println("==== onAfterCreate - uuid: " + model.getUuid());
    }

    @Override
    public void onAfterRemove(User model) throws ModelListenerException {
        System.out.println("==== onAfterRemove - uuid: " + model.getUserId());
    }

    @Override
    public void onAfterUpdate(User model) throws ModelListenerException {
        System.out.println("==== onAfterUpdate user - uuid: " + model.getUuid());
    }

    @Override
    public void onBeforeCreate(User model) throws ModelListenerException {
        System.out.println("==== onBeforeCreate - uuid: " + model.getUuid());
    }

    @Override
    public void onBeforeRemove(User model) throws ModelListenerException {
        System.out.println("==== onBeforeRemove - uuid: " + model.getUuid());
    }

    @Override
    public void onBeforeUpdate(User model) throws ModelListenerException {
        System.out.println("==== onBeforeUpdate user");
    }
}

and in docroot/WEB-INF/src/portal-ext/properties:

value.object.listener.com.liferay.portal.model.User=com.ggd543.liferay.listener.UserEntryListener

After deploy the hook onto liferay 6.0.6 bundled with Jboss 5.1.0 GA, I found that no matter create, update and remove action is performed through control pannel , the corresponding callback method of UserEntryListener is unable to invoke.

爱国者
  • 4,298
  • 9
  • 47
  • 66

1 Answers1

0

Make sure you've included the properties hook in liferay-hook.xml:

<hook>
...
  <portal-properties>portal-ext.properties</portal-properties>
...
</hook>

I'm assuming here that there's a typo in your question - docroot/WEB-INF/src/portal-ext/properties should read docroot/WEB-INF/src/portal-ext.properties - am I right?

Gustav Barkefors
  • 5,016
  • 26
  • 30