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


Java View类代码示例

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


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

示例1: getDataFromDoc

import org.ektorp.support.View; //导入依赖的package包/类
@Override
@View(name = "get_data", map = "function(doc) {if (doc.data) {"
        + "emit(doc._id, doc.data)}}")
public byte[] getDataFromDoc(String id) {
    ViewQuery q = new ViewQuery()
            .viewName("get_data")
            .designDocId("_design/JsonNode")
            .key(id);

    ViewResult result = db.queryView(q);
    try {
        return mapper.writeValueAsBytes(result.getRows().get(0).getValueAsNode());
    } catch (JsonProcessingException ex) {
        logger.error(ex);
    }
    return null;
}
 
开发者ID:martin-kanis,项目名称:relax-dms,代码行数:18,代码来源:CouchDbRepositoryImpl.java

示例2: getAttachments

import org.ektorp.support.View; //导入依赖的package包/类
@View(name = "get_attachments", map = "function(doc) {if (doc._attachments) {"
        + "emit(doc._id, doc._attachments)}}")
public byte[] getAttachments(String id) {
    ViewQuery q = new ViewQuery()
            .viewName("get_attachments")
            .designDocId("_design/JsonNode")
            .key(id);

    ViewResult result = db.queryView(q);
    try {
        return mapper.writeValueAsBytes(result.getRows().get(0).getValueAsNode());
    } catch (JsonProcessingException ex) {
        logger.error(ex);
    }
    return null;
}
 
开发者ID:martin-kanis,项目名称:relax-dms,代码行数:17,代码来源:CouchDbRepositoryImpl.java

示例3: for

import org.ektorp.support.View; //导入依赖的package包/类
@Override
@View(name = "get_attachments_revs", map = "function(doc) {if (doc._attachments) { var revs = [];"
        + " for(var key in doc._attachments) {revs.push(key);}"
        + "emit(doc._id, revs)}}")
public List<String> getAttachmentRevisions(String id) {
    ViewQuery q = new ViewQuery()
            .viewName("get_attachments_revs")
            .designDocId("_design/JsonNode")
            .key(id);

    ViewResult result = db.queryView(q);
    try {
        return mapper.treeToValue(result.getRows().get(0).getValueAsNode(), List.class);
    } catch (JsonProcessingException ex) {
        logger.error(ex);
    }
    return null;
}
 
开发者ID:martin-kanis,项目名称:relax-dms,代码行数:19,代码来源:CouchDbRepositoryImpl.java

示例4: getPermissionsFromDoc

import org.ektorp.support.View; //导入依赖的package包/类
@Override
@View(name = "get_permissions", map = "function(doc) {if (doc.workflow) { "
        + "emit(doc._id, doc.workflow.permissions)}}")
public Set<String> getPermissionsFromDoc(String id) {
    ViewQuery q = new ViewQuery()
            .viewName("get_permissions")
            .designDocId("_design/JsonNode")
            .key(id);

    ViewResult result = db.queryView(q);
    try {
        return mapper.treeToValue(result.getRows().get(0).getValueAsNode(), Set.class);
    } catch (JsonProcessingException ex) {
        logger.error(ex);
    }
    return null;
}
 
开发者ID:martin-kanis,项目名称:relax-dms,代码行数:18,代码来源:CouchDbRepositoryImpl.java

示例5: if

import org.ektorp.support.View; //导入依赖的package包/类
@Override
@View(name = "all", map = "function(doc) { if (!doc.doc_template) emit(doc._id, "
        + "{id:doc._id, author:doc.metadata.author, title:doc.data.Title, permissions:doc.workflow.permissions})}")
public List<DocumentListData> getAllDocuments() {
    ViewQuery q = new ViewQuery()
            .viewName("all")
            .designDocId("_design/JsonNode");
    
    return viewToDocListData(q);
}
 
开发者ID:martin-kanis,项目名称:relax-dms,代码行数:11,代码来源:CouchDbRepositoryImpl.java

示例6: emit

import org.ektorp.support.View; //导入依赖的package包/类
@Override
@View(name = "get_workflow", map = "function(doc) { emit(doc._id, doc.workflow)}")
public Workflow getWorkflowFromDoc(String id) {
    ViewQuery q = new ViewQuery()
            .viewName("get_workflow")
            .designDocId("_design/JsonNode")
            .key(id);
    
    ViewResult result = db.queryView(q);
    String json = result.getRows().get(0).getValue();
    return workflowService.serialize(json);
}
 
开发者ID:martin-kanis,项目名称:relax-dms,代码行数:13,代码来源:CouchDbRepositoryImpl.java

示例7: if

import org.ektorp.support.View; //导入依赖的package包/类
@Override
@View(name = "by_id", map = "function(doc) { if (" + DOCUMENT_ID + ") emit(doc.value.id, doc._id) }")
public EplAdapterDocument findById(String adapterId) {
	List<EplAdapterDocument> adapters = queryView("by_id", adapterId);
	if (adapters.isEmpty()) throw new DocumentNotFoundException("no adapter with id " + adapterId);
	if (adapters.size() == 1) return adapters.get(0);
	throw new IllegalStateException("found more than one adapter for id " + adapterId);
}
 
开发者ID:jvalue,项目名称:cep-service,代码行数:9,代码来源:EplAdapterRepository.java

示例8: if

import org.ektorp.support.View; //导入依赖的package包/类
@View(name = "by_id", map = "function(doc) { if (" + DOCUMENT_ID + ") emit(doc.value.id, doc._id) }")
public OdsRegistrationDocument findById(String eventId) {
	List<OdsRegistrationDocument> events = queryView("by_id", eventId);
	if (events.isEmpty()) throw new DocumentNotFoundException("no registration with id " + eventId);
	if (events.size() == 1) return events.get(0);
	throw new IllegalStateException("found more than one registration for id " + eventId);
}
 
开发者ID:jvalue,项目名称:cep-service,代码行数:8,代码来源:OdsRegistrationRepository.java

示例9: if

import org.ektorp.support.View; //导入依赖的package包/类
@Override
@View(name = "by_id", map = "function(doc) { if (" + DOCUMENT_ID + ") emit(doc.value.id, doc._id) }")
public ClientDocument findById(String clientId) {
	List<ClientDocument> clients = queryView("by_id", clientId);
	if (clients.isEmpty())
		throw new DocumentNotFoundException("no client with id " + clientId);
	if (clients.size() == 1) return clients.get(0);
	throw new IllegalStateException("found more than one client for id " + clientId);
}
 
开发者ID:jvalue,项目名称:cep-service,代码行数:10,代码来源:ClientRepository.java

示例10: if

import org.ektorp.support.View; //导入依赖的package包/类
@View(name = "by_triggerkey", map = "function(doc) { if (doc.type === 'CouchDbTrigger') emit([doc.trigger_name, doc.trigger_group], doc._id); }")
public List<CouchDbTrigger> getTriggersByKeys(List<TriggerKey> triggerKeys) throws JobPersistenceException {
    List<ComplexKey> keys = new ArrayList<ComplexKey>();
    for (TriggerKey triggerKey : triggerKeys) {
        keys.add(ComplexKey.of(triggerKey.getName(), triggerKey.getGroup()));
    }
    return db.queryView(createQuery("by_triggerkey").includeDocs(true).keys(keys), type);
}
 
开发者ID:motech,项目名称:quartz-couchdb-store,代码行数:9,代码来源:CouchDbTriggerStore.java

示例11: if

import org.ektorp.support.View; //导入依赖的package包/类
@View(name = "by_jobkey", map = "function(doc) { if (doc.type === 'CouchDbJobDetail') emit([doc.name, doc.group], doc._id); }")
public List<CouchDbJobDetail> getJobs(List<JobKey> jobKeys) {
    List<ComplexKey> keys = new ArrayList<ComplexKey>();
    for (JobKey jobKey : jobKeys) {
        keys.add(ComplexKey.of(jobKey.getName(), jobKey.getGroup()));
    }
    return db.queryView(createQuery("by_jobkey").includeDocs(true).keys(keys), type);
}
 
开发者ID:motech,项目名称:quartz-couchdb-store,代码行数:9,代码来源:CouchDbJobStore.java

示例12: if

import org.ektorp.support.View; //导入依赖的package包/类
@Override
@View(name = "by_id", map = "function(doc) { if (" + DOCUMENT_ID + ") emit(doc.value.id, doc._id) }")
public PluginMetaDataDocument findById(String pluginId) {
	List<PluginMetaDataDocument> plugins = queryView("by_id", pluginId);
	if (plugins.isEmpty()) throw new DocumentNotFoundException(pluginId);
	if (plugins.size() > 1) throw new IllegalStateException("found more than one plugin for id " + pluginId);
	return plugins.get(0);
}
 
开发者ID:jvalue,项目名称:open-data-service,代码行数:9,代码来源:PluginMetaDataRepository.java

示例13: if

import org.ektorp.support.View; //导入依赖的package包/类
@Override
@View(name = "by_id", map = "function(doc) { if (" + DOCUMENT_ID + ") emit(doc.value.id, doc._id)}")
public DataSourceDocument findById(String sourceId) {
	List<DataSourceDocument> sources = queryView("by_id", sourceId);
	if (sources.isEmpty()) throw new DocumentNotFoundException(sourceId);
	if (sources.size() > 1)
		throw new IllegalStateException("found more than one source for id " + sourceId);
	return sources.get(0);
}
 
开发者ID:jvalue,项目名称:open-data-service,代码行数:10,代码来源:DataSourceRepository.java

示例14: if

import org.ektorp.support.View; //导入依赖的package包/类
@Override
@View(name = "by_id", map = "function(doc) { if (" + DOCUMENT_ID + ") emit(doc.value.id, doc._id) }")
public ProcessorReferenceChainDocument findById(String processorChainId) {
	List<ProcessorReferenceChainDocument> chains = queryView("by_id", processorChainId);
	if (chains.isEmpty()) throw new DocumentNotFoundException(processorChainId);
	if (chains.size() > 1)
		throw new IllegalStateException("found more than one chain for id " + processorChainId);
	return chains.get(0);
}
 
开发者ID:jvalue,项目名称:open-data-service,代码行数:10,代码来源:ProcessorChainReferenceRepository.java

示例15: if

import org.ektorp.support.View; //导入依赖的package包/类
@View(name = "by_id", map = "function(doc) { if (" + DOCUMENT_ID + ") emit(doc.value.id, doc._id)}")
public ClientDocument findById(String clientId) {
	List<ClientDocument> clients = queryView("by_id", clientId);
	if (clients.isEmpty()) throw new DocumentNotFoundException(clientId);
	if (clients.size() > 1) throw new IllegalStateException("found more than one client for id " + clientId);
	return clients.get(0);
}
 
开发者ID:jvalue,项目名称:open-data-service,代码行数:8,代码来源:NotificationClientRepository.java


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