forked from Evolveum/midpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Connect GUI to the new activity framework
Fields of progress, errors, result status, start/end timestamp, LS token, and (newly created - experimental) nodes, are now connected to the data maintained by the activity framework. The connection is via TaskInformation and AttachedTaskInformation objects. Work in progress. The part in admin-gui should be cleaned up, see TODO/FIXME in the code. Also: - added realization and execution start/end timestamps to activity state, - added node and "stalled since" information to the activity tree state overview, - extended ItemsProgressInformation with # of errors. Related to MID-7214. Should resolve also MID-7079, MID-7042, MID-7054, MID-6982, MID-7012, and MID-7068.
- Loading branch information
Showing
42 changed files
with
1,444 additions
and
336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
...dmin-gui/src/main/java/com/evolveum/midpoint/gui/impl/page/admin/task/RootTaskLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright (C) 2010-2021 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.gui.impl.page.admin.task; | ||
|
||
import com.evolveum.midpoint.gui.api.model.LoadableModel; | ||
import com.evolveum.midpoint.gui.api.page.PageBase; | ||
import com.evolveum.midpoint.schema.result.OperationResult; | ||
import com.evolveum.midpoint.task.api.Task; | ||
import com.evolveum.midpoint.util.annotation.Experimental; | ||
import com.evolveum.midpoint.util.logging.LoggingUtils; | ||
import com.evolveum.midpoint.util.logging.Trace; | ||
import com.evolveum.midpoint.util.logging.TraceManager; | ||
import com.evolveum.midpoint.web.component.util.SerializableSupplier; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
/** | ||
* Responsible for creating a model for a root task (given any task in the task tree). | ||
* | ||
* TODO clean up as needed | ||
* TODO optimize # of loads of the root task when navigating through the tree | ||
*/ | ||
@Experimental | ||
public class RootTaskLoader { | ||
|
||
private static final Trace LOGGER = TraceManager.getTrace(RootTaskLoader.class); | ||
|
||
private static final String OPERATION_LOAD_TASK_ROOT = RootTaskLoader.class.getName() + ".loadTaskRoot"; | ||
|
||
public static @NotNull LoadableModel<TaskType> createRootTaskModel( | ||
SerializableSupplier<TaskType> taskSupplier, | ||
SerializableSupplier<PageBase> pageBaseSupplier) { | ||
return LoadableModel.create(() -> { | ||
TaskType task = taskSupplier.get(); | ||
if (task == null || task.getOid() == null) { | ||
return null; | ||
} else if (task.getParent() == null) { | ||
return task; | ||
} else { | ||
return doLoadRoot(task, pageBaseSupplier); | ||
} | ||
}, false); | ||
} | ||
|
||
/** | ||
* Loads root task from the repository. Returns null if task cannot be loaded. | ||
* | ||
* Precondition: task is persistent. | ||
*/ | ||
private static @Nullable TaskType doLoadRoot(@NotNull TaskType taskBean, SerializableSupplier<PageBase> pageBaseSupplier) { | ||
PageBase pageBase = pageBaseSupplier.get(); | ||
Task opTask = pageBase.createSimpleTask(OPERATION_LOAD_TASK_ROOT); | ||
OperationResult result = opTask.getResult(); | ||
try { | ||
return pageBase.getTaskManager() | ||
.createTaskInstance(taskBean.asPrismObject(), result) | ||
.getRoot(result) | ||
.getUpdatedTaskObject().asObjectable(); | ||
} catch (Exception e) { | ||
LoggingUtils.logException(LOGGER, "Couldn't determine root for {}", e, taskBean); | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.