Class DynamicQueryUADAnonymizer<T extends com.liferay.portal.kernel.model.BaseModel>

java.lang.Object
com.liferay.user.associated.data.anonymizer.DynamicQueryUADAnonymizer<T>
All Implemented Interfaces:
UADAnonymizer<T>, UADComponent<T>

public abstract class DynamicQueryUADAnonymizer<T extends com.liferay.portal.kernel.model.BaseModel> extends Object implements UADAnonymizer<T>
Provides the base implementation of UADAnonymizer for entities created using Service Builder. The count and batch actions are based on ActionableDynamicQuery, which is available in the service for the type T entity.
  • Constructor Details

    • DynamicQueryUADAnonymizer

      public DynamicQueryUADAnonymizer()
  • Method Details

    • autoAnonymizeAll

      public void autoAnonymizeAll(long userId, com.liferay.portal.kernel.model.User anonymousUser) throws com.liferay.portal.kernel.exception.PortalException
      Description copied from interface: UADAnonymizer
      Performs anonymization on all entities of type T related to the user. This method is responsible for retrieving the relevant entities, performing anonymization, and persisting the changes.
      Specified by:
      autoAnonymizeAll in interface UADAnonymizer<T extends com.liferay.portal.kernel.model.BaseModel>
      Parameters:
      userId - the primary key of the user whose data is being anonymized
      anonymousUser - the company's anonymous user
      Throws:
      com.liferay.portal.kernel.exception.PortalException - if the persistence threw an exception
    • count

      public long count(long userId) throws com.liferay.portal.kernel.exception.PortalException
      Description copied from interface: UADAnonymizer
      Returns the number of type T entities associated with the user.
      Specified by:
      count in interface UADAnonymizer<T extends com.liferay.portal.kernel.model.BaseModel>
      Parameters:
      userId - the primary key of the user whose data to count
      Returns:
      the number of entities associated with the user
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • deleteAll

      public void deleteAll(long userId) throws com.liferay.portal.kernel.exception.PortalException
      Description copied from interface: UADAnonymizer
      Deletes all type T entities related to the user from the database.
      Specified by:
      deleteAll in interface UADAnonymizer<T extends com.liferay.portal.kernel.model.BaseModel>
      Parameters:
      userId - the primary key of the user whose data to delete
      Throws:
      com.liferay.portal.kernel.exception.PortalException - if a portal exception occurred
    • doGetActionableDynamicQuery

      protected abstract com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery doGetActionableDynamicQuery()
      Returns an ActionableDynamicQuery for type T. This can be retrieved from the service.
      Returns:
      an ActionableDynamicQuery for type T
    • doGetUserIdFieldNames

      protected abstract String[] doGetUserIdFieldNames()
      Returns the names identifying fields on the type T entity that contain the primary key of a user.
      Returns:
      the fields that may contain the primary key of a user
    • getActionableDynamicQuery

      protected com.liferay.portal.kernel.dao.orm.ActionableDynamicQuery getActionableDynamicQuery(long userId)
      Returns an ActionableDynamicQuery for type T. It should be populated with criteria and ready for use by the service.
      Parameters:
      userId - the primary key of the user to pre-filter the ActionableDynamicQuery
      Returns:
      a pre-filtered ActionableDynamicQuery