org.cert.cc.jira.email.handler
Interface JIRAMediator

All Known Implementing Classes:
JIRAMediatorImpl, MockJIRAMediatorImpl

public interface JIRAMediator

JIRAMediator is the go between for most JIRA operations.

© 2009 Carnegie Mellon University

Author:
Steve Scholnick

Method Summary
 IssueType calculateIssueType(Message message)
          Calculates and returns the JIRA IssueType
 Priority calculatePriority(Message message)
          Calculates and returns the JIRA issue Priority
 User determineAssignee(Message message, Project project, User reporter)
          Calculates and returns the issue assignee.
 Priority getDefaultSystemPriority()
          Returns the default system Priority
 String getDescription(Message message)
          Returns the description
 IssueType getIssueType(String issueTypeId)
          Returns the IssueType based on its ID
 String getParameterValue(Message message, String key, String xHeaderName)
          Returns a parameter value or an X-Header value.
 String getParameterValue(String key)
          Returns a parameter value based on the key
 List<Priority> getPossiblePriorties()
          Returns all of the possible Priority values
 Priority getPriority(int id)
          Returns the Priority based on its id value
 Comparator<Priority> getPriorityComparator()
          Returns a Comparator for Prioritys
 Project getProject(String key)
          Returns the Project based on the key.
 GenericValue getProjectByName(String projectName)
          Returns the Project based on the key.
 User getUser(String identifier)
          Returns the JIRA User based on: If the identifier has an @, check to see the email address corresponds to a user. If the identifier does not have a @, check for username only.
 User getUserByEmail(String address)
          Returns the JIRA User based on their email address
 User getUserByUsername(String username)
          Returns the JIRA User based on their username
 boolean isValidUser(String emailAddress)
          Returns if the emailAddress is a valid JIRA user
 

Method Detail

getProject

Project getProject(String key)
Returns the Project based on the key. If no Project is found, null will be returned.

Parameters:
key - Project key
Returns:
Project

getProjectByName

GenericValue getProjectByName(String projectName)
                              throws DataAccessException
Returns the Project based on the key.

Parameters:
projectName - Project name
Returns:
Project
Throws:
DataAccessException - If unable to find the project

getIssueType

IssueType getIssueType(String issueTypeId)
Returns the IssueType based on its ID

Parameters:
issueTypeId - IssueType ID
Returns:
IssueType

getUser

User getUser(String identifier)
             throws EntityNotFoundException
Returns the JIRA User based on:
  1. If the identifier has an @, check to see the email address corresponds to a user.
  2. If the identifier does not have a @, check for username only.
  3. If the identifier has an @ and the email address is invalid, check the username part only of the email address.

Parameters:
identifier - Identifier (username or email address)
Returns:
JIRA User
Throws:
EntityNotFoundException - If no matching User is found

getUserByUsername

User getUserByUsername(String username)
                       throws EntityNotFoundException
Returns the JIRA User based on their username

Parameters:
username - JIRA username
Returns:
JIRA User
Throws:
EntityNotFoundException - If no User matches the username

getUserByEmail

User getUserByEmail(String address)
                    throws EntityNotFoundException
Returns the JIRA User based on their email address

Parameters:
address - Email address
Returns:
JIRA User
Throws:
EntityNotFoundException - If no User matches the email address

isValidUser

boolean isValidUser(String emailAddress)
Returns if the emailAddress is a valid JIRA user

Parameters:
emailAddress - Email address
Returns:
If the emailAddress is a valid JIRA user

determineAssignee

User determineAssignee(Message message,
                       Project project,
                       User reporter)
                       throws MessagingException
Calculates and returns the issue assignee. The algorithm is:
  1. If reporterassignee is set to 1, the assignee is the reporter
  2. If recipientassignee is set to 1, the To: followed by the CC: recipients is scanned looking for a valid JIRA user. The first one, that is found, becomes the assignee.
  3. The default assignee --usually the project lead, becomes the assignee.
  4. No assignee is set
  5. Parameters:
    message - Email Message
    project - JIRA Project
    reporter - Who is reporting this issue
    Returns:
    Assignee or null
    Throws:
    MessagingException - If unable to interrogate the Message

calculatePriority

Priority calculatePriority(Message message)
                           throws MessagingException
Calculates and returns the JIRA issue Priority

Parameters:
message - Email Message
Returns:
Priority
Throws:
MessagingException - If unable to interrogate the Message

calculateIssueType

IssueType calculateIssueType(Message message)
                             throws MessagingException
Calculates and returns the JIRA IssueType

Parameters:
message - Email Message
Returns:
IssueType
Throws:
MessagingException - If unable to interrogate the Message

getPriority

Priority getPriority(int id)
Returns the Priority based on its id value

Parameters:
id - Integer value for the Priority
Returns:
Priority

getDefaultSystemPriority

Priority getDefaultSystemPriority()
Returns the default system Priority


getPossiblePriorties

List<Priority> getPossiblePriorties()
Returns all of the possible Priority values


getDescription

String getDescription(Message message)
                      throws MessagingException
Returns the description

Parameters:
message - Email Message
Returns:
Description
Throws:
MessagingException - If unable to interrogate the Message

getParameterValue

String getParameterValue(String key)
Returns a parameter value based on the key


getParameterValue

String getParameterValue(Message message,
                         String key,
                         String xHeaderName)
                         throws MessagingException
Returns a parameter value or an X-Header value. If the X-Header value is not null, it will be returned. Otherwise the value of the parameter will be returned.

Parameters:
message - Email Message
key - Parameter key
xHeaderName - X-Header name
Returns:
Configuration value
Throws:
MessagingException - If unable to interrogate the Message

getPriorityComparator

Comparator<Priority> getPriorityComparator()
Returns a Comparator for Prioritys



Copyright © 2012 Carnegie Mellon University