Remove duplicated method in TaskElement

FEA: ItEr75S04BugFixing
This commit is contained in:
Manuel Rego Casasnovas 2011-12-14 12:53:46 +01:00
parent af84f83c5f
commit b365d3b46c
4 changed files with 4 additions and 29 deletions

View file

@ -398,8 +398,7 @@ public abstract class OrderElement extends IntegrationEntity implements
} else {
TaskSource taskSource = getTaskSource();
if (taskSource != null) {
taskSource.getTask().detachFromDependencies();
taskSource.getTask().detachFromParent();
taskSource.getTask().detach();
getCurrentSchedulingData().taskSourceRemovalRequested();
}
}

View file

@ -109,7 +109,7 @@ public class OrderLineGroup extends OrderElement implements
TaskGroup group = (TaskGroup) getThis().getTaskSource()
.getTask();
group.remove(childTask);
childTask.detachFromDependencies();
childTask.detachDependencies();
}
@Override

View file

@ -306,8 +306,7 @@ public class TaskSource extends BaseEntity {
@Override
public TaskElement apply(IOptionalPersistence optionalPersistence) {
taskSource.getTask().detachFromDependencies();
taskSource.getTask().detachFromParent();
taskSource.getTask().detach();
optionalPersistence.remove(taskSource);
return null;
}

View file

@ -29,7 +29,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.ConcurrentModificationException;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
@ -477,7 +476,7 @@ public abstract class TaskElement extends BaseEntity {
return result;
}
private void detachDependencies() {
public void detachDependencies() {
detachOutcomingDependencies();
detachIncomingDependencies();
}
@ -651,28 +650,6 @@ public abstract class TaskElement extends BaseEntity {
this.advancePercentage = advancePercentage;
}
public void detachFromDependencies() {
for (Dependency each : copy(getDependenciesWithThisDestination())) {
detachDependency(each);
}
for (Dependency each : copy(getDependenciesWithThisOrigin())) {
detachDependency(each);
}
}
/**
* Copy the dependencies to a list in order to avoid
* {@link ConcurrentModificationException}
*/
private List<Dependency> copy(Set<Dependency> dependencies) {
return new ArrayList<Dependency>(dependencies);
}
private void detachDependency(Dependency each) {
each.getOrigin().removeDependencyWithDestination(each.getDestination(),
each.getType());
}
private Integer sumOfHoursAllocated = 0;
public void setSumOfHoursAllocated(Integer sumOfHoursAllocated) {