本文整理了Java中com.googlecode.objectify.Objectify.delete()
方法的一些代码示例,展示了Objectify.delete()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Objectify.delete()
方法的具体详情如下:
包路径:com.googlecode.objectify.Objectify
类名称:Objectify
方法名:delete
[英]Start a delete command chain. Lets you delete entities or keys.
Deletes do NOT cascade; if you wish to delete an object graph, you must delete each individual entity.
A quick example: ofy().delete().entities(e1, e2, e3).now();
All command objects are immutable; this method returns a new object rather than modifying the current command object.
[中]
代码示例来源:origin: objectify/objectify
public void flush() {
final List<Result<?>> futures = new ArrayList<>();
// Need to do this in a loop because @OnSave methods can enlist more deferred operations. Execution
// of save or delete will undefer() all the relevant items, so both lists empty mean we're done.
while (!operations.isEmpty() || !autogeneratedIdSaves.isEmpty()) {
// Sort into two batch operations: one for save, one for delete.
final List<Object> saves = new ArrayList<>();
final List<Key<?>> deletes = new ArrayList<>();
for (final Map.Entry<Key<?>, Object> entry : operations.entrySet()) {
if (entry.getValue() == null)
deletes.add(entry.getKey());
else
saves.add(entry.getValue());
}
saves.addAll(autogeneratedIdSaves);
if (!saves.isEmpty())
futures.add(ofy.save().entities(saves));
if (!deletes.isEmpty())
futures.add(ofy.delete().keys(deletes));
}
// Complete any pending operations
for (final Result<?> future : futures) {
future.now();
}
}
代码示例来源:origin: com.googlecode.cedar-common/objectify
@Override
public <T> void delete(Class<T> clazz, long id)
{
this.base.delete(clazz, id);
}
代码示例来源:origin: com.googlecode.cedar-common/objectify
@Override
public void delete(Object... keysOrEntities)
{
this.base.delete(keysOrEntities);
}
代码示例来源:origin: com.googlecode.cedar-common/objectify
@Override
public void delete(Iterable<?> keysOrEntities)
{
this.base.delete(keysOrEntities);
}
代码示例来源:origin: com.googlecode.cedar-common/objectify
@Override
public <T> void delete(Class<T> clazz, String name)
{
this.base.delete(clazz, name);
}
代码示例来源:origin: stackoverflow.com
public void deleteMyObjects(Long[] ids) {
Objectify txn = null;
try {
txn = txn();
List<Key<MyObject>> keys = new ArrayList<Key<MyObject>>();
for (long id : ids) {
keys.add(new Key<MyObject>(MyObject.class, id));
}
txn.delete(keys);
commit(txn);
} finally {
rollbackIfNeeded(txn);
}
}
代码示例来源:origin: ArcBees/GWTP
public void delete(T entity) {
ofy().delete().entity(entity);
}
代码示例来源:origin: com.gwtplatform/gwtp-crawler-service
public void delete(T entity) {
ofy().delete().entity(entity);
}
代码示例来源:origin: com.threewks.thundr/thundr-gae
protected Result<Void> deleteInternal(Key<E> key) {
return ofy().delete().key(key);
}
代码示例来源:origin: com.threewks.thundr/thundr-gae
protected Result<Void> deleteInternal(Iterable<Key<E>> keys) {
return ofy().delete().keys(keys);
}
代码示例来源:origin: TEAMMATES/teammates
println(String.format("Skip creation of new account as account (%s) already exists", newGoogleId));
ofy().delete().type(Account.class).id(oldGoogleId).now();
oldStudentProfile.setPictureKey(oldPictureKey);
ofy().save().entity(oldStudentProfile).now();
ofy().delete().key(oldStudentProfileKey).now();
代码示例来源:origin: com.googlecode.luceneappengine/luceneappengine
@Override
public Void run() {
Objectify objectify = ofy();
for(String name : listAll())
deleteSegment(objectify, name);
objectify.delete().key(indexKey);
objectify.delete().entities(((GaeLockFactory)lockFactory).getLocks(GaeDirectory.this));
return null;
}
});
代码示例来源:origin: omerio/appstart
public void remove() {
ofy().delete().entity(this).now();
}
代码示例来源:origin: omerio/appstart
public static void removeAll(List<Todo> todos) {
ofy().delete().entities(todos).now();
}
代码示例来源:origin: com.googlecode.luceneappengine/luceneappengine
/**
* Delete the segment using the specified {@link Objectify} useful for transaction.
* @param objectify The {@link Objectify} to use
* @param name The name of the segment to delete
*/
protected void deleteSegment(final Objectify objectify, final String name) {
final Key<Segment> segmentKey = newSegmentKey(name);
final Segment segment = objectify.load().key(segmentKey).now();
objectify.delete().keys(segment.getHunkKeys(segmentKey));
objectify.delete().key(segmentKey);
}
代码示例来源:origin: com.googlecode.luceneappengine/luceneappengine
@Override
public void deleteFile(String name) {
final Objectify objectify = ofy();
final Segment segment = objectify.load().key(newSegmentKey(name)).now();
final long hunkCount = segment.hunkCount;
for (int i = 1; i <= hunkCount; i++) {
objectify.delete().key(newSegmentHunkKey(name, i));
}
objectify.delete().key(newSegmentKey(name));
}
@Override
代码示例来源:origin: com.threewks.thundr/thundr-gae
@Override
public AsyncResult<Void> deleteAsync(E e) {
final Result<Void> ofyDelete = ofy().delete().entity(e);
final IndexOperation searchDelete = shouldSearch() ? searchService.removeById(Key.create(e)) : null;
return new AsyncResult<Void>() {
@Override
public Void complete() {
ofyDelete.now();
if (searchDelete != null) {
searchDelete.complete();
}
return null;
}
};
}
代码示例来源:origin: com.threewks.thundr/thundr-gae
@Override
public AsyncResult<Void> deleteAsync(Iterable<E> entities) {
final Result<Void> ofyDelete = ofy().delete().entities(entities);
final IndexOperation searchDelete = shouldSearch() ? searchService.removeById(toKeysFromEntities.from(entities)) : null;
return new AsyncResult<Void>() {
@Override
public Void complete() {
ofyDelete.now();
if (searchDelete != null) {
searchDelete.complete();
}
return null;
}
};
}
代码示例来源:origin: instacount/appengine-counter
ObjectifyService.ofy().transactionless().delete().type(CounterShardOperationData.class)
.parent(counterShardDataKey);
ObjectifyService.ofy().transactionless().delete().keys(counterShardDataKeys).now();
ObjectifyService.ofy().transactionless().delete().key(counterData.getTypedKey()).now();
代码示例来源:origin: bedatadriven/activityinfo
@Override
public void vrun() {
FormEntity rootEntity = new FormEntity();
rootEntity.setId(activity.getSiteFormClassId());
rootEntity.setVersion(activity.getVersion());
rootEntity.setSchemaVersion(activity.getActivityVersion().getSchemaVersion());
FormRecordEntity recordEntity = new FormRecordEntity(activity.getSiteFormClassId(), update.getRecordId());
recordEntity.setVersion(newVersion);
recordEntity.setSchemaVersion(activity.getActivityVersion().getSchemaVersion());
recordEntity.setFieldValues(getFormClass(), values);
FormRecordSnapshotEntity snapshot = new FormRecordSnapshotEntity(update.getUserId(), changeType, recordEntity);
if (changeType == RecordChangeType.DELETED) {
ofy().save().entities(rootEntity, snapshot);
ofy().delete().entities(recordEntity);
} else {
ofy().save().entities(rootEntity, recordEntity, snapshot);
}
}
});
内容来源于网络,如有侵权,请联系作者删除!