Interface ConstraintResolver<T extends com.liferay.portal.kernel.model.change.tracking.CTModel<T>>
public interface ConstraintResolver<T extends com.liferay.portal.kernel.model.change.tracking.CTModel<T>>
Constraint resolvers are used to automatically resolve unique database
constraints between different change tracking collections, or to describe the
conflict for users attempting to publish.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the language key that describes the conflict.Returns the model class for this constraint resolver.Returns the language key for steps taken (or steps needed) to resolve the unique constraint conflict.getResourceBundle(Locale locale) Returns the resource bundle to use for the conflict description and resolution description keys.String[]Returns an array of column names for the unique index, excluding thectCollectionIdcolumn.voidresolveConflict(ConstraintResolverContext<T> constraintResolverContext) Called when publishing would cause a constraint violation with both rows involved accessible from the context.
-
Method Details
-
getConflictDescriptionKey
String getConflictDescriptionKey()Returns the language key that describes the conflict.- Returns:
- the language key that describes the conflict
-
getModelClass
Returns the model class for this constraint resolver.- Returns:
- the model class for this constraint resolver
-
getResolutionDescriptionKey
String getResolutionDescriptionKey()Returns the language key for steps taken (or steps needed) to resolve the unique constraint conflict.- Returns:
- the language key
-
getResourceBundle
Returns the resource bundle to use for the conflict description and resolution description keys.- Parameters:
locale- the locale for the resource bundle- Returns:
- the resource bundle
- See Also:
-
getUniqueIndexColumnNames
String[] getUniqueIndexColumnNames()Returns an array of column names for the unique index, excluding thectCollectionIdcolumn.- Returns:
- the unique index column names
- See Also:
-
CTPersistence.getUniqueIndexColumnNames()
-
resolveConflict
void resolveConflict(ConstraintResolverContext<T> constraintResolverContext) throws com.liferay.portal.kernel.exception.PortalException Called when publishing would cause a constraint violation with both rows involved accessible from the context. It is not required to resolve the conflict if the goal is only to describe it for the user. This method is always called from the source model's change tracking collection.- Parameters:
constraintResolverContext- the context used in automatically resolving constraint conflicts between the source and target models- Throws:
com.liferay.portal.kernel.exception.PortalException
-