ItEr44S08ImplantacionAplicacionItEr43S09: [Bug #247] Fixing bug.
Navigating through all generic allocations forcing the load of their criterions so there are no different criterion instances for the same criterion at database
This commit is contained in:
parent
7936e8b0e6
commit
81991cfe08
1 changed files with 23 additions and 0 deletions
|
|
@ -50,13 +50,16 @@ import org.navalplanner.business.orders.entities.OrderElement;
|
|||
import org.navalplanner.business.planner.daos.ITaskElementDAO;
|
||||
import org.navalplanner.business.planner.entities.DayAssignment;
|
||||
import org.navalplanner.business.planner.entities.DerivedAllocation;
|
||||
import org.navalplanner.business.planner.entities.GenericResourceAllocation;
|
||||
import org.navalplanner.business.planner.entities.ICostCalculator;
|
||||
import org.navalplanner.business.planner.entities.ResourceAllocation;
|
||||
import org.navalplanner.business.planner.entities.Task;
|
||||
import org.navalplanner.business.planner.entities.TaskElement;
|
||||
import org.navalplanner.business.planner.entities.TaskGroup;
|
||||
import org.navalplanner.business.planner.entities.TaskMilestone;
|
||||
import org.navalplanner.business.resources.daos.ICriterionDAO;
|
||||
import org.navalplanner.business.resources.daos.IResourceDAO;
|
||||
import org.navalplanner.business.resources.entities.Criterion;
|
||||
import org.navalplanner.business.resources.entities.Resource;
|
||||
import org.navalplanner.business.workreports.daos.IWorkReportLineDAO;
|
||||
import org.navalplanner.business.workreports.entities.WorkReportLine;
|
||||
|
|
@ -139,6 +142,9 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
@Autowired
|
||||
private IResourceDAO resourceDAO;
|
||||
|
||||
@Autowired
|
||||
private ICriterionDAO criterionDAO;
|
||||
|
||||
@Autowired
|
||||
private IWorkReportLineDAO workReportLineDAO;
|
||||
|
||||
|
|
@ -626,6 +632,7 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
TaskGroup taskElement = orderReloaded
|
||||
.getAssociatedTaskElement();
|
||||
final List<Resource> allResources = resourceDAO.list(Resource.class);
|
||||
criterionDAO.list(Criterion.class);
|
||||
forceLoadOfChildren(Arrays.asList(taskElement));
|
||||
planningState = new PlanningState(taskElement, orderReloaded
|
||||
.getAssociatedTasks(), allResources);
|
||||
|
|
@ -644,6 +651,7 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
private void forceLoadOfChildren(Collection<? extends TaskElement> initial) {
|
||||
for (TaskElement each : initial) {
|
||||
forceLoadOfResourceAllocationsResources(each);
|
||||
forceLoadOfCriterions(each);
|
||||
if (each instanceof TaskGroup) {
|
||||
findChildrenWithQueryToAvoidProxies((TaskGroup) each);
|
||||
List<TaskElement> children = each.getChildren();
|
||||
|
|
@ -652,6 +660,21 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forcing the load of all criterions so there are no different criterion
|
||||
* instances for the same criteiron at database
|
||||
*/
|
||||
private void forceLoadOfCriterions(TaskElement taskElement) {
|
||||
List<GenericResourceAllocation> generic = ResourceAllocation.getOfType(
|
||||
GenericResourceAllocation.class, taskElement
|
||||
.getResourceAllocations());
|
||||
for (GenericResourceAllocation each : generic) {
|
||||
for (Criterion eachCriterion : each.getCriterions()) {
|
||||
eachCriterion.getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forcing the load of all resources so the resources at planning state and
|
||||
* at allocations are the same
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue