use of nl.uva.cs.lobcder.resources.LogicalData 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);
}
}
}
}
use of nl.uva.cs.lobcder.resources.LogicalData in project lobcder by skoulouzis.
the class JDBCatalogue method setLogicalDataSupervised.
public void setLogicalDataSupervised(@Nonnull Long uid, @Nonnull Boolean flag, @Nonnull Connection connection) throws SQLException {
try (PreparedStatement ps = connection.prepareStatement("UPDATE ldata_table SET isSupervised = ? WHERE uid = ?")) {
ps.setBoolean(1, flag);
ps.setLong(2, uid);
ps.executeUpdate();
}
LogicalData cached = getFromLDataCache(uid, null);
if (cached != null) {
cached.setSupervised(flag);
putToLDataCache(cached, null);
}
}
use of nl.uva.cs.lobcder.resources.LogicalData in project lobcder by skoulouzis.
the class JDBCatalogue method setLocationPreference.
public void setLocationPreference(Long uid, String locationPreference, Connection connection) throws SQLException {
try (PreparedStatement ps = connection.prepareStatement("UPDATE ldata_table SET locationPreference = ? WHERE uid = ?")) {
ps.setString(1, locationPreference);
ps.setLong(2, uid);
ps.executeUpdate();
}
LogicalData cached = getFromLDataCache(uid, null);
if (cached != null) {
cached.setDataLocationPreference(locationPreference);
putToLDataCache(cached, null);
}
}
use of nl.uva.cs.lobcder.resources.LogicalData in project lobcder by skoulouzis.
the class JDBCatalogue method setLockTokenID.
public void setLockTokenID(@Nonnull Long uid, @Nonnull String lockTokenID, @Nonnull Connection connection) throws SQLException {
try (PreparedStatement ps = connection.prepareStatement("UPDATE ldata_table SET lockTokenID = ? WHERE uid = ?")) {
ps.setString(1, lockTokenID);
ps.setLong(2, uid);
ps.executeUpdate();
}
LogicalData cached = getFromLDataCache(uid, null);
if (cached != null) {
cached.setLockTokenID(lockTokenID);
putToLDataCache(cached, null);
}
}
use of nl.uva.cs.lobcder.resources.LogicalData in project lobcder by skoulouzis.
the class JDBCatalogue method setLockType.
public void setLockType(Long uid, String lockType, Connection connection) throws SQLException {
try (PreparedStatement ps = connection.prepareStatement("UPDATE ldata_table SET lockType = ? WHERE uid = ?")) {
ps.setString(1, lockType);
ps.setLong(2, uid);
ps.executeUpdate();
}
LogicalData cached = getFromLDataCache(uid, null);
if (cached != null) {
cached.setLockType(lockType);
putToLDataCache(cached, null);
}
}
Aggregations