use of org.phoenicis.repository.dto.ApplicationDTO in project POL-POM-5 by PlayOnLinux.
the class ContainersFeaturePanelSkin method updateVerbs.
/**
* Applies the verbs belonging to the currently selected container to the given {@link ContainerInformationPanel}
*
* @param containerInformationPanel The information panel showing the details for the currently selected container
*/
private void updateVerbs(final ContainerInformationPanel containerInformationPanel) {
final ObservableMap<String, ApplicationDTO> verbs = getControl().getVerbs();
final ContainerDTO container = containerInformationPanel.getContainer();
if (container != null && verbs.containsKey(container.getEngine().toLowerCase())) {
containerInformationPanel.setVerbs(verbs.get(container.getEngine().toLowerCase()));
} else {
containerInformationPanel.setVerbs(null);
}
}
use of org.phoenicis.repository.dto.ApplicationDTO in project POL-POM-5 by PlayOnLinux.
the class LocalRepository method fetchApplications.
private List<ApplicationDTO> fetchApplications(File categoryDirectory) {
final File[] applicationDirectories = categoryDirectory.listFiles();
if (applicationDirectories == null) {
return Collections.emptyList();
}
final List<ApplicationDTO> results = new ArrayList<>();
for (File applicationDirectory : applicationDirectories) {
if (applicationDirectory.isDirectory()) {
final ApplicationDTO.Builder applicationDTOBuilder = new ApplicationDTO.Builder(unSerializeApplication(new File(applicationDirectory, "application.json")));
if (StringUtils.isBlank(applicationDTOBuilder.getName())) {
applicationDTOBuilder.withName(applicationDirectory.getName());
}
final File miniaturesDirectory = new File(applicationDirectory, "miniatures");
if (miniaturesDirectory.exists() && miniaturesDirectory.isDirectory()) {
try {
applicationDTOBuilder.withMiniatures(fetchMiniatures(miniaturesDirectory));
} catch (IOException e) {
LOGGER.warn("Unable to read miniatures", e);
}
}
applicationDTOBuilder.withScripts(fetchScripts(applicationDirectory));
applicationDTOBuilder.withResources(fetchResources(applicationDirectory));
ApplicationDTO app = applicationDTOBuilder.build();
results.add(app);
}
}
Collections.sort(results, Comparator.comparing(ApplicationDTO::getName));
return results;
}
use of org.phoenicis.repository.dto.ApplicationDTO in project POL-POM-5 by PlayOnLinux.
the class Repository method getApplication.
default default ApplicationDTO getApplication(List<String> path) {
final CategoryDTO categoryDTO = getCategory(path);
if (categoryDTO == null) {
return null;
}
final Optional<ApplicationDTO> applicationDTO = categoryDTO.getApplications().stream().filter(application -> path.get(1).equals(application.getName())).findFirst();
return applicationDTO.orElse(null);
}
use of org.phoenicis.repository.dto.ApplicationDTO in project POL-POM-5 by PlayOnLinux.
the class ClasspathRepository method buildApplication.
private ApplicationDTO buildApplication(String categoryFileName, String applicationFileName) throws IOException {
final String applicationJsonFile = packagePath + "/" + categoryFileName + "/" + applicationFileName + "/application.json";
final ApplicationDTO applicationDTO = objectMapper.readValue(getClass().getResourceAsStream(applicationJsonFile), ApplicationDTO.class);
return new ApplicationDTO.Builder(applicationDTO).withScripts(buildScripts(categoryFileName, applicationFileName)).withMiniatures(buildMiniatures(categoryFileName, applicationFileName)).build();
}
use of org.phoenicis.repository.dto.ApplicationDTO in project POL-POM-5 by PhoenicisOrg.
the class EngineToolsManager method fetchAvailableEngineTools.
/**
* fetches the available engine tools
* @param repositoryDTO
* @param callback
*/
public void fetchAvailableEngineTools(RepositoryDTO repositoryDTO, Consumer<Map<String, ApplicationDTO>> callback) {
Map<String, ApplicationDTO> tools = new HashMap<>();
// get engine CategoryDTOs
List<CategoryDTO> categoryDTOS = new ArrayList<>();
for (TypeDTO typeDTO : repositoryDTO.getTypes()) {
if (typeDTO.getId().equals("Engines")) {
categoryDTOS = typeDTO.getCategories();
}
}
for (CategoryDTO engine : categoryDTOS) {
for (ApplicationDTO applicationDTO : engine.getApplications()) {
if (applicationDTO.getId().equals("Tools")) {
tools.put(engine.getId(), applicationDTO);
}
}
}
callback.accept(tools);
}
Aggregations