JBoss Identity SVN: r117 - tags.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-10-22 18:59:25 -0400 (Wed, 22 Oct 2008)
New Revision: 117
Added:
tags/PREVIEW-23-10-2008/
Log:
preview
Copied: tags/PREVIEW-23-10-2008 (from rev 116, trunk)
16 years, 2 months
JBoss Identity SVN: r116 - trunk.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-10-22 18:55:57 -0400 (Wed, 22 Oct 2008)
New Revision: 116
Modified:
trunk/pom.xml
Log:
add javadoc generation to the build
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2008-10-22 15:46:57 UTC (rev 115)
+++ trunk/pom.xml 2008-10-22 22:55:57 UTC (rev 116)
@@ -21,4 +21,21 @@
<module>identity-impl</module>
<module>assembly</module>
</modules>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+
+ <aggregate>true</aggregate>
+ <excludePackageNames>org.jboss.identity.impl</excludePackageNames>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </reporting>
+
+
</project>
16 years, 2 months
JBoss Identity SVN: r115 - in trunk: identity-impl and 1 other directories.
by jboss-identity-commits@lists.jboss.org
Author: anil.saldhana(a)jboss.com
Date: 2008-10-22 11:46:57 -0400 (Wed, 22 Oct 2008)
New Revision: 115
Modified:
trunk/identity-api/.classpath
trunk/identity-impl/.classpath
trunk/identity-spi/.classpath
Log:
fix eclipse build
Modified: trunk/identity-api/.classpath
===================================================================
--- trunk/identity-api/.classpath 2008-10-22 12:05:20 UTC (rev 114)
+++ trunk/identity-api/.classpath 2008-10-22 15:46:57 UTC (rev 115)
@@ -2,7 +2,6 @@
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry combineaccessrules="false" kind="src" path="/identity-model"/>
<classpathentry combineaccessrules="false" kind="src" path="/identity-common"/>
<classpathentry kind="output" path="target/eclipse-classes"/>
</classpath>
Modified: trunk/identity-impl/.classpath
===================================================================
--- trunk/identity-impl/.classpath 2008-10-22 12:05:20 UTC (rev 114)
+++ trunk/identity-impl/.classpath 2008-10-22 15:46:57 UTC (rev 115)
@@ -6,8 +6,11 @@
<classpathentry combineaccessrules="false" kind="src" path="/identity-api"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
<classpathentry kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/identity-model"/>
<classpathentry combineaccessrules="false" kind="src" path="/identity-common"/>
<classpathentry combineaccessrules="false" kind="src" path="/identity-spi"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.3.1.GA/hibernate-annotations-3.3.1.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-opends/OpenDS/1.0.0/OpenDS-1.0.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-entitymanager/3.3.1.ga/hibernate-entitymanager-3.3.1.ga.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate/3.2.4.ga/hibernate-3.2.4.ga.jar"/>
<classpathentry kind="output" path="target/eclipse-classes"/>
</classpath>
Modified: trunk/identity-spi/.classpath
===================================================================
--- trunk/identity-spi/.classpath 2008-10-22 12:05:20 UTC (rev 114)
+++ trunk/identity-spi/.classpath 2008-10-22 15:46:57 UTC (rev 115)
@@ -3,7 +3,6 @@
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry combineaccessrules="false" kind="src" path="/identity-model"/>
<classpathentry combineaccessrules="false" kind="src" path="/identity-common"/>
<classpathentry kind="output" path="target/eclipse-classes"/>
</classpath>
16 years, 2 months
JBoss Identity SVN: r114 - trunk/identity-impl/src/test/java/org/jboss/identity/impl/api.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-10-22 08:05:20 -0400 (Wed, 22 Oct 2008)
New Revision: 114
Modified:
trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
Log:
cleanup
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-10-22 11:47:54 UTC (rev 113)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-10-22 12:05:20 UTC (rev 114)
@@ -125,10 +125,7 @@
// Portal is part of common frameworks
session.getRelationshipManager().associateGroups(commonFrameworksOU, portalProject);
-
- //TODO: common frameworks for bgeorges - whats the type of group?
-
// People
Group employeesGroup = session.getPersistenceManager().createGroup("Employees", PEOPLE);
16 years, 2 months
JBoss Identity SVN: r113 - in trunk: identity-impl/src/main/java/org/jboss/identity/impl/api and 1 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-10-22 07:47:54 -0400 (Wed, 22 Oct 2008)
New Revision: 113
Modified:
trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
Log:
some more stuff for portal sample testcase
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java 2008-10-22 10:19:16 UTC (rev 112)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java 2008-10-22 11:47:54 UTC (rev 113)
@@ -76,6 +76,16 @@
Map<String, String[]> getAttributes(IdentityType identity) throws IdentityException;
/**
+ * Get attribute values for the given IdentityType
+ *
+ * @param identity
+ * @param attributeName
+ * @return
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ String[] getAttributeValues(IdentityType identity, String attributeName) throws IdentityException;
+
+ /**
* Update attributes with new values - previous values will be overwritten. All the other attributes are not changed -
* method doesn't overwrite whole attribute set connected with a given IdentityType object.
* @param identity
@@ -97,6 +107,30 @@
throws IdentityException;
/**
+ * Add new attribute - if attribute with given name already exists the values
+ * will be appended
+ *
+ * @param identity
+ * @param attributeName
+ * @param values
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ void addAttribute(IdentityType identity, String attributeName, String[] values)
+ throws IdentityException;
+
+ /**
+ * Add new attribute - if attribute with given name already exists the values
+ * will be appended
+ *
+ * @param identity
+ * @param attributeName
+ * @param values
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ void addAttribute(IdentityType identity, String attributeName, String value)
+ throws IdentityException;
+
+ /**
* Remove attributes
*
* @param identity
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java 2008-10-22 10:19:16 UTC (rev 112)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java 2008-10-22 11:47:54 UTC (rev 113)
@@ -111,6 +111,16 @@
<G extends IdentityType, I extends IdentityType> boolean isAssociated(Collection<G> parents, Collection<I> members)
throws IdentityException;
+ /**
+ * <p>Check if association is present </p>
+ * @param parent
+ * @param member
+ * @return
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ <G extends IdentityType, I extends IdentityType> boolean isAssociated(G parent, I member)
+ throws IdentityException;
+
// Resolve relationships
/**
@@ -163,6 +173,25 @@
boolean ascending) throws IdentityException;
/**
+ * Find all groups that given identity is associated with.
+ * If the paginatedSearch or orderedSearch operations
+ * are not supported, dedicated parameters will
+ * take no effect
+ *
+ * @param identity child identity
+ * @param offset
+ * @param limit 0 means unlimited page size
+ * @param orderedByName
+ * @param ascending
+ * @return
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ Collection<Group> findAssociatedGroups(Identity identity,
+ int offset, int limit,
+ boolean orderedByName,
+ boolean ascending) throws IdentityException;
+
+ /**
* Find identities that have relationship with given parent group.
* If the paginatedSearch or orderedSearch operations
* are not supported in this store implementation, dedicated parameters will
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java 2008-10-22 10:19:16 UTC (rev 112)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java 2008-10-22 11:47:54 UTC (rev 113)
@@ -96,6 +96,29 @@
}
+ public String[] getAttributeValues(IdentityType identity, String attributeName) throws IdentityException
+ {
+ return getAttributes(identity).get(attributeName);
+ }
+
+ public void addAttribute(IdentityType identity, String attributeName, String[] values) throws IdentityException
+ {
+ Map<String, String[]> attrs = new HashMap<String, String[]>();
+ attrs.put(attributeName, values);
+
+ addAttributes(identity, attrs);
+
+ }
+
+ public void addAttribute(IdentityType identity, String attributeName, String value) throws IdentityException
+ {
+ Map<String, String[]> attrs = new HashMap<String, String[]>();
+ attrs.put(attributeName, new String[]{value});
+
+ addAttributes(identity, attrs);
+
+ }
+
public void addAttributes(IdentityType identity, Map<String, String[]> attributes) throws IdentityException
{
Map<String, Set<String>> attrs = new HashMap<String, Set<String>>();
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java 2008-10-22 10:19:16 UTC (rev 112)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java 2008-10-22 11:47:54 UTC (rev 113)
@@ -40,6 +40,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.LinkedList;
+import java.util.Set;
+import java.util.HashSet;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -169,9 +171,19 @@
}
}
- return false;
+ return true;
}
+ public <G extends IdentityType, I extends IdentityType> boolean isAssociated(G parent, I member) throws IdentityException
+ {
+ Set<G> parents = new HashSet<G>();
+ parents.add(parent);
+ Set<I> members = new HashSet<I>();
+ members.add(member);
+
+ return isAssociated(parents, members);
+ }
+
public Collection<Group> findAssociatedGroups(Group group, GroupType groupType, boolean parent, boolean inherited, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
{
@@ -212,6 +224,22 @@
return identities;
}
+ public Collection<Group> findAssociatedGroups(Identity identity, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
+ {
+ List<Group> identities = new LinkedList<Group>();
+
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity), MEMBER, false, offset, limit, false, false);
+
+ for (IdentityObject io : ios)
+ {
+ identities.add(createGroup(io));
+ }
+
+ return identities;
+ }
+
+
+
public Collection<Identity> findAssociatedIdentities(Group group, boolean inherited, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
{
List<Identity> identities = new LinkedList<Identity>();
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-10-22 10:19:16 UTC (rev 112)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-10-22 11:47:54 UTC (rev 113)
@@ -348,6 +348,8 @@
Group acmeOrg = session.getPersistenceManager().createGroup("ACME", ORGANIZATION);
+ session.getRelationshipManager().associateGroups(organizationRootGroup, acmeOrg);
+
Group departmentsOU = session.getPersistenceManager().createGroup("Departments", ORGANIZATION_UNIT);
Group officesOU = session.getPersistenceManager().createGroup("Offices", ORGANIZATION_UNIT);
Group employeesOU = session.getPersistenceManager().createGroup("Employees", ORGANIZATION_UNIT);
@@ -390,9 +392,109 @@
Identity billUser = session.getPersistenceManager().createIdentity("bill");
Identity jackUser = session.getPersistenceManager().createIdentity("jack");
- // Roles assignment
+ // All users are under people root
+ session.getRelationshipManager().associateIdentities(usersROOTGroup, anneUser);
+ session.getRelationshipManager().associateIdentities(usersROOTGroup, marieUser);
+ session.getRelationshipManager().associateIdentities(usersROOTGroup, eveUser);
+ session.getRelationshipManager().associateIdentities(usersROOTGroup, angelinaUser);
+ session.getRelationshipManager().associateIdentities(usersROOTGroup, joannaUser);
+ session.getRelationshipManager().associateIdentities(usersROOTGroup, merilUser);
+ session.getRelationshipManager().associateIdentities(usersROOTGroup, johnUser);
+ session.getRelationshipManager().associateIdentities(usersROOTGroup, stanUser);
+ session.getRelationshipManager().associateIdentities(usersROOTGroup, chrisUser);
+ session.getRelationshipManager().associateIdentities(usersROOTGroup, billUser);
+ session.getRelationshipManager().associateIdentities(usersROOTGroup, jackUser);
+
+ //
+
+
+ // Anna is...
+
+ // Anna Smith...
+
+
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_NAME_GIVEN, "Anne");
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_NAME_FAMILY, "Smith");
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_JOB_TITLE, "Senior Software Developer");
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL, "anne.smith(a)acme.com");
+ session.getAttributesManager().addAttribute(anneUser, P3PConstants.INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER, "777 777 777 7 77");
+
+ // Anna works in Paris office and participates in BASE jumping community as a forum moderator and CMS admin
+
+ session.getRelationshipManager().associateIdentities(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
+
+ session.getRoleManager().createRole(communityMemberRT, anneUser, baseJumpingCommunity);
+ session.getRoleManager().createRole(communityForumModeratorRT, anneUser, baseJumpingCommunity);
+ session.getRoleManager().createRole(communityCMSAdminRT, anneUser, baseJumpingCommunity);
+
+ // Anne belongs to CMS portal admins security group
+
+ session.getRelationshipManager().associateIdentities(cmsAdminGroup, anneUser);
+
+ // Ann is also an owner of geeks community
+
+ session.getRoleManager().createRole(communityOwnerRT, anneUser, geeksCommunity);
+
+
+ //
+
+
+ // Angelina ...
+
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_NAME_GIVEN, "Angelina");
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_NAME_FAMILY, "Blond");
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_JOB_TITLE, "Very important looking job title");
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL, "angelina1979(a)acme.com");
+ session.getAttributesManager().addAttribute(angelinaUser, P3PConstants.INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER, "888 88 88 8888");
+
+ // She works in London and is office manager there - se both RelationshipManager and RoleManager used against
+ // the same pair of identity objects
+
+ session.getRelationshipManager().associateIdentities(londonOffice, angelinaUser);
+
+ session.getRoleManager().createRole(officeManagerRT, angelinaUser, londonOffice);
+
+ // Angelina is member of geeks community and manages cms content there
+
+ session.getRoleManager().createRole(communityMemberRT, angelinaUser, geeksCommunity);
+ session.getRoleManager().createRole(communityCMSAdminRT, angelinaUser, geeksCommunity);
+
+ // As office manager she also edits portal cms content
+
+ session.getRelationshipManager().associateIdentities(cmsEditorGroup, angelinaUser);
+
+
+ //
+
+
+ // Some assertions
+
+ // How many users do we have in whole acme org and how many people in paris and london offices
+ assertEquals(11, session.getRelationshipManager().findAssociatedIdentities(usersROOTGroup, false, 0, 0, false, false).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedIdentities(parisOffice, false, 0, 0, false, false).size());
+ assertEquals(1, session.getRelationshipManager().findAssociatedIdentities(londonOffice, false, 0, 0, false, false).size());
+
+
+ // Is anne geeks community owner?
+ assertTrue(session.getRoleManager().hasRole(anneUser, geeksCommunity, communityOwnerRT));
+
+ // Does she belong to cms admins
+ assertTrue(session.getRelationshipManager().isAssociated(cmsAdminGroup, anneUser));
+
+ // Check all groups that anna belongs to
+ Collection<Group> groups = session.getRelationshipManager().findAssociatedGroups(anneUser, 0, 0, false, false );
+ assertEquals(3, groups.size());
+ assertTrue(groups.contains(usersROOTGroup));
+ assertTrue(groups.contains(parisOffice));
+ assertTrue(groups.contains(cmsAdminGroup));
+
+
+
session.getTransaction().commit();
}
16 years, 2 months
JBoss Identity SVN: r112 - in trunk: identity-common/src/main/java/org/jboss/identity and 3 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-10-22 06:19:16 -0400 (Wed, 22 Oct 2008)
New Revision: 112
Added:
trunk/identity-common/src/main/java/org/jboss/identity/p3p/
trunk/identity-common/src/main/java/org/jboss/identity/p3p/P3PConstants.java
Modified:
trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySession.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionImpl.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
Log:
p3p constants
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySession.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySession.java 2008-10-21 21:33:37 UTC (rev 111)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/IdentitySession.java 2008-10-22 10:19:16 UTC (rev 112)
@@ -97,7 +97,7 @@
* @return
* @throws FeatureNotSupportedException
*/
- AttributesManager getProfileManager();
+ AttributesManager getAttributesManager();
//TODO: proper exception if roles are not supported
Added: trunk/identity-common/src/main/java/org/jboss/identity/p3p/P3PConstants.java
===================================================================
--- trunk/identity-common/src/main/java/org/jboss/identity/p3p/P3PConstants.java (rev 0)
+++ trunk/identity-common/src/main/java/org/jboss/identity/p3p/P3PConstants.java 2008-10-22 10:19:16 UTC (rev 112)
@@ -0,0 +1,245 @@
+/******************************************************************************
+ * 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.identity.p3p;
+
+/**
+ * Class taken from JBoss Portal common module.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision: 5451 $
+ */
+public final class P3PConstants
+{
+ public enum TelecomType
+ {
+ TELEPHONE(TELECOM_TELEPHONE),
+ FAX(TELECOM_FAX),
+ MOBILE(TELECOM_MOBILE),
+ PAGER(TELECOM_PAGER);
+
+ private final String prefix;
+
+ TelecomType(String prefix)
+ {
+ this.prefix = prefix;
+ }
+
+ public String getPrefix()
+ {
+ return prefix;
+ }
+ }
+
+ public enum TelecomInfo
+ {
+ INTCODE(TELECOM_INTCODE),
+ LOCCODE(TELECOM_LOCCODE),
+ NUMBER(TELECOM_NUMBER),
+ EXT(TELECOM_EXT),
+ COMMENT(TELECOM_COMMENT);
+
+ private final String name;
+
+ TelecomInfo(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+ }
+
+ public enum PostalInfo
+ {
+ NAME(POSTAL_NAME),
+ STREET(POSTAL_STREET),
+ CITY(POSTAL_CITY),
+ STATEPROV(POSTAL_STATEPROV),
+ POSTALCODE(POSTAL_POSTALCODE),
+ COUNTRY(POSTAL_COUNTRY),
+ ORGANIZATION(POSTAL_ORGANIZATION);
+
+ private final String name;
+
+ PostalInfo(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+ }
+
+ public enum OnlineInfo
+ {
+ EMAIL(ONLINE_EMAIL),
+ URI(ONLINE_URI);
+
+ private final String name;
+
+ OnlineInfo(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+ }
+
+
+ // Postal
+ private static final String POSTAL_NAME = "postal.name";
+ private static final String POSTAL_STREET = "postal.street";
+ private static final String POSTAL_CITY = "postal.city";
+ private static final String POSTAL_STATEPROV = "postal.stateprov";
+ private static final String POSTAL_POSTALCODE = "postal.postalcode";
+ private static final String POSTAL_COUNTRY = "postal.country";
+ private static final String POSTAL_ORGANIZATION = "postal.organization";
+
+ // Telecom
+ private static final String TELECOM_TELEPHONE = "telecom.telephone.";
+ private static final String TELECOM_FAX = "telecom.fax.";
+ private static final String TELECOM_MOBILE = "telecom.mobile.";
+ private static final String TELECOM_PAGER = "telecom.pager.";
+ private static final String TELECOM_INTCODE = "intcode";
+ private static final String TELECOM_LOCCODE = "loccode";
+ private static final String TELECOM_NUMBER = "number";
+ private static final String TELECOM_EXT = "ext";
+ private static final String TELECOM_COMMENT = "comment";
+
+ // Online
+ private static final String ONLINE_URI = "online.uri";
+ private static final String ONLINE_EMAIL = "online.email";
+
+ /*
+ * User information attribute names (PLT.D in the portlet spec) that are defined in P3P spec.
+ */
+
+ //
+ public static final String INFO_USER_BDATE = "user.bdate";
+ public static final String INFO_USER_GENDER = "user.gender";
+ public static final String INFO_USER_EMPLOYER = "user.employer";
+ public static final String INFO_USER_DEPARTMENT = "user.department";
+ public static final String INFO_USER_JOB_TITLE = "user.jobtitle";
+ public static final String INFO_USER_NAME_PREFIX = "user.name.prefix";
+ public static final String INFO_USER_NAME_GIVEN = "user.name.given";
+ public static final String INFO_USER_NAME_FAMILY = "user.name.family";
+ public static final String INFO_USER_NAME_MIDDLE = "user.name.middle";
+ public static final String INFO_USER_NAME_SUFFIX = "user.name.suffix";
+ public static final String INFO_USER_NAME_NICKNAME = "user.name.nickName";
+
+ // User home
+ private static final String INFO_USER_HOME_PREFIX = "user.home-info.";
+ public static final String INFO_USER_HOME_INFO_POSTAL_NAME = INFO_USER_HOME_PREFIX + POSTAL_NAME;
+ public static final String INFO_USER_HOME_INFO_POSTAL_STREET = INFO_USER_HOME_PREFIX + POSTAL_STREET;
+ public static final String INFO_USER_HOME_INFO_POSTAL_CITY = INFO_USER_HOME_PREFIX + POSTAL_CITY;
+ public static final String INFO_USER_HOME_INFO_POSTAL_STATEPROV = INFO_USER_HOME_PREFIX + POSTAL_STATEPROV;
+ public static final String INFO_USER_HOME_INFO_POSTAL_POSTALCODE = INFO_USER_HOME_PREFIX + POSTAL_POSTALCODE;
+ public static final String INFO_USER_HOME_INFO_POSTAL_COUNTRY = INFO_USER_HOME_PREFIX + POSTAL_COUNTRY;
+ public static final String INFO_USER_HOME_INFO_POSTAL_ORGANIZATION = INFO_USER_HOME_PREFIX + POSTAL_ORGANIZATION;
+ public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_INTCODE = INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + TELECOM_INTCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_LOCCODE = INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + TELECOM_LOCCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_NUMBER = INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + TELECOM_NUMBER;
+ public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_EXT = INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + TELECOM_EXT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_TELEPHONE_COMMENT = INFO_USER_HOME_PREFIX + TELECOM_TELEPHONE + TELECOM_COMMENT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_FAX_INTCODE = INFO_USER_HOME_PREFIX + TELECOM_FAX + TELECOM_INTCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_FAX_LOCCODE = INFO_USER_HOME_PREFIX + TELECOM_FAX + TELECOM_LOCCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_FAX_NUMBER = INFO_USER_HOME_PREFIX + TELECOM_FAX + TELECOM_NUMBER;
+ public static final String INFO_USER_HOME_INFO_TELECOM_FAX_EXT = INFO_USER_HOME_PREFIX + TELECOM_FAX + TELECOM_EXT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_FAX_COMMENT = INFO_USER_HOME_PREFIX + TELECOM_FAX + TELECOM_COMMENT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_INTCODE = INFO_USER_HOME_PREFIX + TELECOM_MOBILE + TELECOM_INTCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_LOCCODE = INFO_USER_HOME_PREFIX + TELECOM_MOBILE + TELECOM_LOCCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_NUMBER = INFO_USER_HOME_PREFIX + TELECOM_MOBILE + TELECOM_NUMBER;
+ public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_EXT = INFO_USER_HOME_PREFIX + TELECOM_MOBILE + TELECOM_EXT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_MOBILE_COMMENT = INFO_USER_HOME_PREFIX + TELECOM_MOBILE + TELECOM_COMMENT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_INTCODE = INFO_USER_HOME_PREFIX + TELECOM_PAGER + TELECOM_INTCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_LOCCODE = INFO_USER_HOME_PREFIX + TELECOM_PAGER + TELECOM_LOCCODE;
+ public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_NUMBER = INFO_USER_HOME_PREFIX + TELECOM_PAGER + TELECOM_NUMBER;
+ public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_EXT = INFO_USER_HOME_PREFIX + TELECOM_PAGER + TELECOM_EXT;
+ public static final String INFO_USER_HOME_INFO_TELECOM_PAGER_COMMENT = INFO_USER_HOME_PREFIX + TELECOM_PAGER + TELECOM_COMMENT;
+ public static final String INFO_USER_HOME_INFO_ONLINE_EMAIL = INFO_USER_HOME_PREFIX + ONLINE_EMAIL;
+ public static final String INFO_USER_HOME_INFO_ONLINE_URI = INFO_USER_HOME_PREFIX + ONLINE_URI;
+
+ // User Business
+ private static final String INFO_USER_BUSINESS_PREFIX = "user.business-info.";
+ public static final String INFO_USER_BUSINESS_INFO_POSTAL_NAME = INFO_USER_BUSINESS_PREFIX + POSTAL_NAME;
+ public static final String INFO_USER_BUSINESS_INFO_POSTAL_STREET = INFO_USER_BUSINESS_PREFIX + POSTAL_STREET;
+ public static final String INFO_USER_BUSINESS_INFO_POSTAL_CITY = INFO_USER_BUSINESS_PREFIX + POSTAL_CITY;
+ public static final String INFO_USER_BUSINESS_INFO_POSTAL_STATEPROV = INFO_USER_BUSINESS_PREFIX + POSTAL_STATEPROV;
+ public static final String INFO_USER_BUSINESS_INFO_POSTAL_POSTALCODE = INFO_USER_BUSINESS_PREFIX + POSTAL_POSTALCODE;
+ public static final String INFO_USER_BUSINESS_INFO_POSTAL_COUNTRY = INFO_USER_BUSINESS_PREFIX + POSTAL_COUNTRY;
+ public static final String INFO_USER_BUSINESS_INFO_POSTAL_ORGANIZATION = INFO_USER_BUSINESS_PREFIX + POSTAL_ORGANIZATION;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_INTCODE = INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + TELECOM_INTCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_LOCCODE = INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + TELECOM_LOCCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_NUMBER = INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + TELECOM_NUMBER;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_EXT = INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + TELECOM_EXT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_TELEPHONE_COMMENT = INFO_USER_BUSINESS_PREFIX + TELECOM_TELEPHONE + TELECOM_COMMENT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_INTCODE = INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + TELECOM_INTCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_LOCCODE = INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + TELECOM_LOCCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_NUMBER = INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + TELECOM_NUMBER;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_EXT = INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + TELECOM_EXT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_FAX_COMMENT = INFO_USER_BUSINESS_PREFIX + TELECOM_FAX + TELECOM_COMMENT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_INTCODE = INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + TELECOM_INTCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_LOCCODE = INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + TELECOM_LOCCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_NUMBER = INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + TELECOM_NUMBER;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_EXT = INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + TELECOM_EXT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_MOBILE_COMMENT = INFO_USER_BUSINESS_PREFIX + TELECOM_MOBILE + TELECOM_COMMENT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_INTCODE = INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + TELECOM_INTCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_LOCCODE = INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + TELECOM_LOCCODE;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_NUMBER = INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + TELECOM_NUMBER;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_EXT = INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + TELECOM_EXT;
+ public static final String INFO_USER_BUSINESS_INFO_TELECOM_PAGER_COMMENT = INFO_USER_BUSINESS_PREFIX + TELECOM_PAGER + TELECOM_COMMENT;
+ public static final String INFO_USER_BUSINESS_INFO_ONLINE_EMAIL = INFO_USER_BUSINESS_PREFIX + ONLINE_EMAIL;
+ public static final String INFO_USER_BUSINESS_INFO_ONLINE_URI = INFO_USER_BUSINESS_PREFIX + ONLINE_URI;
+
+ private P3PConstants()
+ {
+ }
+
+ private static String getHomeOrBusinessPrefix(boolean isBusiness)
+ {
+ return isBusiness ? P3PConstants.INFO_USER_BUSINESS_PREFIX : P3PConstants.INFO_USER_HOME_PREFIX;
+ }
+
+ public static String getPostalUserInfoKey(PostalInfo info, boolean isBusiness)
+ {
+ return getHomeOrBusinessPrefix(isBusiness) + info.getName();
+ }
+
+ public static String getTelecomInfoKey(TelecomType type, TelecomInfo info, boolean isBusiness)
+ {
+ return getHomeOrBusinessPrefix(isBusiness) + type.getPrefix() + info.getName();
+ }
+
+ public static String getOnlineUserInfoKey(OnlineInfo info, boolean isBusiness)
+ {
+ return getHomeOrBusinessPrefix(isBusiness) + info.getName();
+ }
+}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionImpl.java 2008-10-21 21:33:37 UTC (rev 111)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/IdentitySessionImpl.java 2008-10-22 10:19:16 UTC (rev 112)
@@ -134,7 +134,7 @@
return relationshipManager;
}
- public AttributesManager getProfileManager()
+ public AttributesManager getAttributesManager()
{
return profileManager;
}
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-10-21 21:33:37 UTC (rev 111)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-10-22 10:19:16 UTC (rev 112)
@@ -28,8 +28,11 @@
import org.jboss.identity.api.Identity;
import org.jboss.identity.api.RoleType;
import org.jboss.identity.api.IdentitySessionFactory;
+import org.jboss.identity.p3p.P3PConstants;
import java.util.Collection;
+import java.util.Map;
+import java.util.HashMap;
import junit.framework.Assert;
@@ -65,6 +68,8 @@
public void testRedHatOrganization() throws Exception
{
+ // GroupType
+
GroupType ORGANIZATION = new SimpleGroupType("ORGANIZATION");
GroupType ORGANIZATION_UNIT = new SimpleGroupType("ORGANIZATION_UNIT");
GroupType DIVISION = new SimpleGroupType("DIVISION");
@@ -261,9 +266,18 @@
assertTrue(groups.contains(employeesGroup));
assertTrue(groups.contains(portalTeamGroup));
+
+ // User attributes
+ Map<String, String[]> userInfo = new HashMap<String, String[]>();
+ userInfo.put(P3PConstants.INFO_USER_NAME_GIVEN, new String[]{"Boleslaw"});
+ userInfo.put(P3PConstants.INFO_USER_NAME_FAMILY, new String[]{"Dawidowicz"});
- //TODO: Attributes
+ session.getAttributesManager().addAttributes(bdawidowUser, userInfo);
+ userInfo = session.getAttributesManager().getAttributes(bdawidowUser);
+ assertEquals(2, userInfo.keySet().size());
+ assertEquals("Dawidowicz", (userInfo.get(P3PConstants.INFO_USER_NAME_FAMILY))[0]);
+
session.getTransaction().commit();
}
16 years, 2 months
JBoss Identity SVN: r111 - in trunk: identity-impl/src/main/java/org/jboss/identity/impl/api and 4 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-10-21 17:33:37 -0400 (Tue, 21 Oct 2008)
New Revision: 111
Modified:
trunk/identity-api/src/main/java/org/jboss/identity/api/Group.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupType.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectRelationship.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/APITestCase.java
trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
Log:
more in OrganizationTest plus some fixes
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/Group.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/Group.java 2008-10-21 14:30:03 UTC (rev 110)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/Group.java 2008-10-21 21:33:37 UTC (rev 111)
@@ -33,16 +33,9 @@
*/
public interface Group extends IdentityType
{
-
/**
- * <p>Return the name of the identity</p>
* @return
*/
- String getName();
-
- /**
- * @return
- */
GroupType getGroupType();
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java 2008-10-21 14:30:03 UTC (rev 110)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java 2008-10-21 21:33:37 UTC (rev 111)
@@ -128,7 +128,7 @@
* Default is false
* @param offset
* @param limit 0 means unlimited page size
- * @param orderedByAttributeName can be null
+ * @param orderedByName
* @param ascending
* @return
* @throws org.jboss.identity.exception.IdentityException
@@ -138,7 +138,7 @@
boolean parent,
boolean inherited,
int offset, int limit,
- String orderedByAttributeName,
+ boolean orderedByName,
boolean ascending) throws IdentityException;
/**
@@ -151,7 +151,7 @@
* @param groupType can be null
* @param offset
* @param limit 0 means unlimited page size
- * @param orderedByAttributeName can be null
+ * @param orderedByName
* @param ascending
* @return
* @throws org.jboss.identity.exception.IdentityException
@@ -159,7 +159,7 @@
Collection<Group> findAssociatedGroups(Identity identity,
GroupType groupType,
int offset, int limit,
- String orderedByAttributeName,
+ boolean orderedByName,
boolean ascending) throws IdentityException;
/**
@@ -172,7 +172,7 @@
* @param inherited if true also identities from subgroubs will be retrieved. Default is false
* @param offset
* @param limit 0 means unlimited page size
- * @param orderedByAttributeName can be null
+ * @param orderedByName
* @param ascending
* @return
* @throws org.jboss.identity.exception.IdentityException
@@ -180,7 +180,7 @@
Collection<Identity> findAssociatedIdentities(Group group,
boolean inherited,
int offset, int limit,
- String orderedByAttributeName,
+ boolean orderedByName,
boolean ascending) throws IdentityException;
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java 2008-10-21 14:30:03 UTC (rev 110)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java 2008-10-21 21:33:37 UTC (rev 111)
@@ -32,10 +32,14 @@
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObjectRelationship;
+import org.jboss.identity.spi.model.IdentityObject;
+import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.impl.NotYetImplementedException;
import java.util.Collection;
import java.util.Iterator;
+import java.util.List;
+import java.util.LinkedList;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -168,18 +172,57 @@
return false;
}
- public Collection<Group> findAssociatedGroups(Group group, GroupType groupType, boolean parent, boolean inherited, int offset, int limit, String orderedByAttributeName, boolean ascending) throws IdentityException
+ public Collection<Group> findAssociatedGroups(Group group, GroupType groupType, boolean parent, boolean inherited, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
{
- throw new NotYetImplementedException();
+
+ List<Group> identities = new LinkedList<Group>();
+
+ IdentityObjectType iot = getIdentityObjectType(groupType);
+
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, offset, limit, false, false);
+
+ for (IdentityObject io : ios)
+ {
+ if (io.getIdentityType().getName().equals(iot.getName()))
+ {
+ identities.add(createGroup(io));
+ }
+ }
+
+ return identities;
+
}
- public Collection<Group> findAssociatedGroups(Identity identity, GroupType groupType, int offset, int limit, String orderedByAttributeName, boolean ascending) throws IdentityException
+ public Collection<Group> findAssociatedGroups(Identity identity, GroupType groupType, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
{
- throw new NotYetImplementedException();
+ List<Group> identities = new LinkedList<Group>();
+
+ IdentityObjectType iot = getIdentityObjectType(groupType);
+
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(identity), MEMBER, false, offset, limit, false, false);
+
+ for (IdentityObject io : ios)
+ {
+ if (io.getIdentityType().getName().equals(iot.getName()))
+ {
+ identities.add(createGroup(io));
+ }
+ }
+
+ return identities;
}
- public Collection<Identity> findAssociatedIdentities(Group group, boolean inherited, int offset, int limit, String orderedByAttributeName, boolean ascending) throws IdentityException
+ public Collection<Identity> findAssociatedIdentities(Group group, boolean inherited, int offset, int limit, boolean orderedByName, boolean ascending) throws IdentityException
{
- throw new NotYetImplementedException();
+ List<Identity> identities = new LinkedList<Identity>();
+
+ Collection<IdentityObject> ios = getRepository().findIdentityObject(getInvocationContext(), createIdentityObject(group), MEMBER, true, offset, limit, false, false);
+
+ for (IdentityObject io : ios)
+ {
+ identities.add(createIdentity(io));
+ }
+
+ return identities;
}
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java 2008-10-21 14:30:03 UTC (rev 110)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupImpl.java 2008-10-21 21:33:37 UTC (rev 111)
@@ -64,4 +64,38 @@
{
return null;
}
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ SimpleGroupImpl that = (SimpleGroupImpl)o;
+
+ if (groupType != null ? !groupType.equals(that.groupType) : that.groupType != null)
+ {
+ return false;
+ }
+ if (name != null ? !name.equals(that.name) : that.name != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (name != null ? name.hashCode() : 0);
+ result = 31 * result + (id != null ? id.hashCode() : 0);
+ result = 31 * result + (groupType != null ? groupType.hashCode() : 0);
+ return result;
+ }
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupType.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupType.java 2008-10-21 14:30:03 UTC (rev 110)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleGroupType.java 2008-10-21 21:33:37 UTC (rev 111)
@@ -43,5 +43,29 @@
return name;
}
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+ SimpleGroupType that = (SimpleGroupType)o;
+
+ if (name != null ? !name.equals(that.name) : that.name != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ return (name != null ? name.hashCode() : 0);
+ }
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java 2008-10-21 14:30:03 UTC (rev 110)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/SimpleIdentityImpl.java 2008-10-21 21:33:37 UTC (rev 111)
@@ -60,4 +60,33 @@
{
return null;
}
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ SimpleIdentityImpl that = (SimpleIdentityImpl)o;
+
+ if (name != null ? !name.equals(that.name) : that.name != null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int result;
+ result = (name != null ? name.hashCode() : 0);
+ result = 31 * result + (id != null ? id.hashCode() : 0);
+ return result;
+ }
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectRelationship.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectRelationship.java 2008-10-21 14:30:03 UTC (rev 110)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/model/hibernate/HibernateIdentityObjectRelationship.java 2008-10-21 21:33:37 UTC (rev 111)
@@ -32,11 +32,13 @@
import javax.persistence.JoinColumn;
import javax.persistence.UniqueConstraint;
import javax.persistence.Column;
+import javax.persistence.FetchType;
import org.jboss.identity.spi.model.IdentityObjectRelationship;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObject;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationshipType;
+import org.hibernate.annotations.Fetch;
/**
* @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
@@ -69,11 +71,11 @@
@JoinColumn(nullable = false, name="TYPE")
private HibernateIdentityObjectRelationshipType type;
- @ManyToOne
+ @ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(nullable = false, name="FROM_IDENTITY")
private HibernateIdentityObject fromIdentityObject;
- @ManyToOne
+ @ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(nullable = false, name="TO_IDENTITY")
private HibernateIdentityObject toIdentityObject;
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java 2008-10-21 14:30:03 UTC (rev 110)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java 2008-10-21 21:33:37 UTC (rev 111)
@@ -146,11 +146,15 @@
return resolveIdentityStore(identityType).findIdentityObject(invocationCtx, identityType, attributes, offset, limit, orderByName, ascending);
}
- public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCxt, IdentityObject identity, IdentityObjectRelationshipType relationshipType, boolean parent, int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
+ public Collection<IdentityObject> findIdentityObject(IdentityStoreInvocationContext invocationCxt,
+ IdentityObject identity,
+ IdentityObjectRelationshipType relationshipType,
+ boolean parent,
+ int offset, int limit, boolean orderByName, boolean ascending) throws IdentityException
{
- //TODO:!!!!!!
- //return defaultIdentityStore.findIdentityObject(invocationCxt, identity, relationshipType, parent, offset, limit, orderByName, ascending);
- throw new NotYetImplementedException();
+ //TODO:
+ return defaultIdentityStore.findIdentityObject(invocationCxt, identity, relationshipType, parent, offset, limit, orderByName, ascending);
+
}
public IdentityObjectRelationship createRelationship(IdentityStoreInvocationContext invocationCxt, IdentityObject fromIdentity, IdentityObject toIdentity, IdentityObjectRelationshipType relationshipType, String relationshipName, boolean createNames) throws IdentityException
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java 2008-10-21 14:30:03 UTC (rev 110)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java 2008-10-21 21:33:37 UTC (rev 111)
@@ -343,7 +343,7 @@
}
q = getHibernateEntityManager(ctx).getSession().createQuery(hqlString.toString())
- .setParameter("relType", relationshipType)
+ .setParameter("relType", relationshipType.getName())
.setParameter("identity",hibernateObject)
.setFirstResult(offset);
@@ -352,8 +352,9 @@
q.setMaxResults(limit);
}
- results = (List<IdentityObject>)q.list();
+ results = q.list();
+
}
catch (Exception e)
{
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/APITestCase.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/APITestCase.java 2008-10-21 14:30:03 UTC (rev 110)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/APITestCase.java 2008-10-21 21:33:37 UTC (rev 111)
@@ -159,8 +159,8 @@
final LDAPIdentityStoreConfiguration ldapConfig = createLDAPConfig("IDENTITY", null, null);
-
+
IdentityStore ldapStore = new LDAPIdentityStore("LDAPStore");
Map<String, IdentityStore> isMap = new HashMap<String, IdentityStore>();
Modified: trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java
===================================================================
--- trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-10-21 14:30:03 UTC (rev 110)
+++ trunk/identity-impl/src/test/java/org/jboss/identity/impl/api/OrganizationTest.java 2008-10-21 21:33:37 UTC (rev 111)
@@ -65,9 +65,6 @@
public void testRedHatOrganization() throws Exception
{
-
-
-
GroupType ORGANIZATION = new SimpleGroupType("ORGANIZATION");
GroupType ORGANIZATION_UNIT = new SimpleGroupType("ORGANIZATION_UNIT");
GroupType DIVISION = new SimpleGroupType("DIVISION");
@@ -97,10 +94,17 @@
session.getRelationshipManager().associateGroups(jbossDivision, itDepartment);
session.getRelationshipManager().associateGroups(jbossDivision, hrDepartment);
- Group projectsDepartment = session.getPersistenceManager().createGroup("Projects", DEPARTMENT);
+ Group rndDepartment = session.getPersistenceManager().createGroup("RnD", DEPARTMENT);
- session.getRelationshipManager().associateGroups(itDepartment, projectsDepartment);
+ session.getRelationshipManager().associateGroups(itDepartment, rndDepartment);
+ Group projectsOU = session.getPersistenceManager().createGroup("Projects", ORGANIZATION_UNIT);
+ Group commonFrameworksOU = session.getPersistenceManager().createGroup("Common Frameworks", ORGANIZATION_UNIT);
+
+ session.getRelationshipManager().associateGroups(rndDepartment, projectsOU);
+
+ // Projects
+
Group portalProject = session.getPersistenceManager().createGroup("Portal", PROJECT);
Group soaProject = session.getPersistenceManager().createGroup("SOA", PROJECT);
Group jbpmProject = session.getPersistenceManager().createGroup("jBPM", PROJECT);
@@ -108,12 +112,16 @@
Group asProject = session.getPersistenceManager().createGroup("AS", PROJECT);
Group securityProject = session.getPersistenceManager().createGroup("Security", PROJECT);
- session.getRelationshipManager().associateGroups(projectsDepartment, portalProject);
- session.getRelationshipManager().associateGroups(projectsDepartment, soaProject);
- session.getRelationshipManager().associateGroups(projectsDepartment, jbpmProject);
- session.getRelationshipManager().associateGroups(projectsDepartment, asProject);
- session.getRelationshipManager().associateGroups(projectsDepartment, seamProject);
+ session.getRelationshipManager().associateGroups(projectsOU, portalProject);
+ session.getRelationshipManager().associateGroups(projectsOU, soaProject);
+ session.getRelationshipManager().associateGroups(projectsOU, jbpmProject);
+ session.getRelationshipManager().associateGroups(projectsOU, asProject);
+ session.getRelationshipManager().associateGroups(projectsOU, seamProject);
+ // Portal is part of common frameworks
+ session.getRelationshipManager().associateGroups(commonFrameworksOU, portalProject);
+
+
//TODO: common frameworks for bgeorges - whats the type of group?
// People
@@ -147,7 +155,7 @@
session.getRelationshipManager().associateIdentities(employeesGroup, sshahUser);
session.getRelationshipManager().associateIdentities(employeesGroup, mwringeUser);
- // Portal team for management
+ // Portal team for management purposes
Group portalTeamGroup = session.getPersistenceManager().createGroup("Portal Team", PEOPLE);
session.getRelationshipManager().associateIdentities(portalTeamGroup, bdawidowUser);
@@ -156,6 +164,10 @@
session.getRelationshipManager().associateIdentities(portalTeamGroup, sshahUser);
session.getRelationshipManager().associateIdentities(portalTeamGroup, mwringeUser);
+ // Portal team is under common frameworks
+
+ session.getRelationshipManager().associateGroups(commonFrameworksOU, portalTeamGroup);
+
// Role Types
RoleType developerRT = session.getRoleManager().createRoleType("Developer");
@@ -165,6 +177,10 @@
// Assign roles
+ // Common frameworks manager
+
+ session.getRoleManager().createRole(managerRT, bgeorgesUser, commonFrameworksOU);
+
// Portal developers
session.getRoleManager().createRole(developerRT, theuteUser, portalProject);
@@ -191,11 +207,9 @@
session.getRoleManager().createRole(leadDeveloperRT, asaldhanaUser, securityProject);
- //TODO: Asserts for this structure
-
-
// Check what RoleTypes has user theute
Collection<RoleType> roleTypes = session.getRoleManager().findIdentityRoleTypes(theuteUser, 0, 0, false, false);
+ assertEquals(3, roleTypes.size());
assertTrue(roleTypes.contains(developerRT));
assertTrue(roleTypes.contains(leadDeveloperRT));
assertTrue(roleTypes.contains(managerRT));
@@ -205,9 +219,51 @@
assertTrue(session.getRoleManager().hasRole(theuteUser, portalProject, leadDeveloperRT));
assertTrue(session.getRoleManager().hasRole(theuteUser, portalTeamGroup, managerRT));
- //TODO: Something about profile
+ // Check where anil is Lead Developer and where Developer
+ roleTypes = session.getRoleManager().findIdentityRoleTypes(asaldhanaUser, 0, 0, false, false);
+ assertEquals(2, roleTypes.size());
+ assertTrue(roleTypes.contains(developerRT));
+ assertTrue(roleTypes.contains(leadDeveloperRT));
+ roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, securityProject, 0, 0, false, false);
+ assertEquals(2, roleTypes.size());
+ assertTrue(roleTypes.contains(leadDeveloperRT));
+
+ roleTypes = session.getRoleManager().findRoleTypes(asaldhanaUser, asProject, 0, 0, false, false);
+ assertEquals(1, roleTypes.size());
+ assertTrue(roleTypes.contains(developerRT));
+
+ // and simpler...
+ assertTrue(session.getRoleManager().hasRole(asaldhanaUser, asProject, developerRT));
+
+ // Assert relationships
+
+ Collection<Identity> identities = session.getRelationshipManager().findAssociatedIdentities(portalTeamGroup, false, 0, 0, false, false);
+ assertEquals(5, identities.size());
+ assertTrue(identities.contains(claprunUser));
+ assertTrue(identities.contains(mwringeUser));
+ assertTrue(identities.contains(sshahUser));
+ assertTrue(identities.contains(whalesUser));
+ assertTrue(identities.contains(bdawidowUser));
+
+ Collection<Group> groups = session.getRelationshipManager().findAssociatedGroups(rndDepartment, PROJECT, true, false, 0, 0, false, false);
+ assertEquals(0, groups.size());
+
+ // Check to which group Anil belongs
+ groups = session.getRelationshipManager().findAssociatedGroups(asaldhanaUser, PEOPLE, 0, 0, false, false);
+ assertEquals(1, groups.size());
+ assertTrue(groups.contains(employeesGroup));
+
+ // Now check sshah
+ groups = session.getRelationshipManager().findAssociatedGroups(sshahUser, PEOPLE, 0, 0, false, false);
+ assertEquals(2, groups.size());
+ assertTrue(groups.contains(employeesGroup));
+ assertTrue(groups.contains(portalTeamGroup));
+
+
+ //TODO: Attributes
+
session.getTransaction().commit();
}
16 years, 2 months
JBoss Identity SVN: r109 - in trunk/identity-spi/src/main/java/org/jboss/identity/spi: store and 1 other directory.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-10-21 08:27:10 -0400 (Tue, 21 Oct 2008)
New Revision: 109
Added:
trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/PasswordAttribute.java
Removed:
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesDescription.java
Log:
readd PaswordAttribute
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/PasswordAttribute.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/PasswordAttribute.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/PasswordAttribute.java 2008-10-21 12:27:10 UTC (rev 109)
@@ -0,0 +1,72 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.spi.attribute;
+
+import org.jboss.identity.spi.model.IdentityObjectType;
+import org.jboss.identity.spi.model.IdentityObjectAttribute;
+import org.jboss.identity.spi.policy.PasswordExpirationPolicy;
+
+import java.util.Date;
+
+
+
+/**
+ * Represents a password
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jul 13, 2008
+ */
+public class PasswordAttribute<T extends IdentityObjectType>
+implements IdentityObjectAttribute
+{
+ /**
+ * Password policy governing this attribute.
+ * A null value indicates that there is no policy.
+ */
+ protected PasswordExpirationPolicy<T> passwordPolicy;
+
+ /**
+ * Get the date time when the password was last updated.
+ * The update can be based on password expiration.
+ */
+ protected Date lastUpdated = new Date();
+
+ public PasswordAttribute()
+ {
+ }
+
+ public PasswordAttribute(PasswordExpirationPolicy<T> aPasswordPolicy)
+ {
+ this.passwordPolicy = aPasswordPolicy;
+ }
+
+ public PasswordExpirationPolicy<T> getPasswordPolicy()
+ {
+ return passwordPolicy;
+ }
+
+ public void setPasswordPolicy(PasswordExpirationPolicy<T> passwordPolicy)
+ {
+ this.passwordPolicy = passwordPolicy;
+ }
+
+
+}
\ No newline at end of file
Deleted: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesDescription.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesDescription.java 2008-10-21 12:21:15 UTC (rev 108)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesDescription.java 2008-10-21 12:27:10 UTC (rev 109)
@@ -1,98 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.identity.spi.store;
-
-import java.util.Set;
-import java.util.Map;
-
-import org.jboss.identity.spi.model.IdentityObjectType;
-import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
-import org.jboss.identity.spi.exception.IdentityTypeNotSupportedException;
-import org.jboss.identity.exception.IdentityException;
-
-/**
- * Describe the features supported by an Identity Store
- * @author boleslaw dot dawidowicz at redhat anotherdot com
- * @author Anil.Saldhana(a)redhat.com
- * @since Jul 10, 2008
- */
-public interface FeaturesDescription
-{
- /**
- * Get the supported operations
- * @param identityObjectType a type representing identity, role, group
- * @return supported operations for given identity type
- * @throws org.jboss.identity.spi.exception.IdentityTypeNotSupportedException
- */
- public Set<OperationType> getSupportedOperations(IdentityObjectType identityObjectType)
- throws IdentityTypeNotSupportedException;
-
- /**
- * @param operationType
- * @param identityObjectType
- * @return if given operation on given identity type is supported
- * @throws IdentityTypeNotSupportedException
- */
- boolean isOperationSupported(OperationType operationType,
- IdentityObjectType identityObjectType) throws IdentityTypeNotSupportedException;
-
-
- /**
- * @param operationType
- * @return set of identity types that can be processed with a given operation
- * @throws org.jboss.identity.exception.IdentityException
- */
- public Set<IdentityObjectType> getSupportedIdentityObjectTypes(OperationType operationType);
-
- /**
- * @return set of identity types that can be persisted
- */
- Set<IdentityObjectType> getSupportedIdentityObjectTypes();
-
- /**
- * @param identityObjectType
- * @return boolean describing if given identity type can be persisted or retrieved using this identity store
- */
- boolean isIdentityObjectTypeSupported(IdentityObjectType identityObjectType);
-
- /**
- * @param fromType
- * @param toType
- * @param relationshipType
- * @return true is given relationship can be persisted or retrieved
- * @throws org.jboss.identity.exception.IdentityException
- */
- boolean isRelationshipTypeSupported(IdentityObjectType fromType, IdentityObjectType toType,
- IdentityObjectRelationshipType relationshipType)
- throws IdentityException;
-
- /**
- * @return Set of RelationshipType supported in this store
- */
- Set<IdentityObjectRelationshipType> getSupportedRelationshipTypes();
-
- /**
- * @return A mapping of RelationshipType and IdentityType objects that can have such relationship in this store
- */
- Map<IdentityObjectRelationshipType, Map<IdentityObjectType, IdentityObjectType>> getSupportedRelationshipTypeMappings();
-
-}
\ No newline at end of file
16 years, 2 months
JBoss Identity SVN: r108 - in trunk: identity-impl/src/main/java/org/jboss/identity/impl/api and 6 other directories.
by jboss-identity-commits@lists.jboss.org
Author: bdaw
Date: 2008-10-21 08:21:15 -0400 (Tue, 21 Oct 2008)
New Revision: 108
Added:
trunk/identity-api/src/main/java/org/jboss/identity/api/AttributeDescription.java
trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManagerFeaturesDescription.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManagerFeaturesDescription.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManagerFeaturesDescription.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesMetaDataImpl.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/AttributeMetaData.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java
Removed:
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesDescriptionImpl.java
Modified:
trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java
trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java
trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java
trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java
trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java
Log:
More metadata improvements
Added: trunk/identity-api/src/main/java/org/jboss/identity/api/AttributeDescription.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/AttributeDescription.java (rev 0)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/AttributeDescription.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -0,0 +1,48 @@
+/*
+* 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.identity.api;
+
+/**
+ * Information about attribute
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface AttributeDescription
+{
+
+ /**
+ * @return
+ */
+ boolean isReadonly();
+
+ /**
+ * @return
+ */
+ boolean isMultivalue();
+
+ /**
+ * @return
+ */
+ boolean isRequired();
+
+}
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/AttributesManager.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -41,10 +41,25 @@
*/
IdentitySession getIdentitySession();
- //TODO: Add FeaturesDescription
+ /**
+ * Get AttributeDesciption object for single attribute supported with a given IdentityType
+ *
+ * @param identityType
+ * @param name
+ * @return
+ */
+ AttributeDescription getAttributeDescription(IdentityType identityType, String name);
/**
+ * Get AttributeDesciption object for all attributes supported with a given IdentityType
+ *
* @param identityType
+ * @return
+ */
+ Map<String, AttributeDescription> getSupportedAttributesDescriptions(IdentityType identityType);
+
+ /**
+ * @param identityType
* @return names of supported attributes
* @throws org.jboss.identity.exception.IdentityException
*/
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManager.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -42,8 +42,12 @@
IdentitySession getIdentitySession();
- //TODO: Add FeaturesDescription
+ /**
+ * @return
+ */
+ PersistenceManagerFeaturesDescription getFeaturesDescription();
+
// Create
/**
Added: trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManagerFeaturesDescription.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManagerFeaturesDescription.java (rev 0)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/PersistenceManagerFeaturesDescription.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -0,0 +1,63 @@
+/*
+* 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.identity.api;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface PersistenceManagerFeaturesDescription
+{
+
+ /**
+ * @return
+ */
+ boolean isIdentitiesCreationSupported();
+
+ /**
+ * @return
+ */
+ boolean isGroupsCreationSupported();
+
+ /**
+ * @return
+ */
+ boolean isIdentitiesSortedSearchSupported();
+
+ /**
+ * @param groupType
+ * @return
+ */
+ boolean isGroupsSortedSearchSupported(GroupType groupType);
+
+ /**
+ * @return
+ */
+ boolean isIdentitiesPaginatedSearchSupported();
+
+ /**
+ * @param groupType
+ * @return
+ */
+ boolean isGroupsPaginatedSearchSupported(GroupType groupType);
+}
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManager.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -40,7 +40,10 @@
*/
IdentitySession getIdentitySession();
- //TODO: Add FeaturesDescription
+ /**
+ * @return
+ */
+ RelationshipManagerFeaturesDescription getFeaturesDescription();
// Assignation
Added: trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManagerFeaturesDescription.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManagerFeaturesDescription.java (rev 0)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/RelationshipManagerFeaturesDescription.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -0,0 +1,69 @@
+/*
+* 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.identity.api;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface RelationshipManagerFeaturesDescription
+{
+
+ /**
+ * @param fromGroupType
+ * @return
+ */
+ boolean isIdentityAssociationSupported(GroupType fromGroupType);
+
+ /**
+ * @param fromGroupType
+ * @param toGroupType
+ * @return
+ */
+ boolean isGroupAssociationSupported(GroupType fromGroupType, GroupType toGroupType);
+
+ /**
+ * @return
+ */
+ boolean isIdentitiesSortedSearchSupported();
+
+ /**
+ * @param groupType
+ * @return
+ */
+ boolean isGroupsSortedSearchSupported(GroupType groupType);
+
+ /**
+ * @return
+ */
+ boolean isIdentitiesPaginatedSearchSupported();
+
+ /**
+ * @param groupType
+ * @return
+ */
+ boolean isGroupsPaginatedSearchSupported(GroupType groupType);
+
+
+
+}
Modified: trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManager.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -43,7 +43,10 @@
*/
IdentitySession getIdentitySession();
- //TODO: Add FeaturesDescription
+ /**
+ * @return
+ */
+ RoleManagerFeaturesDescription getSupportedFeatures();
// RoleType
Added: trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManagerFeaturesDescription.java
===================================================================
--- trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManagerFeaturesDescription.java (rev 0)
+++ trunk/identity-api/src/main/java/org/jboss/identity/api/RoleManagerFeaturesDescription.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -0,0 +1,62 @@
+/*
+* 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.identity.api;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface RoleManagerFeaturesDescription
+{
+ /**
+ * @return
+ */
+ boolean isRoleTypeCreationSupported();
+
+ /**
+ * @return
+ */
+ boolean isRoleTypeRemovalSupported();
+
+ /**
+ * @return
+ */
+ boolean isRoleSortedSearchSupported();
+
+ /**
+ * @param groupType
+ * @return
+ */
+ boolean isRoleTypeSortedSearchSupported(GroupType groupType);
+
+ /**
+ * @return
+ */
+ boolean isRolePaginatedSearchSupported();
+
+ /**
+ * @param groupType
+ * @return
+ */
+ boolean isRoleTypePaginatedSearchSupported(GroupType groupType);
+}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/AttributesManagerImpl.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -26,6 +26,7 @@
import org.jboss.identity.api.AttributesManager;
import org.jboss.identity.api.IdentityType;
import org.jboss.identity.api.Identity;
+import org.jboss.identity.api.AttributeDescription;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.impl.NotYetImplementedException;
@@ -45,6 +46,16 @@
super(session);
}
+ public AttributeDescription getAttributeDescription(IdentityType identityType, String name)
+ {
+ return null;
+ }
+
+ public Map<String, AttributeDescription> getSupportedAttributesDescriptions(IdentityType identityType)
+ {
+ return null;
+ }
+
//TODO: fix to have similar signatures in API/SPI for String[] and avoid unnesesary iterations
public Set<String> getSupportedAttributeNames(IdentityType identityType) throws IdentityException
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/PersistenceManagerImpl.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -28,6 +28,7 @@
import org.jboss.identity.api.GroupType;
import org.jboss.identity.api.IdentityType;
import org.jboss.identity.api.IdentitySession;
+import org.jboss.identity.api.PersistenceManagerFeaturesDescription;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.spi.model.IdentityObjectType;
import org.jboss.identity.spi.model.IdentityObject;
@@ -52,6 +53,11 @@
super(session);
}
+ public PersistenceManagerFeaturesDescription getFeaturesDescription()
+ {
+ return null;
+ }
+
public Identity createIdentity(String identityName) throws IdentityException
{
IdentityObjectType iot = getIdentityObjectType();
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RelationshipManagerImpl.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -28,6 +28,7 @@
import org.jboss.identity.api.Identity;
import org.jboss.identity.api.IdentityType;
import org.jboss.identity.api.GroupType;
+import org.jboss.identity.api.RelationshipManagerFeaturesDescription;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObjectRelationship;
@@ -56,6 +57,11 @@
super(session);
}
+ public RelationshipManagerFeaturesDescription getFeaturesDescription()
+ {
+ return null;
+ }
+
public void associateGroups(Collection<Group> parents, Collection<Group> members) throws IdentityException
{
for (Iterator<Group> parentsIterator = parents.iterator(); parentsIterator.hasNext();)
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/api/RoleManagerImpl.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -29,6 +29,7 @@
import org.jboss.identity.api.Identity;
import org.jboss.identity.api.Group;
import org.jboss.identity.api.IdentityType;
+import org.jboss.identity.api.RoleManagerFeaturesDescription;
import org.jboss.identity.exception.IdentityException;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObjectRelationship;
@@ -58,6 +59,11 @@
super(session);
}
+ public RoleManagerFeaturesDescription getSupportedFeatures()
+ {
+ return null;
+ }
+
public RoleType createRoleType(String name) throws IdentityException
{
String roleType = null;
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/FallbackIdentityStoreRepository.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -24,7 +24,7 @@
import org.jboss.identity.spi.store.IdentityStore;
import org.jboss.identity.spi.store.AttributeStore;
-import org.jboss.identity.spi.store.FeaturesDescription;
+import org.jboss.identity.spi.store.FeaturesMetaData;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
@@ -71,7 +71,7 @@
return null;
}
- public FeaturesDescription getSupportedFeatures()
+ public FeaturesMetaData getSupportedFeatures()
{
return null;
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/repository/WrapperIdentityStoreRepository.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -22,10 +22,9 @@
package org.jboss.identity.impl.repository;
-import org.jboss.identity.spi.repository.IdentityStoreRepository;
import org.jboss.identity.spi.store.IdentityStore;
import org.jboss.identity.spi.store.AttributeStore;
-import org.jboss.identity.spi.store.FeaturesDescription;
+import org.jboss.identity.spi.store.FeaturesMetaData;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
@@ -71,7 +70,7 @@
return null;
}
- public FeaturesDescription getSupportedFeatures()
+ public FeaturesMetaData getSupportedFeatures()
{
return null;
}
Deleted: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesDescriptionImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesDescriptionImpl.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesDescriptionImpl.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -1,80 +0,0 @@
-/*
-* 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.identity.impl.store;
-
-import org.jboss.identity.spi.store.FeaturesDescription;
-import org.jboss.identity.spi.store.OperationType;
-import org.jboss.identity.spi.exception.IdentityTypeNotSupportedException;
-import org.jboss.identity.spi.model.IdentityObjectType;
-import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
-import org.jboss.identity.exception.IdentityException;
-
-import java.util.Set;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
- * @version : 0.1 $
- */
-public class FeaturesDescriptionImpl implements FeaturesDescription
-{
- public Set<OperationType> getSupportedOperations(IdentityObjectType identityObjectType) throws IdentityTypeNotSupportedException
- {
- return null;
- }
-
- public boolean isOperationSupported(OperationType operationType, IdentityObjectType identityObjectType) throws IdentityTypeNotSupportedException
- {
- return true;
- }
-
- public Set<IdentityObjectType> getSupportedIdentityObjectTypes(OperationType operationType)
- {
- return null;
- }
-
- public Set<IdentityObjectType> getSupportedIdentityObjectTypes()
- {
- return null;
- }
-
- public boolean isIdentityObjectTypeSupported(IdentityObjectType identityObjectType)
- {
- return true;
- }
-
- public boolean isRelationshipTypeSupported(IdentityObjectType fromType, IdentityObjectType toType, IdentityObjectRelationshipType relationshipType) throws IdentityException
- {
- return true;
- }
-
- public Set<IdentityObjectRelationshipType> getSupportedRelationshipTypes()
- {
- return null;
- }
-
- public Map<IdentityObjectRelationshipType, Map<IdentityObjectType, IdentityObjectType>> getSupportedRelationshipTypeMappings()
- {
- return null;
- }
-}
Copied: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesMetaDataImpl.java (from rev 95, trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesDescriptionImpl.java)
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesMetaDataImpl.java (rev 0)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/FeaturesMetaDataImpl.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -0,0 +1,80 @@
+/*
+* 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.identity.impl.store;
+
+import org.jboss.identity.spi.store.FeaturesMetaData;
+import org.jboss.identity.spi.store.OperationType;
+import org.jboss.identity.spi.exception.IdentityTypeNotSupportedException;
+import org.jboss.identity.spi.model.IdentityObjectType;
+import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
+import org.jboss.identity.exception.IdentityException;
+
+import java.util.Set;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class FeaturesMetaDataImpl implements FeaturesMetaData
+{
+ public Set<OperationType> getSupportedOperations(IdentityObjectType identityObjectType) throws IdentityTypeNotSupportedException
+ {
+ return null;
+ }
+
+ public boolean isOperationSupported(OperationType operationType, IdentityObjectType identityObjectType) throws IdentityTypeNotSupportedException
+ {
+ return true;
+ }
+
+ public Set<IdentityObjectType> getSupportedIdentityObjectTypes(OperationType operationType)
+ {
+ return null;
+ }
+
+ public Set<IdentityObjectType> getSupportedIdentityObjectTypes()
+ {
+ return null;
+ }
+
+ public boolean isIdentityObjectTypeSupported(IdentityObjectType identityObjectType)
+ {
+ return true;
+ }
+
+ public boolean isRelationshipTypeSupported(IdentityObjectType fromType, IdentityObjectType toType, IdentityObjectRelationshipType relationshipType) throws IdentityException
+ {
+ return true;
+ }
+
+ public Set<IdentityObjectRelationshipType> getSupportedRelationshipTypes()
+ {
+ return null;
+ }
+
+ public Map<IdentityObjectRelationshipType, Map<IdentityObjectType, IdentityObjectType>> getSupportedRelationshipTypeMappings()
+ {
+ return null;
+ }
+}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/hibernate/HibernateIdentityStoreImpl.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -23,7 +23,7 @@
package org.jboss.identity.impl.store.hibernate;
import org.jboss.identity.spi.store.IdentityStore;
-import org.jboss.identity.spi.store.FeaturesDescription;
+import org.jboss.identity.spi.store.FeaturesMetaData;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
import org.jboss.identity.spi.model.IdentityObject;
@@ -37,12 +37,10 @@
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectType;
import org.jboss.identity.impl.model.hibernate.HibernateIdentityObjectRelationshipName;
import org.jboss.identity.impl.NotYetImplementedException;
-import org.jboss.identity.impl.helper.Tools;
-import org.jboss.identity.impl.store.FeaturesDescriptionImpl;
+import org.jboss.identity.impl.store.FeaturesMetaDataImpl;
import org.jboss.identity.impl.store.hibernate.HibernateIdentityStoreInvocationContext;
import org.hibernate.ejb.HibernateEntityManager;
import org.hibernate.criterion.Restrictions;
-import org.hibernate.HibernateException;
import javax.persistence.NoResultException;
import javax.persistence.Query;
@@ -50,11 +48,8 @@
import java.util.Collection;
import java.util.Map;
import java.util.List;
-import java.util.LinkedList;
import java.util.Iterator;
import java.util.HashSet;
-import java.util.Collections;
-import java.util.HashMap;
import java.io.IOException;
/**
@@ -85,13 +80,13 @@
private String id;
- private FeaturesDescription supportedFeatures;
+ private FeaturesMetaData supportedFeatures;
public HibernateIdentityStoreImpl()
{
// For now just dummy impl
//TODO: initialize with configuration
- supportedFeatures = new FeaturesDescriptionImpl();
+ supportedFeatures = new FeaturesMetaDataImpl();
}
public void start()
@@ -123,7 +118,7 @@
this.id = id;
}
- public FeaturesDescription getSupportedFeatures()
+ public FeaturesMetaData getSupportedFeatures()
{
return supportedFeatures;
}
Modified: trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java
===================================================================
--- trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-impl/src/main/java/org/jboss/identity/impl/store/ldap/LDAPIdentityStore.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -23,7 +23,7 @@
package org.jboss.identity.impl.store.ldap;
import org.jboss.identity.spi.store.IdentityStore;
-import org.jboss.identity.spi.store.FeaturesDescription;
+import org.jboss.identity.spi.store.FeaturesMetaData;
import org.jboss.identity.spi.store.IdentityStoreInvocationContext;
import org.jboss.identity.spi.model.IdentityObject;
import org.jboss.identity.spi.model.IdentityObjectType;
@@ -31,11 +31,10 @@
import org.jboss.identity.spi.model.IdentityObjectRelationship;
import org.jboss.identity.spi.exception.OperationNotSupportedException;
import org.jboss.identity.exception.IdentityException;
-import org.jboss.identity.impl.store.FeaturesDescriptionImpl;
+import org.jboss.identity.impl.store.FeaturesMetaDataImpl;
import org.jboss.identity.impl.model.ldap.LDAPIdentityObjectImpl;
import org.jboss.identity.impl.model.ldap.LDAPIdentityObjectRelationshipImpl;
import org.jboss.identity.impl.helper.Tools;
-import org.jboss.identity.impl.helper.LDAPTools;
import org.jboss.identity.impl.NotYetImplementedException;
import javax.naming.ldap.LdapContext;
@@ -75,13 +74,13 @@
private final String id;
- private FeaturesDescription supportedFeatures;
+ private FeaturesMetaData supportedFeatures;
public LDAPIdentityStore(String id)
{
// For now just dummy impl
//TODO: initialize with configuration
- supportedFeatures = new FeaturesDescriptionImpl();
+ supportedFeatures = new FeaturesMetaDataImpl();
this.id = id;
}
@@ -95,7 +94,7 @@
return id;
}
- public FeaturesDescription getSupportedFeatures()
+ public FeaturesMetaData getSupportedFeatures()
{
return supportedFeatures;
}
Added: trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/AttributeMetaData.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/AttributeMetaData.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/attribute/AttributeMetaData.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -0,0 +1,45 @@
+/*
+* 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.identity.spi.attribute;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface AttributeMetaData
+{
+ /**
+ * @return
+ */
+ boolean isReadonly();
+
+ /**
+ * @return
+ */
+ boolean isMultivalue();
+
+ /**
+ * @return
+ */
+ boolean isRequired();
+}
Copied: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java (from rev 95, trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesDescription.java)
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java (rev 0)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/FeaturesMetaData.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -0,0 +1,98 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.identity.spi.store;
+
+import java.util.Set;
+import java.util.Map;
+
+import org.jboss.identity.spi.model.IdentityObjectType;
+import org.jboss.identity.spi.model.IdentityObjectRelationshipType;
+import org.jboss.identity.spi.exception.IdentityTypeNotSupportedException;
+import org.jboss.identity.exception.IdentityException;
+
+/**
+ * Describe the features supported by an Identity Store
+ * @author boleslaw dot dawidowicz at redhat anotherdot com
+ * @author Anil.Saldhana(a)redhat.com
+ * @since Jul 10, 2008
+ */
+public interface FeaturesMetaData
+{
+ /**
+ * Get the supported operations
+ * @param identityObjectType a type representing identity, role, group
+ * @return supported operations for given identity type
+ * @throws org.jboss.identity.spi.exception.IdentityTypeNotSupportedException
+ */
+ public Set<OperationType> getSupportedOperations(IdentityObjectType identityObjectType)
+ throws IdentityTypeNotSupportedException;
+
+ /**
+ * @param operationType
+ * @param identityObjectType
+ * @return if given operation on given identity type is supported
+ * @throws IdentityTypeNotSupportedException
+ */
+ boolean isOperationSupported(OperationType operationType,
+ IdentityObjectType identityObjectType) throws IdentityTypeNotSupportedException;
+
+
+ /**
+ * @param operationType
+ * @return set of identity types that can be processed with a given operation
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ public Set<IdentityObjectType> getSupportedIdentityObjectTypes(OperationType operationType);
+
+ /**
+ * @return set of identity types that can be persisted
+ */
+ Set<IdentityObjectType> getSupportedIdentityObjectTypes();
+
+ /**
+ * @param identityObjectType
+ * @return boolean describing if given identity type can be persisted or retrieved using this identity store
+ */
+ boolean isIdentityObjectTypeSupported(IdentityObjectType identityObjectType);
+
+ /**
+ * @param fromType
+ * @param toType
+ * @param relationshipType
+ * @return true is given relationship can be persisted or retrieved
+ * @throws org.jboss.identity.exception.IdentityException
+ */
+ boolean isRelationshipTypeSupported(IdentityObjectType fromType, IdentityObjectType toType,
+ IdentityObjectRelationshipType relationshipType)
+ throws IdentityException;
+
+ /**
+ * @return Set of RelationshipType supported in this store
+ */
+ Set<IdentityObjectRelationshipType> getSupportedRelationshipTypes();
+
+ /**
+ * @return A mapping of RelationshipType and IdentityType objects that can have such relationship in this store
+ */
+ Map<IdentityObjectRelationshipType, Map<IdentityObjectType, IdentityObjectType>> getSupportedRelationshipTypeMappings();
+
+}
\ No newline at end of file
Modified: trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java
===================================================================
--- trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java 2008-10-21 11:05:46 UTC (rev 107)
+++ trunk/identity-spi/src/main/java/org/jboss/identity/spi/store/IdentityStore.java 2008-10-21 12:21:15 UTC (rev 108)
@@ -57,7 +57,7 @@
* @return FeaturesDescription object describing what
* operation are supported by this store
*/
- FeaturesDescription getSupportedFeatures();
+ FeaturesMetaData getSupportedFeatures();
// Operations
16 years, 2 months