mirror of
https://github.com/google/nomulus.git
synced 2025-05-13 07:57:13 +02:00
Create *InfoData objects instead of reusing *Resource objects
This is probably best from a code-cleanliness perspective anyways, but the rationale is that tightly coupling the resources to the info responses was a straightjacket that required all status values and fields to be directly available on the resource. With this change, I already was able to get rid of the preMarshal() hackery, and I will be able to get rid of cloneWithLinkedStatus() and most of the contents of cloneProjectedAtTime() for non-domains. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=144252924
This commit is contained in:
parent
96a71ded91
commit
b0bcc1bb3d
22 changed files with 586 additions and 230 deletions
|
@ -25,6 +25,7 @@ import google.registry.flows.Flow;
|
|||
import google.registry.flows.FlowModule.ClientId;
|
||||
import google.registry.flows.FlowModule.TargetId;
|
||||
import google.registry.model.eppoutput.EppResponse;
|
||||
import google.registry.model.host.HostInfoData;
|
||||
import google.registry.model.host.HostResource;
|
||||
import google.registry.util.Clock;
|
||||
import javax.inject.Inject;
|
||||
|
@ -53,10 +54,24 @@ public final class HostInfoFlow implements Flow {
|
|||
@Override
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateClientIsLoggedIn(clientId);
|
||||
validateHostName(targetId);
|
||||
DateTime now = clock.nowUtc();
|
||||
HostResource host = loadAndVerifyExistence(HostResource.class, targetId, now);
|
||||
return responseBuilder.setResData(cloneResourceWithLinkedStatus(host, now)).build();
|
||||
host = (HostResource) cloneResourceWithLinkedStatus(host, now);
|
||||
return responseBuilder
|
||||
.setResData(HostInfoData.newBuilder()
|
||||
.setFullyQualifiedHostName(host.getFullyQualifiedHostName())
|
||||
.setRepoId(host.getRepoId())
|
||||
.setStatusValues(host.getStatusValues())
|
||||
.setInetAddresses(host.getInetAddresses())
|
||||
.setCurrentSponsorClientId(host.getCurrentSponsorClientId())
|
||||
.setCreationClientId(host.getCreationClientId())
|
||||
.setCreationTime(host.getCreationTime())
|
||||
.setLastEppUpdateClientId(host.getLastEppUpdateClientId())
|
||||
.setLastEppUpdateTime(host.getLastEppUpdateTime())
|
||||
.setLastTransferTime(host.getLastTransferTime())
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue