Use IResourcesSearcher for searching resources associated with

criterions

FEA: ItEr74S04BugFixing
This commit is contained in:
Óscar González Fernández 2011-04-11 19:19:20 +02:00
parent 4fb1783673
commit 1744c8df90
16 changed files with 104 additions and 88 deletions

View file

@ -38,7 +38,7 @@ import org.navalplanner.business.calendars.entities.ICalendar;
import org.navalplanner.business.planner.entities.EffortDistributor.IResourceSelector;
import org.navalplanner.business.planner.entities.EffortDistributor.ResourceWithAssignedDuration;
import org.navalplanner.business.planner.entities.allocationalgorithms.ResourcesPerDayModification;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.resources.entities.Criterion;
import org.navalplanner.business.resources.entities.CriterionCompounder;
import org.navalplanner.business.resources.entities.ICriterion;
@ -291,8 +291,10 @@ public class GenericResourceAllocation extends
}
@Override
public List<Resource> querySuitableResources(IResourceDAO resourceDAO) {
return resourceDAO.findSatisfyingAllCriterionsAtSomePoint(getCriterions());
public List<Resource> querySuitableResources(
IResourcesSearcher resourcesSearcher) {
return resourcesSearcher.searchBoth().byCriteria(getCriterions())
.execute();
}
public static Map<Criterion, List<GenericResourceAllocation>> byCriterion(

View file

@ -59,7 +59,7 @@ import org.navalplanner.business.planner.entities.allocationalgorithms.HoursModi
import org.navalplanner.business.planner.entities.allocationalgorithms.ResourcesPerDayModification;
import org.navalplanner.business.planner.entities.allocationalgorithms.UntilFillingHoursAllocator;
import org.navalplanner.business.planner.limiting.entities.LimitingResourceQueueElement;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.resources.entities.ICriterion;
import org.navalplanner.business.resources.entities.Machine;
import org.navalplanner.business.resources.entities.MachineWorkersConfigurationUnit;
@ -1870,7 +1870,8 @@ public abstract class ResourceAllocation<T extends DayAssignment> extends
* that currently match this allocation criterions
* @return a list of resources that are proper for this allocation
*/
public abstract List<Resource> querySuitableResources(IResourceDAO resourceDAO);
public abstract List<Resource> querySuitableResources(
IResourcesSearcher resourceSearcher);
public abstract void makeAssignmentsContainersDontPoseAsTransientAnyMore();

View file

@ -42,7 +42,7 @@ import org.navalplanner.business.calendars.entities.ICalendar;
import org.navalplanner.business.common.ProportionalDistributor;
import org.navalplanner.business.planner.entities.allocationalgorithms.ResourcesPerDayModification;
import org.navalplanner.business.planner.limiting.entities.LimitingResourceQueueElement;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.resources.entities.ICriterion;
import org.navalplanner.business.resources.entities.Resource;
import org.navalplanner.business.resources.entities.Worker;
@ -249,7 +249,8 @@ public class SpecificResourceAllocation extends
}
@Override
public List<Resource> querySuitableResources(IResourceDAO resourceDAO) {
public List<Resource> querySuitableResources(
IResourcesSearcher resourcesSearcher) {
return Collections.singletonList(resource);
}

View file

@ -53,7 +53,7 @@ import org.navalplanner.business.planner.entities.allocationalgorithms.HoursModi
import org.navalplanner.business.planner.entities.allocationalgorithms.ResourcesPerDayModification;
import org.navalplanner.business.planner.entities.consolidations.Consolidation;
import org.navalplanner.business.planner.limiting.entities.LimitingResourceQueueElement;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.resources.entities.Criterion;
import org.navalplanner.business.resources.entities.Resource;
import org.navalplanner.business.resources.entities.Worker;
@ -467,11 +467,11 @@ public class Task extends TaskElement implements ITaskPositionConstrained {
private static abstract class AllocationModificationStrategy {
protected final IResourceDAO resourceDAO;
protected final IResourcesSearcher searcher;
public AllocationModificationStrategy(IResourceDAO resourceDAO) {
Validate.notNull(resourceDAO);
this.resourceDAO = resourceDAO;
public AllocationModificationStrategy(IResourcesSearcher searcher) {
Validate.notNull(searcher);
this.searcher = searcher;
}
public abstract ModificationsResult<ResourcesPerDayModification> getResourcesPerDayModified(
@ -485,15 +485,15 @@ public class Task extends TaskElement implements ITaskPositionConstrained {
private static class WithTheSameHoursAndResourcesPerDay extends
AllocationModificationStrategy {
public WithTheSameHoursAndResourcesPerDay(IResourceDAO resourceDAO) {
super(resourceDAO);
public WithTheSameHoursAndResourcesPerDay(IResourcesSearcher searcher) {
super(searcher);
}
@Override
public ModificationsResult<HoursModification> getHoursModified(
List<ResourceAllocation<?>> allocations) {
List<HoursModification> canBeModified = HoursModification
.fromExistent(allocations, resourceDAO);
.fromExistent(allocations, searcher);
return ModificationsResult.create(allocations, canBeModified);
}
@ -501,7 +501,7 @@ public class Task extends TaskElement implements ITaskPositionConstrained {
public ModificationsResult<ResourcesPerDayModification> getResourcesPerDayModified(
List<ResourceAllocation<?>> allocations) {
List<ResourcesPerDayModification> canBeModified = ResourcesPerDayModification
.fromExistent(allocations, resourceDAO);
.fromExistent(allocations, searcher);
return ModificationsResult.create(allocations, canBeModified);
}
@ -510,15 +510,15 @@ public class Task extends TaskElement implements ITaskPositionConstrained {
private static class WithAnotherResources extends
AllocationModificationStrategy {
public WithAnotherResources(IResourceDAO resourceDAO) {
super(resourceDAO);
public WithAnotherResources(IResourcesSearcher searcher) {
super(searcher);
}
@Override
public ModificationsResult<HoursModification> getHoursModified(
List<ResourceAllocation<?>> allocations) {
List<HoursModification> canBeModified = HoursModification
.withNewResources(allocations, resourceDAO);
.withNewResources(allocations, searcher);
return ModificationsResult.create(allocations, canBeModified);
}
@ -526,7 +526,7 @@ public class Task extends TaskElement implements ITaskPositionConstrained {
public ModificationsResult<ResourcesPerDayModification> getResourcesPerDayModified(
List<ResourceAllocation<?>> allocations) {
List<ResourcesPerDayModification> canBeModified = ResourcesPerDayModification
.withNewResources(allocations, resourceDAO);
.withNewResources(allocations, searcher);
return ModificationsResult.create(allocations, canBeModified);
}
}
@ -539,7 +539,7 @@ public class Task extends TaskElement implements ITaskPositionConstrained {
@Override
protected IDatesHandler createDatesHandler(final Scenario scenario,
final IResourceDAO resourceDAO) {
final IResourcesSearcher searcher) {
return new IDatesHandler() {
@Override
@ -555,7 +555,7 @@ public class Task extends TaskElement implements ITaskPositionConstrained {
private void doReassignment(Direction direction) {
reassign(scenario, direction,
new WithTheSameHoursAndResourcesPerDay(resourceDAO));
new WithTheSameHoursAndResourcesPerDay(searcher));
}
@Override
@ -752,9 +752,9 @@ public class Task extends TaskElement implements ITaskPositionConstrained {
}
public void reassignAllocationsWithNewResources(Scenario scenario,
IResourceDAO resourceDAO) {
reassign(scenario, getAllocationDirection(),
new WithAnotherResources(resourceDAO));
IResourcesSearcher searcher) {
reassign(scenario, getAllocationDirection(), new WithAnotherResources(
searcher));
}
private void reassign(Scenario onScenario, Direction direction,

View file

@ -47,7 +47,7 @@ import org.navalplanner.business.orders.entities.Order;
import org.navalplanner.business.orders.entities.OrderElement;
import org.navalplanner.business.orders.entities.TaskSource;
import org.navalplanner.business.planner.entities.Dependency.Type;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.scenarios.entities.Scenario;
import org.navalplanner.business.util.deepcopy.OnCopy;
import org.navalplanner.business.util.deepcopy.Strategy;
@ -307,8 +307,8 @@ public abstract class TaskElement extends BaseEntity {
}
public IDatesHandler getDatesHandler(Scenario scenario,
IResourceDAO resourceDAO) {
return noNullDates(createDatesHandler(scenario, resourceDAO));
IResourcesSearcher resourcesSearcher) {
return noNullDates(createDatesHandler(scenario, resourcesSearcher));
}
private IDatesHandler noNullDates(final IDatesHandler decorated) {
@ -334,7 +334,8 @@ public abstract class TaskElement extends BaseEntity {
};
}
protected abstract IDatesHandler createDatesHandler(Scenario scenario, IResourceDAO resourceDAO);
protected abstract IDatesHandler createDatesHandler(Scenario scenario,
IResourcesSearcher resourcesSearcher);
public interface IDatesHandler {

View file

@ -34,7 +34,7 @@ import org.hibernate.validator.AssertTrue;
import org.hibernate.validator.Valid;
import org.navalplanner.business.common.entities.ProgressType;
import org.navalplanner.business.orders.entities.TaskSource;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.scenarios.entities.Scenario;
import org.navalplanner.business.workingday.IntraDayDate;
@ -137,7 +137,8 @@ public class TaskGroup extends TaskElement {
}
@Override
protected IDatesHandler createDatesHandler(Scenario scenario, IResourceDAO resourceDAO) {
protected IDatesHandler createDatesHandler(Scenario scenario,
IResourcesSearcher resourcesSearcher) {
return new IDatesHandler() {
@Override

View file

@ -31,7 +31,7 @@ import org.hibernate.validator.AssertTrue;
import org.joda.time.DateTime;
import org.joda.time.Days;
import org.joda.time.LocalDate;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.scenarios.entities.Scenario;
import org.navalplanner.business.workingday.IntraDayDate;
@ -119,7 +119,8 @@ public class TaskMilestone extends TaskElement implements ITaskPositionConstrain
}
@Override
protected IDatesHandler createDatesHandler(Scenario scenario, IResourceDAO resourceDAO) {
protected IDatesHandler createDatesHandler(Scenario scenario,
IResourcesSearcher searcher) {
return new IDatesHandler() {
@Override

View file

@ -26,7 +26,7 @@ import java.util.Collections;
import java.util.List;
import org.navalplanner.business.planner.entities.ResourceAllocation;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.resources.entities.Resource;
/**
@ -50,11 +50,11 @@ public abstract class AllocationModification {
* unsatisfied generic allocation.
*/
protected static <T extends AllocationModification> List<T> ensureNoOneWithoutAssociatedResources(
Collection<? extends T> modifications, IResourceDAO resourceDAO) {
Collection<? extends T> modifications, IResourcesSearcher searcher) {
List<T> result = new ArrayList<T>();
for (T each : modifications) {
if (each.hasNoResources()) {
each.withNewResources(resourceDAO);
each.withNewResources(searcher);
}
if (!each.hasNoResources()) {
result.add(each);
@ -77,9 +77,9 @@ public abstract class AllocationModification {
return resourcesOnWhichApplyAllocation.isEmpty();
}
protected void withNewResources(IResourceDAO resourceDAO) {
protected void withNewResources(IResourcesSearcher resourcesSearcher) {
resourcesOnWhichApplyAllocation = beingModified
.querySuitableResources(resourceDAO);
.querySuitableResources(resourcesSearcher);
}
public ResourceAllocation<?> getBeingModified() {

View file

@ -30,7 +30,7 @@ import org.joda.time.LocalDate;
import org.navalplanner.business.planner.entities.GenericResourceAllocation;
import org.navalplanner.business.planner.entities.ResourceAllocation;
import org.navalplanner.business.planner.entities.SpecificResourceAllocation;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.resources.entities.Resource;
/**
@ -101,21 +101,21 @@ public abstract class HoursModification extends AllocationModification {
public static List<HoursModification> fromExistent(
Collection<? extends ResourceAllocation<?>> allocations,
IResourceDAO resourceDAO) {
IResourcesSearcher searcher) {
List<HoursModification> result = new ArrayList<HoursModification>();
for (ResourceAllocation<?> resourceAllocation : allocations) {
result.add(resourceAllocation.asHoursModification());
}
return ensureNoOneWithoutAssociatedResources(result, resourceDAO);
return ensureNoOneWithoutAssociatedResources(result, searcher);
}
public static List<HoursModification> withNewResources(
List<ResourceAllocation<?>> allocations, IResourceDAO resourceDAO) {
List<HoursModification> result = fromExistent(allocations, resourceDAO);
List<ResourceAllocation<?>> allocations, IResourcesSearcher searcher) {
List<HoursModification> result = fromExistent(allocations, searcher);
for (HoursModification each : result) {
each.withNewResources(resourceDAO);
each.withNewResources(searcher);
}
return ensureNoOneWithoutAssociatedResources(result, resourceDAO);
return ensureNoOneWithoutAssociatedResources(result, searcher);
}
private final int hours;

View file

@ -43,7 +43,7 @@ import org.navalplanner.business.planner.entities.ResourceAllocation;
import org.navalplanner.business.planner.entities.ResourceAllocation.IEffortDistributor;
import org.navalplanner.business.planner.entities.SpecificResourceAllocation;
import org.navalplanner.business.planner.entities.allocationalgorithms.UntilFillingHoursAllocator.IAssignmentsCreator;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.resources.entities.Criterion;
import org.navalplanner.business.resources.entities.Resource;
import org.navalplanner.business.workingday.EffortDuration;
@ -205,13 +205,14 @@ public abstract class ResourcesPerDayModification extends
}
public static List<ResourcesPerDayModification> withNewResources(
List<ResourceAllocation<?>> allocations, IResourceDAO resourceDAO) {
List<ResourceAllocation<?>> allocations,
IResourcesSearcher resourcesSearcher) {
List<ResourcesPerDayModification> result = fromExistent(allocations,
resourceDAO);
resourcesSearcher);
for (ResourcesPerDayModification each : result) {
each.withNewResources(resourceDAO);
each.withNewResources(resourcesSearcher);
}
return ensureNoOneWithoutAssociatedResources(result, resourceDAO);
return ensureNoOneWithoutAssociatedResources(result, resourcesSearcher);
}
public static ResourcesPerDayModification create(
@ -225,7 +226,7 @@ public abstract class ResourcesPerDayModification extends
public static List<ResourcesPerDayModification> fromExistent(
Collection<? extends ResourceAllocation<?>> allocations,
IResourceDAO resourcesDAO) {
IResourcesSearcher resourcesSearcher) {
List<ResourcesPerDayModification> result = new ArrayList<ResourcesPerDayModification>();
for (ResourceAllocation<?> resourceAllocation : allocations) {
ResourcesPerDayModification modification = resourceAllocation
@ -234,7 +235,7 @@ public abstract class ResourcesPerDayModification extends
result.add(modification);
}
}
return ensureNoOneWithoutAssociatedResources(result, resourcesDAO);
return ensureNoOneWithoutAssociatedResources(result, resourcesSearcher);
}
protected static ICalendar calendarFor(Resource associatedResource) {

View file

@ -27,8 +27,8 @@ import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.lang.Validate;
import org.joda.time.LocalDate;
@ -42,10 +42,10 @@ import org.navalplanner.business.orders.entities.Order;
import org.navalplanner.business.orders.entities.TaskSource;
import org.navalplanner.business.planner.daos.ITaskSourceDAO;
import org.navalplanner.business.planner.entities.Dependency;
import org.navalplanner.business.planner.entities.Dependency.Type;
import org.navalplanner.business.planner.entities.Task;
import org.navalplanner.business.planner.entities.TaskElement;
import org.navalplanner.business.planner.entities.Dependency.Type;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.scenarios.daos.IOrderVersionDAO;
import org.navalplanner.business.scenarios.daos.IScenarioDAO;
import org.navalplanner.business.scenarios.entities.OrderVersion;
@ -63,11 +63,11 @@ import org.springframework.transaction.annotation.Transactional;
import org.zkoss.ganttz.adapters.PlannerConfiguration;
import org.zkoss.ganttz.data.ConstraintCalculator;
import org.zkoss.ganttz.data.DependencyType;
import org.zkoss.ganttz.data.DependencyType.Point;
import org.zkoss.ganttz.data.GanttDate;
import org.zkoss.ganttz.data.GanttDiagramGraph;
import org.zkoss.ganttz.data.IDependency;
import org.zkoss.ganttz.data.DependencyType.Point;
import org.zkoss.ganttz.data.GanttDiagramGraph.IAdapter;
import org.zkoss.ganttz.data.IDependency;
import org.zkoss.ganttz.data.constraint.Constraint;
import org.zkoss.ganttz.util.LongOperationFeedback;
import org.zkoss.ganttz.util.LongOperationFeedback.IBackGroundOperation;
@ -177,7 +177,7 @@ public class TemplateModel implements ITemplateModel {
private IUserDAO userDAO;
@Autowired
private IResourceDAO resourceDAO;
private IResourcesSearcher resourcesSearcher;
@Autowired
private IAdHocTransactionService transactionService;
@ -370,7 +370,7 @@ public class TemplateModel implements ITemplateModel {
copyAssignments(order, from, to);
installDependenciesEnforcer(order, TemplateModelAdapter.create(to,
asLocalDate(order.getInitDate()),
asLocalDate(order.getDeadline()), resourceDAO));
asLocalDate(order.getDeadline()), resourcesSearcher));
doReassignations(order, to);
doTheSaving(order);
}
@ -420,7 +420,8 @@ public class TemplateModel implements ITemplateModel {
private void doReassignations(Order order, Scenario scenario) {
for (Task each : getTasksFrom(order)) {
each.reassignAllocationsWithNewResources(scenario, resourceDAO);
each.reassignAllocationsWithNewResources(scenario,
resourcesSearcher);
}
}

View file

@ -30,7 +30,7 @@ import org.joda.time.LocalDate;
import org.navalplanner.business.planner.entities.TaskElement;
import org.navalplanner.business.planner.entities.TaskElement.IDatesHandler;
import org.navalplanner.business.planner.entities.TaskElement.IDatesInterceptor;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.scenarios.entities.Scenario;
import org.navalplanner.business.workingday.IntraDayDate;
import org.navalplanner.web.common.TemplateModel.DependencyWithVisibility;
@ -58,22 +58,23 @@ public class TemplateModelAdapter implements
private final LocalDate deadline;
private final IResourceDAO resourceDAO;
private final IResourcesSearcher resourcesSearcher;
public static TemplateModelAdapter create(Scenario scenario,
LocalDate initDate, LocalDate deadline, IResourceDAO resourceDAO) {
LocalDate initDate, LocalDate deadline,
IResourcesSearcher resourcesSearcher) {
return new TemplateModelAdapter(scenario, initDate, deadline,
resourceDAO);
resourcesSearcher);
}
private TemplateModelAdapter(Scenario scenario, LocalDate orderInitDate,
LocalDate deadline, IResourceDAO resourceDAO) {
LocalDate deadline, IResourcesSearcher resoucesSearcher) {
Validate.notNull(scenario);
Validate.notNull(resourceDAO);
Validate.notNull(resoucesSearcher);
this.scenario = scenario;
this.orderInitDate = orderInitDate;
this.deadline = deadline;
this.resourceDAO = resourceDAO;
this.resourcesSearcher = resoucesSearcher;
}
@Override
@ -168,7 +169,7 @@ public class TemplateModelAdapter implements
}
private IDatesHandler getDatesHandler(TaskElement taskElement) {
return taskElement.getDatesHandler(scenario, resourceDAO);
return taskElement.getDatesHandler(scenario, resourcesSearcher);
}
@Override

View file

@ -40,8 +40,8 @@ import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.Validate;
@ -65,20 +65,20 @@ import org.navalplanner.business.orders.entities.OrderStatusEnum;
import org.navalplanner.business.planner.daos.IResourceAllocationDAO;
import org.navalplanner.business.planner.daos.ITaskElementDAO;
import org.navalplanner.business.planner.entities.Dependency;
import org.navalplanner.business.planner.entities.Dependency.Type;
import org.navalplanner.business.planner.entities.GenericResourceAllocation;
import org.navalplanner.business.planner.entities.ITaskPositionConstrained;
import org.navalplanner.business.planner.entities.PositionConstraintType;
import org.navalplanner.business.planner.entities.ResourceAllocation;
import org.navalplanner.business.planner.entities.ResourceAllocation.Direction;
import org.navalplanner.business.planner.entities.SpecificResourceAllocation;
import org.navalplanner.business.planner.entities.Task;
import org.navalplanner.business.planner.entities.TaskElement;
import org.navalplanner.business.planner.entities.TaskElement.IDatesHandler;
import org.navalplanner.business.planner.entities.TaskGroup;
import org.navalplanner.business.planner.entities.TaskPositionConstraint;
import org.navalplanner.business.planner.entities.Dependency.Type;
import org.navalplanner.business.planner.entities.ResourceAllocation.Direction;
import org.navalplanner.business.planner.entities.TaskElement.IDatesHandler;
import org.navalplanner.business.resources.daos.ICriterionDAO;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.resources.entities.Criterion;
import org.navalplanner.business.resources.entities.Resource;
import org.navalplanner.business.scenarios.entities.Scenario;
@ -93,10 +93,10 @@ import org.zkoss.ganttz.IDatesMapper;
import org.zkoss.ganttz.adapters.DomainDependency;
import org.zkoss.ganttz.data.DependencyType;
import org.zkoss.ganttz.data.GanttDate;
import org.zkoss.ganttz.data.ITaskFundamentalProperties;
import org.zkoss.ganttz.data.GanttDate.Cases;
import org.zkoss.ganttz.data.GanttDate.CustomDate;
import org.zkoss.ganttz.data.GanttDate.LocalDateBased;
import org.zkoss.ganttz.data.ITaskFundamentalProperties;
import org.zkoss.ganttz.data.constraint.Constraint;
/**
* Responsible of adaptating a {@link TaskElement} into a
@ -183,7 +183,7 @@ public class TaskElementAdapter implements ITaskElementAdapter {
private IResourceAllocationDAO resourceAllocationDAO;
@Autowired
private IResourceDAO resourceDAO;
private IResourcesSearcher searcher;
@Autowired
private IConfigurationDAO configurationDAO;
@ -443,7 +443,7 @@ public class TaskElementAdapter implements ITaskElementAdapter {
}
IDatesHandler getDatesHandler(TaskElement taskElement) {
return taskElement.getDatesHandler(currentScenario, resourceDAO);
return taskElement.getDatesHandler(currentScenario, searcher);
}
private void updateTaskPositionConstraint(GanttDate endDate) {

View file

@ -36,7 +36,7 @@ import org.navalplanner.business.planner.entities.GenericResourceAllocation;
import org.navalplanner.business.planner.entities.ResourceAllocation;
import org.navalplanner.business.planner.entities.TaskElement;
import org.navalplanner.business.resources.daos.ICriterionTypeDAO;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.resources.entities.Criterion;
import org.navalplanner.business.resources.entities.CriterionType;
import org.navalplanner.web.planner.order.PlanningState;
@ -71,7 +71,7 @@ public class ReassignCommand implements IReassignCommand {
private IAdHocTransactionService transactionService;
@Autowired
private IResourceDAO resourceDAO;
private IResourcesSearcher resourcesSearcher;
@Autowired
private ITaskElementDAO taskElementDAO;
@ -286,7 +286,8 @@ public class ReassignCommand implements IReassignCommand {
private void reassign(TaskElement taskElement) {
org.navalplanner.business.planner.entities.Task t = (org.navalplanner.business.planner.entities.Task) taskElement;
t.reassignAllocationsWithNewResources(planningState.getCurrentScenario(), resourceDAO);
t.reassignAllocationsWithNewResources(
planningState.getCurrentScenario(), resourcesSearcher);
}
@Override

View file

@ -51,7 +51,7 @@ import org.navalplanner.business.orders.entities.TaskSource;
import org.navalplanner.business.planner.daos.ITaskElementDAO;
import org.navalplanner.business.planner.entities.Dependency;
import org.navalplanner.business.planner.entities.TaskElement;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.scenarios.IScenarioManager;
import org.navalplanner.business.scenarios.entities.Scenario;
import org.navalplanner.web.common.TemplateModel.DependencyWithVisibility;
@ -81,10 +81,11 @@ public class MonteCarloTabCreator {
public static ITab create(Mode mode,
MonteCarloController monteCarloController,
OrderPlanningController orderPlanningController,
Component breadcrumbs, IResourceDAO resourceDAO) {
Component breadcrumbs, IResourcesSearcher resourcesSearcher) {
return new MonteCarloTabCreator(mode, monteCarloController,
orderPlanningController, breadcrumbs, resourceDAO).build();
orderPlanningController, breadcrumbs, resourcesSearcher)
.build();
}
private final Mode mode;
@ -95,18 +96,18 @@ public class MonteCarloTabCreator {
private final Component breadcrumbs;
private final IResourceDAO resourceDAO;
private final IResourcesSearcher resourcesSearcher;
private MonteCarloTabCreator(Mode mode,
MonteCarloController MonteCarloController,
OrderPlanningController orderPlanningController,
Component breadcrumbs, IResourceDAO resourceDAO) {
Validate.notNull(resourceDAO);
Component breadcrumbs, IResourcesSearcher resourcesSearcher) {
Validate.notNull(resourcesSearcher);
this.mode = mode;
this.monteCarloController = MonteCarloController;
this.orderPlanningController = orderPlanningController;
this.breadcrumbs = breadcrumbs;
this.resourceDAO = resourceDAO;
this.resourcesSearcher = resourcesSearcher;
}
private ITab build() {
@ -282,7 +283,7 @@ public class MonteCarloTabCreator {
.create(getCurrentScenario(),
asLocalDate(order.getInitDate()),
asLocalDate(order.getDeadline()),
resourceDAO);
resourcesSearcher);
GanttDiagramGraph<TaskElement, DependencyWithVisibility> graph = createFor(
order, adapter);
graph.addTasks(order.getAllChildrenAssociatedTaskElements());

View file

@ -33,6 +33,7 @@ import org.navalplanner.business.orders.entities.OrderElement;
import org.navalplanner.business.planner.daos.ITaskElementDAO;
import org.navalplanner.business.planner.entities.TaskElement;
import org.navalplanner.business.resources.daos.IResourceDAO;
import org.navalplanner.business.resources.daos.IResourcesSearcher;
import org.navalplanner.business.scenarios.IScenarioManager;
import org.navalplanner.business.templates.entities.OrderTemplate;
import org.navalplanner.web.common.entrypoints.URLHandler;
@ -185,6 +186,9 @@ public class MultipleTabsPlannerController implements Composer,
@Autowired
private IResourceDAO resourceDAO;
@Autowired
private IResourcesSearcher resourcesSearcher;
@Autowired
private IConfigurationDAO configurationDAO;
@ -257,7 +261,7 @@ public class MultipleTabsPlannerController implements Composer,
if (isMontecarloVisible) {
monteCarloTab = MonteCarloTabCreator.create(mode,
monteCarloController, orderPlanningController, breadcrumbs,
resourceDAO);
resourcesSearcher);
}
final State<Void> typeChanged = typeChangedState();