[Bug #812] sorts the combo of multiple search in allocation pop-up.

it places the criteria and then virtual workers, workers
and machines and, it sorts each set by name.

FEA : ItEr68S04BugFixing
This commit is contained in:
Susana Montes Pedreira 2011-01-17 12:58:23 +01:00
parent 23fd066194
commit 1a8d6534c9
3 changed files with 24 additions and 11 deletions

View file

@ -29,7 +29,6 @@ import java.util.concurrent.Callable;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.joda.time.LocalDate;
import org.navalplanner.business.advance.entities.DirectAdvanceAssignment;
import org.navalplanner.business.calendars.entities.CalendarAvailability;
@ -244,10 +243,12 @@ public class PredefinedDatabaseSnapshots {
public Map<CriterionType, List<Criterion>> call() throws Exception {
Map<CriterionType, List<Criterion>> result = new HashMap<CriterionType, List<Criterion>>();
for (CriterionType criterionType : criterionTypeDAO
.getCriterionTypes()) {
List<Criterion> criterions = new ArrayList<Criterion>(
criterionDAO.findByType(criterionType));
result.put(criterionType, criterions);
.getSortedCriterionTypes()) {
if (criterionType.isEnabled()) {
List<Criterion> criterions = criterionType
.getSortCriterions();
result.put(criterionType, criterions);
}
}
return result;
}
@ -318,17 +319,21 @@ public class PredefinedDatabaseSnapshots {
@Override
public Map<Class<?>, List<Resource>> call() throws Exception {
Map<Class<?>, List<Resource>> result = new HashMap<Class<?>, List<Resource>>();
result.put(Worker.class,
new ArrayList<Resource>(resourceDAO.getRealWorkers()));
result.put(Machine.class,
new ArrayList<Resource>(resourceDAO.getMachines()));
result.put(VirtualWorker.class, new ArrayList<Resource>(
resourceDAO.getVirtualWorkers()));
result.put(Worker.class, Resource
.sortByName(new ArrayList<Resource>(resourceDAO
.getRealWorkers())));
result.put(Machine.class, Resource
.sortByName(new ArrayList<Resource>(resourceDAO
.getMachines())));
result.put(VirtualWorker.class, Resource
.sortByName(new ArrayList<Resource>(resourceDAO
.getVirtualWorkers())));
return result;
}
};
}
@Autowired
private IExternalCompanyDAO externalCompanyDAO;

View file

@ -190,6 +190,12 @@ public class CriterionTypeDAO extends IntegrationEntityDAO<CriterionType>
return list(CriterionType.class);
}
@Override
public List<CriterionType> getSortedCriterionTypes() {
return getSession().createCriteria(CriterionType.class).addOrder(
Order.asc("name")).list();
}
@SuppressWarnings("unchecked")
@Override
public List<CriterionType> getCriterionTypesByResources(

View file

@ -62,6 +62,8 @@ public interface ICriterionTypeDAO
List<CriterionType> getCriterionTypesByResources(
Collection<ResourceEnum> resources);
List<CriterionType> getSortedCriterionTypes();
/**
* Checks if exists the equivalent {@link CriterionType} on the DB for a
* {@link CriterionType} created from a {@link PredefinedCriterionTypes}