protected SocialActivityFeedEntry doInterpret(SocialActivity activity, ThemeDisplay themeDisplay)
      throws Exception {

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    if (!CalEventPermission.contains(permissionChecker, activity.getClassPK(), ActionKeys.VIEW)) {

      return null;
    }

    String groupName = StringPool.BLANK;

    if (activity.getGroupId() != themeDisplay.getScopeGroupId()) {
      groupName = getGroupName(activity.getGroupId(), themeDisplay);
    }

    String creatorUserName = getUserName(activity.getUserId(), themeDisplay);

    int activityType = activity.getType();

    // Link

    CalEvent event = CalEventLocalServiceUtil.getEvent(activity.getClassPK());

    String link =
        themeDisplay.getPortalURL()
            + themeDisplay.getPathMain()
            + "/calendar/find_event?redirect="
            + themeDisplay.getURLCurrent()
            + "&eventId="
            + activity.getClassPK();

    // Title

    String titlePattern = null;

    if (activityType == CalendarActivityKeys.ADD_EVENT) {
      titlePattern = "activity-calendar-add-event";
    } else if (activityType == CalendarActivityKeys.UPDATE_EVENT) {
      titlePattern = "activity-calendar-update-event";
    }

    if (Validator.isNotNull(groupName)) {
      titlePattern += "-in";
    }

    String eventTitle = wrapLink(link, HtmlUtil.escape(cleanContent(event.getTitle())));

    Object[] titleArguments = new Object[] {groupName, creatorUserName, eventTitle};

    String title = themeDisplay.translate(titlePattern, titleArguments);

    // Body

    String body = StringPool.BLANK;

    return new SocialActivityFeedEntry(link, title, body);
  }
  public SocialActivitySet addActivitySet(long activityId) throws PortalException, SystemException {

    // Activity set

    SocialActivity activity = socialActivityPersistence.findByPrimaryKey(activityId);

    long activitySetId = counterLocalService.increment();

    SocialActivitySet activitySet = socialActivitySetPersistence.create(activitySetId);

    activitySet.setGroupId(activity.getGroupId());
    activitySet.setCompanyId(activity.getCompanyId());
    activitySet.setUserId(activity.getUserId());
    activitySet.setCreateDate(activity.getCreateDate());
    activitySet.setModifiedDate(activity.getCreateDate());
    activitySet.setClassName(activity.getClassName());
    activitySet.setClassPK(activity.getClassPK());
    activitySet.setType(activity.getType());
    activitySet.setActivityCount(1);

    socialActivitySetPersistence.update(activitySet);

    // Activity

    activity.setActivitySetId(activitySetId);

    socialActivityPersistence.update(activity);

    return activitySet;
  }
  protected Activity getActivity(ThemeDisplay themeDisplay, SocialActivity socialActivity)
      throws Exception {

    Activity activity = null;

    String className = socialActivity.getClassName();

    if (className.equals(Activity.class.getName())) {
      activity = getExternalActivity(socialActivity);
    } else {
      activity =
          new ActivityImpl(
              String.valueOf(socialActivity.getClassPK()),
              String.valueOf(socialActivity.getUserId()));

      HttpServletRequest request = HttpServletRequestThreadLocal.getHttpServletRequest();

      request.setAttribute(WebKeys.THEME_DISPLAY, themeDisplay);

      ServiceContext serviceContext = ServiceContextFactory.getInstance(request);

      serviceContext.setCompanyId(themeDisplay.getCompanyId());
      serviceContext.setUserId(themeDisplay.getUserId());

      SocialActivityFeedEntry socialActivityFeedEntry = null;
      SocialActivityInterpreterLocalServiceUtil.interpret(
          StringPool.BLANK, socialActivity, serviceContext);

      activity.setBody(socialActivityFeedEntry.getBody());
      activity.setTitle(socialActivityFeedEntry.getTitle());
      activity.setUrl(socialActivityFeedEntry.getLink());
    }

    return activity;
  }
  @Test
  public void testActivityHierarchy() throws Exception {
    AssetEntry parentAssetEntry = SocialActivityTestUtil.addAssetEntry(creatorUser, group);

    SocialActivityHierarchyEntryThreadLocal.push(
        parentAssetEntry.getClassNameId(), parentAssetEntry.getClassPK());

    SocialActivityTestUtil.addActivity(creatorUser, group, assetEntry, 1);

    List<SocialActivity> activities =
        SocialActivityLocalServiceUtil.getGroupActivities(
            group.getGroupId(), QueryUtil.ALL_POS, QueryUtil.ALL_POS);

    Assert.assertEquals(1, activities.size());

    SocialActivity activity = activities.get(0);

    Assert.assertEquals(parentAssetEntry.getClassNameId(), activity.getParentClassNameId());
    Assert.assertEquals(parentAssetEntry.getClassPK(), activity.getParentClassPK());

    SocialActivityTestUtil.addActivity(
        creatorUser, group, assetEntry, SocialActivityConstants.TYPE_DELETE);

    Assert.assertEquals(
        1, SocialActivityLocalServiceUtil.getGroupActivitiesCount(group.getGroupId()));
  }
  protected void lockProtectedGetActivityLimit(
      final long groupId,
      final User user,
      final SocialActivity activity,
      final SocialActivityCounterDefinition activityCounterDefinition)
      throws PortalException {

    final long classPK = getLimitClassPK(activity, activityCounterDefinition);

    String lockKey =
        StringUtil.merge(
            new Object[] {
              groupId,
              user.getUserId(),
              activity.getClassNameId(),
              classPK,
              activity.getType(),
              activityCounterDefinition.getName()
            },
            StringPool.POUND);

    LockProtectedAction<SocialActivityLimit> lockProtectedAction =
        new LockProtectedAction<SocialActivityLimit>(
            SocialActivityLimit.class,
            lockKey,
            PropsValues.SOCIAL_ACTIVITY_LOCK_TIMEOUT,
            PropsValues.SOCIAL_ACTIVITY_LOCK_RETRY_DELAY) {

          @Override
          protected SocialActivityLimit performProtectedAction() throws PortalException {

            SocialActivityLimit activityLimit =
                socialActivityLimitPersistence.fetchByG_U_C_C_A_A(
                    groupId,
                    user.getUserId(),
                    activity.getClassNameId(),
                    classPK,
                    activity.getType(),
                    activityCounterDefinition.getName());

            if (activityLimit == null) {
              activityLimit =
                  socialActivityLimitLocalService.addActivityLimit(
                      user.getUserId(),
                      activity.getGroupId(),
                      activity.getClassNameId(),
                      classPK,
                      activity.getType(),
                      activityCounterDefinition.getName(),
                      activityCounterDefinition.getLimitPeriod());
            }

            return activityLimit;
          }
        };

    lockProtectedAction.performAction();

    socialActivityLimitPersistence.cacheResult(lockProtectedAction.getReturnValue());
  }
  /**
   * Removes the user's stored activities from the database.
   *
   * <p>This method removes all activities where the user is either the actor or the receiver.
   *
   * @param userId the primary key of the user
   * @throws PortalException if the user's activity counters could not be deleted
   */
  @Override
  public void deleteUserActivities(long userId) throws PortalException {
    List<SocialActivity> activities =
        socialActivityPersistence.findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS);

    for (SocialActivity activity : activities) {
      if (PropsValues.SOCIAL_ACTIVITY_SETS_ENABLED) {
        socialActivitySetLocalService.decrementActivityCount(activity.getActivitySetId());
      }

      socialActivityPersistence.remove(activity);
    }

    activities =
        socialActivityPersistence.findByReceiverUserId(
            userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS);

    for (SocialActivity activity : activities) {
      if (PropsValues.SOCIAL_ACTIVITY_SETS_ENABLED) {
        socialActivitySetLocalService.decrementActivityCount(activity.getActivitySetId());
      }

      socialActivityPersistence.remove(activity);
    }

    socialActivityCounterLocalService.deleteActivityCounters(User.class.getName(), userId);
  }
  protected SocialActivityCounter addUserActivitiesCounter(SocialActivity activity)
      throws PortalException {

    User user = userPersistence.findByPrimaryKey(activity.getUserId());

    return addActivityCounter(
        activity.getGroupId(), user, activity, _userActivitiesActivityCounterDefinition);
  }
  protected SocialActivityCounter addActivityCounter(
      final long groupId,
      final User user,
      final SocialActivity activity,
      final SocialActivityCounterDefinition activityCounterDefinition)
      throws PortalException {

    int ownerType = activityCounterDefinition.getOwnerType();

    long classNameId = getClassNameId(activity.getAssetEntry(), ownerType);
    long classPK = getClassPK(user, activity.getAssetEntry(), ownerType);

    SocialActivityCounter activityCounter =
        fetchLatestActivityCounter(
            groupId, classNameId, classPK, activityCounterDefinition.getName(), ownerType);

    if (activityCounter == null) {
      activityCounter =
          lockProtectedAddActivityCounter(
              groupId,
              classNameId,
              classPK,
              activityCounterDefinition.getName(),
              ownerType,
              0,
              0,
              activityCounterDefinition.getPeriodLength());
    } else if (!activityCounter.isActivePeriod(activityCounterDefinition.getPeriodLength())) {

      activityCounter =
          lockProtectedAddActivityCounter(
              groupId,
              classNameId,
              classPK,
              activityCounterDefinition.getName(),
              ownerType,
              activityCounter.getTotalValue(),
              activityCounter.getActivityCounterId(),
              activityCounterDefinition.getPeriodLength());
    }

    if (activityCounterDefinition.getLimitValue() > 0) {
      SocialActivityLimit activityLimit =
          socialActivityLimitPersistence.fetchByG_U_C_C_A_A(
              groupId,
              user.getUserId(),
              activity.getClassNameId(),
              getLimitClassPK(activity, activityCounterDefinition),
              activity.getType(),
              activityCounterDefinition.getName());

      if (activityLimit == null) {
        lockProtectedGetActivityLimit(groupId, user, activity, activityCounterDefinition);
      }
    }

    return activityCounter;
  }
  public void decrementActivityCount(long classNameId, long classPK)
      throws PortalException, SystemException {

    List<SocialActivity> activities = socialActivityPersistence.findByC_C(classNameId, classPK);

    for (SocialActivity activity : activities) {
      decrementActivityCount(activity.getActivitySetId());
    }
  }
  @Override
  protected boolean hasPermissions(
      PermissionChecker permissionChecker,
      SocialActivity activity,
      String actionId,
      ServiceContext serviceContext)
      throws Exception {

    return DLFolderPermission.contains(
        permissionChecker, activity.getGroupId(), activity.getClassPK(), actionId);
  }
  protected Activity getExternalActivity(SocialActivity socialActivity) throws Exception {

    Activity activity =
        new ActivityImpl(
            String.valueOf(socialActivity.getClassPK()),
            String.valueOf(socialActivity.getUserId()));

    JSONObject extraDataJSONObject =
        JSONFactoryUtil.createJSONObject(socialActivity.getExtraData());

    SerializerUtil.copyProperties(extraDataJSONObject, activity, _ACTIVITY_FIELDS);

    return activity;
  }
  /**
   * Removes the stored activity and its mirror activity from the database.
   *
   * @param activity the activity to be removed
   * @throws PortalException if the user's activity counters could not be deleted or if a portal
   *     exception occurred
   */
  @Override
  public void deleteActivity(SocialActivity activity) throws PortalException {
    if (PropsValues.SOCIAL_ACTIVITY_SETS_ENABLED) {
      socialActivitySetLocalService.decrementActivityCount(activity.getActivitySetId());
    }

    socialActivityPersistence.remove(activity);

    SocialActivity mirrorActivity =
        socialActivityPersistence.fetchByMirrorActivityId(activity.getActivityId());

    if (mirrorActivity != null) {
      socialActivityPersistence.remove(mirrorActivity);
    }
  }
  protected boolean hasPermission(
      SocialActivity activity, List<SocialActivityInterpreter> activityInterpreters)
      throws PortalException {

    PermissionChecker permissionChecker = getPermissionChecker();
    ServiceContext serviceContext = new ServiceContext();

    for (int i = 0; i < activityInterpreters.size(); i++) {
      SocialActivityInterpreterImpl activityInterpreterImpl =
          (SocialActivityInterpreterImpl) activityInterpreters.get(i);

      if (activityInterpreterImpl.hasClassName(activity.getClassName())) {
        try {
          if (activityInterpreterImpl.hasPermission(
              permissionChecker, activity, ActionKeys.VIEW, serviceContext)) {

            return true;
          }
        } catch (Exception e) {
        }
      }
    }

    return false;
  }
  @Override
  protected String getTitlePattern(String groupName, SocialActivity activity) {

    int activityType = activity.getType();

    if (activityType == JournalActivityKeys.ADD_ARTICLE) {
      if (Validator.isNull(groupName)) {
        return "activity-journal-article-add-web-content";
      } else {
        return "activity-journal-article-add-web-content-in";
      }
    } else if (activityType == JournalActivityKeys.UPDATE_ARTICLE) {
      if (Validator.isNull(groupName)) {
        return "activity-journal-article-update-web-content";
      } else {
        return "activity-journal-article-update-web-content-in";
      }
    } else if (activityType == SocialActivityConstants.TYPE_MOVE_TO_TRASH) {
      if (Validator.isNull(groupName)) {
        return "activity-journal-article-move-to-trash";
      } else {
        return "activity-journal-article-move-to-trash-in";
      }
    } else if (activityType == SocialActivityConstants.TYPE_RESTORE_FROM_TRASH) {

      if (Validator.isNull(groupName)) {
        return "activity-journal-article-restore-from-trash";
      } else {
        return "activity-journal-article-restore-from-trash-in";
      }
    }

    return null;
  }
Beispiel #15
0
  /**
   * Adds the social activity to the database. Also notifies the appropriate model listeners.
   *
   * @param socialActivity the social activity
   * @return the social activity that was added
   * @throws SystemException if a system exception occurred
   */
  @Indexable(type = IndexableType.REINDEX)
  @Override
  public SocialActivity addSocialActivity(SocialActivity socialActivity) throws SystemException {
    socialActivity.setNew(true);

    return socialActivityPersistence.update(socialActivity);
  }
  /**
   * Removes the stored activity and its mirror activity from the database.
   *
   * @param activity the activity to be removed
   * @throws SystemException if a system exception occurred
   */
  public void deleteActivity(SocialActivity activity) throws SystemException {
    socialActivityPersistence.remove(activity);

    try {
      socialActivityPersistence.removeByMirrorActivityId(activity.getActivityId());
    } catch (NoSuchActivityException nsae) {
    }
  }
  protected SocialActivityFeedEntry doInterpret(SocialActivity activity, ThemeDisplay themeDisplay)
      throws Exception {

    String creatorUserName = getUserName(activity.getUserId(), themeDisplay);
    String receiverUserName = getUserName(activity.getReceiverUserId(), themeDisplay);

    User receiverUser = UserLocalServiceUtil.getUserById(activity.getReceiverUserId());

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

      return null;
    }

    int activityType = activity.getType();

    // Link

    WallEntry wallEntry = WallEntryLocalServiceUtil.getWallEntry(activity.getClassPK());

    String link =
        themeDisplay.getPortalURL()
            + themeDisplay.getPathFriendlyURLPublic()
            + StringPool.SLASH
            + HtmlUtil.escapeURL(receiverUser.getScreenName())
            + "/profile/-/wall/"
            + activity.getClassPK();

    // Title

    String title = StringPool.BLANK;

    if (activityType == WallActivityKeys.ADD_ENTRY) {
      title =
          themeDisplay.translate(
              "activity-social-networking-wall-add-entry",
              new Object[] {creatorUserName, receiverUserName});
    }

    // Body

    StringBuilder sb = new StringBuilder();

    sb.append("<a href=\"");
    sb.append(link);
    sb.append("\">");
    sb.append(HtmlUtil.escape(cleanContent(wallEntry.getComments())));
    sb.append("</a>");

    String body = sb.toString();

    return new SocialActivityFeedEntry(link, title, body);
  }
  @Override
  protected SocialActivityFeedEntry doInterpret(SocialActivity activity, ThemeDisplay themeDisplay)
      throws Exception {

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    if (!WikiPagePermission.contains(permissionChecker, activity.getClassPK(), ActionKeys.VIEW)) {

      return null;
    }

    String groupName = StringPool.BLANK;

    if (activity.getGroupId() != themeDisplay.getScopeGroupId()) {
      groupName = getGroupName(activity.getGroupId(), themeDisplay);
    }

    String creatorUserName = getUserName(activity.getUserId(), themeDisplay);

    int activityType = activity.getType();

    // Link

    WikiPageResource pageResource =
        WikiPageResourceLocalServiceUtil.getPageResource(activity.getClassPK());

    String link =
        themeDisplay.getPortalURL()
            + themeDisplay.getPathMain()
            + "/wiki/find_page?pageResourcePrimKey="
            + activity.getClassPK();

    // Title

    String titlePattern = null;

    if (activityType == WikiActivityKeys.ADD_PAGE) {
      titlePattern = "activity-wiki-add-page";
    } else if (activityType == WikiActivityKeys.UPDATE_PAGE) {
      titlePattern = "activity-wiki-update-page";
    }

    if (Validator.isNotNull(groupName)) {
      titlePattern += "-in";
    }

    String pageTitle = wrapLink(link, HtmlUtil.escape(cleanContent(pageResource.getTitle())));

    Object[] titleArguments = new Object[] {groupName, creatorUserName, pageTitle};

    String title = themeDisplay.translate(titlePattern, titleArguments);

    // Body

    String body = StringPool.BLANK;

    return new SocialActivityFeedEntry(link, title, body);
  }
  @Override
  public boolean equals(Object obj) {
    if (this == obj) {
      return true;
    }

    if (!(obj instanceof SocialActivity)) {
      return false;
    }

    SocialActivity socialActivity = (SocialActivity) obj;

    long primaryKey = socialActivity.getPrimaryKey();

    if (getPrimaryKey() == primaryKey) {
      return true;
    } else {
      return false;
    }
  }
  @Override
  public int compareTo(SocialActivity socialActivity) {
    int value = 0;

    if (getCreateDate() < socialActivity.getCreateDate()) {
      value = -1;
    } else if (getCreateDate() > socialActivity.getCreateDate()) {
      value = 1;
    } else {
      value = 0;
    }

    value = value * -1;

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

    return 0;
  }
  protected long getLimitClassPK(
      SocialActivity activity, SocialActivityCounterDefinition activityCounterDefinition) {

    String name = activityCounterDefinition.getName();

    if (name.equals(SocialActivityCounterConstants.NAME_PARTICIPATION)) {
      return 0;
    }

    return activity.getClassPK();
  }
  public void incrementActivityCount(long activitySetId, long activityId)
      throws PortalException, SystemException {

    // Activity set

    SocialActivitySet activitySet = socialActivitySetPersistence.findByPrimaryKey(activitySetId);

    SocialActivity activity = socialActivityPersistence.findByPrimaryKey(activityId);

    activitySet.setModifiedDate(activity.getCreateDate());

    activitySet.setActivityCount(activitySet.getActivityCount() + 1);

    socialActivitySetPersistence.update(activitySet);

    // Activity

    activity.setActivitySetId(activitySetId);

    socialActivityPersistence.update(activity);
  }
  @Override
  protected boolean hasPermissions(
      PermissionChecker permissionChecker,
      SocialActivity activity,
      String actionId,
      ServiceContext serviceContext)
      throws Exception {

    int activityType = activity.getType();

    if (activityType == JournalActivityKeys.ADD_ARTICLE) {
      JournalArticle article = _journalArticleLocalService.getLatestArticle(activity.getClassPK());

      return JournalFolderPermission.contains(
          permissionChecker, article.getGroupId(), article.getFolderId(), ActionKeys.ADD_ARTICLE);
    } else if (activityType == JournalActivityKeys.UPDATE_ARTICLE) {
      return JournalArticlePermission.contains(
          permissionChecker, activity.getClassPK(), ActionKeys.UPDATE);
    }

    return JournalArticlePermission.contains(permissionChecker, activity.getClassPK(), actionId);
  }
  @Override
  protected String getTitlePattern(String groupName, SocialActivity activity) throws Exception {

    String titlePattern = StringPool.BLANK;

    if (activity.getType() == SocialActivityKeyConstants.DL_ADD_FILE_ENTRY) {

      titlePattern = "uploaded-a-new-document";
    } else if (activity.getType() == SocialActivityKeyConstants.DL_UPDATE_FILE_ENTRY) {

      titlePattern = "updated-a-document";
    } else {
      return StringPool.BLANK;
    }

    FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(activity.getClassPK());

    if (fileEntry.getFolderId() > 0) {
      titlePattern = titlePattern.concat("-in-the-x-folder");
    }

    return titlePattern;
  }
  protected void importSocialActivity(SocialActivity socialActivity, long calendarBookingId)
      throws SystemException {

    addSocialActivity(
        counterLocalService.increment(SocialActivity.class.getName()),
        socialActivity.getGroupId(),
        socialActivity.getCompanyId(),
        socialActivity.getUserId(),
        socialActivity.getCreateDate(),
        socialActivity.getMirrorActivityId(),
        classNameLocalService.getClassNameId(CalendarBooking.class),
        calendarBookingId,
        socialActivity.getType(),
        socialActivity.getExtraData(),
        socialActivity.getReceiverUserId());
  }
  protected boolean checkActivityLimit(
      User user, SocialActivity activity, SocialActivityCounterDefinition activityCounterDefinition)
      throws PortalException {

    if (activityCounterDefinition.getLimitValue() == 0) {
      return true;
    }

    long classPK = activity.getClassPK();

    String name = activityCounterDefinition.getName();

    if (name.equals(SocialActivityCounterConstants.NAME_PARTICIPATION)) {
      classPK = 0;
    }

    SocialActivityLimit activityLimit =
        socialActivityLimitPersistence.findByG_U_C_C_A_A(
            activity.getGroupId(),
            user.getUserId(),
            activity.getClassNameId(),
            classPK,
            activity.getType(),
            name);

    int count = activityLimit.getCount(activityCounterDefinition.getLimitPeriod());

    if (count < activityCounterDefinition.getLimitValue()) {
      activityLimit.setCount(activityCounterDefinition.getLimitPeriod(), count + 1);

      socialActivityLimitPersistence.update(activityLimit);

      return true;
    }

    return false;
  }
  @Override
  protected Object[] getTitleArguments(
      String groupName,
      SocialActivity activity,
      String link,
      String title,
      ServiceContext serviceContext)
      throws Exception {

    String folderLink = getFolderLink(activity.getClassPK(), serviceContext);

    if (Validator.isNull(folderLink)) {
      return null;
    }

    return new Object[] {folderLink};
  }
  @Async
  public void addActivity(SocialActivity activity, SocialActivity mirrorActivity)
      throws PortalException, SystemException {

    if (ImportExportThreadLocal.isImportInProcess()) {
      return;
    }

    if ((activity.getActivityId() > 0)
        || ((mirrorActivity != null) && (mirrorActivity.getActivityId() > 0))) {

      throw new PortalException("Activity and mirror activity must not have primary keys set");
    }

    SocialActivityDefinition activityDefinition =
        socialActivitySettingLocalService.getActivityDefinition(
            activity.getGroupId(), activity.getClassName(), activity.getType());

    if ((activityDefinition == null) || activityDefinition.isLogActivity()) {

      long activityId = counterLocalService.increment(SocialActivity.class.getName());

      activity.setActivityId(activityId);

      socialActivityPersistence.update(activity, false);

      if (mirrorActivity != null) {
        long mirrorActivityId = counterLocalService.increment(SocialActivity.class.getName());

        mirrorActivity.setActivityId(mirrorActivityId);
        mirrorActivity.setMirrorActivityId(activity.getPrimaryKey());

        socialActivityPersistence.update(mirrorActivity, false);
      }
    }

    socialActivityCounterLocalService.addActivityCounters(activity);
  }
  @Override
  protected String getPath(SocialActivity activity, ServiceContext serviceContext)
      throws Exception {

    JournalArticle article = _journalArticleLocalService.getLatestArticle(activity.getClassPK());

    Layout layout = article.getLayout();

    if (layout != null) {
      String groupFriendlyURL =
          PortalUtil.getGroupFriendlyURL(layout.getLayoutSet(), serviceContext.getThemeDisplay());

      return groupFriendlyURL
          .concat(JournalArticleConstants.CANONICAL_URL_SEPARATOR)
          .concat(article.getUrlTitle());
    }

    return null;
  }
  @Override
  protected String getTitlePattern(String groupName, SocialActivity activity) {

    int activityType = activity.getType();

    if (activityType == SocialActivityConstants.TYPE_MOVE_TO_TRASH) {
      if (Validator.isNull(groupName)) {
        return "activity-document-library-folder-move-to-trash";
      } else {
        return "activity-document-library-folder-move-to-trash-in";
      }
    } else if (activityType == SocialActivityConstants.TYPE_RESTORE_FROM_TRASH) {

      if (Validator.isNull(groupName)) {
        return "activity-document-library-folder-restore-from-trash";
      } else {
        return "activity-document-library-folder-restore-from-trash-" + "in";
      }
    }

    return null;
  }