Search in sources :

Example 1 with VFSNode

use of nl.uva.vlet.vfs.VFSNode in project lobcder by skoulouzis.

the class Assimilator method add.

public void add(VDir dir, String base, Connection connection, long ssid, boolean addFiles) throws MalformedURLException, VlException, SQLException, NoSuchAlgorithmException {
    VFSNode[] nodes = dir.list();
    for (VFSNode f : nodes) {
        VRL currentPath = new VRL(f.getPath().replaceFirst(base, ""));
        LogicalData register = getLogicalDataByPath(Path.path(currentPath.getPath()), connection);
        LogicalData parent = getLogicalDataByPath(Path.path(currentPath.getPath()).getParent(), connection);
        Long parentRef = new Long(1);
        if (parent == null) {
            parentRef = new Long(1);
        } else {
            parentRef = parent.getUid();
        }
        if (f.isDir()) {
            if (register == null) {
                LogicalData entry = new LogicalData();
                entry.setCreateDate(f.getModificationTime());
                entry.setModifiedDate(f.getModificationTime());
                entry.setName(f.getName());
                entry.setOwner("admin");
                entry.setParentRef(parentRef);
                register = registerDirLogicalData(entry, connection);
            }
            add((VDir) f, base, connection, ssid, addFiles);
        } else if (addFiles) {
            if (register == null) {
                System.err.println(f.getVRL());
                addFile(connection, (VFile) f, parentRef, ssid);
            }
        }
    }
}
Also used : VRL(nl.uva.vlet.vrl.VRL) LogicalData(nl.uva.cs.lobcder.resources.LogicalData) VFSNode(nl.uva.vlet.vfs.VFSNode) VFile(nl.uva.vlet.vfs.VFile)

Aggregations

LogicalData (nl.uva.cs.lobcder.resources.LogicalData)1 VFSNode (nl.uva.vlet.vfs.VFSNode)1 VFile (nl.uva.vlet.vfs.VFile)1 VRL (nl.uva.vlet.vrl.VRL)1