Search in sources :

Example 6 with TypeDTO

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

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