Examples of UserPrefs


Examples of clock.UserPrefs

    public void setUser(User user) {
        this.user = user;
    }

    public static UserPrefs getPrefsForUser(User user) {
        UserPrefs userPrefs = null;

        EntityManager em = EMF.get().createEntityManager();
        try {
            userPrefs = em.find(UserPrefs.class, user.getUserId());
            if (userPrefs == null) {
                userPrefs = new UserPrefs(user.getUserId());
                userPrefs.setUser(user);
            }
        } finally {
            em.close();
        }
View Full Code Here

Examples of clock.UserPrefs

                       HttpServletResponse resp)
        throws IOException {
        UserService userService = UserServiceFactory.getUserService();
        User user = userService.getCurrentUser();

        UserPrefs userPrefs = UserPrefs.getPrefsForUser(user);

        try {
            int tzOffset = new Integer(req.getParameter("tz_offset")).intValue();
            userPrefs.setTzOffset(tzOffset);
            userPrefs.save();
        } catch (NumberFormatException nfe) {
            // User entered a value that wasn't an integer.  Ignore for now.
        }

        resp.sendRedirect("/");
View Full Code Here

Examples of clock.UserPrefs

        this.user = user;
    }

    @SuppressWarnings("unchecked")
    public static UserPrefs getPrefsForUser(User user) {
        UserPrefs userPrefs = null;

        String cacheKey = getCacheKeyForUser(user);

        try {
            MemcacheService memcache = MemcacheServiceFactory.getMemcacheService();
            if (memcache.contains(cacheKey)) {
                logger.warning("CACHE HIT: " + cacheKey);
                userPrefs = (UserPrefs) memcache.get(cacheKey);
                return userPrefs;
            }
            logger.warning("CACHE MISS: " + cacheKey);
            // If the UserPrefs object isn't in memcache,
            // fall through to the datastore.
        } catch (MemcacheServiceException e) {
            // If there is a problem with the cache,
            // fall through to the datastore.
        }

        EntityManager em = EMF.get().createEntityManager();
        try {
            userPrefs = em.find(UserPrefs.class, user.getUserId());
            if (userPrefs == null) {
                userPrefs = new UserPrefs(user);
            } else {
                userPrefs.cacheSet();
            }
        } finally {
            em.close();
        }
View Full Code Here

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

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

        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

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

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

Examples of dotaSoundEditor.UserPrefs

    }//GEN-LAST:event_formWindowClosing

    private void JMenuInstallDirActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_JMenuInstallDirActionPerformed
    {//GEN-HEADEREND:event_JMenuInstallDirActionPerformed
        //Change steam install loc  
        UserPrefs prefs = UserPrefs.getInstance();
        JDialog locationCheckDialog = new JDialog();
        locationCheckDialog.setModal(true);
        locationCheckDialog.setAlwaysOnTop(true);
        locationCheckDialog.setTitle("Locate Dota 2");
        locationCheckDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
View Full Code Here

Examples of org.apache.shindig.gadgets.UserPrefs

    if (context.getCajoled()) {
      addParam(uri, Param.CAJOLE.getKey(), "1", useTpl, false);
    }

    // Add all UserPrefs
    UserPrefs prefs = context.getUserPrefs();
    for (UserPref up : gadget.getSpec().getUserPrefs().values()) {
      String name = up.getName();
      String data = prefs.getPref(name);
      if (data == null) {
        data = up.getDefaultValue();
      }

      boolean upInFragment = !view.needsUserPrefSubstitution();
View Full Code Here

Examples of org.apache.shindig.gadgets.UserPrefs

    Iterator i = prefs.keys();
    while (i.hasNext()) {
      String key = (String)i.next();
      p.put(key, prefs.getString(key));
    }
    return new UserPrefs(p);
  }
View Full Code Here

Examples of org.apache.shindig.gadgets.UserPrefs

      if (paramName.startsWith(USERPREF_PARAM_PREFIX)) {
        String prefName = paramName.substring(USERPREF_PARAM_PREFIX.length());
        prefs.put(prefName, req.getParameter(paramName));
      }
    }
    return new UserPrefs(prefs);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.