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


Java DocumentFragment类代码示例

本文整理汇总了Java中com.couchbase.client.java.subdoc.DocumentFragment的典型用法代码示例。如果您正苦于以下问题:Java DocumentFragment类的具体用法?Java DocumentFragment怎么用?Java DocumentFragment使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DocumentFragment类属于com.couchbase.client.java.subdoc包,在下文中一共展示了DocumentFragment类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeContact

import com.couchbase.client.java.subdoc.DocumentFragment; //导入依赖的package包/类
@ResponseBody
@RequestMapping(method = RequestMethod.PUT, path = "/developer/removeContact/{developerId}")
public String removeContact(final @PathVariable String developerId, final @RequestBody String json) throws Exception {
    JsonObject jsonData = JsonObject.fromJson(json);
    String contactId = jsonData.getString("contactId");

    DocumentFragment<Lookup> fragment = bucket.lookupIn(developerId).get("contacts").execute();
    JsonArray contactList = fragment.content("contacts", JsonArray.class);
    List tempList = contactList.toList();
    tempList.remove(contactId);
    contactList = JsonArray.from(tempList);
    bucket.mutateIn(developerId)
            .replace("contacts", contactList).execute();

    fragment = bucket.lookupIn(contactId).get("contacts").execute();
    contactList = fragment.content("contacts", JsonArray.class);
    tempList = contactList.toList();
    tempList.remove(developerId);
    contactList = JsonArray.from(tempList);
    bucket.mutateIn(contactId)
            .replace("contacts", contactList).execute();

    return "{}";
}
 
开发者ID:couchbaselabs,项目名称:GitTalent,代码行数:25,代码来源:IndexController.java

示例2: findDomainEvents

import com.couchbase.client.java.subdoc.DocumentFragment; //导入依赖的package包/类
@Override
public List<? extends DomainEventData<?>> findDomainEvents(Bucket bucket, String aggregateIdentifier, long firstSequenceNumber, int batchSize) {
    String docId = EVENT_PREFIX + aggregateIdentifier;
    JsonDocument doc = bucket.get(docId);
    List<EventEntry> eventEntries = new ArrayList<>();
    if (doc != null) {
        DocumentFragment<Lookup> fragment = bucket.lookupIn(docId)
                .get("events")
                .execute();
        JsonArray events = fragment.content("events", JsonArray.class);
        events.forEach((event) -> {
            eventEntries.add(new EventEntry((JsonObject) event));
        });
    }
    return eventEntries;
}
 
开发者ID:haxorof,项目名称:axon-couchbase,代码行数:17,代码来源:DocumentPerAggregateStorageStrategy.java

示例3: main

import com.couchbase.client.java.subdoc.DocumentFragment; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {

		CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder().build();

		clusterCouchbase = CouchbaseCluster.create(env, "192.168.4.246", "192.168.4.247", "192.168.4.248");
		proteusBucket = clusterCouchbase.openBucket("proteus-testing");

		String coil = "40101001";

		DocumentFragment<Lookup> resultHSM = proteusBucket.lookupIn(coil).get("proteus-hsm").execute();
		DocumentFragment<Lookup> resultFlatness = proteusBucket.lookupIn(coil).get("proteus-flatness").execute();
		DocumentFragment<Lookup> resultRealtime = proteusBucket.lookupIn(coil).get("proteus-realtime").execute();
		System.out.println("Resultado para la bobina < " + "40101022" + " > | < HSM > " + resultHSM.size()
				+ " | < Flantess > " + resultFlatness.size() + " | < Realtime > " + resultRealtime.size());

		// System.out.println(resultRealtime.toString());
		// Thread.sleep(3000);
		// System.out.println(resultFlatness.toString());
		// Thread.sleep(3000);
		System.out.println(resultHSM.toString());
		Thread.sleep(3000);

		ArrayList<String> coils = new ArrayList<String>();

		coils.add("40101022");
		coils.add("40101018");

		for (String bobina : coils) {
			CouchbaseUtils.checkDataInserted(bobina, proteusBucket);
		}

	}
 
开发者ID:proteus-h2020,项目名称:proteus-consumer-couchbase,代码行数:33,代码来源:ExampleQueryCouch.java

示例4: checkDataInserted

import com.couchbase.client.java.subdoc.DocumentFragment; //导入依赖的package包/类
public static void checkDataInserted(String coilID, Bucket proteusBucket) {
	DocumentFragment<Lookup> resultHSM = proteusBucket.lookupIn(coilID).get("proteus-hsm").execute();
	DocumentFragment<Lookup> resultFlatness = proteusBucket.lookupIn(coilID).get("proteus-realtime").execute();
	DocumentFragment<Lookup> resultRealtime = proteusBucket.lookupIn(coilID).get("proteus-flatness").execute();
	System.out.println("Resultado para la bobina < " + coilID + " > | < HSM > " + resultHSM.size()
			+ " | < Flantess > " + resultFlatness.size() + " | < Realtime > " + resultRealtime.size());
}
 
开发者ID:proteus-h2020,项目名称:proteus-consumer-couchbase,代码行数:8,代码来源:CouchbaseUtils.java


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