当前位置: 首页>>代码示例>>Java>>正文


Java DatastoreService.delete方法代码示例

本文整理汇总了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);
}
 
开发者ID:deniotokiari,项目名称:training-epam-2016,代码行数:9,代码来源:StoreServlet.java

示例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();
}
 
开发者ID:fasthall,项目名称:amazon-price-tracker,代码行数:39,代码来源:Wishlist.java

示例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();
	}
}
 
开发者ID:fasthall,项目名称:amazon-price-tracker,代码行数:12,代码来源:WishlistProductResource.java

示例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();
}
 
开发者ID:fasthall,项目名称:amazon-price-tracker,代码行数:35,代码来源:DeleteWishlistProduct.java

示例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());
}
 
开发者ID:kerafill1116,项目名称:apollo-datastore,代码行数:10,代码来源:SessionFactory.java

示例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);
}
 
开发者ID:GoogleCloudPlatform,项目名称:java-docs-samples,代码行数:14,代码来源:GuestbookTestUtilities.java

示例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);
}
 
开发者ID:GoogleCloudPlatform,项目名称:java-docs-samples,代码行数:15,代码来源:GuestbookTestUtilities.java

示例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());
}
 
开发者ID:kerafill1116,项目名称:apollo-datastore,代码行数:6,代码来源:SessionLogFactory.java

示例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());
}
 
开发者ID:kerafill1116,项目名称:apollo-datastore,代码行数:6,代码来源:ResetPasswordRequestFactory.java

示例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());
}
 
开发者ID:kerafill1116,项目名称:apollo-datastore,代码行数:6,代码来源:ChangeEmailAddressRequestFactory.java


注:本文中的com.google.appengine.api.datastore.DatastoreService.delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。