private void searchDuplicates( Content content, List<Content> visited, Collection<Content> parents, Issues issues) { if (parents.contains(content)) { issues.addIssue(Severity.ERROR, "", "channel_loop"); } else { for (Content parent : parents) { if (!visited.contains(parent)) { visited.add(parent); Collection<Content> parentParents = parent.getReferrersWithDescriptorFulfilling( "CMChannel", PROPERTY_CHILDREN, IS_IN_PRODUCTION); searchDuplicates(content, visited, parentParents, issues); } } } }
@Override public void validate(Content content, Issues issues) { Collection<Content> parents = content.getReferrersWithDescriptorFulfilling( "CMChannel", PROPERTY_CHILDREN, IS_IN_PRODUCTION); List<Content> visited = new ArrayList<>(); searchDuplicates(content, visited, parents, issues); }