All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.dspace.app.bulkaccesscontrol.service.BulkAccessConditionConfigurationService Maven / Gradle / Ivy

The newest version!
/**
 * The contents of this file are subject to the license and copyright
 * detailed in the LICENSE and NOTICE files at the root of the source
 * tree and available online at
 *
 * http://www.dspace.org/license/
 */
package org.dspace.app.bulkaccesscontrol.service;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.collections4.CollectionUtils;
import org.dspace.app.bulkaccesscontrol.model.BulkAccessConditionConfiguration;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Simple bean to manage different Bulk Access Condition configurations
 *
 * @author Mohamed Eskander (mohamed.eskander at 4science.it)
 */
public class BulkAccessConditionConfigurationService {

    @Autowired
    private List bulkAccessConditionConfigurations;

    public List getBulkAccessConditionConfigurations() {
        if (CollectionUtils.isEmpty(bulkAccessConditionConfigurations)) {
            return new ArrayList<>();
        }
        return bulkAccessConditionConfigurations;
    }

    public BulkAccessConditionConfiguration getBulkAccessConditionConfiguration(String name) {
        return getBulkAccessConditionConfigurations().stream()
                                                     .filter(x -> name.equals(x.getName()))
                                                     .findFirst()
                                                     .orElse(null);
    }

    public void setBulkAccessConditionConfigurations(
        List bulkAccessConditionConfigurations) {
        this.bulkAccessConditionConfigurations = bulkAccessConditionConfigurations;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy