agave-files/files-core/src/main/java/org/iplantc/service/io/dao/LogicalFileDao.java
/**
	 * Returns child logical files from another logical file
	 * 
	 * @param path
	 * @param systemId
	 */
Returns child logical files from another logical file

@param path
@param systemId
Returns child logical files from another logical file @param path @param systemId
@SuppressWarnings("unchecked")
	public static List<LogicalFile> findChildren(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 = "SELECT * " +
						 "FROM logical_files " +
						 "WHERE system_id = :systemid and " +  
						 "		BINARY path like :pathmatch and " +  
						 "		BINARY path <> BINARY :path and " +
						 "		tenant_id = :tenantid " +
						 "ORDER BY path ASC";
			List<LogicalFile> children = (List<LogicalFile>)session.createSQLQuery(sql)
					.addEntity(LogicalFile.class)
					.setString("pathmatch", StringUtils.replace(path + "/%", "//", "/"))
					.setString("path", path)
					.setLong("systemid", systemId)
					.setString("tenantid", TenancyHelper.getCurrentTenantId())
					.list();
			session.flush();
			return children;
		}
		catch (HibernateException ex)
		{
			log.error("Failed to find children of " + path, ex);
			try
			{
				if (HibernateUtil.getSession().isOpen()) {
					HibernateUtil.rollbackTransaction();
				}
			}
			catch (Exception ignored) {}
			throw ex;
		}
		finally
		{
			try { HibernateUtil.commitTransaction(); } catch (Exception ignored) {}
		}
	}
@ SuppressWarnings ( "unchecked" ) public static List < LogicalFile > findChildren ( 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 = "SELECT * " + "FROM logical_files " + "WHERE system_id = :systemid and " + "		BINARY path like :pathmatch and " + "		BINARY path <> BINARY :path and " + "		tenant_id = :tenantid " + "ORDER BY path ASC" ; List < LogicalFile > children = ( List < LogicalFile > ) session . createSQLQuery ( sql ) . addEntity ( LogicalFile . class ) . setString ( "pathmatch" , StringUtils . replace ( path + "/%" , "//" , "/" ) ) . setString ( "path" , path ) . setLong ( "systemid" , systemId ) . setString ( "tenantid" , TenancyHelper . getCurrentTenantId ( ) ) . list ( ) ; session . flush ( ) ; return children ; } catch ( HibernateException ex ) { log . error ( "Failed to find children of " + path , ex ) ; try { if ( HibernateUtil . getSession ( ) . isOpen ( ) ) { HibernateUtil . rollbackTransaction ( ) ; } } catch ( Exception ignored ) { } throw ex ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception ignored ) { } } }
Returns child logical files from another logical file
Returns child logical files from another logical file
// update path of existing logical files where the is no corresponding destination logical_file