本文整理了Java中com.psddev.dari.db.Query.where
方法的一些代码示例,展示了Query.where
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.where
方法的具体详情如下:
包路径:com.psddev.dari.db.Query
类名称:Query
方法名:where
暂无
代码示例来源:origin: perfectsense/brightspot-cms
/**
* Returns all users that are currently working.
*
* @return Never {@code null} but may be empty.
*/
public List<ToolUser> getUsers() {
return currentItems != null
? Query.from(ToolUser.class).where("_id = ?", currentItems.keySet()).selectAll()
: new ArrayList<ToolUser>();
}
代码示例来源:origin: perfectsense/brightspot-cms
@Override
public Iterable<?> create(Map<String, Object> data) {
return Query.from(EditFieldUpdate.class)
.where("contentId = ?", data.get("contentId"))
.selectAll();
}
代码示例来源:origin: perfectsense/brightspot-cms
/**
* @deprecated Use {@link Query#from} and {@link Site#itemsPredicate}
* together instead.
*/
@Deprecated
public static <T> Query<T> queryFrom(HttpServletRequest request, Class<T> objectClass) {
return Query.from(objectClass).where(Site.OWNER_FIELD + " = ?", getSite(request));
}
代码示例来源: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
/**
* 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
/**
* Clear the SearchResultSelection by deleting all of the SearchResultSelectionItem that point to it.
*/
public void clear() {
Query.from(SearchResultSelectionItem.class)
.where("selectionId = ?", getId())
.deleteAll();
}
代码示例来源:origin: perfectsense/brightspot-cms
/**
* Returns a partial list of all the revisions of the object with the
* given {@code objectId} within the given {@code offset} and
* {@code limit}.
*/
public static PaginatedResult<History> findByObjectId(ToolUser user, UUID objectId, long offset, int limit) {
return Query
.from(History.class)
.where("objectId = ?", objectId)
.sortDescending("updateDate")
.select(offset, limit);
}
代码示例来源:origin: perfectsense/brightspot-cms
private Taxon findParent(ToolPageContext page) {
return Query
.from(Taxon.class)
.where("_id = ?", page.param(UUID.class, PARENT_ID_PARAMETER))
.first();
}
代码示例来源:origin: perfectsense/brightspot-cms
/**
* Returns the object.
*
* @return May be {@code null}.
*/
public Object getObject() {
if (object == null) {
object = Query.from(Object.class).where("_id = ?", getObjectId()).first();
}
return object;
}
代码示例来源:origin: perfectsense/brightspot-cms
/**
* Returns the tool user that initiated the workflow transition.
*
* @return May be {@code null}.
*/
public ToolUser getUser() {
return Query.from(ToolUser.class).where("_id = ?", getUserId()).first();
}
代码示例来源:origin: perfectsense/brightspot-cms
public Object getContent() {
return Query
.from(Object.class)
.where("_id = ?", getContentId())
.first();
}
代码示例来源:origin: perfectsense/brightspot-cms
public void addChanges(Schedule schedule) {
for (Draft draft : Query
.from(Draft.class)
.where("schedule = ?", schedule)
.selectAll()) {
differencesById.put(draft.getObjectId(), draft.getDifferences());
}
}
代码示例来源:origin: perfectsense/brightspot-cms
public static ToolUser getByChangePasswordToken(String changePasswordToken) {
ToolUser user = Query.from(ToolUser.class).option(Database.DISABLE_FUNNEL_CACHE_QUERY_OPTION, true).where("changePasswordToken = ?", changePasswordToken).first();
long expiration = Settings.getOrDefault(long.class, "cms/tool/changePasswordTokenExpirationInHours", 24L) * 60L * 60L * 1000L;
return user != null && user.changePasswordTokenTime + expiration > System.currentTimeMillis() ? user : null;
}
代码示例来源:origin: perfectsense/brightspot-cms
/**
* Retrieve the existing GuideType instance for a given {@code objectType}.
* If none exists, null is returned
*/
public static GuideType getGuideType(ObjectType objectType) {
return Query.from(GuideType.class)
.where("documentedType = ?", objectType.getId()).first();
}
代码示例来源:origin: perfectsense/brightspot-cms
/**
* Retrieve a GuideType instance for the given {@code documentedType}, creating one if it
* doesn't already exist.
*/
public static GuideType findOrCreateGuide(ObjectType documentedType) {
GuideType guide = Query.from(GuideType.class)
.where("documentedType = ?", documentedType.getId()).first();
if (guide == null) {
guide = createGuide(documentedType);
}
return guide;
}
代码示例来源:origin: perfectsense/brightspot-cms
public static ToolUser getByToken(String token) {
ToolUser user = Query.from(ToolUser.class).option(Database.DISABLE_FUNNEL_CACHE_QUERY_OPTION, true).where("loginTokens/token = ?", token).first();
return user != null && user.getLoginToken(token) != null ? user : null;
}
}
代码示例来源: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
public static <T extends Taxon> List<T> getRoots(Class<T> taxonClass, Site site, Predicate predicate) {
Query<T> query = Query.from(taxonClass).where("cms.taxon.root = true");
if (site != null) {
query.and(site.itemsPredicate());
}
List<T> roots = query.selectAll();
return filter(roots, predicate);
}
代码示例来源:origin: perfectsense/brightspot-cms
/**
* Retrieve a GuideType instance for the parent type of a given {@code field}, creating one if it
* doesn't already exist.
*/
public static GuideType findOrCreateGuide(ObjectField field) {
GuideType guide = Query.from(GuideType.class)
.where("documentedType = ?", field.getParentType().getId()).first();
if (guide == null) {
guide = createGuide(field.getParentType());
}
return guide;
}
代码示例来源:origin: perfectsense/brightspot-cms
private void deleteWorksInProgress(Object object) {
UUID contentId = object instanceof Draft
? ((Draft) object).getObjectId()
: State.getInstance(object).getId();
Query.from(WorkInProgress.class)
.where("owner = ?", getUser())
.and("contentId = ?", contentId)
.deleteAll();
}
内容来源于网络,如有侵权,请联系作者删除!