Revision 3aa0499b src/main/scala/gr/grnet/aquarium/logic/events/WalletEntry.scala
b/src/main/scala/gr/grnet/aquarium/logic/events/WalletEntry.scala | ||
---|---|---|
6 | 6 |
* A WalletEntry is a derived entity. Its data represent money/credits and are calculated based on |
7 | 7 |
* resource events. |
8 | 8 |
* |
9 |
* Wallet entries give us a picture of when credits are calculated from resource events. |
|
10 |
* |
|
9 | 11 |
* @author Georgios Gousios <gousiosg@gmail.com> |
10 | 12 |
* @author Christos KK Loverdos <loverdos@gmail.com> |
11 | 13 |
*/ |
12 | 14 |
case class WalletEntry( |
13 | 15 |
override val id: String, // The id at the client side (the sender) TODO: Rename to remoteId or something... |
14 |
override val occurredMillis: Long, // When it occurred at client side (the sender) |
|
16 |
// When it occurred at client side (the sender). |
|
17 |
// This denotes the `occurredMillis` attribute of the oldest resource event that is referenced |
|
18 |
// by `sourceEventIDs`. The reason for this convention is pure from a query-oriented point of view. |
|
19 |
// See how things are calculated in `UserActor`. |
|
20 |
override val occurredMillis: Long, |
|
15 | 21 |
override val receivedMillis: Long, // When it was received by Aquarium |
16 | 22 |
sourceEventIDs: List[String], // The events that triggered this WalletEntry |
17 | 23 |
value: Float, |
... | ... | |
25 | 31 |
assert(!userId.isEmpty) |
26 | 32 |
|
27 | 33 |
def validate = true |
34 |
|
|
35 |
def fromResourceEvent(rceId: String): Boolean = { |
|
36 |
sourceEventIDs contains rceId |
|
37 |
} |
|
28 | 38 |
} |
29 | 39 |
|
30 | 40 |
object WalletEntry { |
Also available in: Unified diff