本文整理了Java中com.psddev.dari.db.Query.count
方法的一些代码示例,展示了Query.count
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.count
方法的具体详情如下:
包路径:com.psddev.dari.db.Query
类名称:Query
方法名:count
[英]Returns a count of all objects matching this query in a #getDatabase.
[中]返回#getDatabase中与此查询匹配的所有对象的计数。
代码示例来源:origin: perfectsense/brightspot-cms
/**
* Calculates the size of the SearchResultSelection by counting its items {@link Query}.
* @return the size of the SearchResultSelection.
*/
public int size() {
return Long.valueOf(createItemsQuery().count()).intValue();
}
代码示例来源:origin: perfectsense/dari
private Long getCountFor(int index) {
Query<? extends E> query = getQueryFor(index);
if (query == null) {
return null;
} else {
Long count = counts.get(query);
if (count == null) {
count = query.count();
counts.put(query, count);
}
return count;
}
}
代码示例来源:origin: perfectsense/dari
private long readCount(Database database, WebPageContext context) {
return createQuery(database, context).count();
}
代码示例来源:origin: perfectsense/brightspot-cms
/** Returns the number of items completed. */
public long countComplete() {
return Query.fromAll()
.where("cms.workstream.completeIds ^= ?", getId().toString() + ",")
.count();
}
代码示例来源:origin: perfectsense/brightspot-cms
@Override
public String getLabel() {
String name = getName();
StringBuilder label = new StringBuilder();
if (ObjectUtils.isBlank(name)) {
Date triggerDate = getTriggerDate();
label.append(triggerDate != null
? triggerDate.toString()
: getId().toString());
} else {
label.append(name);
}
long draftCount = Query
.from(Draft.class)
.where("schedule = ?", this)
.count();
if (draftCount > 1) {
label.append(" (");
label.append(draftCount);
label.append(" items)");
}
return label.toString();
}
}
代码示例来源:origin: perfectsense/brightspot-cms
/**
* Returns the number of items completed by the given {@code user}.
*
* @param user Can't be {@code null}.
*/
public long countComplete(ToolUser user) {
ErrorUtils.errorIfNull(user, "user");
return Query
.from(Object.class)
.where("cms.workstream.completeIds = ?", getId().toString() + "," + user.getId().toString())
.count();
}
代码示例来源:origin: perfectsense/brightspot-cms
private long getReferencesCount(Object item) {
return Query
.fromAll()
.where("* matches ?", State.getInstance(item).getId())
.count();
}
}
代码示例来源:origin: perfectsense/brightspot-cms
/** Returns the number of remaining items to be worked on. */
public long countIncomplete() {
return getQuery().clone()
.and("id != ?", Query.from(Object.class).where("cms.workstream.completeIds ^= ?", getId().toString() + ","))
.count();
}
代码示例来源:origin: perfectsense/brightspot-cms
private long getAvailableActionCount(boolean archive) {
if (getSelection() != null) {
return itemsQuery().noCache().selectAll().stream().filter(i -> isItemActionable(i, archive)).count();
} else if (getSearch() != null) {
return isSearchActionable(getSearch(), archive) ? getSearch().toQuery(getSite()).count() : 0;
}
return 0;
}
代码示例来源:origin: perfectsense/brightspot-cms
long stateCount = Query.fromQuery(query).where("cms.workflow.currentState = ?", workflowState.getName()).noCache().count();
代码示例来源:origin: perfectsense/dari
try {
if (concreteTypeIds.isEmpty()) {
count = Query.fromAll().using(database).noCache().count();
} else {
for (UUID concreteTypeId : concreteTypeIds) {
long concreteCount = Query.fromAll().using(database).noCache().where("_type = ?", concreteTypeId).count();
count = count + concreteCount;
long objectCount = Query.fromAll().using(database).noCache().where("_type = ?", objType).count();
count = count + objectCount;
long typeMapCount = Query.fromAll().using(database).noCache().where("_type = ?", typeMapType).count();
count = count + typeMapCount;
代码示例来源:origin: perfectsense/dari
private void renderCount() throws IOException {
try {
if (query.getTimeout() == null) {
query.setTimeout(1.0);
}
writeObject(query.count());
} catch (RuntimeException ex) {
writeHtml("Many (");
writeStart("a", "href", page.url("", "timeout", 0));
writeHtml("Force Count");
writeEnd();
writeHtml(")");
}
}
代码示例来源:origin: perfectsense/brightspot-cms
long count = query.count();
ObjectType type = ObjectType.getInstance(page.param(UUID.class, "typeId"));
State state = State.getInstance(type.createObject(page.param(UUID.class, "id")));
代码示例来源:origin: perfectsense/brightspot-cms
count = query.count();
内容来源于网络,如有侵权,请联系作者删除!