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


Java DocumentDeleteOptions类代码示例

本文整理汇总了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();
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:19,代码来源:ArangoCollectionTest.java

示例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();
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:16,代码来源:ArangoCollectionTest.java

示例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) {
	}
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:13,代码来源:ArangoCollectionTest.java

示例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;
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver,代码行数:11,代码来源:InternalArangoCollection.java

示例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;
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver,代码行数:11,代码来源:InternalArangoCollection.java

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

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

示例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) {
	}
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver,代码行数:13,代码来源:ArangoCollectionTest.java

示例9: delete

import com.arangodb.model.DocumentDeleteOptions; //导入依赖的package包/类
public int delete(String key, DocumentDeleteOptions options) {
    DocumentDeleteEntity deleteEntity = collection()
            .deleteDocument(key, _entityType, options);
    return 1;
}
 
开发者ID:febit,项目名称:febit,代码行数:6,代码来源:ArangoDao.java

示例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));
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:21,代码来源:ArangoCollectionAsync.java

示例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));
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver-async,代码行数:22,代码来源:ArangoCollectionAsync.java

示例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));
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver,代码行数:22,代码来源:ArangoCollection.java

示例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));
}
 
开发者ID:arangodb,项目名称:arangodb-java-driver,代码行数:23,代码来源:ArangoCollection.java


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