api/src/main/java/com/epam/pipeline/manager/user/UsersFileImportManager.java
@SuppressWarnings("PMD.AvoidCatchingGenericException")
    public List<PipelineUserEvent> importUsersFromFile(final boolean createUser, final boolean createGroup,
                                                       final List<String> attributesToCreate,
                                                       final MultipartFile file) {
        final List<CategoricalAttribute> categoricalAttributes = ListUtils
                .emptyIfNull(categoricalAttributeManager.loadAll());
        final List<PipelineUserEvent> events = new ArrayList<>();
        final List<PipelineUserWithStoragePath> users =
                new UserImporter(categoricalAttributes, attributesToCreate, events).importUsers(file);
        categoricalAttributes.forEach(categoricalAttributeManager::update);

        events.addAll(users.stream()
                .flatMap(user -> {
                    try {
                        return ListUtils.emptyIfNull(userImportManager
                                .processUser(user, createUser, createGroup, categoricalAttributes)).stream();
                    } catch (Exception e) {
                        log.error(String.format("Failed to process user '%s'", user.getUserName()), e);
                        return Stream.of(PipelineUserEvent.error(user.getUserName(), e.getMessage()));
                    }
                })
                .collect(Collectors.toList()));
        return events;
    }
/**
     * Registers a new {@link PipelineUser}, {@link Role} and {@link MetadataEntry} for users
     * if allowed. Otherwise, log event and skip action.
     * @param createUser true if user shall be created if not exists
     * @param createGroup true if role shall be created if not exists
     * @param attributesToCreate the list of metadata keys that shall be created if not exists
     * @param file the input file with users
     * @return the list of events that happened during user processing
     */
Registers a new  PipelineUser,  Role and  MetadataEntry for users
if allowed. Otherwise, log event and skip action.
Registers a new PipelineUser Role and MetadataEntry for users if allowed . Otherwise log event and skip action .
@SuppressWarnings("PMD.AvoidCatchingGenericException")
    public List<PipelineUserEvent> importUsersFromFile(final boolean createUser, final boolean createGroup,
                                                       final List<String> attributesToCreate,
                                                       final MultipartFile file) {
        final List<CategoricalAttribute> categoricalAttributes = ListUtils
                .emptyIfNull(categoricalAttributeManager.loadAll());
        final List<PipelineUserEvent> events = new ArrayList<>();
        final List<PipelineUserWithStoragePath> users =
                new UserImporter(categoricalAttributes, attributesToCreate, events).importUsers(file);
        categoricalAttributes.forEach(categoricalAttributeManager::update);
        events.addAll(users.stream()
                .flatMap(user -> {
                    try {
                        return ListUtils.emptyIfNull(userImportManager
                                .processUser(user, createUser, createGroup, categoricalAttributes)).stream();
                    } catch (Exception e) {
                        log.error(String.format("Failed to process user '%s'", user.getUserName()), e);
                        return Stream.of(PipelineUserEvent.error(user.getUserName(), e.getMessage()));
                    }
                })
                .collect(Collectors.toList()));
        return events;
    }
@ SuppressWarnings ( "PMD.AvoidCatchingGenericException" ) public List < PipelineUserEvent > importUsersFromFile ( final boolean createUser , final boolean createGroup , final List < String > attributesToCreate , final MultipartFile file ) { final List < CategoricalAttribute > categoricalAttributes = ListUtils . emptyIfNull ( categoricalAttributeManager . loadAll ( ) ) ; final List < PipelineUserEvent > events = new ArrayList < > ( ) ; final List < PipelineUserWithStoragePath > users = new UserImporter ( categoricalAttributes , attributesToCreate , events ) . importUsers ( file ) ; categoricalAttributes . forEach ( categoricalAttributeManager :: update ) ; events . addAll ( users . stream ( ) . flatMap ( user -> { try { return ListUtils . emptyIfNull ( userImportManager . processUser ( user , createUser , createGroup , categoricalAttributes ) ) . stream ( ) ; } catch ( Exception e ) { log . error ( String . format ( "Failed to process user '%s'" , user . getUserName ( ) ) , e ) ; return Stream . of ( PipelineUserEvent . error ( user . getUserName ( ) , e . getMessage ( ) ) ) ; } } ) . collect ( Collectors . toList ( ) ) ) ; return events ; }
Registers a new {@link PipelineUser}, {@link Role} and {@link MetadataEntry} for users
 if allowed.
Registers a new { @link PipelineUser } { @link Role } and { @link MetadataEntry } for users if allowed .