コード例 #1
0
  @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;
    }
  }
  @Async
  @Override
  public void addActivity(SocialActivity activity, SocialActivity mirrorActivity)
      throws PortalException {

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

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

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

    if (isLogActivity(activity)) {
      long activityId = counterLocalService.increment(SocialActivity.class.getName());

      activity.setActivityId(activityId);

      socialActivityPersistence.update(activity);

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

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

        socialActivityPersistence.update(mirrorActivity);
      }

      if (PropsValues.SOCIAL_ACTIVITY_SETS_ENABLED) {
        socialActivityInterpreterLocalService.updateActivitySet(activity.getActivityId());
      }
    }

    socialActivityCounterLocalService.addActivityCounters(activity);
  }
コード例 #3
0
  @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);
  }