Package google.registry.flows
Class ResourceFlowUtils
java.lang.Object
google.registry.flows.ResourceFlowUtils
Static utility functions for resource flows.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Cannot add and remove the same value.static class
Authorization information for accessing resource is invalid.static class
Resource with this id does not exist.static class
The specified resource belongs to another client.static class
The specified status value cannot be set by clients. -
Method Summary
Modifier and TypeMethodDescriptionstatic <R extends EppResource>
voidcheckLinkedDomains
(String targetId, org.joda.time.DateTime now, Class<R> resourceClass) Check whether if there are domains linked to the resource to be deleted.static void
checkSameValuesNotAddedAndRemoved
(com.google.common.collect.ImmutableSet<?> fieldsToAdd, com.google.common.collect.ImmutableSet<?> fieldsToRemove) Check that the same values aren't being added and removed in an update command.static org.joda.time.DateTime
computeExDateForApprovalTime
(DomainBase domain, org.joda.time.DateTime approvalTime, Period period) Computes the exDate for the domain at the given transfer approval time with an adjusted amount of transfer period years if the domain is in the auto renew grace period at the time of approval.static <R extends EppResource & EppResource.ForeignKeyedEppResource>
RloadAndVerifyExistence
(Class<R> clazz, String targetId, org.joda.time.DateTime now) static void
verifyAllStatusesAreClientSettable
(Set<StatusValue> statusValues) Check that allStatusValue
objects in a set are client-settable.static void
verifyAuthInfo
(AuthInfo authInfo, Contact contact) Check that the givenAuthInfo
is valid for the given contact.static void
verifyAuthInfo
(AuthInfo authInfo, Domain domain) Check that the givenAuthInfo
is valid for the given domain.static void
Check that the given AuthInfo is present for a resource being transferred.static <R extends EppResource>
RverifyExistence
(Class<R> clazz, String targetId, Optional<R> resource) static <R extends EppResource & EppResource.ResourceWithTransferData>
voidverifyHasPendingTransfer
(R resource) static void
verifyNoDisallowedStatuses
(EppResource resource, com.google.common.collect.ImmutableSet<StatusValue> disallowedStatuses) Check that the resource does not have any disallowed status values.static void
verifyOptionalAuthInfo
(Optional<AuthInfo> authInfo, Contact contact) Check that the given AuthInfo is either missing or else is valid for the given resource.static void
verifyOptionalAuthInfo
(Optional<AuthInfo> authInfo, Domain domain) Check that the given AuthInfo is either missing or else is valid for the given resource.static <R extends EppResource>
voidverifyResourceDoesNotExist
(Class<R> clazz, String targetId, org.joda.time.DateTime now, String registrarId) static void
verifyResourceOwnership
(String myRegistrarId, EppResource resource) Check that the given registrarId corresponds to the owner of given resource.static void
verifyTargetIdCount
(List<String> targetIds, int maxChecks) Get the list of target ids from a check command.static <R extends EppResource & EppResource.ResourceWithTransferData>
voidverifyTransferInitiator
(String registrarId, R resource)
-
Method Details
-
verifyResourceOwnership
public static void verifyResourceOwnership(String myRegistrarId, EppResource resource) throws EppException Check that the given registrarId corresponds to the owner of given resource.- Throws:
EppException
-
checkLinkedDomains
public static <R extends EppResource> void checkLinkedDomains(String targetId, org.joda.time.DateTime now, Class<R> resourceClass) throws EppException Check whether if there are domains linked to the resource to be deleted. Throws an exception if so.- Throws:
EppException
-
verifyHasPendingTransfer
public static <R extends EppResource & EppResource.ResourceWithTransferData> void verifyHasPendingTransfer(R resource) throws NotPendingTransferException - Throws:
NotPendingTransferException
-
verifyTransferInitiator
public static <R extends EppResource & EppResource.ResourceWithTransferData> void verifyTransferInitiator(String registrarId, R resource) throws NotTransferInitiatorException - Throws:
NotTransferInitiatorException
-
loadAndVerifyExistence
public static <R extends EppResource & EppResource.ForeignKeyedEppResource> R loadAndVerifyExistence(Class<R> clazz, String targetId, org.joda.time.DateTime now) throws ResourceFlowUtils.ResourceDoesNotExistException -
verifyExistence
public static <R extends EppResource> R verifyExistence(Class<R> clazz, String targetId, Optional<R> resource) throws ResourceFlowUtils.ResourceDoesNotExistException -
verifyResourceDoesNotExist
public static <R extends EppResource> void verifyResourceDoesNotExist(Class<R> clazz, String targetId, org.joda.time.DateTime now, String registrarId) throws EppException - Throws:
EppException
-
verifyAuthInfoPresentForResourceTransfer
public static void verifyAuthInfoPresentForResourceTransfer(Optional<AuthInfo> authInfo) throws EppException Check that the given AuthInfo is present for a resource being transferred.- Throws:
EppException
-
verifyOptionalAuthInfo
public static void verifyOptionalAuthInfo(Optional<AuthInfo> authInfo, Contact contact) throws EppException Check that the given AuthInfo is either missing or else is valid for the given resource.- Throws:
EppException
-
verifyOptionalAuthInfo
public static void verifyOptionalAuthInfo(Optional<AuthInfo> authInfo, Domain domain) throws EppException Check that the given AuthInfo is either missing or else is valid for the given resource.- Throws:
EppException
-
verifyAuthInfo
Check that the givenAuthInfo
is valid for the given domain.- Throws:
EppException
-
verifyAuthInfo
Check that the givenAuthInfo
is valid for the given contact.- Throws:
EppException
-
verifyNoDisallowedStatuses
public static void verifyNoDisallowedStatuses(EppResource resource, com.google.common.collect.ImmutableSet<StatusValue> disallowedStatuses) throws EppException Check that the resource does not have any disallowed status values.- Throws:
EppException
-
verifyTargetIdCount
public static void verifyTargetIdCount(List<String> targetIds, int maxChecks) throws TooManyResourceChecksException Get the list of target ids from a check command.- Throws:
TooManyResourceChecksException
-
checkSameValuesNotAddedAndRemoved
public static void checkSameValuesNotAddedAndRemoved(com.google.common.collect.ImmutableSet<?> fieldsToAdd, com.google.common.collect.ImmutableSet<?> fieldsToRemove) throws ResourceFlowUtils.AddRemoveSameValueException Check that the same values aren't being added and removed in an update command. -
verifyAllStatusesAreClientSettable
public static void verifyAllStatusesAreClientSettable(Set<StatusValue> statusValues) throws ResourceFlowUtils.StatusNotClientSettableException Check that allStatusValue
objects in a set are client-settable. -
computeExDateForApprovalTime
public static org.joda.time.DateTime computeExDateForApprovalTime(DomainBase domain, org.joda.time.DateTime approvalTime, Period period) Computes the exDate for the domain at the given transfer approval time with an adjusted amount of transfer period years if the domain is in the auto renew grace period at the time of approval.- Parameters:
domain
- is the domain already projected at approvalTime
-