Add 'created on' field to groups

Contrary to accounts, groups currently have no indication on when
they were created. From now on, the instant a group is added will
be remembered. For existing groups, only a best guess is possible by
deriving the creation time from the first time this group was recorded
in the audit. As that is not possible for groups which were created
before the audit was introduced, those groups get the moment the audit
was available as creation time.

Change-Id: Ic5b3cb8ec6373ad804535b73cbbf85675ab3ec6f
This commit is contained in:
Alice Kober-Sotzek
2017-05-31 15:41:52 +02:00
parent afbb4187f5
commit 57a41bc931
9 changed files with 277 additions and 8 deletions

View File

@@ -17,6 +17,7 @@ package com.google.gerrit.reviewdb.client;
import com.google.gwtorm.client.Column;
import com.google.gwtorm.client.IntKey;
import com.google.gwtorm.client.StringKey;
import java.sql.Timestamp;
/** Named group of one or more accounts, typically used for access controls. */
public final class AccountGroup {
@@ -145,17 +146,22 @@ public final class AccountGroup {
@Column(id = 10)
protected UUID ownerGroupUUID;
@Column(id = 11)
protected Timestamp createdOn;
protected AccountGroup() {}
public AccountGroup(
final AccountGroup.NameKey newName,
final AccountGroup.Id newId,
final AccountGroup.UUID uuid) {
AccountGroup.NameKey newName,
AccountGroup.Id newId,
AccountGroup.UUID uuid,
Timestamp createdOn) {
name = newName;
groupId = newId;
visibleToAll = false;
groupUUID = uuid;
ownerGroupUUID = groupUUID;
this.createdOn = createdOn;
}
public AccountGroup.Id getId() {
@@ -205,4 +211,12 @@ public final class AccountGroup {
public void setGroupUUID(AccountGroup.UUID uuid) {
groupUUID = uuid;
}
public Timestamp getCreatedOn() {
return createdOn;
}
public void setCreatedOn(Timestamp createdOn) {
this.createdOn = createdOn;
}
}