Changeset 536 for geisa/persistence


Ignore:
Timestamp:
07/25/12 18:37:30 (12 years ago)
Author:
npipsl
Message:

Interrogation BDD transition

Location:
geisa/persistence
Files:
5 added
4 edited
4 copied

Legend:

Unmodified
Added
Removed
  • geisa/persistence/implementation/com/ether/dao/IsotopeG03DAOImpl.java

    r533 r536  
    22 
    33import com.ether.IsotopeG03; 
     4import com.ether.Pair; 
    45import com.ether.PersistenceException; 
    56import org.hibernate.criterion.DetachedCriteria; 
     7import org.hibernate.criterion.Projection; 
     8import org.hibernate.criterion.Projections; 
    69import org.hibernate.criterion.Restrictions; 
    710import org.jetbrains.annotations.NotNull; 
    8 import org.jetbrains.annotations.Nullable; 
    911 
     12import java.util.HashSet; 
    1013import java.util.List; 
     14import java.util.Set; 
    1115 
    1216/** 
     
    3236 
    3337    @NotNull 
    34     public List<IsotopeG03> getTransitionsByIsotopeG03Name( final String isotopeName ) 
     38    public List<IsotopeG03> getTransitionsByIsotopeG03Name( final List<String> isotopeNameArray, final Float spectralRangeLower, final Float spectralRangeUpper ) 
     39            throws PersistenceException 
     40    { 
     41        final DetachedCriteria criteria = DetachedCriteria.forClass( IsotopeG03.class ); 
     42        criteria.add( Restrictions.in( "chMoleIsot", isotopeNameArray ) ); 
     43        criteria.add( Restrictions.ge( "wavenbMax", spectralRangeLower ) ); 
     44        criteria.add( Restrictions.le( "wavenbMin", spectralRangeUpper ) ); 
     45        return selectAllByCriteria( IsotopeG03.class, criteria ); 
     46    } 
     47 
     48    @NotNull 
     49    public List<IsotopeG03> getTransitionsByIsotopeG03NameByTransitionLower( final String isotopeName, final Float spectralRangeLower, final Float spectralRangeUpper , final String transitionLower) 
    3550            throws PersistenceException 
    3651    { 
    3752        final DetachedCriteria criteria = DetachedCriteria.forClass( IsotopeG03.class ); 
    3853        criteria.add( Restrictions.eq( "chMoleIsot", isotopeName ) ); 
     54        criteria.add( Restrictions.ge( "wavenbMax", spectralRangeLower) ); 
     55        criteria.add( Restrictions.le( "wavenbMin", spectralRangeUpper) ); 
     56        criteria.add( Restrictions.eq( "codeQuantLower",transitionLower ) ); 
    3957        return selectAllByCriteria( IsotopeG03.class, criteria ); 
    4058    } 
     59 
     60    @NotNull 
     61    public List<Pair> getTransitionsLU( final List<String> isotopeNameArray, final Float spectralRangeLower, final Float spectralRangeUpper ) 
     62            throws PersistenceException 
     63    { 
     64        final DetachedCriteria criteria = DetachedCriteria.forClass( IsotopeG03.class ) 
     65                .add( Restrictions.in( "chMoleIsot", isotopeNameArray ) ) 
     66                .add( Restrictions.ge( "wavenbMax", spectralRangeLower ) ) 
     67                .add( Restrictions.le( "wavenbMin", spectralRangeUpper ) ) 
     68                .setProjection( Projections.projectionList() 
     69                        .add( Projections.property( "codeQuantUpper" ) ) 
     70                        .add( Projections.property( "codeQuantLower" ) )); 
     71 
     72        return selectAllByCriteria( Pair.class, criteria ); 
     73    } 
     74 
     75    @NotNull 
     76    public Set<String> getTransitionsUpper( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper ) 
     77            throws PersistenceException 
     78    { 
     79        return getTransitions(isotopesSelectedNameList, spectralRangeLower, spectralRangeUpper, true); 
     80    } 
     81 
     82    @NotNull 
     83    public Set<String> getTransitionsLower( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper ) 
     84            throws PersistenceException 
     85    { 
     86        return getTransitions(isotopesSelectedNameList, spectralRangeLower, spectralRangeUpper, false); 
     87    } 
     88 
     89    @NotNull 
     90    private Set<String> getTransitions( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper, final boolean isForLower ) 
     91            throws PersistenceException 
     92    { 
     93        final DetachedCriteria criteria = DetachedCriteria.forClass( IsotopeG03.class ) 
     94                .add( Restrictions.in( "chMoleIsot", isotopesSelectedNameList ) ) 
     95                .add( Restrictions.ge( "wavenbMax", spectralRangeLower ) ) 
     96                .add( Restrictions.le( "wavenbMin", spectralRangeUpper ) ); 
     97 
     98        if(isForLower) 
     99            criteria.setProjection( Projections.distinct( Projections.property( "codeQuantUpper" ) )); 
     100        else 
     101            criteria.setProjection( Projections.distinct( Projections.property( "codeQuantLower" ) )); 
     102 
     103        final List<String> transitions = selectAllByCriteria( String.class, criteria ); 
     104        return new HashSet<String>( transitions ); 
     105    } 
     106 
    41107} 
  • geisa/persistence/implementation/com/ether/dao/IsotopeG09.hbm.xml

    r533 r536  
    44<hibernate-mapping default-cascade="save-update" auto-import="false"> 
    55 
    6     <class name="com.ether.IsotopeG03" table="codes_quant_g03"> 
     6    <class name="com.ether.IsotopeG09" table="codes_quant_g09"> 
    77 
    88        <id name="id"> 
  • geisa/persistence/implementation/com/ether/dao/IsotopeG09DAOImpl.java

    r533 r536  
    11package com.ether.dao; 
    22 
    3 import com.ether.IsotopeG03; 
     3import com.ether.IsotopeG09; 
     4import com.ether.Pair; 
    45import com.ether.PersistenceException; 
    56import org.hibernate.criterion.DetachedCriteria; 
     7import org.hibernate.criterion.Projections; 
    68import org.hibernate.criterion.Restrictions; 
    79import org.jetbrains.annotations.NotNull; 
    8 import org.jetbrains.annotations.Nullable; 
    910 
     11import java.util.HashSet; 
    1012import java.util.List; 
     13import java.util.Set; 
    1114 
    1215/** 
     
    1417 * @date july 2012 
    1518 */ 
    16 public class IsotopeG03DAOImpl 
    17         extends DomainAccessObjectImpl<IsotopeG03, Integer> 
    18         implements IsotopeG03DAO 
     19public class IsotopeG09DAOImpl 
     20        extends DomainAccessObjectImpl<IsotopeG09, Integer> 
     21        implements IsotopeG09DAO 
    1922{ 
    20     protected IsotopeG03DAOImpl() 
     23    protected IsotopeG09DAOImpl() 
    2124    { 
    22         super( IsotopeG03.class ); 
     25        super( IsotopeG09.class ); 
     26    } 
     27 
     28 
     29    @NotNull 
     30    public Set<String> getTransitionsUpper( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper ) 
     31            throws PersistenceException 
     32    { 
     33        return getTransitions(isotopesSelectedNameList, spectralRangeLower, spectralRangeUpper, true); 
    2334    } 
    2435 
    2536    @NotNull 
    26     public List<IsotopeG03> getAllIsotopeG03() 
     37    public Set<String> getTransitionsLower( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper ) 
    2738            throws PersistenceException 
    2839    { 
    29         final DetachedCriteria criteria = DetachedCriteria.forClass( IsotopeG03.class ); 
    30         return selectAllByCriteria( IsotopeG03.class, criteria ); 
     40        return getTransitions(isotopesSelectedNameList, spectralRangeLower, spectralRangeUpper, false); 
    3141    } 
    3242 
    3343    @NotNull 
    34     public List<IsotopeG03> getTransitionsByIsotopeG03Name( final String isotopeName ) 
     44    private Set<String> getTransitions( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper, final boolean isForLower ) 
    3545            throws PersistenceException 
    3646    { 
    37         final DetachedCriteria criteria = DetachedCriteria.forClass( IsotopeG03.class ); 
    38         criteria.add( Restrictions.eq( "chMoleIsot", isotopeName ) ); 
    39         return selectAllByCriteria( IsotopeG03.class, criteria ); 
     47        final DetachedCriteria criteria = DetachedCriteria.forClass( IsotopeG09.class ) 
     48                .add( Restrictions.in( "chMoleIsot", isotopesSelectedNameList ) ) 
     49                .add( Restrictions.ge( "wavenbMax", spectralRangeLower ) ) 
     50                .add( Restrictions.le( "wavenbMin", spectralRangeUpper ) ); 
     51 
     52        if(isForLower) 
     53            criteria.setProjection( Projections.distinct( Projections.property( "codeQuantUpper" ) )); 
     54        else 
     55            criteria.setProjection( Projections.distinct( Projections.property( "codeQuantLower" ) )); 
     56 
     57        final List<String> transitions = selectAllByCriteria( String.class, criteria ); 
     58        return new HashSet<String>( transitions ); 
    4059    } 
     60 
    4161} 
  • geisa/persistence/implementation/dao-context.xml

    r533 r536  
    1010    </bean> 
    1111 
    12     <!--<bean id="refIsotopeG09DAO" class="com.ether.dao.IsotopeG09DAOImpl">--> 
    13         <!--<property name="sessionFactory">--> 
    14             <!--<ref bean="sessionFactory" />--> 
    15         <!--</property>--> 
    16     <!--</bean>--> 
     12    <bean id="refIsotopeG09DAO" class="com.ether.dao.IsotopeG09DAOImpl"> 
     13        <property name="sessionFactory"> 
     14            <ref bean="sessionFactory" /> 
     15        </property> 
     16    </bean> 
     17 
     18    <bean id="refIsotopeIasiG03DAO" class="com.ether.dao.IsotopeIasiG03DAOImpl"> 
     19        <property name="sessionFactory"> 
     20            <ref bean="sessionFactory" /> 
     21        </property> 
     22    </bean> 
     23 
     24    <bean id="refIsotopeIasiG09DAO" class="com.ether.dao.IsotopeIasiG09DAOImpl"> 
     25        <property name="sessionFactory"> 
     26            <ref bean="sessionFactory" /> 
     27        </property> 
     28    </bean> 
    1729 
    1830</beans> 
  • geisa/persistence/implementation/hibernate-domain.cfg.xml

    r533 r536  
    77    <session-factory> 
    88        <mapping resource="com/ether/dao/IsotopeG03.hbm.xml"/> 
    9         <!--<mapping resource="com/ether/dao/IsotopeG09.hbm.xml"/>--> 
     9        <mapping resource="com/ether/dao/IsotopeG09.hbm.xml"/> 
     10        <mapping resource="com/ether/dao/IsotopeIasiG03.hbm.xml"/> 
     11        <mapping resource="com/ether/dao/IsotopeIasiG09.hbm.xml"/> 
    1012    </session-factory> 
    1113</hibernate-configuration> 
  • geisa/persistence/interface/com/ether/dao/IsotopeG03DAO.java

    r533 r536  
    22 
    33import com.ether.IsotopeG03; 
     4import com.ether.Pair; 
    45import com.ether.PersistenceException; 
    56import org.jetbrains.annotations.NotNull; 
     
    78 
    89import java.util.List; 
     10import java.util.Set; 
    911 
    1012/** 
     
    1315 */ 
    1416public interface IsotopeG03DAO 
    15         extends DomainAccessObject<IsotopeG03, Integer> 
     17        extends DomainAccessObject<IsotopeG03, Integer> 
    1618{ 
    1719//    @Nullable 
     
    2224 
    2325    @NotNull 
    24     List<IsotopeG03> getTransitionsByIsotopeG03Name( final String isotopeName ) 
     26    List<IsotopeG03> getTransitionsByIsotopeG03Name( final List<String> isotopeNameArray, final Float spectralRangeLower, final Float spectralRangeUpper) 
     27            throws PersistenceException; 
     28 
     29    @NotNull 
     30    List<IsotopeG03> getTransitionsByIsotopeG03NameByTransitionLower( final String isotopeName, final Float spectralRangeLower, final Float spectralRangeUpper, final String transitionLower) 
     31            throws PersistenceException; 
     32 
     33    @NotNull 
     34    List<Pair> getTransitionsLU( final List<String> isotopeNameArray,final Float spectralRangeLower, final Float spectralRangeUpper ) 
     35            throws PersistenceException; 
     36 
     37    @NotNull 
     38    Set<String> getTransitionsLower(final List<String> isotopesSelectedNameList,final Float spectralRangeLower, final Float spectralRangeUpper ) 
     39            throws PersistenceException; 
     40 
     41    @NotNull 
     42    Set<String> getTransitionsUpper(final List<String> isotopesSelectedNameList,final Float spectralRangeLower, final Float spectralRangeUpper ) 
    2543            throws PersistenceException; 
    2644} 
  • geisa/persistence/interface/com/ether/dao/IsotopeG09DAO.java

    r533 r536  
    11package com.ether.dao; 
    22 
    3 import com.ether.IsotopeG03; 
     3 
     4import com.ether.IsotopeG09; 
     5import com.ether.Pair; 
    46import com.ether.PersistenceException; 
    57import org.jetbrains.annotations.NotNull; 
    6 import org.jetbrains.annotations.Nullable; 
    78 
    89import java.util.List; 
     10import java.util.Set; 
    911 
    1012/** 
     
    1214 * @date july 2012 
    1315 */ 
    14 public interface IsotopeG03DAO 
    15         extends DomainAccessObject<IsotopeG03, Integer> 
     16public interface IsotopeG09DAO 
     17        extends DomainAccessObject<IsotopeG09, Integer> 
    1618{ 
    17 //    @Nullable 
    18 //    Plateform getPlateformById( @NotNull final Integer plateformId ) throws PersistenceException; 
     19    @NotNull 
     20    Set<String> getTransitionsLower( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper ) 
     21            throws PersistenceException; 
    1922 
    2023    @NotNull 
    21     List<IsotopeG03> getAllIsotopeG03() throws PersistenceException; 
    22  
    23     @NotNull 
    24     List<IsotopeG03> getTransitionsByIsotopeG03Name( final String isotopeName ) 
     24    Set<String> getTransitionsUpper( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper ) 
    2525            throws PersistenceException; 
    2626} 
  • geisa/persistence/interface/com/ether/dao/IsotopeIasiG03DAO.java

    r533 r536  
    11package com.ether.dao; 
    22 
    3 import com.ether.IsotopeG03; 
     3import com.ether.IsotopeIasiG03; 
     4import com.ether.Pair; 
    45import com.ether.PersistenceException; 
    56import org.jetbrains.annotations.NotNull; 
    6 import org.jetbrains.annotations.Nullable; 
    77 
    88import java.util.List; 
     9import java.util.Set; 
    910 
    1011/** 
     
    1213 * @date july 2012 
    1314 */ 
    14 public interface IsotopeG03DAO 
    15         extends DomainAccessObject<IsotopeG03, Integer> 
     15public interface IsotopeIasiG03DAO 
     16        extends DomainAccessObject<IsotopeIasiG03, Integer> 
    1617{ 
    1718//    @Nullable 
    1819//    Plateform getPlateformById( @NotNull final Integer plateformId ) throws PersistenceException; 
    1920 
    20     @NotNull 
    21     List<IsotopeG03> getAllIsotopeG03() throws PersistenceException; 
    2221 
    2322    @NotNull 
    24     List<IsotopeG03> getTransitionsByIsotopeG03Name( final String isotopeName ) 
     23    Set<String> getTransitionsLower( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper ) 
     24            throws PersistenceException; 
     25 
     26    @NotNull 
     27    Set<String> getTransitionsUpper( final List<String> isotopesSelectedNameList, final Float spectralRangeLower, final Float spectralRangeUpper ) 
    2528            throws PersistenceException; 
    2629} 
Note: See TracChangeset for help on using the changeset viewer.