mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 16:07:15 +02:00
Add utility methods for copying time transition maps and filtering grace periods
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=130281141
This commit is contained in:
parent
19da9a1531
commit
57ec8b3ae3
2 changed files with 42 additions and 0 deletions
|
@ -217,6 +217,37 @@ public class DomainResource extends DomainBase implements ForeignKeyedEppResourc
|
|||
return ImmutableSet.copyOf(gracePeriodStatuses);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Registry Grace Period expiration date for the specified type of grace period for
|
||||
* this domain, or null if there is no grace period of the specified type.
|
||||
*/
|
||||
public Optional<DateTime> getGracePeriodExpirationTime(GracePeriodStatus gracePeriodType) {
|
||||
for (GracePeriod gracePeriod : getGracePeriods()) {
|
||||
if (gracePeriod.getType() == gracePeriodType) {
|
||||
return Optional.of(gracePeriod.getExpirationTime());
|
||||
}
|
||||
}
|
||||
return Optional.absent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks to see if the domain is in a particular type of grace period at the specified time. We
|
||||
* only check the expiration time, because grace periods are always assumed to start at the
|
||||
* beginning of time. This could be confusing if asOfDate is in the past. For instance, the Add
|
||||
* Grace Period will appear to last from the beginning of time until 5 days after the domain is
|
||||
* created.
|
||||
*/
|
||||
public boolean doesAnyGracePeriodOfTypeExpireAfter(
|
||||
GracePeriodStatus gracePeriodType, DateTime asOfDate) {
|
||||
for (GracePeriod gracePeriod : getGracePeriods()) {
|
||||
if ((gracePeriod.getType() == gracePeriodType)
|
||||
&& gracePeriod.getExpirationTime().isAfter(asOfDate)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* The logic in this method, which handles implicit server approval of transfers, very closely
|
||||
* parallels the logic in {@code DomainTransferApproveFlow} which handles explicit client
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue