Scarab commit: svn commit: r10988 - trunk/src/java/org/tigris/scarab/om/QueryPeer.java

[email protected] Fri, 16 Apr 2010 10:11:05 -0700 (PDT)
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: dabbous
Date: 2010-04-16 10:11:05-0700
New Revision: 10988

Modified:
   trunk/src/java/org/tigris/scarab/om/QueryPeer.java

Log:
SCB3036: There was a logical error in the last fix. Now the behaviour is as follows:

if a user has got a PRIVATE Query set as home page for this module, it is taken.
otherwise if there is a GLOBAL Query defined by any user (administrator) for this module, it is taken.

This is no good solution. Everybody should be able to select any query as his/her start page.
And if no query has been defeined by a user, he/she shall see a default start page as customized by an admin.
Probably this needs another field in the Query table which marks a query as the public default query. (to be checked)

Modified: trunk/src/java/org/tigris/scarab/om/QueryPeer.java
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/java/org/tigris/scarab/om/QueryPeer.java?view=diff&pathrev=10988&r1=10987&r2=10988
==============================================================================
--- trunk/src/java/org/tigris/scarab/om/QueryPeer.java	(original)
+++ trunk/src/java/org/tigris/scarab/om/QueryPeer.java	2010-04-16 10:11:05-0700
@@ -444,11 +444,14 @@
             {
                 Query candidate = iter.next();
                 Integer candidateId = candidate.getUserId();
-                if(candidateId.equals(userId) || candidateId.equals(moduleOwnerId))
+                String scopeId      = candidate.getScopeId().toString();
+                boolean isPrivateUserQuery = candidateId.equals(userId) && scopeId.equals(QueryPeer.TYPE_PRIVATE);
+                boolean isGlobalQuery      = scopeId.equals(QueryPeer.TYPE_GLOBAL);
+                if( isPrivateUserQuery || isGlobalQuery )
                 {
                     result = candidate; // We found a customized query.
                 }
-                if(candidateId.equals(userId))
+                if(isPrivateUserQuery)
                 {
                     break; // It is the user's custom query. Take that and be happy.
                 }

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=2585535