agave-systems/systems-core/src/main/java/org/iplantc/service/systems/manager/SystemRoleManager.java
/**
	 * Alerts an app publishers that their applications were disabled. 
	 * This occurs when a publisher role has been removed from them on a system.
	 * 
	 * @param appOwner the user whose publisher status was revoked and whose app is now disabled
	 * @param appIds the app that was disabled
	 * @param system the system for which the app was disabled
	 */
Alerts an app publishers that their applications were disabled.
This occurs when a publisher role has been removed from them on a system.

@param appOwner the user whose publisher status was revoked and whose app is now disabled
@param appIds the app that was disabled
@param system the system for which the app was disabled
Alerts an app publishers that their applications were disabled . This occurs when a publisher role has been removed from them on a system . @param appOwner the user whose publisher status was revoked and whose app is now disabled @param appIds the app that was disabled @param system the system for which the app was disabled
public void sendApplicationDisabledMessage(String appOwner, List<String> appIds, RemoteSystem system) 
	{
		if (ServiceUtils.isValid(appIds)) return;
		AgaveProfileServiceClient profileClient = new AgaveProfileServiceClient(
				Settings.IPLANT_PROFILE_SERVICE + "profile/search/username/" + appOwner, 
				Settings.IRODS_USERNAME, 
				Settings.IRODS_PASSWORD);
		String fullname = "";
		Profile ownerProfile = null;
		try
		{
			for(Profile profile: profileClient.getUsers()) 
			{
				if (profile.getUsername().equals(appOwner)) {
					ownerProfile = profile;
					break;
				}
			}
			if (ownerProfile == null) {
				throw new NotificationException("User profile not found for " + appOwner);
			}
		}
		catch (Exception e)
		{
			log.error("Error looking up email address for " + appOwner + 
					" no notification email will be sent", e);
			return;
		}
		try 
		{	
			String subject = "Your access to \"" + getSystem().getName() + "\" has been revoked.";
			String body = fullname + ",\n\n" +
					"This email is being sent to you as a courtesy by the Agave Platform. " +
					"Your access to " + getSystem().getName() + " (" + getSystem().getSystemId() + ") " +
					"has been revoked by the owner. As a result, the applications you " +
					"registered on this system have been disabled. The affected applications " +
					"are listed below.\n\n";
			for(String appId: appIds) {
				body += "\t" + appId + "\n";
			}
			body += "\nYou will still have access to the application data itself as long as " +
					"you have access to the storage system on which the application deployment " +
					"directory exists. Any jobs you and others have run using the disabled applications " +
					"will remain accessible through your personal job histories. The generated job " +
					"data will be available through the job service. If you have further questions, " +
					"please contact help@agaveplatform.org.";
			try {
				if (StringUtils.isNotBlank(ownerProfile.getEmail())) {
					EmailMessage.send(fullname, ownerProfile.getEmail(), subject, body, HTMLizer.htmlize(body));
				} else {
					log.debug("Unable to send software deactivation notification for " +
									getSystem().getSystemId() + " to " + appOwner +
							" due to missing email address in their profile.");
				}
			} catch (Exception e) {
				log.error("Failed to send software deactivation notification to " +
						appOwner + " at " + ownerProfile.getEmail(), e);
			}
		}
		catch (Exception e)
		{
			log.error("Error notifying " + appOwner + " of application deactivation.", e);
		}
	}
public void sendApplicationDisabledMessage ( String appOwner , List < String > appIds , RemoteSystem system ) { if ( ServiceUtils . isValid ( appIds ) ) return ; AgaveProfileServiceClient profileClient = new AgaveProfileServiceClient ( Settings . IPLANT_PROFILE_SERVICE + "profile/search/username/" + appOwner , Settings . IRODS_USERNAME , Settings . IRODS_PASSWORD ) ; String fullname = "" ; Profile ownerProfile = null ; try { for ( Profile profile : profileClient . getUsers ( ) ) { if ( profile . getUsername ( ) . equals ( appOwner ) ) { ownerProfile = profile ; break ; } } if ( ownerProfile == null ) { throw new NotificationException ( "User profile not found for " + appOwner ) ; } } catch ( Exception e ) { log . error ( "Error looking up email address for " + appOwner + " no notification email will be sent" , e ) ; return ; } try { String subject = "Your access to \"" + getSystem ( ) . getName ( ) + "\" has been revoked." ; String body = fullname + ",\n\n" + "This email is being sent to you as a courtesy by the Agave Platform. " + "Your access to " + getSystem ( ) . getName ( ) + " (" + getSystem ( ) . getSystemId ( ) + ") " + "has been revoked by the owner. As a result, the applications you " + "registered on this system have been disabled. The affected applications " + "are listed below.\n\n" ; for ( String appId : appIds ) { body += "\t" + appId + "\n" ; } body += "\nYou will still have access to the application data itself as long as " + "you have access to the storage system on which the application deployment " + "directory exists. Any jobs you and others have run using the disabled applications " + "will remain accessible through your personal job histories. The generated job " + "data will be available through the job service. If you have further questions, " + "please contact help@agaveplatform.org." ; try { if ( StringUtils . isNotBlank ( ownerProfile . getEmail ( ) ) ) { EmailMessage . send ( fullname , ownerProfile . getEmail ( ) , subject , body , HTMLizer . htmlize ( body ) ) ; } else { log . debug ( "Unable to send software deactivation notification for " + getSystem ( ) . getSystemId ( ) + " to " + appOwner + " due to missing email address in their profile." ) ; } } catch ( Exception e ) { log . error ( "Failed to send software deactivation notification to " + appOwner + " at " + ownerProfile . getEmail ( ) , e ) ; } } catch ( Exception e ) { log . error ( "Error notifying " + appOwner + " of application deactivation." , e ) ; } }
Alerts an app publishers that their applications were disabled.
Alerts an app publishers that their applications were disabled .