class VulnerabilityController implements Constants {

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

		if (Strings.isNullOrEmpty(assetGroup)) {
			return ResponseUtils.buildFailureResponse(new Exception(ASSET_MANDATORY));
		}
		ResponseData response;
		try {
			response = new ResponseData(vulnerabilityService.getVulnerabilityByAppAndEnv(assetGroup,
					"tags.Environment.keyword", application));
		} catch (Exception e) {
			LOGGER.error("Exception in vulnerabilitybyenvironment ", e);
			return ResponseUtils.buildFailureResponse(e);
		}
		return ResponseUtils.buildSucessResponse(response);
	}

}