mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Replace command.applyTo() with inlined builder operations
These are much easier to understand. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=137446273
This commit is contained in:
parent
b84d7f1fb5
commit
1dbc5f6bb0
28 changed files with 489 additions and 426 deletions
|
@ -19,7 +19,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
import static com.google.common.collect.Iterables.getOnlyElement;
|
||||
import static com.google.common.collect.Maps.transformValues;
|
||||
import static com.google.common.collect.Sets.difference;
|
||||
import static com.google.common.collect.Sets.intersection;
|
||||
import static google.registry.model.ofy.ObjectifyService.ofy;
|
||||
import static google.registry.util.CollectionUtils.difference;
|
||||
import static google.registry.util.CollectionUtils.forceEmptyToNull;
|
||||
|
@ -37,7 +36,6 @@ import com.googlecode.objectify.Work;
|
|||
import google.registry.model.EppResource;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.eppcommon.AuthInfo;
|
||||
import google.registry.model.eppinput.ResourceCommand.AbstractSingleResourceCommand;
|
||||
import google.registry.model.eppinput.ResourceCommand.ResourceCheck;
|
||||
import google.registry.model.eppinput.ResourceCommand.ResourceCreateOrChange;
|
||||
|
@ -98,14 +96,8 @@ public class DomainCommand {
|
|||
return registrant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTo(B builder) {
|
||||
if (registrant != null) {
|
||||
builder.setRegistrant(registrant);
|
||||
}
|
||||
if (authInfo != null) {
|
||||
builder.setAuthInfo(authInfo);
|
||||
}
|
||||
public DomainAuthInfo getAuthInfo() {
|
||||
return authInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,24 +167,10 @@ public class DomainCommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AuthInfo getAuthInfo() {
|
||||
public DomainAuthInfo getAuthInfo() {
|
||||
return authInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTo(DomainBase.Builder<?, ?> builder) {
|
||||
super.applyTo(builder);
|
||||
if (fullyQualifiedDomainName != null) {
|
||||
builder.setFullyQualifiedDomainName(fullyQualifiedDomainName);
|
||||
}
|
||||
if (nameservers != null) {
|
||||
builder.setNameservers(getNameservers());
|
||||
}
|
||||
if (contacts != null) {
|
||||
builder.setContacts(getContacts());
|
||||
}
|
||||
}
|
||||
|
||||
/** Creates a copy of this {@link Create} with hard links to hosts and contacts. */
|
||||
@Override
|
||||
public Create cloneAndLinkReferences(DateTime now) throws InvalidReferencesException {
|
||||
|
@ -422,24 +400,6 @@ public class DomainCommand {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyTo(DomainBase.Builder<?, ?> builder) throws AddRemoveSameValueException {
|
||||
super.applyTo(builder);
|
||||
getInnerChange().applyTo(builder);
|
||||
AddRemove add = getInnerAdd();
|
||||
AddRemove remove = getInnerRemove();
|
||||
if (!intersection(add.getNameservers(), remove.getNameservers()).isEmpty()) {
|
||||
throw new AddRemoveSameValueException();
|
||||
}
|
||||
builder.addNameservers(add.getNameservers());
|
||||
builder.removeNameservers(remove.getNameservers());
|
||||
if (!intersection(add.getContacts(), remove.getContacts()).isEmpty()) {
|
||||
throw new AddRemoveSameValueException();
|
||||
}
|
||||
builder.addContacts(add.getContacts());
|
||||
builder.removeContacts(remove.getContacts());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a copy of this {@link Update} with hard links to hosts and contacts.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue