mirror of
https://github.com/google/nomulus
synced 2026-08-08 08:16:10 +00:00
Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1fcf63facd | ||
|
|
f87e7eb6e6 | ||
|
|
7a174e3ffa | ||
|
|
2b38ad8a25 | ||
|
|
eefb4c71aa | ||
|
|
9d3cbd07fd | ||
|
|
69f8904692 | ||
|
|
7bebe46695 | ||
|
|
156344e408 |
@@ -138,8 +138,8 @@ def main():
|
||||
if args.directory and os.path.exists(dir):
|
||||
pr(f'Reusing directory {dir}\n')
|
||||
os.chdir(dir)
|
||||
run('git', 'fetch', 'git@github.com:google/nomulus', 'master:master')
|
||||
run('git', 'checkout', 'master')
|
||||
run('git', 'fetch', 'git@github.com:google/nomulus', 'master')
|
||||
run('git', 'checkout', 'origin/master')
|
||||
else:
|
||||
run('git', 'clone', 'git@github.com:google/nomulus', dir)
|
||||
os.chdir(dir)
|
||||
@@ -175,7 +175,7 @@ def main():
|
||||
# Print the list of packages that were removed.
|
||||
for package in old_packages:
|
||||
if package not in new_packages:
|
||||
pr('removed ', b':'.join(package))
|
||||
pr('removed ', b':'.join(package), '\n')
|
||||
else:
|
||||
pr('Package versions not updated!\n')
|
||||
|
||||
|
||||
@@ -33,10 +33,8 @@ import static google.registry.request.RequestParameters.extractSetOfDatetimePara
|
||||
|
||||
import com.google.appengine.api.taskqueue.Queue;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.request.Parameter;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Named;
|
||||
@@ -79,9 +77,8 @@ public class BatchModule {
|
||||
|
||||
@Provides
|
||||
@Parameter(PARAM_RESOURCE_KEY)
|
||||
// TODO(b/207363014): figure out if this needs to be modified for vkey string replacement
|
||||
static Key<ImmutableObject> provideResourceKey(HttpServletRequest req) {
|
||||
return Key.create(extractRequiredParameter(req, PARAM_RESOURCE_KEY));
|
||||
static String provideResourceKey(HttpServletRequest req) {
|
||||
return extractRequiredParameter(req, PARAM_RESOURCE_KEY);
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@@ -22,7 +22,6 @@ import static google.registry.persistence.transaction.TransactionManagerFactory.
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.persistence.VKey;
|
||||
@@ -50,7 +49,7 @@ public class ResaveEntityAction implements Runnable {
|
||||
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
private final Key<ImmutableObject> resourceKey;
|
||||
private final String resourceKey;
|
||||
private final DateTime requestedTime;
|
||||
private final ImmutableSortedSet<DateTime> resaveTimes;
|
||||
private final AsyncTaskEnqueuer asyncTaskEnqueuer;
|
||||
@@ -58,7 +57,7 @@ public class ResaveEntityAction implements Runnable {
|
||||
|
||||
@Inject
|
||||
ResaveEntityAction(
|
||||
@Parameter(PARAM_RESOURCE_KEY) Key<ImmutableObject> resourceKey,
|
||||
@Parameter(PARAM_RESOURCE_KEY) String resourceKey,
|
||||
@Parameter(PARAM_REQUESTED_TIME) DateTime requestedTime,
|
||||
@Parameter(PARAM_RESAVE_TIMES) ImmutableSet<DateTime> resaveTimes,
|
||||
AsyncTaskEnqueuer asyncTaskEnqueuer,
|
||||
@@ -76,15 +75,14 @@ public class ResaveEntityAction implements Runnable {
|
||||
"Re-saving entity %s which was enqueued at %s.", resourceKey, requestedTime);
|
||||
tm().transact(
|
||||
() -> {
|
||||
// TODO(/207363014): figure out if this should modified for vkey string replacement
|
||||
ImmutableObject entity = tm().loadByKey(VKey.from(resourceKey));
|
||||
ImmutableObject entity = tm().loadByKey(VKey.create(resourceKey));
|
||||
tm().put(
|
||||
(entity instanceof EppResource)
|
||||
? ((EppResource) entity).cloneProjectedAtTime(tm().getTransactionTime())
|
||||
: entity);
|
||||
if (!resaveTimes.isEmpty()) {
|
||||
asyncTaskEnqueuer.enqueueAsyncResave(
|
||||
VKey.from(resourceKey), requestedTime, resaveTimes);
|
||||
VKey.create(resourceKey), requestedTime, resaveTimes);
|
||||
}
|
||||
});
|
||||
response.setPayload("Entity re-saved.");
|
||||
|
||||
@@ -167,13 +167,13 @@ public class RdeIO {
|
||||
Optional.ofNullable(key.revision())
|
||||
.orElseGet(() -> RdeRevision.getNextRevision(tld, watermark, mode));
|
||||
String id = RdeUtil.timestampToId(watermark);
|
||||
String prefix = options.getJobName();
|
||||
String basename = RdeNamingUtils.makeRydeFilename(tld, watermark, mode, 1, revision);
|
||||
String prefix =
|
||||
options.getJobName()
|
||||
+ '/'
|
||||
+ RdeNamingUtils.makeRydeFilename(tld, watermark, mode, 1, revision);
|
||||
if (key.manual()) {
|
||||
checkState(key.directoryWithTrailingSlash() != null, "Manual subdirectory not specified");
|
||||
prefix = prefix + "/manual/" + key.directoryWithTrailingSlash() + basename;
|
||||
} else {
|
||||
prefix = prefix + '/' + basename;
|
||||
prefix = "manual/" + key.directoryWithTrailingSlash() + prefix;
|
||||
}
|
||||
BlobId xmlFilename = BlobId.of(rdeBucket, prefix + ".xml.ghostryde");
|
||||
// This file will contain the byte length (ASCII) of the raw unencrypted XML.
|
||||
|
||||
@@ -56,9 +56,9 @@ public final class ContactCheckFlow implements Flow {
|
||||
@Inject ContactCheckFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
public EppResponse run() throws EppException {
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
ImmutableList<String> targetIds = ((Check) resourceCommand).getTargetIds();
|
||||
verifyTargetIdCount(targetIds, maxChecks);
|
||||
ImmutableSet<String> existingIds =
|
||||
|
||||
@@ -70,10 +70,10 @@ public final class ContactCreateFlow implements TransactionalFlow {
|
||||
@Inject ContactCreateFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
Create command = (Create) resourceCommand;
|
||||
DateTime now = tm().getTransactionTime();
|
||||
verifyResourceDoesNotExist(ContactResource.class, targetId, now, registrarId);
|
||||
|
||||
@@ -90,10 +90,10 @@ public final class ContactDeleteFlow implements TransactionalFlow {
|
||||
ContactDeleteFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
checkLinkedDomains(targetId, now, ContactResource.class, DomainBase::getReferencedContacts);
|
||||
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
|
||||
@@ -65,10 +65,10 @@ public final class ContactInfoFlow implements Flow {
|
||||
ContactInfoFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
DateTime now = clock.nowUtc();
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
ContactResource contact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
if (!isSuperuser) {
|
||||
verifyResourceOwnership(registrarId, contact);
|
||||
|
||||
@@ -74,14 +74,14 @@ public final class ContactTransferApproveFlow implements TransactionalFlow {
|
||||
@Inject ContactTransferApproveFlow() {}
|
||||
|
||||
/**
|
||||
* <p>The logic in this flow, which handles client approvals, very closely parallels the logic in
|
||||
* The logic in this flow, which handles client approvals, very closely parallels the logic in
|
||||
* {@link ContactResource#cloneProjectedAtTime} which handles implicit server approvals.
|
||||
*/
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
verifyOptionalAuthInfo(authInfo, existingContact);
|
||||
|
||||
@@ -76,8 +76,8 @@ public final class ContactTransferCancelFlow implements TransactionalFlow {
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
verifyOptionalAuthInfo(authInfo, existingContact);
|
||||
|
||||
@@ -63,9 +63,9 @@ public final class ContactTransferQueryFlow implements Flow {
|
||||
@Inject ContactTransferQueryFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
public EppResponse run() throws EppException {
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
ContactResource contact =
|
||||
loadAndVerifyExistence(ContactResource.class, targetId, clock.nowUtc());
|
||||
verifyOptionalAuthInfo(authInfo, contact);
|
||||
|
||||
@@ -72,10 +72,10 @@ public final class ContactTransferRejectFlow implements TransactionalFlow {
|
||||
@Inject ContactTransferRejectFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
verifyOptionalAuthInfo(authInfo, existingContact);
|
||||
|
||||
@@ -92,10 +92,10 @@ public final class ContactTransferRequestFlow implements TransactionalFlow {
|
||||
@Inject ContactTransferRequestFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(gainingClientId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
verifyAuthInfoPresentForResourceTransfer(authInfo);
|
||||
|
||||
@@ -89,10 +89,10 @@ public final class ContactUpdateFlow implements TransactionalFlow {
|
||||
@Inject ContactUpdateFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
Update command = (Update) resourceCommand;
|
||||
DateTime now = tm().getTransactionTime();
|
||||
ContactResource existingContact = loadAndVerifyExistence(ContactResource.class, targetId, now);
|
||||
|
||||
@@ -135,8 +135,8 @@ public final class DomainCheckFlow implements Flow {
|
||||
extensionManager.register(
|
||||
FeeCheckCommandExtension.class, LaunchCheckExtension.class, AllocationTokenExtension.class);
|
||||
flowCustomLogic.beforeValidation();
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
ImmutableList<String> domainNames = ((Check) resourceCommand).getTargetIds();
|
||||
verifyTargetIdCount(domainNames, maxChecks);
|
||||
DateTime now = clock.nowUtc();
|
||||
|
||||
@@ -82,8 +82,8 @@ public final class DomainClaimsCheckFlow implements Flow {
|
||||
@Override
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(LaunchCheckExtension.class, AllocationTokenExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
if (eppInput.getSingleExtension(AllocationTokenExtension.class).isPresent()) {
|
||||
throw new DomainClaimsCheckNotAllowedWithAllocationTokens();
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ import org.joda.time.Duration;
|
||||
* @error {@link DomainPricingLogic.AllocationTokenInvalidForPremiumNameException}
|
||||
*/
|
||||
@ReportingSpec(ActivityReportField.DOMAIN_CREATE)
|
||||
public class DomainCreateFlow implements TransactionalFlow {
|
||||
public final class DomainCreateFlow implements TransactionalFlow {
|
||||
|
||||
/** Anchor tenant creates should always be for 2 years, since they get 2 years free. */
|
||||
private static final int ANCHOR_TENANT_CREATE_VALID_YEARS = 2;
|
||||
@@ -219,7 +219,7 @@ public class DomainCreateFlow implements TransactionalFlow {
|
||||
@Inject DomainCreateFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(
|
||||
FeeCreateCommandExtension.class,
|
||||
SecDnsCreateExtension.class,
|
||||
@@ -227,9 +227,9 @@ public class DomainCreateFlow implements TransactionalFlow {
|
||||
LaunchCreateExtension.class,
|
||||
AllocationTokenExtension.class);
|
||||
flowCustomLogic.beforeValidation();
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
verifyRegistrarIsActive(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
DomainCommand.Create command = cloneAndLinkReferences((Create) resourceCommand, now);
|
||||
Period period = command.getPeriod();
|
||||
|
||||
@@ -138,12 +138,12 @@ public final class DomainDeleteFlow implements TransactionalFlow {
|
||||
@Inject DomainDeleteFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(
|
||||
MetadataExtension.class, SecDnsCreateExtension.class, DomainDeleteSuperuserExtension.class);
|
||||
flowCustomLogic.beforeValidation();
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
// Loads the target resource if it exists
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
|
||||
@@ -91,11 +91,11 @@ public final class DomainInfoFlow implements Flow {
|
||||
DomainInfoFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(FeeInfoCommandExtensionV06.class);
|
||||
flowCustomLogic.beforeValidation();
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = clock.nowUtc();
|
||||
DomainBase domain = verifyExistence(
|
||||
DomainBase.class, targetId, loadByForeignKey(DomainBase.class, targetId, now));
|
||||
|
||||
@@ -135,12 +135,12 @@ public final class DomainRenewFlow implements TransactionalFlow {
|
||||
@Inject DomainRenewFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(FeeRenewCommandExtension.class, MetadataExtension.class);
|
||||
flowCustomLogic.beforeValidation();
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
verifyRegistrarIsActive(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
Renew command = (Renew) resourceCommand;
|
||||
// Loads the target resource if it exists
|
||||
|
||||
@@ -128,14 +128,14 @@ public final class DomainRestoreRequestFlow implements TransactionalFlow {
|
||||
@Inject DomainRestoreRequestFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(
|
||||
FeeUpdateCommandExtension.class,
|
||||
MetadataExtension.class,
|
||||
RgpUpdateExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
verifyRegistrarIsActive(registrarId);
|
||||
extensionManager.validate();
|
||||
Update command = (Update) resourceCommand;
|
||||
DateTime now = tm().getTransactionTime();
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
|
||||
@@ -99,14 +99,14 @@ public final class DomainTransferApproveFlow implements TransactionalFlow {
|
||||
@Inject DomainTransferApproveFlow() {}
|
||||
|
||||
/**
|
||||
* <p>The logic in this flow, which handles client approvals, very closely parallels the logic in
|
||||
* The logic in this flow, which handles client approvals, very closely parallels the logic in
|
||||
* {@link DomainBase#cloneProjectedAtTime} which handles implicit server approvals.
|
||||
*/
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
verifyOptionalAuthInfo(authInfo, existingDomain);
|
||||
|
||||
@@ -86,10 +86,10 @@ public final class DomainTransferCancelFlow implements TransactionalFlow {
|
||||
@Inject DomainTransferCancelFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
verifyOptionalAuthInfo(authInfo, existingDomain);
|
||||
|
||||
@@ -67,9 +67,9 @@ public final class DomainTransferQueryFlow implements Flow {
|
||||
@Inject DomainTransferQueryFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
public EppResponse run() throws EppException {
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
DateTime now = clock.nowUtc();
|
||||
DomainBase domain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
verifyOptionalAuthInfo(authInfo, domain);
|
||||
|
||||
@@ -88,10 +88,10 @@ public final class DomainTransferRejectFlow implements TransactionalFlow {
|
||||
@Inject DomainTransferRejectFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
Registry registry = Registry.get(existingDomain.getTld());
|
||||
|
||||
@@ -139,14 +139,14 @@ public final class DomainTransferRequestFlow implements TransactionalFlow {
|
||||
@Inject DomainTransferRequestFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(
|
||||
DomainTransferRequestSuperuserExtension.class,
|
||||
FeeTransferCommandExtension.class,
|
||||
MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(gainingClientId);
|
||||
verifyRegistrarIsActive(gainingClientId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
Optional<DomainTransferRequestSuperuserExtension> superuserExtension =
|
||||
|
||||
@@ -43,6 +43,7 @@ import static google.registry.flows.domain.DomainFlowUtils.verifyNotInPendingDel
|
||||
import static google.registry.model.reporting.HistoryEntry.Type.DOMAIN_UPDATE;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.tm;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.ImmutableSortedSet;
|
||||
import com.google.common.collect.Ordering;
|
||||
@@ -77,9 +78,11 @@ import google.registry.model.domain.secdns.SecDnsUpdateExtension;
|
||||
import google.registry.model.domain.superuser.DomainUpdateSuperuserExtension;
|
||||
import google.registry.model.eppcommon.AuthInfo;
|
||||
import google.registry.model.eppcommon.StatusValue;
|
||||
import google.registry.model.eppcommon.Trid;
|
||||
import google.registry.model.eppinput.EppInput;
|
||||
import google.registry.model.eppinput.ResourceCommand;
|
||||
import google.registry.model.eppoutput.EppResponse;
|
||||
import google.registry.model.poll.PendingActionNotificationResponse.DomainPendingActionNotificationResponse;
|
||||
import google.registry.model.poll.PollMessage;
|
||||
import google.registry.model.reporting.IcannReportingTypes.ActivityReportField;
|
||||
import google.registry.model.tld.Registry;
|
||||
@@ -149,6 +152,7 @@ public final class DomainUpdateFlow implements TransactionalFlow {
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@Inject @TargetId String targetId;
|
||||
@Inject @Superuser boolean isSuperuser;
|
||||
@Inject Trid trid;
|
||||
@Inject DomainHistory.Builder historyBuilder;
|
||||
@Inject DnsQueue dnsQueue;
|
||||
@Inject EppResponse.Builder responseBuilder;
|
||||
@@ -164,8 +168,8 @@ public final class DomainUpdateFlow implements TransactionalFlow {
|
||||
SecDnsUpdateExtension.class,
|
||||
DomainUpdateSuperuserExtension.class);
|
||||
flowCustomLogic.beforeValidation();
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
Update command = cloneAndLinkReferences((Update) resourceCommand, now);
|
||||
DomainBase existingDomain = loadAndVerifyExistence(DomainBase.class, targetId, now);
|
||||
@@ -360,6 +364,10 @@ public final class DomainUpdateFlow implements TransactionalFlow {
|
||||
.setEventTime(now)
|
||||
.setRegistrarId(existingDomain.getCurrentSponsorRegistrarId())
|
||||
.setMsg(msg)
|
||||
.setResponseData(
|
||||
ImmutableList.of(
|
||||
DomainPendingActionNotificationResponse.create(
|
||||
existingDomain.getDomainName(), true, trid, now)))
|
||||
.build());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,9 +56,9 @@ public final class HostCheckFlow implements Flow {
|
||||
@Inject HostCheckFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
public EppResponse run() throws EppException {
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
ImmutableList<String> hostnames = ((Check) resourceCommand).getTargetIds();
|
||||
verifyTargetIdCount(hostnames, maxChecks);
|
||||
ImmutableSet<String> existingIds =
|
||||
|
||||
@@ -100,10 +100,10 @@ public final class HostCreateFlow implements TransactionalFlow {
|
||||
HostCreateFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
Create command = (Create) resourceCommand;
|
||||
DateTime now = tm().getTransactionTime();
|
||||
verifyResourceDoesNotExist(HostResource.class, targetId, now, registrarId);
|
||||
|
||||
@@ -92,10 +92,10 @@ public final class HostDeleteFlow implements TransactionalFlow {
|
||||
HostDeleteFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
DateTime now = tm().getTransactionTime();
|
||||
validateHostName(targetId);
|
||||
checkLinkedDomains(targetId, now, HostResource.class, DomainBase::getNameservers);
|
||||
|
||||
@@ -62,8 +62,8 @@ public final class HostInfoFlow implements Flow {
|
||||
|
||||
@Override
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
validateHostName(targetId);
|
||||
DateTime now = clock.nowUtc();
|
||||
HostResource host = loadAndVerifyExistence(HostResource.class, targetId, now);
|
||||
|
||||
@@ -125,10 +125,10 @@ public final class HostUpdateFlow implements TransactionalFlow {
|
||||
@Inject HostUpdateFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
public EppResponse run() throws EppException {
|
||||
extensionManager.register(MetadataExtension.class);
|
||||
extensionManager.validate();
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate();
|
||||
Update command = (Update) resourceCommand;
|
||||
Change change = command.getInnerChange();
|
||||
String suppliedNewHostName = change.getFullyQualifiedHostName();
|
||||
|
||||
@@ -45,17 +45,17 @@ import org.joda.time.DateTime;
|
||||
/**
|
||||
* An EPP flow for acknowledging {@link PollMessage}s.
|
||||
*
|
||||
* <p>Registrars refer to poll messages using an externally visible id generated by
|
||||
* {@link PollMessageExternalKeyConverter}. One-time poll messages are deleted from Datastore once
|
||||
* they are ACKed, whereas autorenew poll messages are simply marked as read, and won't be delivered
|
||||
* again until the next year of their recurrence.
|
||||
* <p>Registrars refer to poll messages using an externally visible id generated by {@link
|
||||
* PollMessageExternalKeyConverter}. One-time poll messages are deleted from Datastore once they are
|
||||
* ACKed, whereas autorenew poll messages are simply marked as read, and won't be delivered again
|
||||
* until the next year of their recurrence.
|
||||
*
|
||||
* @error {@link PollAckFlow.InvalidMessageIdException}
|
||||
* @error {@link PollAckFlow.MessageDoesNotExistException}
|
||||
* @error {@link PollAckFlow.MissingMessageIdException}
|
||||
* @error {@link PollAckFlow.NotAuthorizedToAckMessageException}
|
||||
*/
|
||||
public class PollAckFlow implements TransactionalFlow {
|
||||
public final class PollAckFlow implements TransactionalFlow {
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@@ -65,9 +65,9 @@ public class PollAckFlow implements TransactionalFlow {
|
||||
@Inject PollAckFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
public EppResponse run() throws EppException {
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
if (messageId.isEmpty()) {
|
||||
throw new MissingMessageIdException();
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ import org.joda.time.DateTime;
|
||||
*
|
||||
* @error {@link PollRequestFlow.UnexpectedMessageIdException}
|
||||
*/
|
||||
public class PollRequestFlow implements Flow {
|
||||
public final class PollRequestFlow implements Flow {
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@@ -57,9 +57,9 @@ public class PollRequestFlow implements Flow {
|
||||
@Inject PollRequestFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
public EppResponse run() throws EppException {
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
if (!messageId.isEmpty()) {
|
||||
throw new UnexpectedMessageIdException();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ import javax.inject.Inject;
|
||||
*
|
||||
* @error {@link google.registry.flows.FlowUtils.GenericXmlSyntaxErrorException}
|
||||
*/
|
||||
public class HelloFlow implements Flow {
|
||||
public final class HelloFlow implements Flow {
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject Clock clock;
|
||||
|
||||
@@ -90,7 +90,7 @@ public class LoginFlow implements Flow {
|
||||
}
|
||||
|
||||
/** Run the flow without bothering to log errors. The {@link #run} method will do that for us. */
|
||||
private final EppResponse runWithoutLogging() throws EppException {
|
||||
private EppResponse runWithoutLogging() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
Login login = (Login) eppInput.getCommandWrapper().getCommand();
|
||||
if (!registrarId.isEmpty()) {
|
||||
|
||||
@@ -30,7 +30,7 @@ import javax.inject.Inject;
|
||||
*
|
||||
* @error {@link google.registry.flows.FlowUtils.NotLoggedInException}
|
||||
*/
|
||||
public class LogoutFlow implements Flow {
|
||||
public final class LogoutFlow implements Flow {
|
||||
|
||||
@Inject ExtensionManager extensionManager;
|
||||
@Inject @RegistrarId String registrarId;
|
||||
@@ -39,9 +39,9 @@ public class LogoutFlow implements Flow {
|
||||
@Inject LogoutFlow() {}
|
||||
|
||||
@Override
|
||||
public final EppResponse run() throws EppException {
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
public EppResponse run() throws EppException {
|
||||
validateRegistrarIsLoggedIn(registrarId);
|
||||
extensionManager.validate(); // There are no legal extensions for this flow.
|
||||
sessionMetadata.invalidate();
|
||||
return responseBuilder.setResultFromCode(SUCCESS_AND_CLOSE).build();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
package google.registry.model;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.billing.BillingEvent;
|
||||
import google.registry.model.common.Cursor;
|
||||
import google.registry.model.common.EntityGroupRoot;
|
||||
@@ -45,6 +46,7 @@ import google.registry.model.server.ServerSecret;
|
||||
import google.registry.model.tld.Registry;
|
||||
|
||||
/** Sets of classes of the Objectify-registered entities in use throughout the model. */
|
||||
@DeleteAfterMigration
|
||||
public final class EntityClasses {
|
||||
|
||||
/** Set of entity classes. */
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.google.appengine.api.datastore.DatastoreServiceFactory;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import google.registry.beam.common.RegistryPipelineWorkerInitializer;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
/**
|
||||
@@ -28,6 +29,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
* <p>In non-test, non-beam environments the Id is generated by Datastore, otherwise it's from an
|
||||
* atomic long number that's incremented every time this method is called.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
public final class IdService {
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,12 +19,14 @@ import static com.google.common.base.Predicates.subtypeOf;
|
||||
import static java.util.stream.Collectors.joining;
|
||||
|
||||
import com.google.common.collect.Ordering;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Queue;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/** Utility methods for getting the version of the model schema from the model code. */
|
||||
@DeleteAfterMigration
|
||||
public final class SchemaVersion {
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,11 +20,13 @@ import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.annotation.Id;
|
||||
import com.googlecode.objectify.annotation.Parent;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.annotations.InCrossTld;
|
||||
import javax.persistence.MappedSuperclass;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
/** A singleton entity in Datastore. */
|
||||
@DeleteAfterMigration
|
||||
@MappedSuperclass
|
||||
@InCrossTld
|
||||
public abstract class CrossTldSingleton extends ImmutableObject {
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.google.common.collect.ImmutableMultimap;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.common.TimedTransitionProperty.TimedTransition;
|
||||
import google.registry.model.replay.SqlOnlyEntity;
|
||||
import java.time.Duration;
|
||||
@@ -39,6 +40,7 @@ import org.joda.time.DateTime;
|
||||
* <p>The entity is stored in SQL throughout the entire migration so as to have a single point of
|
||||
* access.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
@Entity
|
||||
public class DatabaseMigrationStateSchedule extends CrossTldSingleton implements SqlOnlyEntity {
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.annotation.Entity;
|
||||
import com.googlecode.objectify.annotation.Id;
|
||||
import google.registry.model.BackupGroupRoot;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.replay.DatastoreOnlyEntity;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -37,6 +38,7 @@ import javax.annotation.Nullable;
|
||||
* entity group for the single namespace where global data applicable for all TLDs lived.
|
||||
*/
|
||||
@Entity
|
||||
@DeleteAfterMigration
|
||||
public class EntityGroupRoot extends BackupGroupRoot implements DatastoreOnlyEntity {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
@@ -24,12 +24,14 @@ import com.googlecode.objectify.annotation.Index;
|
||||
import com.googlecode.objectify.annotation.Parent;
|
||||
import google.registry.model.BackupGroupRoot;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.annotations.ReportedOn;
|
||||
import google.registry.model.replay.DatastoreOnlyEntity;
|
||||
|
||||
/** An index that allows for quick enumeration of all EppResource entities (e.g. via map reduce). */
|
||||
@ReportedOn
|
||||
@Entity
|
||||
@DeleteAfterMigration
|
||||
public class EppResourceIndex extends BackupGroupRoot implements DatastoreOnlyEntity {
|
||||
|
||||
@Id String id;
|
||||
|
||||
@@ -23,12 +23,14 @@ import com.googlecode.objectify.annotation.Entity;
|
||||
import com.googlecode.objectify.annotation.Id;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.annotations.VirtualEntity;
|
||||
import google.registry.model.replay.DatastoreOnlyEntity;
|
||||
|
||||
/** A virtual entity to represent buckets to which EppResourceIndex objects are randomly added. */
|
||||
@Entity
|
||||
@VirtualEntity
|
||||
@DeleteAfterMigration
|
||||
public class EppResourceIndexBucket extends ImmutableObject implements DatastoreOnlyEntity {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
|
||||
@@ -43,6 +43,7 @@ import com.googlecode.objectify.annotation.Index;
|
||||
import google.registry.config.RegistryConfig;
|
||||
import google.registry.model.BackupGroupRoot;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.annotations.ReportedOn;
|
||||
import google.registry.model.contact.ContactResource;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
@@ -65,6 +66,7 @@ import org.joda.time.Duration;
|
||||
* the foreign key string. The instance is never deleted, but it is updated if a newer entity
|
||||
* becomes the active entity.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
public abstract class ForeignKeyIndex<E extends EppResource> extends BackupGroupRoot {
|
||||
|
||||
/** The {@link ForeignKeyIndex} type for {@link ContactResource} entities. */
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.Result;
|
||||
import com.googlecode.objectify.cmd.DeleteType;
|
||||
import com.googlecode.objectify.cmd.Deleter;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -30,6 +31,7 @@ import java.util.stream.Stream;
|
||||
* A Deleter that forwards to {@code auditedOfy().delete()}, but can be augmented via subclassing to
|
||||
* do custom processing on the keys to be deleted prior to their deletion.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
abstract class AugmentedDeleter implements Deleter {
|
||||
private final Deleter delegate = ofy().delete();
|
||||
|
||||
|
||||
@@ -21,13 +21,15 @@ import com.google.common.collect.ImmutableList;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.Result;
|
||||
import com.googlecode.objectify.cmd.Saver;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A Saver that forwards to {@code ofy().save()}, but can be augmented via subclassing to
|
||||
* do custom processing on the entities to be saved prior to their saving.
|
||||
* A Saver that forwards to {@code ofy().save()}, but can be augmented via subclassing to do custom
|
||||
* processing on the entities to be saved prior to their saving.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
abstract class AugmentedSaver implements Saver {
|
||||
private final Saver delegate = ofy().save();
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import com.googlecode.objectify.annotation.Id;
|
||||
import google.registry.config.RegistryConfig;
|
||||
import google.registry.model.Buildable;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.annotations.NotBackedUp;
|
||||
import google.registry.model.annotations.NotBackedUp.Reason;
|
||||
import google.registry.model.replay.DatastoreOnlyEntity;
|
||||
@@ -51,6 +52,7 @@ import org.joda.time.DateTime;
|
||||
*/
|
||||
@Entity
|
||||
@NotBackedUp(reason = Reason.COMMIT_LOGS)
|
||||
@DeleteAfterMigration
|
||||
public class CommitLogBucket extends ImmutableObject implements Buildable, DatastoreOnlyEntity {
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.googlecode.objectify.annotation.Entity;
|
||||
import com.googlecode.objectify.annotation.Id;
|
||||
import com.googlecode.objectify.annotation.Parent;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.annotations.NotBackedUp;
|
||||
import google.registry.model.annotations.NotBackedUp.Reason;
|
||||
import google.registry.model.replay.DatastoreOnlyEntity;
|
||||
@@ -45,6 +46,7 @@ import org.joda.time.DateTime;
|
||||
*/
|
||||
@Entity
|
||||
@NotBackedUp(reason = Reason.COMMIT_LOGS)
|
||||
@DeleteAfterMigration
|
||||
public class CommitLogCheckpoint extends ImmutableObject implements DatastoreOnlyEntity {
|
||||
|
||||
/** Shared singleton parent entity for commit log checkpoints. */
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.annotation.Entity;
|
||||
import com.googlecode.objectify.annotation.Id;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.annotations.NotBackedUp;
|
||||
import google.registry.model.annotations.NotBackedUp.Reason;
|
||||
import google.registry.model.replay.DatastoreOnlyEntity;
|
||||
@@ -29,6 +30,7 @@ import org.joda.time.DateTime;
|
||||
/** Singleton parent entity for all commit log checkpoints. */
|
||||
@Entity
|
||||
@NotBackedUp(reason = Reason.COMMIT_LOGS)
|
||||
@DeleteAfterMigration
|
||||
public class CommitLogCheckpointRoot extends ImmutableObject implements DatastoreOnlyEntity {
|
||||
|
||||
public static final long SINGLETON_ID = 1; // There is always exactly one of these.
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.googlecode.objectify.annotation.Entity;
|
||||
import com.googlecode.objectify.annotation.Id;
|
||||
import com.googlecode.objectify.annotation.Parent;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.annotations.NotBackedUp;
|
||||
import google.registry.model.annotations.NotBackedUp.Reason;
|
||||
import google.registry.model.replay.DatastoreOnlyEntity;
|
||||
@@ -39,6 +40,7 @@ import org.joda.time.DateTime;
|
||||
*/
|
||||
@Entity
|
||||
@NotBackedUp(reason = Reason.COMMIT_LOGS)
|
||||
@DeleteAfterMigration
|
||||
public class CommitLogManifest extends ImmutableObject implements DatastoreOnlyEntity {
|
||||
|
||||
/** Commit log manifests are parented on a random bucket. */
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.googlecode.objectify.annotation.Entity;
|
||||
import com.googlecode.objectify.annotation.Id;
|
||||
import com.googlecode.objectify.annotation.Parent;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.annotations.NotBackedUp;
|
||||
import google.registry.model.annotations.NotBackedUp.Reason;
|
||||
import google.registry.model.replay.DatastoreOnlyEntity;
|
||||
@@ -34,6 +35,7 @@ import google.registry.model.replay.DatastoreOnlyEntity;
|
||||
/** Representation of a saved entity in a {@link CommitLogManifest} (not deletes). */
|
||||
@Entity
|
||||
@NotBackedUp(reason = Reason.COMMIT_LOGS)
|
||||
@DeleteAfterMigration
|
||||
public class CommitLogMutation extends ImmutableObject implements DatastoreOnlyEntity {
|
||||
|
||||
/** The manifest this belongs to. */
|
||||
|
||||
@@ -30,6 +30,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.BackupGroupRoot;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.util.Clock;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@@ -39,6 +40,7 @@ import java.util.function.Supplier;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Wrapper for {@link Supplier} that associates a time with each attempt. */
|
||||
@DeleteAfterMigration
|
||||
class CommitLoggedWork<R> implements Runnable {
|
||||
|
||||
private final Supplier<R> work;
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.Result;
|
||||
import com.googlecode.objectify.cmd.Query;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.annotations.InCrossTld;
|
||||
import google.registry.model.contact.ContactHistory;
|
||||
import google.registry.model.domain.DomainHistory;
|
||||
@@ -55,6 +56,7 @@ import javax.persistence.NonUniqueResultException;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Datastore implementation of {@link TransactionManager}. */
|
||||
@DeleteAfterMigration
|
||||
public class DatastoreTransactionManager implements TransactionManager {
|
||||
|
||||
private Ofy injectedOfy;
|
||||
|
||||
@@ -16,6 +16,7 @@ package google.registry.model.ofy;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
|
||||
/**
|
||||
* Contains the mapping from class names to SQL-replay-write priorities.
|
||||
@@ -26,6 +27,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
* values represent an earlier write (and later delete). Higher-valued classes can have foreign keys
|
||||
* on lower-valued classes, but not vice versa.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
public class EntityWritePriorities {
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,6 +35,7 @@ import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.model.Buildable;
|
||||
import google.registry.model.EntityClasses;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.translators.BloomFilterOfStringTranslatorFactory;
|
||||
import google.registry.model.translators.CidrAddressBlockTranslatorFactory;
|
||||
import google.registry.model.translators.CommitLogRevisionsTranslatorFactory;
|
||||
@@ -52,6 +53,7 @@ import google.registry.model.translators.VKeyTranslatorFactory;
|
||||
* objects. The class contains a static initializer to call factory().register(...) on all
|
||||
* persistable objects in this package.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
public class ObjectifyService {
|
||||
|
||||
/** A singleton instance of our Ofy wrapper. */
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.googlecode.objectify.ObjectifyFactory;
|
||||
import com.googlecode.objectify.cmd.Deleter;
|
||||
import com.googlecode.objectify.cmd.Loader;
|
||||
import com.googlecode.objectify.cmd.Saver;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.annotations.NotBackedUp;
|
||||
import google.registry.model.annotations.VirtualEntity;
|
||||
import google.registry.model.ofy.ReadOnlyWork.KillTransactionException;
|
||||
@@ -59,6 +60,7 @@ import org.joda.time.Duration;
|
||||
* simpler to wrap {@link Objectify} rather than extend it because this way we can remove some
|
||||
* methods that we don't really want exposed and add some shortcuts.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
public class Ofy {
|
||||
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
package google.registry.model.ofy;
|
||||
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
@@ -23,6 +24,7 @@ import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
|
||||
/** A filter that statically registers types with Objectify. */
|
||||
@DeleteAfterMigration
|
||||
public class OfyFilter implements Filter {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,10 +14,12 @@
|
||||
|
||||
package google.registry.model.ofy;
|
||||
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.util.Clock;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/** Wrapper for {@link Supplier} that disallows mutations and fails the transaction at the end. */
|
||||
@DeleteAfterMigration
|
||||
class ReadOnlyWork<R> extends CommitLoggedWork<R> {
|
||||
|
||||
ReadOnlyWork(Supplier<R> work, Clock clock) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.config.RegistryEnvironment;
|
||||
import google.registry.model.UpdateAutoTimestamp;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.replay.DatastoreEntity;
|
||||
import google.registry.model.replay.ReplaySpecializer;
|
||||
import google.registry.persistence.VKey;
|
||||
@@ -34,6 +35,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
*
|
||||
* <p>This code is to be removed when the actual replay cron job is implemented.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
public class ReplayQueue {
|
||||
|
||||
static ConcurrentLinkedQueue<ImmutableMap<Key<?>, Object>> queue =
|
||||
|
||||
+2
@@ -28,6 +28,7 @@ import com.google.appengine.api.datastore.Query;
|
||||
import com.google.appengine.api.datastore.Transaction;
|
||||
import com.google.appengine.api.datastore.TransactionOptions;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -35,6 +36,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/** A proxy for {@link AsyncDatastoreService} that exposes call counts. */
|
||||
@DeleteAfterMigration
|
||||
public class RequestCapturingAsyncDatastoreService implements AsyncDatastoreService {
|
||||
|
||||
private final AsyncDatastoreService delegate;
|
||||
|
||||
@@ -18,8 +18,10 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.ObjectifyFactory;
|
||||
import com.googlecode.objectify.impl.ObjectifyImpl;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
|
||||
/** Registry-specific Objectify subclass that exposes the keys used in the current session. */
|
||||
@DeleteAfterMigration
|
||||
public class SessionKeyExposingObjectify extends ObjectifyImpl<SessionKeyExposingObjectify> {
|
||||
|
||||
public SessionKeyExposingObjectify(ObjectifyFactory factory) {
|
||||
|
||||
@@ -17,6 +17,7 @@ package google.registry.model.ofy;
|
||||
import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.Objectify;
|
||||
import google.registry.model.BackupGroupRoot;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import org.joda.time.DateTime;
|
||||
@@ -25,6 +26,7 @@ import org.joda.time.DateTime;
|
||||
* Exception when trying to write to Datastore with a timestamp that is inconsistent with a partial
|
||||
* ordering on transactions that touch the same entities.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
class TimestampInversionException extends RuntimeException {
|
||||
|
||||
static String getFileAndLine(StackTraceElement callsite) {
|
||||
|
||||
@@ -26,10 +26,12 @@ import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.Map;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Metadata for an {@link Ofy} transaction that saves commit logs. */
|
||||
@DeleteAfterMigration
|
||||
public class TransactionInfo {
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
@@ -14,9 +14,11 @@
|
||||
|
||||
package google.registry.model.replay;
|
||||
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.Optional;
|
||||
|
||||
/** An entity that has the same Java object representation in SQL and Datastore. */
|
||||
@DeleteAfterMigration
|
||||
public interface DatastoreAndSqlEntity extends DatastoreEntity, SqlEntity {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
package google.registry.model.replay;
|
||||
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -24,6 +25,7 @@ import java.util.Optional;
|
||||
* transactions and data into the secondary SQL store during the first, Datastore-primary, phase of
|
||||
* the migration.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
public interface DatastoreEntity {
|
||||
|
||||
Optional<SqlEntity> toSqlEntity();
|
||||
|
||||
@@ -14,9 +14,11 @@
|
||||
|
||||
package google.registry.model.replay;
|
||||
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.Optional;
|
||||
|
||||
/** An entity that is only stored in Datastore, that should not be replayed to SQL. */
|
||||
@DeleteAfterMigration
|
||||
public interface DatastoreOnlyEntity extends DatastoreEntity {
|
||||
@Override
|
||||
default Optional<SqlEntity> toSqlEntity() {
|
||||
|
||||
@@ -22,9 +22,11 @@ import com.googlecode.objectify.Key;
|
||||
import com.googlecode.objectify.annotation.Entity;
|
||||
import com.googlecode.objectify.annotation.Id;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
|
||||
/** Datastore entity to keep track of the last SQL transaction imported into the datastore. */
|
||||
@Entity
|
||||
@DeleteAfterMigration
|
||||
public class LastSqlTransaction extends ImmutableObject implements DatastoreOnlyEntity {
|
||||
|
||||
/** The key for this singleton. */
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
package google.registry.model.replay;
|
||||
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -21,6 +22,7 @@ import java.util.Optional;
|
||||
*
|
||||
* <p>We expect that this is a result of the entity being dually-written.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
public interface NonReplicatedEntity extends DatastoreEntity, SqlEntity {
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
package google.registry.model.replay;
|
||||
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.persistence.VKey;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@@ -25,6 +26,7 @@ import java.lang.reflect.Method;
|
||||
* not directly present in the other database. This class allows us to do that by using reflection
|
||||
* to invoke special class methods if they are present.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
public class ReplaySpecializer {
|
||||
|
||||
public static void beforeSqlDelete(VKey<?> key) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.flogger.FluentLogger;
|
||||
import google.registry.model.UpdateAutoTimestamp;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.common.DatabaseMigrationStateSchedule;
|
||||
import google.registry.model.common.DatabaseMigrationStateSchedule.MigrationState;
|
||||
import google.registry.model.common.DatabaseMigrationStateSchedule.ReplayDirection;
|
||||
@@ -53,6 +54,7 @@ import org.joda.time.Duration;
|
||||
automaticallyPrintOk = true,
|
||||
auth = Auth.AUTH_INTERNAL_OR_ADMIN)
|
||||
@VisibleForTesting
|
||||
@DeleteAfterMigration
|
||||
public class ReplicateToDatastoreAction implements Runnable {
|
||||
public static final String PATH = "/_dr/cron/replicateToDatastore";
|
||||
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
|
||||
|
||||
@@ -16,6 +16,7 @@ package google.registry.model.replay;
|
||||
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
|
||||
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
@@ -25,6 +26,7 @@ import java.util.Optional;
|
||||
* <p>This will be used when replaying SQL transactions into Datastore, during the second,
|
||||
* SQL-primary, phase of the migration from Datastore to SQL.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
public interface SqlEntity {
|
||||
|
||||
Optional<DatastoreEntity> toDatastoreEntity();
|
||||
|
||||
@@ -14,9 +14,11 @@
|
||||
|
||||
package google.registry.model.replay;
|
||||
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.Optional;
|
||||
|
||||
/** An entity that is only stored in SQL, that should not be replayed to Datastore. */
|
||||
@DeleteAfterMigration
|
||||
public interface SqlOnlyEntity extends SqlEntity {
|
||||
@Override
|
||||
default Optional<DatastoreEntity> toDatastoreEntity() {
|
||||
|
||||
@@ -17,12 +17,14 @@ package google.registry.model.replay;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
|
||||
import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.common.CrossTldSingleton;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
@Entity
|
||||
@DeleteAfterMigration
|
||||
public class SqlReplayCheckpoint extends CrossTldSingleton implements SqlOnlyEntity {
|
||||
|
||||
@Column(nullable = false)
|
||||
|
||||
@@ -14,11 +14,13 @@
|
||||
|
||||
package google.registry.model.tld.label;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.collect.ImmutableList.toImmutableList;
|
||||
import static google.registry.config.RegistryConfig.getDomainLabelListCacheDuration;
|
||||
import static google.registry.config.RegistryConfig.getSingletonCachePersistDuration;
|
||||
import static google.registry.config.RegistryConfig.getStaticPremiumListMaxCachedEntries;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
|
||||
import static google.registry.util.CollectionUtils.isNullOrEmpty;
|
||||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
@@ -153,27 +155,26 @@ public class PremiumListDao {
|
||||
}
|
||||
|
||||
public static PremiumList save(String name, CurrencyUnit currencyUnit, List<String> inputData) {
|
||||
checkArgument(!inputData.isEmpty(), "New premium list data cannot be empty");
|
||||
return save(PremiumListUtils.parseToPremiumList(name, currencyUnit, inputData));
|
||||
}
|
||||
|
||||
/** Saves the given premium list (and its premium list entries) to Cloud SQL. */
|
||||
public static PremiumList save(PremiumList premiumList) {
|
||||
jpaTm().transact(() -> jpaTm().insert(premiumList));
|
||||
premiumListCache.invalidate(premiumList.getName());
|
||||
jpaTm()
|
||||
.transact(
|
||||
() -> {
|
||||
if (premiumList.getLabelsToPrices() != null) {
|
||||
Optional<PremiumList> savedPremiumList =
|
||||
PremiumListDao.getLatestRevision(premiumList.getName());
|
||||
jpaTm().insert(premiumList);
|
||||
jpaTm().getEntityManager().flush(); // This populates the revisionId.
|
||||
long revisionId = premiumList.getRevisionId();
|
||||
|
||||
if (!isNullOrEmpty(premiumList.getLabelsToPrices())) {
|
||||
ImmutableSet.Builder<PremiumEntry> entries = new ImmutableSet.Builder<>();
|
||||
premiumList.getLabelsToPrices().entrySet().stream()
|
||||
.forEach(
|
||||
entry ->
|
||||
entries.add(
|
||||
PremiumEntry.create(
|
||||
savedPremiumList.get().getRevisionId(),
|
||||
entry.getValue(),
|
||||
entry.getKey())));
|
||||
PremiumEntry.create(revisionId, entry.getValue(), entry.getKey())));
|
||||
jpaTm().insertAll(entries.build());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package google.registry.model.tld.label;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static org.joda.time.DateTimeZone.UTC;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -38,7 +37,6 @@ public class PremiumListUtils {
|
||||
.setCreationTimestamp(DateTime.now(UTC))
|
||||
.build();
|
||||
ImmutableMap<String, PremiumEntry> prices = partialPremiumList.parse(inputData);
|
||||
checkArgument(inputData.size() > 0, "Input cannot be empty");
|
||||
Map<String, BigDecimal> priceAmounts = Maps.transformValues(prices, PremiumEntry::getValue);
|
||||
return partialPremiumList.asBuilder().setLabelsToPrices(priceAmounts).build();
|
||||
}
|
||||
|
||||
+7
-4
@@ -23,6 +23,7 @@ import static google.registry.util.DateTimeUtils.START_OF_TIME;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import com.google.common.collect.Ordering;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.ofy.CommitLogManifest;
|
||||
import google.registry.persistence.transaction.Transaction;
|
||||
import org.joda.time.DateTime;
|
||||
@@ -31,11 +32,12 @@ import org.joda.time.DateTime;
|
||||
* Objectify translator for {@code ImmutableSortedMap<DateTime, Key<CommitLogManifest>>} fields.
|
||||
*
|
||||
* <p>This translator is responsible for doing three things:
|
||||
*
|
||||
* <ol>
|
||||
* <li>Translating the data into two lists of {@code Date} and {@code Key} objects, in a manner
|
||||
* similar to {@code @Mapify}.
|
||||
* <li>Inserting a key to the transaction's {@link CommitLogManifest} on save.
|
||||
* <li>Truncating the map to include only the last key per day for the last 30 days.
|
||||
* <li>Translating the data into two lists of {@code Date} and {@code Key} objects, in a manner
|
||||
* similar to {@code @Mapify}.
|
||||
* <li>Inserting a key to the transaction's {@link CommitLogManifest} on save.
|
||||
* <li>Truncating the map to include only the last key per day for the last 30 days.
|
||||
* </ol>
|
||||
*
|
||||
* <p>This allows you to have a field on your model object that tracks historical revisions of
|
||||
@@ -46,6 +48,7 @@ import org.joda.time.DateTime;
|
||||
*
|
||||
* @see google.registry.model.EppResource
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
public final class CommitLogRevisionsTranslatorFactory
|
||||
extends ImmutableSortedMapTranslatorFactory<DateTime, Key<CommitLogManifest>> {
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ package google.registry.module.backend;
|
||||
import com.google.monitoring.metrics.MetricReporter;
|
||||
import dagger.Component;
|
||||
import dagger.Lazy;
|
||||
import google.registry.batch.BatchModule;
|
||||
import google.registry.bigquery.BigqueryModule;
|
||||
import google.registry.config.CloudTasksUtilsModule;
|
||||
import google.registry.config.CredentialModule;
|
||||
@@ -55,6 +56,7 @@ import javax.inject.Singleton;
|
||||
modules = {
|
||||
AuthModule.class,
|
||||
BackendRequestComponentModule.class,
|
||||
BatchModule.class,
|
||||
BigqueryModule.class,
|
||||
ConfigModule.class,
|
||||
CloudTasksUtilsModule.class,
|
||||
|
||||
@@ -142,7 +142,7 @@ public class VKey<T> extends ImmutableObject implements Serializable {
|
||||
* "@ofy:agR0ZXN0cjELEg9FbnRpdHlHcm91cFJvb3QiCWNyb3NzLXRsZAwLEgpUZXN0T2JqZWN0IgNmb28M", where sql
|
||||
* key and ofy key values are encoded in Base64.
|
||||
*/
|
||||
public static <T> VKey<T> create(String keyString) throws Exception {
|
||||
public static <T> VKey<T> create(String keyString) {
|
||||
if (!keyString.startsWith(CLASS_TYPE + KV_SEPARATOR)) {
|
||||
// to handle the existing ofy key string
|
||||
return fromWebsafeKey(keyString);
|
||||
|
||||
+2
@@ -15,6 +15,7 @@
|
||||
package google.registry.persistence.converter;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.common.DatabaseMigrationStateSchedule;
|
||||
import google.registry.model.common.DatabaseMigrationStateSchedule.MigrationState;
|
||||
import google.registry.model.common.DatabaseMigrationStateSchedule.MigrationStateTransition;
|
||||
@@ -23,6 +24,7 @@ import javax.persistence.Converter;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** JPA converter for {@link DatabaseMigrationStateSchedule} transitions. */
|
||||
@DeleteAfterMigration
|
||||
@Converter(autoApply = true)
|
||||
public class DatabaseMigrationScheduleTransitionConverter
|
||||
extends TimedTransitionPropertyConverterBase<MigrationState, MigrationStateTransition> {
|
||||
|
||||
+2
@@ -16,6 +16,7 @@ package google.registry.persistence.transaction;
|
||||
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.assertNotReadOnlyMode;
|
||||
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.persistence.EntityGraph;
|
||||
@@ -34,6 +35,7 @@ import javax.persistence.criteria.CriteriaUpdate;
|
||||
import javax.persistence.metamodel.Metamodel;
|
||||
|
||||
/** An {@link EntityManager} that throws exceptions on write actions if in read-only mode. */
|
||||
@DeleteAfterMigration
|
||||
public class ReadOnlyCheckingEntityManager implements EntityManager {
|
||||
|
||||
private final EntityManager delegate;
|
||||
|
||||
@@ -16,6 +16,7 @@ package google.registry.persistence.transaction;
|
||||
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.assertNotReadOnlyMode;
|
||||
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -29,6 +30,7 @@ import javax.persistence.Query;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
/** A {@link Query} that throws exceptions on write actions if in read-only mode. */
|
||||
@DeleteAfterMigration
|
||||
class ReadOnlyCheckingQuery implements Query {
|
||||
|
||||
private final Query delegate;
|
||||
|
||||
+2
@@ -16,6 +16,7 @@ package google.registry.persistence.transaction;
|
||||
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.assertNotReadOnlyMode;
|
||||
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -29,6 +30,7 @@ import javax.persistence.TemporalType;
|
||||
import javax.persistence.TypedQuery;
|
||||
|
||||
/** A {@link TypedQuery <T>} that throws exceptions on write actions if in read-only mode. */
|
||||
@DeleteAfterMigration
|
||||
class ReadOnlyCheckingTypedQuery<T> implements TypedQuery<T> {
|
||||
|
||||
private final TypedQuery<T> delegate;
|
||||
|
||||
+7
-1
@@ -35,7 +35,7 @@ import org.joda.time.DateTime;
|
||||
|
||||
/** Factory class to create {@link TransactionManager} instance. */
|
||||
// TODO: Rename this to PersistenceFactory and move to persistence package.
|
||||
public class TransactionManagerFactory {
|
||||
public final class TransactionManagerFactory {
|
||||
|
||||
private static final DatastoreTransactionManager ofyTm = createTransactionManager();
|
||||
|
||||
@@ -47,6 +47,8 @@ public class TransactionManagerFactory {
|
||||
private static Supplier<JpaTransactionManager> jpaTm =
|
||||
Suppliers.memoize(TransactionManagerFactory::createJpaTransactionManager);
|
||||
|
||||
private static boolean onBeam = false;
|
||||
|
||||
private TransactionManagerFactory() {}
|
||||
|
||||
private static JpaTransactionManager createJpaTransactionManager() {
|
||||
@@ -86,6 +88,9 @@ public class TransactionManagerFactory {
|
||||
if (tmForTest.isPresent()) {
|
||||
return tmForTest.get();
|
||||
}
|
||||
if (onBeam) {
|
||||
return jpaTm();
|
||||
}
|
||||
return DatabaseMigrationStateSchedule.getValueAtTime(DateTime.now(UTC))
|
||||
.getPrimaryDatabase()
|
||||
.equals(PrimaryDatabase.DATASTORE)
|
||||
@@ -127,6 +132,7 @@ public class TransactionManagerFactory {
|
||||
public static void setJpaTmOnBeamWorker(Supplier<JpaTransactionManager> jpaTmSupplier) {
|
||||
checkNotNull(jpaTmSupplier, "jpaTmSupplier");
|
||||
jpaTm = Suppliers.memoize(jpaTmSupplier::get);
|
||||
onBeam = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package google.registry.rde;
|
||||
|
||||
import static com.google.appengine.api.taskqueue.QueueFactory.getQueue;
|
||||
import static google.registry.request.RequestParameters.extractBooleanParameter;
|
||||
import static google.registry.request.RequestParameters.extractOptionalIntParameter;
|
||||
import static google.registry.request.RequestParameters.extractOptionalParameter;
|
||||
@@ -22,7 +21,6 @@ import static google.registry.request.RequestParameters.extractRequiredDatetimeP
|
||||
import static google.registry.request.RequestParameters.extractSetOfDatetimeParameters;
|
||||
import static google.registry.request.RequestParameters.extractSetOfParameters;
|
||||
|
||||
import com.google.appengine.api.taskqueue.Queue;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.jcraft.jsch.SftpProgressMonitor;
|
||||
import dagger.Binds;
|
||||
@@ -30,7 +28,6 @@ import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import google.registry.request.Parameter;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Named;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
@@ -110,12 +107,6 @@ public abstract class RdeModule {
|
||||
return extractOptionalParameter(req, PARAM_PREFIX);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Named("rde-report")
|
||||
static Queue provideQueueRdeReport() {
|
||||
return getQueue("rde-report");
|
||||
}
|
||||
|
||||
@Binds
|
||||
abstract SftpProgressMonitor provideSftpProgressMonitor(
|
||||
LoggingSftpProgressMonitor loggingSftpProgressMonitor);
|
||||
|
||||
@@ -17,6 +17,7 @@ package google.registry.tools;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.collect.Sets.SetView;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
@@ -27,6 +28,7 @@ import java.io.File;
|
||||
* two-level directory hierarchy with data files in level-db format (output-*) and Datastore
|
||||
* metadata files (*.export_metadata).
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
class CompareDbBackups {
|
||||
private static final String DS_V3_BACKUP_FILE_PREFIX = "output-";
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
package google.registry.tools;
|
||||
|
||||
import static com.google.appengine.api.taskqueue.TaskOptions.Builder.withUrl;
|
||||
import static google.registry.model.tld.Registries.assertTldsExist;
|
||||
import static google.registry.rde.RdeModule.PARAM_BEAM;
|
||||
import static google.registry.rde.RdeModule.PARAM_DIRECTORY;
|
||||
@@ -23,23 +22,22 @@ import static google.registry.rde.RdeModule.PARAM_MANUAL;
|
||||
import static google.registry.rde.RdeModule.PARAM_MODE;
|
||||
import static google.registry.rde.RdeModule.PARAM_REVISION;
|
||||
import static google.registry.rde.RdeModule.PARAM_WATERMARKS;
|
||||
import static google.registry.rde.RdeModule.RDE_REPORT_QUEUE;
|
||||
import static google.registry.request.RequestParameters.PARAM_TLDS;
|
||||
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.ParameterException;
|
||||
import com.beust.jcommander.Parameters;
|
||||
import com.google.appengine.api.taskqueue.Queue;
|
||||
import com.google.appengine.api.taskqueue.TaskOptions;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.ImmutableMultimap;
|
||||
import google.registry.model.rde.RdeMode;
|
||||
import google.registry.rde.RdeStagingAction;
|
||||
import google.registry.request.Action.Service;
|
||||
import google.registry.tools.params.DateTimeParameter;
|
||||
import google.registry.util.AppEngineServiceUtils;
|
||||
import google.registry.util.CloudTasksUtils;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/**
|
||||
@@ -94,15 +92,7 @@ final class GenerateEscrowDepositCommand implements CommandWithRemoteApi {
|
||||
|
||||
@Inject AppEngineServiceUtils appEngineServiceUtils;
|
||||
|
||||
@Inject
|
||||
@Named("rde-report")
|
||||
Queue queue;
|
||||
|
||||
// ETA is a required property for TaskOptions but we let the service to set it when submitting the
|
||||
// task to the task queue. However, the local test service doesn't do that for us during the unit
|
||||
// test, so we add this field here to let the unit test be able to inject the ETA to pass the
|
||||
// test.
|
||||
@VisibleForTesting Optional<Long> maybeEtaMillis = Optional.empty();
|
||||
@Inject CloudTasksUtils cloudTasksUtils;
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -126,27 +116,25 @@ final class GenerateEscrowDepositCommand implements CommandWithRemoteApi {
|
||||
throw new ParameterException("Output subdirectory must not be empty");
|
||||
}
|
||||
|
||||
// Unlike many tool commands, this command is actually invoking an action on the backend module
|
||||
// (because it's a mapreduce). So we invoke it in a different way.
|
||||
String hostname = appEngineServiceUtils.getCurrentVersionHostname("backend");
|
||||
TaskOptions opts =
|
||||
withUrl(RdeStagingAction.PATH)
|
||||
.header("Host", hostname)
|
||||
.param(PARAM_MANUAL, String.valueOf(true))
|
||||
.param(PARAM_MODE, mode.toString())
|
||||
.param(PARAM_DIRECTORY, outdir)
|
||||
.param(PARAM_LENIENT, Boolean.toString(lenient))
|
||||
.param(PARAM_BEAM, Boolean.toString(beam))
|
||||
.param(PARAM_TLDS, tlds.stream().collect(Collectors.joining(",")))
|
||||
.param(
|
||||
ImmutableMultimap.Builder<String, String> paramsBuilder =
|
||||
new ImmutableMultimap.Builder<String, String>()
|
||||
.put(PARAM_MANUAL, String.valueOf(true))
|
||||
.put(PARAM_MODE, mode.toString())
|
||||
.put(PARAM_DIRECTORY, outdir)
|
||||
.put(PARAM_LENIENT, Boolean.toString(lenient))
|
||||
.put(PARAM_BEAM, Boolean.toString(beam))
|
||||
.put(PARAM_TLDS, tlds.stream().collect(Collectors.joining(",")))
|
||||
.put(
|
||||
PARAM_WATERMARKS,
|
||||
watermarks.stream().map(DateTime::toString).collect(Collectors.joining(",")));
|
||||
|
||||
if (revision != null) {
|
||||
opts = opts.param(PARAM_REVISION, String.valueOf(revision));
|
||||
paramsBuilder.put(PARAM_REVISION, String.valueOf(revision));
|
||||
}
|
||||
if (maybeEtaMillis.isPresent()) {
|
||||
opts = opts.etaMillis(maybeEtaMillis.get());
|
||||
}
|
||||
queue.add(opts);
|
||||
cloudTasksUtils.enqueue(
|
||||
RDE_REPORT_QUEUE,
|
||||
CloudTasksUtils.createPostTask(
|
||||
RdeStagingAction.PATH, Service.BACKEND.toString(), paramsBuilder.build()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,12 +15,14 @@
|
||||
package google.registry.tools;
|
||||
|
||||
import com.beust.jcommander.Parameters;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.common.DatabaseMigrationStateSchedule;
|
||||
import google.registry.model.common.DatabaseMigrationStateSchedule.MigrationState;
|
||||
import google.registry.model.common.DatabaseMigrationStateSchedule.MigrationStateTransition;
|
||||
import google.registry.model.common.TimedTransitionProperty;
|
||||
|
||||
/** A command to check the current Registry 3.0 migration state of the database. */
|
||||
@DeleteAfterMigration
|
||||
@Parameters(separators = " =", commandDescription = "Check current Registry 3.0 migration state")
|
||||
public class GetDatabaseMigrationStateCommand implements CommandWithRemoteApi {
|
||||
|
||||
|
||||
@@ -20,12 +20,12 @@ import static google.registry.model.ofy.ObjectifyService.auditedOfy;
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
import google.registry.model.EppResource;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.persistence.VKey;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Command to get info on a Datastore resource by websafe key.
|
||||
*/
|
||||
/** Command to get info on a Datastore resource by websafe key. */
|
||||
@DeleteAfterMigration
|
||||
@Parameters(separators = " =", commandDescription = "Fetch a Datastore resource by websafe key")
|
||||
final class GetResourceByKeyCommand implements CommandWithRemoteApi {
|
||||
|
||||
@@ -40,7 +40,7 @@ final class GetResourceByKeyCommand implements CommandWithRemoteApi {
|
||||
boolean expand;
|
||||
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
public void run() {
|
||||
for (String keyString : mainParameters) {
|
||||
System.out.println("\n");
|
||||
VKey<EppResource> resourceKey =
|
||||
|
||||
@@ -19,11 +19,13 @@ import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
import google.registry.model.SchemaVersion;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
/** Generates the schema file used for model versioning. */
|
||||
@DeleteAfterMigration
|
||||
@Parameters(commandDescription = "Generate a model schema file")
|
||||
final class GetSchemaCommand implements Command {
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.googlecode.objectify.annotation.Entity;
|
||||
import com.googlecode.objectify.annotation.EntitySubclass;
|
||||
import com.googlecode.objectify.annotation.Parent;
|
||||
import google.registry.model.BackupGroupRoot;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.annotations.NotBackedUp;
|
||||
import google.registry.model.annotations.VirtualEntity;
|
||||
import java.io.Serializable;
|
||||
@@ -40,6 +41,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/** Visualizes the schema parentage tree. */
|
||||
@DeleteAfterMigration
|
||||
@Parameters(commandDescription = "Generate a model schema file")
|
||||
final class GetSchemaTreeCommand implements Command {
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.google.common.base.Ascii;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import google.registry.export.datastore.DatastoreAdmin;
|
||||
import google.registry.export.datastore.Operation;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -35,6 +36,7 @@ import org.joda.time.Duration;
|
||||
* href="http://playbooks/domain_registry/procedures/backup-restore-testing.md">the playbook</a> for
|
||||
* the entire process.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
@Parameters(separators = " =", commandDescription = "Imports a backup of the Datastore.")
|
||||
public class ImportDatastoreCommand extends ConfirmingCommand {
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.google.api.client.json.JsonFactory;
|
||||
import com.google.api.client.json.jackson2.JacksonFactory;
|
||||
import google.registry.export.datastore.DatastoreAdmin;
|
||||
import google.registry.export.datastore.DatastoreAdmin.ListOperations;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.util.Clock;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
@@ -28,6 +29,7 @@ import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
|
||||
/** Command that lists Datastore operations. */
|
||||
@DeleteAfterMigration
|
||||
@Parameters(separators = " =", commandDescription = "List Datastore operations.")
|
||||
public class ListDatastoreOperationsCommand implements Command {
|
||||
|
||||
|
||||
@@ -26,12 +26,14 @@ import com.google.common.util.concurrent.Futures;
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import google.registry.bigquery.BigqueryUtils.SourceFormat;
|
||||
import google.registry.export.AnnotatedEntities;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/** Command to load Datastore snapshots into Bigquery. */
|
||||
@DeleteAfterMigration
|
||||
@Parameters(separators = " =", commandDescription = "Load Datastore snapshot into Bigquery")
|
||||
final class LoadSnapshotCommand extends BigqueryCommand {
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.google.common.io.CharStreams;
|
||||
import com.google.common.io.Files;
|
||||
import com.googlecode.objectify.Key;
|
||||
import google.registry.model.ImmutableObject;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.domain.DomainBase;
|
||||
import google.registry.persistence.VKey;
|
||||
import google.registry.util.NonFinalForTesting;
|
||||
@@ -40,6 +41,7 @@ import java.util.List;
|
||||
* <p>The key path is the value of column __key__.path of the entity's BigQuery table. Its value is
|
||||
* converted from the entity's key.
|
||||
*/
|
||||
@DeleteAfterMigration
|
||||
abstract class ReadEntityFromKeyPathCommand<T> extends MutatingCommand {
|
||||
|
||||
@Parameter(
|
||||
|
||||
@@ -19,6 +19,7 @@ import dagger.Component;
|
||||
import dagger.Lazy;
|
||||
import google.registry.batch.BatchModule;
|
||||
import google.registry.bigquery.BigqueryModule;
|
||||
import google.registry.config.CloudTasksUtilsModule;
|
||||
import google.registry.config.CredentialModule.LocalCredentialJson;
|
||||
import google.registry.config.RegistryConfig.Config;
|
||||
import google.registry.config.RegistryConfig.ConfigModule;
|
||||
@@ -64,6 +65,7 @@ import javax.inject.Singleton;
|
||||
BigqueryModule.class,
|
||||
ConfigModule.class,
|
||||
CloudDnsWriterModule.class,
|
||||
CloudTasksUtilsModule.class,
|
||||
DatastoreAdminModule.class,
|
||||
DatastoreServiceModule.class,
|
||||
DummyKeyringModule.class,
|
||||
|
||||
@@ -42,7 +42,7 @@ public final class ResaveEntitiesCommand extends MutatingCommand {
|
||||
List<String> mainParameters;
|
||||
|
||||
@Override
|
||||
protected void init() throws Exception {
|
||||
protected void init() {
|
||||
for (List<String> batch : partition(mainParameters, BATCH_SIZE)) {
|
||||
for (String websafeKey : batch) {
|
||||
ImmutableObject entity =
|
||||
|
||||
@@ -19,12 +19,14 @@ import static google.registry.persistence.transaction.TransactionManagerFactory.
|
||||
import com.beust.jcommander.Parameter;
|
||||
import com.beust.jcommander.Parameters;
|
||||
import com.google.common.collect.ImmutableSortedMap;
|
||||
import google.registry.model.annotations.DeleteAfterMigration;
|
||||
import google.registry.model.common.DatabaseMigrationStateSchedule;
|
||||
import google.registry.model.common.DatabaseMigrationStateSchedule.MigrationState;
|
||||
import google.registry.tools.params.TransitionListParameter.MigrationStateTransitions;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** Command to set the Registry 3.0 database migration state schedule. */
|
||||
@DeleteAfterMigration
|
||||
@Parameters(
|
||||
separators = " =",
|
||||
commandDescription = "Set the current database migration state schedule.")
|
||||
|
||||
@@ -16,6 +16,7 @@ package google.registry.tools;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.collect.ImmutableSet.toImmutableSet;
|
||||
import static google.registry.model.tld.label.PremiumListUtils.parseToPremiumList;
|
||||
import static google.registry.persistence.transaction.TransactionManagerFactory.jpaTm;
|
||||
import static google.registry.util.ListNamingUtils.convertFilePathToName;
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
@@ -27,7 +28,6 @@ import com.google.common.collect.Streams;
|
||||
import google.registry.model.tld.label.PremiumList;
|
||||
import google.registry.model.tld.label.PremiumList.PremiumEntry;
|
||||
import google.registry.model.tld.label.PremiumListDao;
|
||||
import google.registry.model.tld.label.PremiumListUtils;
|
||||
import java.nio.file.Files;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -45,11 +45,11 @@ class UpdatePremiumListCommand extends CreateOrUpdatePremiumListCommand {
|
||||
String.format("Could not update premium list %s because it doesn't exist.", name));
|
||||
List<String> existingEntry = getExistingPremiumEntry(list.get()).asList();
|
||||
inputData = Files.readAllLines(inputFile, UTF_8);
|
||||
checkArgument(!inputData.isEmpty(), "New premium list data cannot be empty");
|
||||
currency = list.get().getCurrency();
|
||||
// reconstructing existing premium list to bypass Hibernate lazy initialization exception
|
||||
PremiumList existingPremiumList =
|
||||
PremiumListUtils.parseToPremiumList(name, currency, existingEntry);
|
||||
PremiumList updatedPremiumList = PremiumListUtils.parseToPremiumList(name, currency, inputData);
|
||||
PremiumList existingPremiumList = parseToPremiumList(name, currency, existingEntry);
|
||||
PremiumList updatedPremiumList = parseToPremiumList(name, currency, inputData);
|
||||
|
||||
return String.format(
|
||||
"Update premium list for %s?\n Old List: %s\n New List: %s",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user