Package com.javaeye.jert.domain.user

Examples of com.javaeye.jert.domain.user.UserPrefs


    public static final String USER_PREFS_SESSION_KEY = "_USER_PREFS_SESSION_KEY_";

    protected void before(ActionInvocation invocation) {
        Action action = invocation.getAction();
        if (action instanceof UserPrefsAware) {
            UserPrefs userPrefs = (UserPrefs) invocation.getInvocationContext().getSession().get(USER_PREFS_SESSION_KEY);
            if (userPrefs == null) {
                UserPrefsService service = (UserPrefsService) Application.getInstance().getContainer().getComponent(UserPrefsService.class);
                userPrefs = service.loadUserPrefs(RemoteUser.get().getName());
                invocation.getInvocationContext().getSession().put(USER_PREFS_SESSION_KEY, userPrefs);
            }
View Full Code Here


        return new ClassPathXmlApplicationContext("com/javaeye/jert/service/test/UserPrefsServiceTest.xml");
    }
   
    public void test() {
        String userName = "tester";
        UserPrefs userPrefs = new UserPrefs();
        Locale chinese = new Locale("zh", "CN");
        Integer countOnEachPage = new Integer(20);
       
        userPrefs.setUserName(userName);
        userPrefs.setLocale(chinese);
        userPrefs.setCountOnEachPage(countOnEachPage);
        service.createUserPrefs(userPrefs);
       
        UserPrefs stored = service.loadUserPrefs(userName);
        assertEquals(chinese, stored.getLocale());
        assertEquals(countOnEachPage, stored.getCountOnEachPage());
        assertEquals(userName, stored.getUserName());
       
        stored.setLocale(new Locale("en"));
        service.updateUserPrefs(stored);
    }
View Full Code Here

public class UserPrefsServiceDefaultImpl extends AbstractService implements UserPrefsService {

    public UserPrefs loadUserPrefs(String userName) {
        List result = findByNamedQuery("findUserPrefsByUserName", userName);
        if (result != null && result.size() > 0) { return (UserPrefs) result.get(0); }
        return new UserPrefs(Locale.getDefault(), new Integer(ReportInstance.DEFAULT_COUNT_ON_EACH_PAGE));
    }
View Full Code Here

TOP

Related Classes of com.javaeye.jert.domain.user.UserPrefs

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.