Examples of ThemeDisplay


Examples of com.liferay.portal.theme.ThemeDisplay

  public void addFriend(
      ActionRequest actionRequest, ActionResponse actionResponse)
    throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
      WebKeys.THEME_DISPLAY);

    Group group = GroupLocalServiceUtil.getGroup(
      themeDisplay.getScopeGroupId());

    User user = UserLocalServiceUtil.getUserById(group.getClassPK());

    SocialRequestLocalServiceUtil.addRequest(
      themeDisplay.getUserId(), 0, User.class.getName(),
      themeDisplay.getUserId(), FriendsRequestKeys.ADD_FRIEND,
      StringPool.BLANK, user.getUserId());
  }
View Full Code Here

Examples of com.liferay.portal.theme.ThemeDisplay

  public void deleteFriend(
      ActionRequest actionRequest, ActionResponse actionResponse)
    throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
      WebKeys.THEME_DISPLAY);

    Group group = GroupLocalServiceUtil.getGroup(
      themeDisplay.getScopeGroupId());

    User user = UserLocalServiceUtil.getUserById(group.getClassPK());

    SocialRelationLocalServiceUtil.deleteRelation(
      themeDisplay.getUserId(), user.getUserId(),
      SocialRelationConstants.TYPE_BI_FRIEND);
  }
View Full Code Here

Examples of com.liferay.portal.theme.ThemeDisplay

  public void joinGroup(
      ActionRequest actionRequest, ActionResponse actionResponse)
    throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
      WebKeys.THEME_DISPLAY);

    Group group = GroupLocalServiceUtil.getGroup(
      themeDisplay.getScopeGroupId());

    if (group.getType() == GroupConstants.TYPE_COMMUNITY_OPEN) {
      UserLocalServiceUtil.addGroupUsers(
        group.getGroupId(), new long[] {themeDisplay.getUserId()});
    }
    else {
      Role role = RoleLocalServiceUtil.getRole(
        themeDisplay.getCompanyId(), "Community Administrator");

      LinkedHashMap<String, Object> userParams =
        new LinkedHashMap<String, Object>();

      userParams.put(
        "userGroupRole",
        new Long[] {new Long(group.getGroupId()),
        new Long(role.getRoleId())});

      List<User> users = UserLocalServiceUtil.search(
        themeDisplay.getCompanyId(), null, Boolean.TRUE, userParams,
        QueryUtil.ALL_POS, QueryUtil.ALL_POS, (OrderByComparator) null);

      for (User user : users) {
        SocialRequestLocalServiceUtil.addRequest(
          themeDisplay.getUserId(), 0, Group.class.getName(),
          group.getGroupId(), MembersRequestKeys.ADD_MEMBER,
          StringPool.BLANK, user.getUserId());
      }
    }
  }
View Full Code Here

Examples of com.liferay.portal.theme.ThemeDisplay

  public void joinOrganization(
      ActionRequest actionRequest, ActionResponse actionResponse)
    throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
      WebKeys.THEME_DISPLAY);

    Group group = GroupLocalServiceUtil.getGroup(
      themeDisplay.getScopeGroupId());

    Organization organization =
      OrganizationLocalServiceUtil.getOrganization(group.getClassPK());

    Role role = RoleLocalServiceUtil.getRole(
      themeDisplay.getCompanyId(), "Organization Administrator");

    LinkedHashMap<String, Object> userParams =
      new LinkedHashMap<String, Object>();

    userParams.put(
      "userGroupRole",
      new Long[] {new Long(group.getGroupId()),
      new Long(role.getRoleId())});

    List<User> users = UserLocalServiceUtil.search(
      themeDisplay.getCompanyId(), null, Boolean.TRUE, userParams,
      QueryUtil.ALL_POS, QueryUtil.ALL_POS, (OrderByComparator) null);

    for (User user : users) {
      SocialRequestLocalServiceUtil.addRequest(
        themeDisplay.getUserId(), 0, Organization.class.getName(),
        organization.getOrganizationId(), MembersRequestKeys.ADD_MEMBER,
        StringPool.BLANK, user.getUserId());
    }
  }
View Full Code Here

Examples of com.liferay.portal.theme.ThemeDisplay

  public void leaveGroup(
      ActionRequest actionRequest, ActionResponse actionResponse)
    throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
      WebKeys.THEME_DISPLAY);

    UserLocalServiceUtil.unsetGroupUsers(
      themeDisplay.getScopeGroupId(),
      new long[] {themeDisplay.getUserId()});
  }
View Full Code Here

Examples of com.liferay.portal.theme.ThemeDisplay

  public void leaveOrganization(
      ActionRequest actionRequest, ActionResponse actionResponse)
    throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
      WebKeys.THEME_DISPLAY);

    Group group = GroupLocalServiceUtil.getGroup(
      themeDisplay.getScopeGroupId());

    UserLocalServiceUtil.unsetOrganizationUsers(
      group.getClassPK(), new long[] {themeDisplay.getUserId()});
  }
View Full Code Here

Examples of com.liferay.portal.theme.ThemeDisplay

  public void updateSummary(
      ActionRequest actionRequest, ActionResponse actionResponse)
    throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
      WebKeys.THEME_DISPLAY);

    if (!themeDisplay.isSignedIn()) {
      return;
    }

    Group group = GroupLocalServiceUtil.getGroup(
      themeDisplay.getScopeGroupId());

    User user = null;

    if (group.isUser()) {
      user = UserLocalServiceUtil.getUserById(group.getClassPK());
    }
    else {
      return;
    }

    if (!UserPermissionUtil.contains(
        themeDisplay.getPermissionChecker(), user.getUserId(),
        ActionKeys.UPDATE)) {

      return;
    }

    String jobTitle = ParamUtil.getString(actionRequest, "jobTitle");
    String aboutMe = ParamUtil.getString(actionRequest, "aboutMe");

    try {
      ExpandoValueLocalServiceUtil.addValue(
        themeDisplay.getCompanyId(), User.class.getName(), "SN",
        "aboutMe", user.getUserId(), aboutMe);

      Contact contact = user.getContact();

      contact.setJobTitle(jobTitle);
View Full Code Here

Examples of com.liferay.portal.theme.ThemeDisplay

  public void addWallEntry(
      ActionRequest actionRequest, ActionResponse actionResponse)
    throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
      WebKeys.THEME_DISPLAY);

    if (!themeDisplay.isSignedIn()) {
      return;
    }

    Group group = GroupLocalServiceUtil.getGroup(
      themeDisplay.getScopeGroupId());

    User user = null;

    if (group.isUser()) {
      user = UserLocalServiceUtil.getUserById(group.getClassPK());
    }
    else {
      return;
    }

    if ((themeDisplay.getUserId() != user.getUserId()) &&
      (!SocialRelationLocalServiceUtil.hasRelation(
        themeDisplay.getUserId(), user.getUserId(),
        SocialRelationConstants.TYPE_BI_FRIEND))) {

      return;
    }

    String comments = ParamUtil.getString(actionRequest, "comments");

    WallEntryLocalServiceUtil.addWallEntry(
      themeDisplay.getScopeGroupId(), themeDisplay.getUserId(),
      comments, themeDisplay);
  }
View Full Code Here

Examples of com.liferay.portal.theme.ThemeDisplay

  public void deleteWallEntry(
      ActionRequest actionRequest, ActionResponse actionResponse)
    throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
      WebKeys.THEME_DISPLAY);

    if (!themeDisplay.isSignedIn()) {
      return;
    }

    long wallEntryId = ParamUtil.getLong(actionRequest, "wallEntryId");

    WallEntry wallEntry = null;

    try {
      wallEntry = WallEntryLocalServiceUtil.getWallEntry(wallEntryId);
    }
    catch (Exception e) {
      return;
    }

    if (wallEntry.getGroupId() != themeDisplay.getScopeGroupId()) {
      return;
    }

    Group group = GroupLocalServiceUtil.getGroup(
      themeDisplay.getScopeGroupId());

    User user = null;

    if (group.isUser()) {
      user = UserLocalServiceUtil.getUserById(group.getClassPK());
    }
    else {
      return;
    }

    if (!UserPermissionUtil.contains(
        themeDisplay.getPermissionChecker(), user.getUserId(),
        ActionKeys.UPDATE)) {

      return;
    }
View Full Code Here

Examples of com.liferay.portal.theme.ThemeDisplay

  public void deleteMeetupsEntry(
      ActionRequest actionRequest, ActionResponse actionResponse)
    throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
      WebKeys.THEME_DISPLAY);

    PermissionChecker permissionChecker =
      themeDisplay.getPermissionChecker();

    if (!permissionChecker.isCompanyAdmin()) {
      return;
    }
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.