Get rid of the delete() method on ReservedList

It wasn't being used by any actual code, and having helper methods handling
saving/persistence on entities like this is not a pattern we want to encourage,
since it hides Datastore transactions from further up in the call chain. The
idea is that you can always look for ofy() calls in the same layer of code to
see where persisted data is being changed.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=143036027
This commit is contained in:
mcilwain 2016-12-27 09:17:01 -08:00 committed by Ben McIlwain
parent 28f6c770c8
commit 48a1bacbb0
2 changed files with 0 additions and 32 deletions

View file

@ -16,7 +16,6 @@ package google.registry.model.registry.label;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import static google.registry.model.common.EntityGroupRoot.getCrossTldKey;
import static google.registry.model.ofy.ObjectifyService.ofy;
import static google.registry.model.ofy.Ofy.RECOMMENDED_MEMCACHE_EXPIRATION;
@ -36,7 +35,6 @@ import com.google.common.collect.ImmutableSet;
import com.google.common.net.InternetDomainName;
import com.google.common.util.concurrent.UncheckedExecutionException;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.VoidWork;
import com.googlecode.objectify.annotation.Cache;
import com.googlecode.objectify.annotation.Embed;
import com.googlecode.objectify.annotation.Entity;
@ -234,22 +232,6 @@ public final class ReservedList
return ofy().load().type(ReservedList.class).parent(getCrossTldKey()).id(listName).now();
}});
/** Deletes the ReservedList with the given name. */
public static void delete(final String listName) {
final ReservedList reservedList = ReservedList.get(listName).orNull();
checkState(
reservedList != null,
"Attempted to delete reserved list %s which doesn't exist",
listName);
ofy().transactNew(new VoidWork() {
@Override
public void vrun() {
ofy().delete().entity(reservedList).now();
}
});
cache.invalidate(listName);
}
/**
* Gets the {@link ReservationType} of a label in a single ReservedList, or returns an absent
* Optional if none exists in the list.