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

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

/*
 * 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 org.springframework.stereotype.Component;

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


/**
 * 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 - 2025 Weber Informatics LLC | Privacy Policy