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")); } } }
systemMap.getInt("numCores"), systemMap.getString("cpuArch"), systemMap.getBoolean("numaEnabled") ); final BasicDBObject osMap = (BasicDBObject) hostInfoResult.get("os");
memoryMap.getInt("resident"), memoryMap.getInt("virtual"), memoryMap.getBoolean("supported"), memoryMap.getInt("mapped"), memoryMap.getInt("mappedWithJournal", -1)
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"));
/** * 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; }
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"); }
/** * 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; }
/** * 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; }
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); } } } }
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);
.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))));
.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))));
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; }
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; }
@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(); } } }
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(); } }
while (realmsCursor.hasNext()) { BasicDBObject realm = (BasicDBObject) realmsCursor.next(); boolean updateProfileOnInitialSocialLogin = realm.getBoolean("updateProfileOnInitialSocialLogin"); BasicDBObject socialConfig = (BasicDBObject) realm.get("socialConfig");
systemMap.getInt("numCores"), systemMap.getString("cpuArch"), systemMap.getBoolean("numaEnabled") ); final BasicDBObject osMap = (BasicDBObject) hostInfoResult.get("os");
memoryMap.getInt("resident"), memoryMap.getInt("virtual"), memoryMap.getBoolean("supported"), memoryMap.getInt("mapped"), memoryMap.getInt("mappedWithJournal", -1)