Bug #1538: Detect inconsistent states on unsaved scheduling points.

FEA: ItEr77S04BugFixing
This commit is contained in:
Jacobo Aragunde Pérez 2012-10-01 13:46:53 +02:00
parent 35f7fca342
commit b7d612b655

View file

@ -316,7 +316,7 @@ public abstract class OrderElement extends IntegrationEntity implements
} else if (isSuperElementPartialOrCompletelyScheduled()) {
removeUnscheduled(result);
if (wasASchedulingPoint()) {
result.add(taskSourceRemoval());
removeTaskSource(result);
} else {
if (hadATaskSource() && currentTaskSourceIsNotTheSame()) {
//all the children of this element were unscheduled and then scheduled again,
@ -350,6 +350,14 @@ public abstract class OrderElement extends IntegrationEntity implements
}
private boolean wasASchedulingPoint() {
TaskSource currentTaskSource = getTaskSource();
// check if the existing TaskSource is inconsistent with the current
// scheduling state
if (currentTaskSource != null && currentTaskSource.getTask().isLeaf()
&& getSchedulingStateType() != Type.SCHEDULING_POINT) {
return true;
}
// check if the scheduling state has changed WRT the DB
SchedulingDataForVersion currentVersionOnDB = getCurrentVersionOnDB();
return SchedulingState.Type.SCHEDULING_POINT == currentVersionOnDB
.getSchedulingStateType();