agave-tags/tags-core/src/main/java/org/iplantc/service/tags/dao/TagDao.java
/**
	 * Returns true if a {@link Tag} by the same name already exists for the given user.
	 * @param name name of tag
	 * @param username owner of tag
	 * @return true of a match exists within the current tenant. false otherwise
	 * @throws TagException if unable to query tags
	 */
Returns true if a  Tag by the same name already exists for the given user.
@param name name of tag
@param username owner of tag
@return true of a match exists within the current tenant. false otherwise
@throws TagException if unable to query tags
Returns true if a Tag by the same name already exists for the given user . @param name name of tag @param username owner of tag @return true of a match exists within the current tenant . false otherwise @throws TagException if unable to query tags
public boolean doesTagNameExistForUser(String name, String username) throws TagException 
	{
		try
		{
			Session session = getSession();
			String sql = "SELECT t.uuid FROM Tag t where t.name = :name and t.owner = :username";
			String match = (String)session.createQuery(sql)
					.setString("name", name)
					.setString("username", username)
					.setCacheMode(CacheMode.IGNORE)
					.setCacheable(false)
					.setMaxResults(1)
					.uniqueResult();
			session.flush();
			return match != null;
		}
		catch (HibernateException ex)
		{
			try
			{
				if (HibernateUtil.getSession().isOpen()) {
					HibernateUtil.rollbackTransaction();
				}
			}
			catch (Exception ignored) {}
			throw new TagException(ex);
		}
		finally {
			try { HibernateUtil.commitTransaction(); } catch (Exception ignored) {}
		}
	}
public boolean doesTagNameExistForUser ( String name , String username ) throws TagException { try { Session session = getSession ( ) ; String sql = "SELECT t.uuid FROM Tag t where t.name = :name and t.owner = :username" ; String match = ( String ) session . createQuery ( sql ) . setString ( "name" , name ) . setString ( "username" , username ) . setCacheMode ( CacheMode . IGNORE ) . setCacheable ( false ) . setMaxResults ( 1 ) . uniqueResult ( ) ; session . flush ( ) ; return match != null ; } catch ( HibernateException ex ) { try { if ( HibernateUtil . getSession ( ) . isOpen ( ) ) { HibernateUtil . rollbackTransaction ( ) ; } } catch ( Exception ignored ) { } throw new TagException ( ex ) ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception ignored ) { } } }
Returns true if a {@link Tag} by the same name already exists for the given user.
Returns true if a { @link Tag } by the same name already exists for the given user .