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);
}
}
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;
}
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;
}
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;
}
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;
}
Aggregations