Package com.gadglet.data

Examples of com.gadglet.data.DomainUser


        record.setGadgetPermissions(isEditor, isOwner, isOwner);

        if (!isOwner) {
          // send info about the owner need to change !!!!
          DomainUser owner = DomainUserUtils.getDomainUserByUniqueId(
              item.getOwnerId(), request.getCurrentDomainUser()
                  .getAccount());

          record.addItemField(
              ProfileFields.PROFILE_NICKNAME.getParamName(),
              owner.getNickName());
          record.addItemField(
              ProfileFields.PROFILE_TITLE.getParamName(),
              owner.getTitle());

          if (owner.getPhotoUrl() != null
              && owner.getPhotoUrl().length() > 0)
            record.addItemField(ProfileFields.PROFILE_THUMBNAILURL
                .getParamName(), owner.getPhotoUrl());

        }
      }

    }
View Full Code Here


        record.setGadgetPermissions(isEditor, isOwner, isOwner);

        if (!isOwner) {
          // send info about the owner need to change !!!!
          DomainUser owner = DomainUserUtils.getDomainUserByUniqueId(
              item.getOwnerId(), request.getCurrentDomainUser()
                  .getAccount());

          record.addItemField(
              ProfileFields.PROFILE_NICKNAME.getParamName(),
              owner.getNickName());
          record.addItemField(
              ProfileFields.PROFILE_TITLE.getParamName(),
              owner.getTitle());

          if (owner.getPhotoUrl() != null
              && owner.getPhotoUrl().length() > 0)
            record.addItemField(ProfileFields.PROFILE_THUMBNAILURL
                .getParamName(), owner.getPhotoUrl());

        }
      }

    }
View Full Code Here

    item.addItemField(Params.DISCUSSION_LEVEL.getParamName(), "0");

    item.setContentName(Params.DISCUSSION_TEXT.getParamName());

    DomainUser writer = DomainUserUtils.getDomainUserByUniqueId(discussion
        .getOwnerId(), request.getCurrentDomainUser().getAccount());

    item.addItemField(ProfileFields.PROFILE_NICKNAME.getParamName(),
        writer.getNickName());
    item.addItemField(ProfileFields.PROFILE_TITLE.getParamName(),
        writer.getTitle());

    if (writer.getPhotoUrl() != null && writer.getPhotoUrl().length() > 0)
      item.addItemField(
          ProfileFields.PROFILE_THUMBNAILURL.getParamName(),
          writer.getPhotoUrl());

    item.setGadgetPermissions(discussion.isUserEdit(request),
        discussion.isOwnedByMe(request),
        discussion.isOwnedByMe(request));

    if (replays != null) {

      for (Replys replay : replays) {
        int level = 0;

        item = response.newItem();
        item.addItemKeyField(replay.getId());
        item.addItemField(Params.DISCUSSION_TEXT.getParamName(),
            replay.getReply());

        formatedDate = df.format(replay.getCdate());

        if (formatedDate != null)
          item.addItemField(
              Params.DISCUSSION_MSD_DATE.getParamName(),
              formatedDate);
        else
          item.addItemField(
              Params.DISCUSSION_MSD_DATE.getParamName(), "");

        if (replay.getReplyOrder() != null)
          level = replay.getReplyOrder().split("\\*").length - 1;
        // this will be used to create UI message indentation
        item.addItemField(Params.DISCUSSION_LEVEL.getParamName(),
            new Integer(level).toString());

        item.setContentName(Params.DICUSSION_REPLY.getParamName());

        writer = DomainUserUtils.getDomainUserByUniqueId(replay
            .getUserName(), request.getCurrentDomainUser()
            .getAccount());

        item.addItemField(
            ProfileFields.PROFILE_NICKNAME.getParamName(),
            writer.getNickName());
        item.addItemField(ProfileFields.PROFILE_TITLE.getParamName(),
            writer.getTitle());

        if (writer.getPhotoUrl() != null
            && writer.getPhotoUrl().length() > 0)
          item.addItemField(
              ProfileFields.PROFILE_THUMBNAILURL.getParamName(),
              writer.getPhotoUrl());

        item.setGadgetPermissions(discussion.isUserEdit(request),
            false, false);

      }
View Full Code Here

        record.setGadgetPermissions(isEditor, isOwner, isOwner);

        if (!isOwner) {
          // send info about the owner need to change !!!!
          DomainUser owner = DomainUserUtils.getDomainUserByUniqueId(
              item.getOwnerId(), request.getCurrentDomainUser()
                  .getAccount());

          record.addItemField(
              ProfileFields.PROFILE_NICKNAME.getParamName(),
              owner.getNickName());
          record.addItemField(
              ProfileFields.PROFILE_TITLE.getParamName(),
              owner.getTitle());

          if (owner.getPhotoUrl() != null
              && owner.getPhotoUrl().length() > 0)
            record.addItemField(ProfileFields.PROFILE_THUMBNAILURL
                .getParamName(), owner.getPhotoUrl());

        }
      }

    }
View Full Code Here

  public void getProfile(GadgletRequestWrapper request, GadgletResponse res)
      throws Exception {

    try {

      DomainUser currUser = request.getCurrentDomainUser();

      ContentRecord profileRecord = res.newItem();

      profileRecord.addItemField(
          ProfileFields.PROFILE_NICKNAME.getParamName(),
          currUser.getNickName());

      profileRecord.addItemField(
          ProfileFields.PROFILE_THUMBNAILURL.getParamName(),
          currUser.getPhotoUrl());

      profileRecord.addItemField(
          ProfileFields.PROFILE_TITLE.getParamName(),
          currUser.getTitle());

    } catch (Exception e) {

      throw e;
    }
View Full Code Here

      GadgletResponse jsonResponse) throws RequestException {
    // need to check session for existing user

    boolean userLogin = false;
    User user = null;
    DomainUser domainUser = null;

    domainUser =  platformRequestWrapper.getCurrentDomainUser();

    try {
      OAuthService oauth = OAuthServiceFactory.getOAuthService();
      user = oauth.getCurrentUser();
      userLogin = true;


    } catch (OAuthRequestException e) {
      printStackTrace(e);
      throw new RequestException(ReqErrorTypes.USER_NOT_LOGGEDIN);

    }
    // in case the user changed his id during session (possible ?)
    if (domainUser != null && !user.getUserId().equals(domainUser.getId()))
      domainUser = null;

    if (domainUser != null) {
      NamespaceManager.set(domainUser.getAccount());
      return true;
    }


   
    domainUser = DomainUserUtils.getMyDomainUserWithOauth();
    // set user in session
   
    if (platformRequestWrapper != null && domainUser != null) {
         
      if (domainUser.getAccount() == null)
        throw new RequestException(ReqErrorTypes.USER_MISSING_ACCOUNT);
      if (domainUser.getStatus() != DomainUserStatus.ACTIVE.getUserStatus())
        throw new RequestException(ReqErrorTypes.USER_NOT_ACTIVE);
     
      platformRequestWrapper.getSession().setAttribute("domainUser",
          domainUser);
      NamespaceManager.set(domainUser.getAccount());
      return true;
    }
   
   
    if (domainUser == null)
View Full Code Here

   
      throw new RequestException(ReqErrorTypes.USER_NOT_LOGGEDIN);
     
    }

    DomainUser domainUser = null;

    domainUser = (DomainUser) platformRequestWrapper.getSession()
        .getAttribute("domainUser");

    if (domainUser != null
        && domainUser.getOauthConsumerKey().equals(
            platformRequestWrapper.getOpenSocialConsumerKey())
        && domainUser.getOpensocialViewerId().equals(
            platformRequestWrapper.getOpenSocialViewerId())) {
   
      NamespaceManager.set(domainUser.getAccount());
      return true;
    }
    else
      domainUser = DomainUserUtils.getDomainUserByOpenSocial(platformRequestWrapper);
   
    if (domainUser != null){
      if (domainUser.getStatus() != DomainUserStatus.ACTIVE.getUserStatus())
        throw new RequestException(ReqErrorTypes.USER_NOT_ACTIVE);
     
      // set user in session
      if (platformRequestWrapper != null && domainUser != null) {
        platformRequestWrapper.getSession().setAttribute("domainUser",
            domainUser);
        NamespaceManager.set(domainUser.getAccount());
        return true;
      }
    }
   
   
View Full Code Here

TOP

Related Classes of com.gadglet.data.DomainUser

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.