Bug fix bei addAprioriToCalc()
This commit is contained in:
@@ -166,20 +166,23 @@ public class TreeHelper {
|
||||
public TreeItem<Object> addAprioriToCalc(TreeItem<Object> calcItem, TreeItem<Object> aprioriItem)
|
||||
throws InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
|
||||
for (TreeItem<Object> aprioriChild : aprioriItem.getChildren()) {
|
||||
|
||||
List<TreeItem<Object>> matchingChildren = calcItem.getChildren().stream()
|
||||
.filter(c -> ((ProduktbausteinType) c.getValue()).getId()
|
||||
.equals(((ProduktbausteinType) aprioriChild.getValue()).getId()))
|
||||
.toList();
|
||||
|
||||
if (matchingChildren.isEmpty()) {
|
||||
TreeItem<Object> newChild = cloneTreeItem(aprioriChild);
|
||||
|
||||
calcItem.getChildren().add(newChild);
|
||||
addAprioriToCalc(newChild, aprioriChild);
|
||||
} else {
|
||||
for (TreeItem<Object> matchingChild : matchingChildren) {
|
||||
addAprioriToCalc(matchingChild, aprioriChild);
|
||||
boolean isInCalc = false;
|
||||
int i = 0;
|
||||
for (TreeItem<Object> calcChild : calcItem.getChildren()) {
|
||||
if (((ProduktbausteinType) calcChild.getValue()).getId().equals(((ProduktbausteinType) aprioriChild.getValue()).getId()) || isNotIncluded.contains(calcChild)) {
|
||||
isInCalc = true;
|
||||
if (!aprioriChild.getChildren().isEmpty()) {
|
||||
calcChild = addAprioriToCalc(calcChild, aprioriChild);
|
||||
calcItem.getChildren().set(i, calcChild);
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (!isInCalc) {
|
||||
TreeItem<Object> missingCalcItem = cloneTreeItem(aprioriChild);
|
||||
calcItem.getChildren().add(missingCalcItem);
|
||||
if (!isNotIncluded.contains(missingCalcItem)) {
|
||||
isNotIncluded.add(missingCalcItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user