use of com.robotoworks.mechanoid.db.sqliteModel.SelectList in project mechanoid by robotoworks.
the class SelectExpressionImpl method basicSetSelectList.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSelectList(SelectList newSelectList, NotificationChain msgs) {
SelectList oldSelectList = selectList;
selectList = newSelectList;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SqliteModelPackage.SELECT_EXPRESSION__SELECT_LIST, oldSelectList, newSelectList);
if (msgs == null)
msgs = notification;
else
msgs.add(notification);
}
return msgs;
}
use of com.robotoworks.mechanoid.db.sqliteModel.SelectList in project mechanoid by robotoworks.
the class ModelUtil method getViewResultColumns.
public static ArrayList<ColumnSource> getViewResultColumns(final CreateViewStatement stmt) {
ArrayList<ColumnSource> result = new ArrayList<ColumnSource>();
SelectStatement _selectStatement = stmt.getSelectStatement();
SelectCoreExpression coreExpr = _selectStatement.getCore();
if ((coreExpr instanceof SelectCore)) {
SelectCore core = ((SelectCore) coreExpr);
SelectCoreExpression _right = core.getRight();
SelectList selectList = ((SelectExpression) _right).getSelectList();
boolean _notEquals = (!Objects.equal(selectList, null));
if (_notEquals) {
EList<ColumnSource> _resultColumns = selectList.getResultColumns();
final Function1<ColumnSource, Boolean> _function = new Function1<ColumnSource, Boolean>() {
public Boolean apply(final ColumnSource it) {
boolean _and = false;
String _name = it.getName();
boolean _notEquals = (!Objects.equal(_name, null));
if (!_notEquals) {
_and = false;
} else {
String _name_1 = it.getName();
boolean _equals = _name_1.equals("");
boolean _not = (!_equals);
_and = _not;
}
return Boolean.valueOf(_and);
}
};
Iterable<ColumnSource> _filter = IterableExtensions.<ColumnSource>filter(_resultColumns, _function);
Iterables.<ColumnSource>addAll(result, _filter);
}
} else {
SelectList selectList_1 = ((SelectExpression) coreExpr).getSelectList();
boolean _notEquals_1 = (!Objects.equal(selectList_1, null));
if (_notEquals_1) {
EList<ColumnSource> _resultColumns_1 = selectList_1.getResultColumns();
final Function1<ColumnSource, Boolean> _function_1 = new Function1<ColumnSource, Boolean>() {
public Boolean apply(final ColumnSource it) {
boolean _and = false;
String _name = it.getName();
boolean _notEquals = (!Objects.equal(_name, null));
if (!_notEquals) {
_and = false;
} else {
String _name_1 = it.getName();
boolean _equals = _name_1.equals("");
boolean _not = (!_equals);
_and = _not;
}
return Boolean.valueOf(_and);
}
};
Iterable<ColumnSource> _filter_1 = IterableExtensions.<ColumnSource>filter(_resultColumns_1, _function_1);
Iterables.<ColumnSource>addAll(result, _filter_1);
}
}
return result;
}
use of com.robotoworks.mechanoid.db.sqliteModel.SelectList 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.SelectList in project mechanoid by robotoworks.
the class SqliteModelProposalProvider method completePrimaryExpression_Column.
@Override
public void completePrimaryExpression_Column(EObject model, Assignment assignment, ContentAssistContext context, final ICompletionProposalAcceptor acceptor) {
EObject lastObj = NodeModelUtils.findActualSemanticObjectFor(context.getLastCompleteNode());
EObject currentObj = NodeModelUtils.findActualSemanticObjectFor(context.getCurrentNode());
ICompositeNode node = NodeModelUtils.getNode(lastObj);
if (lastObj instanceof ColumnSourceRef) {
ColumnSourceRef ref = (ColumnSourceRef) lastObj;
if (ref.getColumn() == null) {
lookupCrossReference(ref, SqliteModelPackage.Literals.COLUMN_SOURCE_REF__COLUMN, acceptor, Predicates.<IEObjectDescription>alwaysTrue(), getProposalFactory("column", context));
return;
}
}
SelectList selectList = ModelUtil.getAncestorOfType(currentObj, SelectList.class);
if (selectList != null) {
lookupCrossReference(selectList, SqliteModelPackage.Literals.COLUMN_SOURCE_REF__COLUMN, acceptor, Predicates.<IEObjectDescription>alwaysTrue(), getProposalFactory("column", context));
return;
}
super.completePrimaryExpression_Column(model, assignment, context, acceptor);
}
Aggregations