org.cert.cc.jira
Class JIRAProxy

java.lang.Object
  extended by org.cert.cc.jira.JIRAProxy

public final class JIRAProxy
extends Object

JIRAProxy is the go between for some common JIRA operations.

© 2010 Carnegie Mellon University

Author:
Steve Scholnick

Method Summary
static GenericValue createIssue(MutableIssue issueData, User authenticatedUser)
          Creates a new JIRA issue
static CustomField getCustomField(String identifier)
          Returns the CustomField based on identifier.
static Priority getDefaultSystemPriority()
          Returns the default system Priority
static IssueLinkType getIssueLinkType(String identifier)
          Returns the IssueLinkType based on identifier.
static IssueType getIssueType(String identifier)
          Returns the IssueType based on identifier.
static List<Priority> getPossiblePriorties()
          Returns all of the possible Priority values
static Priority getPriority(int id)
          Returns the Priority based on its id value
static Priority getPriority(String identifier)
          Returns the Priority based on identifier.
static Project getProject(String key)
          Returns the Project based on the key.
static GenericValue getProjectByName(String projectName)
          Returns the Project based on the key.
static 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.
static User getUserByEmail(String address)
          Returns the JIRA User based on their email address
static User getUserByUsername(String username)
          Returns the JIRA User based on their username
static void indexIssue(GenericValue issue)
          Indexes an issue.
static void indexIssue(Issue issue)
          Indexes an issue.
static boolean isValidUser(String emailAddress)
          Returns if the emailAddress is a valid JIRA user
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createIssue

public static GenericValue createIssue(MutableIssue issueData,
                                       User authenticatedUser)
                                throws CreateException
Creates a new JIRA issue

Parameters:
issueData - Issue to be created
authenticatedUser - Authorized UserException creating the issue
Returns:
Newly created issue as a GenericValue
Throws:
CreateException - If unable to create the issue

indexIssue

public static void indexIssue(Issue issue)
Indexes an issue.

Parameters:
issue - to be indexed

indexIssue

public static void indexIssue(GenericValue issue)
Indexes an issue.

Parameters:
issue - to be indexed

getIssueLinkType

public static IssueLinkType getIssueLinkType(String identifier)
Returns the IssueLinkType based on identifier. If identifier is a number IssueLinkType is looked up by its id; otherwise; identifier is matched to IssueLinkType#getName().

Parameters:
identifier - IssueLinkType identifier
Returns:
IssueLinkType

getDefaultSystemPriority

public static Priority getDefaultSystemPriority()
Returns the default system Priority


getIssueType

public static IssueType getIssueType(String identifier)
Returns the IssueType based on identifier. If identifier is a number IssueType is looked up by its id; otherwise; identifier is matched to IssueType#getName().

Parameters:
identifier - IssueType identifier
Returns:
IssueType

getPossiblePriorties

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


getPriority

public static Priority getPriority(String identifier)
Returns the Priority based on identifier. If identifier is a number Priority is looked up by its id; otherwise; identifier is matched to Priority#getName().

Parameters:
identifier - Priority identifier
Returns:
Priority

getPriority

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

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

getProject

public static 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

public static 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

getCustomField

public static CustomField getCustomField(String identifier)
Returns the CustomField based on identifier. If identifier is a number CustomField is looked up by its id; otherwise; identifier is matched to CustomField#getName().

Parameters:
identifier - CustomField identifier
Returns:
CustomField

getUser

public static 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

getUserByEmail

public static 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

getUserByUsername

public static 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

isValidUser

public static 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


Copyright © 2012 Carnegie Mellon University