agave-systems/systems-core/src/main/java/org/iplantc/service/systems/dao/BatchQueueDao.java
/**
     * Fetches the {@link BatchQueue} based on the {@code systemId} of the
     * {@link ExecutionSystem}.
     * 
     * Tenancy is honored on this query, so make sure you load the tenant of
     * the corresponding {@link ExecutionSystem} if calling this without a
     * Reqest session.
     *  
     * @param systemId id of the owning {@link ExecutionSystem}
     * @return
     */
Fetches the  BatchQueue based on the  systemId of the
ExecutionSystem.

Tenancy is honored on this query, so make sure you load the tenant of
the corresponding  ExecutionSystem if calling this without a
Reqest session.

@param systemId id of the owning  ExecutionSystem
@return
Fetches the BatchQueue based on the systemId of the ExecutionSystem . Tenancy is honored on this query so make sure you load the tenant of the corresponding ExecutionSystem if calling this without a Reqest session . @param systemId id of the owning ExecutionSystem @return
@SuppressWarnings("unchecked")
    public List<BatchQueue> findBySystemId(String systemId, int offset, int limit)
    {
        try
        {
            Session session = getSession();
            String hql =  "from org.iplantc.service.systems.model.BatchQueue b "
                        + "where b.executionSystem.systemId = :systemId "
                        + "     and b.executionSystem.tenantId = :tenantId "
                        + "     and b.executionSystem.available = :available";
            return (List<BatchQueue>)session.createQuery(hql)
                    .setString("systemId", systemId)
                    .setString("tenantId", TenancyHelper.getCurrentTenantId())
                    .setBoolean("available", Boolean.TRUE)
                    .setFirstResult(offset)
                    .setMaxResults(limit)
                    .list();
        }
        catch (ObjectNotFoundException ex)
        {
            return null;
        }
        catch (HibernateException ex)
        {
            throw ex;
        }
    }
@ SuppressWarnings ( "unchecked" ) public List < BatchQueue > findBySystemId ( String systemId , int offset , int limit ) { try { Session session = getSession ( ) ; String hql = "from org.iplantc.service.systems.model.BatchQueue b " + "where b.executionSystem.systemId = :systemId " + "     and b.executionSystem.tenantId = :tenantId " + "     and b.executionSystem.available = :available" ; return ( List < BatchQueue > ) session . createQuery ( hql ) . setString ( "systemId" , systemId ) . setString ( "tenantId" , TenancyHelper . getCurrentTenantId ( ) ) . setBoolean ( "available" , Boolean . TRUE ) . setFirstResult ( offset ) . setMaxResults ( limit ) . list ( ) ; } catch ( ObjectNotFoundException ex ) { return null ; } catch ( HibernateException ex ) { throw ex ; } }
Fetches the {@link BatchQueue} based on the {@code systemId} of the
 {@link ExecutionSystem}.
Fetches the { @link BatchQueue } based on the { @code systemId } of the { @link ExecutionSystem } .