Author: bdaw
Date: 2011-09-12 20:34:45 -0400 (Mon, 12 Sep 2011)
New Revision: 7364
Modified:
epp/portal/branches/EPP_5_2_Branch/component/identity/pom.xml
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java
epp/portal/branches/EPP_5_2_Branch/pom.xml
Log:
JBEPP-1133 - Created users aren't displayed properly in Users management
JBEPP-1068 - Slow login of user root when many memberships in DB
JBEPP-1156 - Upgrade to JCR 1.14.0-GA
Modified: epp/portal/branches/EPP_5_2_Branch/component/identity/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/component/identity/pom.xml 2011-09-12 23:43:07 UTC
(rev 7363)
+++ epp/portal/branches/EPP_5_2_Branch/component/identity/pom.xml 2011-09-13 00:34:45 UTC
(rev 7364)
@@ -53,6 +53,11 @@
</dependency>
<dependency>
+ <groupId>org.exoplatform.portal</groupId>
+ <artifactId>exo.portal.component.common</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.gatein.common</groupId>
<artifactId>common-logging</artifactId>
</dependency>
Modified:
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2011-09-12
23:43:07 UTC (rev 7363)
+++
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/GroupDAOImpl.java 2011-09-13
00:34:45 UTC (rev 7364)
@@ -71,9 +71,22 @@
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);
+ }
+
final public Group createGroupInstance()
{
if (log.isTraceEnabled())
Modified:
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2011-09-12
23:43:07 UTC (rev 7363)
+++
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipDAOImpl.java 2011-09-13
00:34:45 UTC (rev 7364)
@@ -19,7 +19,9 @@
package org.exoplatform.services.organization.idm;
+import org.exoplatform.commons.utils.ListAccess;
import org.exoplatform.commons.utils.ListenerStack;
+import org.exoplatform.commons.utils.ListAccessImpl;
import org.exoplatform.services.organization.Group;
import org.exoplatform.services.organization.Membership;
import org.exoplatform.services.organization.MembershipEventListener;
@@ -65,9 +67,22 @@
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);
+ }
+
final public Membership createMembershipInstance()
{
return new MembershipImpl();
@@ -749,11 +764,17 @@
return result;
}
+
public Collection findMembershipsByGroup(Group group) throws Exception
{
return findMembershipsByGroupId(group.getId());
}
+ public ListAccess<Membership> findAllMembershipsByGroup(Group group) throws
Exception
+ {
+ return new ListAccessImpl(Membership.class, (List)findMembershipsByGroup(group));
+ }
+
public Collection findMembershipsByGroupId(String groupId) throws Exception
{
if (log.isTraceEnabled())
Modified:
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2011-09-12
23:43:07 UTC (rev 7363)
+++
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/MembershipTypeDAOImpl.java 2011-09-13
00:34:45 UTC (rev 7364)
@@ -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:
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2011-09-12
23:43:07 UTC (rev 7363)
+++
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserDAOImpl.java 2011-09-13
00:34:45 UTC (rev 7364)
@@ -107,9 +107,22 @@
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);
+ }
+
public User createUserInstance()
{
return new UserImpl();
@@ -154,6 +167,11 @@
}
+ if (getIntegrationCache() != null)
+ {
+ getIntegrationCache().invalidateAll();
+ }
+
persistUserInfo(user, session);
if (broadcast)
@@ -324,7 +342,19 @@
public ListAccess<User> findAllUsers() throws Exception
{
- throw new UnsupportedOperationException();
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findAllUsers",
+ null
+ );
+ }
+
+ UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
+
+ return new IDMUserListAccess(this, service_, qb, 20, true);
}
//
@@ -417,6 +447,27 @@
);
}
+ ListAccess list = findUsersByQuery(q);
+
+ return new LazyPageList(list, 20);
+ }
+
+ //
+
+ public ListAccess<User> findUsersByQuery(Query q) throws Exception
+ {
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findUsersByQuery",
+ new Object[]{
+ "q", q
+ }
+ );
+ }
+
// if only condition is email which is unique then delegate to other method as it
will be more efficient
if (q.getUserName() == null &&
q.getEmail() != null &&
@@ -427,7 +478,7 @@
if (uniqueUser != null)
{
- return new LazyPageList<User>( new ListAccess<User>()
+ return new ListAccess<User>()
{
public User[] load(int index, int length) throws Exception,
IllegalArgumentException
{
@@ -438,23 +489,8 @@
{
return 1;
}
- }, 1);
+ };
}
- else
- {
- return new LazyPageList<User>( new ListAccess<User>()
- {
- public User[] load(int index, int length) throws Exception,
IllegalArgumentException
- {
- return new User[0];
- }
-
- public int getSize() throws Exception
- {
- return 0;
- }
- }, 1);
- }
}
@@ -469,7 +505,7 @@
list = cache.getGtnUserLazyPageList(getCacheNS(), q);
if (list != null)
{
- return new LazyPageList(list, 20);
+ return list;
}
}
@@ -516,16 +552,9 @@
cache.putGtnUserLazyPageList(getCacheNS(), q, list);
}
- return new LazyPageList(list, 20);
+ return list;
}
- //
-
- public ListAccess<User> findUsersByQuery(Query query) throws Exception
- {
- throw new UnsupportedOperationException();
- }
-
public LazyPageList findUsersByGroup(String groupId) throws Exception
{
if (log.isTraceEnabled())
@@ -540,23 +569,7 @@
);
}
-
- UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
-
- org.picketlink.idm.api.Group jbidGroup = null;
- try
- {
- jbidGroup = orgService.getJBIDMGroup(groupId);
- }
- catch (Exception e)
- {
- log.info("Cannot obtain group: " + groupId + "; ", e);
-
- }
-
- qb.addRelatedGroup(jbidGroup);
-
- return new LazyPageList(new IDMUserListAccess(this, service_, qb, 20, false), 20);
+ return new LazyPageList(findUsersByGroupId(groupId), 20);
}
public User findUserByEmail(String email) throws Exception
@@ -614,7 +627,35 @@
public ListAccess<User> findUsersByGroupId(String groupId) throws Exception
{
- throw new UnsupportedOperationException();
+ if (log.isTraceEnabled())
+ {
+ Tools.logMethodIn(
+ log,
+ LogLevel.TRACE,
+ "findUsersByGroupId",
+ new Object[]{
+ "groupId", groupId
+ }
+ );
+ }
+
+
+ UserQueryBuilder qb = service_.getIdentitySession().createUserQueryBuilder();
+
+ org.picketlink.idm.api.Group jbidGroup = null;
+ try
+ {
+ jbidGroup = orgService.getJBIDMGroup(groupId);
+ }
+ catch (Exception e)
+ {
+ log.info("Cannot obtain group: " + groupId + "; ", e);
+
+ }
+
+ qb.addRelatedGroup(jbidGroup);
+
+ return new IDMUserListAccess(this, service_, qb, 20, false);
}
//
Modified:
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java
===================================================================
---
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java 2011-09-12
23:43:07 UTC (rev 7363)
+++
epp/portal/branches/EPP_5_2_Branch/component/identity/src/main/java/org/exoplatform/services/organization/idm/UserProfileDAOImpl.java 2011-09-13
00:34:45 UTC (rev 7364)
@@ -66,9 +66,22 @@
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);
+ }
+
final public UserProfile createUserProfileInstance()
{
return new UserProfileImpl();
Modified: epp/portal/branches/EPP_5_2_Branch/pom.xml
===================================================================
--- epp/portal/branches/EPP_5_2_Branch/pom.xml 2011-09-12 23:43:07 UTC (rev 7363)
+++ epp/portal/branches/EPP_5_2_Branch/pom.xml 2011-09-13 00:34:45 UTC (rev 7364)
@@ -37,17 +37,17 @@
<name>EPP GateIn - Portal - ${project.version}</name>
<properties>
-
<org.exoplatform.kernel.version>2.3.0-CR4-CP01</org.exoplatform.kernel.version>
- <org.exoplatform.core.version>2.4.0-CR4</org.exoplatform.core.version>
- <org.exoplatform.ws.version>2.2.0-CR4</org.exoplatform.ws.version>
-
<org.exoplatform.jcr.version>1.14.0-CR4-CP01</org.exoplatform.jcr.version>
+
<org.exoplatform.kernel.version>2.3.0-GA</org.exoplatform.kernel.version>
+
<org.exoplatform.core.version>2.4.0-GA-CP02</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.jibx.version>1.2.1</org.jibx.version>
<org.shindig.version>2.0.2-Beta02</org.shindig.version>
<nl.captcha.simplecaptcha.version>1.1.1-GA-Patch01</nl.captcha.simplecaptcha.version>
<org.gatein.common.version>2.0.4-Beta03</org.gatein.common.version>
<org.gatein.wci.version>2.1.0-Beta06</org.gatein.wci.version>
<org.gatein.pc.version>2.3.0-Beta04</org.gatein.pc.version>
- <org.picketlink.idm>1.3.0.Alpha03</org.picketlink.idm>
+ <org.picketlink.idm>1.3.0.Alpha04</org.picketlink.idm>
<org.gatein.wsrp.version>2.1.0-Beta05</org.gatein.wsrp.version>
<org.gatein.mop.version>1.1.0-Beta05</org.gatein.mop.version>
<org.gatein.mgmt.version>1.0.0-Beta02</org.gatein.mgmt.version>