PageRenderTime 60ms CodeModel.GetById 38ms RepoModel.GetById 0ms app.codeStats 0ms

/app/models/RouteAccess.scala

https://github.com/delving/culture-hub
Scala | 33 lines | 19 code | 10 blank | 4 comment | 0 complexity | 8b4b1ab7b15093864c4cd3c1c15e3a44 MD5 | raw file
  1. package models
  2. import com.mongodb.casbah.Imports._
  3. import org.bson.types.ObjectId
  4. import com.novus.salat.dao.SalatDAO
  5. import models.HubMongoContext._
  6. import java.util.Date
  7. import scala.util.matching.Regex
  8. /**
  9. *
  10. * @author Manuel Bernhardt <bernhardt.manuel@gmail.com>
  11. */
  12. case class RouteAccess(_id: ObjectId = new ObjectId,
  13. date: Date = new Date(),
  14. uri: String,
  15. queryString: Map[String, Seq[String]])
  16. object RouteAccess extends MultiModel[RouteAccess, RouteAccessDAO] {
  17. def connectionName: String = "RouteAccess"
  18. def initIndexes(collection: MongoCollection) {}
  19. def initDAO(collection: MongoCollection, connection: MongoDB)(implicit configuration: OrganizationConfiguration) = new RouteAccessDAO(collection)
  20. }
  21. class RouteAccessDAO(collection: MongoCollection) extends SalatDAO[RouteAccess, ObjectId](collection) {
  22. def findAfterForPath(date: Date, pathPattern: Regex) = find(("date" $gt date) ++ MongoDBObject("uri" -> pathPattern.pattern))
  23. }