Class RestrictRelationRemovalContribution
java.lang.Object
ch.tocco.nice2.usermanager.impl.businessunit.RestrictRelationRemovalContribution
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@Nullable BiFunction
<Entity, Set<String>, TextMessage> @Nullable BiPredicate
<Relation, Entity> Instead of always restricting the removal of relation X if relation Y is set, this method allows to provide an additional condition that needs to evaluate to true to deny the removal.void
setBlockingRelations
(String blockingRelations) void
setEntityModel
(String entityModel) void
setErrorMessage
(String errorMessage) void
setErrorMessageFormatter
(BiFunction<Entity, Set<String>, TextMessage> errorMessageFormatter) void
setRestrictedRelations
(String restrictedRelations) void
setRestrictPredicate
(BiPredicate<Relation, Entity> restrictPredicate)
-
Constructor Details
-
RestrictRelationRemovalContribution
public RestrictRelationRemovalContribution()
-
-
Method Details
-
getEntityModel
-
setEntityModel
-
getBlockingRelationsAsSet
-
setBlockingRelations
-
getRestrictedRelationsAsSet
-
setRestrictedRelations
-
getErrorMessage
-
setErrorMessage
-
getRestrictPredicate
Instead of always restricting the removal of relation X if relation Y is set, this method allows to provide an additional condition that needs to evaluate to true to deny the removal. This predicate is applied to each set blocking relation to determine whether the removal should be restricted.- Returns:
- a BiPredicate that receives the set blocking relation that is currently being tested as first argument and the entity to be removed as second argument
-
setRestrictPredicate
-
getErrorMessageFormatter
- Returns:
- a function to create a text message. This function receives the entity that couldn't be deleted and a set with all text resources for the relations that caused the removal to fail.
-
setErrorMessageFormatter
public void setErrorMessageFormatter(BiFunction<Entity, Set<String>, TextMessage> errorMessageFormatter)
-