本文整理汇总了Java中com.google.appengine.api.datastore.DatastoreService.delete方法的典型用法代码示例。如果您正苦于以下问题:Java DatastoreService.delete方法的具体用法?Java DatastoreService.delete怎么用?Java DatastoreService.delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.appengine.api.datastore.DatastoreService
的用法示例。
在下文中一共展示了DatastoreService.delete方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteAllObjects
import com.google.appengine.api.datastore.DatastoreService; //导入方法依赖的package包/类
public void deleteAllObjects(Query query){
final DatastoreService dss=DatastoreServiceFactory.getDatastoreService();
final ArrayList<Key> keys=new ArrayList<>();
for ( final Entity entity : dss.prepare(query).asIterable(FetchOptions.Builder.withLimit(100000))) {
keys.add(entity.getKey());
}
dss.delete(keys);
}
示例2: deleteWishlistProduct
import com.google.appengine.api.datastore.DatastoreService; //导入方法依赖的package包/类
@DELETE
@Produces(MediaType.TEXT_HTML)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public void deleteWishlistProduct(@FormParam("productID") String productID,
@Context HttpServletResponse servletResponse) throws Exception {
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if (user == null) {
System.out.println("Login first");
return;
}
DatastoreService datastore = DatastoreServiceFactory
.getDatastoreService();
// MemcacheService syncCache =
// MemcacheServiceFactory.getMemcacheService();
Key entKey = KeyFactory.createKey(user.getEmail(), productID);
try {
datastore.delete(entKey);
// syncCache.delete(productID);
} catch (Exception e) {
e.printStackTrace();
}
servletResponse.getWriter().println("<html><head>");
servletResponse
.getWriter()
.println(
"<meta http-equiv=\"refresh\" content=\"3;url=/wishlist.jsp\" />");
servletResponse.getWriter().println("</head><body>");
servletResponse.getWriter().println(
"<h1>" + productID + " has been deleted.</h1><br>");
servletResponse
.getWriter()
.println(
"<h2>Redirecting in 3 seconds...</h2> <a href=\"/wishlist.jsp\">Go back now</a>");
servletResponse.getWriter().println("</body></html>");
servletResponse.flushBuffer();
}
示例3: delete
import com.google.appengine.api.datastore.DatastoreService; //导入方法依赖的package包/类
@DELETE
public void delete() {
DatastoreService datastore = DatastoreServiceFactory
.getDatastoreService();
Key entKey = KeyFactory.createKey(email, productID);
try {
datastore.delete(entKey);
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: doPost
import com.google.appengine.api.datastore.DatastoreService; //导入方法依赖的package包/类
protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
String productID = request.getParameter("productID");
// Check if login
UserService userService = UserServiceFactory.getUserService();
User user = userService.getCurrentUser();
if (user == null) {
response.getWriter().println("Login first.");
} else {
// delete the entry
DatastoreService datastore = DatastoreServiceFactory
.getDatastoreService();
Key entKey = KeyFactory.createKey(user.getEmail(), productID);
try {
datastore.delete(entKey);
} catch (Exception e) {
e.printStackTrace();
}
response.getWriter().println("<html><head>");
response.getWriter()
.println(
"<meta http-equiv=\"refresh\" content=\"3;url=/wishlist.jsp\" />");
response.getWriter().println("</head><body>");
response.getWriter().println(
"<h1>" + productID + " has been deleted.</h1><br>");
response.getWriter()
.println(
"<h2>Redirecting in 3 seconds...</h2> <a href=\"/\">Go back now</a>");
response.getWriter().println("</body></html>");
response.flushBuffer();
}
response.flushBuffer();
}
示例5: disconnect
import com.google.appengine.api.datastore.DatastoreService; //导入方法依赖的package包/类
public static void disconnect(DatastoreService datastore, Transaction txn, Session session, Date dateSignedOut, CauseOfDisconnect causeOfDisconnect)
throws ConcurrentModificationException {
SessionLog sessionLog = new SessionLog(session);
sessionLog.setDateSignedOut(dateSignedOut);
sessionLog.setCauseOfDisconnect(causeOfDisconnect);
SessionLogFactory.add(datastore, txn, sessionLog);
datastore.delete(txn, session.getKey());
}
示例6: cleanDatastore
import com.google.appengine.api.datastore.DatastoreService; //导入方法依赖的package包/类
public static void cleanDatastore(DatastoreService ds, String book) {
Query query = new Query("Greeting")
.setAncestor(new KeyFactory.Builder("Guestbook", book)
.getKey()).setKeysOnly();
PreparedQuery pq = ds.prepare(query);
List<Entity> entities = pq.asList(FetchOptions.Builder.withDefaults());
ArrayList<Key> keys = new ArrayList<>(entities.size());
for (Entity e : entities) {
keys.add(e.getKey());
}
ds.delete(keys);
}
示例7: cleanDatastore
import com.google.appengine.api.datastore.DatastoreService; //导入方法依赖的package包/类
public static void cleanDatastore(DatastoreService ds, String book) {
Query query =
new Query("Greeting")
.setAncestor(new KeyFactory.Builder("Guestbook", book).getKey())
.setKeysOnly();
PreparedQuery pq = ds.prepare(query);
List<Entity> entities = pq.asList(FetchOptions.Builder.withDefaults());
ArrayList<Key> keys = new ArrayList<>(entities.size());
for (Entity e : entities) {
keys.add(e.getKey());
}
ds.delete(keys);
}
示例8: remove
import com.google.appengine.api.datastore.DatastoreService; //导入方法依赖的package包/类
public static void remove(DatastoreService datastore, Transaction txn, SessionLog sessionLog)
throws ConcurrentModificationException {
datastore.delete(txn, sessionLog.getKey());
}
示例9: remove
import com.google.appengine.api.datastore.DatastoreService; //导入方法依赖的package包/类
public static void remove(DatastoreService datastore, Transaction txn, ResetPasswordRequest resetPasswordRequest)
throws ConcurrentModificationException {
datastore.delete(txn, resetPasswordRequest.getKey());
}
示例10: remove
import com.google.appengine.api.datastore.DatastoreService; //导入方法依赖的package包/类
public static void remove(DatastoreService datastore, Transaction txn, ChangeEmailAddressRequest changeEmailAddressRequest)
throws ConcurrentModificationException {
datastore.delete(txn, changeEmailAddressRequest.getKey());
}