class VulnerabilityController implements Constants {

	@RequestMapping(path = "/v1/vulnerabilities/summary", method = RequestMethod.GET)
	public ResponseEntity<Object> getVulnerabilitysummary(@RequestParam(name = "ag", required = true) String assetGroup,
			@RequestParam(name = "severity", required = false) String severity) {

		if (Strings.isNullOrEmpty(assetGroup)) {
			return ResponseUtils.buildFailureResponse(new Exception(ASSET_MANDATORY));
		}
		if (Strings.isNullOrEmpty(severity)) {
			severity = SEVERITY_LEVELS;
		}
		DitributionDTO response;
		try {
			response = new DitributionDTO(vulnerabilityService.getVulnerabilitySummary(assetGroup, severity));
		} catch (Exception e) {
			LOGGER.error("Exception in getVulnerabilitysummary ", e);
			return ResponseUtils.buildFailureResponse(e);
		}
		return ResponseUtils.buildSucessResponse(response);
	}

}