在liferay 6.0.6中创建用户时,不会调用UserEntryListener

时间:2012-07-05 08:49:28

标签: java jboss5.x liferay-6

我在liferay挂钩中定义了一个UserEntryListener:

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");
    }
}

docroot/WEB-INF/src/portal-ext/properties

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

将钩子部署到与Jboss 5.1.0 GA捆绑在一起的liferay 6.0.6之后,我发现无论是通过控制面板执行创建,更新和删除操作,UserEntryListener的相应回调方法都无法调用。

1 个答案:

答案 0 :(得分:0)

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

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

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