class VulnerabilityService implements Constants {

	public List<Map<String, Object>> getTrendAnnotations(String assetGroup, Date from) throws DataException {

		List<Map<String, Object>> globalAnnotations = new ArrayList<>();
		List<Map<String, Object>> assetGroupAnnotations = new ArrayList<>();
		List<Map<String, Object>> annotations = vulnerabilityRepository.getTrendAnnotations(assetGroup, from);

		annotations.parallelStream().forEach(annotation -> {
			if (StringUtils.isEmpty(annotation.get("ag").toString())) {
				synchronized (globalAnnotations) {
					globalAnnotations.add(annotation);
				}
			} else {
				synchronized (assetGroupAnnotations) {
					assetGroupAnnotations.add(annotation);
				}
			}
		});

		Map<String, Object> gloablMap = new HashMap<>();
		gloablMap.put("type", "Global");
		gloablMap.put("data", globalAnnotations);

		Map<String, Object> agMap = new HashMap<>();
		agMap.put("type", "AssetGroup");
		agMap.put("data", assetGroupAnnotations);

		List<Map<String, Object>> noteList = new ArrayList<>();
		noteList.add(agMap);
		noteList.add(gloablMap);

		return noteList;
	}

}