ItEr47S04ValidacionEProbasFuncionaisItEr46S04: Simplifying call.
Providing the resource dao in the constructor
This commit is contained in:
parent
2ccf19bf24
commit
c089051fdd
4 changed files with 9 additions and 6 deletions
|
|
@ -218,7 +218,7 @@ public class ResourceAllocationModel implements IResourceAllocationModel {
|
|||
}
|
||||
|
||||
private void reassociateResourcesWithSession() {
|
||||
planningState.reassociateResourcesWithSession(resourceDAO);
|
||||
planningState.reassociateResourcesWithSession();
|
||||
}
|
||||
|
||||
private void removeDeletedAllocations() {
|
||||
|
|
@ -238,7 +238,7 @@ public class ResourceAllocationModel implements IResourceAllocationModel {
|
|||
this.task = task;
|
||||
this.currentStartDate = task.getStartDate();
|
||||
this.planningState = planningState;
|
||||
planningState.reassociateResourcesWithSession(resourceDAO);
|
||||
planningState.reassociateResourcesWithSession();
|
||||
taskElementDAO.reattach(this.task);
|
||||
reattachTaskSource();
|
||||
loadCriterionsOfGenericAllocations();
|
||||
|
|
|
|||
|
|
@ -746,7 +746,7 @@ public abstract class OrderPlanningModel implements IOrderPlanningModel {
|
|||
criterionDAO.list(Criterion.class);
|
||||
forceLoadOfChildren(Arrays.asList(taskElement));
|
||||
planningState = new PlanningState(taskElement, orderReloaded
|
||||
.getAssociatedTasks(), allResources, criterionDAO);
|
||||
.getAssociatedTasks(), allResources, criterionDAO, resourceDAO);
|
||||
forceLoadOfDependenciesCollections(planningState.getInitial());
|
||||
forceLoadOfWorkingHours(planningState.getInitial());
|
||||
forceLoadOfLabels(planningState.getInitial());
|
||||
|
|
|
|||
|
|
@ -50,12 +50,15 @@ public class PlanningState {
|
|||
|
||||
private final ICriterionDAO criterionDAO;
|
||||
|
||||
private final IResourceDAO resourceDAO;
|
||||
|
||||
public PlanningState(TaskGroup rootTask,
|
||||
Collection<? extends TaskElement> initialState,
|
||||
Collection<? extends Resource> initialResources,
|
||||
ICriterionDAO criterionDAO) {
|
||||
ICriterionDAO criterionDAO, IResourceDAO resourceDAO) {
|
||||
this.rootTask = rootTask;
|
||||
this.criterionDAO = criterionDAO;
|
||||
this.resourceDAO = resourceDAO;
|
||||
this.initial = new ArrayList<TaskElement>(initialState);
|
||||
this.toSave = new HashSet<TaskElement>(initialState);
|
||||
this.toRemove = new HashSet<TaskElement>();
|
||||
|
|
@ -70,7 +73,7 @@ public class PlanningState {
|
|||
return new ArrayList<TaskElement>(initial);
|
||||
}
|
||||
|
||||
public void reassociateResourcesWithSession(IResourceDAO resourceDAO) {
|
||||
public void reassociateResourcesWithSession() {
|
||||
for (Resource resource : resources) {
|
||||
resourceDAO.reattach(resource);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public class ReassignCommand implements IReassignCommand {
|
|||
private void doReassignation(IContext<TaskElement> context,
|
||||
ReassignConfiguration configuration) {
|
||||
Validate.notNull(configuration);
|
||||
planningState.reassociateResourcesWithSession(resourceDAO);
|
||||
planningState.reassociateResourcesWithSession();
|
||||
List<Task> taskToReassign = configuration.filterForReassignment(context
|
||||
.getTasksOrderedByStartDate());
|
||||
reassign(reattach(withEntities(context.getMapper(), taskToReassign)));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue