mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Add --reason flag to UpdateSmdCommand
Just an old patch that I had lying around and never mailed out. Seemed like it could be worth having checked in. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=124853504
This commit is contained in:
parent
cc01035fe8
commit
9a2b88ee28
2 changed files with 13 additions and 4 deletions
|
@ -57,6 +57,11 @@ final class UpdateSmdCommand implements RemoteApiCommand {
|
|||
required = true)
|
||||
private Path smdFile;
|
||||
|
||||
@Parameter(
|
||||
names = "--reason",
|
||||
description = "Special reason for the SMD update to record in the history entry.")
|
||||
private String reason;
|
||||
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
final EncodedSignedMark encodedSignedMark =
|
||||
|
@ -66,14 +71,15 @@ final class UpdateSmdCommand implements RemoteApiCommand {
|
|||
@Override
|
||||
public void vrun() {
|
||||
try {
|
||||
updateSmd(id, encodedSignedMark);
|
||||
updateSmd(id, encodedSignedMark, reason);
|
||||
} catch (EppException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}});
|
||||
}
|
||||
|
||||
private void updateSmd(String applicationId, EncodedSignedMark encodedSignedMark)
|
||||
private static void updateSmd(
|
||||
String applicationId, EncodedSignedMark encodedSignedMark, String reason)
|
||||
throws EppException {
|
||||
ofy().assertInTransaction();
|
||||
DateTime now = ofy().getTransactionTime();
|
||||
|
@ -105,6 +111,7 @@ final class UpdateSmdCommand implements RemoteApiCommand {
|
|||
.setModificationTime(now)
|
||||
.setClientId(domainApplication.getCurrentSponsorClientId())
|
||||
.setBySuperuser(true)
|
||||
.setReason("UpdateSmdCommand" + (reason != null ? ": " + reason : ""))
|
||||
.build();
|
||||
|
||||
// Save entities to datastore.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue