use of com.qcadoo.plugin.api.PluginDependencyResult in project qcadoo by qcadoo.
the class DefaultPluginDependencyManager method getDependentPlugins.
private Set<PluginDependencyInformation> getDependentPlugins(final List<Plugin> plugins, final boolean includeDisabled, final PluginStatusResolver pluginStatusResolver) {
List<Plugin> enabledDependencyPlugins = new LinkedList<Plugin>();
Set<String> argumentPluginIdentifiersSet = getArgumentIdentifiersSet(plugins);
for (Plugin plugin : pluginAccessor.getPlugins()) {
if (includeDisabled) {
if (pluginStatusResolver.isPluginNotInstalled(plugin)) {
continue;
}
} else {
if (!pluginStatusResolver.isPluginEnabled(plugin)) {
continue;
}
}
for (Plugin pluginToDisable : plugins) {
for (PluginDependencyInformation dependencyInfo : plugin.getRequiredPlugins()) {
if (dependencyInfo.getIdentifier().equals(pluginToDisable.getIdentifier())) {
enabledDependencyPlugins.add(plugin);
break;
}
}
}
}
Set<PluginDependencyInformation> enabledDependencies = new HashSet<PluginDependencyInformation>();
for (Plugin plugin : enabledDependencyPlugins) {
enabledDependencies.add(new PluginDependencyInformation(plugin.getIdentifier()));
}
if (!enabledDependencyPlugins.isEmpty()) {
PluginDependencyResult nextLevelDependencioesResult = getDependenciesToDisable(enabledDependencyPlugins, pluginStatusResolver);
enabledDependencies.addAll(nextLevelDependencioesResult.getDependenciesToDisable());
}
Iterator<PluginDependencyInformation> dependencyInfoIterator = enabledDependencies.iterator();
while (dependencyInfoIterator.hasNext()) {
if (argumentPluginIdentifiersSet.contains(dependencyInfoIterator.next().getIdentifier())) {
dependencyInfoIterator.remove();
}
}
return enabledDependencies;
}
Aggregations