agave-files/files-core/src/main/java/org/iplantc/service/io/dao/LogicalFileDao.java
/**
	 * Finds logical file reference corresponding to the immediate parent folder of the
	 * given logical file. If the parent does not have an entry, null will be returned.
	 *  
	 * @param logicalFile
	 * @return
	 */
Finds logical file reference corresponding to the immediate parent folder of the
given logical file. If the parent does not have an entry, null will be returned.

@param logicalFile
@return
Finds logical file reference corresponding to the immediate parent folder of the given logical file . If the parent does not have an entry null will be returned . @param logicalFile @return
public static LogicalFile findParent(LogicalFile logicalFile) 
	{
		if (logicalFile == null) {
			throw new HibernateException("No file specified");
		}
		try 
		{
			Session session = getSession();
			String hql = "SELECT * FROM logical_files "
					   + "WHERE BINARY path = :path and "
					   + "		native_format = :dirtype and "
					   + "		 system_id = :systemid and "
					   + "		 tenant_id = :tenantid ";
			LogicalFile parent =  (LogicalFile) session.createSQLQuery(hql)
					.addEntity(LogicalFile.class)
					.setString("path", FilenameUtils.getFullPathNoEndSeparator(logicalFile.getPath()))
					.setString("dirtype", LogicalFile.DIRECTORY)
					.setLong("systemid", logicalFile.getSystem().getId())
					.setString("tenantid", TenancyHelper.getCurrentTenantId())
					.setMaxResults(1)
					.uniqueResult();
			session.flush();
			return parent;
		}
		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) {}
		}
	}
public static LogicalFile findParent ( LogicalFile logicalFile ) { if ( logicalFile == null ) { throw new HibernateException ( "No file specified" ) ; } try { Session session = getSession ( ) ; String hql = "SELECT * FROM logical_files " + "WHERE BINARY path = :path and " + "		native_format = :dirtype and " + "		 system_id = :systemid and " + "		 tenant_id = :tenantid " ; LogicalFile parent = ( LogicalFile ) session . createSQLQuery ( hql ) . addEntity ( LogicalFile . class ) . setString ( "path" , FilenameUtils . getFullPathNoEndSeparator ( logicalFile . getPath ( ) ) ) . setString ( "dirtype" , LogicalFile . DIRECTORY ) . setLong ( "systemid" , logicalFile . getSystem ( ) . getId ( ) ) . setString ( "tenantid" , TenancyHelper . getCurrentTenantId ( ) ) . setMaxResults ( 1 ) . uniqueResult ( ) ; session . flush ( ) ; return parent ; } 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 ) { } } }
Finds logical file reference corresponding to the immediate parent folder of the
 given logical file.
Finds logical file reference corresponding to the immediate parent folder of the given logical file .