Yay, awesome! :-)
On 16 August 2010 01:06, <[email protected]> wrote: > Author: esjewett > Date: Sun Aug 15 23:06:48 2010 > New Revision: 985773 > > URL: http://svn.apache.org/viewvc?rev=985773&view=rev > Log: > Backend infrastructure for conversation following. > > Added: > > > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/actor/ConvDistributor.scala > > > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/UserConvFollow.scala > Modified: > > > incubator/esme/branches/tagandconversationfollow/src/main/scala/bootstrap/liftweb/Boot.scala > > > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/actor/Distributor.scala > > > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/Mailbox.scala > > > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/Message.scala > > > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/MessageTag.scala > > > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/User.scala > > > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/UserTagFollow.scala > > > incubator/esme/branches/tagandconversationfollow/src/main/webapp/info_view/conversation.html > > Modified: > incubator/esme/branches/tagandconversationfollow/src/main/scala/bootstrap/liftweb/Boot.scala > URL: > http://svn.apache.org/viewvc/incubator/esme/branches/tagandconversationfollow/src/main/scala/bootstrap/liftweb/Boot.scala?rev=985773&r1=985772&r2=985773&view=diff > > ============================================================================== > --- > incubator/esme/branches/tagandconversationfollow/src/main/scala/bootstrap/liftweb/Boot.scala > (original) > +++ > incubator/esme/branches/tagandconversationfollow/src/main/scala/bootstrap/liftweb/Boot.scala > Sun Aug 15 23:06:48 2010 > @@ -83,7 +83,7 @@ class Boot { > > if (Props.mode == Props.RunModes.Test) { > Schemifier.destroyTables_!!(Log.infoF _, User, ExtSession, > - Message, Mailbox, Tag, UserTagFollow, > + Message, Mailbox, Tag, UserTagFollow, UserConvFollow, > Relationship, MessageTag, > AuthToken, UrlStore, Tracking, > Action, AccessPool, > @@ -91,7 +91,7 @@ class Boot { > } > > Schemifier.schemify(true, Log.infoF _, User, ExtSession, Message, > - Mailbox, Tag, UserTagFollow, > + Mailbox, Tag, UserTagFollow, UserConvFollow, > Relationship, MessageTag, AuthToken, > UrlStore, Tracking, Action, > AccessPool, Privilege, UserAuth, UserCryptoSig) > @@ -225,7 +225,8 @@ class Boot { > Distributor.touch > SchedulerActor.touch > MessagePullActor.touch > - TagDistributor.touch > + TagDistributor.touch > + ConvDistributor.touch > // ScalaInterpreter.touch > > > > Added: > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/actor/ConvDistributor.scala > URL: > http://svn.apache.org/viewvc/incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/actor/ConvDistributor.scala?rev=985773&view=auto > > ============================================================================== > --- > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/actor/ConvDistributor.scala > (added) > +++ > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/actor/ConvDistributor.scala > Sun Aug 15 23:06:48 2010 > @@ -0,0 +1,44 @@ > +/** > + * Licensed to the Apache Software Foundation (ASF) under one > + * or more contributor license agreements. See the NOTICE file > + * distributed with this work for additional information > + * regarding copyright ownership. The ASF licenses this file > + * to you under the Apache License, Version 2.0 (the > + * "License"); you may not use this file except in compliance > + * with the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, > + * software distributed under the License is distributed on an > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > + * KIND, either express or implied. See the License for the > + * specific language governing permissions and limitations > + * under the License. > + */ > + > +package org.apache.esme.actor > + > +import net.liftweb._ > +import actor._ > + > +import org.apache.esme._ > +import model.{Message, User, ConvFollowReason} > + > +object ConvDistributor extends LiftActor { > + > + protected def messageHandler = { > + case Distributor.NewMessage(msg) => { > + Message.findMessages(List(msg.conversation)).values.map( m => { > + m.followers.refresh.map( u => { > + Distributor ! Distributor.AddMessageToMailbox(u.id, msg, > ConvFollowReason(m.id)); > + }) > + }) > + } > + } > + > + def touch { > + > + } > + > +} > \ No newline at end of file > > Modified: > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/actor/Distributor.scala > URL: > http://svn.apache.org/viewvc/incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/actor/Distributor.scala?rev=985773&r1=985772&r2=985773&view=diff > > ============================================================================== > --- > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/actor/Distributor.scala > (original) > +++ > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/actor/Distributor.scala > Sun Aug 15 23:06:48 2010 > @@ -75,7 +75,8 @@ object Distributor extends LiftActor { > case nm @ NewMessage(msg) => > val toSend = UserActor.TestForTracking(msg) > users.values.foreach(_ ! toSend) > - TagDistributor ! nm > + TagDistributor ! nm > + ConvDistributor ! nm > listeners.foreach(_ ! nm) > > case UpdateTrackingFor(userId, ttype) => > > Modified: > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/Mailbox.scala > URL: > http://svn.apache.org/viewvc/incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/Mailbox.scala?rev=985773&r1=985772&r2=985773&view=diff > > ============================================================================== > --- > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/Mailbox.scala > (original) > +++ > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/Mailbox.scala > Sun Aug 15 23:06:48 2010 > @@ -105,6 +105,9 @@ case class ConversationReason(conversati > } > case class TagFollowReason(tagName: String) extends MailboxReason { > def attr = new UnprefixedAttribute("tag", tagName, Null) > +} > +case class ConvFollowReason(convId: Long) extends MailboxReason { > + def attr = new UnprefixedAttribute("conversation", convId, Null) > } > case class LoginReason(userId: Long) extends MailboxReason { > def attr = new UnprefixedAttribute("login", userId.toString, Null) > > Modified: > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/Message.scala > URL: > http://svn.apache.org/viewvc/incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/Message.scala?rev=985773&r1=985772&r2=985773&view=diff > > ============================================================================== > --- > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/Message.scala > (original) > +++ > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/Message.scala > Sun Aug 15 23:06:48 2010 > @@ -278,7 +278,7 @@ object Message extends Message with Long > > > @Searchable > -class Message extends LongKeyedMapper[Message] { > +class Message extends LongKeyedMapper[Message] with ManyToMany { > import Message._ > > def getSingleton = Message // what's the "meta" server > @@ -322,7 +322,9 @@ class Message extends LongKeyedMapper[Me > > object replyTo extends MappedLongForeignKey(this, Message) > > - object conversation extends MappedLongForeignKey(this, Message) > + object conversation extends MappedLongForeignKey(this, Message) > + > + object followers extends MappedManyToMany(UserConvFollow, > UserConvFollow.conversation, UserConvFollow.user, User) > > object pool extends MappedLongForeignKey(this, AccessPool) { > override def asJs = > > Modified: > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/MessageTag.scala > URL: > http://svn.apache.org/viewvc/incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/MessageTag.scala?rev=985773&r1=985772&r2=985773&view=diff > > ============================================================================== > --- > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/MessageTag.scala > (original) > +++ > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/MessageTag.scala > Sun Aug 15 23:06:48 2010 > @@ -36,7 +36,7 @@ class MessageTag extends LongKeyedMapper > object id extends MappedLongIndex(this) > > object message extends MappedLongForeignKey(this, Message) > - object tag extends MappedLongForeignKey(this, Tag) // MappedText(this) > + object tag extends MappedLongForeignKey(this, Tag) > object sentTo extends MappedLongForeignKey(this, User) > object url extends MappedLongForeignKey(this, UrlStore) > } > > Modified: > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/User.scala > URL: > http://svn.apache.org/viewvc/incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/User.scala?rev=985773&r1=985772&r2=985773&view=diff > > ============================================================================== > --- > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/User.scala > (original) > +++ > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/User.scala > Sun Aug 15 23:06:48 2010 > @@ -403,4 +403,6 @@ class User extends KeyedMapper[Long, Use > def localeDisplayName = S.?("base_user_ui_locale") > > object tagsfollowing extends MappedManyToMany(UserTagFollow, > UserTagFollow.user, UserTagFollow.tag, Tag) > + > + object convsfollowing extends MappedManyToMany(UserConvFollow, > UserConvFollow.user, UserConvFollow.conversation, Message) > } > > Added: > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/UserConvFollow.scala > URL: > http://svn.apache.org/viewvc/incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/UserConvFollow.scala?rev=985773&view=auto > > ============================================================================== > --- > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/UserConvFollow.scala > (added) > +++ > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/UserConvFollow.scala > Sun Aug 15 23:06:48 2010 > @@ -0,0 +1,32 @@ > +package org.apache.esme.model > + > +/** > + * Licensed to the Apache Software Foundation (ASF) under one > + * or more contributor license agreements. See the NOTICE file > + * distributed with this work for additional information > + * regarding copyright ownership. The ASF licenses this file > + * to you under the Apache License, Version 2.0 (the > + * "License"); you may not use this file except in compliance > + * with the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, > + * software distributed under the License is distributed on an > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY > + * KIND, either express or implied. See the License for the > + * specific language governing permissions and limitations > + * under the License. > + */ > + > +import net.liftweb._ > +import mapper._ > + > +object UserConvFollow extends UserConvFollow with > LongKeyedMetaMapper[UserConvFollow] > + > +class UserConvFollow extends LongKeyedMapper[UserConvFollow] with IdPK { > + def getSingleton = UserConvFollow > + > + object user extends LongMappedMapper(this, User) > + object conversation extends LongMappedMapper(this, Message) > +} > \ No newline at end of file > > Modified: > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/UserTagFollow.scala > URL: > http://svn.apache.org/viewvc/incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/UserTagFollow.scala?rev=985773&r1=985772&r2=985773&view=diff > > ============================================================================== > --- > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/UserTagFollow.scala > (original) > +++ > incubator/esme/branches/tagandconversationfollow/src/main/scala/org/apache/esme/model/UserTagFollow.scala > Sun Aug 15 23:06:48 2010 > @@ -19,13 +19,8 @@ package org.apache.esme.model > * under the License. > */ > > -import net.liftweb._ > -//import http._ > -import mapper._ > -//import util._ > -//import actor._ > -//import common._ > -//import Helpers._ > +import net.liftweb._ > +import mapper._ > > object UserTagFollow extends UserTagFollow with > LongKeyedMetaMapper[UserTagFollow] > > > Modified: > incubator/esme/branches/tagandconversationfollow/src/main/webapp/info_view/conversation.html > URL: > http://svn.apache.org/viewvc/incubator/esme/branches/tagandconversationfollow/src/main/webapp/info_view/conversation.html?rev=985773&r1=985772&r2=985773&view=diff > > ============================================================================== > --- > incubator/esme/branches/tagandconversationfollow/src/main/webapp/info_view/conversation.html > (original) > +++ > incubator/esme/branches/tagandconversationfollow/src/main/webapp/info_view/conversation.html > Sun Aug 15 23:06:48 2010 > @@ -26,7 +26,8 @@ > > <div id="back-header"> > <h1><lift:loc>ui_default_conversation</lift:loc></h1> > - <div class="container-aux"> > + <div class="container-aux"> > + <span id="following"><conv:followButton/></span> > <div> > <lift:displayConversation/> > <lift:embed what="templates-hidden/message_core"/> > > >
