本文整理汇总了Java中com.arangodb.model.DocumentDeleteOptions类的典型用法代码示例。如果您正苦于以下问题:Java DocumentDeleteOptions类的具体用法?Java DocumentDeleteOptions怎么用?Java DocumentDeleteOptions使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DocumentDeleteOptions类属于com.arangodb.model包,在下文中一共展示了DocumentDeleteOptions类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteDocumentReturnOld
import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
@Test
public void deleteDocumentReturnOld() throws InterruptedException, ExecutionException {
final BaseDocument doc = new BaseDocument();
doc.addAttribute("a", "test");
final DocumentCreateEntity<BaseDocument> createResult = db.collection(COLLECTION_NAME).insertDocument(doc, null)
.get();
final DocumentDeleteOptions options = new DocumentDeleteOptions().returnOld(true);
final CompletableFuture<DocumentDeleteEntity<BaseDocument>> f = db.collection(COLLECTION_NAME)
.deleteDocument(createResult.getKey(), BaseDocument.class, options);
assertThat(f, is(notNullValue()));
f.whenComplete((deleteResult, ex) -> {
assertThat(deleteResult.getOld(), is(notNullValue()));
assertThat(deleteResult.getOld(), instanceOf(BaseDocument.class));
assertThat(deleteResult.getOld().getAttribute("a"), is(notNullValue()));
assertThat(String.valueOf(deleteResult.getOld().getAttribute("a")), is("test"));
});
f.get();
}
示例2: deleteDocumentIfMatch
import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
@Test
public void deleteDocumentIfMatch() throws InterruptedException, ExecutionException {
final BaseDocument doc = new BaseDocument();
final DocumentCreateEntity<BaseDocument> createResult = db.collection(COLLECTION_NAME).insertDocument(doc, null)
.get();
final DocumentDeleteOptions options = new DocumentDeleteOptions().ifMatch(createResult.getRev());
db.collection(COLLECTION_NAME).deleteDocument(createResult.getKey(), null, options).get();
final CompletableFuture<BaseDocument> f = db.collection(COLLECTION_NAME).getDocument(createResult.getKey(),
BaseDocument.class, null);
assertThat(f, is(notNullValue()));
f.whenComplete((document, ex) -> {
assertThat(document, is(nullValue()));
});
f.get();
}
示例3: deleteDocumentIfMatchFail
import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
@Test
public void deleteDocumentIfMatchFail() throws InterruptedException, ExecutionException {
final BaseDocument doc = new BaseDocument();
final DocumentCreateEntity<BaseDocument> createResult = db.collection(COLLECTION_NAME).insertDocument(doc, null)
.get();
final DocumentDeleteOptions options = new DocumentDeleteOptions().ifMatch("no");
try {
db.collection(COLLECTION_NAME).deleteDocument(createResult.getKey(), null, options).get();
fail();
} catch (final Exception e) {
}
}
示例4: deleteDocumentRequest
import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
protected Request deleteDocumentRequest(final String key, final DocumentDeleteOptions options) {
final Request request;
request = new Request(db.name(), RequestType.DELETE,
executor.createPath(ArangoDBConstants.PATH_API_DOCUMENT, executor.createDocumentHandle(name, key)));
final DocumentDeleteOptions params = (options != null ? options : new DocumentDeleteOptions());
request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC, params.getWaitForSync());
request.putQueryParam(ArangoDBConstants.RETURN_OLD, params.getReturnOld());
request.putHeaderParam(ArangoDBConstants.IF_MATCH, params.getIfMatch());
return request;
}
示例5: deleteDocumentsRequest
import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
protected <T> Request deleteDocumentsRequest(final Collection<T> keys, final DocumentDeleteOptions options) {
final Request request;
request = new Request(db.name(), RequestType.DELETE,
executor.createPath(ArangoDBConstants.PATH_API_DOCUMENT, name));
final DocumentDeleteOptions params = (options != null ? options : new DocumentDeleteOptions());
request.putQueryParam(ArangoDBConstants.WAIT_FOR_SYNC, params.getWaitForSync());
request.putQueryParam(ArangoDBConstants.RETURN_OLD, params.getReturnOld());
request.setBody(util().serialize(keys));
return request;
}
示例6: deleteDocumentReturnOld
import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
@Test
public void deleteDocumentReturnOld() {
final BaseDocument doc = new BaseDocument();
doc.addAttribute("a", "test");
final DocumentCreateEntity<BaseDocument> createResult = db.collection(COLLECTION_NAME).insertDocument(doc,
null);
final DocumentDeleteOptions options = new DocumentDeleteOptions().returnOld(true);
final DocumentDeleteEntity<BaseDocument> deleteResult = db.collection(COLLECTION_NAME)
.deleteDocument(createResult.getKey(), BaseDocument.class, options);
assertThat(deleteResult.getOld(), is(notNullValue()));
assertThat(deleteResult.getOld(), instanceOf(BaseDocument.class));
assertThat(deleteResult.getOld().getAttribute("a"), is(notNullValue()));
assertThat(String.valueOf(deleteResult.getOld().getAttribute("a")), is("test"));
}
示例7: deleteDocumentIfMatch
import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
@Test
public void deleteDocumentIfMatch() {
final BaseDocument doc = new BaseDocument();
final DocumentCreateEntity<BaseDocument> createResult = db.collection(COLLECTION_NAME).insertDocument(doc,
null);
final DocumentDeleteOptions options = new DocumentDeleteOptions().ifMatch(createResult.getRev());
db.collection(COLLECTION_NAME).deleteDocument(createResult.getKey(), null, options);
final BaseDocument document = db.collection(COLLECTION_NAME).getDocument(createResult.getKey(),
BaseDocument.class, null);
assertThat(document, is(nullValue()));
}
示例8: deleteDocumentIfMatchFail
import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
@Test
public void deleteDocumentIfMatchFail() {
final BaseDocument doc = new BaseDocument();
final DocumentCreateEntity<BaseDocument> createResult = db.collection(COLLECTION_NAME).insertDocument(doc,
null);
final DocumentDeleteOptions options = new DocumentDeleteOptions().ifMatch("no");
try {
db.collection(COLLECTION_NAME).deleteDocument(createResult.getKey(), null, options);
fail();
} catch (final ArangoDBException e) {
}
}
示例9: delete
import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
public int delete(String key, DocumentDeleteOptions options) {
DocumentDeleteEntity deleteEntity = collection()
.deleteDocument(key, _entityType, options);
return 1;
}
示例10: deleteDocument
import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
/**
* Removes a document
*
* @see <a href="https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#removes-a-document">API
* Documentation</a>
* @param key
* The key of the document
* @param type
* The type of the document (POJO class, VPackSlice or String for Json). Only necessary if
* options.returnOld is set to true, otherwise can be null.
* @param options
* Additional options, can be null
* @return information about the document
*/
public <T> CompletableFuture<DocumentDeleteEntity<T>> deleteDocument(
final String key,
final Class<T> type,
final DocumentDeleteOptions options) {
return executor.execute(deleteDocumentRequest(key, options), deleteDocumentResponseDeserializer(type));
}
示例11: deleteDocuments
import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
/**
* Removes multiple document
*
* @see <a href=
* "https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#removes-multiple-documents">API
* Documentation</a>
* @param values
* The keys of the documents or the documents themselves
* @param type
* The type of the documents (POJO class, VPackSlice or String for Json). Only necessary if
* options.returnOld is set to true, otherwise can be null.
* @param options
* Additional options, can be null
* @return information about the documents
*/
public <T> CompletableFuture<MultiDocumentEntity<DocumentDeleteEntity<T>>> deleteDocuments(
final Collection<?> values,
final Class<T> type,
final DocumentDeleteOptions options) {
return executor.execute(deleteDocumentsRequest(values, options), deleteDocumentsResponseDeserializer(type));
}
示例12: deleteDocument
import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
/**
* Removes a document
*
* @see <a href="https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#removes-a-document">API
* Documentation</a>
* @param key
* The key of the document
* @param type
* The type of the document (POJO class, VPackSlice or String for Json). Only necessary if
* options.returnOld is set to true, otherwise can be null.
* @param options
* Additional options, can be null
* @return information about the document
* @throws ArangoDBException
*/
public <T> DocumentDeleteEntity<T> deleteDocument(
final String key,
final Class<T> type,
final DocumentDeleteOptions options) throws ArangoDBException {
return executor.execute(deleteDocumentRequest(key, options), deleteDocumentResponseDeserializer(type));
}
示例13: deleteDocuments
import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
/**
* Removes multiple document
*
* @see <a href=
* "https://docs.arangodb.com/current/HTTP/Document/WorkingWithDocuments.html#removes-multiple-documents">API
* Documentation</a>
* @param values
* The keys of the documents or the documents themselves
* @param type
* The type of the documents (POJO class, VPackSlice or String for Json). Only necessary if
* options.returnOld is set to true, otherwise can be null.
* @param options
* Additional options, can be null
* @return information about the documents
* @throws ArangoDBException
*/
public <T> MultiDocumentEntity<DocumentDeleteEntity<T>> deleteDocuments(
final Collection<?> values,
final Class<T> type,
final DocumentDeleteOptions options) throws ArangoDBException {
return executor.execute(deleteDocumentsRequest(values, options), deleteDocumentsResponseDeserializer(type));
}