Changeset 268 for ether_megapoli/trunk


Ignore:
Timestamp:
11/29/11 17:07:52 (13 years ago)
Author:
vmipsl
Message:

BO User

Location:
ether_megapoli/trunk
Files:
10 edited
2 copied

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/common/implementation/com/ether/annotation/ControllerMethod.java

    r249 r268  
    1919 
    2020    boolean requestMandatory() default false; 
     21 
     22    boolean backofficeMethod() default false; 
    2123} 
  • ether_megapoli/trunk/persistence/implementation/dao-context.xml

    r220 r268  
    44<!-- Application context DAO layer --> 
    55<beans> 
    6         <bean id="refPlateformDAO" class="com.ether.dao.PlateformDAOImpl"> 
    7                 <property name="sessionFactory"> 
    8                         <ref bean="sessionFactory" /> 
    9                 </property> 
    10         </bean> 
     6    <bean id="refPlateformDAO" class="com.ether.dao.PlateformDAOImpl"> 
     7        <property name="sessionFactory"> 
     8            <ref bean="sessionFactory"/> 
     9        </property> 
     10    </bean> 
    1111 
    12         <bean id="refParameterDAO" class="com.ether.dao.ParameterDAOImpl"> 
    13                 <property name="sessionFactory"> 
    14                         <ref bean="sessionFactory" /> 
    15                 </property> 
    16         </bean> 
     12    <bean id="refParameterDAO" class="com.ether.dao.ParameterDAOImpl"> 
     13        <property name="sessionFactory"> 
     14            <ref bean="sessionFactory"/> 
     15        </property> 
     16    </bean> 
    1717 
    18         <bean id="refValueDAO" class="com.ether.dao.ValueDAOImpl"> 
    19                 <property name="sessionFactory"> 
    20                         <ref bean="sessionFactory" /> 
    21                 </property> 
    22         </bean> 
     18    <bean id="refValueDAO" class="com.ether.dao.ValueDAOImpl"> 
     19        <property name="sessionFactory"> 
     20            <ref bean="sessionFactory"/> 
     21        </property> 
     22    </bean> 
    2323 
    2424    <bean id="refMeasureDAO" class="com.ether.dao.MeasureDAOImpl"> 
    2525        <property name="sessionFactory"> 
    26             <ref bean="sessionFactory" /> 
     26            <ref bean="sessionFactory"/> 
     27        </property> 
     28    </bean> 
     29 
     30    <bean id="refUserDAO" class="com.ether.dao.user.UserDAOImpl"> 
     31        <property name="sessionFactory"> 
     32            <ref bean="sessionFactory"/> 
    2733        </property> 
    2834    </bean> 
  • ether_megapoli/trunk/persistence/implementation/hibernate-domain.cfg.xml

    r199 r268  
    3434        <mapping resource="com/medias/objects/Zone.hbm.xml"/> 
    3535 
     36        <mapping resource="com/ether/dao/user/User.hbm.xml"/> 
    3637        </session-factory> 
    3738</hibernate-configuration> 
  • ether_megapoli/trunk/persistence/implementation/hibernate.cfg.xml

    r199 r268  
    1818                                <prop key="hibernate.connection.driver_class">org.postgresql.Driver</prop> 
    1919                                <!--<prop key="hibernate.connection.url">jdbc:postgresql://darkstar.ipslnet:5432/megapoli_2</prop>--> 
    20                                 <prop key="hibernate.connection.url">jdbc:postgresql://darkstar.private.ipsl.fr:5432/megapoli_2</prop> 
     20                                <prop key="hibernate.connection.url">jdbc:postgresql://darkstar.private.ipsl.fr:5432/MEGAPOLI_VM4</prop> 
    2121                                <prop key="hibernate.connection.username">postgres</prop> 
    2222                                <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop> 
  • ether_megapoli/trunk/persistence/implementation/hibernate.properties

    r199 r268  
    11hibernate.connection.driver_class = org.postgresql.Driver 
    2 hibernate.connection.url=jdbc:postgresql://darkstar.private.ipsl.fr:5432/megapoli_2 
     2hibernate.connection.url=jdbc:postgresql://darkstar.private.ipsl.fr:5432/MEGAPOLI_VM4 
    33hibernate.connection.username=postgres 
    44#hibernate.c3p0.min_size=5 
  • ether_megapoli/trunk/persistence/implementation/hibernate_local.cfg.xml

    r200 r268  
    1818                                <prop key="hibernate.connection.driver_class">org.postgresql.Driver</prop> 
    1919                                <!--<prop key="hibernate.connection.url">jdbc:postgresql://darkstar.ipslnet:5432/megapoli_2</prop>--> 
    20                                 <prop key="hibernate.connection.url">jdbc:postgresql://darkstar.private.ipsl.fr:5432/megapoli_2</prop> 
     20                                <prop key="hibernate.connection.url">jdbc:postgresql://darkstar.private.ipsl.fr:5432/MEGAPOLI_VM4</prop> 
    2121                                <prop key="hibernate.connection.username">postgres</prop> 
    2222                                <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop> 
  • ether_megapoli/trunk/persistence/implementation/hibernate_local.properties

    r199 r268  
    11hibernate.connection.driver_class = org.postgresql.Driver 
    2 hibernate.connection.url=jdbc:postgresql://darkstar.private.ipsl.fr:5432/megapoli_2 
     2hibernate.connection.url=jdbc:postgresql://darkstar.private.ipsl.fr:5432/MEGAPOLI_VM4 
    33hibernate.connection.username=postgres 
    44#hibernate.c3p0.min_size=5 
  • ether_megapoli/trunk/service/implementation/com/ether/EtherServiceImpl.java

    r244 r268  
    44import com.ether.dao.ParameterDAO; 
    55import com.ether.dao.PlateformDAO; 
     6import com.ether.dao.UserDAO; 
    67import com.ether.dao.ValueDAO; 
     8import com.ether.user.User; 
     9import com.ether.user.UserState; 
    710import com.medias.database.objects.Parametre; 
    811import com.medias.database.objects.Plateforme; 
     
    182185    } 
    183186 
     187    @Nullable 
     188    @Transactional(readOnly = true) 
     189    public User getUserById( @NotNull final Integer userId ) 
     190            throws ServiceException 
     191    { 
     192        try 
     193        { 
     194            return _userDAO.getUserById( userId ); 
     195        } 
     196        catch( PersistenceException e ) 
     197        { 
     198            throw new ServiceException( ServiceException.ServiceCode.USER_NOT_FOUND, e ); 
     199        } 
     200    } 
     201 
     202    @Nullable 
     203    @Transactional(readOnly = true) 
     204    public User getUserByEmail( @NotNull final String userEmail ) 
     205            throws ServiceException 
     206    { 
     207        try 
     208        { 
     209            return _userDAO.getUserByEmail( userEmail ); 
     210        } 
     211        catch( PersistenceException e ) 
     212        { 
     213            throw new ServiceException( ServiceException.ServiceCode.USER_NOT_FOUND, e ); 
     214        } 
     215    } 
     216 
     217    @NotNull 
     218    @Transactional(rollbackFor = Exception.class) 
     219    public Integer createUser( @NotNull final User user ) 
     220            throws ServiceException 
     221    { 
     222        try 
     223        { 
     224            return _userDAO.insert( user ); 
     225        } 
     226        catch( PersistenceException e ) 
     227        { 
     228            throw new ServiceException( ServiceException.ServiceCode.PERSISTENCE, e ); 
     229        } 
     230    } 
     231 
     232    @NotNull 
     233    @Transactional(readOnly = true) 
     234    public List<User> getAllUsers() 
     235            throws ServiceException 
     236    { 
     237        try 
     238        { 
     239            return _userDAO.selectAll(); 
     240        } 
     241        catch( PersistenceException e ) 
     242        { 
     243            throw new ServiceException( ServiceException.ServiceCode.PERSISTENCE, e ); 
     244        } 
     245    } 
     246 
     247    @NotNull 
     248    @Transactional(readOnly = true) 
     249    public List<User> getUsersByState( @NotNull final UserState userState ) 
     250            throws ServiceException 
     251    { 
     252        try 
     253        { 
     254            return _userDAO.getUsersByState( userState ); 
     255        } 
     256        catch( PersistenceException e ) 
     257        { 
     258            throw new ServiceException( ServiceException.ServiceCode.WAITING_USER_NOT_FOUND, e ); 
     259        } 
     260    } 
     261 
    184262    @Required 
    185263    public void setPlateformDAO( final PlateformDAO plateformDAO ) 
     
    204282    { 
    205283        _measureDAO = measureDAO; 
     284    } 
     285 
     286    @Required 
     287    public void setUserDAO( final UserDAO userDAO ) 
     288    { 
     289        _userDAO = userDAO; 
    206290    } 
    207291 
     
    212296    private ValueDAO _valueDAO; 
    213297    private MeasureDAO _measureDAO; 
     298    private UserDAO _userDAO; 
    214299} 
  • ether_megapoli/trunk/service/interface/com/ether/EtherService.java

    r244 r268  
    11package com.ether; 
    22 
     3import com.ether.user.User; 
     4import com.ether.user.UserState; 
    35import com.medias.database.objects.Parametre; 
    46import com.medias.database.objects.Plateforme; 
     
    5557    Date getLastDate() 
    5658            throws ServiceException; 
     59 
     60    @Nullable 
     61    User getUserById( @NotNull final Integer userId ) 
     62            throws ServiceException; 
     63 
     64    @Nullable 
     65    User getUserByEmail( @NotNull final String userEmail ) 
     66            throws ServiceException; 
     67 
     68    @NotNull 
     69    Integer createUser( @NotNull User user ) 
     70            throws ServiceException; 
     71 
     72    @NotNull 
     73    List<User> getAllUsers() 
     74            throws ServiceException; 
     75 
     76    @NotNull 
     77    List<User> getUsersByState( @NotNull UserState userState ) 
     78            throws ServiceException; 
    5779} 
  • ether_megapoli/trunk/web/resources/js/classesForJQuery/etherHelper.js

    r234 r268  
    1313    return (-1 == index); 
    1414} 
     15 
     16function getJSONUser() 
     17{ 
     18    return getLoginModule().getJSONUser(); 
     19} 
     20 
     21function getPath() 
     22{ 
     23    return InterfaceTemplate.path; 
     24} 
     25 
     26function setPath( path ) 
     27{ 
     28    InterfaceTemplate.path = path; 
     29} 
     30 
     31function getLoginModule() 
     32{ 
     33    return InterfaceTemplate.loginModule; 
     34} 
     35 
     36function setLoginModule( loginModule ) 
     37{ 
     38    InterfaceTemplate.loginModule = loginModule; 
     39} 
     40 
     41function neededLogin( href ) 
     42{ 
     43    $( "#signin_menu" ).ready( function() 
     44    { 
     45        if( !getJSONUser() ) 
     46            getLoginModule().showLogin( loginTexts["data.authentification.text"] ); 
     47        else 
     48            document.location.href = getPath() + href; 
     49    } ); 
     50} 
     51 
     52// Need to import javascript librairy "calendar/anytime.js" 
     53function formatDate( date, formatDate ) 
     54{ 
     55    var format = formatDate ? formatDate : "%Y-%m-%d %H:%i"; 
     56    var calendarConverter = new AnyTime.Converter( { format: format } ); 
     57    return calendarConverter.format( date ); 
     58} 
  • ether_megapoli/trunk/web/src/com/ether/ControllerEther.java

    r252 r268  
    1313import org.apache.commons.logging.Log; 
    1414import org.apache.commons.logging.LogFactory; 
     15import org.apache.struts.Globals; 
    1516import org.jetbrains.annotations.NotNull; 
    1617import org.jetbrains.annotations.Nullable; 
     
    3233import java.util.HashMap; 
    3334import java.util.List; 
     35import java.util.Locale; 
    3436import java.util.Map; 
    3537 
     
    9395            if( methodDescription.isRequestMandatory() ) 
    9496                params[params.length - 1] = request; 
     97 
     98            if( methodDescription.isBackofficeMethod() ) 
     99                request.getSession().setAttribute( Globals.LOCALE_KEY, Locale.ENGLISH ); 
    95100 
    96101            // Invoke method (go to controller) 
Note: See TracChangeset for help on using the changeset viewer.