public List<Cookbook> getQualifiedCookbooks(List<Cookbook> cookbooks) { List<Cookbook> qualifiedCookbooks = new ArrayList<>(); List<Cookbook> unqualifiedCookbooks = new ArrayList<>(); List<Cookbook> failedCookbooks = new ArrayList<>(); for (Cookbook cookbook : cookbooks) { String url = cookbook.getExternal_url(); String name = cookbook.getName(); LOGGER.info(String.format("process repository: '%s', %s", name, url)); if (url != null && !url.isEmpty()) { if (isQualified(url)) { qualifiedCookbooks.add(cookbook); } else { unqualifiedCookbooks.add(cookbook); } } else { failedCookbooks.add(cookbook); } } logCookbooks(qualifiedCookbooks, "qualified"); logCookbooks(unqualifiedCookbooks, "unqualified"); logCookbooks(failedCookbooks, "failed"); LOGGER.info( String.format( "summary: [%d / %d / %d] (qualified / failed / available)", qualifiedCookbooks.size(), failedCookbooks.size(), cookbooks.size())); return qualifiedCookbooks; }
private void logCookbooks(List<Cookbook> cookbooks, String status) { LOGGER.info(String.format("[%d] %s cookbooks were found", cookbooks.size(), status)); for (Cookbook cookbook : cookbooks) { LOGGER.info( String.format( "%s cookbook: '%s', %s", status, cookbook.getName(), cookbook.getExternal_url())); } }