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

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

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

Query.master介绍

[英]Sets this query to execute against master.
[中]

代码示例

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

@Override
  protected <T> Query<T> filterQuery(Query<T> query) {
    return query.clone().master().resolveInvisible().option(Database.DISABLE_FUNNEL_CACHE_QUERY_OPTION, true);
  }
};

代码示例来源:origin: perfectsense/dari

.using(database)
.noCache()
.master()
.first());

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

.from(Schedule.class)
.sortAscending("triggerDate")
.master()
.noCache()
.resolveInvisible()

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

String qrUrl = page.cmsUrl("qrCode");
if (user.isTfaRequired() && !user.isTfaEnabled() && !request.getRequestURI().startsWith(tfaUrl) && !request.getRequestURI().startsWith(qrUrl)) {
  user = Query.from(ToolUser.class).where("_id = ?", user.getId()).noCache().master().first();
  if (user != null && user.isTfaRequired() && !user.isTfaEnabled()) {
    tfaUrl = page.cmsUrl("toolUserTfa", RETURN_PATH_PARAMETER, JspUtils.getAbsolutePath(request, ""));

代码示例来源:origin: perfectsense/dari

/**
 * Returns {@code true} if any instances of the types associated
 * with the given {@code name} have been updated since the given
 * {@code time}.
 */
public static boolean isUpdated(String name, long time) {
  Tracker tracker = Query
      .from(Tracker.class)
      .where("_id = ?", createTrackerId(name))
      .master()
      .noCache()
      .first();
  return tracker != null && tracker.getLastUpdate() > time;
}

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

/**
 * Makes a raw path, like {@code siteId:directoryId/item},
 * using the given {@code site} and {@code path}.
 */
private String makeRawPath(Site site, String path) {
  Matcher pathMatcher = StringUtils.getMatcher(normalizePath(path), "^(/.*?)([^/]*)/?$");
  pathMatcher.find();
  path = pathMatcher.group(1);
  Directory dir = Query
      .from(Directory.class)
      .where("path = ?", path)
      .master()
      .noCache()
      .first();
  if (dir == null) {
    dir = new Directory();
    dir.setPath(path);
    dir.saveImmediately();
  }
  String rawPath = dir.getRawPath() + pathMatcher.group(2);
  if (site != null) {
    rawPath = site.getRawPath() + rawPath;
  }
  return rawPath;
}

代码示例来源:origin: perfectsense/dari

private void recalculateImmediateIndexedMethods(UUID id) {
  Set<ObjectMethod> immediateMethods = new HashSet<ObjectMethod>();
  for (ObjectMethod method : getRecalculableObjectMethods(db, typeId, fieldName)) {
    RecalculationFieldData methodData = method.as(RecalculationFieldData.class);
    if (methodData.isImmediate()) {
      immediateMethods.add(method);
    }
  }
  if (!immediateMethods.isEmpty()) {
    Object obj = Query.fromAll().master().noCache().where("_id = ?", id).first();
    State state = State.getInstance(obj);
    if (state != null) {
      Database stateDb = state.getDatabase();
      stateDb.beginIsolatedWrites();
      try {
        for (ObjectMethod method : immediateMethods) {
          method.recalculate(state);
        }
        stateDb.commitWrites();
      } finally {
        stateDb.endWrites();
      }
    }
  }
}

代码示例来源:origin: perfectsense/dari

.referenceOnly()
.noCache()
.master();

代码示例来源:origin: perfectsense/dari

.fromType(type)
.where("_type = ?", type)
.master()
.noCache()
.hasMoreThan(0)) {

代码示例来源:origin: perfectsense/dari

Query<?> query = Query.fromType(type).noCache().master();

代码示例来源:origin: perfectsense/dari

.using(database)
.noCache()
.master()
.first());

代码示例来源:origin: perfectsense/dari

/** Immediately refreshes all globals using the backing database. */
public synchronized void refreshGlobals() {
  bootstrapOnce.ensure();
  Database database = getDatabase();
  LOGGER.info("Loading globals from [{}]", database.getName());
  Query<Object> globalsQuery = Query
      .from(Object.class)
      .where("_id = ?", GLOBALS_ID)
      .using(database)
      .noCache();
  State newGlobals = State.getInstance(globalsQuery.first());
  if (newGlobals == null) {
    newGlobals = State.getInstance(globalsQuery.master().first());
  }
  if (newGlobals == null) {
    newGlobals = new State();
    newGlobals.setDatabase(database);
    newGlobals.setId(GLOBALS_ID);
    newGlobals.save();
  }
  globals = newGlobals;
  lastGlobalsUpdate = new Date();
  fieldsCache.reset();
  metricFieldsCache.reset();
  indexesCache.reset();
}

代码示例来源:origin: perfectsense/dari

/**
   * Returns the next number in the sequence with the given {@code name},
   * or the given {@code initialValue} if the sequence has never been
   * used before.
   *
   * @param name Can't be blank.
   */
  public static long nextLong(String name, long initialValue) {
    Sequence s = null;
    while (true) {
      s = Query.from(Sequence.class).where("name = ?", name).master().noCache().first();
      if (s != null) {
        break;
      }
      s = new Sequence();
      s.setName(name);
      s.setValue(initialValue);
      try {
        s.saveImmediately();
        break;
      } catch (ValidationException error) {
        if (s.getState().getErrors(s.getState().getField("name")).isEmpty()) {
          throw error;
        }
      }
    }
    return (long) s.next();
  }
}

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

/**
 * Returns the lock associated with the given {@code aspect} of the
 * given {@code content}.
 *
 * @param content Can't be {@code null}.
 * @param aspect If {@code null}, it's equivalent to an empty string.
 * @return May be {@code null} if there is no lock associated, or if
 * the lock's owner is either archived or deleted.
 */
public static ContentLock findLock(Object content, String aspect) {
  ContentLock lock =  Query
      .from(ContentLock.class)
      .where("_id = ?", createLockId(content, aspect))
      .master()
      .noCache()
      .first();
  if (lock != null) {
    Object owner = lock.getOwner();
    // Owner is deleted.
    if (owner == null) {
      unlock(content, null, null);
      return null;
    // Owner is archived.
    } else if (State.getInstance(owner).as(Content.ObjectModification.class).isTrash()) {
      return null;
    }
  }
  return lock;
}

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

.fromAll()
.where("com.psddev.cms.db.Draft/schedule = ?", this)
.master()
.noCache()
.resolveInvisible()

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

.from(ContentLock.class)
.where("_id = ?", lockId)
.master()
.noCache()
.first();

代码示例来源:origin: perfectsense/dari

.option(CONNECTION_QUERY_OPTION, connection)
.option(RETURN_ORIGINAL_DATA_QUERY_OPTION, Boolean.TRUE)
.master()
.noCache()
.first();

相关文章