agave-systems/systems-core/src/main/java/org/iplantc/service/systems/dao/SystemDao.java
/**
     * Returns all systems the user has set as their defaults. This will not
     * include public systems that are global defaults. These need to be
     * manually added if missing.
     *
     * @param apiUsername
     * @return List of RemoteSystem objects represeting the user default systems
     */
Returns all systems the user has set as their defaults. This will not
include public systems that are global defaults. These need to be
manually added if missing.

@param apiUsername
@return List of RemoteSystem objects represeting the user default systems
Returns all systems the user has set as their defaults . This will not include public systems that are global defaults . These need to be manually added if missing . @param apiUsername @return List of RemoteSystem objects represeting the user default systems
@SuppressWarnings("unchecked")
    public List<RemoteSystem> findUserDefaultSystems(String apiUsername) {
        String hql = "SELECT s.system " + "FROM RemoteSystem s "
                + "WHERE uds.system.available = :available "
                + "AND :username in elements( s.usersUsingAsDefault) " + "ORDER BY sys.name DESC";
        try {
            Session session = getSession();
            session.clear();
            List<RemoteSystem> systems = (List<RemoteSystem>) session.createQuery(hql)
                    .setString("username", apiUsername).setBoolean("available", true).list();
            session.flush();
            return systems;
        } catch (HibernateException ex) {
            try {
                if (HibernateUtil.getSession().isOpen()) {
                    HibernateUtil.rollbackTransaction();
                }
            } catch (Exception ignored) {
            }
            throw ex;
        } finally {
            try {
                HibernateUtil.commitTransaction();
            } catch (Throwable ignored) {
            }
        }
    }
@ SuppressWarnings ( "unchecked" ) public List < RemoteSystem > findUserDefaultSystems ( String apiUsername ) { String hql = "SELECT s.system " + "FROM RemoteSystem s " + "WHERE uds.system.available = :available " + "AND :username in elements( s.usersUsingAsDefault) " + "ORDER BY sys.name DESC" ; try { Session session = getSession ( ) ; session . clear ( ) ; List < RemoteSystem > systems = ( List < RemoteSystem > ) session . createQuery ( hql ) . setString ( "username" , apiUsername ) . setBoolean ( "available" , true ) . list ( ) ; session . flush ( ) ; return systems ; } catch ( HibernateException ex ) { try { if ( HibernateUtil . getSession ( ) . isOpen ( ) ) { HibernateUtil . rollbackTransaction ( ) ; } } catch ( Exception ignored ) { } throw ex ; } finally { try { HibernateUtil . commitTransaction ( ) ; } catch ( Throwable ignored ) { } } }
Returns all systems the user has set as their defaults.
Returns all systems the user has set as their defaults .