org.jooq.TableField.isTrue()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(126)

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

TableField.isTrue介绍

暂无

代码示例

代码示例来源:origin: org.jooq/jooq-meta

@Override
protected void loadUniqueKeys(DefaultRelations relations) throws SQLException {
  for (Record record : fetchKeys(DB_INDEX.IS_PRIMARY_KEY.isTrue())) {
    String key = record.get("constraint_name", String.class);
    String tableName = record.get(DB_CLASS.CLASS_NAME);
    String columnName = record.get(DB_INDEX_KEY.KEY_ATTR_NAME);
    TableDefinition table = getTable(getSchemata().get(0), tableName);
    if (table != null) {
      relations.addPrimaryKey(key, table.getColumn(columnName));
    }
  }
}

代码示例来源:origin: org.jooq/jooq-meta

@Override
protected void loadPrimaryKeys(DefaultRelations relations) throws SQLException {
  for (Record record : fetchKeys(DB_INDEX.IS_UNIQUE.isTrue().and(DB_INDEX.IS_PRIMARY_KEY.isFalse()))) {
    String key = record.get("constraint_name", String.class);
    String tableName = record.get(DB_CLASS.CLASS_NAME);
    String columnName = record.get(DB_INDEX_KEY.KEY_ATTR_NAME);
    TableDefinition table = getTable(getSchemata().get(0), tableName);
    if (table != null) {
      relations.addUniqueKey(key, table.getColumn(columnName));
    }
  }
}

代码示例来源:origin: rancher/cattle

@Override
protected void addAccountAuthorization(boolean byId, boolean byLink, String type, Map<Object, Object> criteria, Policy policy) {
  super.addAccountAuthorization(byId, byLink, type, criteria, policy);
  if (!policy.isOption(Policy.LIST_ALL_ACCOUNTS)) {
    if (policy.isOption(Policy.AUTHORIZED_FOR_ALL_ACCOUNTS) && (byId || byLink)) {
      return;
    }
    TableField<?, Object> accountField = JooqUtils.getTableField(getMetaDataManager(), type, ObjectMetaDataManager.ACCOUNT_FIELD);
    TableField<?, Object> publicField = JooqUtils.getTableField(getMetaDataManager(), type, ObjectMetaDataManager.PUBLIC_FIELD);
    Object accountValue = criteria.get(ObjectMetaDataManager.ACCOUNT_FIELD);
    if (accountField == null || publicField == null || accountValue == null) {
      return;
    }
    ApiRequest request = ApiContext.getContext().getApiRequest();
    // Only allow is_public logic for GET methods
    if (request == null) {
      return;
    }
    if ("GET".equals(request.getMethod()) || ("POST".equals(request.getMethod()) && request.getAction() == null)) {
      criteria.remove(ObjectMetaDataManager.ACCOUNT_FIELD);
      Condition accountCondition = null;
      if (accountValue instanceof io.github.ibuildthecloud.gdapi.condition.Condition) {
        accountCondition = accountField.in(((io.github.ibuildthecloud.gdapi.condition.Condition) accountValue).getValues());
      } else {
        accountCondition = accountField.eq(accountValue);
      }
      criteria.put(Condition.class, publicField.isTrue().or(accountCondition));
    }
  }
}

代码示例来源:origin: rancher/cattle

@Override
public List<? extends Service> getSkipServices(long accountId) {
  return create()
      .select(SERVICE.fields())
      .from(SERVICE)
      .where(SERVICE.ACCOUNT_ID.eq(accountId)
          .and(SERVICE.REMOVED.isNull())
          .and(SERVICE.SKIP.isTrue()))
      .fetchInto(ServiceRecord.class);
}

代码示例来源:origin: org.jooq/jooq-meta

@Override
  public void run(Connection connection) throws SQLException {
    DatabaseMetaData meta = connection.getMetaData();
    for (String table : create()
        .selectDistinct(DB_INDEX.CLASS_NAME)
        .from(DB_INDEX)
        .where(DB_INDEX.IS_FOREIGN_KEY.isTrue())
        .fetch(DB_INDEX.CLASS_NAME)) {
      for (Record record : create().fetch(meta.getImportedKeys(null, null, table))) {
        String foreignKeyName =
          record.get("FKTABLE_NAME", String.class) +
          "__" +
          record.get("FK_NAME", String.class);
        String foreignKeyTableName = record.get("FKTABLE_NAME", String.class);
        String foreignKeyColumnName = record.get("FKCOLUMN_NAME", String.class);
        String uniqueKeyName =
          record.get("PKTABLE_NAME", String.class) +
          "__" +
          record.get("PK_NAME", String.class);
        TableDefinition referencingTable = getTable(getSchemata().get(0), foreignKeyTableName);
        if (referencingTable != null) {
          ColumnDefinition column = referencingTable.getColumn(foreignKeyColumnName);
          relations.addForeignKey(foreignKeyName, uniqueKeyName, column, getSchemata().get(0));
        }
      }
    }
  }
});

代码示例来源:origin: rancher/cattle

@Override
  public boolean isSchedulerServiceEnabled(Long accountId) {
    return create()
        .select(SERVICE.ID)
        .from(SERVICE)
        .where(SERVICE.ACCOUNT_ID.equal(accountId)
        .and(SERVICE.SYSTEM.isTrue())
        .and(SERVICE.REMOVED.isNull())
        .and(SERVICE.STATE.notIn(INACTIVE_STATES))
        .and(SERVICE.DATA.like("%io.rancher.container.agent_service.scheduling%"))).fetch().size() > 0;
  }
}

代码示例来源:origin: rancher/cattle

@Override
public List<Long> getAgentProviderIgnoreHealth(String providedServiceLabel, long accountId) {
  return Arrays.asList(create().select(INSTANCE.AGENT_ID)
      .from(INSTANCE)
      .join(INSTANCE_LABEL_MAP)
        .on(INSTANCE_LABEL_MAP.INSTANCE_ID.eq(INSTANCE.ID))
      .join(LABEL)
        .on(LABEL.ID.eq(INSTANCE_LABEL_MAP.LABEL_ID).and(LABEL.KEY.eq(providedServiceLabel)))
      .where(INSTANCE.ACCOUNT_ID.eq(accountId)
          .and(INSTANCE.AGENT_ID.isNotNull())
          .and(INSTANCE.SYSTEM.isTrue())
          .and(INSTANCE.STATE.in(InstanceConstants.STATE_RUNNING, InstanceConstants.STATE_STARTING)))
      .orderBy(INSTANCE.AGENT_ID.asc())
      .fetch().intoArray(INSTANCE.AGENT_ID));
}

代码示例来源:origin: rancher/cattle

@Override
public List<? extends Volume> findBadNativeVolumes(int count) {
  return create().select(VOLUME.fields())
      .from(VOLUME)
      .join(MOUNT)
        .on(MOUNT.VOLUME_ID.eq(VOLUME.ID))
      .join(INSTANCE)
        .on(MOUNT.INSTANCE_ID.eq(INSTANCE.ID))
      .where(INSTANCE.STATE.eq(CommonStatesConstants.PURGED)
          .and(VOLUME.STATE.eq(CommonStatesConstants.INACTIVE))
          .and(INSTANCE.NATIVE_CONTAINER.isTrue()))
      .limit(count)
      .fetchInto(VolumeRecord.class);
}

代码示例来源:origin: rancher/cattle

@Override
public List<? extends Stack> getStacksThatMatch(Collection<String> currentIds) {
  return create().select(STACK.fields())
    .from(STACK)
    .leftOuterJoin(SCHEDULED_UPGRADE)
      .on(SCHEDULED_UPGRADE.STACK_ID.eq(STACK.ID)
          .and(SCHEDULED_UPGRADE.REMOVED.isNull())
          .and(SCHEDULED_UPGRADE.FINISHED.isNull()))
    .where(STACK.REMOVED.isNull()
        .and(STACK.SYSTEM.isTrue())
        .and(STACK.EXTERNAL_ID.in(currentIds))
        .and(SCHEDULED_UPGRADE.ID.isNull()))
    .fetchInto(StackRecord.class);
}

代码示例来源:origin: rancher/cattle

@Override
public List<? extends Stack> getStacksToUpgrade(Collection<String> currentIds) {
  return create().select(STACK.fields())
    .from(STACK)
    .leftOuterJoin(SCHEDULED_UPGRADE)
      .on(SCHEDULED_UPGRADE.STACK_ID.eq(STACK.ID)
          .and(SCHEDULED_UPGRADE.REMOVED.isNull())
          .and(SCHEDULED_UPGRADE.FINISHED.isNull()))
    .where(STACK.REMOVED.isNull()
        .and(STACK.SYSTEM.isTrue())
        .and(STACK.EXTERNAL_ID.notIn(currentIds))
        .and(SCHEDULED_UPGRADE.ID.isNull()))
    .fetchInto(StackRecord.class);
}

相关文章