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

org.duracloud.syncui.domain.DirectoryConfigs Maven / Gradle / Ivy

There is a newer version: 8.1.0
Show 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://duracloud.org/license/
 */
package org.duracloud.syncui.domain;

import java.io.File;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;

import org.springframework.stereotype.Component;

/**
 * A list of configured directories.
 *
 * @author Daniel Bernstein
 */
@Component("directoryConfigs")
public class DirectoryConfigs extends LinkedHashSet {

    private static final long serialVersionUID = 1L;

    public List toFileList() {
        List list = new LinkedList();

        for (DirectoryConfig config : this) {
            list.add(new File(config.getDirectoryPath()));
        }
        return list;
    }

    public DirectoryConfig removePath(String path) {
        for (DirectoryConfig d : this) {
            if (d.getDirectoryPath().equals(path)) {
                this.remove(d);
                return d;
            }
        }

        return null;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy