Skip to content

Commit

Permalink
LPS-34887 Fixing logic in SocialActivity, need to decrement activity …
Browse files Browse the repository at this point in the history
…count before persist
  • Loading branch information
johnnyhowey authored and brianchandotcom committed May 1, 2013
1 parent 270010b commit eaa6f44
Showing 1 changed file with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,15 @@ userId, groupId, new Date(), className, classPK, type, extraData,
public void deleteActivities(AssetEntry assetEntry)
throws PortalException, SystemException {

socialActivityPersistence.removeByC_C(
assetEntry.getClassNameId(), assetEntry.getClassPK());

socialActivityCounterLocalService.deleteActivityCounters(assetEntry);

if (PropsValues.SOCIAL_ACTIVITY_SETS_ENABLED) {
socialActivitySetLocalService.decrementActivityCount(
assetEntry.getClassNameId(), assetEntry.getClassPK());
}

socialActivityPersistence.removeByC_C(
assetEntry.getClassNameId(), assetEntry.getClassPK());

socialActivityCounterLocalService.deleteActivityCounters(assetEntry);
}

/**
Expand All @@ -365,12 +365,12 @@ public void deleteActivities(String className, long classPK)

long classNameId = PortalUtil.getClassNameId(className);

socialActivityPersistence.removeByC_C(classNameId, classPK);

if (PropsValues.SOCIAL_ACTIVITY_SETS_ENABLED) {
socialActivitySetLocalService.decrementActivityCount(
classNameId, classPK);
}

socialActivityPersistence.removeByC_C(classNameId, classPK);
}

/**
Expand Down Expand Up @@ -398,6 +398,11 @@ public void deleteActivity(long activityId)
public void deleteActivity(SocialActivity activity)
throws PortalException, SystemException {

if (PropsValues.SOCIAL_ACTIVITY_SETS_ENABLED) {
socialActivitySetLocalService.decrementActivityCount(
activity.getActivitySetId());
}

socialActivityPersistence.remove(activity);

try {
Expand All @@ -406,11 +411,6 @@ public void deleteActivity(SocialActivity activity)
}
catch (NoSuchActivityException nsae) {
}

if (PropsValues.SOCIAL_ACTIVITY_SETS_ENABLED) {
socialActivitySetLocalService.decrementActivityCount(
activity.getActivitySetId());
}
}

/**
Expand All @@ -434,24 +434,24 @@ public void deleteUserActivities(long userId)
userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS);

for (SocialActivity activity : activities) {
socialActivityPersistence.remove(activity);

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) {
socialActivityPersistence.remove(activity);

if (PropsValues.SOCIAL_ACTIVITY_SETS_ENABLED) {
socialActivitySetLocalService.decrementActivityCount(
activity.getActivitySetId());
}

socialActivityPersistence.remove(activity);
}

socialActivityCounterLocalService.deleteActivityCounters(
Expand Down

0 comments on commit eaa6f44

Please sign in to comment.