Interface UADAnonymizer<T>
- Type Parameters:
T
- the entity type to be anonymized or deleted
- All Superinterfaces:
UADComponent<T>
- All Known Implementing Classes:
DynamicQueryUADAnonymizer
Provides a way to retrieve, count, anonymize, and delete type
T
entities for a user. The anonymous user used in the autoAnonymize(T, long, com.liferay.portal.kernel.model.User)
and autoAnonymizeAll(long, com.liferay.portal.kernel.model.User)
methods is the anonymous user defined for a
particular company by AnonymousUserConfiguration
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
autoAnonymize
(T t, long userId, com.liferay.portal.kernel.model.User anonymousUser) Anonymizes the given entity and persists the changes to the database.void
autoAnonymizeAll
(long userId, com.liferay.portal.kernel.model.User anonymousUser) Performs anonymization on all entities of typeT
related to the user.long
count
(long userId) Returns the number of typeT
entities associated with the user.void
Deletes the entity from the database.void
deleteAll
(long userId) Deletes all typeT
entities related to the user from the database.getExceptionMessageMap
(Locale locale) Returns a map of error messages corresponding to exceptions.Methods inherited from interface com.liferay.user.associated.data.component.UADComponent
getTypeClass, getTypeKey
-
Method Details
-
autoAnonymize
void autoAnonymize(T t, long userId, com.liferay.portal.kernel.model.User anonymousUser) throws com.liferay.portal.kernel.exception.PortalException Anonymizes the given entity and persists the changes to the database. The primary key of the user is used to match against different fields on the given entity. The anonymous user is given to provide replacement user-related data, if needed.- Parameters:
t
- the entity to be anonymizeduserId
- the primary key of the user associated with typeT
anonymousUser
- the company's anonymous user- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the persistence threw an exception
-
autoAnonymizeAll
void autoAnonymizeAll(long userId, com.liferay.portal.kernel.model.User anonymousUser) throws com.liferay.portal.kernel.exception.PortalException Performs anonymization on all entities of typeT
related to the user. This method is responsible for retrieving the relevant entities, performing anonymization, and persisting the changes.- Parameters:
userId
- the primary key of the user whose data is being anonymizedanonymousUser
- the company's anonymous user- Throws:
com.liferay.portal.kernel.exception.PortalException
- if the persistence threw an exception
-
count
long count(long userId) throws com.liferay.portal.kernel.exception.PortalException Returns the number of typeT
entities associated with the user.- 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
-
delete
Deletes the entity from the database.- Parameters:
t
- the entity to be deleted- Throws:
com.liferay.portal.kernel.exception.PortalException
- if a portal exception occurred
-
deleteAll
void deleteAll(long userId) throws com.liferay.portal.kernel.exception.PortalException Deletes all typeT
entities related to the user from the database.- Parameters:
userId
- the primary key of the user whose data to delete- Throws:
com.liferay.portal.kernel.exception.PortalException
- if a portal exception occurred
-
getExceptionMessageMap
Returns a map of error messages corresponding to exceptions.- Parameters:
locale
- the locale of the language
-