/** * Deletes entities corresponding to the specified {@code Key}s from App * Engine Datastore within the specified {@code Transaction}. * * @param transaction The transaction to delete entities. * @param keys The {@code Key}s corresponding to the entities to be deleted. */ public void delete(Transaction transaction, Key... keys) { datastore.delete(transaction, keys); }
/** * Deletes entities corresponding to the specified {@code Key}s from App * Engine Datastore within the specified {@code Transaction}. * * @param transaction The transaction to delete entities. * @param keys The {@code Key}s corresponding to the entities to be deleted. */ public void delete(Transaction transaction, Iterable<Key> keys) { datastore.delete(transaction, keys); }
@Override public void deleteUser(String username) { Key userKey = KeyFactory.createKey(AUTH_FLOWS_USER_DB_KIND, username); datastore.delete(userKey); }
@Override public void delete(Collection<Entity> rows) { List<Key> keys = new ArrayList<>(); for (Entity entity : rows) { keys.add(entity.getKey()); } datastore.delete(keys); }
@Override public void delete(Entity row) { datastore.delete(row.getKey()); }
public String deleteStockName(String stockName) { DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); Filter f = new FilterPredicate("Name", FilterOperator.EQUAL, stockName); Query q = new Query("Stocks").setFilter(f).setKeysOnly(); List<Entity> results = ds.prepare(q) .asList(FetchOptions.Builder.withDefaults()); if (results.isEmpty()) return "Not Found!"; ds.delete(results.get(0).getKey()); return "OK"; }
@Override public void delete(String userId, Credential credential) { DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); Key key = KeyFactory.createKey(KIND, userId); datastore.delete(key); }
public void delete(Transaction transaction, Key... keys) { try { inner.delete(transaction, keys); } catch (IllegalArgumentException e) { throw wrapIllegalArgumentException(e); } catch (ConcurrentModificationException e) { throw wrapConcurrentModificationException(e); } catch (DatastoreFailureException e) { throw wrapDatastoreFailureException(e); } }
public void delete(Transaction transaction, Iterable<Key> keyIterable) { try { inner.delete(transaction, keyIterable); } catch (IllegalArgumentException e) { throw wrapIllegalArgumentException(e); } catch (ConcurrentModificationException e) { throw wrapConcurrentModificationException(e); } catch (DatastoreFailureException e) { throw wrapDatastoreFailureException(e); } }
public void delete(Iterable<Key> keyIterable) { try { inner.delete(keyIterable); } catch (IllegalArgumentException e) { throw wrapIllegalArgumentException(e); } catch (ConcurrentModificationException e) { throw wrapConcurrentModificationException(e); } catch (DatastoreFailureException e) { throw wrapDatastoreFailureException(e); } }
public void delete(Key... keys) { try { inner.delete(keys); } catch (IllegalArgumentException e) { throw wrapIllegalArgumentException(e); } catch (ConcurrentModificationException e) { throw wrapConcurrentModificationException(e); } catch (DatastoreFailureException e) { throw wrapDatastoreFailureException(e); } }
private void deleteEntityList(List<Entity> entities) { List<Key> keys = new ArrayList<Key>(); for (Entity entity : entities) { keys.add(entity.getKey()); } service.delete(keys); }
String name = "Paul"; int age =19; DatastoreService service= DatastoreServiceFactory.getDatastoreService(); Entity entity = new Entity("Person",1); entity.setProperty("name",name); entity.setProperty("alter",age); service.put(entity); service.delete()
@After @Override public void tearDown() { for (Set<Entity> entities2 : entities) { for (Entity entity : entities2) { service.delete(entity.getKey()); } } super.tearDown(); }
private void clearTestData() { DatastoreService ds = DatastoreServiceFactory.getDatastoreService(); Query query = new Query("XmppMsg"); List<Key> msgs = new ArrayList<>(); for (Entity e : ds.prepare(query).asIterable()) { msgs.add(e.getKey()); } ds.delete(msgs); }
@Before public void clearData() { asyncService = DatastoreServiceFactory.getAsyncDatastoreService(); List<Key> elist = new ArrayList<Key>(); Query query = new Query(ASYNC_ENTITY); for (Entity readRec : service.prepare(query).asIterable()) { elist.add(readRec.getKey()); } service.delete(elist); }
@Test public void queriesDontReturnDeletedEntities() throws Exception { String methodName = "queriesDontReturnDeletedEntities"; Entity entity = createTestEntityWithUniqueMethodNameKey(SMOKE_TEST_ENTITY, methodName); Key key = entity.getKey(); service.put(entity); service.delete(key); List<Entity> entities = service.prepare(new Query(SMOKE_TEST_ENTITY).setAncestor(key)) .asList(FetchOptions.Builder.withDefaults()); assertEquals(0, entities.size()); }
@After public void tearDown() { List<Entity> entities = service.prepare(new Query(TEST_ENTITY_KIND).setKeysOnly()).asList(withDefaults()); for (Entity entity : entities) { service.delete(entity.getKey()); } }
@Test public void testIntegerPropertySortingIsNotLexicographic() throws Exception { String methodName = "testIntegerPropertySortingIsNotLexicographic"; Entity parent = createTestEntityWithUniqueMethodNameKey(QUERY_SORTING_ENTITY, methodName); Key key = parent.getKey(); Entity ten = storeTestEntityWithSingleProperty(key, 10); Entity five = storeTestEntityWithSingleProperty(key, 5); Query query = createQuery().setAncestor(key).addSort(SINGLE_PROPERTY_NAME, ASCENDING); List<Entity> results = service.prepare(query).asList(withDefaults()); assertTrue(results.indexOf(five) < results.indexOf(ten)); // if sorting were lexicographic, "10" would come before "5" service.delete(ten.getKey(), five.getKey()); }
public void purgeTestRunRecords() { DatastoreService datastoreService = DatastoreServiceFactory. getDatastoreService(); FilterPredicate testRunFilter = new FilterPredicate(TEST_RUN_ID, FilterOperator.EQUAL, testRunId); Query query = new Query(entityName).setFilter(testRunFilter).setKeysOnly(); for (Entity readRec : datastoreService.prepare(query).asIterable()) { datastoreService.delete(readRec.getKey()); } }