Set<Dependency> getDependenciesBetweenProjects() { Set<Dependency> result = Sets.newLinkedHashSet(); for (Dependency dependency : dependencies) { if (ResourceUtils.isSet(dependency.getFrom()) || ResourceUtils.isSet(dependency.getTo())) { result.add(dependency); } } return result; }
/** Keep only project stuff */ public void clear() { Iterator<Map.Entry<Resource, Bucket>> it = buckets.entrySet().iterator(); while (it.hasNext()) { Map.Entry<Resource, Bucket> entry = it.next(); Resource resource = entry.getKey(); if (!ResourceUtils.isSet(resource)) { entry.getValue().clear(); it.remove(); } } // store dependencies for (Dependency dep : dependencies) { dependencyPersister.saveDependency(currentProject, dep); } // Keep only inter module dependencies Set<Dependency> projectDependencies = getDependenciesBetweenProjects(); dependencies.clear(); incomingDependenciesByResource.clear(); outgoingDependenciesByResource.clear(); for (Dependency projectDependency : projectDependencies) { projectDependency.setId(null); registerDependency(projectDependency); } }
/** Keep only project stuff */ public void clear() { Iterator<Map.Entry<Resource, Bucket>> it = buckets.entrySet().iterator(); while (it.hasNext()) { Map.Entry<Resource, Bucket> entry = it.next(); Resource resource = entry.getKey(); if (!ResourceUtils.isSet(resource)) { entry.getValue().clear(); it.remove(); } } Set<Dependency> projectDependencies = getDependenciesBetweenProjects(); dependencies.clear(); incomingDependenciesByResource.clear(); outgoingDependenciesByResource.clear(); for (Dependency projectDependency : projectDependencies) { projectDependency.setId(null); registerDependency(projectDependency); } lock.unlock(); }