Simplify logic in create/update tld commands

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=121993554
This commit is contained in:
cgoldfeder 2016-05-10 15:16:25 -07:00 committed by Justine Tunney
parent d1f34776d2
commit d62da7bb19
3 changed files with 102 additions and 95 deletions

View file

@ -17,9 +17,11 @@ package google.registry.tools;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkState;
import static google.registry.model.registry.Registries.getTlds;
import static google.registry.util.CollectionUtils.nullToEmpty;
import static google.registry.util.DateTimeUtils.START_OF_TIME;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSortedMap;
import com.beust.jcommander.Parameter;
@ -81,4 +83,19 @@ class CreateTldCommand extends CreateOrUpdateTldCommand {
checkState(!getTlds().contains(tld), "TLD already exists");
return null;
}
@Override
ImmutableSet<String> getAllowedRegistrants(Registry oldRegistry) {
return ImmutableSet.copyOf(nullToEmpty(allowedRegistrants));
}
@Override
ImmutableSet<String> getAllowedNameservers(Registry oldRegistry) {
return ImmutableSet.copyOf(nullToEmpty(allowedNameservers));
}
@Override
ImmutableSet<String> getReservedLists(Registry oldRegistry) {
return ImmutableSet.copyOf(nullToEmpty(reservedListNames));
}
}