Revision 58368
Added by Konstantina Galouni almost 4 years ago
StatisticsController.java | ||
---|---|---|
38 | 38 |
return statistics; |
39 | 39 |
} |
40 | 40 |
|
41 |
@RequestMapping(value = "/statistics/{id}/toggle", method = RequestMethod.POST) |
|
42 |
public Boolean toggleStatistics(@PathVariable String id) throws Exception { |
|
43 |
Statistics statistics = statisticsDAO.findById(id); |
|
44 |
boolean status = statistics.getIsActive(); |
|
45 |
statistics.setIsActive(!status); |
|
46 |
statisticsDAO.save(statistics); |
|
47 |
return statistics.getIsActive(); |
|
48 |
} |
|
49 |
|
|
41 | 50 |
@RequestMapping(value = "/statistics/save", method = RequestMethod.POST) |
42 | 51 |
public Statistics insertStatistics(@RequestBody Statistics statistics) { |
43 | 52 |
Statistics savedStatistics = statisticsDAO.save(statistics); |
Also available in: Unified diff
[Trunk | Admin Tools service]:
1. Statistics.java: Added "isActive" field (default value: true).
2. StatisticsController.java: Added toggleStatistics method (/statistics/{id}/toggle) for activating/ deactivating statistics.