agave-realtime/realtime-core/src/main/java/org/iplantc/service/realtime/dao/RealtimeChannelDao.java
/**
	 * Returns true if a {@link RealtimeChannel} by the same name already exists for the given user.
	 * TODO: Should we match on subscribed events as well?
	 * @param username
	 * @param channelName
	 * @return
	 * @throws RealtimeChannelException
	 */
Returns true if a  RealtimeChannel by the same name already exists for the given user.
TODO: Should we match on subscribed events as well.
@param username
@param channelName
@return
@throws RealtimeChannelException
Returns true if a RealtimeChannel by the same name already exists for the given user . TODO : Should we match on subscribed events as well . @param username @param channelName @return @throws RealtimeChannelException
public boolean doesExist(String username, String channelName) throws RealtimeChannelException 
	{
		try
		{
			Session session = getSession();
			String sql = "select uuid as from realtimechannels where name = :name and owner = :owner and tenant_id = :tenantId";
			String match = (String)session.createSQLQuery(sql)
					.setString("name", channelName)
					.setString("owner", username)
					.setString("tenantId", TenancyHelper.getCurrentTenantId())
					.setMaxResults(1)
					.uniqueResult();
			session.flush();
			return match != null;
		}
		catch (HibernateException ex)
		{
			try
			{
				if (HibernateUtil.getSession().isOpen()) {
					HibernateUtil.rollbackTransaction();
				}
			}
			catch (Exception e) {}
			throw new RealtimeChannelException(ex);
		}
		finally {
			try { HibernateUtil.commitTransaction(); } catch (Exception e) {}
		}
	}
public boolean doesExist ( String username , String channelName ) throws RealtimeChannelException { try { Session session = getSession ( ) ; String sql = "select uuid as from realtimechannels where name = :name and owner = :owner and tenant_id = :tenantId" ; String match = ( String ) session . createSQLQuery ( sql ) . setString ( "name" , channelName ) . setString ( "owner" , username ) . setString ( "tenantId" , TenancyHelper . getCurrentTenantId ( ) ) . setMaxResults ( 1 ) . uniqueResult ( ) ; session . flush ( ) ; return match != null ; } catch ( HibernateException ex ) { try { if ( HibernateUtil . getSession ( ) . isOpen ( ) ) { HibernateUtil . rollbackTransaction ( ) ; } } catch ( Exception e ) { } throw new RealtimeChannelException ( ex ) ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception e ) { } } }
Returns true if a {@link RealtimeChannel} by the same name already exists for the given user.
Returns true if a { @link RealtimeChannel } by the same name already exists for the given user .