use of eu.esdihumboldt.hale.common.tasks.TaskType.TaskSeverity in project hale by halestudio.
the class TaskDescriptionLabelProvider method getNodeLevel.
/**
* Get the given node's severity level
*
* @param node the node
*
* @return the severity level or <code>null</code>
*/
private TaskSeverity getNodeLevel(MapTreeNode<?, ?> node) {
TaskSeverity level = null;
TreeNode[] children = node.getChildren();
for (TreeNode child : children) {
if (child instanceof DefaultTreeNode) {
// child is task node
DefaultTreeNode childNode = (DefaultTreeNode) child;
Object tmp = childNode.getValue();
// get value
Object value;
if (tmp.getClass().isArray()) {
value = ((Object[]) tmp)[index];
} else {
value = tmp;
}
// determine level
if (value instanceof ResolvedTask) {
ResolvedTask<?> task = (ResolvedTask<?>) value;
if (task.isOpen()) {
// only inspect open tasks
level = TaskSeverity.max(level, task.getSeverityLevel());
}
}
} else if (child instanceof MapTreeNode<?, ?>) {
// child is map node
MapTreeNode<?, ?> childNode = (MapTreeNode<?, ?>) child;
TaskSeverity childLevel = getNodeLevel(childNode);
level = TaskSeverity.max(level, childLevel);
}
}
return level;
}
Aggregations