protected Collection<LogicalPath> getPaths(final boolean sourceOnly) { final Collection<LogicalPath> pathIds = new ArrayList<LogicalPath>(); for (final Pom pom : pomManagementService.getPoms()) { for (final PhysicalPath modulePath : pom.getPhysicalPaths()) { if (!sourceOnly || modulePath.isSource()) { pathIds.add(modulePath.getLogicalPath()); } } } return pathIds; }
/** * Locates the first {@link PhysicalPath} which can be construed as a parent of the presented * identifier. * * @param identifier to locate the parent of (required) * @return the first matching parent, or null if not found */ protected PhysicalPath getApplicablePhysicalPath(final String identifier) { Assert.notNull(identifier, "Identifier required"); PhysicalPath physicalPath = null; int longest = 0; for (final Pom pom : pomManagementService.getPoms()) { if (removeTrailingSeparator(identifier).startsWith(removeTrailingSeparator(pom.getRoot())) && removeTrailingSeparator(pom.getRoot()).length() > longest) { longest = removeTrailingSeparator(pom.getRoot()).length(); int nextLongest = 0; for (final PhysicalPath thisPhysicalPath : pom.getPhysicalPaths()) { final String possibleParent = new FileDetails(thisPhysicalPath.getLocation(), null).getCanonicalPath(); if (removeTrailingSeparator(identifier).startsWith(possibleParent) && possibleParent.length() > nextLongest) { nextLongest = possibleParent.length(); physicalPath = thisPhysicalPath; } } } } return physicalPath; }