Add stageEntityChange() method to display difference when creating a reserved list (#1149)

* Add stageEntityChange() method to display difference before execution when creating a reserved list
This commit is contained in:
Rachel Guan
2021-05-12 17:32:57 -04:00
committed by GitHub
parent 484e30cd80
commit 85bac9834f
2 changed files with 33 additions and 0 deletions
@@ -25,7 +25,9 @@ import com.beust.jcommander.Parameters;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.googlecode.objectify.Key;
import google.registry.model.registry.label.ReservedList;
import google.registry.persistence.VKey;
import java.nio.file.Files;
import java.util.List;
import org.joda.time.DateTime;
@@ -63,6 +65,12 @@ final class CreateReservedListCommand extends CreateOrUpdateReservedListCommand
.setCreationTime(now)
.setLastUpdateTime(now)
.build();
// calls the stageEntityChange method that takes old entity, new entity and a new vkey;
// Because ReservedList is a sqlEntity and its primary key field (revisionId) is only set when
// it's being persisted; a vkey has to be created here explicitly for ReservedList instances.
stageEntityChange(
null, reservedList, VKey.createOfy(ReservedList.class, Key.create(reservedList)));
}
private static void validateListName(String name) {