Author: bdaw
Date: 2009-03-20 09:57:54 -0400 (Fri, 20 Mar 2009)
New Revision: 392
Added:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQuery.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/Query.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/QueryException.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/QuerySortOrder.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQuery.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UnsupportedQueryConstraint.java
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQuery.java
Log:
Query API proposition
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQuery.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQuery.java
(rev 0)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/GroupQuery.java 2009-03-20
13:57:54 UTC (rev 392)
@@ -0,0 +1,77 @@
+/*
+* 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.idm.api.query;
+
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.User;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface GroupQuery extends Query
+{
+
+ GroupQuery setId(String id);
+
+ GroupQuery setNameAndType(String name, String type);
+
+ GroupQuery setName(String name);
+
+ GroupQuery setType(String type);
+
+ GroupQuery addAssociatedGroup(Group group, boolean parent);
+
+ GroupQuery addAssociatedGroup(String id, boolean parent);
+
+ GroupQuery addAssociatedGroups(Collection<Group> groups, boolean parent);
+
+ GroupQuery addAssociatedGroupsIds(Collection<String> ids, boolean parent);
+
+ GroupQuery addAssociatedUser(User user);
+
+ GroupQuery addAssociatedUser(String id);
+
+ GroupQuery addAssociatedUsers(Collection<User> users);
+
+ GroupQuery addAssociatedUsersIds(Collection<String> ids);
+
+ GroupQuery addUserConnectedByRole(User user);
+
+ GroupQuery addUserConnectedByRole(String id);
+
+ GroupQuery addUsersConnectedByRole(Collection<User> users);
+
+ GroupQuery addUsersIdsConnectedByRole(Collection<String> ids);
+
+ GroupQuery addRelatedUser(User user);
+
+ GroupQuery addRelatedUser(String id);
+
+ GroupQuery sort(QuerySortOrder order) throws UnsupportedQueryConstraint;
+
+ GroupQuery page(int firstResult, int maxResults) throws UnsupportedQueryConstraint;
+
+}
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/Query.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/Query.java
(rev 0)
+++ idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/Query.java 2009-03-20
13:57:54 UTC (rev 392)
@@ -0,0 +1,41 @@
+/*
+* 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.idm.api.query;
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface Query
+{
+
+ Collection execute() throws QueryException;
+
+ Object singleResult() throws QueryException;
+
+ List list() throws QueryException;
+
+}
Added:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/QueryException.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/QueryException.java
(rev 0)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/QueryException.java 2009-03-20
13:57:54 UTC (rev 392)
@@ -0,0 +1,50 @@
+/*
+* 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.idm.api.query;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class QueryException extends Exception
+{
+ public QueryException()
+ {
+ super();
+ }
+
+ public QueryException(String message)
+ {
+ super(message);
+ }
+
+ public QueryException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public QueryException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Added:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/QuerySortOrder.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/QuerySortOrder.java
(rev 0)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/QuerySortOrder.java 2009-03-20
13:57:54 UTC (rev 392)
@@ -0,0 +1,37 @@
+/*
+* 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.idm.api.query;/**
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public enum QuerySortOrder
+{
+
+ ASCENDING,
+
+ DESCENDING;
+
+}
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQuery.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQuery.java
(rev 0)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/RoleQuery.java 2009-03-20
13:57:54 UTC (rev 392)
@@ -0,0 +1,53 @@
+/*
+* 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.idm.api.query;
+
+import org.jboss.identity.idm.api.User;
+import org.jboss.identity.idm.api.Group;
+import org.jboss.identity.idm.api.RoleType;
+import org.jboss.identity.idm.api.IdentityType;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface RoleQuery extends Query
+{
+
+ RoleQuery setUser(User user);
+
+ RoleQuery setUser(String id);
+
+ RoleQuery setGroup(Group group);
+
+ RoleQuery setGroup(String id);
+
+ RoleQuery setRoleType(RoleType roleType);
+
+ RoleQuery setRoleType(String string);
+
+ RoleQuery setIdentityType(IdentityType identityType);
+
+ RoleQuery setIdentityTypeId(String id);
+
+}
Added:
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UnsupportedQueryConstraint.java
===================================================================
---
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UnsupportedQueryConstraint.java
(rev 0)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UnsupportedQueryConstraint.java 2009-03-20
13:57:54 UTC (rev 392)
@@ -0,0 +1,51 @@
+/*
+* 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.idm.api.query;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public class UnsupportedQueryConstraint extends QueryException
+{
+
+ public UnsupportedQueryConstraint()
+ {
+ super();
+ }
+
+ public UnsupportedQueryConstraint(String message)
+ {
+ super(message);
+ }
+
+ public UnsupportedQueryConstraint(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public UnsupportedQueryConstraint(Throwable cause)
+ {
+ super(cause);
+ }
+}
Added: idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQuery.java
===================================================================
--- idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQuery.java
(rev 0)
+++
idm/trunk/idm-api/src/main/java/org/jboss/identity/idm/api/query/UserQuery.java 2009-03-20
13:57:54 UTC (rev 392)
@@ -0,0 +1,66 @@
+/*
+* 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.idm.api.query;
+
+import org.jboss.identity.idm.api.Group;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:boleslaw.dawidowicz at redhat.com">Boleslaw
Dawidowicz</a>
+ * @version : 0.1 $
+ */
+public interface UserQuery extends Query
+{
+
+ UserQuery withUserId(String id);
+
+ UserQuery addAssociatedGroup(Group group);
+
+ UserQuery addAssociatedGroup(String id);
+
+ UserQuery addAssociatedGroups(Collection<Group> groups);
+
+ UserQuery addAssociatedGroupsIds(Collection<String> groups);
+
+ UserQuery addGroupConnectedWithRole(Group group);
+
+ UserQuery addGroupConnectedWithRole(String id);
+
+ UserQuery addGroupsConnectedWithRole(Collection<Group> groups);
+
+ UserQuery addGroupsIdsConnectedWithRole(Collection<String> groups);
+
+ UserQuery addRelatedGroup(Group group);
+
+ UserQuery addRelatedGroup(String id);
+
+ UserQuery addRelatedGroups(Collection<Group> group);
+
+ UserQuery addRelatedGroupsIds(Collection<String> ids);
+
+ UserQuery sort(QuerySortOrder order) throws UnsupportedQueryConstraint;
+
+ UserQuery page(int firstResult, int maxResults) throws UnsupportedQueryConstraint;
+
+}