Search in sources :

Example 11 with ApplicationDTO

use of org.phoenicis.repository.dto.ApplicationDTO in project phoenicis 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)

Example 12 with ApplicationDTO

use of org.phoenicis.repository.dto.ApplicationDTO in project POL-POM-5 by PlayOnLinux.

the class ContainersFeaturePanelSkin method updateEngineTools.

/**
 * Applies the engine tools 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 updateEngineTools(final ContainerInformationPanel containerInformationPanel) {
    final ObservableMap<String, ApplicationDTO> engineTools = getControl().getEngineTools();
    final ContainerDTO container = containerInformationPanel.getContainer();
    if (container != null && engineTools.containsKey(container.getEngine().toLowerCase())) {
        containerInformationPanel.setEngineTools(engineTools.get(container.getEngine().toLowerCase()));
    } else {
        containerInformationPanel.setEngineTools(null);
    }
}
Also used : ApplicationDTO(org.phoenicis.repository.dto.ApplicationDTO) ContainerDTO(org.phoenicis.containers.dto.ContainerDTO)

Example 13 with ApplicationDTO

use of org.phoenicis.repository.dto.ApplicationDTO in project POL-POM-5 by PlayOnLinux.

the class EngineToolsManager method fetchAvailableEngineTools.

/**
 * Fetches the available engine tools
 *
 * @param repositoryDTO The repository containing the engine tools
 * @param callback The callback taking the fetched engine tools
 */
public void fetchAvailableEngineTools(RepositoryDTO repositoryDTO, Consumer<Map<String, ApplicationDTO>> callback) {
    // get engine CategoryDTOs
    List<CategoryDTO> categoryDTOS = new ArrayList<>();
    for (TypeDTO typeDTO : repositoryDTO.getTypes()) {
        if (typeDTO.getId().equals("engines")) {
            categoryDTOS = typeDTO.getCategories();
        }
    }
    Map<String, ApplicationDTO> tools = new HashMap<>();
    for (CategoryDTO engine : categoryDTOS) {
        for (ApplicationDTO applicationDTO : engine.getApplications()) {
            if (applicationDTO.getId().equals(engine.getId() + ".tools")) {
                tools.put(engine.getId().replaceAll("^.*\\.", ""), 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)

Example 14 with ApplicationDTO

use of org.phoenicis.repository.dto.ApplicationDTO in project POL-POM-5 by PlayOnLinux.

the class VerbsManager method fetchAvailableVerbs.

/**
 * Fetches the available Verbs
 *
 * @param repositoryDTO
 * @param callback
 */
public void fetchAvailableVerbs(RepositoryDTO repositoryDTO, Consumer<Map<String, ApplicationDTO>> callback) {
    Map<String, ApplicationDTO> verbs = 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(engine.getId() + ".verbs")) {
                verbs.put(engine.getId().replaceAll("^.*\\.", ""), applicationDTO);
            }
        }
    }
    callback.accept(verbs);
}
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