agave-profiles/profiles-core/src/main/java/org/iplantc/service/profile/dao/InternalUserDao.java
/**
	 * Checks for the existence of the given username registered to the given API
	 * user.
	 * 
	 * @param apiUsername
	 * @param internalUsername
	 * @return false if the username is already registered to the API user. True 
	 * otherwise.
	 * @throws ProfileException
	 */
Checks for the existence of the given username registered to the given API
user.

@param apiUsername
@param internalUsername
@return false if the username is already registered to the API user. True
otherwise.
Checks for the existence of the given username registered to the given API user . @param apiUsername @param internalUsername @return false if the username is already registered to the API user . True otherwise .
public boolean isUsernameAvailable(String apiUsername, String internalUsername)
	throws ProfileException
	{
		try
		{
			Session session = getSession();
			String hql = "from InternalUser u " +
					"where u.createdBy = :createdby " +
					"and u.username = :username";
			boolean empty = session.createQuery(hql)
					.setString("createdby", apiUsername)
					.setString("username", internalUsername)
					.list().isEmpty();
			session.flush();
			return empty;
		}
		catch (HibernateException ex)
		{
			try
			{
				if (HibernateUtil.getSession().isOpen()) {
					HibernateUtil.rollbackTransaction();
				}
			}
			catch (Exception e) {}
			throw new ProfileException(ex);
		}
		finally {
			try { HibernateUtil.commitTransaction(); } catch (Exception e) {}
		}
	}
public boolean isUsernameAvailable ( String apiUsername , String internalUsername ) throws ProfileException { try { Session session = getSession ( ) ; String hql = "from InternalUser u " + "where u.createdBy = :createdby " + "and u.username = :username" ; boolean empty = session . createQuery ( hql ) . setString ( "createdby" , apiUsername ) . setString ( "username" , internalUsername ) . list ( ) . isEmpty ( ) ; session . flush ( ) ; return empty ; } catch ( HibernateException ex ) { try { if ( HibernateUtil . getSession ( ) . isOpen ( ) ) { HibernateUtil . rollbackTransaction ( ) ; } } catch ( Exception e ) { } throw new ProfileException ( ex ) ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Exception e ) { } } }
Checks for the existence of the given username registered to the given API
 user.
Checks for the existence of the given username registered to the given API user .