use of com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper in project sql-boot by sql-boot.
the class ApiController method getListResponseEntity.
private ResponseEntity<List<DbResource>> getListResponseEntity(final HttpServletRequest request, final String connectionName, final String type) {
final Uri uri = new SqlPlaceholdersWrapper(new DbUri(parseUri(type, request)));
final ResourceType fsResourceTypes = new FsResourceTypes(dbConnectionList.getConnectionByName(connectionName));
final List<DbResource> collect = fsResourceTypes.read(uri).collect(toList());
if (collect.isEmpty()) {
return new ResponseEntity<>(collect, HttpStatus.NO_CONTENT);
} else {
return new ResponseEntity<>(collect, HttpStatus.OK);
}
}
use of com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper in project sql-boot by sql-boot.
the class ApiController method getListResponseEntityHeaders.
private ResponseEntity<List<Map<String, Object>>> getListResponseEntityHeaders(final HttpServletRequest request, final String connectionName, final String path) {
final Uri uri = new SqlPlaceholdersWrapper(new DbUri(parseUri(path, request)));
ResourceType fsResourceTypes = new FsResourceTypes(dbConnectionList.getConnectionByName(connectionName));
final List<Map<String, Object>> headers = fsResourceTypes.read(uri).map(DbResource::headers).collect(toList());
if (headers.isEmpty()) {
return new ResponseEntity<>(headers, HttpStatus.NO_CONTENT);
} else {
return new ResponseEntity<>(headers, HttpStatus.OK);
}
}
use of com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper in project sql-boot by sql-boot.
the class SchemaJdbcResourceTypeTest method read.
@Test
public void read() {
final ResourceType schema = new SchemaJdbcResourceType(dataSource);
final Stream<DbResource> schemas = schema.read(new SqlPlaceholdersWrapper(new DbUri("schema", asList("*"))));
assertEquals(3, schemas.count());
}
use of com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper in project sql-boot by sql-boot.
the class FunctionJdbcResourceTypeTest method read.
@Test
@Ignore
public void read() {
final ResourceType function = new FunctionJdbcResourceType(dataSource);
final Stream<DbResource> functions = function.read(new SqlPlaceholdersWrapper(new DbUri("function", asList("*"))));
assertEquals(1, functions.count());
}
use of com.github.mgramin.sqlboot.model.uri.wrappers.SqlPlaceholdersWrapper in project sql-boot by sql-boot.
the class ProcedureJdbcResourceTypeTest method read.
@Test
public void read() {
final ResourceType procedure = new ProcedureJdbcResourceType(dataSource);
final Stream<DbResource> procedures = procedure.read(new SqlPlaceholdersWrapper(new DbUri("procedure", asList("*"))));
assertEquals(1, procedures.count());
}
Aggregations