/** * Browse all documents. */ public Iterable<ODocument> browse(final ODatabaseDocumentTx db) { checkNotNull(db); return db.browseClass(DB_CLASS); } }
/** * Browse all documents. */ public Iterable<ODocument> browseDocuments(final ODatabaseDocumentTx db) { checkNotNull(db); return db.browseClass(typeName); }
try (ODatabaseDocumentTx db = configDatabaseInstance.get().connect()) { List<ODocument> allBlobStores = stream(db.browseClass(DB_CLASS).spliterator(), false) .collect(toList());
@VisibleForTesting void updateRepositoriesForRenamedBlobStores(Map<String, String> renamedBlobStores) { try (ODatabaseDocumentTx db = configDatabaseInstance.get().connect()) { stream(db.browseClass("repository").spliterator(), false) .forEach(doc -> { Map<String, Map<String, Object>> attributes = doc.field(ATTRIBUTES); if (attributes != null) { Map<String, Object> storage = attributes.get("storage"); if (storage != null) { String blobStoreName = (String) storage.get(BLOB_STORE_NAME); if (renamedBlobStores.containsKey(blobStoreName)) { storage.put(BLOB_STORE_NAME, renamedBlobStores.get(blobStoreName)); doc.field(ATTRIBUTES, attributes).save(); } } } }); } }
@VisibleForTesting void updateBlobStoreJobs(Map<String, String> renamedBlobStores) { try (ODatabaseDocumentTx db = configDatabaseInstance.get().connect()) { stream(db.browseClass("quartz_job_detail").spliterator(), false) .forEach(doc -> { Map<String, Map<String, Object>> valueData = doc.field("value_data"); Map<String, Object> jobDataMap = getJobData(doc, valueData); if (jobDataMap == null) { return; } String blobStoreName = (String) jobDataMap.get(BLOBSTORE_NAME_DETAIL_FIELD); if (renamedBlobStores.containsKey(blobStoreName)) { jobDataMap.put(BLOBSTORE_NAME_DETAIL_FIELD, renamedBlobStores.get(blobStoreName)); doc.field("value_data", valueData).save(); } }); } }
if (requireLogin == null || requireLogin.isEmpty() || !requireLogin.equalsIgnoreCase("true")) { IUser user = docToUser(db.browseClass("User").next());
for (OIdentifiable id : g.getRawGraph().browseClass("V")) { startingVertices.add(id.getIdentity()); if (limit > -1 && startingVertices.size() >= limit)
private static <R extends Record, E extends Throwable> void forEachRecord(final ODatabaseDocumentTx database, final OClass documentClass, final Class<R> recordType, final Predicate<? super Comparable<?>> filter, final EntryReader<? super Comparable<?>, ? super R, E> reader) throws E{ final ORecordIteratorClass<ODocument> records = database.browseClass(documentClass.getName()); while (records.hasNext()){ final ODocument document = records.next(); final PersistentRecord record; if(document instanceof PersistentRecord) record = (PersistentRecord) document; else { record = new PersistentRecord(document); database.reload(record); } record.lock(false); try { final Comparable<?> key; if (filter.test(key = record.getKey())) if(!reader.accept(key, recordType.cast(record))) return; } finally { record.unlock(); } } }
for (ODocument doc : db.browseClass(TABLE_NAME)) for (ODocument doc : db.browseClass(TABLE_NAME))
for (ODocument document : db.browseClass(type.getName())) { ORID rid = document.getIdentity(); if (rid.getClusterId() != primaryClusterId) {
doc = db.browseClass("UserGroup").next();