ItEr38S08CUAdministracionCategoriaCosteItEr37S12: only active CostCategories appear in the ResourcesCostCategoryAssignment autocomplete box

This commit is contained in:
Jacobo Aragunde Pérez 2009-12-08 21:37:21 +01:00 committed by Javier Moran Rua
parent e6990cadc6
commit 1aba98bde1
3 changed files with 21 additions and 1 deletions

View file

@ -20,6 +20,11 @@
package org.navalplanner.business.costcategories.daos;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.navalplanner.business.common.daos.GenericDAOHibernate;
import org.navalplanner.business.costcategories.entities.CostCategory;
import org.springframework.beans.factory.config.BeanDefinition;
@ -34,4 +39,15 @@ import org.springframework.stereotype.Repository;
public class CostCategoryDAO extends GenericDAOHibernate<CostCategory, Long>
implements ICostCategoryDAO {
@Override
public List<CostCategory> findActive() {
Criteria c = getSession().createCriteria(CostCategory.class);
c.add(Restrictions.eq("enabled", true));
List<CostCategory> list = new ArrayList<CostCategory>();
list.addAll(c.list());
return list;
}
}

View file

@ -20,6 +20,8 @@
package org.navalplanner.business.costcategories.daos;
import java.util.List;
import org.navalplanner.business.common.daos.IGenericDAO;
import org.navalplanner.business.costcategories.entities.CostCategory;
@ -28,4 +30,6 @@ import org.navalplanner.business.costcategories.entities.CostCategory;
*/
public interface ICostCategoryDAO extends IGenericDAO<CostCategory, Long> {
List<CostCategory> findActive();
}

View file

@ -44,7 +44,7 @@ public class CostCategoryFinder extends Finder implements IFinder {
@Transactional(readOnly = true)
public List<CostCategory> getAll() {
return dao.list(CostCategory.class);
return dao.findActive();
}
@Override