Line | |
---|
1 | package com.ether.dao.simulation; |
---|
2 | |
---|
3 | import com.ether.dao.SearchableAbstractHibernateMappingDAO; |
---|
4 | import com.ether.simulation.Dimension; |
---|
5 | import com.ether.simulation.SimulationFilter; |
---|
6 | import org.hibernate.criterion.DetachedCriteria; |
---|
7 | import org.hibernate.criterion.Order; |
---|
8 | import org.jetbrains.annotations.NotNull; |
---|
9 | import org.springframework.util.StringUtils; |
---|
10 | |
---|
11 | /** |
---|
12 | * @author vmipsl |
---|
13 | * @date 03 juillet 2012 |
---|
14 | */ |
---|
15 | public class DimensionDAOImpl |
---|
16 | extends SearchableAbstractHibernateMappingDAO<Dimension, Integer, SimulationFilter> |
---|
17 | implements DimensionDAO |
---|
18 | { |
---|
19 | protected DimensionDAOImpl() |
---|
20 | { |
---|
21 | super( Dimension.class, Integer.class ); |
---|
22 | } |
---|
23 | |
---|
24 | @Override |
---|
25 | protected DetachedCriteria searchCriteria( @NotNull final SimulationFilter filter, final boolean isForCount ) |
---|
26 | { |
---|
27 | final DetachedCriteria criteria = DetachedCriteria.forClass( Dimension.class ); |
---|
28 | |
---|
29 | if( StringUtils.hasText( filter.getSearchText() ) ) |
---|
30 | criteria.add( escapedLike( "name", filter.getSearchText() ) ); |
---|
31 | |
---|
32 | if( !isForCount ) |
---|
33 | criteria.addOrder( Order.asc( filter.getSort() ) ); |
---|
34 | return criteria; |
---|
35 | } |
---|
36 | |
---|
37 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.