com.psddev.dari.db.Query.where()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(215)

本文整理了Java中com.psddev.dari.db.Query.where方法的一些代码示例,展示了Query.where的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.where方法的具体详情如下:
包路径:com.psddev.dari.db.Query
类名称:Query
方法名:where

Query.where介绍

暂无

代码示例

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * Returns all users that are currently working.
  3. *
  4. * @return Never {@code null} but may be empty.
  5. */
  6. public List<ToolUser> getUsers() {
  7. return currentItems != null
  8. ? Query.from(ToolUser.class).where("_id = ?", currentItems.keySet()).selectAll()
  9. : new ArrayList<ToolUser>();
  10. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. @Override
  2. public Iterable<?> create(Map<String, Object> data) {
  3. return Query.from(EditFieldUpdate.class)
  4. .where("contentId = ?", data.get("contentId"))
  5. .selectAll();
  6. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * @deprecated Use {@link Query#from} and {@link Site#itemsPredicate}
  3. * together instead.
  4. */
  5. @Deprecated
  6. public static <T> Query<T> queryFrom(HttpServletRequest request, Class<T> objectClass) {
  7. return Query.from(objectClass).where(Site.OWNER_FIELD + " = ?", getSite(request));
  8. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /** Returns the number of items completed. */
  2. public long countComplete() {
  3. return Query.fromAll()
  4. .where("cms.workstream.completeIds ^= ?", getId().toString() + ",")
  5. .count();
  6. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * Returns the number of items completed by the given {@code user}.
  3. *
  4. * @param user Can't be {@code null}.
  5. */
  6. public long countComplete(ToolUser user) {
  7. ErrorUtils.errorIfNull(user, "user");
  8. return Query
  9. .from(Object.class)
  10. .where("cms.workstream.completeIds = ?", getId().toString() + "," + user.getId().toString())
  11. .count();
  12. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * Clear the SearchResultSelection by deleting all of the SearchResultSelectionItem that point to it.
  3. */
  4. public void clear() {
  5. Query.from(SearchResultSelectionItem.class)
  6. .where("selectionId = ?", getId())
  7. .deleteAll();
  8. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * Returns a partial list of all the revisions of the object with the
  3. * given {@code objectId} within the given {@code offset} and
  4. * {@code limit}.
  5. */
  6. public static PaginatedResult<History> findByObjectId(ToolUser user, UUID objectId, long offset, int limit) {
  7. return Query
  8. .from(History.class)
  9. .where("objectId = ?", objectId)
  10. .sortDescending("updateDate")
  11. .select(offset, limit);
  12. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. private Taxon findParent(ToolPageContext page) {
  2. return Query
  3. .from(Taxon.class)
  4. .where("_id = ?", page.param(UUID.class, PARENT_ID_PARAMETER))
  5. .first();
  6. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * Returns the object.
  3. *
  4. * @return May be {@code null}.
  5. */
  6. public Object getObject() {
  7. if (object == null) {
  8. object = Query.from(Object.class).where("_id = ?", getObjectId()).first();
  9. }
  10. return object;
  11. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * Returns the tool user that initiated the workflow transition.
  3. *
  4. * @return May be {@code null}.
  5. */
  6. public ToolUser getUser() {
  7. return Query.from(ToolUser.class).where("_id = ?", getUserId()).first();
  8. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. public Object getContent() {
  2. return Query
  3. .from(Object.class)
  4. .where("_id = ?", getContentId())
  5. .first();
  6. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. public void addChanges(Schedule schedule) {
  2. for (Draft draft : Query
  3. .from(Draft.class)
  4. .where("schedule = ?", schedule)
  5. .selectAll()) {
  6. differencesById.put(draft.getObjectId(), draft.getDifferences());
  7. }
  8. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. public static ToolUser getByChangePasswordToken(String changePasswordToken) {
  2. ToolUser user = Query.from(ToolUser.class).option(Database.DISABLE_FUNNEL_CACHE_QUERY_OPTION, true).where("changePasswordToken = ?", changePasswordToken).first();
  3. long expiration = Settings.getOrDefault(long.class, "cms/tool/changePasswordTokenExpirationInHours", 24L) * 60L * 60L * 1000L;
  4. return user != null && user.changePasswordTokenTime + expiration > System.currentTimeMillis() ? user : null;
  5. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * Retrieve the existing GuideType instance for a given {@code objectType}.
  3. * If none exists, null is returned
  4. */
  5. public static GuideType getGuideType(ObjectType objectType) {
  6. return Query.from(GuideType.class)
  7. .where("documentedType = ?", objectType.getId()).first();
  8. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * Retrieve a GuideType instance for the given {@code documentedType}, creating one if it
  3. * doesn't already exist.
  4. */
  5. public static GuideType findOrCreateGuide(ObjectType documentedType) {
  6. GuideType guide = Query.from(GuideType.class)
  7. .where("documentedType = ?", documentedType.getId()).first();
  8. if (guide == null) {
  9. guide = createGuide(documentedType);
  10. }
  11. return guide;
  12. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. public static ToolUser getByToken(String token) {
  2. ToolUser user = Query.from(ToolUser.class).option(Database.DISABLE_FUNNEL_CACHE_QUERY_OPTION, true).where("loginTokens/token = ?", token).first();
  3. return user != null && user.getLoginToken(token) != null ? user : null;
  4. }
  5. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /** Returns the number of remaining items to be worked on. */
  2. public long countIncomplete() {
  3. return getQuery().clone()
  4. .and("id != ?", Query.from(Object.class).where("cms.workstream.completeIds ^= ?", getId().toString() + ","))
  5. .count();
  6. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. public static <T extends Taxon> List<T> getRoots(Class<T> taxonClass, Site site, Predicate predicate) {
  2. Query<T> query = Query.from(taxonClass).where("cms.taxon.root = true");
  3. if (site != null) {
  4. query.and(site.itemsPredicate());
  5. }
  6. List<T> roots = query.selectAll();
  7. return filter(roots, predicate);
  8. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. /**
  2. * Retrieve a GuideType instance for the parent type of a given {@code field}, creating one if it
  3. * doesn't already exist.
  4. */
  5. public static GuideType findOrCreateGuide(ObjectField field) {
  6. GuideType guide = Query.from(GuideType.class)
  7. .where("documentedType = ?", field.getParentType().getId()).first();
  8. if (guide == null) {
  9. guide = createGuide(field.getParentType());
  10. }
  11. return guide;
  12. }

代码示例来源:origin: perfectsense/brightspot-cms

  1. private void deleteWorksInProgress(Object object) {
  2. UUID contentId = object instanceof Draft
  3. ? ((Draft) object).getObjectId()
  4. : State.getInstance(object).getId();
  5. Query.from(WorkInProgress.class)
  6. .where("owner = ?", getUser())
  7. .and("contentId = ?", contentId)
  8. .deleteAll();
  9. }

相关文章