*/
private CommitHook getCommitHook(@Nullable final String path) {
List<CommitHook> hooks = newArrayList();
if (path != null) {
hooks.add(new EditorHook(new EditorProvider() {
@Override
public Editor getRootEditor(NodeState before, NodeState after, NodeBuilder builder) {
return new ItemSaveValidator(path);
}
}));
}
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);