use of com.serotonin.m2m2.web.mvc.rest.v1.model.DemoModel in project ma-core-public by infiniteautomation.
the class MangoDemoRestController method queryStore.
/**
* Perform an RQL Query on the Store
* @param root
* @return
*/
private List<DemoModel> queryStore(ASTNode root) {
List<Demo> values = root.accept(new RQLToObjectListQuery<Demo>(), this.demoStore);
List<DemoModel> models = new ArrayList<DemoModel>();
for (Demo value : values) {
models.add(new DemoModel(value));
}
return models;
}
use of com.serotonin.m2m2.web.mvc.rest.v1.model.DemoModel in project ma-core-public by infiniteautomation.
the class MangoDemoRestController method getAllDemos.
@ApiOperation(value = "Get all demos", notes = "Notes for getting all demos")
@ApiResponses(value = { @ApiResponse(code = 200, message = "Ok"), @ApiResponse(code = 403, message = "User does not have access") })
@RequestMapping(method = RequestMethod.GET, produces = { "application/json", "text/csv" }, value = "/list")
public ResponseEntity<List<DemoModel>> getAllDemos(HttpServletRequest request, @ApiParam(value = "Limit the number of results", required = false) @RequestParam(value = "limit", required = false, defaultValue = "100") int limit) {
RestProcessResult<List<DemoModel>> result = new RestProcessResult<List<DemoModel>>(HttpStatus.OK);
this.checkUser(request, result);
if (result.isOk()) {
ASTNode root = new ASTNode("limit", limit);
List<DemoModel> models = queryStore(root);
return result.createResponseEntity(models);
}
return result.createResponseEntity();
}
Aggregations