Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[#1887] add paramter for alarmRule api #1888

Merged
merged 1 commit into from
Jul 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@
* @author minwoo.jung
*/
@Controller
@RequestMapping(value="/alarmRule")
@RequestMapping(value={"/alarmRule", "/application/alarmRule"})
public class AlarmController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

public final static String USER_GROUP_ID = "userGroupId";
public final static String APPLICATION_ID = "applicationId";

@Autowired
AlarmService alarmService;
Expand Down Expand Up @@ -86,15 +87,19 @@ public Map<String, String> deleteRule(@RequestBody Rule rule) {

@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public Object getRule(@RequestParam(USER_GROUP_ID) String userGroupId) {
if (StringUtils.isEmpty(userGroupId)) {
public Object getRule(@RequestParam(value=USER_GROUP_ID, required=false) String userGroupId, @RequestParam(value=APPLICATION_ID, required=false) String applicationId) {
if (StringUtils.isEmpty(userGroupId) && StringUtils.isEmpty(applicationId)) {
Map<String, String> result = new HashMap<>();
result.put("errorCode", "500");
result.put("errorMessage", "there is not userGroupId to get alarm rule");
result.put("errorMessage", "there is not userGroupId or applicationID to get alarm rule");
return result;
}

return alarmService.selectRuleByUserGroupId(userGroupId);
if (!StringUtils.isEmpty(userGroupId)) {
return alarmService.selectRuleByUserGroupId(userGroupId);
}

return alarmService.selectRuleByApplicationId(applicationId);
}

@RequestMapping(method = RequestMethod.PUT)
Expand Down