agave-files/files-core/src/main/java/org/iplantc/service/io/dao/LogicalFileDao.java
/**
	 * Returns all existing logical file records for the parents of the 
	 * current file/folder. There is no guarantee there are any entries
	 * for the parents. No check is done to determine where to stop, thus
	 * logical file records could be returned for paths outside of the 
	 * current system root if it had changed at some point.
	 *  
	 * @param logicalFile
	 * @return
	 */
Returns all existing logical file records for the parents of the
current file/folder. There is no guarantee there are any entries
for the parents. No check is done to determine where to stop, thus
logical file records could be returned for paths outside of the
current system root if it had changed at some point.

@param logicalFile
@return
Returns all existing logical file records for the parents of the current file / folder . There is no guarantee there are any entries for the parents . No check is done to determine where to stop thus logical file records could be returned for paths outside of the current system root if it had changed at some point . @param logicalFile @return
@SuppressWarnings("unchecked")
	public static List<LogicalFile> findParents(RemoteSystem system, String path) 
	{
		if (StringUtils.isEmpty(path)) {
			throw new HibernateException("No path specified");
		} else if (StringUtils.equals(path, "/")) {
			return new ArrayList<LogicalFile>();
		}
		try 
		{
			Session session = getSession();
			String hql = "SELECT * FROM logical_files "
					+ "WHERE LOCATE(BINARY path, :path) = 1 and "
					+ "		 BINARY path <> :path and "  
					+ "		 BINARY native_format = :dirType and "
					+ "		 system_id = :systemId and "
					+ "		 tenant_id = :tenantid " 
					+ "ORDER BY path DESC";
			List<LogicalFile> files =  (List<LogicalFile>)session.createSQLQuery(hql)
				.addEntity(LogicalFile.class)
				.setString("path", path)
				.setString("dirType", LogicalFile.DIRECTORY)
				.setString("tenantid", TenancyHelper.getCurrentTenantId())
				.setLong("systemId", system.getId())
				.list();
			session.flush();
			return files;
		}
		catch (HibernateException ex)
		{
			log.error("Failed to get logical file parents", 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 > findParents ( RemoteSystem system , String path ) { if ( StringUtils . isEmpty ( path ) ) { throw new HibernateException ( "No path specified" ) ; } else if ( StringUtils . equals ( path , "/" ) ) { return new ArrayList < LogicalFile > ( ) ; } try { Session session = getSession ( ) ; String hql = "SELECT * FROM logical_files " + "WHERE LOCATE(BINARY path, :path) = 1 and " + "		 BINARY path <> :path and " + "		 BINARY native_format = :dirType and " + "		 system_id = :systemId and " + "		 tenant_id = :tenantid " + "ORDER BY path DESC" ; List < LogicalFile > files = ( List < LogicalFile > ) session . createSQLQuery ( hql ) . addEntity ( LogicalFile . class ) . setString ( "path" , path ) . setString ( "dirType" , LogicalFile . DIRECTORY ) . setString ( "tenantid" , TenancyHelper . getCurrentTenantId ( ) ) . setLong ( "systemId" , system . getId ( ) ) . list ( ) ; session . flush ( ) ; return files ; } catch ( HibernateException ex ) { log . error ( "Failed to get logical file parents" , ex ) ; try { if ( HibernateUtil . getSession ( ) . isOpen ( ) ) { HibernateUtil . rollbackTransaction ( ) ; } } catch ( Exception ignored ) { } throw ex ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception ignored ) { } } }
Returns all existing logical file records for the parents of the
 current file/folder.
Returns all existing logical file records for the parents of the current file / folder .