コード例 #1
0
  protected void updateActive(ActionRequest actionRequest, String cmd) throws Exception {

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

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

    if ((groupId == themeDisplay.getDoAsGroupId())
        || (groupId == themeDisplay.getScopeGroupId())
        || (groupId == getRefererGroupId(themeDisplay))) {

      throw new RequiredGroupException(
          String.valueOf(groupId), RequiredGroupException.CURRENT_GROUP);
    }

    Group group = GroupServiceUtil.getGroup(groupId);

    boolean active = false;

    if (cmd.equals(Constants.RESTORE)) {
      active = true;
    }

    ServiceContext serviceContext =
        ServiceContextFactory.getInstance(Group.class.getName(), actionRequest);

    GroupServiceUtil.updateGroup(
        groupId,
        group.getParentGroupId(),
        group.getName(),
        group.getDescription(),
        group.getType(),
        group.getFriendlyURL(),
        active,
        serviceContext);
  }
コード例 #2
0
  private void _buildParentGroupsBreadcrumb(
      LayoutSet layoutSet, PortletURL portletURL, ThemeDisplay themeDisplay, StringBundler sb)
      throws Exception {
    Group group = layoutSet.getGroup();

    if (group.isOrganization()) {
      Organization organization =
          OrganizationLocalServiceUtil.getOrganization(group.getOrganizationId());

      Organization parentOrganization = organization.getParentOrganization();

      if (parentOrganization != null) {
        Group parentGroup = parentOrganization.getGroup();

        LayoutSet parentLayoutSet =
            LayoutSetLocalServiceUtil.getLayoutSet(
                parentGroup.getGroupId(), layoutSet.isPrivateLayout());

        _buildParentGroupsBreadcrumb(parentLayoutSet, portletURL, themeDisplay, sb);
      }
    } else if (group.isUser()) {
      User groupUser = UserLocalServiceUtil.getUser(group.getClassPK());

      List<Organization> organizations =
          OrganizationLocalServiceUtil.getUserOrganizations(groupUser.getUserId(), true);

      if (!organizations.isEmpty()) {
        Organization organization = organizations.get(0);

        Group parentGroup = organization.getGroup();

        LayoutSet parentLayoutSet =
            LayoutSetLocalServiceUtil.getLayoutSet(
                parentGroup.getGroupId(), layoutSet.isPrivateLayout());

        _buildParentGroupsBreadcrumb(parentLayoutSet, portletURL, themeDisplay, sb);
      }
    }

    int layoutsPageCount = 0;

    if (layoutSet.isPrivateLayout()) {
      layoutsPageCount = group.getPrivateLayoutsPageCount();
    } else {
      layoutsPageCount = group.getPublicLayoutsPageCount();
    }

    if ((layoutsPageCount > 0) && !group.getName().equals(GroupConstants.GUEST)) {
      String layoutSetFriendlyURL = PortalUtil.getLayoutSetFriendlyURL(layoutSet, themeDisplay);

      sb.append("<li><span><a href=\"");
      sb.append(layoutSetFriendlyURL);
      sb.append("\">");
      sb.append(HtmlUtil.escape(group.getDescriptiveName()));
      sb.append("</a></span></li>");
    }
  }
コード例 #3
0
  public int compareTo(Group group) {
    int value = 0;

    value = getName().compareToIgnoreCase(group.getName());

    if (value != 0) {
      return value;
    }

    return 0;
  }
コード例 #4
0
  public static JSONObject toJSONObject(Group model) {
    JSONObject jsonObj = JSONFactoryUtil.createJSONObject();

    jsonObj.put("groupId", model.getGroupId());
    jsonObj.put("companyId", model.getCompanyId());
    jsonObj.put("creatorUserId", model.getCreatorUserId());
    jsonObj.put("classNameId", model.getClassNameId());
    jsonObj.put("classPK", model.getClassPK());
    jsonObj.put("parentGroupId", model.getParentGroupId());
    jsonObj.put("liveGroupId", model.getLiveGroupId());
    jsonObj.put("name", model.getName());
    jsonObj.put("description", model.getDescription());
    jsonObj.put("type", model.getType());
    jsonObj.put("typeSettings", model.getTypeSettings());
    jsonObj.put("friendlyURL", model.getFriendlyURL());
    jsonObj.put("active", model.getActive());

    return jsonObj;
  }
  protected Map<Locale, String> getCalendarNameMap(
      PortletDataContext portletDataContext, Calendar calendar) throws Exception {

    String calendarName = calendar.getName(LocaleUtil.getDefault());

    Group sourceGroup = GroupLocalServiceUtil.fetchGroup(portletDataContext.getSourceGroupId());

    if ((sourceGroup == null) || !calendarName.equals(sourceGroup.getDescriptiveName())) {

      return calendar.getNameMap();
    }

    Map<Locale, String> calendarNameMap = new HashMap<>();

    Group scopeGroup = GroupLocalServiceUtil.getGroup(portletDataContext.getScopeGroupId());

    calendarNameMap.put(LocaleUtil.getDefault(), scopeGroup.getName());

    return calendarNameMap;
  }
コード例 #6
0
  protected String getResults(HttpServletRequest request) throws Exception {

    String xml = StringUtil.read(request.getInputStream());

    String documentName = null;

    int beginPos = xml.lastIndexOf("<document>");
    int endPos = xml.lastIndexOf("</document>");

    if (beginPos != -1) {
      documentName = xml.substring(beginPos + 10, endPos);

      documentName = HttpUtil.decodeURL(documentName);
    }

    String path = documentName;

    int pos = documentName.lastIndexOf("sharepoint/");

    if (pos != -1) {
      path = path.substring(pos + 11);
    }

    Group group = GroupServiceUtil.getGroup(SharepointUtil.getGroupId(path));

    boolean minimal = false;

    beginPos = xml.lastIndexOf("<minimal>");
    endPos = xml.lastIndexOf("</minimal>");

    if (beginPos != -1) {
      minimal = GetterUtil.getBoolean(xml.substring(beginPos + 9, endPos));
    }

    Document doc = SAXReaderUtil.createDocument();

    Element root = doc.addElement("Results");

    String url = "http://" + request.getLocalAddr() + ":" + request.getServerPort() + "/sharepoint";

    root.addElement("SubscribeUrl").setText(url);
    root.addElement("MtgInstance");
    root.addElement("SettingUrl").setText(url);
    root.addElement("PermsUrl").setText(url);
    root.addElement("UserInfoUrl").setText(url);

    Element rolesEl = root.addElement("Roles");

    List<Role> roles = RoleLocalServiceUtil.getRoles(PortalUtil.getCompanyId(request));

    for (Role role : roles) {
      ResponseElement responseElement = new RoleResponseElement(role);

      responseElement.addElement(rolesEl);
    }

    if (!minimal) {
      Element schemaEl = root.addElement("Schema");

      schemaEl.addAttribute("Name", "Documents");
      schemaEl.addAttribute("Url", group.getName());

      Element fieldEl = schemaEl.addElement("Field");

      fieldEl.addAttribute("Name", "FileLeafRef");
      fieldEl.addAttribute("Required", "true");
      fieldEl.addAttribute("Type", "Invalid");

      fieldEl.addElement("Choices");

      fieldEl = schemaEl.addElement("Field");

      fieldEl.addAttribute("Name", "_SourceUrl");
      fieldEl.addAttribute("Required", "false");
      fieldEl.addAttribute("Type", "Text");

      fieldEl.addElement("Choices");

      fieldEl = schemaEl.addElement("Field");

      fieldEl.addAttribute("Name", "_SharedFileIndex");
      fieldEl.addAttribute("Required", "false");
      fieldEl.addAttribute("Type", "Text");

      fieldEl.addElement("Choices");

      fieldEl = schemaEl.addElement("Field");

      fieldEl.addAttribute("Name", "Order");
      fieldEl.addAttribute("Required", "false");
      fieldEl.addAttribute("Type", "Number");

      fieldEl.addElement("Choices");

      fieldEl = schemaEl.addElement("Field");

      fieldEl.addAttribute("Name", "Title");
      fieldEl.addAttribute("Required", "false");
      fieldEl.addAttribute("Type", "Text");

      fieldEl.addElement("Choices");

      Element listInfoEl = root.addElement("ListInfo");

      listInfoEl.addAttribute("Name", "Links");

      listInfoEl.addElement("Moderated").setText(String.valueOf(false));

      Element listPermissionsEl = listInfoEl.addElement("ListPermissions");

      listPermissionsEl.addElement("DeleteListItems");
      listPermissionsEl.addElement("EditListItems");
      listPermissionsEl.addElement("InsertListItems");
      listPermissionsEl.addElement("ManageRoles");
      listPermissionsEl.addElement("ManageWeb");
    }

    Element permissionsEl = root.addElement("Permissions");

    if (!minimal) {
      permissionsEl.addElement("DeleteListItems");
      permissionsEl.addElement("EditListItems");
      permissionsEl.addElement("InsertListItems");
      permissionsEl.addElement("ManageRoles");
      permissionsEl.addElement("ManageWeb");
    }

    root.addElement("HasUniquePerm").setText(String.valueOf(true));
    root.addElement("WorkspaceType").setText("DWS");
    root.addElement("IsADMode").setText(String.valueOf(false));
    root.addElement("DocUrl").setText(documentName);
    root.addElement("Minimal").setText(String.valueOf(true));

    Element resultsEl = root.addElement("Results");

    resultsEl.addElement("Title").setText(group.getName());
    resultsEl.addElement("LastUpdate");

    User user = (User) request.getSession().getAttribute(WebKeys.USER);

    ResponseElement responseElement = new MemberResponseElement(user, false);

    responseElement.addElement(resultsEl);

    Element membersEl = resultsEl.addElement("Members");

    List<User> users = UserLocalServiceUtil.getGroupUsers(group.getGroupId());

    for (User member : users) {
      responseElement = new MemberResponseElement(member, true);

      responseElement.addElement(membersEl);
    }

    if (!minimal) {
      Element assigneesEl = resultsEl.addElement("Assignees");

      for (User member : users) {
        responseElement = new MemberResponseElement(member, true);

        responseElement.addElement(assigneesEl);
      }

      Element listEl = resultsEl.addElement("List");

      listEl.addAttribute("Name", "Documents");

      listEl.addElement("ID");

      String parentFolderPath = path;

      pos = parentFolderPath.lastIndexOf("/");

      if (pos != -1) {
        parentFolderPath = parentFolderPath.substring(0, pos);
      }

      SharepointStorage storage = SharepointUtil.getStorage(parentFolderPath);

      SharepointRequest sharepointRequest = new SharepointRequest(parentFolderPath);

      storage.addDocumentElements(sharepointRequest, listEl);
    }

    return doc.asXML();
  }
コード例 #7
0
  protected Object[] updateGroup(ActionRequest actionRequest) throws Exception {

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

    long userId = PortalUtil.getUserId(actionRequest);

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

    long parentGroupId =
        ParamUtil.getLong(
            actionRequest,
            "parentGroupSearchContainerPrimaryKeys",
            GroupConstants.DEFAULT_PARENT_GROUP_ID);
    String name = null;
    String description = null;
    int type = 0;
    String friendlyURL = null;
    boolean active = false;

    ServiceContext serviceContext =
        ServiceContextFactory.getInstance(Group.class.getName(), actionRequest);

    Group liveGroup = null;
    String oldFriendlyURL = null;
    String oldStagingFriendlyURL = null;

    if (liveGroupId <= 0) {

      // Add group

      name = ParamUtil.getString(actionRequest, "name");
      description = ParamUtil.getString(actionRequest, "description");
      type = ParamUtil.getInteger(actionRequest, "type");
      friendlyURL = ParamUtil.getString(actionRequest, "friendlyURL");
      active = ParamUtil.getBoolean(actionRequest, "active");

      liveGroup =
          GroupServiceUtil.addGroup(
              parentGroupId,
              GroupConstants.DEFAULT_LIVE_GROUP_ID,
              name,
              description,
              type,
              friendlyURL,
              true,
              active,
              serviceContext);

      LiveUsers.joinGroup(themeDisplay.getCompanyId(), liveGroup.getGroupId(), userId);
    } else {

      // Update group

      liveGroup = GroupLocalServiceUtil.getGroup(liveGroupId);

      oldFriendlyURL = liveGroup.getFriendlyURL();

      name = ParamUtil.getString(actionRequest, "name", liveGroup.getName());
      description = ParamUtil.getString(actionRequest, "description", liveGroup.getDescription());
      type = ParamUtil.getInteger(actionRequest, "type", liveGroup.getType());
      friendlyURL = ParamUtil.getString(actionRequest, "friendlyURL", liveGroup.getFriendlyURL());
      active = ParamUtil.getBoolean(actionRequest, "active", liveGroup.getActive());

      liveGroup =
          GroupServiceUtil.updateGroup(
              liveGroupId,
              parentGroupId,
              name,
              description,
              type,
              friendlyURL,
              active,
              serviceContext);

      if (type == GroupConstants.TYPE_SITE_OPEN) {
        List<MembershipRequest> membershipRequests =
            MembershipRequestLocalServiceUtil.search(
                liveGroupId,
                MembershipRequestConstants.STATUS_PENDING,
                QueryUtil.ALL_POS,
                QueryUtil.ALL_POS);

        for (MembershipRequest membershipRequest : membershipRequests) {
          MembershipRequestServiceUtil.updateStatus(
              membershipRequest.getMembershipRequestId(),
              themeDisplay.translate("your-membership-has-been-approved"),
              MembershipRequestConstants.STATUS_APPROVED,
              serviceContext);

          LiveUsers.joinGroup(
              themeDisplay.getCompanyId(),
              membershipRequest.getGroupId(),
              new long[] {membershipRequest.getUserId()});
        }
      }
    }

    // Settings

    UnicodeProperties typeSettingsProperties = liveGroup.getTypeSettingsProperties();

    String customJspServletContextName =
        ParamUtil.getString(
            actionRequest,
            "customJspServletContextName",
            typeSettingsProperties.getProperty("customJspServletContextName"));

    typeSettingsProperties.setProperty("customJspServletContextName", customJspServletContextName);

    typeSettingsProperties.setProperty(
        "defaultSiteRoleIds",
        ListUtil.toString(getRoles(actionRequest), Role.ROLE_ID_ACCESSOR, StringPool.COMMA));
    typeSettingsProperties.setProperty(
        "defaultTeamIds",
        ListUtil.toString(getTeams(actionRequest), Team.TEAM_ID_ACCESSOR, StringPool.COMMA));

    String[] analyticsTypes =
        PrefsPropsUtil.getStringArray(
            themeDisplay.getCompanyId(), PropsKeys.ADMIN_ANALYTICS_TYPES, StringPool.NEW_LINE);

    for (String analyticsType : analyticsTypes) {
      if (analyticsType.equalsIgnoreCase("google")) {
        String googleAnalyticsId =
            ParamUtil.getString(
                actionRequest,
                "googleAnalyticsId",
                typeSettingsProperties.getProperty("googleAnalyticsId"));

        typeSettingsProperties.setProperty("googleAnalyticsId", googleAnalyticsId);
      } else {
        String analyticsScript =
            ParamUtil.getString(
                actionRequest,
                SitesUtil.ANALYTICS_PREFIX + analyticsType,
                typeSettingsProperties.getProperty(analyticsType));

        typeSettingsProperties.setProperty(
            SitesUtil.ANALYTICS_PREFIX + analyticsType, analyticsScript);
      }
    }

    String publicRobots =
        ParamUtil.getString(
            actionRequest, "publicRobots", liveGroup.getTypeSettingsProperty("false-robots.txt"));
    String privateRobots =
        ParamUtil.getString(
            actionRequest, "privateRobots", liveGroup.getTypeSettingsProperty("true-robots.txt"));

    typeSettingsProperties.setProperty("false-robots.txt", publicRobots);
    typeSettingsProperties.setProperty("true-robots.txt", privateRobots);

    int trashEnabled =
        ParamUtil.getInteger(
            actionRequest,
            "trashEnabled",
            GetterUtil.getInteger(typeSettingsProperties.getProperty("trashEnabled")));

    typeSettingsProperties.setProperty("trashEnabled", String.valueOf(trashEnabled));

    int trashEntriesMaxAgeCompany =
        PrefsPropsUtil.getInteger(themeDisplay.getCompanyId(), PropsKeys.TRASH_ENTRIES_MAX_AGE);

    int defaultTrashEntriesMaxAgeGroup =
        GetterUtil.getInteger(
            typeSettingsProperties.getProperty("trashEntriesMaxAge"), trashEntriesMaxAgeCompany);

    int trashEntriesMaxAgeGroup =
        ParamUtil.getInteger(actionRequest, "trashEntriesMaxAge", defaultTrashEntriesMaxAgeGroup);

    if (trashEntriesMaxAgeGroup != trashEntriesMaxAgeCompany) {
      typeSettingsProperties.setProperty(
          "trashEntriesMaxAge", String.valueOf(trashEntriesMaxAgeGroup));
    } else {
      typeSettingsProperties.remove("trashEntriesMaxAge");
    }

    // Virtual hosts

    LayoutSet publicLayoutSet = liveGroup.getPublicLayoutSet();

    String publicVirtualHost =
        ParamUtil.getString(
            actionRequest, "publicVirtualHost", publicLayoutSet.getVirtualHostname());

    LayoutSetServiceUtil.updateVirtualHost(liveGroup.getGroupId(), false, publicVirtualHost);

    LayoutSet privateLayoutSet = liveGroup.getPrivateLayoutSet();

    String privateVirtualHost =
        ParamUtil.getString(
            actionRequest, "privateVirtualHost", privateLayoutSet.getVirtualHostname());

    LayoutSetServiceUtil.updateVirtualHost(liveGroup.getGroupId(), true, privateVirtualHost);

    // Staging

    if (liveGroup.hasStagingGroup()) {
      Group stagingGroup = liveGroup.getStagingGroup();

      oldStagingFriendlyURL = stagingGroup.getFriendlyURL();

      friendlyURL =
          ParamUtil.getString(actionRequest, "stagingFriendlyURL", stagingGroup.getFriendlyURL());

      GroupServiceUtil.updateFriendlyURL(stagingGroup.getGroupId(), friendlyURL);

      LayoutSet stagingPublicLayoutSet = stagingGroup.getPublicLayoutSet();

      publicVirtualHost =
          ParamUtil.getString(
              actionRequest,
              "stagingPublicVirtualHost",
              stagingPublicLayoutSet.getVirtualHostname());

      LayoutSetServiceUtil.updateVirtualHost(stagingGroup.getGroupId(), false, publicVirtualHost);

      LayoutSet stagingPrivateLayoutSet = stagingGroup.getPrivateLayoutSet();

      privateVirtualHost =
          ParamUtil.getString(
              actionRequest,
              "stagingPrivateVirtualHost",
              stagingPrivateLayoutSet.getVirtualHostname());

      LayoutSetServiceUtil.updateVirtualHost(stagingGroup.getGroupId(), true, privateVirtualHost);
    }

    liveGroup =
        GroupServiceUtil.updateGroup(liveGroup.getGroupId(), typeSettingsProperties.toString());

    // Layout set prototypes

    if (!liveGroup.isStaged()) {
      long privateLayoutSetPrototypeId =
          ParamUtil.getLong(actionRequest, "privateLayoutSetPrototypeId");
      long publicLayoutSetPrototypeId =
          ParamUtil.getLong(actionRequest, "publicLayoutSetPrototypeId");

      boolean privateLayoutSetPrototypeLinkEnabled =
          ParamUtil.getBoolean(
              actionRequest,
              "privateLayoutSetPrototypeLinkEnabled",
              privateLayoutSet.isLayoutSetPrototypeLinkEnabled());
      boolean publicLayoutSetPrototypeLinkEnabled =
          ParamUtil.getBoolean(
              actionRequest,
              "publicLayoutSetPrototypeLinkEnabled",
              publicLayoutSet.isLayoutSetPrototypeLinkEnabled());

      if ((privateLayoutSetPrototypeId == 0)
          && (publicLayoutSetPrototypeId == 0)
          && !privateLayoutSetPrototypeLinkEnabled
          && !publicLayoutSetPrototypeLinkEnabled) {

        long layoutSetPrototypeId = ParamUtil.getLong(actionRequest, "layoutSetPrototypeId");
        int layoutSetVisibility = ParamUtil.getInteger(actionRequest, "layoutSetVisibility");
        boolean layoutSetPrototypeLinkEnabled =
            ParamUtil.getBoolean(
                actionRequest, "layoutSetPrototypeLinkEnabled", (layoutSetPrototypeId > 0));

        if (layoutSetVisibility == _LAYOUT_SET_VISIBILITY_PRIVATE) {
          privateLayoutSetPrototypeId = layoutSetPrototypeId;

          privateLayoutSetPrototypeLinkEnabled = layoutSetPrototypeLinkEnabled;
        } else {
          publicLayoutSetPrototypeId = layoutSetPrototypeId;

          publicLayoutSetPrototypeLinkEnabled = layoutSetPrototypeLinkEnabled;
        }
      }

      SitesUtil.updateLayoutSetPrototypesLinks(
          liveGroup,
          publicLayoutSetPrototypeId,
          privateLayoutSetPrototypeId,
          publicLayoutSetPrototypeLinkEnabled,
          privateLayoutSetPrototypeLinkEnabled);
    }

    // Staging

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

    long refererPlid = GetterUtil.getLong(HttpUtil.getParameter(redirect, "refererPlid", false));

    if (!privateLayoutSet.isLayoutSetPrototypeLinkActive()
        && !publicLayoutSet.isLayoutSetPrototypeLinkActive()) {

      if ((refererPlid > 0)
          && liveGroup.hasStagingGroup()
          && (themeDisplay.getScopeGroupId() != liveGroup.getGroupId())) {

        Layout firstLayout =
            LayoutLocalServiceUtil.fetchFirstLayout(
                liveGroup.getGroupId(), false, LayoutConstants.DEFAULT_PARENT_LAYOUT_ID);

        if (firstLayout == null) {
          firstLayout =
              LayoutLocalServiceUtil.fetchFirstLayout(
                  liveGroup.getGroupId(), true, LayoutConstants.DEFAULT_PARENT_LAYOUT_ID);
        }

        if (firstLayout != null) {
          refererPlid = firstLayout.getPlid();
        } else {
          refererPlid = 0;
        }
      }

      StagingUtil.updateStaging(actionRequest, liveGroup);
    }

    return new Object[] {liveGroup, oldFriendlyURL, oldStagingFriendlyURL, refererPlid};
  }
コード例 #8
0
  protected void notify(
      long userId, MembershipRequest membershipRequest, String subjectProperty, String bodyProperty)
      throws IOException, PortalException, SystemException {

    Company company = companyPersistence.findByPrimaryKey(membershipRequest.getCompanyId());

    Group group = groupPersistence.findByPrimaryKey(membershipRequest.getGroupId());

    User user = userPersistence.findByPrimaryKey(userId);
    User requestUser = userPersistence.findByPrimaryKey(membershipRequest.getUserId());

    String fromName =
        PrefsPropsUtil.getString(
            membershipRequest.getCompanyId(), PropsKeys.COMMUNITIES_EMAIL_FROM_NAME);

    String fromAddress =
        PrefsPropsUtil.getString(
            membershipRequest.getCompanyId(), PropsKeys.COMMUNITIES_EMAIL_FROM_ADDRESS);

    String toName = user.getFullName();
    String toAddress = user.getEmailAddress();

    String subject = PrefsPropsUtil.getContent(membershipRequest.getCompanyId(), subjectProperty);

    String body = PrefsPropsUtil.getContent(membershipRequest.getCompanyId(), bodyProperty);

    String statusKey = null;

    if (membershipRequest.getStatusId() == MembershipRequestConstants.STATUS_APPROVED) {

      statusKey = "approved";
    } else if (membershipRequest.getStatusId() == MembershipRequestConstants.STATUS_DENIED) {

      statusKey = "denied";
    } else {
      statusKey = "pending";
    }

    subject =
        StringUtil.replace(
            subject,
            new String[] {
              "[$COMMUNITY_NAME$]",
              "[$COMPANY_ID$]",
              "[$COMPANY_MX$]",
              "[$COMPANY_NAME$]",
              "[$FROM_ADDRESS$]",
              "[$FROM_NAME$]",
              "[$PORTAL_URL$]",
              "[$REQUEST_USER_ADDRESS$]",
              "[$REQUEST_USER_NAME$]",
              "[$STATUS$]",
              "[$TO_NAME$]",
              "[$USER_ADDRESS$]",
              "[$USER_NAME$]",
            },
            new String[] {
              group.getName(),
              String.valueOf(company.getCompanyId()),
              company.getMx(),
              company.getName(),
              fromAddress,
              fromName,
              company.getVirtualHost(),
              requestUser.getEmailAddress(),
              requestUser.getFullName(),
              LanguageUtil.get(user.getLocale(), statusKey),
              toName,
              user.getEmailAddress(),
              user.getFullName()
            });

    body =
        StringUtil.replace(
            body,
            new String[] {
              "[$COMMENTS$]",
              "[$COMMUNITY_NAME$]",
              "[$COMPANY_ID$]",
              "[$COMPANY_MX$]",
              "[$COMPANY_NAME$]",
              "[$FROM_ADDRESS$]",
              "[$FROM_NAME$]",
              "[$PORTAL_URL$]",
              "[$REPLY_COMMENTS$]",
              "[$REQUEST_USER_NAME$]",
              "[$REQUEST_USER_ADDRESS$]",
              "[$STATUS$]",
              "[$TO_NAME$]",
              "[$USER_ADDRESS$]",
              "[$USER_NAME$]",
            },
            new String[] {
              membershipRequest.getComments(),
              group.getName(),
              String.valueOf(company.getCompanyId()),
              company.getMx(),
              company.getName(),
              fromAddress,
              fromName,
              company.getVirtualHost(),
              membershipRequest.getReplyComments(),
              requestUser.getFullName(),
              requestUser.getEmailAddress(),
              LanguageUtil.get(user.getLocale(), statusKey),
              toName,
              user.getEmailAddress(),
              user.getFullName()
            });

    InternetAddress from = new InternetAddress(fromAddress, fromName);

    InternetAddress to = new InternetAddress(toAddress, toName);

    MailMessage message = new MailMessage(from, to, subject, body, true);

    mailService.sendEmail(message);
  }