use of com.serotonin.m2m2.web.mvc.rest.v1.model.system.TimezoneModel in project ma-modules-public by infiniteautomation.
the class ServerRestController method queryTimezone.
@ApiOperation(value = "Query Timezones", notes = "", response = TimezoneModel.class, responseContainer = "Array")
@RequestMapping(method = RequestMethod.GET, produces = { "application/json" }, value = "/timezones")
public ResponseEntity<PageQueryResultModel<TimezoneModel>> queryTimezone(HttpServletRequest request) {
RestProcessResult<PageQueryResultModel<TimezoneModel>> result = new RestProcessResult<PageQueryResultModel<TimezoneModel>>(HttpStatus.OK);
this.checkUser(request, result);
if (result.isOk()) {
try {
// Parse the RQL Query
ASTNode root = parseRQLtoAST(request.getQueryString());
List<TimezoneModel> list = root.accept(new RQLToObjectListQuery<TimezoneModel>(), allTimezones);
PageQueryResultModel<TimezoneModel> model = new PageQueryResultModel<TimezoneModel>(list, allTimezones.size() + 1);
return result.createResponseEntity(model);
} catch (InvalidRQLRestException e) {
LOG.error(e.getMessage(), e);
result.addRestMessage(getInternalServerErrorMessage(e.getMessage()));
return result.createResponseEntity();
}
}
return result.createResponseEntity();
}
use of com.serotonin.m2m2.web.mvc.rest.v1.model.system.TimezoneModel in project ma-modules-public by infiniteautomation.
the class ServerRestV2Controller method queryTimezone.
@ApiOperation(value = "Query Timezones", notes = "", response = TimezoneModel.class, responseContainer = "Array")
@RequestMapping(method = RequestMethod.GET, value = "/timezones")
public ResponseEntity<PageQueryResultModel<TimezoneModel>> queryTimezone(HttpServletRequest request) {
ASTNode root = parseRQLtoAST(request.getQueryString());
List<TimezoneModel> list = root.accept(new RQLToObjectListQuery<TimezoneModel>(), allTimezones);
PageQueryResultModel<TimezoneModel> model = new PageQueryResultModel<TimezoneModel>(list, allTimezones.size() + 1);
return new ResponseEntity<PageQueryResultModel<TimezoneModel>>(model, HttpStatus.OK);
}
Aggregations