ItEr26S07CUAsignacionGrupoRecursosAPlanificacionItEr25S07: Inlining use of EditTaskModel

This commit is contained in:
Óscar González Fernández 2009-09-15 11:07:03 +02:00
parent 780ef88827
commit d2e8aeebec
3 changed files with 1 additions and 55 deletions

View file

@ -21,8 +21,6 @@ import org.zkoss.zul.Intbox;
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class EditTaskController extends GenericForwardComposer {
private IEditTaskModel editTaskModel;
private TaskElement currentTaskElement;
private Intbox hours;
@ -59,7 +57,7 @@ public class EditTaskController extends GenericForwardComposer {
// Sets the value of fields
fixedDuration.setChecked(task.isFixedDuration() == null ? false
: task.isFixedDuration());
duration.setValue(editTaskModel.getDuration(task));
duration.setValue(task.getDaysDuration());
// Disable some fields depending on fixedDuration value
duration.setDisabled(task.isFixedDuration() == null ? true : !task

View file

@ -1,31 +0,0 @@
package org.navalplanner.web.planner;
import org.navalplanner.business.planner.daos.ITaskElementDAO;
import org.navalplanner.business.planner.entities.Task;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* Model for UI operations related to edit {@link Task} popup.
*
* @author Manuel Rego Casasnovas <mrego@igalia.com>
*/
@Service
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class EditTaskModel implements IEditTaskModel {
@Autowired
private ITaskElementDAO taskElementDAO;
@Override
@Transactional(readOnly = true)
public Integer getDuration(Task task) {
taskElementDAO.save(task);
return task.getDaysDuration();
}
}

View file

@ -1,21 +0,0 @@
package org.navalplanner.web.planner;
import org.navalplanner.business.planner.entities.Task;
/**
* Contract for edit {@link Task} popup.
*
* @author Manuel Rego Casasnovas <mrego@igalia.com>
*/
public interface IEditTaskModel {
/**
* Returns the duration of a {@link Task} in number of days.
*
* @param task
* The {@link Task} to get the duration
* @return The days of the {@link Task}
*/
Integer getDuration(Task task);
}