Add getCaptionForCriterionsFrom and use it wherever possible

FEA: ItEr60S04ValidacionEProbasFuncionaisItEr59S04
This commit is contained in:
Óscar González Fernández 2010-09-20 01:06:51 +02:00
parent 625e204b69
commit fedfeeaeef
4 changed files with 12 additions and 5 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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());