Bug #1433: Make sure that old TaskSources are deleted also in the case of parent tasks.

It fixes the other part of the bug, when a task is the only child of a container and
it is unscheduled, so the TaskSource of the parent is deleted too.

FEA: ItEr76S04BugFixing
This commit is contained in:
Jacobo Aragunde Pérez 2012-05-07 14:25:44 +02:00
parent a25fac6146
commit 73b4f99e33

View file

@ -300,7 +300,12 @@ public abstract class OrderElement extends IntegrationEntity implements
if(getOnDBTaskSource() != getTaskSource()) {
//this element was unscheduled and then scheduled again. Its TaskSource has
//been recreated but we have to remove the old one.
removeTaskSource(result);
if(getParent().getTaskSource() == getParent().getOnDBTaskSource()) {
//we only remove the TaskSource if the parent is not in the same situation.
//In case the parent is in the same situation, it will remove the related
//TaskSources in children tasks.
removeTaskSource(result);
}
}
result
.addAll(synchronizationForSchedulingPoint(schedulingDataForVersion));
@ -309,6 +314,11 @@ public abstract class OrderElement extends IntegrationEntity implements
if (wasASchedulingPoint()) {
result.add(taskSourceRemoval());
}
if(getOnDBTaskSource() != getTaskSource()) {
//all the children of this element were unscheduled and then scheduled again,
//its TaskSource has been recreated but we have to remove the old one.
result.add(taskSourceRemoval());
}
result
.add(synchronizationForSuperelement(schedulingDataForVersion));
} else if (schedulingState.isNoScheduled()) {
@ -417,7 +427,7 @@ public abstract class OrderElement extends IntegrationEntity implements
}
}
private TaskSource getOnDBTaskSource() {
protected TaskSource getOnDBTaskSource() {
SchedulingDataForVersion schedulingDataForVersion = getCurrentVersionOnDB();
return schedulingDataForVersion.getTaskSource();
}