Make TaskElementAdapter a singleton
FEA: ItEr75S11PreventLooseChanges
This commit is contained in:
parent
f2fb4ff8f7
commit
4d79e2d212
5 changed files with 745 additions and 768 deletions
|
|
@ -56,7 +56,7 @@ import org.springframework.context.annotation.Scope;
|
|||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
|
||||
@Scope(BeanDefinition.SCOPE_SINGLETON)
|
||||
/**
|
||||
* @author Diego Pino Garcia <dpino@igalia.com>
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* This file is part of NavalPlan
|
||||
*
|
||||
* Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
|
||||
* Desenvolvemento Tecnolóxico de Galicia
|
||||
* Copyright (C) 2010-2011 Igalia, S.L.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.navalplanner.web.planner;
|
||||
|
||||
import org.joda.time.LocalDate;
|
||||
import org.navalplanner.business.planner.entities.TaskElement;
|
||||
import org.navalplanner.business.scenarios.entities.Scenario;
|
||||
import org.zkoss.ganttz.adapters.IAdapterToTaskFundamentalProperties;
|
||||
|
||||
/**
|
||||
* Contract for {@link TaskElementAdapter} <br />
|
||||
* @author Óscar González Fernández <ogonzalez@igalia.com>
|
||||
*/
|
||||
public interface ITaskElementAdapter extends IAdapterToTaskFundamentalProperties<TaskElement>{
|
||||
|
||||
void useScenario(Scenario scenario);
|
||||
|
||||
void setInitDate(LocalDate initDate);
|
||||
|
||||
void setDeadline(LocalDate deadline);
|
||||
|
||||
void setPreventCalculateResourcesText(boolean preventCalculateResourcesText);
|
||||
|
||||
boolean isPreventCalculateResourcesText();
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -68,7 +68,7 @@ import org.navalplanner.business.users.entities.UserRole;
|
|||
import org.navalplanner.business.workreports.entities.WorkReportLine;
|
||||
import org.navalplanner.web.orders.assigntemplates.TemplateFinderPopup;
|
||||
import org.navalplanner.web.orders.assigntemplates.TemplateFinderPopup.IOnResult;
|
||||
import org.navalplanner.web.planner.ITaskElementAdapter;
|
||||
import org.navalplanner.web.planner.TaskElementAdapter;
|
||||
import org.navalplanner.web.planner.chart.Chart;
|
||||
import org.navalplanner.web.planner.chart.EarnedValueChartFiller;
|
||||
import org.navalplanner.web.planner.chart.EarnedValueChartFiller.EarnedValueType;
|
||||
|
|
@ -155,7 +155,7 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
|
|||
private IScenarioManager scenarioManager;
|
||||
|
||||
@Autowired
|
||||
private ITaskElementAdapter taskElementAdapter;
|
||||
private TaskElementAdapter taskElementAdapterCreator;
|
||||
|
||||
private Scenario currentScenario;
|
||||
|
||||
|
|
@ -729,13 +729,9 @@ public class CompanyPlanningModel implements ICompanyPlanningModel {
|
|||
|
||||
private PlannerConfiguration<TaskElement> createConfiguration(
|
||||
IPredicate predicate) {
|
||||
taskElementAdapter.setPreventCalculateResourcesText(true);
|
||||
taskElementAdapter.useScenario(currentScenario);
|
||||
List<TaskElement> toShow;
|
||||
toShow = retainOnlyTopLevel(predicate);
|
||||
|
||||
return new PlannerConfiguration<TaskElement>(taskElementAdapter,
|
||||
new TaskElementNavigator(), toShow);
|
||||
return new PlannerConfiguration<TaskElement>(
|
||||
taskElementAdapterCreator.createForCompany(currentScenario),
|
||||
new TaskElementNavigator(), retainOnlyTopLevel(predicate));
|
||||
}
|
||||
|
||||
private List<TaskElement> retainOnlyTopLevel(IPredicate predicate) {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ import org.navalplanner.business.users.entities.UserRole;
|
|||
import org.navalplanner.business.workingday.EffortDuration;
|
||||
import org.navalplanner.web.calendars.BaseCalendarModel;
|
||||
import org.navalplanner.web.common.ViewSwitcher;
|
||||
import org.navalplanner.web.planner.ITaskElementAdapter;
|
||||
import org.navalplanner.web.planner.TaskElementAdapter;
|
||||
import org.navalplanner.web.planner.advances.AdvanceAssignmentPlanningController;
|
||||
import org.navalplanner.web.planner.advances.IAdvanceAssignmentPlanningCommand;
|
||||
import org.navalplanner.web.planner.allocation.IResourceAllocationCommand;
|
||||
|
|
@ -255,7 +255,7 @@ public class OrderPlanningModel implements IOrderPlanningModel {
|
|||
private List<IZoomLevelChangedListener> keepAliveZoomListeners = new ArrayList<IZoomLevelChangedListener>();
|
||||
|
||||
@Autowired
|
||||
private ITaskElementAdapter taskElementAdapter;
|
||||
private TaskElementAdapter taskElementAdapterCreator;
|
||||
|
||||
@Autowired
|
||||
private ICostCalculator hoursCostCalculator;
|
||||
|
|
@ -1091,11 +1091,9 @@ public class OrderPlanningModel implements IOrderPlanningModel {
|
|||
}
|
||||
|
||||
private PlannerConfiguration<TaskElement> createConfiguration(Order order) {
|
||||
taskElementAdapter.useScenario(currentScenario);
|
||||
taskElementAdapter.setInitDate(asLocalDate(order.getInitDate()));
|
||||
taskElementAdapter.setDeadline(asLocalDate(order.getDeadline()));
|
||||
PlannerConfiguration<TaskElement> result = new PlannerConfiguration<TaskElement>(
|
||||
taskElementAdapter,
|
||||
taskElementAdapterCreator
|
||||
.createForOrder(currentScenario, order),
|
||||
new TaskElementNavigator(), planningState.getInitial());
|
||||
result.setNotBeforeThan(order.getInitDate());
|
||||
result.setNotAfterThan(order.getDeadline());
|
||||
|
|
@ -1105,10 +1103,6 @@ public class OrderPlanningModel implements IOrderPlanningModel {
|
|||
return result;
|
||||
}
|
||||
|
||||
private LocalDate asLocalDate(Date date) {
|
||||
return date != null ? LocalDate.fromDateFields(date) : null;
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private PlanningStateCreator planningStateCreator;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue