source: geisa/persistence/implementation/com/ether/dao/IsotopeIasiG03DAOImpl.java @ 542

Last change on this file since 542 was 542, checked in by npipsl, 12 years ago

Début raffraichissement menu transition quand on clique dessus

File size: 4.0 KB
Line 
1package com.ether.dao;
2
3import com.ether.IsotopeG09;
4import com.ether.IsotopeIasiG03;
5
6import com.ether.PersistenceException;
7import org.hibernate.criterion.DetachedCriteria;
8import org.hibernate.criterion.Projections;
9import org.hibernate.criterion.Restrictions;
10import org.jetbrains.annotations.NotNull;
11
12import java.util.HashSet;
13import java.util.List;
14import java.util.Set;
15/**
16 * @author npipsl
17 * @date july 2012
18 */
19
20
21public class IsotopeIasiG03DAOImpl
22        extends DomainAccessObjectImpl<IsotopeIasiG03, Integer>
23        implements IsotopeIasiG03DAO
24{
25    protected IsotopeIasiG03DAOImpl()
26    {
27        super( IsotopeIasiG03.class );
28    }
29
30     @NotNull
31    public Set<String> getTransitionsUpperByTransitionLower( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper , final String transitionLower)
32            throws PersistenceException
33    {
34
35          final DetachedCriteria criteria = DetachedCriteria.forClass( IsotopeIasiG03.class )
36                .add( Restrictions.in( "chMoleIsot", isotopesSelectedNameList ) )
37                .add( Restrictions.ge( "wavenbMax", spectralRangeLower ) )
38                .add( Restrictions.le( "wavenbMin", spectralRangeUpper ) )
39                .add( Restrictions.eq( "codeQuantLower",transitionLower ) );
40            criteria.setProjection( Projections.distinct( Projections.property( "codeQuantUpper" ) ));
41
42        final List<String> transitions = selectAllByCriteria( String.class, criteria );
43        return new HashSet<String>( transitions );
44    }
45
46     @NotNull
47    public Set<String> getTransitionsUpperByTransitionUpper( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper , final String transitionUpper)
48            throws PersistenceException
49    {
50
51          final DetachedCriteria criteria = DetachedCriteria.forClass( IsotopeIasiG03.class )
52                .add( Restrictions.in( "chMoleIsot", isotopesSelectedNameList ) )
53                .add( Restrictions.ge( "wavenbMax", spectralRangeLower ) )
54                .add( Restrictions.le( "wavenbMin", spectralRangeUpper ) )
55                .add( Restrictions.eq( "codeQuantUpper",transitionUpper ) );
56            criteria.setProjection( Projections.distinct( Projections.property( "codeQuantLower" ) ));
57
58        final List<String> transitions = selectAllByCriteria( String.class, criteria );
59        return new HashSet<String>( transitions );
60    }
61
62
63    @NotNull
64    public Set<String> getTransitionsUpper( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper )
65            throws PersistenceException
66    {
67        return getTransitions(isotopesSelectedNameList, spectralRangeLower, spectralRangeUpper, true);
68    }
69
70    @NotNull
71    public Set<String> getTransitionsLower( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper )
72            throws PersistenceException
73    {
74        return getTransitions(isotopesSelectedNameList, spectralRangeLower, spectralRangeUpper, false);
75    }
76
77    @NotNull
78    private Set<String> getTransitions( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper, final boolean isForUpper )
79            throws PersistenceException
80    {
81        final DetachedCriteria criteria = DetachedCriteria.forClass( IsotopeIasiG03.class )
82                .add( Restrictions.in( "chMoleIsot", isotopesSelectedNameList ) )
83                .add( Restrictions.ge( "wavenbMax", spectralRangeLower ) )
84                .add( Restrictions.le( "wavenbMin", spectralRangeUpper ) );
85
86        if(isForUpper)
87            criteria.setProjection( Projections.distinct( Projections.property( "codeQuantUpper" ) ));
88        else
89            criteria.setProjection( Projections.distinct( Projections.property( "codeQuantLower" ) ));
90
91        final List<String> transitions = selectAllByCriteria( String.class, criteria );
92        return new HashSet<String>( transitions );
93    }
94
95}
Note: See TracBrowser for help on using the repository browser.