use of org.apache.jackrabbit.oak.spi.commit.PostValidationHook in project jackrabbit-oak by apache.
the class MutableRoot method getCommitHook.
/**
* Combine the globally defined commit hook(s) and the hooks and validators defined by the
* various security related configurations.
*
* @return A commit hook combining repository global commit hook(s) with the pluggable hooks
* defined with the security modules and the padded {@code hooks}.
*/
private CommitHook getCommitHook() {
List<CommitHook> hooks = newArrayList();
hooks.add(ResetCommitAttributeHook.INSTANCE);
hooks.add(hook);
List<CommitHook> postValidationHooks = new ArrayList<CommitHook>();
for (SecurityConfiguration sc : securityProvider.getConfigurations()) {
for (CommitHook ch : sc.getCommitHooks(workspaceName)) {
if (ch instanceof PostValidationHook) {
postValidationHooks.add(ch);
} else if (ch != EmptyHook.INSTANCE) {
hooks.add(ch);
}
}
List<? extends ValidatorProvider> validators = sc.getValidators(workspaceName, subject.getPrincipals(), moveTracker);
if (!validators.isEmpty()) {
hooks.add(new EditorHook(CompositeEditorProvider.compose(validators)));
}
}
hooks.addAll(postValidationHooks);
return CompositeHook.compose(hooks);
}
Aggregations