Package com.gadglet.core.GadgletResponse

Examples of com.gadglet.core.GadgletResponse.ContentRecord


          && item.getPersonalNotesMessage().length() > 30)
        msg = item.getPersonalNotesMessage().substring(0, 30) + "...";
      else
        msg = item.getPersonalNotesMessage();

      ContentRecord record = response.newItem();

      record.addItemKeyField(item.getContentItemKey());
      record.addItemField(Params.MESSAGE.getParamName(), msg);
      record.addItemField(Params.PRIORITY.getParamName(), new Integer(
          item.getPriority()).toString());

      List<SharedItemReff> shares = item.getSharedItemReff();
      boolean isOwner = false;
      boolean isEditor = false;

      if (shares != null) {

        for (SharedItemReff share : shares) {
          if (share.getSharedWithId().equals(
              request.getCurrentUserId())
              && share.getSharingType().equals(SharingType.OWNER)) {
            isOwner = true;
            isEditor = true;
          }

          if (share.getSharedWithId().equals(
              request.getCurrentUserId())
              && share.getSharingType().equals(SharingType.EDIT))
            isEditor = true;
        }

        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.getDiscussion().length() > 40)
        title = item.getDiscussion().substring(0, 40) + "...";
      else
        title = item.getDiscussion();

      ContentRecord record = response.newItem();

      record.addItemKeyField(item.getContentItemKey());
   
      record.addItemField(Params.DISCUSSION_TEXT.getParamName(), title);
     
      List<SharedItemReff> shares = item.getSharedItemReff();
      boolean isOwner = false;
      boolean isEditor = false;

      if (shares != null) {

        for (SharedItemReff share : shares) {
          if (share.getSharedWithId().equals(
              request.getCurrentUserId())
              && share.getSharingType().equals(SharingType.OWNER)) {
            isOwner = true;
            isEditor = true;
          }

          if (share.getSharedWithId().equals(
              request.getCurrentUserId())
              && share.getSharingType().equals(SharingType.EDIT))
            isEditor = true;
        }

        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.getPersonalNotesMessage().length() > 30)
        msg = item.getPersonalNotesMessage().substring(0, 30) + "...";
      else
        msg = item.getPersonalNotesMessage();

      ContentRecord record = response.newItem();

      record.addItemKeyField(item.getContentItemKey());
      record.addItemField(Params.MESSAGE.getParamName(), msg);
      record.addItemField(Params.PRIORITY.getParamName(), new Integer(
          item.getPriority()).toString());

      List<SharedItemReff> shares = item.getSharedItemReff();
      boolean isOwner = false;
      boolean isEditor = false;

      if (shares != null) {

        for (SharedItemReff share : shares) {
          if (share.getSharedWithId().equals(
              request.getCurrentUserProfileId())
              && share.getSharingType().equals(SharingType.OWNER)) {
            isOwner = true;
            isEditor = true;
          }

          if (share.getSharedWithId().equals(
              request.getCurrentUserProfileId())
              && share.getSharingType().equals(SharingType.EDIT))
            isEditor = true;
        }

        record.setGadgetPermissions(isEditor, isOwner, isOwner);

        if (!isOwner) {
          // send info about the owner
          UserProfile owner = UserProfilesUtils.getProfileById(item
              .getOwnerId());

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

          }
View Full Code Here

      throw new RequestException(ReqErrorTypes.REQUEST_FAILED);
    } finally {
      pm.close();
    }

    ContentRecord item = response.newItem();

    SimpleDateFormat df = new SimpleDateFormat("MMM/dd/yy hh:mm");
    String formatedDate = null;

    item.addItemKeyField(discussion.getContentItemKey());
    item.addItemField(Params.DISCUSSION_TEXT.getParamName(),
        discussion.getDiscussion());

    formatedDate = df.format(discussion.getCreation());

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

    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

          && item.getBookMarkTitle().length() > 40)
        title = item.getBookMarkTitle().substring(0, 40) + "...";
      else
        title = item.getBookMarkTitle();

      ContentRecord record = response.newItem();

      record.addItemKeyField(item.getContentItemKey());
      record.addItemField(Params.BOOKMARK_TITLE.getParamName(), title);
      record.addItemField(Params.BOOKMARK_URL.getParamName(), item.getBookMarkUrl());
      record.addItemField(Params.BOOKMARK_TYPE.getParamName(),
          item.getBookMarkType().toString());

      List<SharedItemReff> shares = item.getSharedItemReff();
      boolean isOwner = false;
      boolean isEditor = false;

      if (shares != null) {

        for (SharedItemReff share : shares) {
          if (share.getSharedWithId().equals(
              request.getCurrentUserId())
              && share.getSharingType().equals(SharingType.OWNER)) {
            isOwner = true;
            isEditor = true;
          }

          if (share.getSharedWithId().equals(
              request.getCurrentUserId())
              && share.getSharingType().equals(SharingType.EDIT))
            isEditor = true;
        }

        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

    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) {
View Full Code Here

        .getMyfriends(request);
   
    if (myFriendsList != null) {
   
      for (DomainUser friend : myFriendsList) {
        ContentRecord profileRecord = res.newItem();
       
        profileRecord.addItemField(
            ProfileFields.PROFILE_NICKNAME.getParamName(),
            friend.getNickName());

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

        profileRecord.addItemField(
            ProfileFields.PROFILE_TITLE.getParamName(),
            friend.getTitle());
       
        profileRecord.addItemField(
            ProfileFields.PROFILE_FRIEND_ID.getParamName(),
            friend.getUniqueId());

      }
View Full Code Here

      for (DomainUser friend : myDomainUsers) {
        // skip current user from list
        if(friend.getUniqueId().equals(request.getCurrentDomainUserId()))
          continue;
       
        ContentRecord profileRecord = res.newItem();

        count ++;
        profileRecord.addItemField(
            ProfileFields.PROFILE_NICKNAME.getParamName(),
            friend.getNickName());

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

        profileRecord.addItemField(
            ProfileFields.PROFILE_TITLE.getParamName(),
            friend.getTitle());
       
        profileRecord.addItemField(
            ProfileFields.PROFILE_FRIEND_ID.getParamName(),
            friend.getUniqueId());

      }
View Full Code Here

    UserProfile profile = null;
    try {

      profile = UserProfilesUtils.getMyProfile(request);

      ContentRecord profileRecord = res.newItem();

      profileRecord.addItemField(
          ProfileFields.PROFILE_NICKNAME.getParamName(),
          profile.getNickName());
      profileRecord.addItemField(
          ProfileFields.PROFILE_PRIVACY.getParamName(),
          profile.getVisibilityStatus().getPrivacyStatus());
      profileRecord.addItemField(
          ProfileFields.PROFILE_THUMBNAILURL.getParamName(),
          profile.getPhotoUrl());

    } catch (Exception e) {
View Full Code Here

      res.setTotalItemsNum(0);
    else{
     
      for(Friends friends: myFriends){
       
        ContentRecord record  = res.newItem();
       
        record.addItemKeyField(friends.getFriendId(request.getCurrentUserProfileId()));
       
       
        UserProfile profile = UserProfilesUtils.getProfileById(friends.getFriendId(request.getCurrentUserProfileId()));
       
        if(profile!=null && !profile.isPrivate()){
          record.addItemField(ProfileFields.PROFILE_NICKNAME.getParamName(), profile.getNickName());
          if( profile.getPhotoUrl()!=null &&  profile.getPhotoUrl().length()>0)
            record.addItemField(ProfileFields.PROFILE_THUMBNAILURL.getParamName(), profile.getPhotoUrl());
        }
             
        record.setContentName("myFriends");
       
        record.setGadgetPermissions(false, false, false);
      }
     
    }
   
 
View Full Code Here

TOP

Related Classes of com.gadglet.core.GadgletResponse.ContentRecord

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.