mirror of
https://github.com/google/nomulus.git
synced 2025-04-30 12:07:51 +02:00
Swap id and indexed field in LrpToken
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=130014294
This commit is contained in:
parent
159528fb6f
commit
2e88129c43
3 changed files with 30 additions and 26 deletions
|
@ -25,7 +25,6 @@ import google.registry.model.BackupGroupRoot;
|
|||
import google.registry.model.Buildable;
|
||||
import google.registry.model.reporting.HistoryEntry;
|
||||
import google.registry.model.reporting.HistoryEntry.Type;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
|
@ -34,18 +33,19 @@ import java.util.Set;
|
|||
@Entity
|
||||
public class LrpToken extends BackupGroupRoot implements Buildable {
|
||||
|
||||
/**
|
||||
* The token's assignee (a unique identifier).
|
||||
*/
|
||||
@Id
|
||||
String assignee;
|
||||
|
||||
/**
|
||||
* The secret token assigned to a registrant for the purposes of LRP registration.
|
||||
*/
|
||||
@Index
|
||||
@Id
|
||||
String token;
|
||||
|
||||
/**
|
||||
* The token's assignee (additional metadata for identifying the owner of the token, which may
|
||||
* vary from TLD to TLD).
|
||||
*/
|
||||
@Index
|
||||
String assignee;
|
||||
|
||||
/**
|
||||
* A list of TLDs for which this LRP token is valid.
|
||||
*/
|
||||
|
@ -89,7 +89,7 @@ public class LrpToken extends BackupGroupRoot implements Buildable {
|
|||
private Builder(LrpToken instance) {
|
||||
super(instance);
|
||||
}
|
||||
|
||||
|
||||
public Builder setAssignee(String assignee) {
|
||||
getInstance().assignee = assignee;
|
||||
return this;
|
||||
|
|
|
@ -19,6 +19,7 @@ import static google.registry.model.ofy.ObjectifyService.ofy;
|
|||
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.domain.LrpToken;
|
||||
import google.registry.tools.Command.GtechCommand;
|
||||
|
@ -51,22 +52,25 @@ public final class GetLrpTokenCommand implements RemoteApiCommand, GtechCommand
|
|||
checkArgument(
|
||||
(tokenString == null) == (assignee != null),
|
||||
"Exactly one of either token or assignee must be specified.");
|
||||
LrpToken token = null;
|
||||
if (assignee != null) {
|
||||
token = ofy().load().key(Key.create(LrpToken.class, assignee)).now();
|
||||
} else if (tokenString != null) {
|
||||
token = ofy().load()
|
||||
.type(LrpToken.class)
|
||||
.filter("token", tokenString)
|
||||
.first()
|
||||
.now();
|
||||
}
|
||||
if (token != null) {
|
||||
System.out.println(token);
|
||||
if (includeHistory && token.getRedemptionHistoryEntry() != null) {
|
||||
System.out.println(
|
||||
ofy().load().key(token.getRedemptionHistoryEntry()).now().toHydratedString());
|
||||
ImmutableSet.Builder<LrpToken> tokensBuilder = ImmutableSet.builder();
|
||||
if (tokenString != null) {
|
||||
LrpToken token = ofy().load().key(Key.create(LrpToken.class, tokenString)).now();
|
||||
if (token != null) {
|
||||
tokensBuilder.add(token);
|
||||
}
|
||||
} else {
|
||||
tokensBuilder.addAll(ofy().load().type(LrpToken.class).filter("assignee", assignee));
|
||||
}
|
||||
|
||||
ImmutableSet<LrpToken> tokens = tokensBuilder.build();
|
||||
if (!tokens.isEmpty()) {
|
||||
for (LrpToken token : tokens) {
|
||||
System.out.println(token);
|
||||
if (includeHistory && token.getRedemptionHistoryEntry() != null) {
|
||||
System.out.println(
|
||||
ofy().load().key(token.getRedemptionHistoryEntry()).now().toHydratedString());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("Token not found.");
|
||||
}
|
||||
|
|
|
@ -285,10 +285,10 @@ class google.registry.model.domain.GracePeriod {
|
|||
org.joda.time.DateTime expirationTime;
|
||||
}
|
||||
class google.registry.model.domain.LrpToken {
|
||||
@Id java.lang.String assignee;
|
||||
@Id java.lang.String token;
|
||||
com.googlecode.objectify.Key<google.registry.model.reporting.HistoryEntry> redemptionHistoryEntry;
|
||||
google.registry.model.UpdateAutoTimestamp updateTimestamp;
|
||||
java.lang.String token;
|
||||
java.lang.String assignee;
|
||||
java.util.Set<java.lang.String> validTlds;
|
||||
}
|
||||
class google.registry.model.domain.Period {
|
||||
|
|
Loading…
Add table
Reference in a new issue