Class CategoryTree
Categories of Tasks or Cases,
e.g. to show an overview of involved categories in a task or case query.
The CategoryTree is created by the method createFor(CaseQuery) or createFor(TaskQuery),
the method optimize and executes the passed query and returns the corresponding tree model.
Example:
Lets imagine that the query
returns the following four tasks which are categorized as below:
TaskQuery query = TaskQuery.create().where().currentUserCanWorkOn();
List<ITask> query.executor().results();
- Task 1 in category 'Finance/Invoices'
- Task 2 in category 'Finance/Invoices'
- Task 3 in category 'Finance/Invoices/Incoming'
- Task 4 in category 'Support/FirstLevel'
The same query could be passed to the createFor(TaskQuery) method to get the corresponding category tree model.
The above query would create the following tree model:
- Root-Entry (task count: 4, children: 2)
- Finance (task count: 3, children: 1)
- Invoices (task count: 3, children: 1)
- Incoming (task count: 3, children: 0)
- Support (task count: 1, children: 1)
- FirstLevel (task count: 1, children: 0)
The tree model could be accessed by code as follows:
CategoryTree rootNode = CategoryTree.createFor(query);
rootNode.getCategory(); // null
rootNode.count(); // 4 -> 4 tasks blow this category
CategoryTree financeNode = rootNode.getChildren().get(0); // first node 'Finance'
financeNode.getCategory().getName(); // 'Finance'
financeNode.count(); // 3 -> 3 tasks blow this category
CategoryTree invoicesNode = financeNode.getChildren().get(0);
invoicesNode.getCategory().getName(); // 'Invoices'
invoicesNode.count(); // 3 -> 3 tasks blow this category
CategoryTree incomingNode = invoicesNode.getChildren().get(0);
incomingNode.getCategory().getName(); // 'Incoming'
incomingNode.count(); // 1 -> there is 1 task blow this category
CategoryTree supportNode = rootNode.getChildren().get(1);
supportNode.getCategory().getName(); // 'Support'
supportNode.count(); // 1 -> there is 1 task blow this category
CategoryTree firstLevelNode = supportNode.getChildren().get(1);
firstLevelNode.getCategory().getName(); // 'FirstLevel'
firstLevelNode.count(); // 1 -> there is 1 task blow this category
- API:
- This is a public API.
-
Method Summary
Modifier and TypeMethodDescriptionlongcount()Returns to total count of involved tasks or cases of this entry.static CategoryTreeCreates a tree model based on the passedCaseQuery.static CategoryTreeCreates a tree model based on the passedTaskQuery.Returns the children and their children recursively.Returns theCategoryof this entry.Returns the children of this entry.Returns the raw category path of this entry.
-
Method Details
-
createFor
Creates a tree model based on the passedCaseQuery.- Parameters:
caseQuery- the basedCaseQuery- Returns:
- The root node of the
CategoryTree - API:
- This public API is available in Java.
-
createFor
Creates a tree model based on the passedTaskQuery.- Parameters:
taskQuery- the basedTaskQuery- Returns:
- The root node of the
CategoryTree - API:
- This public API is available in Java.
-
getRawPath
Returns the raw category path of this entry.- Returns:
- the raw category path of this entry
- API:
- This public API is available in Java.
-
getCategory
- Returns:
- the
Categoryof this entry - API:
- This public API is available in Java.
-
count
public long count()Returns to total count of involved tasks or cases of this entry.- Returns:
- to total count of involved tasks or cases of this entry
- API:
- This public API is available in Java.
-
getChildren
Returns the children of this entry.- Returns:
- the children of this entry, maybe a empty list
- API:
- This public API is available in Java.
-
getAllChildren
Returns the children and their children recursively.- Returns:
- all the children of this entry, maybe a empty list
- API:
- This public API is available in Java.
-