Search in sources :

Example 1 with TypeDTO

use of org.phoenicis.repository.dto.TypeDTO in project phoenicis by PhoenicisOrg.

the class EnginesController method populateView.

private void populateView(RepositoryDTO repositoryDTO) {
    Platform.runLater(() -> {
        List<CategoryDTO> categoryDTOS = new ArrayList<>();
        for (TypeDTO typeDTO : repositoryDTO.getTypes()) {
            if (typeDTO.getId().equals("Engines")) {
                categoryDTOS = typeDTO.getCategories();
            }
        }
        setDefaultEngineIcons(categoryDTOS);
        enginesSource.fetchAvailableEngines(categoryDTOS, versions -> Platform.runLater(() -> this.enginesView.populate(versions)));
    });
}
Also used : CategoryDTO(org.phoenicis.repository.dto.CategoryDTO) ArrayList(java.util.ArrayList) TypeDTO(org.phoenicis.repository.dto.TypeDTO)

Example 2 with TypeDTO

use of org.phoenicis.repository.dto.TypeDTO in project POL-POM-5 by PhoenicisOrg.

the class EnginesController method populateView.

private void populateView(RepositoryDTO repositoryDTO) {
    Platform.runLater(() -> {
        List<CategoryDTO> categoryDTOS = new ArrayList<>();
        for (TypeDTO typeDTO : repositoryDTO.getTypes()) {
            if (typeDTO.getId().equals("Engines")) {
                categoryDTOS = typeDTO.getCategories();
            }
        }
        setDefaultEngineIcons(categoryDTOS);
        enginesSource.fetchAvailableEngines(categoryDTOS, versions -> Platform.runLater(() -> this.enginesView.populate(versions)));
    });
}
Also used : CategoryDTO(org.phoenicis.repository.dto.CategoryDTO) ArrayList(java.util.ArrayList) TypeDTO(org.phoenicis.repository.dto.TypeDTO)

Example 3 with TypeDTO

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

Example 4 with TypeDTO

use of org.phoenicis.repository.dto.TypeDTO 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 5 with TypeDTO

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

Aggregations

ArrayList (java.util.ArrayList)6 CategoryDTO (org.phoenicis.repository.dto.CategoryDTO)6 TypeDTO (org.phoenicis.repository.dto.TypeDTO)6 HashMap (java.util.HashMap)4 ApplicationDTO (org.phoenicis.repository.dto.ApplicationDTO)4