Bug #1433: Small code refactor of this bug fix.

FEA: ItEr76S04BugFixing
This commit is contained in:
Jacobo Aragunde Pérez 2012-05-07 16:08:47 +02:00
parent 73b4f99e33
commit 5edf9998ff

View file

@ -297,10 +297,10 @@ public abstract class OrderElement extends IntegrationEntity implements
//we have to remove the TaskSource which contains a TaskGroup instead of TaskElement
removeTaskSource(result);
}
if(getOnDBTaskSource() != getTaskSource()) {
if(currentTaskSourceIsNotTheSame()) {
//this element was unscheduled and then scheduled again. Its TaskSource has
//been recreated but we have to remove the old one.
if(getParent().getTaskSource() == getParent().getOnDBTaskSource()) {
if(!getParent().currentTaskSourceIsNotTheSame()) {
//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.
@ -314,7 +314,7 @@ public abstract class OrderElement extends IntegrationEntity implements
if (wasASchedulingPoint()) {
result.add(taskSourceRemoval());
}
if(getOnDBTaskSource() != getTaskSource()) {
if(currentTaskSourceIsNotTheSame()) {
//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());
@ -346,6 +346,10 @@ public abstract class OrderElement extends IntegrationEntity implements
.getSchedulingStateType();
}
protected boolean currentTaskSourceIsNotTheSame() {
return getOnDBTaskSource() != getTaskSource();
}
private List<TaskSourceSynchronization> childrenSynchronizations() {
List<TaskSourceSynchronization> childrenOfGroup = new ArrayList<TaskSourceSynchronization>();
for (OrderElement orderElement : getSomewhatScheduledOrderElements()) {
@ -427,7 +431,7 @@ public abstract class OrderElement extends IntegrationEntity implements
}
}
protected TaskSource getOnDBTaskSource() {
private TaskSource getOnDBTaskSource() {
SchedulingDataForVersion schedulingDataForVersion = getCurrentVersionOnDB();
return schedulingDataForVersion.getTaskSource();
}