agave-files/files-core/src/main/java/org/iplantc/service/io/dao/LogicalFileDao.java
/**
	 * Removes all logical files whose absolute path is prefixed by the given path + /.
	 * This should only be used when you discover that a logical file that was a folder 
	 * is now a file.
	 * 
	 * @param path
	 * @param systemId
	 */
Removes all logical files whose absolute path is prefixed by the given path + /.
This should only be used when you discover that a logical file that was a folder
is now a file.

@param path
@param systemId
Removes all logical files whose absolute path is prefixed by the given path + / . This should only be used when you discover that a logical file that was a folder is now a file . @param path @param systemId
public static void deleteSubtreePath(String path, Long systemId) 
	{
		if (StringUtils.isEmpty(path)) {
			throw new HibernateException("No path specified");
		}
		if (systemId == null) {
			throw new HibernateException("No system id specified");
		}
		try {
			Session session = getSession();
			String sql = "DELETE LogicalFile " +
						 "WHERE system.id = :systemid and " +  
						 "		path like :pathmatch and " +
						 "		path <> :path ";
			session.createQuery(sql)
				.setString("path", path)
				.setString("pathmatch", StringUtils.replace(path + "/%", "//", "/"))
				.setLong("systemid", systemId)
				.executeUpdate();
			session.flush();
		}
		catch (HibernateException ex)
		{
			log.error("Failed to remove logical file children of " + path, ex);
			try
			{
				if (HibernateUtil.getSession().isOpen()) {
					HibernateUtil.rollbackTransaction();
				}
			}
			catch (Exception ignored) {}
			throw ex;
		}
		finally
		{
			try { HibernateUtil.commitTransaction(); } catch (Exception ignored) {}
		}
	}
public static void deleteSubtreePath ( String path , Long systemId ) { if ( StringUtils . isEmpty ( path ) ) { throw new HibernateException ( "No path specified" ) ; } if ( systemId == null ) { throw new HibernateException ( "No system id specified" ) ; } try { Session session = getSession ( ) ; String sql = "DELETE LogicalFile " + "WHERE system.id = :systemid and " + "		path like :pathmatch and " + "		path <> :path " ; session . createQuery ( sql ) . setString ( "path" , path ) . setString ( "pathmatch" , StringUtils . replace ( path + "/%" , "//" , "/" ) ) . setLong ( "systemid" , systemId ) . executeUpdate ( ) ; session . flush ( ) ; } catch ( HibernateException ex ) { log . error ( "Failed to remove logical file children of " + path , ex ) ; try { if ( HibernateUtil . getSession ( ) . isOpen ( ) ) { HibernateUtil . rollbackTransaction ( ) ; } } catch ( Exception ignored ) { } throw ex ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception ignored ) { } } }
Removes all logical files whose absolute path is prefixed by the given path + /.
Removes all logical files whose absolute path is prefixed by the given path + / .
// update path of existing logical files where the is no corresponding destination logical_file