ItEr31S12ValidacionEProbasFuncionaisItEr30S17: When detaching a DayAssignment, it's removed from the resource too
bug #66
This commit is contained in:
parent
efb02d7df3
commit
a97dec36cd
3 changed files with 11 additions and 0 deletions
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
package org.navalplanner.business.planner.entities;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
|
@ -80,6 +81,7 @@ public class GenericDayAssignment extends DayAssignment {
|
|||
|
||||
public void detach() {
|
||||
genericResourceAllocation = null;
|
||||
getResource().removeAssignments(Arrays.asList(this));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
package org.navalplanner.business.planner.entities;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
|
@ -81,5 +82,6 @@ public class SpecificDayAssignment extends DayAssignment {
|
|||
|
||||
void detach() {
|
||||
this.specificResourceAllocation = null;
|
||||
getResource().removeAssignments(Arrays.asList(this));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -596,6 +596,13 @@ public abstract class Resource extends BaseEntity{
|
|||
this.dayAssignments.addAll(assignments);
|
||||
}
|
||||
|
||||
public void removeAssignments(
|
||||
Collection<? extends DayAssignment> assignments) {
|
||||
Validate.noNullElements(assignments);
|
||||
clearCachedData();
|
||||
this.dayAssignments.removeAll(assignments);
|
||||
}
|
||||
|
||||
public List<DayAssignment> getAssignments() {
|
||||
return new ArrayList<DayAssignment>(dayAssignments);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue