agave-jobs/jobs-core/src/main/java/org/iplantc/service/jobs/dao/JobDao.java
/**
	 * Counts the number of active jobs on a {@link BatchQueue} for a given {@code username}. The {@code systemId}
	 * and {@code queueName} are given instead of domain objects to avoid redundant validation within this method.
	 *
	 * @param owner the user for whom to count active jobs
	 * @param systemId the system id {@link ExecutionSystem} with the named {@link BatchQueue}
	 * @param queueName the name of the {@link BatchQueue} for which to count active jobs
	 * @return the number of active jobs associated with a {@link BatchQueue}.
	 * @throws JobException if the query cannot be performed
	 */
Counts the number of active jobs on a  BatchQueue for a given  username. The  systemId
and  queueName are given instead of domain objects to avoid redundant validation within this method.

@param owner the user for whom to count active jobs
@param systemId the system id  ExecutionSystem with the named  BatchQueue
@param queueName the name of the  BatchQueue for which to count active jobs
@return the number of active jobs associated with a  BatchQueue.
@throws JobException if the query cannot be performed
Counts the number of active jobs on a BatchQueue for a given username . The systemId and queueName are given instead of domain objects to avoid redundant validation within this method . @param owner the user for whom to count active jobs @param systemId the system id ExecutionSystem with the named BatchQueue @param queueName the name of the BatchQueue for which to count active jobs @return the number of active jobs associated with a BatchQueue . @throws JobException if the query cannot be performed
public static Long countActiveUserJobsOnSystemQueue(String owner, String systemId, String queueName)
	throws JobException
	{
		try
		{
			Session session = getSession();
			session.clear();
			String hql = "select count(*) "
					+ "from Job where "
					+ "		queue_request = :queuerequest and "
					+ "		owner = :jobowner and "
					+ "		system = :jobsystem and "
					+ "		status in " + "(" + JobStatusType.getActiveStatusValues() + ") and "
					+ "		visible = :visible ";
			long jobCount = (Long) session.createQuery(hql)
					.setBoolean("visible", true)
					.setString("jobowner", owner)
					.setString("queuerequest", queueName)
					.setString("jobsystem", systemId)
					.uniqueResult();
			session.flush();
			return jobCount;
		} catch (HibernateException ex) {
			throw new JobException(ex);
		} finally {
			try {
				HibernateUtil.commitTransaction();
			} catch (Exception ignored) {
			}
		}
	}
public static Long countActiveUserJobsOnSystemQueue ( String owner , String systemId , String queueName ) throws JobException { try { Session session = getSession ( ) ; session . clear ( ) ; String hql = "select count(*) " + "from Job where " + "		queue_request = :queuerequest and " + "		owner = :jobowner and " + "		system = :jobsystem and " + "		status in " + "(" + JobStatusType . getActiveStatusValues ( ) + ") and " + "		visible = :visible " ; long jobCount = ( Long ) session . createQuery ( hql ) . setBoolean ( "visible" , true ) . setString ( "jobowner" , owner ) . setString ( "queuerequest" , queueName ) . setString ( "jobsystem" , systemId ) . uniqueResult ( ) ; session . flush ( ) ; return jobCount ; } catch ( HibernateException ex ) { throw new JobException ( ex ) ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception ignored ) { } } }
Counts the number of active jobs on a {@link BatchQueue} for a given {@code username}.
Counts the number of active jobs on a { @link BatchQueue } for a given { @code username } .