esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r786599 - in /incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme: actor/UserActor.scala lib/AccessPoolMgr.scala model/Privilege.scala
Date Fri, 19 Jun 2009 17:41:55 GMT
Author: dpp
Date: Fri Jun 19 17:41:55 2009
New Revision: 786599

URL: http://svn.apache.org/viewvc?rev=786599&view=rev
Log:
Some minor performance enhancements

Modified:
    incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/actor/UserActor.scala
    incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/lib/AccessPoolMgr.scala
    incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/model/Privilege.scala

Modified: incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/actor/UserActor.scala
URL: http://svn.apache.org/viewvc/incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/actor/UserActor.scala?rev=786599&r1=786598&r2=786599&view=diff
==============================================================================
--- incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/actor/UserActor.scala
(original)
+++ incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/actor/UserActor.scala
Fri Jun 19 17:41:55 2009
@@ -72,7 +72,7 @@
   
   private var _mailbox: Array[Long] = Array()
   
-  private var pools: List[Long] = List()
+  private var pools: Set[Long] = Set()
 
   private def followers: List[Long] = User.followerIdsForUserId(userId)
   
@@ -185,7 +185,7 @@
     
       case LatestMessages(cnt) => reply(_mailbox.take(cnt).toList)
       
-      case AllowPool(poolId) => pools ::= poolId
+      case AllowPool(poolId) => pools += poolId
     }
   }
 

Modified: incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/lib/AccessPoolMgr.scala
URL: http://svn.apache.org/viewvc/incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/lib/AccessPoolMgr.scala?rev=786599&r1=786598&r2=786599&view=diff
==============================================================================
--- incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/lib/AccessPoolMgr.scala
(original)
+++ incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/lib/AccessPoolMgr.scala
Fri Jun 19 17:41:55 2009
@@ -102,7 +102,7 @@
     val adminPools = ("0", "--choose pool--") ::
     (adminUser match {
       case Full(u)=> Privilege.findAdminPools(u.id).map(
-        p => (p.toString, AccessPool.find(p).get.getName))
+        p => (p.toString, AccessPool.find(p).get.getName)).toList
       case _ => Nil
     })
       

Modified: incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/model/Privilege.scala
URL: http://svn.apache.org/viewvc/incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/model/Privilege.scala?rev=786599&r1=786598&r2=786599&view=diff
==============================================================================
--- incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/model/Privilege.scala
(original)
+++ incubator/esme/branches/access-pools/server/src/main/scala/org/apache/esme/model/Privilege.scala
Fri Jun 19 17:41:55 2009
@@ -35,19 +35,20 @@
     foreach(_.delete_!)
   }
   
-  def findViewablePools(userId: Long) = Privilege.findMap(
+  def findViewablePools(userId: Long): Set[Long] =
+  Set(Privilege.findMap(
     By(Privilege.user, userId)
-  )(p => Full(p.pool.is))
+  )(p => Full(p.pool.is)) :_*)
 
-  def findWritablePools(userId: Long) = Privilege.findMap(
+  def findWritablePools(userId: Long): Set[Long] = Set(Privilege.findMap(
     By(Privilege.user, userId),
     NotBy(Privilege.permission, Permission.Read)
-  )(p => Full(p.pool.is))
+  )(p => Full(p.pool.is)) :_*)
 
-  def findAdminPools(userId: Long) = Privilege.findMap(
+  def findAdminPools(userId: Long): Set[Long] = Set(Privilege.findMap(
     By(Privilege.user, userId),
     By(Privilege.permission, Permission.Admin)
-  )(p => Full(p.pool.is))
+  )(p => Full(p.pool.is)) :_*)
 }
 
 class Privilege extends LongKeyedMapper[Privilege] {



Mime
View raw message