Package mindnotes.server

Source Code of mindnotes.server.UserInfoServiceImpl

package mindnotes.server;

import mindnotes.shared.services.UserInfo;
import mindnotes.shared.services.UserInfoService;

import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

@SuppressWarnings("serial")
public class UserInfoServiceImpl extends RemoteServiceServlet implements
    UserInfoService {

  @Override
  public UserInfo getUserInfo() {
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    UserInfo info = new UserInfo();
    if (user == null) {
      info.setLoginURL(userService.createLoginURL("/MindNotes.html"));
    } else {
      info.setLogoutURL(userService.createLogoutURL("/MindNotes.html"));

      info.setEmail(user.getEmail());
      info.setNickname(user.getNickname());
      info.setUserId(user.getUserId());

    }
    return info;
  }
}
TOP

Related Classes of mindnotes.server.UserInfoServiceImpl

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.