Search in sources :

Example 1 with DataSourceAccessMethod

use of org.applause.lang.applauseDsl.DataSourceAccessMethod in project applause by applause.

the class RESTURLsRelativeRESTURLsSpec method dataSourceAccessMethodUrlShouldBe.

public void dataSourceAccessMethodUrlShouldBe(final CharSequence sequence, final String url) {
    try {
        final Model model = this._parseHelper.parse(sequence);
        EList<NamedElement> _elements = model.getElements();
        Iterable<DataSource> _filter = Iterables.<DataSource>filter(_elements, DataSource.class);
        final DataSource datasource = IterableExtensions.<DataSource>head(_filter);
        EList<DataSourceAccessMethod> _methods = datasource.getMethods();
        final DataSourceAccessMethod method = IterableExtensions.<DataSourceAccessMethod>head(_methods);
        RESTSpecification _restSpecification = method.getRestSpecification();
        RESTURL _path = _restSpecification.getPath();
        String _value = this._rESTURLExtensions.value(_path);
        Matcher<String> _is = CoreMatchers.<String>is(url);
        Assert.<String>assertThat(_value, _is);
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : DataSourceAccessMethod(org.applause.lang.applauseDsl.DataSourceAccessMethod) RESTSpecification(org.applause.lang.applauseDsl.RESTSpecification) Model(org.applause.lang.applauseDsl.Model) NamedElement(org.applause.lang.applauseDsl.NamedElement) RESTURL(org.applause.lang.applauseDsl.RESTURL) DataSource(org.applause.lang.applauseDsl.DataSource)

Example 2 with DataSourceAccessMethod

use of org.applause.lang.applauseDsl.DataSourceAccessMethod in project applause by applause.

the class DefaultListScreenEditActionCompiler method compileCommitEditing.

public CharSequence compileCommitEditing(final Screen it) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath");
    _builder.newLine();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    Entity _resourceType = this._defaultListScreenClassExtensions.resourceType(it);
    String _typeName = this._typeExtensions.typeName(_resourceType);
    _builder.append(_typeName, "	");
    _builder.append(" *item= self.items[indexPath.row];");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("[item ");
    DataSourceAccessMethod _deleteMethod = this.deleteMethod(it);
    String _name = _deleteMethod.getName();
    _builder.append(_name, "	");
    _builder.append(":^(");
    Entity _resourceType_1 = this._defaultListScreenClassExtensions.resourceType(it);
    String _typeName_1 = this._typeExtensions.typeName(_resourceType_1);
    _builder.append(_typeName_1, "	");
    _builder.append(" *item, NSError *error)");
    _builder.newLineIfNotEmpty();
    _builder.append("\t");
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("if (error) {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("NSLog(@\"Error %@\", error);");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("else {");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("if (indexPath.row < self.items.count) {");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("[self.items removeObjectAtIndex:indexPath.row];");
    _builder.newLine();
    _builder.append("\t\t\t\t");
    _builder.append("[self.tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];");
    _builder.newLine();
    _builder.append("\t\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}];");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    return _builder;
}
Also used : Entity(org.applause.lang.applauseDsl.Entity) DataSourceAccessMethod(org.applause.lang.applauseDsl.DataSourceAccessMethod) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 3 with DataSourceAccessMethod

use of org.applause.lang.applauseDsl.DataSourceAccessMethod in project applause by applause.

the class DefaultListScreenClassExtensions method restMethod.

public DataSourceAccessMethod restMethod(final Screen it) {
    ScreenListItemCell _defaultCell = this.defaultCell(it);
    RESTMethodCall _restMethod = _defaultCell.getRestMethod();
    DataSourceAccessMethod _restMethod_1 = _restMethod.getRestMethod();
    return _restMethod_1;
}
Also used : ScreenListItemCell(org.applause.lang.applauseDsl.ScreenListItemCell) RESTMethodCall(org.applause.lang.applauseDsl.RESTMethodCall) DataSourceAccessMethod(org.applause.lang.applauseDsl.DataSourceAccessMethod)

Example 4 with DataSourceAccessMethod

use of org.applause.lang.applauseDsl.DataSourceAccessMethod in project applause by applause.

the class EntityDataAccessHeaderFileCompiler method compileHeaderFile.

public CharSequence compileHeaderFile(final DataSource it) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("#import <Foundation/Foundation.h>");
    _builder.newLine();
    _builder.append("#import \"");
    Entity _resourceType = it.getResourceType();
    String _entityModelHeaderFileName = this._entityClassExtensions.entityModelHeaderFileName(_resourceType);
    _builder.append(_entityModelHeaderFileName, "");
    _builder.append("\"");
    _builder.newLineIfNotEmpty();
    _builder.newLine();
    _builder.append("@interface ");
    Entity _resourceType_1 = it.getResourceType();
    String _typeName = this._typeExtensions.typeName(_resourceType_1);
    _builder.append(_typeName, "");
    _builder.append(" (DataAccess)");
    _builder.newLineIfNotEmpty();
    {
        EList<DataSourceAccessMethod> _methods = it.getMethods();
        for (final DataSourceAccessMethod method : _methods) {
            CharSequence _compileRESTMethod = this.compileRESTMethod(method);
            _builder.append(_compileRESTMethod, "");
            _builder.newLineIfNotEmpty();
        }
    }
    _builder.append("@end");
    _builder.newLine();
    return _builder;
}
Also used : Entity(org.applause.lang.applauseDsl.Entity) EList(org.eclipse.emf.common.util.EList) DataSourceAccessMethod(org.applause.lang.applauseDsl.DataSourceAccessMethod) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation)

Example 5 with DataSourceAccessMethod

use of org.applause.lang.applauseDsl.DataSourceAccessMethod in project applause by applause.

the class DefaultDetailsScreenModuleFileCompiler method restMethod.

public DataSourceAccessMethod restMethod(final Screen it) {
    ScreenListItemCell _defaultCell = this.defaultCell(it);
    RESTMethodCall _restMethod = _defaultCell.getRestMethod();
    DataSourceAccessMethod _restMethod_1 = _restMethod.getRestMethod();
    return _restMethod_1;
}
Also used : ScreenListItemCell(org.applause.lang.applauseDsl.ScreenListItemCell) RESTMethodCall(org.applause.lang.applauseDsl.RESTMethodCall) DataSourceAccessMethod(org.applause.lang.applauseDsl.DataSourceAccessMethod)

Aggregations

DataSourceAccessMethod (org.applause.lang.applauseDsl.DataSourceAccessMethod)12 DataSource (org.applause.lang.applauseDsl.DataSource)6 DataSourceCall (org.applause.lang.applauseDsl.DataSourceCall)5 Entity (org.applause.lang.applauseDsl.Entity)4 RESTSpecification (org.applause.lang.applauseDsl.RESTSpecification)4 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)4 RESTVerb (org.applause.lang.applauseDsl.RESTVerb)3 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)3 RESTMethodCall (org.applause.lang.applauseDsl.RESTMethodCall)2 ScreenListItemCell (org.applause.lang.applauseDsl.ScreenListItemCell)2 EList (org.eclipse.emf.common.util.EList)2 Model (org.applause.lang.applauseDsl.Model)1 NamedElement (org.applause.lang.applauseDsl.NamedElement)1 RESTURL (org.applause.lang.applauseDsl.RESTURL)1 Screen (org.applause.lang.applauseDsl.Screen)1 UIComponentMemberConfiguration (org.applause.lang.applauseDsl.UIComponentMemberConfiguration)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1 IScope (org.eclipse.xtext.scoping.IScope)1