def exists(event: ResourceEvent): Boolean = {
Store.getEventStore match {
- case Some(x) => x.findById(event.id).isEmpty
+ case Some(x) => x.findEventById(event.id).isEmpty
case None => false
}
}
def persist(event: ResourceEvent): Boolean = {
Store.getEventStore match {
- case Some(x) => x.store(event) match {
+ case Some(x) => x.storeEvent(event) match {
case Just(x) => true
case x: Failed =>
logger.error("Could not save event: %s".format(event))
* @author Georgios Gousios <gousiosg@gmail.com>.
*/
trait EventStore {
- def store[A <: AquariumEvent](event: A): Maybe[RecordID]
+ def storeEvent[A <: AquariumEvent](event: A): Maybe[RecordID]
- def findById[A <: AquariumEvent](id: String): Option[A]
+ def findEventById[A <: AquariumEvent](id: String): Option[A]
- def findByUserId[A <: AquariumEvent](userId: String)(sortWith: Option[(A, A) => Boolean]): List[A]
+ def findEventsByUserId[A <: AquariumEvent](userId: Long)(sortWith: Option[(A, A) => Boolean]): List[A]
}
\ No newline at end of file
*/
//EventStore methods
- def store[A <: AquariumEvent](event: A): Maybe[RecordID] = {
+ def storeEvent[A <: AquariumEvent](event: A): Maybe[RecordID] = {
try {
// Store
val obj = JSON.parse(event.toJson).asInstanceOf[DBObject]
}
}
- def findById[A <: AquariumEvent](id: String): Option[A] = {
+ def findEventById[A <: AquariumEvent](id: String): Option[A] = {
val q = new BasicDBObject()
q.put("id", id)
None
}
- def findByUserId[A <: AquariumEvent](userId: String)
+ def findEventsByUserId[A <: AquariumEvent](userId: Long)
(sortWith: Option[(A, A) => Boolean]): List[A] = {
List()
}