Open Kilda Java Documentation
LogActivityController.java
Go to the documentation of this file.
1 package org.openkilda.controller;
2 
3 import java.util.ArrayList;
4 import java.util.List;
5 
6 import javax.servlet.http.HttpServletRequest;
7 
14 import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.http.HttpStatus;
16 import org.springframework.http.MediaType;
17 import org.springframework.web.bind.annotation.RequestMapping;
18 import org.springframework.web.bind.annotation.RequestMethod;
19 import org.springframework.web.bind.annotation.RequestParam;
20 import org.springframework.web.bind.annotation.ResponseStatus;
21 import org.springframework.web.bind.annotation.RestController;
22 import org.springframework.web.servlet.ModelAndView;
23 
24 @RestController
25 @RequestMapping(path = "/useractivity", produces = MediaType.APPLICATION_JSON_VALUE)
26 public class LogActivityController extends BaseController {
27 
28  @Autowired
29  private UserActivityLogService userActivityLogService;
30 
38  @RequestMapping
40  public ModelAndView useractivity(final HttpServletRequest request) {
41  return validateAndRedirect(request, IConstants.View.ACTIVITY_LOGS);
42  }
43 
44  @ResponseStatus(HttpStatus.OK)
45  @RequestMapping(path = "/log", method = RequestMethod.GET)
46  public List<LogInfo> getLogs(final @RequestParam(name = "userId", required = false) List<Long> userIds,
47  final @RequestParam(name = "activity", required = false) List<String> activities,
48  final @RequestParam(name = "startTime", required = false) String startTime,
49  final @RequestParam(name = "endTime", required = false) String endTime) {
50  return userActivityLogService.getActivityLog(userIds, activities, startTime, endTime);
51  }
52 
53  @ResponseStatus(HttpStatus.OK)
54  @RequestMapping(path = "/types", method = RequestMethod.GET)
55  public List<ActivityTypeInfo> getActivityTypes() {
56  List<ActivityTypeInfo> activityTypeInfos = new ArrayList<>();
57  for (ActivityType activityType : ActivityType.values()) {
58  activityTypeInfos.add(new ActivityTypeInfo(activityType.getId(),
59  activityType.getActivityTypeEntity().getActivityName()));
60  }
61  return activityTypeInfos;
62  }
63 }
ModelAndView useractivity(final HttpServletRequest request)
name
Definition: setup.py:24