public class

MockConstantsManager

extends Object
implements ConstantsManager
java.lang.Object
   ↳ com.atlassian.jira.mock.MockConstantsManager

Summary

[Expand]
Inherited Constants
From interface com.atlassian.jira.config.ConstantsManager
Public Constructors
MockConstantsManager()
Public Methods
void addIssueType(GenericValue type)
void addPriority(GenericValue priority)
void addResolution(GenericValue resolution)
void addStatus(GenericValue status)
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
GenericValue createIssueType(String name, Long sequence, String style, String description, String iconurl)
Note this metod does not validate the input - i.e.
List<String> expandIssueTypeIds(Collection<String> 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 ALL_STANDARD_ISSUE_TYPES, ALL_SUB_TASK_ISSUE_TYPES and ALL_ISSUE_TYPES.
List<String> getAllIssueTypeIds()
Returns all issueType Ids.
Collection<IssueType> getAllIssueTypeObjects()
Returns a list of IssueTypes.
List<GenericValue> getAllIssueTypes()
Returns a list of IssueTypes.
GenericValue getConstant(String constantType, String id)
GenericValue getConstantByName(String constantType, String name)
Returns a constant by name.
IssueConstant getConstantByNameIgnoreCase(String constantType, String name)
Returns a constant by name ignoring the case of the name passed in.
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.
GenericValue getDefaultPriority()
Returns the default priority configured in JIRA.
Priority getDefaultPriorityObject()
Returns the default priority configured in JIRA.
List<GenericValue> getEditableSubTaskIssueTypes()
Retrieves an editable list of sub-task issues.
IssueConstant getIssueConstant(GenericValue issueConstantGV)
Converts a constant GenericValue to an IssueConstant object.
IssueConstant getIssueConstantByName(String constantType, String name)
Returns a constant by name.
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<GenericValue> getIssueTypes()
Retrieve regular (non-subtask) issue types.
Collection<GenericValue> getPriorities()
Retrieve all Priorities in JIRA.
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<Priority> getPriorityObjects()
Retrieve all Priorities in JIRA.
Collection<IssueType> getRegularIssueTypeObjects()
Retrieve regular (non-subtask) issue types.
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<Resolution> getResolutionObjects()
Retrieve all Resolutions in JIRA.
Collection<GenericValue> getResolutions()
Retrieve all Resolutions in JIRA.
GenericValue getStatus(String id)
Returns a Status given an id.
Status getStatusByName(String name)
Searches for a given status by name.
Status getStatusByNameIgnoreCase(String name)
Searches for a given status by name ignoring case.
Status getStatusByTranslatedName(String name)
Searches for a given status by its translated name.
Status getStatusObject(String id)
Returns a Status given an id.
Collection<Status> getStatusObjects()
Returns all statuses
Collection<GenericValue> getStatuses()
Returns all statuses
Collection<IssueType> getSubTaskIssueTypeObjects()
Retrieves all the sub-task issue types
Collection<GenericValue> getSubTaskIssueTypes()
Retrieves all the sub-task issue types.
IssueType insertIssueType(String name, Long sequence, String style, String description, Long avatarId)
Creates a new IssueType.
IssueType insertIssueType(String name, Long sequence, String style, String description, String iconurl)
Creates a new IssueType.
void invalidate(IssueConstant issueConstant)
Clear the cache for this Issue Constant.
void invalidateAll()
Sets all cached copies of constant to null.
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)
void updateIssueType(String id, String name, Long sequence, String style, String description, Long avatarId)
Updates an existing issueType.
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.
void validateCreateIssueTypeWithAvatar(String name, String style, String description, String avatarId, ErrorCollection errors, String nameFieldName)
Validates creation of a new issuetype.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.config.ConstantsManager

Public Constructors

public MockConstantsManager ()

Public Methods

public void addIssueType (GenericValue type)

public void addPriority (GenericValue priority)

public void addResolution (GenericValue resolution)

public void addStatus (GenericValue status)

public boolean constantExists (String constantType, String name)

Checks if a constant exists.

Parameters
constantType See PRIORITY_CONSTANT_TYPE, STATUS_CONSTANT_TYPE, RESOLUTION_CONSTANT_TYPE, ISSUE_TYPE_CONSTANT_TYPE
name The name of the constant.
Returns
  • True if the constant exists. False otherwise

public List convertToConstantObjects (String constantType, Collection ids)

Converts the list of ids to the objects of appropriate types

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

public GenericValue createIssueType (String name, Long sequence, String style, String description, String iconurl)

Note this metod does not validate the input - i.e. It does not check for duplicate names etc. Use this method in conjunction with validateCreateIssueType(String, String, String, String, com.atlassian.jira.util.ErrorCollection, String)

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.
Returns
  • The newly created IssueType

public List<String> expandIssueTypeIds (Collection<String> 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 ALL_STANDARD_ISSUE_TYPES, ALL_SUB_TASK_ISSUE_TYPES and ALL_ISSUE_TYPES.

Parameters
issueTypeIds A collection of the issuetype Ids to retrieve.
Returns
  • A list of "actual" IssueType ID's expanded from the macro constants (or a new copy of the original list if it doesn't contain macros).

public List<String> getAllIssueTypeIds ()

Returns all issueType Ids.

Returns
  • A list of all the IssueType Ids.

public Collection<IssueType> getAllIssueTypeObjects ()

Returns a list of IssueTypes.

Returns

public List<GenericValue> getAllIssueTypes ()

Returns a list of IssueTypes.

Returns
  • A list of GenericValue issueTypes.

public GenericValue getConstant (String constantType, String id)

public GenericValue getConstantByName (String constantType, String name)

Returns a constant by name.

Parameters
constantType See PRIORITY_CONSTANT_TYPE, STATUS_CONSTANT_TYPE, RESOLUTION_CONSTANT_TYPE, ISSUE_TYPE_CONSTANT_TYPE
name The Name of the constant.
Returns
  • A constant GenericValue

public IssueConstant getConstantByNameIgnoreCase (String constantType, String name)

Returns a constant by name ignoring the case of the name passed in.

Parameters
constantType See PRIORITY_CONSTANT_TYPE, STATUS_CONSTANT_TYPE, RESOLUTION_CONSTANT_TYPE, ISSUE_TYPE_CONSTANT_TYPE
name The Name of the constant, case-insensitive.
Returns
  • An IssueConstant (or null if not found)

public IssueConstant getConstantObject (String constantType, String id)

Returns an IssueConstant object for the given type & id.

Parameters
constantType See PRIORITY_CONSTANT_TYPE, STATUS_CONSTANT_TYPE, RESOLUTION_CONSTANT_TYPE, ISSUE_TYPE_CONSTANT_TYPE
id The id of the constant.
Returns

public Collection getConstantObjects (String constantType)

Returns all IssueConstant objects for the given type.

Returns

public GenericValue getDefaultPriority ()

Returns the default priority configured in JIRA.

Returns
  • The default priority GenericValue.

public Priority getDefaultPriorityObject ()

Returns the default priority configured in JIRA.

Returns
  • The default priority.

public List<GenericValue> getEditableSubTaskIssueTypes ()

Retrieves an editable list of sub-task issues.

Returns
  • A List of editable sub-task GenericValues

public IssueConstant getIssueConstant (GenericValue issueConstantGV)

Converts a constant GenericValue to an IssueConstant object.

Parameters
issueConstantGV the constant GenericValue.
Returns

public IssueConstant getIssueConstantByName (String constantType, String name)

Returns a constant by name.

Parameters
constantType See PRIORITY_CONSTANT_TYPE, STATUS_CONSTANT_TYPE, RESOLUTION_CONSTANT_TYPE, ISSUE_TYPE_CONSTANT_TYPE
name The Name of the constant.
Returns
  • The IssueConstant

public GenericValue getIssueType (String id)

Given an IssueType ID this method retrieves that IssueType.

Parameters
id The ID of the IssueType.
Returns
  • An IssueType GenericValue

public IssueType getIssueTypeObject (String id)

Given an IssueType ID this method retrieves that IssueType.

Parameters
id The ID of the IssueType.
Returns

public Collection<GenericValue> getIssueTypes ()

Retrieve regular (non-subtask) issue types.

Returns
  • A collection of IssueType GenericValues

public Collection<GenericValue> getPriorities ()

Retrieve all Priorities in JIRA.

Returns
  • A list of Priority GenericValues.

public String getPriorityName (String id)

Returns the priority Name for a given priority ID.

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.

public Priority getPriorityObject (String id)

Given a priority ID, this method retrieves that priority.

Parameters
id The id of the priority
Returns

public Collection<Priority> getPriorityObjects ()

Retrieve all Priorities in JIRA.

Returns

public Collection<IssueType> getRegularIssueTypeObjects ()

Retrieve regular (non-subtask) issue types.

Returns

public GenericValue getResolution (String id)

Given a resolution ID, this method retrieves that resolution.

Parameters
id The id of the resolution
Returns
  • A resolution GenericValue

public Resolution getResolutionObject (String id)

Given a resolution ID, this method retrieves that resolution.

Parameters
id The id of the resolution
Returns

public Collection<Resolution> getResolutionObjects ()

Retrieve all Resolutions in JIRA.

Returns

public Collection<GenericValue> getResolutions ()

Retrieve all Resolutions in JIRA.

Returns
  • A List of Resolution GenericValues.

public GenericValue getStatus (String id)

Returns a Status given an id.

Parameters
id The id of a status
Returns
  • Returns a status GenericValue

public Status getStatusByName (String name)

Searches for a given status by name. This is not the most efficient implementation. If the name is not found, or the given name is null, then it returns null.

Parameters
name The name of the status.
Returns
  • A Status object with the given name, or null if none found.

public Status getStatusByNameIgnoreCase (String name)

Searches for a given status by name ignoring case. This is not the most efficient implementation. If the name is not found, or the given name is null, then it returns null.

Parameters
name The name of the status.
Returns
  • A Status object with the given name, or null if none found.

public Status getStatusByTranslatedName (String name)

Searches for a given status by its translated name. If no matching translated name is found the true (untranslated) name will be tried. If the name is not found, or the given name is null, then it returns null.

Parameters
name The name of the status.
Returns
  • A Status object with the given name, or null if none found.

public Status getStatusObject (String id)

Returns a Status given an id.

Parameters
id The id of a status
Returns

public Collection<Status> getStatusObjects ()

Returns all statuses

Returns
  • Returns a Collection of Status objects

public Collection<GenericValue> getStatuses ()

Returns all statuses

Returns
  • Returns a Collection of status GenericValues.

public Collection<IssueType> getSubTaskIssueTypeObjects ()

Retrieves all the sub-task issue types

Returns

public Collection<GenericValue> getSubTaskIssueTypes ()

Retrieves all the sub-task issue types. These will be non-modifiable. Use getEditableSubTaskIssueTypes() instead if you require an editable list.

Returns
  • A Collection of sub-task GenericValues.

public IssueType insertIssueType (String name, Long sequence, String style, String description, Long avatarId)

Creates a new IssueType.

Note this method does not validate the input - i.e. It does not check for duplicate names etc. Use this method in conjunction with validateCreateIssueType(String, String, String, String, com.atlassian.jira.util.ErrorCollection, String)

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.
avatarId Avatar id,
Returns
  • The newly created IssueType

public IssueType insertIssueType (String name, Long sequence, String style, String description, String iconurl)

Creates a new IssueType.

Note this method does not validate the input - i.e. It does not check for duplicate names etc. Use this method in conjunction with validateCreateIssueType(String, String, String, String, com.atlassian.jira.util.ErrorCollection, String)

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.
Returns
  • The newly created IssueType

public void invalidate (IssueConstant issueConstant)

Clear the cache for this Issue Constant. Implementations may clear additional IssueConstants at their discretion.

public void invalidateAll ()

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.

public void refresh ()

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.

public void refreshIssueTypes ()

Reloads all IssueTypes from the DB.

public void refreshPriorities ()

Reloads all priorities from the DB.

public void refreshResolutions ()

Reloads all resolutions from the DB.

public void refreshStatuses ()

Reloads all statuses from DB.

public void removeIssueType (String id)

Removes an existing issueType. This will cause a invalidate of all issue types (i.e. reload from the DB).

Parameters
id ID of an existing issueType

public void storeIssueTypes (List issueTypes)

public void updateIssueType (String id, String name, Long sequence, String style, String description, Long avatarId)

Updates an existing issueType. This will cause a invalidate of all issue types (i.e. reload from the DB).

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.
avatarId avatarid of new issueType.

public void updateIssueType (String id, String name, Long sequence, String style, String description, String iconurl)

Updates an existing issueType. This will cause a invalidate of all issue types (i.e. reload from the DB).

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.

public void validateCreateIssueType (String name, String style, String description, String iconurl, ErrorCollection errors, String nameFieldName)

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.

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.

public void validateCreateIssueTypeWithAvatar (String name, String style, String description, String avatarId, ErrorCollection errors, String nameFieldName)

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 correct avatarId is passed.

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.
avatarId An avatar id.
errors A collection of errors used to pass back any problems.
nameFieldName The field to which the errors should be added.