use of com.robotoworks.mechanoid.db.sqliteModel.SingleSource in project mechanoid by robotoworks.
the class ModelUtil method getAllReferenceableColumns.
public static ArrayList<EObject> getAllReferenceableColumns(final SelectExpression expr, final boolean includeAliases) {
final ArrayList<EObject> items = Lists.<EObject>newArrayList();
boolean _and = false;
SelectList _selectList = expr.getSelectList();
boolean _notEquals = (!Objects.equal(_selectList, null));
if (!_notEquals) {
_and = false;
} else {
_and = includeAliases;
}
if (_and) {
SelectList _selectList_1 = expr.getSelectList();
EList<ColumnSource> _resultColumns = _selectList_1.getResultColumns();
final Function1<ColumnSource, Boolean> _function = new Function1<ColumnSource, Boolean>() {
public Boolean apply(final ColumnSource it) {
String _name = it.getName();
return Boolean.valueOf((!Objects.equal(_name, null)));
}
};
Iterable<ColumnSource> _filter = IterableExtensions.<ColumnSource>filter(_resultColumns, _function);
Iterables.<EObject>addAll(items, _filter);
}
ArrayList<SingleSource> _findAllSingleSources = ModelUtil.findAllSingleSources(expr);
final Function1<SingleSource, Boolean> _function_1 = new Function1<SingleSource, Boolean>() {
public Boolean apply(final SingleSource item) {
if ((item instanceof SingleSourceTable)) {
String _name = ((SingleSourceTable) item).getName();
return Boolean.valueOf(Objects.equal(_name, null));
}
return Boolean.valueOf(false);
}
};
Iterable<SingleSource> _filter_1 = IterableExtensions.<SingleSource>filter(_findAllSingleSources, _function_1);
final Consumer<SingleSource> _function_2 = new Consumer<SingleSource>() {
public void accept(final SingleSource item) {
SingleSourceTable source = ((SingleSourceTable) item);
DDLStatement _ancestorOfType = ModelUtil.<DDLStatement>getAncestorOfType(item, DDLStatement.class);
TableDefinition _tableReference = source.getTableReference();
ArrayList<EObject> _findColumnDefs = ModelUtil.findColumnDefs(_ancestorOfType, _tableReference);
items.addAll(_findColumnDefs);
}
};
_filter_1.forEach(_function_2);
return items;
}
use of com.robotoworks.mechanoid.db.sqliteModel.SingleSource in project mechanoid by robotoworks.
the class ModelUtil method getAllReferenceableSingleSources.
public static ArrayList<EObject> getAllReferenceableSingleSources(final SelectCoreExpression expr) {
final ArrayList<EObject> items = Lists.<EObject>newArrayList();
if ((expr instanceof SelectCore)) {
SelectCoreExpression _left = ((SelectCore) expr).getLeft();
ArrayList<EObject> _allReferenceableSingleSources = ModelUtil.getAllReferenceableSingleSources(_left);
items.addAll(_allReferenceableSingleSources);
SelectCoreExpression _right = ((SelectCore) expr).getRight();
ArrayList<EObject> _allReferenceableSingleSources_1 = ModelUtil.getAllReferenceableSingleSources(_right);
items.addAll(_allReferenceableSingleSources_1);
} else {
if ((expr instanceof SelectExpression)) {
ArrayList<SingleSource> _findAllSingleSources = ModelUtil.findAllSingleSources(((SelectExpression) expr));
items.addAll(_findAllSingleSources);
}
}
return items;
}
use of com.robotoworks.mechanoid.db.sqliteModel.SingleSource in project mechanoid by robotoworks.
the class ModelUtil method findAllSingleSources.
public static ArrayList<SingleSource> findAllSingleSources(final SelectExpression expr) {
final ArrayList<SingleSource> items = Lists.<SingleSource>newArrayList();
JoinSource _source = expr.getSource();
SingleSource _source_1 = _source.getSource();
items.add(_source_1);
JoinSource _source_2 = expr.getSource();
EList<JoinStatement> _joinStatements = _source_2.getJoinStatements();
for (final JoinStatement join : _joinStatements) {
SingleSource _singleSource = join.getSingleSource();
items.add(_singleSource);
}
return items;
}
use of com.robotoworks.mechanoid.db.sqliteModel.SingleSource in project mechanoid by robotoworks.
the class JoinSourceImpl method basicSetSource.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSource(SingleSource newSource, NotificationChain msgs) {
SingleSource oldSource = source;
source = newSource;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SqliteModelPackage.JOIN_SOURCE__SOURCE, oldSource, newSource);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of com.robotoworks.mechanoid.db.sqliteModel.SingleSource in project mechanoid by robotoworks.
the class JoinStatementImpl method basicSetSingleSource.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSingleSource(SingleSource newSingleSource, NotificationChain msgs) {
SingleSource oldSingleSource = singleSource;
singleSource = newSingleSource;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SqliteModelPackage.JOIN_STATEMENT__SINGLE_SOURCE, oldSingleSource, newSingleSource);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
Aggregations