org.jenkinsci.plugins.jobmail.actions
Class JobMailProjectAction

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.Actionable
          extended by org.jenkinsci.plugins.jobmail.actions.JobMailBaseAction
              extended by org.jenkinsci.plugins.jobmail.actions.JobMailProjectAction
All Implemented Interfaces:
hudson.model.Action, hudson.model.ModelObject, hudson.search.SearchableModelObject, hudson.search.SearchItem, jenkins.model.ModelObjectWithContextMenu
Direct Known Subclasses:
JobMailBuildAction

public class JobMailProjectAction
extends JobMailBaseAction

Implements the mail action visible from the project view. contains most of the methods for creating the email and setting its properties.

Author:
yboev

Nested Class Summary
 
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
jenkins.model.ModelObjectWithContextMenu.ContextMenu, jenkins.model.ModelObjectWithContextMenu.MenuItem
 
Field Summary
protected  JobMailGlobalConfiguration conf
          The global configuration.
 
Constructor Summary
JobMailProjectAction(hudson.model.AbstractProject<?,?> project)
          Constructor method.
 
Method Summary
 void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          The whole input of the email page.
 String getDefaultRecipients()
          Returns the default recipients.
 String getDefaultSubject()
          Returns the default subject for the email.
 String getFromProperty()
          Returns the from propery of the email as a String.
protected  String getProjectName()
          Return the project name.
protected  String getRedirectUrl()
          Returns the url to which the user is redirected after sending the mail.
 List<JobMailGlobalConfiguration.Template> getTemplates()
          Returns all configured templates.
 String getTemplateText(JobMailGlobalConfiguration.Template currentTemplate)
          Constructs the content part of the email from a template.
 void init()
          Initialize method, loads the configuration.
 
Methods inherited from class org.jenkinsci.plugins.jobmail.actions.JobMailBaseAction
getDisplayName, getIconFileName, getSearchUrl, getUrlName
 
Methods inherited from class hudson.model.Actionable
addAction, doContextMenu, getAction, getAction, getActions, getActions, getDynamic
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

conf

protected JobMailGlobalConfiguration conf
The global configuration.

Constructor Detail

JobMailProjectAction

public JobMailProjectAction(hudson.model.AbstractProject<?,?> project)
Constructor method.

Parameters:
project - project for which the action is being created
Method Detail

getFromProperty

public String getFromProperty()
                       throws javax.mail.internet.AddressException
Returns the from propery of the email as a String. This is the current user(if logged in) or the admin's email address otherwise.

Returns:
property as String
Throws:
javax.mail.internet.AddressException - Address problem

doConfigSubmit

public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req,
                           org.kohsuke.stapler.StaplerResponse rsp)
                    throws IOException,
                           javax.servlet.ServletException,
                           javax.mail.MessagingException,
                           InterruptedException
The whole input of the email page.

Parameters:
req - request
rsp - response
Throws:
IOException - Input/output problem
javax.servlet.ServletException - servlet problem
javax.mail.MessagingException - Messaging problem
InterruptedException - Interrupt

init

public void init()
Initialize method, loads the configuration. Called in the jelly, every time the action is clicked.


getDefaultSubject

public String getDefaultSubject()
                         throws IOException,
                                InterruptedException
Returns the default subject for the email.

Returns:
default subject as string
Throws:
IOException - Input/output
InterruptedException - Interrupt

getDefaultRecipients

public String getDefaultRecipients()
Returns the default recipients.

Returns:
default recipients as String.

getTemplates

public List<JobMailGlobalConfiguration.Template> getTemplates()
Returns all configured templates.

Returns:
list of all templates.

getTemplateText

public String getTemplateText(JobMailGlobalConfiguration.Template currentTemplate)
Constructs the content part of the email from a template.

Parameters:
currentTemplate - the template from which we are constructing text
Returns:
the constructed text as String

getRedirectUrl

protected String getRedirectUrl()
Returns the url to which the user is redirected after sending the mail.

Returns:
the url as String

getProjectName

protected String getProjectName()
Return the project name.

Returns:
the name as String


Copyright © 2004-2013. All Rights Reserved.