Search in sources :

Example 6 with RESTSpecification

use of org.applause.lang.applauseDsl.RESTSpecification 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 7 with RESTSpecification

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

the class DataSourceAccessMethodImpl method basicSetRestSpecification.

/**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
public NotificationChain basicSetRestSpecification(RESTSpecification newRestSpecification, NotificationChain msgs) {
    RESTSpecification oldRestSpecification = restSpecification;
    restSpecification = newRestSpecification;
    if (eNotificationRequired()) {
        ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ApplauseDslPackage.DATA_SOURCE_ACCESS_METHOD__REST_SPECIFICATION, oldRestSpecification, newRestSpecification);
        if (msgs == null)
            msgs = notification;
        else
            msgs.add(notification);
    }
    return msgs;
}
Also used : RESTSpecification(org.applause.lang.applauseDsl.RESTSpecification) ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl)

Example 8 with RESTSpecification

use of org.applause.lang.applauseDsl.RESTSpecification 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 9 with RESTSpecification

use of org.applause.lang.applauseDsl.RESTSpecification 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 10 with RESTSpecification

use of org.applause.lang.applauseDsl.RESTSpecification 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

RESTSpecification (org.applause.lang.applauseDsl.RESTSpecification)11 RESTURL (org.applause.lang.applauseDsl.RESTURL)5 RESTVerb (org.applause.lang.applauseDsl.RESTVerb)5 DataSource (org.applause.lang.applauseDsl.DataSource)4 DataSourceAccessMethod (org.applause.lang.applauseDsl.DataSourceAccessMethod)4 Entity (org.applause.lang.applauseDsl.Entity)4 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)4 DataSourceCall (org.applause.lang.applauseDsl.DataSourceCall)3 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)3 Model (org.applause.lang.applauseDsl.Model)1 NamedElement (org.applause.lang.applauseDsl.NamedElement)1 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)1