private void reduceList(Site site, Map<String, String> zapRelations, 
    		Map<String, Vulnerability> groupVulnerabilities) throws MalformedURLException {
        /**
         * De las vulnerabilidades encontradas las mapeamos a objetos
         * y las agrupamos por tipo de vulnerabilidad y url
         */
    	for (Alert alert: site.getAlerts()) {
    		String nameVuln = zapRelations.get(alert.getPluginid());
    		if(StringUtils.isBlank(nameVuln)){
        		Vulnerability vulnerability = new Vulnerability();
        		vulnerability.setName(Constantes.COMMON_MESSAGE_NOT_FOUND + alert.getName());
                vulnerability.setShortName(alert.getName());                
                vulnerability.setLongName(alert.getName());
                //TODO: Convertir la serveridad
                vulnerability.setSeverity(alert.getRiskdesc().replaceAll("\\(.*\\)", "").trim());
                vulnerability.setCwe(Integer.parseInt(alert.getCweid()));
                for(Endpoint endPointZap : alert.getInstances()){
                	if(!vulnerability.getEndpoint().stream().anyMatch(obj -> obj.getUrl().equals(getUrlWithoutParameters(endPointZap.getUrl())) 
            				&& obj.getMethod().equals(endPointZap.getMethod()))){                		
            			vulnerability.getEndpoint().add(new Endpoint(endPointZap.getMethod(), getUrlWithoutParameters(endPointZap.getUrl())));
            		}
                }
                groupVulnerabilities.put(vulnerability.getName(), vulnerability);
        	} else if(groupVulnerabilities.containsKey(nameVuln)){
        		Vulnerability vulnerability = groupVulnerabilities.get(nameVuln);
        		for(Endpoint endPointZap : alert.getInstances()){
        			if(!vulnerability.getEndpoint().stream().anyMatch(obj -> obj.getUrl().equals(getUrlWithoutParameters(endPointZap.getUrl())) 
            				&& obj.getMethod().equals(endPointZap.getMethod()))){                		
            			vulnerability.getEndpoint().add(new Endpoint(endPointZap.getMethod(), getUrlWithoutParameters(endPointZap.getUrl())));
            		}
                }
        	} else {
        		Vulnerability vulnerability = new Vulnerability();
        		vulnerability.setShortName(alert.getName());                
                vulnerability.setLongName(alert.getName());
                //TODO: Convertir la serveridad
                vulnerability.setSeverity(alert.getRiskdesc().replaceAll("\\(.*\\)", ""));
                vulnerability.setCwe(Integer.parseInt(alert.getCweid()));
                for(Endpoint endPointZap : alert.getInstances()){
                	if(!vulnerability.getEndpoint().stream().anyMatch(obj -> obj.getUrl().equals(getUrlWithoutParameters(endPointZap.getUrl())) 
            				&& obj.getMethod().equals(endPointZap.getMethod()))){                		
            			vulnerability.getEndpoint().add(new Endpoint(endPointZap.getMethod(), getUrlWithoutParameters(endPointZap.getUrl())));
            		}
                }
                groupVulnerabilities.put(vulnerability.getName(), vulnerability);
        	} 
    	}
    }
private void reduceList(Site site, Map<String, String> zapRelations, 
    		Map<String, Vulnerability> groupVulnerabilities) throws MalformedURLException {
       
    	for (Alert alert: site.getAlerts()) {
    		String nameVuln = zapRelations.get(alert.getPluginid());
    		if(StringUtils.isBlank(nameVuln)){
        		Vulnerability vulnerability = new Vulnerability();
        		vulnerability.setName(Constantes.COMMON_MESSAGE_NOT_FOUND + alert.getName());
                vulnerability.setShortName(alert.getName());                
                vulnerability.setLongName(alert.getName());
               
                vulnerability.setSeverity(alert.getRiskdesc().replaceAll("\\(.*\\)", "").trim());
                vulnerability.setCwe(Integer.parseInt(alert.getCweid()));
                for(Endpoint endPointZap : alert.getInstances()){
                	if(!vulnerability.getEndpoint().stream().anyMatch(obj -> obj.getUrl().equals(getUrlWithoutParameters(endPointZap.getUrl())) 
            				&& obj.getMethod().equals(endPointZap.getMethod()))){                		
            			vulnerability.getEndpoint().add(new Endpoint(endPointZap.getMethod(), getUrlWithoutParameters(endPointZap.getUrl())));
            		}
                }
                groupVulnerabilities.put(vulnerability.getName(), vulnerability);
        	} else if(groupVulnerabilities.containsKey(nameVuln)){
        		Vulnerability vulnerability = groupVulnerabilities.get(nameVuln);
        		for(Endpoint endPointZap : alert.getInstances()){
        			if(!vulnerability.getEndpoint().stream().anyMatch(obj -> obj.getUrl().equals(getUrlWithoutParameters(endPointZap.getUrl())) 
            				&& obj.getMethod().equals(endPointZap.getMethod()))){                		
            			vulnerability.getEndpoint().add(new Endpoint(endPointZap.getMethod(), getUrlWithoutParameters(endPointZap.getUrl())));
            		}
                }
        	} else {
        		Vulnerability vulnerability = new Vulnerability();
        		vulnerability.setShortName(alert.getName());                
                vulnerability.setLongName(alert.getName());
               
                vulnerability.setSeverity(alert.getRiskdesc().replaceAll("\\(.*\\)", ""));
                vulnerability.setCwe(Integer.parseInt(alert.getCweid()));
                for(Endpoint endPointZap : alert.getInstances()){
                	if(!vulnerability.getEndpoint().stream().anyMatch(obj -> obj.getUrl().equals(getUrlWithoutParameters(endPointZap.getUrl())) 
            				&& obj.getMethod().equals(endPointZap.getMethod()))){                		
            			vulnerability.getEndpoint().add(new Endpoint(endPointZap.getMethod(), getUrlWithoutParameters(endPointZap.getUrl())));
            		}
                }
                groupVulnerabilities.put(vulnerability.getName(), vulnerability);
        	} 
    	}
    }
private void reducelist(site site, map<string, string> zaprelations, map<string, vulnerability> groupvulnerabilities) throws malformedurlexception { for (alert alert: site.getalerts()) { string namevuln = zaprelations.get(alert.getpluginid()); if(stringutils.isblank(namevuln)){ vulnerability vulnerability = new vulnerability(); vulnerability.setname(constantes.common_message_not_found + alert.getname()); vulnerability.setshortname(alert.getname()); vulnerability.setlongname(alert.getname()); vulnerability.setseverity(alert.getriskdesc().replaceall("\\(.*\\)", "").trim()); vulnerability.setcwe(integer.parseint(alert.getcweid())); for(endpoint endpointzap : alert.getinstances()){ if(!vulnerability.getendpoint().stream().anymatch(obj -> obj.geturl().equals(geturlwithoutparameters(endpointzap.geturl())) && obj.getmethod().equals(endpointzap.getmethod()))){ vulnerability.getendpoint().add(new endpoint(endpointzap.getmethod(), geturlwithoutparameters(endpointzap.geturl()))); } } groupvulnerabilities.put(vulnerability.getname(), vulnerability); } else if(groupvulnerabilities.containskey(namevuln)){ vulnerability vulnerability = groupvulnerabilities.get(namevuln); for(endpoint endpointzap : alert.getinstances()){ if(!vulnerability.getendpoint().stream().anymatch(obj -> obj.geturl().equals(geturlwithoutparameters(endpointzap.geturl())) && obj.getmethod().equals(endpointzap.getmethod()))){ vulnerability.getendpoint().add(new endpoint(endpointzap.getmethod(), geturlwithoutparameters(endpointzap.geturl()))); } } } else { vulnerability vulnerability = new vulnerability(); vulnerability.setshortname(alert.getname()); vulnerability.setlongname(alert.getname()); vulnerability.setseverity(alert.getriskdesc().replaceall("\\(.*\\)", "")); vulnerability.setcwe(integer.parseint(alert.getcweid())); for(endpoint endpointzap : alert.getinstances()){ if(!vulnerability.getendpoint().stream().anymatch(obj -> obj.geturl().equals(geturlwithoutparameters(endpointzap.geturl())) && obj.getmethod().equals(endpointzap.getmethod()))){ vulnerability.getendpoint().add(new endpoint(endpointzap.getmethod(), geturlwithoutparameters(endpointzap.geturl()))); } } groupvulnerabilities.put(vulnerability.getname(), vulnerability); } } }