use of org.phoenicis.entities.OperatingSystem in project POL-POM-5 by PlayOnLinux.
the class FilterRepository method fetchInstallableApplications.
@Override
public List<CategoryDTO> fetchInstallableApplications() {
final OperatingSystem currentOperatingSystem = operatingSystemFetcher.fetchCurrentOperationSystem();
final List<CategoryDTO> categories = repository.fetchInstallableApplications();
return categories.stream().map(category -> {
final List<ApplicationDTO> applications = new ArrayList<>();
for (ApplicationDTO application : category.getApplications()) {
List<ScriptDTO> scripts = application.getScripts();
if (!enforceIncompatibleOperatingSystems) {
scripts = application.getScripts().stream().filter(script -> script.getCompatibleOperatingSystems() == null || script.getCompatibleOperatingSystems().contains(currentOperatingSystem)).collect(Collectors.toList());
}
if (!scripts.isEmpty()) {
applications.add(new ApplicationDTO.Builder(application).withScripts(scripts).build());
}
}
return new CategoryDTO.Builder(category).withApplications(applications).build();
}).filter(category -> !category.getApplications().isEmpty()).collect(Collectors.toList());
}
Aggregations