mirror of
https://github.com/google/nomulus.git
synced 2025-07-24 11:38:35 +02:00
* Restore ofy keys in GracePeriod objects Restore the ofy keys when loading GracePeriod object from SQL. There's no clear way to do this using the normal approach (fix-up during a PostLoad method) because fixups to these violate immutability after hibernate has already obtained their hash values. Instead, we force reconstitution of the ofy keys in all public methods that access them (including equals() and hashCode()) so that they can be generated before an invalid hash is generated. As part of this change, convert the GracePeriod id from an autogenerated sequence to a UUID allocated from ObjectifyService and enhance ImmutableObject to allow it to exclude certain fields from hash/equals and print. The ImmutableObject enhancements are necessary because we compare grace periods against locally created test objects in a number of unit tests and there's no way this can work with GracePeriods loaded from SQL currently, as they will have an identifier field generated from the database and the test objects will have an identifier field of null (or a new unique value, after this change). Removing autogeneration from GracePeriod ids ended up being likely not strictly necessary for this change (it was a consequence of an earlier iteration). However, it does alleviate the problem of mutation of an immutable object after creation and is more in line with how we've decided to allocate other identifiers. * Changed needed after rebase. |
||
---|---|---|
.. | ||
gradle/dependency-locks | ||
src | ||
WEB-INF/appengine-generated | ||
build.gradle | ||
Dockerfile | ||
karma.conf.js |