Package com.changestuffs.shared.actions

Examples of com.changestuffs.shared.actions.GetUserInfoResult


    ChannelService channelService = ChannelServiceFactory.getChannelService();
    ChannelPresence presence = channelService.parsePresence(req);
    String email = presence.clientId();
    UserBeanOAM oam = provider.get();
    oam.updateOnline(isOnline(), email);
    GetUserInfoResult result = oam.getGetUserInfoResult(email);
    for(String online : result.getOnline()){
      log.info(email+" is online = "+isOnline()+". Sending message to "+online);
      channelService.sendMessage(new ChannelMessage(online, getJson(email, online)));
    }
  }
View Full Code Here


 
  @Logued
  @Override
  public GetUserInfoResult execute(GetUserInfo action, ExecutionContext context)
      throws ActionException {
    GetUserInfoResult result = null;
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();
    UserBeanOAM oam = provider.get();
    GetUserInfoResult myInfo = oam.getGetUserInfoResult(user.getEmail());
    if(action.getEmail() != null){
      if(myInfo.getFriends().contains(action.getEmail())){
        result = oam.getGetUserInfoResult(action.getEmail());
      }else{
        throw new IllegalArgumentException(action.getEmail()+" isn't friend of "+user.getEmail());
      }
    }else{
View Full Code Here

  public GetUserInfoResult getGetUserInfoResult(String email){
    User userBean = model.find(User.class, email);
    if(userBean != null){
      Set<String> friends = getSecureSet(userBean.getFriends());
      Set<String> prending = getSecureSet(userBean.getPendingFriends());
      return new GetUserInfoResult(userBean.getCell(), userBean.getCountry(), userBean.getCity(), email, userBean.isReceiveEmails(), friends, prending, getOnline(friends));
    }else{
      // It's maybe the first time, and DB is slow so it can be null
      Set<String> empty = new HashSet<String>();
      return new GetUserInfoResult("", "", "", email, true, empty, empty, empty);
    }
  }
View Full Code Here

TOP

Related Classes of com.changestuffs.shared.actions.GetUserInfoResult

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.