agave-apps/apps-core/src/main/java/org/iplantc/service/apps/managers/ApplicationManager.java
/**
	 * Deletes a software record and every resource associated with it.
	 *
	 * @param software the software to erase
	 * @param username the user requesting the software be erased
	 */
Deletes a software record and every resource associated with it.
@param software the software to erase
@param username the user requesting the software be erased
Deletes a software record and every resource associated with it . @param software the software to erase @param username the user requesting the software be erased
public static void eraseSoftware(Software software, String username) throws SoftwareResourceException
	{
		try {
			String sql = "update jobs set visible = 0 where software_name = :softwareName and tenant_id = :tenantId";
			Session session = HibernateUtil.getSession();
			session.clear();
			session.createSQLQuery(sql)
				.setString("softwareName", software.getUniqueName())
				.setString("tenantId", software.getTenantId())
				.executeUpdate();
			SoftwareEventProcessor eventProcessor = new SoftwareEventProcessor();
			eventProcessor.processSoftwareContentEvent(software, 
					SoftwareEventType.DELETED,
					"App was deleted by user " + username, 
					username);
		} catch (Throwable e) {
			throw new SoftwareResourceException(400,
					"Failed to erase app. Unable to delete associated jobs.", e);
		}
		NotificationDao ndao = new NotificationDao();
		try {
			List<Notification> appNotifications = ndao.getActiveNotificationsForUuid(software.getUuid());
			for (Notification n: appNotifications) 
			{
				ndao.delete(n);
			}
		} catch (Throwable e) {
			throw new SoftwareResourceException(400,
					"Failed to erase app. Unable to delete associated notifications.", e);
		}
		SoftwareDao.delete(software);
	}
public static void eraseSoftware ( Software software , String username ) throws SoftwareResourceException { try { String sql = "update jobs set visible = 0 where software_name = :softwareName and tenant_id = :tenantId" ; Session session = HibernateUtil . getSession ( ) ; session . clear ( ) ; session . createSQLQuery ( sql ) . setString ( "softwareName" , software . getUniqueName ( ) ) . setString ( "tenantId" , software . getTenantId ( ) ) . executeUpdate ( ) ; SoftwareEventProcessor eventProcessor = new SoftwareEventProcessor ( ) ; eventProcessor . processSoftwareContentEvent ( software , SoftwareEventType . DELETED , "App was deleted by user " + username , username ) ; } catch ( Throwable e ) { throw new SoftwareResourceException ( 400 , "Failed to erase app. Unable to delete associated jobs." , e ) ; } NotificationDao ndao = new NotificationDao ( ) ; try { List < Notification > appNotifications = ndao . getActiveNotificationsForUuid ( software . getUuid ( ) ) ; for ( Notification n : appNotifications ) { ndao . delete ( n ) ; } } catch ( Throwable e ) { throw new SoftwareResourceException ( 400 , "Failed to erase app. Unable to delete associated notifications." , e ) ; } SoftwareDao . delete ( software ) ; }
Deletes a software record and every resource associated with it.
Deletes a software record and every resource associated with it .
// hide jobs using this app // delete notifications using this app