Search in sources :

Example 1 with RESTVerb

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

the class DefaultDetailsScreenModuleFileCompiler method dataAccessMethodNameForCreate.

public String dataAccessMethodNameForCreate(final Screen it) {
    DataSourceCall _datasource = it.getDatasource();
    DataSource _datasource_1 = _datasource.getDatasource();
    EList<DataSourceAccessMethod> _methods = _datasource_1.getMethods();
    final Function1<DataSourceAccessMethod, Boolean> _function = new Function1<DataSourceAccessMethod, Boolean>() {

        public Boolean apply(final DataSourceAccessMethod it) {
            RESTSpecification _restSpecification = it.getRestSpecification();
            RESTVerb _verb = _restSpecification.getVerb();
            boolean _equals = Objects.equal(_verb, RESTVerb.POST);
            return Boolean.valueOf(_equals);
        }
    };
    DataSourceAccessMethod _findFirst = IterableExtensions.<DataSourceAccessMethod>findFirst(_methods, _function);
    String _name = _findFirst.getName();
    return _name;
}
Also used : DataSourceCall(org.applause.lang.applauseDsl.DataSourceCall) DataSourceAccessMethod(org.applause.lang.applauseDsl.DataSourceAccessMethod) RESTSpecification(org.applause.lang.applauseDsl.RESTSpecification) Function1(org.eclipse.xtext.xbase.lib.Functions.Function1) RESTVerb(org.applause.lang.applauseDsl.RESTVerb) DataSource(org.applause.lang.applauseDsl.DataSource)

Example 2 with RESTVerb

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

the class DefaultDetailsScreenModuleFileCompiler method dataAccessMethodNameForUpdate.

public String dataAccessMethodNameForUpdate(final Screen it) {
    DataSourceCall _datasource = it.getDatasource();
    DataSource _datasource_1 = _datasource.getDatasource();
    EList<DataSourceAccessMethod> _methods = _datasource_1.getMethods();
    final Function1<DataSourceAccessMethod, Boolean> _function = new Function1<DataSourceAccessMethod, Boolean>() {

        public Boolean apply(final DataSourceAccessMethod it) {
            RESTSpecification _restSpecification = it.getRestSpecification();
            RESTVerb _verb = _restSpecification.getVerb();
            boolean _equals = Objects.equal(_verb, RESTVerb.PUT);
            return Boolean.valueOf(_equals);
        }
    };
    DataSourceAccessMethod _findFirst = IterableExtensions.<DataSourceAccessMethod>findFirst(_methods, _function);
    String _name = _findFirst.getName();
    return _name;
}
Also used : DataSourceCall(org.applause.lang.applauseDsl.DataSourceCall) DataSourceAccessMethod(org.applause.lang.applauseDsl.DataSourceAccessMethod) RESTSpecification(org.applause.lang.applauseDsl.RESTSpecification) Function1(org.eclipse.xtext.xbase.lib.Functions.Function1) RESTVerb(org.applause.lang.applauseDsl.RESTVerb) DataSource(org.applause.lang.applauseDsl.DataSource)

Example 3 with RESTVerb

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

the class DefaultListScreenEditActionCompiler method deleteMethod.

public DataSourceAccessMethod deleteMethod(final Screen it) {
    DataSourceCall _datasource = it.getDatasource();
    DataSource _datasource_1 = _datasource.getDatasource();
    EList<DataSourceAccessMethod> _methods = _datasource_1.getMethods();
    final Function1<DataSourceAccessMethod, Boolean> _function = new Function1<DataSourceAccessMethod, Boolean>() {

        public Boolean apply(final DataSourceAccessMethod it) {
            RESTSpecification _restSpecification = it.getRestSpecification();
            RESTVerb _verb = _restSpecification.getVerb();
            boolean _equals = Objects.equal(_verb, RESTVerb.DELETE);
            return Boolean.valueOf(_equals);
        }
    };
    Iterable<DataSourceAccessMethod> _filter = IterableExtensions.<DataSourceAccessMethod>filter(_methods, _function);
    DataSourceAccessMethod _head = IterableExtensions.<DataSourceAccessMethod>head(_filter);
    return _head;
}
Also used : DataSourceCall(org.applause.lang.applauseDsl.DataSourceCall) DataSourceAccessMethod(org.applause.lang.applauseDsl.DataSourceAccessMethod) RESTSpecification(org.applause.lang.applauseDsl.RESTSpecification) Function1(org.eclipse.xtext.xbase.lib.Functions.Function1) RESTVerb(org.applause.lang.applauseDsl.RESTVerb) DataSource(org.applause.lang.applauseDsl.DataSource)

Example 4 with RESTVerb

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

the class EntityDataAccessHeaderFileCompiler method compileRESTMethod.

public CharSequence compileRESTMethod(final DataSourceAccessMethod it) {
    CharSequence _switchResult = null;
    RESTSpecification _restSpecification = it.getRestSpecification();
    RESTVerb _verb = _restSpecification.getVerb();
    final RESTVerb _switchValue = _verb;
    boolean _matched = false;
    if (!_matched) {
        if (Objects.equal(_switchValue, RESTVerb.GET)) {
            _matched = true;
            CharSequence _compileGETLISTMethod = this.compileGETLISTMethod(it);
            _switchResult = _compileGETLISTMethod;
        }
    }
    if (!_matched) {
        if (Objects.equal(_switchValue, RESTVerb.POST)) {
            _matched = true;
            CharSequence _compilePOSTMethod = this.compilePOSTMethod(it);
            _switchResult = _compilePOSTMethod;
        }
    }
    if (!_matched) {
        if (Objects.equal(_switchValue, RESTVerb.PUT)) {
            _matched = true;
            CharSequence _compilePUTMethod = this.compilePUTMethod(it);
            _switchResult = _compilePUTMethod;
        }
    }
    if (!_matched) {
        if (Objects.equal(_switchValue, RESTVerb.DELETE)) {
            _matched = true;
            CharSequence _compileDELETEMethod = this.compileDELETEMethod(it);
            _switchResult = _compileDELETEMethod;
        }
    }
    return _switchResult;
}
Also used : RESTSpecification(org.applause.lang.applauseDsl.RESTSpecification) RESTVerb(org.applause.lang.applauseDsl.RESTVerb)

Example 5 with RESTVerb

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

the class EntityDataAccessModuleFileCompiler method compileRESTMethod.

public CharSequence compileRESTMethod(final DataSourceAccessMethod it) {
    CharSequence _switchResult = null;
    RESTSpecification _restSpecification = it.getRestSpecification();
    RESTVerb _verb = _restSpecification.getVerb();
    final RESTVerb _switchValue = _verb;
    boolean _matched = false;
    if (!_matched) {
        if (Objects.equal(_switchValue, RESTVerb.GET)) {
            _matched = true;
            CharSequence _compileGETLISTMethod = this.compileGETLISTMethod(it);
            _switchResult = _compileGETLISTMethod;
        }
    }
    if (!_matched) {
        if (Objects.equal(_switchValue, RESTVerb.POST)) {
            _matched = true;
            CharSequence _compilePOSTMethod = this.compilePOSTMethod(it);
            _switchResult = _compilePOSTMethod;
        }
    }
    if (!_matched) {
        if (Objects.equal(_switchValue, RESTVerb.PUT)) {
            _matched = true;
            CharSequence _compilePUTMethod = this.compilePUTMethod(it);
            _switchResult = _compilePUTMethod;
        }
    }
    if (!_matched) {
        if (Objects.equal(_switchValue, RESTVerb.DELETE)) {
            _matched = true;
            CharSequence _compileDELETEMethod = this.compileDELETEMethod(it);
            _switchResult = _compileDELETEMethod;
        }
    }
    return _switchResult;
}
Also used : RESTSpecification(org.applause.lang.applauseDsl.RESTSpecification) RESTVerb(org.applause.lang.applauseDsl.RESTVerb)

Aggregations

RESTVerb (org.applause.lang.applauseDsl.RESTVerb)6 RESTSpecification (org.applause.lang.applauseDsl.RESTSpecification)5 DataSource (org.applause.lang.applauseDsl.DataSource)3 DataSourceAccessMethod (org.applause.lang.applauseDsl.DataSourceAccessMethod)3 DataSourceCall (org.applause.lang.applauseDsl.DataSourceCall)3 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)3 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1