protected boolean isDistributedCommand() { return getDatabase().getStorage() instanceof OAutoshardedStorage && !((OAutoshardedStorage) getDatabase().getStorage()) .isLocalEnv(); }
public void checkEmbedded() { if (!(getDatabase().getStorage().getUnderlying() instanceof OAbstractPaginatedStorage)) throw new OSchemaException("'Internal' schema modification methods can be used only inside of embedded database"); }
protected void checkForDateFormat(final String iDateAsString) { if (iDateAsString != null) if (globalRef.getType() == OType.DATE) { try { getDatabase().getStorage().getConfiguration().getDateFormatInstance().parse(iDateAsString); } catch (ParseException e) { throw OException .wrapException(new OSchemaException("Invalid date format while formatting date '" + iDateAsString + "'"), e); } } else if (globalRef.getType() == OType.DATETIME) { try { getDatabase().getStorage().getConfiguration().getDateTimeFormatInstance().parse(iDateAsString); } catch (ParseException e) { throw OException .wrapException(new OSchemaException("Invalid datetime format while formatting date '" + iDateAsString + "'"), e); } } }
/** * Remove the index on property * * @deprecated Use {@link OIndexManager#dropIndex(String)} instead. */ @Deprecated public OPropertyImpl dropIndexes() { getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_DELETE); acquireSchemaReadLock(); try { final OIndexManager indexManager = getDatabase().getMetadata().getIndexManager(); final ArrayList<OIndex<?>> relatedIndexes = new ArrayList<OIndex<?>>(); for (final OIndex<?> index : indexManager.getClassIndexes(owner.getName())) { final OIndexDefinition definition = index.getDefinition(); if (OCollections.indexOf(definition.getFields(), globalRef.getName(), new OCaseInsentiveComparator()) > -1) { if (definition instanceof OPropertyIndexDefinition) { relatedIndexes.add(index); } else { throw new IllegalArgumentException( "This operation applicable only for property indexes. " + index.getName() + " is " + index.getDefinition()); } } } for (final OIndex<?> index : relatedIndexes) getDatabase().getMetadata().getIndexManager().dropIndex(index.getName()); return this; } finally { releaseSchemaReadLock(); } }
setLinkedClass(getDatabase().getMetadata().getSchema().getClass(stringValue)); break; case LINKEDTYPE: