本文整理汇总了Java中com.couchbase.client.java.document.Document类的典型用法代码示例。如果您正苦于以下问题:Java Document类的具体用法?Java Document怎么用?Java Document使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Document类属于com.couchbase.client.java.document包,在下文中一共展示了Document类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: upsert
import com.couchbase.client.java.document.Document; //导入依赖的package包/类
@Override
public Tt upsert(Tt tt) {
JsonObject content = JsonObject.fromJson(gson.toJson(tt));
content.put(DOCTYPE_KEY, DOCTYPE_TT);
Document<?> document = JsonDocument.create(tt.getId().toString(), content);
bucket.upsert(document);
return tt;
}
开发者ID:maxcleme,项目名称:f4f-tts,代码行数:9,代码来源:CouchbaseTtsDao.java
示例2: toDocument
import com.couchbase.client.java.document.Document; //导入依赖的package包/类
private <T> Document<T> toDocument(final Object obj) {
final Class<?> cls = obj.getClass();
if (Document.class.isAssignableFrom(cls)) {
return (Document<T>) obj;
} else {
return (Document<T>) toJsonDocument(obj);
}
}
开发者ID:landawn,项目名称:AbacusUtil,代码行数:10,代码来源:CouchbaseExecutor.java
示例3: toEntityForUpdate
import com.couchbase.client.java.document.Document; //导入依赖的package包/类
private <T> T toEntityForUpdate(Class<T> cls, final Document<?> document) {
if (cls.isAssignableFrom(document.getClass())) {
return (T) document;
} else {
return toEntity(cls, (JsonDocument) document);
}
}
开发者ID:landawn,项目名称:AbacusUtil,代码行数:8,代码来源:CouchbaseExecutor.java
示例4: startImport
import com.couchbase.client.java.document.Document; //导入依赖的package包/类
@Override
public Observable<Document> startImport() {
MongoClient client = MongoClients.create(connectionString);
MongoDatabase db = client.getDatabase(dbName);
return db.getCollection(collectionName).find().toObservable()
.map(new Func1<org.bson.Document, Document>() {
public Document call(org.bson.Document mongoDoc) {
mongoDoc.put(typeField, type);
RawJsonDocument d = RawJsonDocument.create(mongoDoc
.getObjectId("_id").toHexString(), mongoDoc
.toJson());
return d;
};
});
}
开发者ID:ldoguin,项目名称:couchbase-java-importer,代码行数:16,代码来源:MongoDBConfig.java
示例5: createNode
import com.couchbase.client.java.document.Document; //导入依赖的package包/类
public Observable<Document> createNode(String[] line) {
ObjectNode node = objectMapper.createObjectNode();
for (int i = 0; i < getTotalColumn(); i++) {
String columnType = getColumType().get(i);
RowType.valueOf(columnType).addField(node, columName.get(i),
line[i], getSimpleDateFormat());
}
String kc = getKeyColum();
String key = getKeyPrefix() + node.get(kc).asText();
RawJsonDocument rjd = RawJsonDocument.create(key, node.toString());
return Observable.just(rjd);
}
开发者ID:ldoguin,项目名称:couchbase-java-importer,代码行数:13,代码来源:CSVConfig.java
示例6: call
import com.couchbase.client.java.document.Document; //导入依赖的package包/类
@Override
public Observable<? extends Document> call(Document doc) {
return asyncBucket
.upsert(doc)
.timeout(importTimeout, TimeUnit.MILLISECONDS)
.retryWhen(
RetryBuilder
.anyOf(RequestCancelledException.class)
.delay(fixed(requestCancelledExceptionDelay,
TimeUnit.MILLISECONDS))
.max(requestCancelledExceptionRetries).build())
.retryWhen(
RetryBuilder
.anyOf(TemporaryFailureException.class,
BackpressureException.class)
.delay(fixed(temporaryFailureExceptionDelay,
TimeUnit.MILLISECONDS))
.max(temporaryFailureExceptionRetries).build())
.doOnError(t -> writeToErrorLog(doc.id()))
.doOnNext(jd -> writeToSuccessLog(doc.id()))
.onErrorResumeNext(
new Func1<Throwable, Observable<Document>>() {
@Override
public Observable<Document> call(Throwable throwable) {
log.error(String.format(
"Could not import document ", doc.id()));
log.error(throwable);
return Observable.empty();
}
});
}
开发者ID:ldoguin,项目名称:couchbase-java-importer,代码行数:32,代码来源:ImportJsonToCouchbase.java
示例7: startImport
import com.couchbase.client.java.document.Document; //导入依赖的package包/类
@Override
public Observable<Document> startImport() {
throw new UnsupportedOperationException();
}
开发者ID:ldoguin,项目名称:couchbase-java-importer,代码行数:5,代码来源:JSONGenertorConfig.java
示例8: CouchbaseWriter
import com.couchbase.client.java.document.Document; //导入依赖的package包/类
public CouchbaseWriter(CouchbaseEnvironment couchbaseEnvironment, Config config) {
List<String> hosts = ConfigUtils.getStringList(config, CouchbaseWriterConfigurationKeys.BOOTSTRAP_SERVERS);
_cluster = CouchbaseCluster.create(couchbaseEnvironment, hosts);
String bucketName = ConfigUtils.getString(config, CouchbaseWriterConfigurationKeys.BUCKET,
CouchbaseWriterConfigurationKeys.BUCKET_DEFAULT);
String password = ConfigUtils.getString(config, CouchbaseWriterConfigurationKeys.PASSWORD, "");
_bucket = _cluster.openBucket(bucketName, password,
Collections.<Transcoder<? extends Document, ?>>singletonList(_tupleDocumentTranscoder));
_operationTimeout = ConfigUtils.getLong(config, CouchbaseWriterConfigurationKeys.OPERATION_TIMEOUT_MILLIS,
CouchbaseWriterConfigurationKeys.OPERATION_TIMEOUT_DEFAULT);
_operationTimeunit = TimeUnit.MILLISECONDS;
_defaultWriteResponseMapper = new GenericWriteResponseWrapper<>();
log.info("Couchbase writer configured with: hosts: {}, bucketName: {}, operationTimeoutInMillis: {}",
hosts, bucketName, _operationTimeout);
}
开发者ID:apache,项目名称:incubator-gobblin,代码行数:24,代码来源:CouchbaseWriter.java
示例9: testUpdate
import com.couchbase.client.java.document.Document; //导入依赖的package包/类
@Test
public void testUpdate() throws Exception {
when(bucket.replace(any(Document.class))).thenReturn(any(Document.class));
impl.update("ABC123", new Tester("testerName", "testerOtherProperty"));
verify(bucket).replace(RawJsonDocument.create("TESTER:ABC123", fixture("fixtures/tester.json")));
}
开发者ID:smartmachine,项目名称:dropwizard-couchbase,代码行数:7,代码来源:GenericAccessorImplTest.java
示例10: startImport
import com.couchbase.client.java.document.Document; //导入依赖的package包/类
Observable<Document> startImport() throws Exception;
开发者ID:ldoguin,项目名称:couchbase-java-importer,代码行数:2,代码来源:ImporterConfig.java
注:本文中的com.couchbase.client.java.document.Document类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论