Add getCaptionForCriterionsFrom and use it wherever possible
FEA: ItEr60S04ValidacionEProbasFuncionaisItEr59S04
This commit is contained in:
parent
625e204b69
commit
fedfeeaeef
4 changed files with 12 additions and 5 deletions
|
|
@ -40,6 +40,7 @@ import org.hibernate.validator.NotNull;
|
|||
import org.hibernate.validator.Valid;
|
||||
import org.navalplanner.business.common.IntegrationEntity;
|
||||
import org.navalplanner.business.common.Registry;
|
||||
import org.navalplanner.business.planner.entities.GenericResourceAllocation;
|
||||
import org.navalplanner.business.requirements.entities.CriterionRequirement;
|
||||
import org.navalplanner.business.resources.daos.ICriterionDAO;
|
||||
|
||||
|
|
@ -116,6 +117,12 @@ public class Criterion extends IntegrationEntity implements ICriterion {
|
|||
return getCaptionFor(ResourceEnum.WORKER, criteria);
|
||||
}
|
||||
|
||||
public static String getCaptionForCriterionsFrom(
|
||||
GenericResourceAllocation allocation) {
|
||||
return getCaptionFor(allocation.getResourceType(),
|
||||
allocation.getCriterions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string of criterion names separated by comma
|
||||
* @param resourceType
|
||||
|
|
|
|||
|
|
@ -232,9 +232,8 @@ public class LimitingResourcesController extends GenericForwardComposer {
|
|||
.getResource();
|
||||
return (resource != null) ? resource.getName() : "";
|
||||
} else if (resourceAllocation instanceof GenericResourceAllocation) {
|
||||
Set<Criterion> criteria = ((GenericResourceAllocation) resourceAllocation)
|
||||
.getCriterions();
|
||||
return Criterion.getCaptionFor(criteria);
|
||||
GenericResourceAllocation genericAllocation = (GenericResourceAllocation) resourceAllocation;
|
||||
return Criterion.getCaptionForCriterionsFrom(genericAllocation);
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@ public class GenericAllocationRow extends AllocationRow {
|
|||
|
||||
result.criterions = resourceAllocation.getCriterions();
|
||||
result.resources = resourceDAO.findSatisfyingAllCriterionsAtSomePoint(result.criterions);
|
||||
result.setName(Criterion.getCaptionFor(result.criterions));
|
||||
result.setName(Criterion
|
||||
.getCaptionForCriterionsFrom(resourceAllocation));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ public class LimitingAllocationRow {
|
|||
final AllocationType type = getAllocationType();
|
||||
if (AllocationType.GENERIC_WORKERS.equals(type)) {
|
||||
final GenericResourceAllocation generic = (GenericResourceAllocation) resourceAllocation;
|
||||
return Criterion.getCaptionFor(generic.getCriterions());
|
||||
return Criterion.getCaptionForCriterionsFrom(generic);
|
||||
}
|
||||
if (AllocationType.SPECIFIC.equals(type)) {
|
||||
return formatResources(resourceAllocation.getAssociatedResources());
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue