mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 21:45:43 +01:00
28 lines
877 B
Java
28 lines
877 B
Java
package sonia.scm.plugin;
|
|
|
|
import org.mapstruct.Mapper;
|
|
import org.mapstruct.factory.Mappers;
|
|
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
@Mapper
|
|
public abstract class PluginCenterDtoMapper {
|
|
|
|
static final PluginCenterDtoMapper INSTANCE = Mappers.getMapper(PluginCenterDtoMapper.class);
|
|
|
|
abstract PluginInformation map(PluginCenterDto.Plugin plugin);
|
|
abstract PluginCondition map(PluginCenterDto.Condition condition);
|
|
|
|
Set<AvailablePlugin> map(PluginCenterDto pluginCenterDto) {
|
|
Set<AvailablePlugin> plugins = new HashSet<>();
|
|
for (PluginCenterDto.Plugin plugin : pluginCenterDto.getEmbedded().getPlugins()) {
|
|
AvailablePluginDescriptor descriptor = new AvailablePluginDescriptor(
|
|
map(plugin), map(plugin.getConditions()), plugin.getDependencies()
|
|
);
|
|
plugins.add(new AvailablePlugin(descriptor));
|
|
}
|
|
return plugins;
|
|
}
|
|
}
|