class UserEditorDriver implements Driver<User, UserEditor> {

    public boolean flush() {
        assert this.isEditMode;
        this.isFlushed = true;

        // Flush editor and sub-editors.
        userEditor.flush();
        userEditor.attributesEditor().flush();
        userEditor.groupsExplorer().flush();
        userEditor.rolesExplorer().flush();

        // Obtain the editor's values.
        final String id = userEditor.identifier();
        final Map<String, String> properties = userEditor.attributesEditor().getValue();
        final Set<Group> groups = userEditor.groupsExplorer().getValue();
        final Set<Role> roles = userEditor.rolesExplorer().getValue();

        // Create a new resulting instance (as groups & roles are unmodifiable collections in the default UserImpl).
        user = new UserImpl(id,
                            roles,
                            groups,
                            properties);

        // Validate the instance and set delegate violations, if any, to the editors hierarchy.
        Set<ConstraintViolation<User>> violations = userSystemManager.usersValidator().validate(user);
        userEditor.setViolations(violations);
        return violations == null || violations.isEmpty();
    }

    @Inject public  UserEditorDriver(final ClientUserSystemManager userSystemManager);

}