-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Java classes for console history objects #2350
Conversation
ec8b046
to
a84e5b9
Compare
core/src/test/java/google/registry/model/console/RegistrarPocUpdateHistoryTest.java
Fixed
Show fixed
Hide fixed
@Index(columnList = "repoId"), | ||
@Index(columnList = "revisionId") | ||
}) | ||
public class ConsoleEppActionHistory extends ConsoleUpdateHistory { |
Check failure
Code scanning / CodeQL
No clone method Error
@Index(columnList = "emailAddress"), | ||
@Index(columnList = "registrarId") | ||
}) | ||
public class RegistrarPocUpdateHistory extends ConsoleUpdateHistory { |
Check failure
Code scanning / CodeQL
No clone method Error
@Access(AccessType.FIELD) | ||
@Embeddable | ||
@MappedSuperclass | ||
public class RegistrarPocBase extends ImmutableObject implements Jsonifiable, UnsafeSerializable { |
Check failure
Code scanning / CodeQL
No clone method Error
@Access(AccessType.FIELD) | ||
@Entity | ||
@Table(indexes = {@Index(columnList = "historyActingUser"), @Index(columnList = "registrarId")}) | ||
public class RegistrarUpdateHistory extends ConsoleUpdateHistory { |
Check failure
Code scanning / CodeQL
No clone method Error
@Access(AccessType.FIELD) | ||
@Embeddable | ||
@MappedSuperclass | ||
public class RegistrarBase extends UpdateAutoTimestampEntity implements Buildable, Jsonifiable { |
Check failure
Code scanning / CodeQL
No clone method Error
@Access(AccessType.FIELD) | ||
@Embeddable | ||
@MappedSuperclass | ||
public class UserBase extends UpdateAutoTimestampEntity implements Buildable { |
Check failure
Code scanning / CodeQL
No clone method Error
@Access(AccessType.FIELD) | ||
@Entity | ||
@Table(indexes = {@Index(columnList = "historyActingUser"), @Index(columnList = "emailAddress")}) | ||
public class UserUpdateHistory extends ConsoleUpdateHistory { |
Check failure
Code scanning / CodeQL
No clone method Error
215d893
to
3b69d0c
Compare
3b69d0c
to
ee3ed11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 79 of 81 files at r1, 2 of 2 files at r2, all commit messages.
Reviewable status: all files reviewed, 15 unresolved discussions (waiting on @gbrodman)
core/src/main/java/google/registry/model/console/ConsoleUpdateHistory.java
line 61 at r2 (raw file):
/** The user that performed the modification. */ @JoinColumn(name = "historyActingUser", referencedColumnName = "emailAddress")
nullable = false?
core/src/main/java/google/registry/model/console/ConsoleUpdateHistory.java
line 78 at r2 (raw file):
/** The time at which the modification was mode. */ @Column(nullable = false, name = "historyDateTime")
It might be a bit late (because the schema change has gone in), but I think we should probably keep consistency across history objects. In EPP history resources we use historyModificationTime
I believe. I'll leave it up to you, depending on how much trouble you are willing to go through (at least there's no data in the table yet) and how soon you want to commit these changes. I actually think it is OK to change schema and the code at the same time, as long as you are not actively using the table. But our presubmits might prevent you from doing that.
core/src/main/java/google/registry/model/console/ConsoleUpdateHistory.java
line 88 at r2 (raw file):
public long getRevisionId() { // For some reason, Hibernate throws NPE during some initialization phases if we don't deal with // the null case. Setting the id to 0L when it is null should be fine because 0L for primitive
Is it still true? Or did you just copy-and-pasted this part?
core/src/main/java/google/registry/ui/server/RegistrarFormFields.java
line 93 at r2 (raw file):
.build(); public static final FormField<String, Registrar.State> STATE_FIELD =
These removals seem unrelated to the PR?
core/src/test/java/google/registry/testing/DatabaseHelper.java
line 1018 at r2 (raw file):
} /** Creates and persists an admin {@link User} with the given email address. */
if it does not already exist.
core/src/test/java/google/registry/testing/DatabaseHelper.java
line 1031 at r2 (raw file):
.build(); tm().transact(() -> tm().put(user)); return UserDao.loadUser(emailAddress).get();
Any reason to load it back from the database? Are there any (significant) fields that only get set when the entity is persisted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 15 unresolved discussions (waiting on @Github-advanced-security[bot] and @jianglai)
core/src/main/java/google/registry/model/console/ConsoleUpdateHistory.java
line 61 at r2 (raw file):
Previously, jianglai (Lai Jiang) wrote…
nullable = false?
Done.
core/src/main/java/google/registry/model/console/ConsoleUpdateHistory.java
line 78 at r2 (raw file):
Previously, jianglai (Lai Jiang) wrote…
It might be a bit late (because the schema change has gone in), but I think we should probably keep consistency across history objects. In EPP history resources we use
historyModificationTime
I believe. I'll leave it up to you, depending on how much trouble you are willing to go through (at least there's no data in the table yet) and how soon you want to commit these changes. I actually think it is OK to change schema and the code at the same time, as long as you are not actively using the table. But our presubmits might prevent you from doing that.
I think the presubmits would prevent that, though it's not like we're in a huge rush here. The name "modification time" kind of felt odd to me before, but I suppose it's referring to the time that the resource in question was modified? I would be amenable to changing it here, I think.
core/src/main/java/google/registry/model/console/ConsoleUpdateHistory.java
line 88 at r2 (raw file):
Previously, jianglai (Lai Jiang) wrote…
Is it still true? Or did you just copy-and-pasted this part?
I copied and pasted this from HistoryEntry, since this is kind of modeled on that class.
it seems like it passes the tests without it though soooooooooo yeah we can remove it here
core/src/main/java/google/registry/ui/server/RegistrarFormFields.java
line 93 at r2 (raw file):
Previously, jianglai (Lai Jiang) wrote…
These removals seem unrelated to the PR?
They're unused, and we were already updating the enums in this class anyway.
core/src/test/java/google/registry/model/console/RegistrarPocUpdateHistoryTest.java
line 39 at r1 (raw file):
Previously, github-advanced-security[bot] wrote…
Unread local variable
Variable 'ImmutableList pocs' is never read.
Done.
core/src/test/java/google/registry/testing/DatabaseHelper.java
line 1018 at r2 (raw file):
Previously, jianglai (Lai Jiang) wrote…
if it does not already exist.
Done.
core/src/test/java/google/registry/testing/DatabaseHelper.java
line 1031 at r2 (raw file):
Previously, jianglai (Lai Jiang) wrote…
Any reason to load it back from the database? Are there any (significant) fields that only get set when the entity is persisted?
the ID, unfortunately
ee3ed11
to
e9b2fc4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 3 of 3 files at r3, all commit messages.
Reviewable status: all files reviewed, 10 unresolved discussions (waiting on @gbrodman and @Github-advanced-security[bot])
core/src/test/java/google/registry/testing/DatabaseHelper.java
line 1031 at r2 (raw file):
Previously, gbrodman wrote…
the ID, unfortunately
Ah, of course...
e9b2fc4
to
0381c5b
Compare
(this will still fail because the other change has not been deployed) |
This also creates base classes for the objects contained within the history classes, e.g. RegistrarBase. This is the same way that objects stored in the HistoryEntry subclasses have base classes, e.g. DomainBase.
0381c5b
to
790cc34
Compare
@jianglai just checking, are you still good with this? It's been a while since it was in review (due to me going on vacation) so I just wanted to double-check |
Yes, go ahead. |
This also creates base classes for the objects contained within the history classes, e.g. RegistrarBase. This is the same way that objects stored in the HistoryEntry subclasses have base classes, e.g. DomainBase.
This change is