ItEr27S07CUVistaRecursosTempoPorProxectoItEr26S08: Checking there are workers matched by criterion at allocation
This commit is contained in:
parent
7ae8c6b75d
commit
481707ee17
2 changed files with 28 additions and 4 deletions
|
|
@ -212,6 +212,14 @@ class FormBinder {
|
|||
_("at least one no empty allocation is needed"));
|
||||
}
|
||||
|
||||
public void markNoWorkersMatchedByCriterion(GenericAllocationDTO generic) {
|
||||
Decimalbox decimalbox = resourcesPerDayInputsByAllocationDTO
|
||||
.get(generic);
|
||||
throw new WrongValueException(
|
||||
decimalbox,
|
||||
_("there are no workers for required criterions. So the generic allocation can't be done"));
|
||||
}
|
||||
|
||||
public void setAllocationsList(Listbox allocationsList) {
|
||||
this.allocationsList = allocationsList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,10 +120,13 @@ public class ResourceAllocationsBeingEdited {
|
|||
}
|
||||
|
||||
public void checkInvalidValues() {
|
||||
if (thereIsNoEmptyGenericResourceAllocation()
|
||||
&& noWorkersForCriterion()) {
|
||||
formBinder.markNoWorkersMatchedByCriterion(getGenericAllocation());
|
||||
}
|
||||
if (thereIsJustOneEmptyGenericResourceAllocation()) {
|
||||
formBinder
|
||||
.markGenericAllocationMustBeNoZeroOrMoreAllocations(currentAllocations
|
||||
.get(0));
|
||||
.markGenericAllocationMustBeNoZeroOrMoreAllocations(getGenericAllocation());
|
||||
}
|
||||
if (formBinder.getCalculatedValue() != CalculatedValue.NUMBER_OF_HOURS
|
||||
&& formBinder.getAssignedHours() == 0) {
|
||||
|
|
@ -134,6 +137,19 @@ public class ResourceAllocationsBeingEdited {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean noWorkersForCriterion() {
|
||||
return resourcesMatchingCriterions.isEmpty();
|
||||
}
|
||||
|
||||
private boolean thereIsNoEmptyGenericResourceAllocation() {
|
||||
return !getGenericAllocation().isEmptyResourcesPerDay();
|
||||
}
|
||||
|
||||
private GenericAllocationDTO getGenericAllocation() {
|
||||
return (GenericAllocationDTO) currentAllocations
|
||||
.get(0);
|
||||
}
|
||||
|
||||
private boolean thereIsLeastOneNoEmptyAllocation() {
|
||||
for (AllocationDTO allocationDTO : currentAllocations) {
|
||||
if (!allocationDTO.isEmptyResourcesPerDay()) {
|
||||
|
|
@ -145,8 +161,8 @@ public class ResourceAllocationsBeingEdited {
|
|||
|
||||
private boolean thereIsJustOneEmptyGenericResourceAllocation() {
|
||||
return currentAllocations.size() == 1
|
||||
&& currentAllocations.get(0).isGeneric()
|
||||
&& currentAllocations.get(0).isEmptyResourcesPerDay();
|
||||
&& getGenericAllocation().isGeneric()
|
||||
&& getGenericAllocation().isEmptyResourcesPerDay();
|
||||
}
|
||||
|
||||
public AggregateOfResourceAllocations doAllocation() {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue