use of com.robotoworks.mechanoid.db.sqliteModel.TableDefinition in project mechanoid by robotoworks.
the class ModelUtil method getHistory.
public static LinkedList<TableDefinition> getHistory(final TableDefinition ref) {
LinkedList<TableDefinition> refs = new LinkedList<TableDefinition>();
TableDefinition current = ref;
while ((current instanceof AlterTableRenameStatement)) {
{
refs.add(current);
TableDefinition _table = ((AlterTableRenameStatement) current).getTable();
current = _table;
}
}
refs.add(current);
return refs;
}
use of com.robotoworks.mechanoid.db.sqliteModel.TableDefinition in project mechanoid by robotoworks.
the class ModelUtil method isDefinitionReferencedByView.
public static boolean isDefinitionReferencedByView(final TableDefinition tableDef, final CreateViewStatement view) {
TreeIterator<EObject> _eAllContents = view.eAllContents();
final Function1<EObject, Boolean> _function = new Function1<EObject, Boolean>() {
public Boolean apply(final EObject obj) {
if ((obj instanceof SingleSourceTable)) {
SingleSourceTable sourceTable = ((SingleSourceTable) obj);
TableDefinition _tableReference = sourceTable.getTableReference();
if ((!(_tableReference instanceof CreateViewStatement))) {
TableDefinition _tableReference_1 = sourceTable.getTableReference();
String _name = _tableReference_1.getName();
String _name_1 = tableDef.getName();
boolean _equals = _name.equals(_name_1);
if (_equals) {
return Boolean.valueOf(true);
}
} else {
TableDefinition _tableReference_2 = sourceTable.getTableReference();
return Boolean.valueOf(ModelUtil.isDefinitionReferencedByView(tableDef, ((CreateViewStatement) _tableReference_2)));
}
}
return Boolean.valueOf(false);
}
};
return IteratorExtensions.<EObject>exists(_eAllContents, _function);
}
use of com.robotoworks.mechanoid.db.sqliteModel.TableDefinition in project mechanoid by robotoworks.
the class StatementSequenceValidator method _validateStatement.
protected void _validateStatement(final StatementSequenceValidatorResult result, final CreateTriggerStatement stmt) {
String _name = stmt.getName();
boolean _nameExists = this.nameExists(_name);
if (_nameExists) {
result.valid = false;
result.message = "Name conflict, use another name";
result.feature = SqliteModelPackage.Literals.CREATE_TRIGGER_STATEMENT__NAME;
} else {
TableDefinition _table = stmt.getTable();
String _name_1 = _table.getName();
boolean _contains = this.tables.contains(_name_1);
boolean _not = (!_contains);
if (_not) {
result.valid = false;
result.message = "No such table";
result.feature = SqliteModelPackage.Literals.CREATE_TRIGGER_STATEMENT__TABLE;
}
}
}
use of com.robotoworks.mechanoid.db.sqliteModel.TableDefinition in project mechanoid by robotoworks.
the class UpdateStatementImpl method setTable.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTable(TableDefinition newTable) {
TableDefinition oldTable = table;
table = newTable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SqliteModelPackage.UPDATE_STATEMENT__TABLE, oldTable, table));
}
use of com.robotoworks.mechanoid.db.sqliteModel.TableDefinition in project mechanoid by robotoworks.
the class StatementSequenceValidator method _validateStatement.
protected void _validateStatement(final StatementSequenceValidatorResult result, final AlterTableRenameStatement stmt) {
TableDefinition _table = stmt.getTable();
String _name = _table.getName();
boolean _contains = this.tables.contains(_name);
boolean _not = (!_contains);
if (_not) {
result.valid = false;
result.message = "No such table";
result.feature = SqliteModelPackage.Literals.ALTER_TABLE_RENAME_STATEMENT__TABLE;
} else {
String _name_1 = stmt.getName();
boolean _nameExists = this.nameExists(_name_1);
if (_nameExists) {
result.valid = false;
result.message = "Name conflict, use another name";
result.feature = SqliteModelPackage.Literals.TABLE_DEFINITION__NAME;
}
}
}
Aggregations