Forums

RSS RSS
Liferay 5.2 Model Listeners (Hooks) Flat View
Threads
I'm trying to define a Model Listener hook using the 5.2 definition for hooks. In 5.1 you could specify your model listeners in liferay-hook.xml:
1
2<hook>
3    <model-listener>
4        <model-listener-class>be.aca.RegistrationValueListener</model-listener-class>
5        <model-name>com.liferay.portlet.expando.model.ExpandoValue</model-name>
6    </model-listener>
7</hook>


Since 5.2 you have to do it in the portal.properties. So I define my hook like this:
1
2<?xml version="1.0" encoding="UTF-8"?>
3<!DOCTYPE hook PUBLIC "-//Liferay//DTD Hook 5.2.0//EN" "http://www.liferay.com/dtd/liferay-hook_5_2_0.dtd">
4<hook>
5    <portal-properties>portal-ext.properties</portal-properties>
6</hook>


I put a custom portal-ext.properties inside my src folder and enter:
1
2value.object.listener.com.liferay.portlet.expando.model.ExpandoValue=be.aca.RegistrationValueListener


In my listener, I perform an action on creation of an ExpandoValue:
 1
 2public class RegistrationValueListener implements ModelListener {
 3
 4    //...
 5
 6    @Override
 7    public void onAfterCreate(BaseModel model) throws ModelListenerException {
 8        System.out.println("BLABLA");
 9    }
10
11        //...
12}


But on form submit, nothing gets logged... What's going wrong? In 5.1 this worked perfectly.
Flag Flag
RE: Liferay 5.2 Model Listeners (Hooks)
11/24/09 8:51 AM as a reply to Peter Mesotten.
I have exactly the same problem !

With a "UserModelListener" it works perfectly, but with expando, nothing happens :-(
Flag Flag