com.mongodb.BasicDBObject.getBoolean()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(91)

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

BasicDBObject.getBoolean介绍

暂无

代码示例

代码示例来源:origin: MorphiaOrg/morphia

private void assertBackground(final List<DBObject> indexInfo) {
  for (final DBObject dbObject : indexInfo) {
    BasicDBObject index = (BasicDBObject) dbObject;
    if (!index.getString("name").equals("_id_")) {
      Assert.assertTrue(index.getBoolean("background"));
    }
  }
}

代码示例来源:origin: Graylog2/graylog2-server

systemMap.getInt("numCores"),
    systemMap.getString("cpuArch"),
    systemMap.getBoolean("numaEnabled")
);
final BasicDBObject osMap = (BasicDBObject) hostInfoResult.get("os");

代码示例来源:origin: Graylog2/graylog2-server

memoryMap.getInt("resident"),
memoryMap.getInt("virtual"),
memoryMap.getBoolean("supported"),
memoryMap.getInt("mapped"),
memoryMap.getInt("mappedWithJournal", -1)

代码示例来源:origin: MorphiaOrg/morphia

assertEquals("upper", collation.get("caseFirst"));
assertEquals("shifted", collation.get("alternate"));
Assert.assertTrue(collation.getBoolean("backwards"));
assertEquals("upper", collation.get("caseFirst"));
Assert.assertTrue(collation.getBoolean("caseLevel"));
assertEquals("space", collation.get("maxVariable"));
Assert.assertTrue(collation.getBoolean("normalization"));
Assert.assertTrue(collation.getBoolean("numericOrdering"));
assertEquals(5, collation.get("strength"));

代码示例来源:origin: apache/gora

/**
 * Access field as a boolean.
 *
 * @param fieldName fully qualified name of the field to be accessed
 * @return value of the field as a boolean
 */
public Boolean getBoolean(String fieldName) {
 BasicDBObject parent = getFieldParent(fieldName);
 String lf = getLeafName(fieldName);
 return parent.containsField(lf) ? parent.getBoolean(lf) : null;
}

代码示例来源:origin: shekhargulati/todoapp-spark

public Todo(BasicDBObject dbObject) {
  this.id = ((ObjectId) dbObject.get("_id")).toString();
  this.title = dbObject.getString("title");
  this.done = dbObject.getBoolean("done");
  this.createdOn = dbObject.getDate("createdOn");
}

代码示例来源:origin: apache/jackrabbit-oak

/**
 * Check if the majority read concern is supported by this storage engine.
 * The fact that read concern is supported doesn't it can be used - it also
 * has to be enabled.
 *
 * @return true if the majority read concern is supported
 */
public boolean isMajorityReadConcernSupported() {
  if (majorityReadConcernSupported == null) {
    BasicDBObject stat = getServerStatus();
    if (stat.isEmpty()) {
      LOG.debug("User doesn't have privileges to get server status; falling back to the isMajorityReadConcernEnabled()");
      return isMajorityReadConcernEnabled();
    } else {
      if (stat.containsField("storageEngine")) {
        BasicDBObject storageEngine = (BasicDBObject) stat.get("storageEngine");
        majorityReadConcernSupported = storageEngine.getBoolean("supportsCommittedReads");
      } else {
        majorityReadConcernSupported = false;
      }
    }
  }
  return majorityReadConcernSupported;
}

代码示例来源:origin: org.apache.jackrabbit/oak-store-document

/**
 * Check if the majority read concern is supported by this storage engine.
 * The fact that read concern is supported doesn't it can be used - it also
 * has to be enabled.
 *
 * @return true if the majority read concern is supported
 */
public boolean isMajorityReadConcernSupported() {
  if (majorityReadConcernSupported == null) {
    BasicDBObject stat = getServerStatus();
    if (stat.isEmpty()) {
      LOG.debug("User doesn't have privileges to get server status; falling back to the isMajorityReadConcernEnabled()");
      return isMajorityReadConcernEnabled();
    } else {
      if (stat.containsField("storageEngine")) {
        BasicDBObject storageEngine = (BasicDBObject) stat.get("storageEngine");
        majorityReadConcernSupported = storageEngine.getBoolean("supportsCommittedReads");
      } else {
        majorityReadConcernSupported = false;
      }
    }
  }
  return majorityReadConcernSupported;
}

代码示例来源:origin: ch.epfl.bbp.nlp/bluima_mongodb

public static void readFieldFromDb(String fieldKey, String range,
      Annotation a, Feature f, BasicDBObject dbO, JCas jCas) {

    if (dbO.containsField(fieldKey)) {

      if (range.equals("String")) {
        a.setStringValue(f, dbO.getString(fieldKey));
      } else if (range.equals("StringArray")) {
        BasicDBList vals = (BasicDBList) dbO.get(fieldKey);
        StringArray sa = new StringArray(jCas, vals.size());
        for (int i = 0; i < vals.size(); i++) {
          sa.set(i, vals.get(i).toString());
        }
        a.setFeatureValue(f, sa);
      } else if (range.equals("Integer")) {
        a.setIntValue(f, dbO.getInt(fieldKey));
      } else if (range.equals("Float")) {
        a.setFloatValue(f, (float) dbO.getDouble(fieldKey));
      } else if (range.equals("Boolean")) {
        a.setBooleanValue(f, dbO.getBoolean(fieldKey));
      } else {
        LOG.warn("range not supported " + range);
      }
    }
  }
}

代码示例来源:origin: epam/DLab

String remoteIp = uiDoc.getString("remoteIp", "");
BasicDBList roles = (BasicDBList) uiDoc.get("roles");
Boolean awsUser = uiDoc.getBoolean("awsUser", false);
UserInfo ui = new UserInfo(name, accessToken);
ui.setFirstName(firstName);

代码示例来源:origin: org.apache.rya/mongodb.rya

.setRyaInstanceName(basicObj.getString(INSTANCE_KEY))
.setRyaVersion(basicObj.getString(VERSION_KEY))
.setEntityCentricIndexDetails(new EntityCentricIndexDetails(basicObj.getBoolean(ENTITY_DETAILS_KEY)))
.setTemporalIndexDetails(new TemporalIndexDetails(basicObj.getBoolean(TEMPORAL_DETAILS_KEY)))
.setFreeTextDetails(new FreeTextIndexDetails(basicObj.getBoolean(FREETEXT_DETAILS_KEY)))
.setProspectorDetails(new ProspectorDetails(Optional.<Date>fromNullable(basicObj.getDate(PROSPECTOR_DETAILS_KEY))))
.setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.<Date>fromNullable(basicObj.getDate(JOIN_SELECTIVITY_DETAILS_KEY))));

代码示例来源:origin: apache/incubator-rya

.setRyaInstanceName(basicObj.getString(INSTANCE_KEY))
.setRyaVersion(basicObj.getString(VERSION_KEY))
.setEntityCentricIndexDetails(new EntityCentricIndexDetails(basicObj.getBoolean(ENTITY_DETAILS_KEY)))
.setTemporalIndexDetails(new TemporalIndexDetails(basicObj.getBoolean(TEMPORAL_DETAILS_KEY)))
.setFreeTextDetails(new FreeTextIndexDetails(basicObj.getBoolean(FREETEXT_DETAILS_KEY)))
.setProspectorDetails(new ProspectorDetails(Optional.<Date>fromNullable(basicObj.getDate(PROSPECTOR_DETAILS_KEY))))
.setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.<Date>fromNullable(basicObj.getDate(JOIN_SELECTIVITY_DETAILS_KEY))));

代码示例来源:origin: org.apache.rya/mongodb.rya

private static PCJIndexDetails.Builder getPCJIndexDetails(final BasicDBObject basicObj) {
  final BasicDBObject pcjIndexDBO = (BasicDBObject) basicObj.get(PCJ_DETAILS_KEY);
  final PCJIndexDetails.Builder pcjBuilder = PCJIndexDetails.builder();
  if (!pcjIndexDBO.getBoolean(PCJ_ENABLED_KEY)) {
    pcjBuilder.setEnabled(false);
  } else {
    pcjBuilder.setEnabled(true);//no fluo details to set since mongo has no fluo support
    final BasicDBList pcjs = (BasicDBList) pcjIndexDBO.get(PCJ_PCJS_KEY);
    if (pcjs != null) {
      for (int ii = 0; ii < pcjs.size(); ii++) {
        final BasicDBObject pcj = (BasicDBObject) pcjs.get(ii);
        pcjBuilder.addPCJDetails(toPCJDetails(pcj));
      }
    }
  }
  return pcjBuilder;
}

代码示例来源:origin: apache/incubator-rya

private static PCJIndexDetails.Builder getPCJIndexDetails(final BasicDBObject basicObj) {
  final BasicDBObject pcjIndexDBO = (BasicDBObject) basicObj.get(PCJ_DETAILS_KEY);
  final PCJIndexDetails.Builder pcjBuilder = PCJIndexDetails.builder();
  if (!pcjIndexDBO.getBoolean(PCJ_ENABLED_KEY)) {
    pcjBuilder.setEnabled(false);
  } else {
    pcjBuilder.setEnabled(true);//no fluo details to set since mongo has no fluo support
    final BasicDBList pcjs = (BasicDBList) pcjIndexDBO.get(PCJ_PCJS_KEY);
    if (pcjs != null) {
      for (int ii = 0; ii < pcjs.size(); ii++) {
        final BasicDBObject pcj = (BasicDBObject) pcjs.get(ii);
        pcjBuilder.addPCJDetails(toPCJDetails(pcj));
      }
    }
  }
  return pcjBuilder;
}

代码示例来源:origin: org.keycloak/keycloak-model-mongo

@Override
  public void update(KeycloakSession session) throws ClassNotFoundException {
    DBCollection clients = db.getCollection("clients");
    DBCursor clientsCursor = clients.find();

    try {
      while (clientsCursor.hasNext()) {
        BasicDBObject client = (BasicDBObject) clientsCursor.next();

        boolean directGrantsOnly = client.getBoolean("directGrantsOnly", false);
        client.append("standardFlowEnabled", !directGrantsOnly);
        client.append("implicitFlowEnabled", false);
        client.append("directAccessGrantsEnabled", directGrantsOnly);
        client.removeField("directGrantsOnly");

        clients.save(client);
      }
    } finally {
      clientsCursor.close();
    }
  }
}

代码示例来源:origin: org.keycloak/keycloak-model-mongo

private void updateIdentityProviders() {
  DBCollection realms = db.getCollection("realms");
  DBCursor realmsCursor = realms.find();
  try {
    while (realmsCursor.hasNext()) {
      BasicDBObject realm = (BasicDBObject) realmsCursor.next();
      BasicDBList identityProviders = (BasicDBList) realm.get("identityProviders");
      if (identityProviders != null) {
        for (Object ipObj : identityProviders) {
          BasicDBObject identityProvider = (BasicDBObject) ipObj;
          boolean updateProfileFirstLogin = identityProvider.getBoolean("updateProfileFirstLogin");
          String upflMode = updateProfileFirstLogin ? IdentityProviderRepresentation.UPFLM_ON : IdentityProviderRepresentation.UPFLM_OFF;
          identityProvider.put("updateProfileFirstLoginMode", upflMode);
          identityProvider.removeField("updateProfileFirstLogin");
          identityProvider.put("trustEmail", false);
        }
      }
      realms.save(realm);
    }
  } finally {
    realmsCursor.close();
  }
}

代码示例来源:origin: org.keycloak/keycloak-model-mongo

while (realmsCursor.hasNext()) {
  BasicDBObject realm = (BasicDBObject) realmsCursor.next();
  boolean updateProfileOnInitialSocialLogin = realm.getBoolean("updateProfileOnInitialSocialLogin");
  BasicDBObject socialConfig = (BasicDBObject) realm.get("socialConfig");

代码示例来源:origin: org.graylog2/graylog2-server

systemMap.getInt("numCores"),
    systemMap.getString("cpuArch"),
    systemMap.getBoolean("numaEnabled")
);
final BasicDBObject osMap = (BasicDBObject) hostInfoResult.get("os");

代码示例来源:origin: org.graylog2/graylog2-server

memoryMap.getInt("resident"),
memoryMap.getInt("virtual"),
memoryMap.getBoolean("supported"),
memoryMap.getInt("mapped"),
memoryMap.getInt("mappedWithJournal", -1)

相关文章