/*
* Copyright (C) 2003-2007 eXo Platform SAS.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see
* <configuration> * [..] * <external-component-plugins> * <target-component>org.exoplatform.services.organization.OrganizationService</target-component> * <component-plugin> * <name>my.user.listener</name> * <set-method>addListenerPlugin</set-method> * <type>my.package.MyUserEventListener</type> * <description>your listener description</description> * </component-plugin> * </external-component-plugins> * [...] * /configuration> **/ public class UserEventListener extends BaseComponentPlugin { /** * This method is called before the user is persisted to the database. * * @param user The user to be saved * @param isNew if the user is a new record in the database or not * @throws Exception The developer can decide to throw an exception or not. If * the listener throw an exception, the organization service should * not save/update the user to the database */ public void preSave(User user, boolean isNew) throws Exception { } /** * This method is called after the user has been saved but not commited yet * * @param user The user instance has been saved. * @param isNew if the user is a new record in the database or not * @throws Exception The developer can decide to throw the exception or not. * If the method throw an exception. The organization service should * role back the data to the state before the method * userHandler.createUser(..) or UserHandler.saveUser(..) is called. */ public void postSave(User user, boolean isNew) throws Exception { } /** * This method is called before an user should be deleted * * @param user the user to be delete * @throws Exception The developer can decide to throw the exception or not. * If the method throw an exception. The organization service should * not remove the user record from the database. */ public void preDelete(User user) throws Exception { } /** * This method should be called after the user has been removed from the * database but not commited yet. * * @param user The user instance which has been removed from the database. * @throws Exception The developer can decide to throw the exception or not. * If the method throw the exception, the organization service * should role back the database to the state before the method * UserHandler.removeUser(..) is called. */ public void postDelete(User user) throws Exception { } }