Package com.atlassian.jira.config
Interface ConstantsManager
- All Known Implementing Classes:
DefaultConstantsManager,MockConstantsManager
@PublicApi
public interface ConstantsManager
Manager for issue types, statuses, priorities and resolutions. This manager is responsible for
caching these constants as well as all the usual update, delete, add operations in the database.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringUsed to retrieve all IssueTypes.static final StringUsed to retrieve all standard IssueTypes.static final StringUsed to retrieve all sub-task IssueTypes.static final StringUsed to filterIssueConstantobjects.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated. -
Method Summary
Modifier and TypeMethodDescriptionbooleanconstantExists(String constantType, String name) Checks if a constant exists.static PatterncreateIssueConstantNameSearchPattern(@NotEmpty String substring) 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 seeALL_STANDARD_ISSUE_TYPES,ALL_SUB_TASK_ISSUE_TYPESandALL_ISSUE_TYPES.Returns all issueType Ids.Returns a list of IssueTypes.getConstantByNameIgnoreCase(String constantType, String name) Returns a constant by name ignoring the case of the name passed in.getConstantObject(String constantType, String id) Returns anIssueConstantobject for the given type invalid input: '&' id.Collection<? extends IssueConstant> getConstantObjects(String constantType) Returns allIssueConstantobjects for the given type.getConstantsByIds(ConstantsManager.CONSTANT_TYPE constantType, Collection<String> ids) Converts the list of ids to the objects of appropriate typesDeprecated.Since v7.6.Retrieves an mutable list of sub-task issues.getIssueConstant(org.ofbiz.core.entity.GenericValue issueConstantGV) Deprecated.Deprecated since v7.0.getIssueConstantByName(String constantType, String name) Returns a constant by name.getIssueType(String id) Given an IssueType ID this method retrieves that IssueType.Retrieve all Priorities in JIRA.Returns the priority Name for a given priority ID.Given a priority ID, this method retrieves that priority.Retrieve regular (non-subtask) issue types.getResolution(String id) Given a resolution ID, this method retrieves that resolution.Retrieve all Resolutions in JIRA.Returns a Status given an id.getStatusByName(String name) Searches for a given status by name.Searches for a given status by name ignoring case.Searches for a given status by its translated name.Returns all statusesdefault StatusDeprecated.UsegetStatus(java.lang.String)instead.Retrieves all the sub-task issue typesCreates a new IssueType.Deprecated.UseinsertIssueType(String, Long, String, String, Long)instead.voidinvalidate(IssueConstant issueConstant) Clear the cache for this Issue Constant.voidSets all cached copies of constants to null.voidrecalculateIssueTypeSequencesAndStore(List<IssueType> issueTypes) Resequences the supplied issuetypes into sequential order.voidrecalculatePrioritySequencesAndStore(List<Priority> priorities) Resequences the supplied priorities into sequential order.voidrecalculateResolutionSequencesAndStore(List<Resolution> resolutions) Resequences the supplied resolutions into sequential order.voidrecalculateStatusSequencesAndStore(List<Status> statuses) Resequences the supplied statuses into sequential order.voidReloads all IssueTypes from the DB.voidReloads all priorities from the DB.voidReloads all resolutions from the DB.voidReloads all statuses from DB.voidDeprecated.Since 7.0.voidupdateIssueType(String id, String name, Long sequence, String style, String description, Long avatarId) Updates an existing issueType.voidupdateIssueType(String id, String name, Long sequence, String style, String description, String iconurl) Deprecated.useupdateIssueType(String, String, Long, String, String, Long)since v6.3voidvalidateCreateIssueType(String name, String style, String description, String iconurl, ErrorCollection errors, String nameFieldName) Validates creation of a new issuetype.voidvalidateCreateIssueTypeWithAvatar(String name, String style, String description, String avatarId, ErrorCollection errors, String nameFieldName) Validates creation of a new issuetype.io.atlassian.fugue.Option<Pair<String, ErrorCollection.Reason>> validateName(String name, io.atlassian.fugue.Option<IssueType> issueTypeToUpdate) Validates the name of issue type.
-
Field Details
-
ALL_STANDARD_ISSUE_TYPES
Used to retrieve all standard IssueTypes.- See Also:
-
ALL_SUB_TASK_ISSUE_TYPES
Used to retrieve all sub-task IssueTypes.- See Also:
-
ALL_ISSUE_TYPES
Used to retrieve all IssueTypes.- See Also:
-
PRIORITY_CONSTANT_TYPE
Deprecated.Used in the genericgetConstantObject(String, String)method -
STATUS_CONSTANT_TYPE
Deprecated.Used in the genericgetConstantObject(String, String)method -
RESOLUTION_CONSTANT_TYPE
Deprecated.Used in the genericgetConstantObject(String, String)method -
ISSUE_TYPE_CONSTANT_TYPE
Deprecated.Used in the genericgetConstantObject(String, String)method -
ISSUE_CONSTANT_NAME_SEARCH_PATTERN
Used to filterIssueConstantobjects. It allows to check whether the name or any part of multi-word name starts with given string- See Also:
-
-
Method Details
-
getPriorities
Retrieve all Priorities in JIRA.- Returns:
- A list of Priority
Prioritys.
-
getPriorityObject
Given a priority ID, this method retrieves that priority.- Parameters:
id- The id of the priority- Returns:
- A
Priorityobject.
-
getPriorityName
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.
-
getDefaultPriority
Deprecated.Returns the default priority configured in JIRA.- Returns:
- The default priority
-
refreshPriorities
void refreshPriorities()Reloads all priorities from the DB. -
getResolutions
Retrieve all Resolutions in JIRA.- Returns:
- A List of Resolution
Resolutions.
-
getResolution
Given a resolution ID, this method retrieves that resolution.- Parameters:
id- The id of the resolution- Returns:
- A resolution
-
refreshResolutions
void refreshResolutions()Reloads all resolutions from the DB. -
getIssueType
Given an IssueType ID this method retrieves that IssueType.- Parameters:
id- The ID of the IssueType.- Returns:
- An IssueType
-
getRegularIssueTypeObjects
Collection<IssueType> getRegularIssueTypeObjects()Retrieve regular (non-subtask) issue types.- Returns:
- A collection of
IssueTypes
-
getAllIssueTypeObjects
Collection<IssueType> getAllIssueTypeObjects()Returns a list of IssueTypes.- Returns:
- A Collection of
IssueTypeobjects.
-
getAllIssueTypeIds
Returns all issueType Ids.- Returns:
- A list of all the IssueType Ids.
-
getSubTaskIssueTypeObjects
Retrieves all the sub-task issue types- Returns:
- A Collection of all sub-task
IssueTypes.
-
getEditableSubTaskIssueTypes
Retrieves an mutable list of sub-task issues. The list is mutable, that is its elements can be reordered added to or removed. The elements of the list, that is the issue types themselves, are not mutable.- Returns:
- A List of editable sub-task
-
expandIssueTypeIds
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 seeALL_STANDARD_ISSUE_TYPES,ALL_SUB_TASK_ISSUE_TYPESandALL_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).
-
refreshIssueTypes
void refreshIssueTypes()Reloads all IssueTypes from the DB. -
insertIssueType
@Deprecated IssueType insertIssueType(String name, Long sequence, String style, String description, String iconurl) throws CreateException Deprecated.UseinsertIssueType(String, Long, String, String, Long)instead. Since v6.3.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 IssueTypesequence- 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
- Throws:
CreateException- If there is an error creating this Issue Type.
-
insertIssueType
IssueType insertIssueType(String name, Long sequence, String style, String description, Long avatarId) throws CreateException 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 IssueTypesequence- 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
- Throws:
CreateException- If there is an error creating this Issue Type.- Since:
- v6.3
-
validateCreateIssueType
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 IssueTypestyle- 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.
-
validateCreateIssueTypeWithAvatar
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 IssueTypestyle- 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.- Since:
- v6.3
-
updateIssueType
@Deprecated void updateIssueType(String id, String name, Long sequence, String style, String description, String iconurl) throws DataAccessException Deprecated.useupdateIssueType(String, String, Long, String, String, Long)since v6.3Updates 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 IssueTypesequence- 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:
DataAccessException- indicates an error in the Data Access Layer
-
updateIssueType
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 IssueTypesequence- 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.- Throws:
DataAccessException- indicates an error in the Data Access Layer- Since:
- v6.3
-
removeIssueType
Deprecated.Since 7.0. Do not use this method!!! UseIssueTypeManager.removeIssueType(String, String).Removes an existing issueType. This will cause a invalidate of all issue types (i.e. reload from the DB).THIS METHOD IS BROKEN AND SHOULD NEVER BE USED SINCE v5.0.
- Parameters:
id- ID of an existing issueType- Throws:
RemoveException- if the issueType with id doesn't exist, or an error occurred removing the issue.
-
getStatus
Returns a Status given an id.- Parameters:
id- The id of a status- Returns:
- Returns a status
-
getStatusObject
Deprecated.UsegetStatus(java.lang.String)instead. Deprecated since v7.0Returns a Status given an id.- Parameters:
id- The id of a status- Returns:
- Returns a
Statusobject.
-
getStatuses
Collection<Status> getStatuses()Returns all statuses- Returns:
- Returns a Collection of status
Statuss.
-
refreshStatuses
void refreshStatuses()Reloads all statuses from DB. -
getStatusByName
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
Statusobject with the given name, ornullif none found.
-
getStatusByNameIgnoreCase
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
Statusobject with the given name, ornullif none found.
-
getStatusByTranslatedName
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
Statusobject with the given name, ornullif none found.
-
getConstantObject
Returns anIssueConstantobject for the given type invalid input: '&' id.- Parameters:
constantType- SeeConstantsManager.CONSTANT_TYPEid- The id of the constant.- Returns:
- A
IssueConstantobject. Null if it doesn't exist.
-
getConstantObjects
Returns allIssueConstantobjects for the given type.- Parameters:
constantType- SeeConstantsManager.CONSTANT_TYPE- Returns:
- A collection of
IssueConstantobject; will benullif and only ifconstantTypeis invalid
-
getConstantsByIds
@Nonnull List<IssueConstant> getConstantsByIds(@Nonnull ConstantsManager.CONSTANT_TYPE constantType, @Nonnull Collection<String> ids) Converts the list of ids to the objects of appropriate types- Parameters:
constantType- Type of constantids- list of constant ids- Returns:
- List of IssueConstant subclasses.
-
constantExists
Checks if a constant exists.- Parameters:
constantType- SeePRIORITY_CONSTANT_TYPE,STATUS_CONSTANT_TYPE,RESOLUTION_CONSTANT_TYPE,ISSUE_TYPE_CONSTANT_TYPEname- The name of the constant.- Returns:
- True if the constant exists. False otherwise
-
getIssueConstantByName
Returns a constant by name.- Parameters:
constantType- SeePRIORITY_CONSTANT_TYPE,STATUS_CONSTANT_TYPE,RESOLUTION_CONSTANT_TYPE,ISSUE_TYPE_CONSTANT_TYPEname- The Name of the constant.- Returns:
- The IssueConstant
-
getConstantByNameIgnoreCase
Returns a constant by name ignoring the case of the name passed in.- Parameters:
constantType- SeePRIORITY_CONSTANT_TYPE,STATUS_CONSTANT_TYPE,RESOLUTION_CONSTANT_TYPE,ISSUE_TYPE_CONSTANT_TYPEname- The Name of the constant, case-insensitive.- Returns:
- An IssueConstant (or null if not found)
-
getIssueConstant
Deprecated.Deprecated since v7.0. You just shouldn't have GVs any moreConverts a constantGenericValueto anIssueConstantobject.- Parameters:
issueConstantGV- the constantGenericValue.- Returns:
- An
IssueConstantobject.
-
validateName
io.atlassian.fugue.Option<Pair<String,ErrorCollection.Reason>> validateName(String name, io.atlassian.fugue.Option<IssueType> issueTypeToUpdate) Validates the name of issue type. If the validation passes returns Option.none, else returns na Option with a pair of error message and reason. -
invalidateAll
void invalidateAll()Sets all cached copies of constants to null. This will cause them to be re-loaded from the DB the next time they are accessed. -
invalidate
Clear the cache for this Issue Constant. Implementations may clear additional IssueConstants at their discretion. -
recalculateIssueTypeSequencesAndStore
Resequences the supplied issuetypes into sequential order.- Parameters:
issueTypes-
-
recalculatePrioritySequencesAndStore
Resequences the supplied priorities into sequential order.- Parameters:
priorities-
-
recalculateStatusSequencesAndStore
Resequences the supplied statuses into sequential order.- Parameters:
statuses-
-
recalculateResolutionSequencesAndStore
Resequences the supplied resolutions into sequential order.- Parameters:
resolutions-
-
createIssueConstantNameSearchPattern
@ExperimentalApi static Pattern createIssueConstantNameSearchPattern(@NotEmpty @NotEmpty String substring) - Parameters:
substring- starting part of the name that must be present- Returns:
- pattern for filtering issue constant names
-
ConstantsManager.CONSTANT_TYPE.ISSUE_TYPE