ItEr27S06CUAsignacionGrupoRecursosAPlanificacionItEr26S07: The task stores now the calculatedValue
This commit is contained in:
parent
0b47d92668
commit
7417453383
5 changed files with 22 additions and 19 deletions
|
|
@ -29,7 +29,7 @@ public class Task extends TaskElement {
|
|||
@NotNull
|
||||
private HoursGroup hoursGroup;
|
||||
|
||||
private Boolean fixedDuration = false;
|
||||
private CalculatedValue calculatedValue = CalculatedValue.END_DATE;
|
||||
|
||||
private Set<ResourceAllocation<?>> resourceAllocations = new HashSet<ResourceAllocation<?>>();
|
||||
|
||||
|
|
@ -89,16 +89,16 @@ public class Task extends TaskElement {
|
|||
resourceAllocations.remove(resourceAllocation);
|
||||
}
|
||||
|
||||
public Boolean getFixedDuration() {
|
||||
return fixedDuration;
|
||||
public CalculatedValue getCalculatedValue() {
|
||||
if (calculatedValue == null) {
|
||||
return CalculatedValue.END_DATE;
|
||||
}
|
||||
return calculatedValue;
|
||||
}
|
||||
|
||||
public void setFixedDuration(boolean fixedDuration) {
|
||||
this.fixedDuration = fixedDuration;
|
||||
}
|
||||
|
||||
public boolean isFixedDuration() {
|
||||
return fixedDuration != null && fixedDuration;
|
||||
public void setCalculatedValue(CalculatedValue calculatedValue) {
|
||||
Validate.notNull(calculatedValue);
|
||||
this.calculatedValue = calculatedValue;
|
||||
}
|
||||
|
||||
public void setDaysDuration(Integer duration) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,11 @@
|
|||
<joined-subclass name="Task">
|
||||
<key column="TASK_ELEMENT_ID"></key>
|
||||
<many-to-one name="hoursGroup" cascade="none"/>
|
||||
<property name="fixedDuration" />
|
||||
<property name="calculatedValue">
|
||||
<type name="org.hibernate.type.EnumType">
|
||||
<param name="enumClass">org.navalplanner.business.planner.entities.CalculatedValue</param>
|
||||
</type>
|
||||
</property>
|
||||
<set name="resourceAllocations" cascade="all-delete-orphan">
|
||||
<key column="TASK" />
|
||||
<one-to-many class="ResourceAllocation" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package org.navalplanner.web.planner;
|
||||
|
||||
import org.navalplanner.business.planner.entities.CalculatedValue;
|
||||
import org.navalplanner.business.planner.entities.Task;
|
||||
import org.navalplanner.business.planner.entities.TaskElement;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
|
|
@ -54,9 +55,10 @@ public class EditTaskController extends GenericForwardComposer {
|
|||
duration.setValue(task.getDaysDuration());
|
||||
|
||||
// Disable some fields depending on fixedDuration value
|
||||
duration.setDisabled(!task.isFixedDuration());
|
||||
((Datebox) hours.getFellow("endDateBox")).setDisabled(!task
|
||||
.isFixedDuration());
|
||||
duration
|
||||
.setDisabled(task.getCalculatedValue() == CalculatedValue.END_DATE);
|
||||
((Datebox) hours.getFellow("endDateBox")).setDisabled(task
|
||||
.getCalculatedValue() == CalculatedValue.END_DATE);
|
||||
} else {
|
||||
// If it's a TaskGroup
|
||||
// Hide fields
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ public class ResourceAllocationModel implements IResourceAllocationModel {
|
|||
task.setDaysDuration(newDaysDuration);
|
||||
ganttTask.setEndDate(task.getEndDate());
|
||||
}
|
||||
task.setCalculatedValue(allocator.getCalculatedValue());
|
||||
}
|
||||
|
||||
private List<Resource> getResourcesMatchingCriterions() {
|
||||
|
|
|
|||
|
|
@ -58,15 +58,10 @@ public class ResourceAllocationsBeingEdited {
|
|||
this.modifyTask = modifyTask;
|
||||
this.currentAllocations = new ArrayList<AllocationDTO>(
|
||||
initialAllocations);
|
||||
this.calculatedValue = getCurrentCalculatedValue(task);
|
||||
this.calculatedValue = task.getCalculatedValue();
|
||||
this.daysDuration = task.getDaysDuration();
|
||||
}
|
||||
|
||||
private CalculatedValue getCurrentCalculatedValue(Task task) {
|
||||
return task.isFixedDuration() ? CalculatedValue.NUMBER_OF_HOURS
|
||||
: CalculatedValue.END_DATE;
|
||||
}
|
||||
|
||||
public void addSpecificResorceAllocationFor(Worker worker) {
|
||||
if (alreadyExistsAllocationFor(worker)) {
|
||||
throw new IllegalArgumentException(_(
|
||||
|
|
@ -193,6 +188,7 @@ public class ResourceAllocationsBeingEdited {
|
|||
task, currentAllocations,
|
||||
resourceDAO, resourcesMatchingCriterions, true);
|
||||
result.formBinder = this.formBinder;
|
||||
result.calculatedValue = this.calculatedValue;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue