agave-systems/systems-core/src/main/java/org/iplantc/service/systems/manager/SystemManager.java
/**
	 * Erases system completely from the database. This is an admin-only action and will not 
	 * clean up the registered apps.
	 * 
	 * @param system
	 * @param apiUsername
	 * @throws PermissionException 
	 */
Erases system completely from the database. This is an admin-only action and will not
clean up the registered apps.

@param system
@param apiUsername
@throws PermissionException
Erases system completely from the database . This is an admin - only action and will not clean up the registered apps . @param system @param apiUsername @throws PermissionException
public void eraseSystem(RemoteSystem system, String apiUsername) throws PermissionException {
		if (system == null) {
			throw new SystemException("No system provided.");
		} else if (system.isPubliclyAvailable()) {
			throw new SystemException("System " + system.getSystemId() + 
					" is currently a public system. Please remove from public scope before erasing.");
		} else if (system.isGlobalDefault()) {
			throw new SystemException("System " + system.getSystemId() + 
					" is currently the global default " + system.getType() + " system. "
					+ "Please set another system as the global default and remove this "
					+ "system from public scope before erasing.");
		} else if (!ServiceUtils.isAdmin(apiUsername)) {
			throw new PermissionException("User does not have permission to edit global defaults.");
		}
		try {
			getDao().remove(system);
		} catch (Throwable e) {
			throw new SystemException("Failed to erase system " + system.getSystemId(), e);
		}
		try {
			new SystemHistoryEventDao().deleteByEntityId(system.getUuid());
		} catch (EntityEventPersistenceException e) {
			log.error("Failed to clean up event data when system system " +
                    system + " was erased", e);
		}
		getEventProcessor().processSystemUpdateEvent(system, SystemEventType.ERASED, apiUsername);
	}
public void eraseSystem ( RemoteSystem system , String apiUsername ) throws PermissionException { if ( system == null ) { throw new SystemException ( "No system provided." ) ; } else if ( system . isPubliclyAvailable ( ) ) { throw new SystemException ( "System " + system . getSystemId ( ) + " is currently a public system. Please remove from public scope before erasing." ) ; } else if ( system . isGlobalDefault ( ) ) { throw new SystemException ( "System " + system . getSystemId ( ) + " is currently the global default " + system . getType ( ) + " system. " + "Please set another system as the global default and remove this " + "system from public scope before erasing." ) ; } else if ( ! ServiceUtils . isAdmin ( apiUsername ) ) { throw new PermissionException ( "User does not have permission to edit global defaults." ) ; } try { getDao ( ) . remove ( system ) ; } catch ( Throwable e ) { throw new SystemException ( "Failed to erase system " + system . getSystemId ( ) , e ) ; } try { new SystemHistoryEventDao ( ) . deleteByEntityId ( system . getUuid ( ) ) ; } catch ( EntityEventPersistenceException e ) { log . error ( "Failed to clean up event data when system system " + system + " was erased" , e ) ; } getEventProcessor ( ) . processSystemUpdateEvent ( system , SystemEventType . ERASED , apiUsername ) ; }
Erases system completely from the database.
Erases system completely from the database .
// stuff will break if we do this! // remove the system from the db