Search in sources :

Example 1 with TaskDefinitionModel

use of io.vertigo.studio.plugins.mda.task.model.TaskDefinitionModel in project vertigo by KleeGroup.

the class TaskGeneratorPlugin method builDtDefinitiondMap.

private static Map<DtDefinition, List<TaskDefinition>> builDtDefinitiondMap() {
    final Collection<TaskDefinition> taskDefinitions = Home.getApp().getDefinitionSpace().getAll(TaskDefinition.class);
    final Map<DtDefinition, List<TaskDefinition>> taskDefinitionsMap = new LinkedHashMap<>();
    // ---
    // Par défaut, On crée pour chaque DT une liste vide des taches lui étant associées.
    final Collection<DtDefinition> dtDefinitions = Home.getApp().getDefinitionSpace().getAll(DtDefinition.class);
    for (final DtDefinition dtDefinition : dtDefinitions) {
        taskDefinitionsMap.put(dtDefinition, new ArrayList<TaskDefinition>());
    }
    // ---
    for (final TaskDefinition taskDefinition : taskDefinitions) {
        final TaskDefinitionModel templateTaskDefinition = new TaskDefinitionModel(taskDefinition);
        final DtDefinition dtDefinition = getDtDefinition(templateTaskDefinition);
        final boolean dao = dtDefinition != null;
        if (dao) {
            // Dans le cas d'un DTO ou DTC en sortie on considère que la tache est liée au DAO.
            taskDefinitionsMap.get(dtDefinition).add(taskDefinition);
        }
    }
    return taskDefinitionsMap;
}
Also used : TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) ArrayList(java.util.ArrayList) List(java.util.List) TaskDefinitionModel(io.vertigo.studio.plugins.mda.task.model.TaskDefinitionModel) LinkedHashMap(java.util.LinkedHashMap)

Example 2 with TaskDefinitionModel

use of io.vertigo.studio.plugins.mda.task.model.TaskDefinitionModel in project vertigo by KleeGroup.

the class TaskGeneratorPlugin method buildPackageMap.

private static Map<String, List<TaskDefinition>> buildPackageMap() {
    final Collection<TaskDefinition> taskDefinitions = Home.getApp().getDefinitionSpace().getAll(TaskDefinition.class);
    final Map<String, List<TaskDefinition>> taskDefinitionsMap = new LinkedHashMap<>();
    // ---
    for (final TaskDefinition taskDefinition : taskDefinitions) {
        final TaskDefinitionModel templateTaskDefinition = new TaskDefinitionModel(taskDefinition);
        final DtDefinition dtDefinition = getDtDefinition(templateTaskDefinition);
        // Correction bug : task avec retour DtObject (non persistant) non générée
        // Les taches sont générées dans les pao
        // - si il n'esxiste pas de définition associées à la tache
        // - ou si la définition est considérée comme non persistante.
        final boolean pao = dtDefinition == null || !dtDefinition.isPersistent();
        if (pao) {
            // La tache est liée au package. (PAO)
            final List<TaskDefinition> list = taskDefinitionsMap.computeIfAbsent(taskDefinition.getPackageName(), k -> new ArrayList<>());
            // on ajoute la tache aux taches du package.
            list.add(taskDefinition);
        }
    }
    return taskDefinitionsMap;
}
Also used : TaskDefinition(io.vertigo.dynamo.task.metamodel.TaskDefinition) DtDefinition(io.vertigo.dynamo.domain.metamodel.DtDefinition) ArrayList(java.util.ArrayList) List(java.util.List) TaskDefinitionModel(io.vertigo.studio.plugins.mda.task.model.TaskDefinitionModel) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

DtDefinition (io.vertigo.dynamo.domain.metamodel.DtDefinition)2 TaskDefinition (io.vertigo.dynamo.task.metamodel.TaskDefinition)2 TaskDefinitionModel (io.vertigo.studio.plugins.mda.task.model.TaskDefinitionModel)2 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2