Make timestamp a property and add an eventType method
authorChristos KK Loverdos <loverdos@gmail.com>
Tue, 29 Nov 2011 10:23:06 +0000 (12:23 +0200)
committerChristos KK Loverdos <loverdos@gmail.com>
Tue, 29 Nov 2011 10:23:32 +0000 (12:23 +0200)
logic/src/main/scala/gr/grnet/aquarium/logic/events/AquariumEvent.scala
logic/src/main/scala/gr/grnet/aquarium/logic/events/ResourceEvent.scala

index 73a8042..94959a5 100644 (file)
  * or implied, of GRNET S.A.
  */
 
-package gr.grnet.aquarium.logic.events
+package gr.grnet.aquarium
+package logic.events
+
+import util.shortClassNameOf
 
 import net.liftweb.json.{Xml, Printer, Extraction, JsonAST}
 
@@ -43,7 +46,7 @@ import net.liftweb.json.{Xml, Printer, Extraction, JsonAST}
  * @author Georgios Gousios <gousiosg@gmail.com>
  */
 
-abstract class AquariumEvent(timestamp: Long) {
+abstract class AquariumEvent(val timestamp: Long) {
 
   def validate: Boolean
 
@@ -61,4 +64,6 @@ abstract class AquariumEvent(timestamp: Long) {
   }
 
   def toXml = Xml.toXml(toJValue).toString()
+
+  def eventType: String = shortClassNameOf(this)
 }
index e5a8d59..306f853 100644 (file)
@@ -50,7 +50,7 @@ case class ResourceEvent(
   userId: Long,
   cliendId: Long,
   resource: String,
-  timestamp: Long,
+  override val timestamp: Long,
   eventVersion: Short,
   details: Map[String, String]
 ) extends AquariumEvent(timestamp) {