if (!db.getMetadata().getSchema().existsClass(CLASS)) { db.getMetadata().getSchema().createClass(CLASS);
/** * Returns {@code true} if the given schema class exists, otherwise {@code false}. */ protected static boolean hasSchemaClass(final Provider<DatabaseInstance> databaseInstance, final String className) { try (ODatabaseDocumentTx db = databaseInstance.get().connect()) { return db.getMetadata().getSchema().existsClass(className); } }
@Override public void apply() throws Exception { try (ODatabaseDocumentTx db = componentDatabaseInstance.get().connect()) { if(db.getMetadata().getSchema().existsClass("assetdownloadcount")){ int updates = db.command(new OCommandSQL(UPDATE_ASSET_NAME)).execute(); if (updates > 0) { log.info("Updated {} records with null assetIds", updates); } } } } }
/** * Runs a {@link BiConsumer} of {@link ODatabaseDocumentTx} and {@link OClass} * if the specified {@code className} exists. */ protected static void withDatabaseAndClass(final Provider<DatabaseInstance> databaseInstance, final String className, final BiConsumer<ODatabaseDocumentTx, OClass> consumer) { withDatabase(databaseInstance, db -> { if (db.getMetadata().getSchema().existsClass(className)) { consumer.accept(db, db.getMetadata().getSchema().getClass(className)); } }); }
if (db.getMetadata().getSchema().existsClass("Config")) {
/** * {@inheritDoc} * Check whether there exist a schema enforced over OrientDB document class. */ @Override public boolean schemaExists() throws GoraException { try (ODatabaseDocumentTx schemaTx = connectionPool.acquire()) { schemaTx.activateOnCurrentThread(); return schemaTx.getMetadata().getSchema() .existsClass(orientDBMapping.getDocumentClass()); } catch (Exception e) { throw new GoraException(e); } }
if (db.getMetadata().getSchema().existsClass("Config")) {
if (documentDatabase.getMetadata().getSchema().existsClass(iClassName)) cls = documentDatabase.getMetadata().getSchema().getClass(iClassName); else {