Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
BlogsEntry Listener not working liferay 7.1
Hello everyone,
I have tried below code.Please correct me if i missed something.
I have tried below code.Please correct me if i missed something.
@Component(immediate = true, service = ModelListener.class)
public class BlogListener extends BaseModelListener<blogsentry> {
public static final Log _log = LogFactoryUtil.getLog(BlogListener.class);
@Override
public void onAfterCreate(BlogsEntry model) throws ModelListenerException {
// TODO Auto-generated method stub
super.onAfterCreate(model);
_log.info(">>>>>>>>>>>>> BLOG CREATE");
}
@Override
public void onAfterUpdate(BlogsEntry model) throws ModelListenerException {
// TODO Auto-generated method stub
super.onAfterUpdate(model);
_log.info(">>>>>>>>>>>>> BLOG UPDATE");
}
@Override
public void onAfterRemove(BlogsEntry model) throws ModelListenerException {
// TODO Auto-generated method stub
super.onAfterRemove(model);
}
}
</blogsentry>
I found the solution.
Issue is related to dependecy and I just added below dependency.
and import below package instead of importing com.liferay.blogs.kernel.model.BlogsEntry.
Thanks
Issue is related to dependecy and I just added below dependency.
compile group: 'com.liferay', name: 'com.liferay.blogs.api', version: '4.0.3'and import below package instead of importing com.liferay.blogs.kernel.model.BlogsEntry.
import com.liferay.blogs.model.BlogsEntry;Thanks