Author: bdaw
Date: 2009-03-19 17:44:54 -0400 (Thu, 19 Mar 2009)
New Revision: 385
Modified:
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/DBTestCase.java
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Group.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java
Log:
bobo
Modified:
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/DBTestCase.java
===================================================================
---
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/DBTestCase.java 2009-03-19
19:34:38 UTC (rev 384)
+++
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/DBTestCase.java 2009-03-19
21:44:54 UTC (rev 385)
@@ -95,10 +95,10 @@
identitySession.getRelationshipManager().associateGroups(acmeOrg, itGroup);
identitySession.getRelationshipManager().associateGroups(acmeOrg, hrGroup);
- identitySession.getRelationshipManager().associateUsers(itGroup, johnDoe);
- identitySession.getRelationshipManager().associateUsers(itGroup, alice);
+ identitySession.getRelationshipManager().associateUser(itGroup, johnDoe);
+ identitySession.getRelationshipManager().associateUser(itGroup, alice);
- identitySession.getRelationshipManager().associateUsers(hrGroup, eva);
+ identitySession.getRelationshipManager().associateUser(hrGroup, eva);
RoleType managerRT =
identitySession.getRoleManager().createRoleType("manager");
@@ -145,7 +145,7 @@
Group otherGroup =
identitySession.getPersistenceManager().createGroup("otherGroup", GROUP);
- identitySession.getRelationshipManager().associateUsers(otherGroup, xUser);
+ identitySession.getRelationshipManager().associateUser(otherGroup, xUser);
assertEquals(1,
identitySession.getRelationshipManager().findAssociatedGroups(xUser, GROUP).size());
assertEquals(1, identitySession.getRoleManager().findGroupsWithRelatedRole(xUser,
GROUP, null).size());
Modified:
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java
===================================================================
---
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java 2009-03-19
19:34:38 UTC (rev 384)
+++
idm/trunk/example/maven2/src/test/java/org/jboss/identity/idm/example/InjectSFTestCase.java 2009-03-19
21:44:54 UTC (rev 385)
@@ -28,6 +28,7 @@
import org.jboss.identity.idm.api.IdentitySearchControl;
import org.jboss.identity.idm.api.Attribute;
import org.jboss.identity.idm.api.AttributeDescription;
+import org.jboss.identity.idm.api.Group;
import org.jboss.identity.idm.api.cfg.IdentityConfiguration;
import org.jboss.identity.idm.impl.configuration.IdentityConfigurationImpl;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
@@ -102,10 +103,10 @@
identitySession.getRelationshipManager().associateGroupsByIds(acmeOrgId,
itGroupId);
identitySession.getRelationshipManager().associateGroupsByIds(acmeOrgId,
hrGroupId);
- identitySession.getRelationshipManager().associateUsersByIds(itGroupId,
johnDoeUser);
- identitySession.getRelationshipManager().associateUsersByIds(itGroupId,
aliceUser);
+ identitySession.getRelationshipManager().associateUserByIds(itGroupId,
johnDoeUser);
+ identitySession.getRelationshipManager().associateUserByIds(itGroupId,
aliceUser);
- identitySession.getRelationshipManager().associateUsersByIds(hrGroupId,
evaUser);
+ identitySession.getRelationshipManager().associateUserByIds(hrGroupId,
evaUser);
identitySession.getRoleManager().createRoleType("manager");
@@ -152,13 +153,16 @@
String otherGroupId =
identitySession.getPersistenceManager().createGroup("otherGroup",
GROUP).getId();
- identitySession.getRelationshipManager().associateUsersByIds(otherGroupId,
xUser);
+ identitySession.getRelationshipManager().associateUserByIds(otherGroupId,
xUser);
assertEquals(1,
identitySession.getRelationshipManager().findAssociatedGroups(xUser, GROUP,
null).size());
assertEquals(1,
identitySession.getRoleManager().findGroupsWithRelatedRole(xUser, GROUP, null).size());
assertEquals(1,
identitySession.getRoleManager().findGroupsWithRelatedRole(xUser, null).size());
+
+
+
identitySession.getTransaction().commit();
identitySession.close();
Modified:
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java
===================================================================
---
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-03-19
19:34:38 UTC (rev 384)
+++
idm/trunk/idm/src/main/java/org/jboss/identity/idm/impl/api/session/managers/RelationshipManagerImpl.java 2009-03-19
21:44:54 UTC (rev 385)
@@ -37,7 +37,6 @@
import org.jboss.identity.idm.spi.searchcontrol.IdentityObjectSearchControl;
import org.jboss.identity.idm.impl.NotYetImplementedException;
import org.jboss.identity.idm.impl.api.session.managers.AbstractManager;
-import org.jboss.identity.idm.impl.api.model.GroupId;
import java.util.Collection;
import java.util.Iterator;
@@ -235,12 +234,12 @@
{
User member = membersIterator.next();
- associateUsers(parent, member);
+ associateUser(parent, member);
}
}
}
- public void associateUsers(Group parent, Collection<User> members) throws
IdentityException
+ public void associateUser(Group parent, Collection<User> members) throws
IdentityException
{
checkNotNullArgument(parent, "Parent group");
@@ -262,7 +261,7 @@
{
String member = membersIterator.next();
- associateUsersByIds(parent, member);
+ associateUserByIds(parent, member);
}
}
@@ -276,7 +275,7 @@
}
- public void associateUsers(Group parent, User member) throws IdentityException
+ public void associateUser(Group parent, User member) throws IdentityException
{
checkNotNullArgument(parent, "Parent group");
checkNotNullArgument(member, "Member user");
@@ -285,7 +284,7 @@
}
- public void associateUsersByIds(String parentId, String memberId) throws
IdentityException
+ public void associateUserByIds(String parentId, String memberId) throws
IdentityException
{
checkNotNullArgument(parentId, "Parent group Id");
checkNotNullArgument(memberId, "Member user Id");
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java 2009-03-19
19:34:38 UTC (rev 384)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/OrganizationTest.java 2009-03-19
21:44:54 UTC (rev 385)
@@ -152,23 +152,23 @@
// Store as employees
- session.getRelationshipManager().associateUsers(employeesGroup, theuteUser);
- session.getRelationshipManager().associateUsers(employeesGroup, mlittleUser);
- session.getRelationshipManager().associateUsers(employeesGroup, asaldhanaUser);
- session.getRelationshipManager().associateUsers(employeesGroup, bdawidowUser);
- session.getRelationshipManager().associateUsers(employeesGroup, claprunUser);
- session.getRelationshipManager().associateUsers(employeesGroup, whalesUser);
- session.getRelationshipManager().associateUsers(employeesGroup, sshahUser);
- session.getRelationshipManager().associateUsers(employeesGroup, mwringeUser);
+ session.getRelationshipManager().associateUser(employeesGroup, theuteUser);
+ session.getRelationshipManager().associateUser(employeesGroup, mlittleUser);
+ session.getRelationshipManager().associateUser(employeesGroup, asaldhanaUser);
+ session.getRelationshipManager().associateUser(employeesGroup, bdawidowUser);
+ session.getRelationshipManager().associateUser(employeesGroup, claprunUser);
+ session.getRelationshipManager().associateUser(employeesGroup, whalesUser);
+ session.getRelationshipManager().associateUser(employeesGroup, sshahUser);
+ session.getRelationshipManager().associateUser(employeesGroup, mwringeUser);
// Portal team for management purposes
Group portalTeamGroup = session.getPersistenceManager().createGroup("Portal
Team", PEOPLE);
- session.getRelationshipManager().associateUsers(portalTeamGroup, bdawidowUser);
- session.getRelationshipManager().associateUsers(portalTeamGroup, claprunUser);
- session.getRelationshipManager().associateUsers(portalTeamGroup, whalesUser);
- session.getRelationshipManager().associateUsers(portalTeamGroup, sshahUser);
- session.getRelationshipManager().associateUsers(portalTeamGroup, mwringeUser);
+ session.getRelationshipManager().associateUser(portalTeamGroup, bdawidowUser);
+ session.getRelationshipManager().associateUser(portalTeamGroup, claprunUser);
+ session.getRelationshipManager().associateUser(portalTeamGroup, whalesUser);
+ session.getRelationshipManager().associateUser(portalTeamGroup, sshahUser);
+ session.getRelationshipManager().associateUser(portalTeamGroup, mwringeUser);
// Portal team is under common frameworks
@@ -420,17 +420,17 @@
// All users are under people root
- session.getRelationshipManager().associateUsers(usersROOTGroup, anneUser);
- session.getRelationshipManager().associateUsers(usersROOTGroup, marieUser);
- session.getRelationshipManager().associateUsers(usersROOTGroup, eveUser);
- session.getRelationshipManager().associateUsers(usersROOTGroup, angelinaUser);
- session.getRelationshipManager().associateUsers(usersROOTGroup, joannaUser);
- session.getRelationshipManager().associateUsers(usersROOTGroup, merilUser);
- session.getRelationshipManager().associateUsers(usersROOTGroup, johnUser);
- session.getRelationshipManager().associateUsers(usersROOTGroup, stanUser);
- session.getRelationshipManager().associateUsers(usersROOTGroup, chrisUser);
- session.getRelationshipManager().associateUsers(usersROOTGroup, billUser);
- session.getRelationshipManager().associateUsers(usersROOTGroup, jackUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, anneUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, marieUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, eveUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, angelinaUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, joannaUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, merilUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, johnUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, stanUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, chrisUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, billUser);
+ session.getRelationshipManager().associateUser(usersROOTGroup, jackUser);
session.getTransaction().commit();
@@ -452,7 +452,7 @@
// Anna works in Paris office and participates in BASE jumping community as a forum
moderator and CMS admin
- session.getRelationshipManager().associateUsers(parisOffice, anneUser);
+ session.getRelationshipManager().associateUser(parisOffice, anneUser);
// Anne could be just associated with BASE jumping community group using
RelationshipManager but insted Role mechanism
// is used to have more fine grained control of access rights inside of a
community
@@ -470,7 +470,7 @@
// Anne belongs to CMS portal admins security group
- session.getRelationshipManager().associateUsers(cmsAdminGroup, anneUser);
+ session.getRelationshipManager().associateUser(cmsAdminGroup, anneUser);
// Ann is also an owner of geeks community
@@ -491,7 +491,7 @@
// She works in London and is office manager there - se both RelationshipManager
and RoleManager used against
// the same pair of identity objects
- session.getRelationshipManager().associateUsers(londonOffice, angelinaUser);
+ session.getRelationshipManager().associateUser(londonOffice, angelinaUser);
session.getRoleManager().createRole(officeManagerRT, angelinaUser, londonOffice);
@@ -502,7 +502,7 @@
// As office manager she also edits portal cms content
- session.getRelationshipManager().associateUsers(cmsEditorGroup, angelinaUser);
+ session.getRelationshipManager().associateUser(cmsEditorGroup, angelinaUser);
//
Modified:
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java
===================================================================
---
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java 2009-03-19
19:34:38 UTC (rev 384)
+++
idm/trunk/idm/src/test/java/org/jboss/identity/idm/impl/api/RelationshipManagerTest.java 2009-03-19
21:44:54 UTC (rev 385)
@@ -154,8 +154,8 @@
// Associate Group and Users
- session.getRelationshipManager().associateUsers(group1, user1);
- session.getRelationshipManager().associateUsers(group1, user2);
+ session.getRelationshipManager().associateUser(group1, user1);
+ session.getRelationshipManager().associateUser(group1, user2);
// isAssociated
@@ -204,8 +204,8 @@
session.getRelationshipManager().disassociateUsersByIds(Arrays.asList(group1.getId()),
Arrays.asList(user1.getId(), user2.getId()));
// reassociate #3
- session.getRelationshipManager().associateUsersByIds(group1.getId(),
user1.getId());
- session.getRelationshipManager().associateUsersByIds(group1.getId(),
user2.getId());
+ session.getRelationshipManager().associateUserByIds(group1.getId(),
user1.getId());
+ session.getRelationshipManager().associateUserByIds(group1.getId(),
user2.getId());
assertTrue(session.getRelationshipManager().isAssociated(Arrays.asList(group1),
Arrays.asList(user1, user2)));
@@ -336,8 +336,8 @@
session.getRelationshipManager().associateGroups(group1, group2);
session.getRelationshipManager().associateGroups(group1, group3);
- session.getRelationshipManager().associateUsers(group1, user1);
- session.getRelationshipManager().associateUsers(group1, user2);
+ session.getRelationshipManager().associateUser(group1, user1);
+ session.getRelationshipManager().associateUser(group1, user2);
session.getRoleManager().createRoleType("rt1");
session.getRoleManager().createRoleType("rt2");
Modified: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Group.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Group.java 2009-03-19
19:34:38 UTC (rev 384)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/Group.java 2009-03-19
21:44:54 UTC (rev 385)
@@ -27,7 +27,7 @@
/**
* Represents a Group. Group has a name that is unique in scope of a given group type.
This means that groupType/name pairs
* uniquely identifies group. Group Id contains encoded group type and name imformation.
In default implementation
- * it can look as follows: "group://GROUP_TYPE/GROUP_NAME". Still prefix and
format of Id can change in the future so
+ * it can look as follows: "group:/GROUP_TYPE/GROUP_NAME". Still prefix and
format of Id can change in the future so
* PersistenceManager.createGroupId(String groupName, String groupType) method should be
used to create it.
*
* @author Anil.Saldhana(a)redhat.com
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-03-19
19:34:38 UTC (rev 384)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/PersistenceManager.java 2009-03-19
21:44:54 UTC (rev 385)
@@ -69,7 +69,7 @@
/**
* <p>Create a group Id. Result string can be used in other methods. Group Id
contains encoded group type and
* name imformation.
- * In default implementation it can look as follows:
"group://GROUP_TYPE/GROUP_NAME".
+ * In default implementation it can look as follows:
"group:/GROUP_TYPE/GROUP_NAME".
* Still prefix and format of Id can change in the future so this method should be
used to create it.</p>
* @param groupName
* @param groupType
Modified:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-03-19
19:34:38 UTC (rev 384)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/RelationshipManager.java 2009-03-19
21:44:54 UTC (rev 385)
@@ -116,7 +116,7 @@
* @param members
* @throws org.jboss.identity.idm.exception.IdentityException
*/
- void associateUsers(Group parent, Collection<User> members)
+ void associateUser(Group parent, Collection<User> members)
throws IdentityException;
/**
@@ -143,7 +143,7 @@
* @param members
* @throws org.jboss.identity.idm.exception.IdentityException
*/
- void associateUsers(Group parents, User members)
+ void associateUser(Group parents, User members)
throws IdentityException;
/**
@@ -152,7 +152,7 @@
* @param memberid
* @throws org.jboss.identity.idm.exception.IdentityException
*/
- void associateUsersByIds(String parentGroupId, String memberid)
+ void associateUserByIds(String parentGroupId, String memberid)
throws IdentityException;
/**
@@ -428,7 +428,7 @@
/**
- * Find all groups that given identity is associated with.
+ * Find all groups that given identity is associated with. Will return groups
connected with a given user with a role
*
* @param user child identity
* @param groupType can be null
@@ -440,7 +440,7 @@
IdentitySearchControl[] controls) throws
IdentityException;
/**
- * Find all groups that given identity is associated with.
+ * Find all groups that given identity is associated with. Will return groups
connected with a given user with a role
*
* @param userId
* @param groupType can be null
@@ -452,7 +452,7 @@
IdentitySearchControl[] controls) throws
IdentityException;
/**
- * Find identities that have relationship with given parent group.
+ * Find identities that have relationship with given parent group. Will return users
connected with a given group with a role
*
* @param group parent group
* @return
@@ -461,7 +461,7 @@
Collection<User> findRelatedUsers(Group group, IdentitySearchControl[] controls)
throws IdentityException;
/**
- * Find identities that have relationship with given parent group.
+ * Find identities that have relationship with given parent group. Will return users
connected with a given group with a role
*
* @param groupId parent group id
* @return