Revision 564bd9c9

b/src/main/scala/gr/grnet/aquarium/logic/events/AquariumEvent.scala
48 48
 * @author Christos KK Loverdos <loverdos@gmail.com>
49 49
 */
50 50

  
51
abstract class AquariumEvent(val id: String, val timestamp: Long)
51
abstract class AquariumEvent(val id: String, val occurredMillis: Long)
52 52
  extends JsonSupport with XmlSupport with Loggable {
53 53

  
54 54
  def validate: Boolean
b/src/main/scala/gr/grnet/aquarium/logic/events/ResourceEvent.scala
50 50
  userId: String,
51 51
  clientId: String,
52 52
  resource: String,
53
  override val timestamp: Long,
53
  override val occurredMillis: Long,
54 54
  eventVersion: String,
55 55
  value: Float,
56 56
  var aqTimestamp: Long = 0,
57 57
  details: Map[String, String]
58
) extends AquariumEvent(id, timestamp) {
58
) extends AquariumEvent(id, occurredMillis) {
59 59

  
60 60
  def validate() : Boolean = {
61 61

  
b/src/main/scala/gr/grnet/aquarium/logic/events/UserEvent.scala
12 12
 */
13 13
case class UserEvent(
14 14
  override val id: String,
15
  override val timestamp: Long,
15
  override val occurredMillis: Long,
16 16
  var aqTimestamp: Long = 0,
17 17
  userId: String,
18 18
  eventVersion: Short,
......
21 21
  idp: String,
22 22
  tenant: String,
23 23
  roles: Array[String]
24
  ) extends AquariumEvent(id, timestamp) {
24
  ) extends AquariumEvent(id, occurredMillis) {
25 25

  
26 26
  assert(eventType == 1 || eventType == 2)
27 27
  assert(state.equalsIgnoreCase("ACTIVE") ||
b/src/main/scala/gr/grnet/aquarium/logic/events/WalletEntry.scala
6 6
/**
7 7
 *
8 8
 * @author Georgios Gousios <gousiosg@gmail.com>
9
 * @author Christos KK Loverdos <loverdos@gmail.com>
9 10
 */
10 11
case class WalletEntry(override val id: String,
11
                       override val timestamp: Long,
12
                       related: Array[String],
12
                       override val occurredMillis: Long,
13
                       sourceEventIDs: Array[String], // The events that triggered this WalletEntry
13 14
                       value: Float,
14 15
                       reason: String,
15 16
                       userId: String,
16 17
                       finalized: Boolean)
17
  extends AquariumEvent(id, timestamp) {
18
  extends AquariumEvent(id, occurredMillis) {
18 19

  
19
  assert(timestamp > 0)
20
  assert(occurredMillis > 0)
20 21
  assert(value > 0F)
21 22
  assert(!userId.isEmpty)
22 23

  
b/src/main/scala/gr/grnet/aquarium/store/mongodb/MongoDBStore.scala
184 184
  }
185 185

  
186 186
  private[this] def _sortByTimestampAsc[A <: AquariumEvent](one: A, two: A): Boolean = {
187
    if (one.timestamp > two.timestamp) false
188
    else if (one.timestamp < two.timestamp) true
187
    if (one.occurredMillis > two.occurredMillis) false
188
    else if (one.occurredMillis < two.occurredMillis) true
189 189
    else true
190 190
  }
191 191

  
192 192
  private[this] def _sortByTimestampDesc[A <: AquariumEvent](one: A, two: A): Boolean = {
193
    if (one.timestamp < two.timestamp) false
194
    else if (one.timestamp > two.timestamp) true
193
    if (one.occurredMillis < two.occurredMillis) false
194
    else if (one.occurredMillis > two.occurredMillis) true
195 195
    else true
196 196
  }
197 197

  

Also available in: Unified diff