Search in sources :

Example 21 with ColumnSource

use of com.robotoworks.mechanoid.db.sqliteModel.ColumnSource in project mechanoid by robotoworks.

the class ActiveRecordGenerator method _generateMakeDirtyStatements.

protected CharSequence _generateMakeDirtyStatements(final CreateViewStatement stmt) {
    StringConcatenation _builder = new StringConcatenation();
    ArrayList<ColumnSource> cols = ModelUtil.getViewResultColumns(stmt);
    _builder.newLineIfNotEmpty();
    {
        final Function1<ColumnSource, Boolean> _function = new Function1<ColumnSource, Boolean>() {

            public Boolean apply(final ColumnSource it) {
                String _name = it.getName();
                boolean _equals = _name.equals("_id");
                return Boolean.valueOf((!_equals));
            }
        };
        Iterable<ColumnSource> _filter = IterableExtensions.<ColumnSource>filter(cols, _function);
        for (final ColumnSource col : _filter) {
            _builder.append("m");
            String _name = col.getName();
            String _pascalize = Strings.pascalize(_name);
            _builder.append(_pascalize, "");
            _builder.append("Dirty = dirty;");
            _builder.newLineIfNotEmpty();
        }
    }
    return _builder;
}
Also used : StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Function1(org.eclipse.xtext.xbase.lib.Functions.Function1) ColumnSource(com.robotoworks.mechanoid.db.sqliteModel.ColumnSource)

Aggregations

ColumnSource (com.robotoworks.mechanoid.db.sqliteModel.ColumnSource)21 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)13 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)12 ColumnType (com.robotoworks.mechanoid.db.sqliteModel.ColumnType)8 ResultColumn (com.robotoworks.mechanoid.db.sqliteModel.ResultColumn)5 EList (org.eclipse.emf.common.util.EList)5 ColumnDef (com.robotoworks.mechanoid.db.sqliteModel.ColumnDef)4 ArrayList (java.util.ArrayList)4 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)4 CreateTableStatement (com.robotoworks.mechanoid.db.sqliteModel.CreateTableStatement)2 CreateViewStatement (com.robotoworks.mechanoid.db.sqliteModel.CreateViewStatement)2 SelectCoreExpression (com.robotoworks.mechanoid.db.sqliteModel.SelectCoreExpression)2 SelectExpression (com.robotoworks.mechanoid.db.sqliteModel.SelectExpression)2 SelectList (com.robotoworks.mechanoid.db.sqliteModel.SelectList)2 TableDefinition (com.robotoworks.mechanoid.db.sqliteModel.TableDefinition)2 Consumer (java.util.function.Consumer)2 EObject (org.eclipse.emf.ecore.EObject)2 AlterTableAddColumnStatement (com.robotoworks.mechanoid.db.sqliteModel.AlterTableAddColumnStatement)1 CastExpression (com.robotoworks.mechanoid.db.sqliteModel.CastExpression)1 ColumnSourceRef (com.robotoworks.mechanoid.db.sqliteModel.ColumnSourceRef)1