Add set of valid TLDs to LrpToken

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=129141577
This commit is contained in:
Chris Tingue 2016-08-02 14:27:44 -07:00 committed by Justine Tunney
parent eb76b063b3
commit d2ca1ff691

View file

@ -14,6 +14,7 @@
package google.registry.model.domain;
import static google.registry.util.CollectionUtils.nullToEmptyImmutableCopy;
import static google.registry.util.PreconditionsUtils.checkArgumentNotNull;
import com.googlecode.objectify.Key;
@ -25,6 +26,8 @@ import google.registry.model.Buildable;
import google.registry.model.reporting.HistoryEntry;
import google.registry.model.reporting.HistoryEntry.Type;
import java.util.Set;
/**
* An entity representing a token distributed to eligible LRP registrants.
*/
@ -43,6 +46,11 @@ public class LrpToken extends BackupGroupRoot implements Buildable {
@Index
String token;
/**
* A list of TLDs for which this LRP token is valid.
*/
Set<String> validTlds;
/**
* The key of the history entry for which the token was used. Given LRP is a domain application
* phase, this should always be a {@link Type#DOMAIN_APPLICATION_CREATE}.
@ -65,6 +73,10 @@ public class LrpToken extends BackupGroupRoot implements Buildable {
return redemptionHistoryEntry != null;
}
public Set<String> getValidTlds() {
return nullToEmptyImmutableCopy(validTlds);
}
@Override
public Builder asBuilder() {
return new Builder(clone(this));
@ -92,5 +104,10 @@ public class LrpToken extends BackupGroupRoot implements Buildable {
getInstance().redemptionHistoryEntry = checkArgumentNotNull(redemptionHistoryEntry);
return this;
}
public Builder setValidTlds(Set<String> validTlds) {
getInstance().validTlds = validTlds;
return this;
}
}
}