com.atlassian.jira.config
Class DefaultConstantsManager

java.lang.Object
  extended by com.atlassian.jira.config.DefaultConstantsManager
All Implemented Interfaces:
ConstantsManager

public class DefaultConstantsManager
extends Object
implements ConstantsManager


Field Summary
static org.apache.commons.collections.Predicate REGULAR_ISSUE_TYPE_PREDICATE
           
static org.apache.commons.collections.Predicate SUBTASK_PREDICATE
           
 
Fields inherited from interface com.atlassian.jira.config.ConstantsManager
ALL_ISSUE_TYPES, ALL_STANDARD_ISSUE_TYPES, ALL_SUB_TASK_ISSUE_TYPES, ISSUE_TYPE_CONSTANT_TYPE, PRIORITY_CONSTANT_TYPE, RESOLUTION_CONSTANT_TYPE, STATUS_CONSTANT_TYPE
 
Constructor Summary
DefaultConstantsManager(JiraAuthenticationContext authenticationContext)
           
 
Method Summary
 boolean constantExists(String constantType, String name)
          Checks if a constant exists.
 List convertToConstantObjects(String constantType, Collection ids)
          Converts the list of ids to the objects of appropriate types
 org.ofbiz.core.entity.GenericValue createIssueType(String name, Long sequence, String style, String description, String iconurl)
          Note this metod does not validate the input - i.e.
 List expandIssueTypeIds(Collection issueTypeIds)
          Converts the 'special' ids of issue types to a list of issue type ids For example, converts a special id to a list of all sub-task issue types Also see ConstantsManager.ALL_STANDARD_ISSUE_TYPES, ConstantsManager.ALL_SUB_TASK_ISSUE_TYPES and ConstantsManager.ALL_ISSUE_TYPES.
 List getAllIssueTypeIds()
          Returns all issueType Ids.
 Collection getAllIssueTypeObjects()
          Returns a list of IssueTypes.
 List getAllIssueTypes()
          Returns a list of IssueTypes.
 org.ofbiz.core.entity.GenericValue getConstant(String constantType, String id)
          Generic method to retrieve a particular constant type.
 org.ofbiz.core.entity.GenericValue getConstantByName(String constantType, String name)
          Returns a constant by name.
 IssueConstant getConstantObject(String constantType, String id)
          Returns an IssueConstant object for the given type & id.
 Collection getConstantObjects(String constantType)
          Returns all IssueConstant objects for the given type.
 org.ofbiz.core.entity.GenericValue getDefaultPriority()
          Returns the default priority configured in JIRA.
 List getEditableSubTaskIssueTypes()
          Retrieves an editable list of sub-task issues.
 IssueConstant getIssueConstant(org.ofbiz.core.entity.GenericValue issueConstantGV)
          Converts a constant GenericValue to an IssueConstant object.
 org.ofbiz.core.entity.GenericValue getIssueType(String id)
          Given an issueType ID this method retrieves that issueType.
 IssueType getIssueTypeObject(String id)
          Given an issueType ID this method retrieves that issueType.
 Collection getIssueTypes()
          Retrieve regular (non-subtask) issue types.
 Collection getPriorities()
          Retrieve all Priorities in JIRA.
 org.ofbiz.core.entity.GenericValue getPriority(String id)
          Given a priority ID, this method retrieves that priority.
 String getPriorityName(String id)
          Returns the priority Name for a given priority ID.
 Priority getPriorityObject(String id)
          Given a priority ID, this method retrieves that priority.
 Collection getPriorityObjects()
          Retrieve all Priorities in JIRA.
 Collection getRegularIssueTypeObjects()
          Retrieve regular (non-subtask) issue types.
 org.ofbiz.core.entity.GenericValue getResolution(String id)
          Given a resolution ID, this method retrieves that resolution.
 Resolution getResolutionObject(String id)
          Given a resolution ID, this method retrieves that resolution.
 Collection getResolutionObjects()
          Retrieve all Resolutions in JIRA.
 Collection getResolutions()
          Retrieve all Resolutions in JIRA.
 org.ofbiz.core.entity.GenericValue getStatus(String id)
          Returns a Status given an id.
 Status getStatusByName(String name)
          Searches for a given status by name.
 Collection getStatuses()
          Returns all statuses
 Status getStatusObject(String id)
          Returns a Status given an id.
 Collection getStatusObjects()
          Returns all statuses
 Collection getSubTaskIssueTypeObjects()
          Retrieves all the sub-task issue types
 Collection getSubTaskIssueTypes()
          Retrieve subtask issue types.
 void refresh()
          Sets all cached copies of constant to null.
 void refreshIssueTypes()
          Reloads all IssueTypes from the DB.
 void refreshPriorities()
          Reloads all priorities from the DB.
 void refreshResolutions()
          Reloads all resolutions from the DB.
 void refreshStatuses()
          Reloads all statuses from DB.
 void removeIssueType(String id)
          Removes an existing issueType.
 void storeIssueTypes(List issueTypes)
          Bulk operation to store a list of issueTypes.
 void updateIssueType(String id, String name, Long sequence, String style, String description, String iconurl)
          Updates an existing issueType.
 void validateCreateIssueType(String name, String style, String description, String iconurl, ErrorCollection errors, String nameFieldName)
          Validates creation of a new issuetype.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUBTASK_PREDICATE

public static final org.apache.commons.collections.Predicate SUBTASK_PREDICATE

REGULAR_ISSUE_TYPE_PREDICATE

public static final org.apache.commons.collections.Predicate REGULAR_ISSUE_TYPE_PREDICATE
Constructor Detail

DefaultConstantsManager

public DefaultConstantsManager(JiraAuthenticationContext authenticationContext)
Method Detail

getStatuses

public Collection getStatuses()
Description copied from interface: ConstantsManager
Returns all statuses

Specified by:
getStatuses in interface ConstantsManager
Returns:
Returns a Collection of status GenericValues.

getStatusObjects

public Collection getStatusObjects()
Description copied from interface: ConstantsManager
Returns all statuses

Specified by:
getStatusObjects in interface ConstantsManager
Returns:
Returns a Collection of Status objects

getStatus

public org.ofbiz.core.entity.GenericValue getStatus(String id)
Description copied from interface: ConstantsManager
Returns a Status given an id.

Specified by:
getStatus in interface ConstantsManager
Parameters:
id - The id of a status
Returns:
Returns a status GenericValue

getStatusObject

public Status getStatusObject(String id)
Description copied from interface: ConstantsManager
Returns a Status given an id.

Specified by:
getStatusObject in interface ConstantsManager
Parameters:
id - The id of a status
Returns:
Returns a Status object.

refreshStatuses

public void refreshStatuses()
Description copied from interface: ConstantsManager
Reloads all statuses from DB.

Specified by:
refreshStatuses in interface ConstantsManager

getConstant

public org.ofbiz.core.entity.GenericValue getConstant(String constantType,
                                                      String id)
Description copied from interface: ConstantsManager
Generic method to retrieve a particular constant type.

Specified by:
getConstant in interface ConstantsManager
Parameters:
constantType - See ConstantsManager.PRIORITY_CONSTANT_TYPE, ConstantsManager.STATUS_CONSTANT_TYPE, ConstantsManager.RESOLUTION_CONSTANT_TYPE, ConstantsManager.ISSUE_TYPE_CONSTANT_TYPE
id - The id of the constant.
Returns:
A GenericValue containing the constant. Null if it doesn't exist.

getConstantObject

public IssueConstant getConstantObject(String constantType,
                                       String id)
Description copied from interface: ConstantsManager
Returns an IssueConstant object for the given type & id.

Specified by:
getConstantObject in interface ConstantsManager
Parameters:
constantType - See ConstantsManager.PRIORITY_CONSTANT_TYPE, ConstantsManager.STATUS_CONSTANT_TYPE, ConstantsManager.RESOLUTION_CONSTANT_TYPE, ConstantsManager.ISSUE_TYPE_CONSTANT_TYPE
id - The id of the constant.
Returns:
A IssueConstant object. Null if it doesn't exist.

getConstantObjects

public Collection getConstantObjects(String constantType)
Description copied from interface: ConstantsManager
Returns all IssueConstant objects for the given type.

Specified by:
getConstantObjects in interface ConstantsManager
Parameters:
constantType - See ConstantsManager.PRIORITY_CONSTANT_TYPE, ConstantsManager.STATUS_CONSTANT_TYPE, ConstantsManager.RESOLUTION_CONSTANT_TYPE, ConstantsManager.ISSUE_TYPE_CONSTANT_TYPE
Returns:
A collection of IssueConstant object.

convertToConstantObjects

public List convertToConstantObjects(String constantType,
                                     Collection ids)
Description copied from interface: ConstantsManager
Converts the list of ids to the objects of appropriate types

Specified by:
convertToConstantObjects in interface ConstantsManager
Parameters:
constantType - the constant type. Case insenstive
ids - list of constant ids or GenericValues
Returns:
List of IssueConstant subclasses. Null if constantType is null or the ids are empty

constantExists

public boolean constantExists(String constantType,
                              String name)
Description copied from interface: ConstantsManager
Checks if a constant exists.

Specified by:
constantExists in interface ConstantsManager
Parameters:
constantType - See ConstantsManager.PRIORITY_CONSTANT_TYPE, ConstantsManager.STATUS_CONSTANT_TYPE, ConstantsManager.RESOLUTION_CONSTANT_TYPE, ConstantsManager.ISSUE_TYPE_CONSTANT_TYPE
name - The name of the constant.
Returns:
True if the constant exists. False otherwise

getConstantByName

public org.ofbiz.core.entity.GenericValue getConstantByName(String constantType,
                                                            String name)
Description copied from interface: ConstantsManager
Returns a constant by name.

Specified by:
getConstantByName in interface ConstantsManager
Parameters:
constantType - See ConstantsManager.PRIORITY_CONSTANT_TYPE, ConstantsManager.STATUS_CONSTANT_TYPE, ConstantsManager.RESOLUTION_CONSTANT_TYPE, ConstantsManager.ISSUE_TYPE_CONSTANT_TYPE
name - The Name of the constant.
Returns:
A constant GenericValue

createIssueType

public org.ofbiz.core.entity.GenericValue createIssueType(String name,
                                                          Long sequence,
                                                          String style,
                                                          String description,
                                                          String iconurl)
                                                   throws CreateException
Description copied from interface: ConstantsManager
Note this metod does not validate the input - i.e. It does not check for duplicate names etc. Use this method in conjunction with ConstantsManager.validateCreateIssueType(String, String, String, String, com.atlassian.jira.util.ErrorCollection, String)

Specified by:
createIssueType in interface ConstantsManager
Parameters:
name - Name of the new IssueType
sequence - Sequence number used for ordering the issuetypes in the UI.
style - Used to record the type of issue, such as SUBTASK. Null for regular issues.
description - A short description of the new issue type.
iconurl - A URL to an icon to be used for the new issueType.
Throws:
CreateException

validateCreateIssueType

public void validateCreateIssueType(String name,
                                    String style,
                                    String description,
                                    String iconurl,
                                    ErrorCollection errors,
                                    String nameFieldName)
Description copied from interface: ConstantsManager
Validates creation of a new issuetype. In particular, this function checks that a name has been submitted, no other issueTypes with the same name exist, and that the icon URL exists.

Specified by:
validateCreateIssueType in interface ConstantsManager
Parameters:
name - Name of the new IssueType
style - Used to record the type of issue, such as SUBTASK. Null for regular issues.
description - A short description of the new issue type.
iconurl - A URL to an icon to be used for the new issueType.
errors - A collection of errors used to pass back any problems.
nameFieldName - The field to which the errors should be added.

updateIssueType

public void updateIssueType(String id,
                            String name,
                            Long sequence,
                            String style,
                            String description,
                            String iconurl)
                     throws StoreException
Description copied from interface: ConstantsManager
Updates an existing issueType. This will cause a refresh of all issue types (i.e. reload from the DB).

Specified by:
updateIssueType in interface ConstantsManager
Parameters:
id - ID of the existing issuetype.
name - Name of the new IssueType
sequence - Sequence number used for ordering the issuetypes in the UI.
style - Used to record the type of issue, such as SUBTASK. Null for regular issues.
description - A short description of the new issue type.
iconurl - A URL to an icon to be used for the new issueType.
Throws:
StoreException

removeIssueType

public void removeIssueType(String id)
                     throws RemoveException
Description copied from interface: ConstantsManager
Removes an existing issueType. This will cause a refresh of all issue types (i.e. reload from the DB).

Specified by:
removeIssueType in interface ConstantsManager
Parameters:
id - ID of an existing issueType
Throws:
RemoveException - if the issueType with id doesn't exist, or an error occured removing the issue.

storeIssueTypes

public void storeIssueTypes(List issueTypes)
                     throws StoreException
Description copied from interface: ConstantsManager
Bulk operation to store a list of issueTypes.

Specified by:
storeIssueTypes in interface ConstantsManager
Parameters:
issueTypes - A list of IssueType GenericValues
Throws:
StoreException

refresh

public void refresh()
Description copied from interface: ConstantsManager
Sets all cached copies of constant to null. This will cause them to be re-loaded from the DB the next time they are accessed.

Specified by:
refresh in interface ConstantsManager

expandIssueTypeIds

public List expandIssueTypeIds(Collection issueTypeIds)
Description copied from interface: ConstantsManager
Converts the 'special' ids of issue types to a list of issue type ids For example, converts a special id to a list of all sub-task issue types Also see ConstantsManager.ALL_STANDARD_ISSUE_TYPES, ConstantsManager.ALL_SUB_TASK_ISSUE_TYPES and ConstantsManager.ALL_ISSUE_TYPES.

Specified by:
expandIssueTypeIds in interface ConstantsManager
Parameters:
issueTypeIds - A collection of the issuetype Ids to retrieve.

getAllIssueTypeIds

public List getAllIssueTypeIds()
Description copied from interface: ConstantsManager
Returns all issueType Ids.

Specified by:
getAllIssueTypeIds in interface ConstantsManager
Returns:
A list of all the IssueType Ids.

getIssueConstant

public IssueConstant getIssueConstant(org.ofbiz.core.entity.GenericValue issueConstantGV)
Description copied from interface: ConstantsManager
Converts a constant GenericValue to an IssueConstant object.

Specified by:
getIssueConstant in interface ConstantsManager
Parameters:
issueConstantGV - the constant GenericValue.
Returns:
An IssueConstant object.

getPriorities

public Collection getPriorities()
Description copied from interface: ConstantsManager
Retrieve all Priorities in JIRA.

Specified by:
getPriorities in interface ConstantsManager
Returns:
A list of Priority GenericValues.

getPriorityObjects

public Collection getPriorityObjects()
Description copied from interface: ConstantsManager
Retrieve all Priorities in JIRA.

Specified by:
getPriorityObjects in interface ConstantsManager
Returns:
A list of Prioritys.

getPriorityObject

public Priority getPriorityObject(String id)
Description copied from interface: ConstantsManager
Given a priority ID, this method retrieves that priority.

Specified by:
getPriorityObject in interface ConstantsManager
Parameters:
id - The id of the priority
Returns:
A Priority object.

getDefaultPriority

public org.ofbiz.core.entity.GenericValue getDefaultPriority()
Description copied from interface: ConstantsManager
Returns the default priority configured in JIRA.

Specified by:
getDefaultPriority in interface ConstantsManager
Returns:
The default priority GenericValue.

getPriority

public org.ofbiz.core.entity.GenericValue getPriority(String id)
Description copied from interface: ConstantsManager
Given a priority ID, this method retrieves that priority.

Specified by:
getPriority in interface ConstantsManager
Parameters:
id - The id of the priority
Returns:
A Priority GenericValue

getPriorityName

public String getPriorityName(String id)
Description copied from interface: ConstantsManager
Returns the priority Name for a given priority ID.

Specified by:
getPriorityName in interface ConstantsManager
Parameters:
id - the id of a priority
Returns:
the name of the priority with the given id, or an i18n'd String indicating that no priority is set (e.g. "None") if the id is null.

getResolutionObject

public Resolution getResolutionObject(String id)
Description copied from interface: ConstantsManager
Given a resolution ID, this method retrieves that resolution.

Specified by:
getResolutionObject in interface ConstantsManager
Parameters:
id - The id of the resolution
Returns:
A Resolution object.

refreshPriorities

public void refreshPriorities()
Description copied from interface: ConstantsManager
Reloads all priorities from the DB.

Specified by:
refreshPriorities in interface ConstantsManager

getResolutions

public Collection getResolutions()
Description copied from interface: ConstantsManager
Retrieve all Resolutions in JIRA.

Specified by:
getResolutions in interface ConstantsManager
Returns:
A List of Resolution GenericValues.

getResolutionObjects

public Collection getResolutionObjects()
Description copied from interface: ConstantsManager
Retrieve all Resolutions in JIRA.

Specified by:
getResolutionObjects in interface ConstantsManager
Returns:
A List of Resolution objects.

getResolution

public org.ofbiz.core.entity.GenericValue getResolution(String id)
Description copied from interface: ConstantsManager
Given a resolution ID, this method retrieves that resolution.

Specified by:
getResolution in interface ConstantsManager
Parameters:
id - The id of the resolution
Returns:
A resolution GenericValue

refreshResolutions

public void refreshResolutions()
Description copied from interface: ConstantsManager
Reloads all resolutions from the DB.

Specified by:
refreshResolutions in interface ConstantsManager

getIssueTypes

public Collection getIssueTypes()
Description copied from interface: ConstantsManager
Retrieve regular (non-subtask) issue types.

Specified by:
getIssueTypes in interface ConstantsManager
Returns:
A collection of IssueType GenericValues

getAllIssueTypeObjects

public Collection getAllIssueTypeObjects()
Description copied from interface: ConstantsManager
Returns a list of IssueTypes.

Specified by:
getAllIssueTypeObjects in interface ConstantsManager
Returns:
A Collection of IssueType objects.

getRegularIssueTypeObjects

public Collection getRegularIssueTypeObjects()
Description copied from interface: ConstantsManager
Retrieve regular (non-subtask) issue types.

Specified by:
getRegularIssueTypeObjects in interface ConstantsManager
Returns:
A collection of IssueTypes

getSubTaskIssueTypeObjects

public Collection getSubTaskIssueTypeObjects()
Description copied from interface: ConstantsManager
Retrieves all the sub-task issue types

Specified by:
getSubTaskIssueTypeObjects in interface ConstantsManager
Returns:
A Collection of all sub-task IssueTypes.

getStatusByName

public Status getStatusByName(String name)
Description copied from interface: ConstantsManager
Searches for a given status by name. This is not the most efficient implementation.

Specified by:
getStatusByName in interface ConstantsManager
Parameters:
name - The name of the status.
Returns:
A Status object.

getSubTaskIssueTypes

public Collection getSubTaskIssueTypes()
Retrieve subtask issue types.

Specified by:
getSubTaskIssueTypes in interface ConstantsManager
Returns:
A collection of IssueType GenericValues

getEditableSubTaskIssueTypes

public List getEditableSubTaskIssueTypes()
Description copied from interface: ConstantsManager
Retrieves an editable list of sub-task issues.

Specified by:
getEditableSubTaskIssueTypes in interface ConstantsManager
Returns:
A List of editable sub-task GenericValues

getAllIssueTypes

public List getAllIssueTypes()
Description copied from interface: ConstantsManager
Returns a list of IssueTypes.

Specified by:
getAllIssueTypes in interface ConstantsManager
Returns:
A list of GenericValue issueTypes.

getIssueType

public org.ofbiz.core.entity.GenericValue getIssueType(String id)
Description copied from interface: ConstantsManager
Given an issueType ID this method retrieves that issueType.

Specified by:
getIssueType in interface ConstantsManager
Parameters:
id - The ID of the IssueType.
Returns:
An issueType GenericValue

getIssueTypeObject

public IssueType getIssueTypeObject(String id)
Description copied from interface: ConstantsManager
Given an issueType ID this method retrieves that issueType.

Specified by:
getIssueTypeObject in interface ConstantsManager
Parameters:
id - The ID of the IssueType.
Returns:
An IssueType object

refreshIssueTypes

public void refreshIssueTypes()
Description copied from interface: ConstantsManager
Reloads all IssueTypes from the DB.

Specified by:
refreshIssueTypes in interface ConstantsManager


Copyright © 2002-2007 Atlassian. All Rights Reserved.