The result from running an accounting process
authorGeorgios Gousios <gousiosg@gmail.com>
Wed, 21 Dec 2011 08:56:20 +0000 (10:56 +0200)
committerGeorgios Gousios <gousiosg@gmail.com>
Wed, 21 Dec 2011 09:00:12 +0000 (11:00 +0200)
logic/src/main/scala/gr/grnet/aquarium/logic/events/WalletEntry.scala [new file with mode: 0644]

diff --git a/logic/src/main/scala/gr/grnet/aquarium/logic/events/WalletEntry.scala b/logic/src/main/scala/gr/grnet/aquarium/logic/events/WalletEntry.scala
new file mode 100644 (file)
index 0000000..740badc
--- /dev/null
@@ -0,0 +1,31 @@
+package gr.grnet.aquarium.logic.events
+
+import gr.grnet.aquarium.util.json.JsonHelpers
+import net.liftweb.json._
+
+/**
+ *
+ * @author Georgios Gousios <gousiosg@gmail.com>
+ */
+case class WalletEntry(override val id: String,
+                       override val timestamp: Long,
+                       related: Array[String],
+                       value: Float,
+                       reason: String,
+                       userId: String)
+  extends AquariumEvent(id, timestamp) {
+
+  assert(timestamp > 0)
+  assert(value > 0F)
+  assert(!userId.isEmpty)
+
+  def validate = true
+}
+
+object WalletEntry {
+  def fromJson(json: String): ResourceEvent = {
+    implicit val formats = JsonHelpers.DefaultJsonFormats
+    val jsonAST = parse(json)
+    Extraction.extract[ResourceEvent](jsonAST)
+  }
+}
\ No newline at end of file