本文整理汇总了Java中org.lightcouch.CouchDbClient.view方法的典型用法代码示例。如果您正苦于以下问题:Java CouchDbClient.view方法的具体用法?Java CouchDbClient.view怎么用?Java CouchDbClient.view使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lightcouch.CouchDbClient
的用法示例。
在下文中一共展示了CouchDbClient.view方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadDocsFromView
import org.lightcouch.CouchDbClient; //导入方法依赖的package包/类
protected List<String> loadDocsFromView(String viewId, String path,
String sourcePath, String startKey, String endKey) {
View view;
List<String> allDocs = new Vector<String>();
CouchDbClient dbClient = connectionProvider.getDBClient(CouchDbClient.class, path);
try
{
view = dbClient.view(viewId);
allDocs = view.includeDocs(false).startKey(startKey).endKey(endKey).query();
} catch (NoDocumentException e)
{
e.printStackTrace();
System.out.println("create view, view id: " + viewId);
createView(path, sourcePath, viewId);
view = dbClient.view(viewId);
allDocs = view.includeDocs(false).startKey(startKey).endKey(endKey).query();
}
return allDocs;
}
示例2: loadViewIntoInputStream
import org.lightcouch.CouchDbClient; //导入方法依赖的package包/类
protected InputStream loadViewIntoInputStream(String viewId, String path, String sourcePath) {
View view;
CouchDbClient dbClient = connectionProvider.getDBClient(CouchDbClient.class, path);
InputStream inStream = null;
try
{
view = dbClient.view(viewId);
} catch (NoDocumentException e)
{
e.printStackTrace();
System.out.println("create view, view id: " + viewId);
createView(path, sourcePath, viewId);
view = dbClient.view(viewId);
}
inStream = view.includeDocs(false).queryForStream();
return inStream;
}
示例3: loadDocsFromView
import org.lightcouch.CouchDbClient; //导入方法依赖的package包/类
protected List<String> loadDocsFromView(String viewId, String path, String sourcePath) {
View view;
List<String> allDocs = new Vector<String>();
CouchDbClient dbClient = connectionProvider.getDBClient(CouchDbClient.class, path);
try
{
view = dbClient.view(viewId);
allDocs = view.includeDocs(true).query();
} catch (NoDocumentException e)
{
e.printStackTrace();
createView(path, sourcePath, viewId);
view = dbClient.view(viewId);
allDocs = view.includeDocs(true).query();
}
return allDocs;
}
示例4: list
import org.lightcouch.CouchDbClient; //导入方法依赖的package包/类
@Override
public List<E> list(String path, String username, String password) {
View view;
List<String> allDocs = new Vector<String>();
CouchDbClient dbClient = connectionProvider.getDBClient(CouchDbClient.class, path, username, password);
try
{
view = dbClient.view(RemoteDaoConstants.VIEW_ALL_DOCS);
allDocs = view.includeDocs(true).query();
} catch (NoDocumentException e)
{
e.printStackTrace();
DesignDocument designDoc = dbClient.design().getFromDesk(RemoteDaoConstants.VIEW_ALL_DOCS);
// designDoc.new DesignDocument();//
dbClient.design().synchronizeWithDb(designDoc);
view = dbClient.view(RemoteDaoConstants.VIEW_ALL_DOCS);
allDocs = view.includeDocs(true).query();
}
List<E> results = loadObjectsFromStrings(allDocs, path);
if (!results.isEmpty())
{
registerQueryIdWithInternalRegistry(RemoteDaoConstants.VIEW_ALL_DOCS, path);
}
return results;
}
示例5: list
import org.lightcouch.CouchDbClient; //导入方法依赖的package包/类
@Override
public List<BTSProject> list(String path, String username, String password) {
View view;
List<String> allDocs = new Vector<String>();
CouchDbClient dbClient = connectionProvider.getDBClient(CouchDbClient.class, path, username, password);
try
{
view = dbClient.view(RemoteDaoConstants.VIEW_ALL_BTSPROJECTS);
allDocs = view.includeDocs(true).query();
} catch (NoDocumentException e)
{
e.printStackTrace();
DesignDocument designDoc = dbClient.design().getFromDesk(RemoteDaoConstants.VIEW_ALL_BTSPROJECTS);
// designDoc.new DesignDocument();//
dbClient.design().synchronizeWithDb(designDoc);
view = dbClient.view(RemoteDaoConstants.VIEW_ALL_BTSPROJECTS);
allDocs = view.includeDocs(true).query();
}
List<BTSProject> results = loadObjectsFromStrings(allDocs, path);
if (!results.isEmpty())
{
registerQueryIdWithInternalRegistry(RemoteDaoConstants.VIEW_ALL_BTSPROJECTS, path);
}
return results;
}
示例6: findLastID
import org.lightcouch.CouchDbClient; //导入方法依赖的package包/类
@Override
public String findLastID(String collectionName, String prefix) {
String viewId = BTSConstants.VIEW_ID_LAST_ID;
View view;
CouchDbClient dbClient = connectionProvider.getDBClient(CouchDbClient.class, collectionName);
List<String> allDocs;
try
{
view = dbClient.view(viewId);
allDocs = view.includeDocs(false).startKey(prefix + 0).reduce(true).query();
} catch (NoDocumentException e)
{
e.printStackTrace();
System.out.println("create view, view id: " + viewId);
createView(collectionName, "/id_reservation/", viewId);
view = dbClient.view(viewId);
allDocs = view.includeDocs(false).startKey(prefix + 0).reduce(true).query();
}
System.out.println(allDocs);
String result = allDocs.toString();
Matcher m = VALUE_PATTERN.matcher(result);
if (m.find())
{
return prefix+ m.group(2);
}
return null;
}