From: Christos KK Loverdos Date: Fri, 16 Mar 2012 16:02:38 +0000 (+0200) Subject: Add support for DB _id X-Git-Url: https://code.grnet.gr/git/aquarium/commitdiff_plain/e43647692c2700df1054af0a234572f394bb71a6 Add support for DB _id --- diff --git a/src/main/scala/gr/grnet/aquarium/user/UserState.scala b/src/main/scala/gr/grnet/aquarium/user/UserState.scala index b042eca..3b43fab 100644 --- a/src/main/scala/gr/grnet/aquarium/user/UserState.scala +++ b/src/main/scala/gr/grnet/aquarium/user/UserState.scala @@ -130,7 +130,11 @@ case class UserState( rolesSnapshot: RolesSnapshot, ownedResourcesSnapshot: OwnedResourcesSnapshot, calculationReason: UserStateCalculationReason = NoSpecificCalculationReason, - totalEventsProcessedCounter: Long = 0L + totalEventsProcessedCounter: Long = 0L, + // The user state we used to compute this one. Normally the (cached) + // state at the beginning of the billing period. + parentUserStateId: Option[String] = None, + _id: String = "" ) extends JsonSupport { private[this] def _allSnapshots: List[Long] = { @@ -147,6 +151,12 @@ case class UserState( def newestSnapshotTime: Long = _allSnapshots max + def idOpt: Option[String] = _id match { + case null ⇒ None + case "" ⇒ None + case _id ⇒ Some(_id) + } + // def userCreationDate = new Date(userCreationMillis) // // def userCreationFormatedDate = new MutableDateCalc(userCreationMillis).toString