Search in sources :

Example 6 with ApplicationDTO

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);
    }
}
Also used : ApplicationDTO(org.phoenicis.repository.dto.ApplicationDTO) ContainerDTO(org.phoenicis.containers.dto.ContainerDTO)

Example 7 with ApplicationDTO

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;
}
Also used : ApplicationDTO(org.phoenicis.repository.dto.ApplicationDTO) ToStringBuilder(org.apache.commons.lang.builder.ToStringBuilder) HashCodeBuilder(org.apache.commons.lang.builder.HashCodeBuilder) EqualsBuilder(org.apache.commons.lang.builder.EqualsBuilder) IOException(java.io.IOException) File(java.io.File)

Example 8 with ApplicationDTO

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);
}
Also used : CategoryDTO(org.phoenicis.repository.dto.CategoryDTO) Consumer(java.util.function.Consumer) CategoryDTO(org.phoenicis.repository.dto.CategoryDTO) List(java.util.List) Optional(java.util.Optional) Collections(java.util.Collections) ApplicationDTO(org.phoenicis.repository.dto.ApplicationDTO) ScriptDTO(org.phoenicis.repository.dto.ScriptDTO) ApplicationDTO(org.phoenicis.repository.dto.ApplicationDTO)

Example 9 with ApplicationDTO

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();
}
Also used : ApplicationDTO(org.phoenicis.repository.dto.ApplicationDTO)

Example 10 with ApplicationDTO

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);
}
Also used : CategoryDTO(org.phoenicis.repository.dto.CategoryDTO) ApplicationDTO(org.phoenicis.repository.dto.ApplicationDTO) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) TypeDTO(org.phoenicis.repository.dto.TypeDTO)

Aggregations

ApplicationDTO (org.phoenicis.repository.dto.ApplicationDTO)14 CategoryDTO (org.phoenicis.repository.dto.CategoryDTO)7 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)4 TypeDTO (org.phoenicis.repository.dto.TypeDTO)4 List (java.util.List)2 EqualsBuilder (org.apache.commons.lang.builder.EqualsBuilder)2 HashCodeBuilder (org.apache.commons.lang.builder.HashCodeBuilder)2 ContainerDTO (org.phoenicis.containers.dto.ContainerDTO)2 ScriptDTO (org.phoenicis.repository.dto.ScriptDTO)2 File (java.io.File)1 IOException (java.io.IOException)1 Collections (java.util.Collections)1 Optional (java.util.Optional)1 Consumer (java.util.function.Consumer)1 Collectors (java.util.stream.Collectors)1 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)1 ToStringBuilder (org.apache.commons.lang.builder.ToStringBuilder)1 OperatingSystem (org.phoenicis.entities.OperatingSystem)1 MappedList (org.phoenicis.javafx.collections.MappedList)1