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);
}
}
}
}
Aggregations