use of com.robotoworks.mechanoid.db.sqliteModel.CreateViewStatement in project mechanoid by robotoworks.
the class StatementSequenceValidator method _sequence.
protected void _sequence(final DropViewStatement stmt) {
CreateViewStatement _view = stmt.getView();
String _name = _view.getName();
this.views.remove(_name);
}
use of com.robotoworks.mechanoid.db.sqliteModel.CreateViewStatement in project mechanoid by robotoworks.
the class DropViewStatementImpl method setView.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setView(CreateViewStatement newView) {
CreateViewStatement oldView = view;
view = newView;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SqliteModelPackage.DROP_VIEW_STATEMENT__VIEW, oldView, view));
}
use of com.robotoworks.mechanoid.db.sqliteModel.CreateViewStatement 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.CreateViewStatement in project mechanoid by robotoworks.
the class ModelUtil method getConfigInitViews.
public static Collection<CreateViewStatement> getConfigInitViews(final Model model) {
final ArrayList<CreateViewStatement> items = Lists.<CreateViewStatement>newArrayList();
DatabaseBlock _database = model.getDatabase();
InitBlock _init = _database.getInit();
boolean _notEquals = (!Objects.equal(_init, null));
if (_notEquals) {
DatabaseBlock _database_1 = model.getDatabase();
InitBlock _init_1 = _database_1.getInit();
EList<DDLStatement> _statements = _init_1.getStatements();
Iterable<CreateViewStatement> _filter = Iterables.<CreateViewStatement>filter(_statements, CreateViewStatement.class);
Iterables.<CreateViewStatement>addAll(items, _filter);
}
return items;
}
use of com.robotoworks.mechanoid.db.sqliteModel.CreateViewStatement in project mechanoid by robotoworks.
the class ModelUtil method getAllViewsInConfigInitReferencingTable.
public static HashSet<CreateViewStatement> getAllViewsInConfigInitReferencingTable(final Model model, final TableDefinition tableDef) {
HashSet<CreateViewStatement> matches = new HashSet<CreateViewStatement>();
Collection<CreateViewStatement> _configInitViews = ModelUtil.getConfigInitViews(model);
for (final CreateViewStatement view : _configInitViews) {
boolean _isDefinitionReferencedByView = ModelUtil.isDefinitionReferencedByView(tableDef, view);
if (_isDefinitionReferencedByView) {
matches.add(view);
}
}
return matches;
}
Aggregations