All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hudson.plugins.emailext.EmailExtHelp Maven / Gradle / Ivy

The newest version!
package hudson.plugins.emailext;

import hudson.plugins.emailext.plugins.ContentBuilder;
import hudson.plugins.emailext.plugins.EmailContent;

/**
 * Produces all the dynamically generated help text.
 */
public class EmailExtHelp {

	/**
	 * Generates the help text for the content tokens available
	 * while configuring a project.
	 * 
	 * @return the help text
	 */
	public static String getContentTokenHelpText() {
		return getTokenHelpText(true);
	}
	
	/**
	 * Generates the help text for the content tokens available
	 * while doing global configuration.
	 * 
	 * @return the help text
	 */
	public static String getGlobalContentTokenHelpText() {
		return getTokenHelpText(false);
	}
	
	private static String getTokenHelpText(boolean displayDefaultTokens) {
		StringBuffer sb = new StringBuffer();
		
		// This is the help for the content tokens
		sb.append("\n" +
				"

All arguments are optional. Arguments may be given for each token in the " + "form name=\"value\" for strings and in the form name=value for booleans and numbers. " + "The {'s and }'s may be omitted if there are no arguments.

" + "

Examples: $TOKEN, ${TOKEN}, ${TOKEN, count=100}, ${ENV, var=\"PATH\"}

\n" + "Available Tokens\n" + "
    \n"); if (displayDefaultTokens) { sb.append( "
  • ${DEFAULT_SUBJECT} - This is the default email subject that is " + "configured in Hudson's system configuration page.
  • \n" + "
  • ${DEFAULT_CONTENT} - This is the default email content that is " + "configured in Hudson's system configuration page.
  • \n" + "
  • ${PROJECT_DEFAULT_SUBJECT} - This is the default email subject for " + "this project. The result of using this token in the advanced configuration is " + "what is in the Default Subject field above. WARNING: Do not use this token in the " + "Default Subject or Content fields. Doing this has an undefined result.
  • \n" + "
  • ${PROJECT_DEFAULT_CONTENT} - This is the default email content for " + "this project. The result of using this token in the advanced configuration is " + "what is in the Default Content field above. WARNING: Do not use this token in the " + "Default Subject or Content fields. Doing this has an undefined result.
  • \n"); } for (EmailContent content : ContentBuilder.getEmailContentTypes()) { sb.append("
  • ${"); sb.append(content.getToken()); for (String arg : content.getArguments()) { sb.append(", "); sb.append(arg); sb.append(""); } sb.append("} - "); sb.append(content.getHelpText()); sb.append("
  • \n"); } sb.append("
\n"); return sb.toString(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy