mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Scope down TransferData to only ContactResource and DomainResource
HostResource and DomainApplication are not transferable, (or at least, not directly in the case of hosts) and have no need for the TransferData field. In a flat-flow world, we can push it down to where it's actually used. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=139201423
This commit is contained in:
parent
0234795240
commit
84009eaccb
24 changed files with 309 additions and 240 deletions
|
@ -12,7 +12,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package google.registry.model.domain;
|
||||
package google.registry.model.domain;
|
||||
|
||||
import static com.google.common.collect.Sets.intersection;
|
||||
import static google.registry.model.EppResourceUtils.projectResourceOntoBuilderAtTime;
|
||||
|
@ -33,6 +33,7 @@ import com.googlecode.objectify.annotation.EntitySubclass;
|
|||
import com.googlecode.objectify.annotation.IgnoreSave;
|
||||
import com.googlecode.objectify.condition.IfNull;
|
||||
import google.registry.model.EppResource.ForeignKeyedEppResource;
|
||||
import google.registry.model.EppResource.ResourceWithTransferData;
|
||||
import google.registry.model.annotations.ExternalMessagingName;
|
||||
import google.registry.model.billing.BillingEvent;
|
||||
import google.registry.model.domain.rgp.GracePeriodStatus;
|
||||
|
@ -75,7 +76,8 @@ import org.joda.time.Interval;
|
|||
@Cache(expirationSeconds = RECOMMENDED_MEMCACHE_EXPIRATION)
|
||||
@EntitySubclass(index = true)
|
||||
@ExternalMessagingName("domain")
|
||||
public class DomainResource extends DomainBase implements ForeignKeyedEppResource {
|
||||
public class DomainResource extends DomainBase
|
||||
implements ForeignKeyedEppResource, ResourceWithTransferData {
|
||||
|
||||
/** The max number of years that a domain can be registered for, as set by ICANN policy. */
|
||||
public static final int MAX_REGISTRATION_YEARS = 10;
|
||||
|
@ -156,6 +158,10 @@ public class DomainResource extends DomainBase implements ForeignKeyedEppResourc
|
|||
@XmlTransient
|
||||
Key<DomainApplication> application;
|
||||
|
||||
/** Data about any pending or past transfers on this domain. */
|
||||
@XmlTransient
|
||||
TransferData transferData;
|
||||
|
||||
public ImmutableSet<String> getSubordinateHosts() {
|
||||
return nullToEmptyImmutableCopy(subordinateHosts);
|
||||
}
|
||||
|
@ -192,6 +198,11 @@ public class DomainResource extends DomainBase implements ForeignKeyedEppResourc
|
|||
return application;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final TransferData getTransferData() {
|
||||
return Optional.fromNullable(transferData).or(TransferData.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getForeignKey() {
|
||||
return fullyQualifiedDomainName;
|
||||
|
@ -356,7 +367,8 @@ public class DomainResource extends DomainBase implements ForeignKeyedEppResourc
|
|||
}
|
||||
|
||||
/** A builder for constructing {@link DomainResource}, since it is immutable. */
|
||||
public static class Builder extends DomainBase.Builder<DomainResource, Builder> {
|
||||
public static class Builder extends DomainBase.Builder<DomainResource, Builder>
|
||||
implements BuilderWithTransferData<Builder> {
|
||||
|
||||
public Builder() {}
|
||||
|
||||
|
@ -366,6 +378,10 @@ public class DomainResource extends DomainBase implements ForeignKeyedEppResourc
|
|||
|
||||
@Override
|
||||
public DomainResource build() {
|
||||
// If TransferData is totally empty, set it to null.
|
||||
if (TransferData.EMPTY.equals(getInstance().transferData)) {
|
||||
setTransferData(null);
|
||||
}
|
||||
// A DomainResource has status INACTIVE if there are no nameservers.
|
||||
if (getInstance().getNameservers().isEmpty()) {
|
||||
addStatusValue(StatusValue.INACTIVE);
|
||||
|
@ -440,5 +456,11 @@ public class DomainResource extends DomainBase implements ForeignKeyedEppResourc
|
|||
getInstance().gracePeriods = difference(getInstance().getGracePeriods(), gracePeriod);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder setTransferData(TransferData transferData) {
|
||||
getInstance().transferData = transferData;
|
||||
return thisCastToDerived();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue