Search in sources :

Example 1 with DataSource

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

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

the class EntityDataAccessGeneratorSpec method isGeneratedModuleFileFromModel.

public void isGeneratedModuleFileFromModel(final CharSequence expectedGeneratedCode, final String dataSourceName, final CharSequence input) {
    final DataSource datasource = this.datasource(input, dataSourceName);
    final CharSequence result = this._entityDataAccessModuleFileCompiler.compileModuleFile(datasource);
    String _string = result.toString();
    String _string_1 = expectedGeneratedCode.toString();
    Matcher<String> _equalTo = CoreMatchers.<String>equalTo(_string_1);
    Assert.<String>assertThat(_string, _equalTo);
}
Also used : DataSource(org.applause.lang.applauseDsl.DataSource)

Example 3 with DataSource

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

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

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

the class DataSourceCallImpl method setDatasource.

/**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
public void setDatasource(DataSource newDatasource) {
    DataSource oldDatasource = datasource;
    datasource = newDatasource;
    if (eNotificationRequired())
        eNotify(new ENotificationImpl(this, Notification.SET, ApplauseDslPackage.DATA_SOURCE_CALL__DATASOURCE, oldDatasource, datasource));
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) DataSource(org.applause.lang.applauseDsl.DataSource)

Aggregations

DataSource (org.applause.lang.applauseDsl.DataSource)14 DataSourceCall (org.applause.lang.applauseDsl.DataSourceCall)7 DataSourceAccessMethod (org.applause.lang.applauseDsl.DataSourceAccessMethod)6 Entity (org.applause.lang.applauseDsl.Entity)5 RESTSpecification (org.applause.lang.applauseDsl.RESTSpecification)4 RESTVerb (org.applause.lang.applauseDsl.RESTVerb)3 Function1 (org.eclipse.xtext.xbase.lib.Functions.Function1)3 Model (org.applause.lang.applauseDsl.Model)2 NamedElement (org.applause.lang.applauseDsl.NamedElement)2 EObject (org.eclipse.emf.ecore.EObject)2 AbsoluteRESTURL (org.applause.lang.applauseDsl.AbsoluteRESTURL)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 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)1 IScope (org.eclipse.xtext.scoping.IScope)1 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)1