use of com.orientechnologies.orient.core.storage.OAutoshardedStorage in project orientdb by orientechnologies.
the class OPropertyImpl method setMin.
public OPropertyImpl setMin(final String min) {
getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE);
acquireSchemaWriteLock();
try {
final ODatabaseDocumentInternal database = getDatabase();
final OStorage storage = database.getStorage();
if (storage instanceof OStorageProxy) {
final String cmd = String.format("alter property %s min %s", getFullNameQuoted(), quoteString(min));
database.command(new OCommandSQL(cmd)).execute();
} else if (isDistributedCommand()) {
final String cmd = String.format("alter property %s min %s", getFullNameQuoted(), quoteString(min));
final OCommandSQL commandSQL = new OCommandSQL(cmd);
commandSQL.addExcludedNode(((OAutoshardedStorage) storage).getNodeId());
database.command(commandSQL).execute();
setMinInternal(min);
} else
setMinInternal(min);
} finally {
releaseSchemaWriteLock();
}
return this;
}
use of com.orientechnologies.orient.core.storage.OAutoshardedStorage in project orientdb by orientechnologies.
the class OPropertyImpl method setType.
public OPropertyImpl setType(final OType type) {
getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE);
final ODatabaseDocumentInternal database = getDatabase();
acquireSchemaWriteLock();
try {
final OStorage storage = database.getStorage();
if (storage instanceof OStorageProxy) {
final String cmd = String.format("alter property %s type %s", getFullNameQuoted(), quoteString(type.toString()));
database.command(new OCommandSQL(cmd)).execute();
} else if (isDistributedCommand()) {
final String cmd = String.format("alter property %s type %s", getFullNameQuoted(), quoteString(type.toString()));
final OCommandSQL commandSQL = new OCommandSQL(cmd);
commandSQL.addExcludedNode(((OAutoshardedStorage) storage).getNodeId());
database.command(commandSQL).execute();
setTypeInternal(type);
} else
setTypeInternal(type);
} finally {
releaseSchemaWriteLock();
}
owner.fireDatabaseMigration(database, globalRef.getName(), globalRef.getType());
return this;
}
use of com.orientechnologies.orient.core.storage.OAutoshardedStorage in project orientdb by orientechnologies.
the class OPropertyImpl method setMandatory.
public OPropertyImpl setMandatory(final boolean isMandatory) {
getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE);
acquireSchemaWriteLock();
try {
final ODatabaseDocumentInternal database = getDatabase();
final OStorage storage = database.getStorage();
if (storage instanceof OStorageProxy) {
final String cmd = String.format("alter property %s mandatory %s", getFullNameQuoted(), isMandatory);
database.command(new OCommandSQL(cmd)).execute();
} else if (isDistributedCommand()) {
final String cmd = String.format("alter property %s mandatory %s", getFullNameQuoted(), isMandatory);
final OCommandSQL commandSQL = new OCommandSQL(cmd);
commandSQL.addExcludedNode(((OAutoshardedStorage) storage).getNodeId());
database.command(commandSQL).execute();
setMandatoryInternal(isMandatory);
} else
setMandatoryInternal(isMandatory);
} finally {
releaseSchemaWriteLock();
}
return this;
}
Aggregations