All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.yawp.repository.tools.DeleteAll Maven / Gradle / Ivy

There is a newer version: 2.08alpha
Show newest version
package io.yawp.repository.tools;

import com.google.appengine.api.NamespaceManager;
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.PreparedQuery;
import com.google.appengine.api.datastore.Query;

public class DeleteAll {

	public static void now(String ns) {
		NamespaceManager.set(ns);
		now();
	}

	public static void now() {
		DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
		Query query = new Query();
		PreparedQuery pq = datastore.prepare(query);
		for (Entity entity : pq.asIterable()) {
			datastore.delete(entity.getKey());
		}
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy