Bug #1387: Reset the TaskSource when an OrderGroup changes to scheduling point.

FEA: ItEr76S04BugFixing
This commit is contained in:
Jacobo Aragunde Pérez 2012-03-09 13:54:07 +01:00
parent e5ea9caa7f
commit 6af82b4c54

View file

@ -57,6 +57,7 @@ import org.libreplan.business.orders.entities.SchedulingState.Type;
import org.libreplan.business.orders.entities.TaskSource.TaskSourceSynchronization;
import org.libreplan.business.planner.entities.Task;
import org.libreplan.business.planner.entities.TaskElement;
import org.libreplan.business.planner.entities.TaskGroup;
import org.libreplan.business.planner.entities.TaskPositionConstraint;
import org.libreplan.business.qualityforms.entities.QualityForm;
import org.libreplan.business.qualityforms.entities.TaskQualityForm;
@ -290,6 +291,11 @@ public abstract class OrderElement extends IntegrationEntity implements
SchedulingDataForVersion schedulingDataForVersion) {
List<TaskSourceSynchronization> result = new ArrayList<TaskSourceSynchronization>();
if (isSchedulingPoint()) {
if(isSchedulingPointButItWasNot()) {
//this element was a container but now it's a scheduling point
//we have to remove the TaskSource which contains a TaskGroup instead of TaskElement
removeTaskSource(result);
}
result
.addAll(synchronizationForSchedulingPoint(schedulingDataForVersion));
} else if (isSuperElementPartialOrCompletelyScheduled()) {
@ -323,6 +329,11 @@ public abstract class OrderElement extends IntegrationEntity implements
&& getTaskSource().getTask() instanceof Task;
}
private boolean isSchedulingPointButItWasNot() {
return getTaskSource() != null
&& getTaskSource().getTask() instanceof TaskGroup;
}
private List<TaskSourceSynchronization> childrenSynchronizations() {
List<TaskSourceSynchronization> childrenOfGroup = new ArrayList<TaskSourceSynchronization>();
for (OrderElement orderElement : getSomewhatScheduledOrderElements()) {