step 1. create a class that extends ModelListener .
eg. If want to extend ContactListener and want to do some action onAfterCreate then
public class CustomContactListener extends ContactListener {
public void onAfterCreate(BaseModel model) throws ModelListenerException {
try {
super.onAfterCreate(model)
//your code
System.out.println("Conatct info after update: " + contact.getContactId() + ":" + contact.getFirstName());
}
catch (Exception e) {
throw new ModelListenerException(e);
}
}
}
step 2. Make an entry in portal-ext.properties
value.object.listener.com.liferay.portal.model.Contact=\
com.liferay.portal.model.ContactListener,\
com.liferay.portal.model.CustomContactListener
do ant deploy and update contact table entry and check in console whether updated data is coming or not.
No comments:
Post a Comment