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

1 回答 1

0

确保你在 liferay-hook.xml 中包含了属性钩子:

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

我在这里假设您的问题中有错字-docroot/WEB-INF/src/portal-ext/properties应该阅读docroot/WEB-INF/src/portal-ext.properties-对吗?

于 2012-07-05T10:21:45.907 回答