Author: bdaw
Date: 2011-09-12 08:46:15 -0400 (Mon, 12 Sep 2011)
New Revision: 7357
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java
portal/trunk/pom.xml
Log:
GTNPORTAL-1909 - adding a null as an argument to EventListeners in Organization Service
API should be forbidden
GTNPORTAL-2092 - Upgrade to JCR 1.14.0-GA
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2011-09-12
11:57:34 UTC (rev 7356)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2011-09-12
12:46:15 UTC (rev 7357)
@@ -71,11 +71,19 @@
public void addGroupEventListener(GroupEventListener listener)
{
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
listeners_.add(listener);
}
public void removeGroupEventListener(GroupEventListener listener)
{
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
listeners_.remove(listener);
}
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2011-09-12
11:57:34 UTC (rev 7356)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2011-09-12
12:46:15 UTC (rev 7357)
@@ -67,11 +67,19 @@
public void addMembershipEventListener(MembershipEventListener listener)
{
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
listeners_.add(listener);
}
public void removeMembershipEventListener(MembershipEventListener listener)
{
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
listeners_.remove(listener);
}
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2011-09-12
11:57:34 UTC (rev 7356)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2011-09-12
12:46:15 UTC (rev 7357)
@@ -19,7 +19,9 @@
package org.exoplatform.services.organization.idm;
+import org.exoplatform.commons.utils.ListenerStack;
import org.exoplatform.services.organization.MembershipType;
+import org.exoplatform.services.organization.MembershipTypeEventListener;
import org.exoplatform.services.organization.MembershipTypeHandler;
import org.exoplatform.services.organization.impl.MembershipTypeImpl;
import org.gatein.common.logging.LogLevel;
@@ -59,12 +61,34 @@
private static Logger log = LoggerFactory.getLogger(MembershipTypeDAOImpl.class);
+ private List listeners_;
+
public MembershipTypeDAOImpl(PicketLinkIDMOrganizationServiceImpl orgService,
PicketLinkIDMService service)
{
service_ = service;
+ listeners_ = new ListenerStack(5);
this.orgService = orgService;
}
+ public void addMembershipTypeEventListener(MembershipTypeEventListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
+
+ listeners_.add(listener);
+ }
+
+ public void removeMembershipTypeEventListener(MembershipTypeEventListener listener)
+ {
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
+ listeners_.remove(listener);
+ }
+
final public MembershipType createMembershipTypeInstance()
{
return new MembershipTypeImpl();
@@ -90,7 +114,19 @@
mt.setCreatedDate(now);
mt.setModifiedDate(now);
+ if (broadcast)
+ {
+ preSave(mt, true);
+ }
+
getIdentitySession().getRoleManager().createRoleType(mt.getName());
+
+ if (broadcast)
+ {
+ postSave(mt, true);
+ }
+
+
updateMembershipType(mt);
return mt;
@@ -112,7 +148,19 @@
}
Date now = new Date();
mt.setModifiedDate(now);
+
+ if (broadcast)
+ {
+ preSave(mt, true);
+ }
+
updateMembershipType(mt);
+
+ if (broadcast)
+ {
+ postSave(mt, true);
+ }
+
return mt;
}
@@ -173,7 +221,18 @@
if (mt != null)
{
+ if (broadcast)
+ {
+ preDelete(mt);
+ }
+
getIdentitySession().getRoleManager().removeRoleType(mt.getName());
+
+ if (broadcast)
+ {
+ postDelete(mt);
+ }
+
}
return mt;
@@ -297,4 +356,40 @@
return;
}
+ private void preSave(MembershipType membershipType, boolean isNew) throws Exception
+ {
+ for (int i = 0; i < listeners_.size(); i++)
+ {
+ MembershipTypeEventListener listener =
(MembershipTypeEventListener)listeners_.get(i);
+ listener.preSave(membershipType, isNew);
+ }
+ }
+
+ private void postSave(MembershipType membershipType, boolean isNew) throws Exception
+ {
+ for (int i = 0; i < listeners_.size(); i++)
+ {
+ MembershipTypeEventListener listener =
(MembershipTypeEventListener)listeners_.get(i);
+ listener.postSave(membershipType, isNew);
+ }
+ }
+
+ private void preDelete(MembershipType membershipType) throws Exception
+ {
+ for (int i = 0; i < listeners_.size(); i++)
+ {
+ MembershipTypeEventListener listener =
(MembershipTypeEventListener)listeners_.get(i);
+ listener.preDelete(membershipType);
+ }
+ }
+
+ private void postDelete(MembershipType membershipType) throws Exception
+ {
+ for (int i = 0; i < listeners_.size(); i++)
+ {
+ MembershipTypeEventListener listener =
(MembershipTypeEventListener)listeners_.get(i);
+ listener.postDelete(membershipType);
+ }
+ }
+
}
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2011-09-12
11:57:34 UTC (rev 7356)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2011-09-12
12:46:15 UTC (rev 7357)
@@ -107,11 +107,19 @@
public void addUserEventListener(UserEventListener listener)
{
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
listeners_.add(listener);
}
public void removeUserEventListener(UserEventListener listener)
{
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
listeners_.remove(listener);
}
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java 2011-09-12
11:57:34 UTC (rev 7356)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java 2011-09-12
12:46:15 UTC (rev 7357)
@@ -66,11 +66,19 @@
public void addUserProfileEventListener(UserProfileEventListener listener)
{
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
listeners_.add(listener);
}
public void removeUserProfileEventListener(UserProfileEventListener listener)
{
+ if (listener == null)
+ {
+ throw new IllegalArgumentException("Listener cannot be null");
+ }
listeners_.remove(listener);
}
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2011-09-12 11:57:34 UTC (rev 7356)
+++ portal/trunk/pom.xml 2011-09-12 12:46:15 UTC (rev 7357)
@@ -38,7 +38,7 @@
<properties>
<org.exoplatform.kernel.version>2.3.0-GA</org.exoplatform.kernel.version>
- <org.exoplatform.core.version>2.4.0-GA</org.exoplatform.core.version>
+
<org.exoplatform.core.version>2.4.0-GA-CP01</org.exoplatform.core.version>
<org.exoplatform.ws.version>2.2.0-GA</org.exoplatform.ws.version>
<org.exoplatform.jcr.version>1.14.0-GA</org.exoplatform.jcr.version>
<org.shindig.version>2.0.2-Beta02</org.shindig.version>
Show replies by date