01: /**
02: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
03: *
04: * Permission is hereby granted, free of charge, to any person obtaining a copy
05: * of this software and associated documentation files (the "Software"), to deal
06: * in the Software without restriction, including without limitation the rights
07: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
08: * copies of the Software, and to permit persons to whom the Software is
09: * furnished to do so, subject to the following conditions:
10: *
11: * The above copyright notice and this permission notice shall be included in
12: * all copies or substantial portions of the Software.
13: *
14: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20: * SOFTWARE.
21: */package com.liferay.portal.model;
22:
23: import com.liferay.portal.ModelListenerException;
24: import com.liferay.portal.security.ldap.PortalLDAPUtil;
25:
26: import org.apache.commons.logging.Log;
27: import org.apache.commons.logging.LogFactory;
28:
29: /**
30: * <a href="UserListener.java.html"><b><i>View Source</i></b></a>
31: *
32: * @author Scott Lee
33: * @author Brian Wing Shun Chan
34: *
35: */
36: public class UserListener implements ModelListener {
37:
38: public void onBeforeCreate(BaseModel model)
39: throws ModelListenerException {
40: if (_log.isDebugEnabled()) {
41: _log.debug("onBeforeCreate");
42: }
43: }
44:
45: public void onAfterCreate(BaseModel model)
46: throws ModelListenerException {
47: try {
48: User user = (User) model;
49:
50: PortalLDAPUtil.exportToLDAP(user);
51:
52: if (_log.isDebugEnabled()) {
53: _log.debug("onAfterCreate");
54: }
55: } catch (Exception e) {
56: throw new ModelListenerException(e);
57: }
58: }
59:
60: public void onBeforeRemove(BaseModel model)
61: throws ModelListenerException {
62: if (_log.isDebugEnabled()) {
63: _log.debug("onBeforeRemove");
64: }
65: }
66:
67: public void onAfterRemove(BaseModel model)
68: throws ModelListenerException {
69: if (_log.isDebugEnabled()) {
70: _log.debug("onAfterRemove");
71: }
72: }
73:
74: public void onBeforeUpdate(BaseModel model)
75: throws ModelListenerException {
76: if (_log.isDebugEnabled()) {
77: _log.debug("onBeforeUpdate");
78: }
79: }
80:
81: public void onAfterUpdate(BaseModel model)
82: throws ModelListenerException {
83: try {
84: User user = (User) model;
85:
86: PortalLDAPUtil.exportToLDAP(user);
87:
88: if (_log.isDebugEnabled()) {
89: _log.debug("onAfterUpdate");
90: }
91: } catch (Exception e) {
92: throw new ModelListenerException(e);
93: }
94: }
95:
96: private static Log _log = LogFactory.getLog(UserListener.class);
97:
98: }
|