Author: bdaw
Date: 2008-04-18 03:43:16 -0400 (Fri, 18 Apr 2008)
New Revision: 10637
Added:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserProfileChangedEvent.java
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java
Log:
Add identity event for user profile change
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java 2008-04-18
07:32:54 UTC (rev 10636)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/DelegatingUserProfileModuleImpl.java 2008-04-18
07:43:16 UTC (rev 10637)
@@ -134,6 +134,7 @@
log.debug("Delegating to DB module");
getDBModule().setProperty(user, name, propertyValue);
+ fireUserProfileChangedEvent(user.getId(), user.getUserName(), name);
return;
}
throw new IdentityException("Cannot process property - incorrect profile or
module configuration");
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java 2008-04-18
07:32:54 UTC (rev 10636)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/db/HibernateUserProfileModuleImpl.java 2008-04-18
07:43:16 UTC (rev 10637)
@@ -162,6 +162,7 @@
{
dbUser.getProfileMap().remove(propertyName);
}
+ fireUserProfileChangedEvent(user.getId(), user.getUserName(), propertyName);
}
public Map getProperties(User user) throws IdentityException
Copied:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserProfileChangedEvent.java
(from rev 10605,
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserCreatedEvent.java)
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserProfileChangedEvent.java
(rev 0)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/event/UserProfileChangedEvent.java 2008-04-18
07:43:16 UTC (rev 10637)
@@ -0,0 +1,79 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software 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 *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.identity.event;
+
+/**
+ * @author <a href="mailto:boleslaw dot dawidowicz at redhat anotherdot
com">Boleslaw Dawidowicz</a>
+ * @version $Revision: 1.1 $
+ */
+public class UserProfileChangedEvent extends IdentityEvent
+{
+
+ /** . */
+ private final Object userId;
+
+ /** . */
+ private final String userName;
+
+ /** . */
+ private final String propertyName;
+
+ public UserProfileChangedEvent(Object userId, String userName, String propertyName)
+ {
+ if (userId == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (userName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.userId = userId;
+ this.userName = userName;
+ this.propertyName = propertyName;
+ }
+
+ public Object getUserId()
+ {
+ return userId;
+ }
+
+ public String getUserName()
+ {
+ return userName;
+ }
+
+ public String getPropertyName()
+ {
+ return propertyName;
+ }
+
+ public String toString()
+ {
+ return "UserProfileChangedEvent[userId=" + userId +
",userName=" + userName + ",propertyName=" + propertyName +
"]";
+ }
+}
\ No newline at end of file
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java 2008-04-18
07:32:54 UTC (rev 10636)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/ldap/LDAPUserProfileModuleImpl.java 2008-04-18
07:43:16 UTC (rev 10637)
@@ -214,6 +214,7 @@
attrs.put(attr);
ldapContext.modifyAttributes(ldapUser.getDn(),
DirContext.REPLACE_ATTRIBUTE,attrs);
+ fireUserProfileChangedEvent(user.getId(), user.getUserName(), propertyName);
}
catch (NamingException e)
{
Modified:
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java
===================================================================
---
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java 2008-04-18
07:32:54 UTC (rev 10636)
+++
modules/identity/branches/JBP_IDENTITY_BRANCH_1_0/identity/src/main/org/jboss/portal/identity/service/UserProfileModuleService.java 2008-04-18
07:43:16 UTC (rev 10637)
@@ -23,6 +23,9 @@
import org.jboss.portal.identity.IdentityContext;
import org.jboss.portal.identity.UserProfileModule;
+import org.jboss.portal.identity.IdentityException;
+import org.jboss.portal.identity.event.IdentityEvent;
+import org.jboss.portal.identity.event.UserProfileChangedEvent;
import org.jboss.portal.identity.metadata.profile.info.ProfileInfoSupport;
import org.jboss.portal.identity.metadata.config.ConfigurationParser;
import org.jboss.portal.identity.info.ProfileInfo;
@@ -79,5 +82,12 @@
{
this.profileConfigFile = profileConfigFile;
}
+
+ protected void fireUserProfileChangedEvent(Object userId, String userName, String
propertyName) throws IdentityException
+ {
+ IdentityEvent event = new UserProfileChangedEvent(userId, userName, propertyName);
+ getIdentityEventBroadcaster().fireEvent(event);
+ }
+
}