Class DefaultIssueTypeSchemeService
- All Implemented Interfaces:
IssueTypeSchemeService
- Since:
- v8.0
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultIssueTypeSchemeService(SearchService searchService, IssueTypeSchemeManager issueTypeSchemeManager, ProjectService projectService, GlobalPermissionManager globalPermissionManager, I18nHelper.BeanFactory i18nFactory, IssueTypeService issueTypeService) -
Method Summary
Modifier and TypeMethodDescriptionaddProjectAssociations(ApplicationUser user, long schemeId, List<String> projectIdsOrKeys) Adds additional project-scheme associations between the issue type scheme specified by theschemeIdand the projects given by theprojectIdsOrKeyscollection.createIssueTypeScheme(ApplicationUser user, String name, String description, List<String> issueTypeIds, String defaultIssueTypeId) Creates a new issue type scheme with the specified name, description, issue types, and default issue type.deleteIssueTypeScheme(ApplicationUser user, long schemeId) Deletes the issue type scheme specified by theschemeId.<T> ServiceOutcome<T> errorCase(String msg, ErrorCollection.Reason reason) Creates a failed service outcome with the specified errormsgandreason.Retrieves and returns all issue type schemes in the Jira.getAssociatedProjects(ApplicationUser user, long schemeId) Retrieves the project-scheme associations for the issue type scheme specified by theschemeId.getDefaultIssueType(FieldConfigScheme issueTypeScheme) Looks up and returns the default issue type (the one that is presented as the initial/selected choice to users when creating a new Issue, for instance) for the specified issue type scheme.getIssuesMatchingTypesInProjects(ApplicationUser user, Collection<Long> projectIds, Collection<String> issueTypeIds) For the projects specified byprojectIds, finds the issues that are of the types given byissueTypIds.getIssuesMatchingTypesInProjectsUnsorted(ApplicationUser user, Collection<Long> projectIds, Collection<String> issueTypeIds) For the projects specified byprojectIds, finds the issues that are of the types given byissueTypIds.getIssuesRequiringMigration(ApplicationUser user, Collection<String> chosenIssueTypeIds, List<Long> projectIds) Figures out which issues in the specified projects would require migration if only thechosenIssueTypeIdswere made available to the projects.getIssuesRequiringMigrationDueToSchemeAssociation(ApplicationUser user, FieldConfigScheme issueTypeScheme, List<Long> projectIds) Figures out which issues in the specified projects would require migration if the givenissueTypeSchemewere to be associated with them.getIssueTypeScheme(ApplicationUser user, long schemeId) Retrieves the issue type scheme specified by theschemeId.longgetNumIssuesMatchingTypesInProjects(ApplicationUser user, Collection<Long> projectIds, Collection<String> issueTypeIds) For the projects specified byprojectIds, determines how many issues are of the types given byissueTypIds.removeAllProjectAssociations(ApplicationUser user, long schemeId) Removes all project associations for the issue type scheme specified by theschemeId.removeProjectAssociation(ApplicationUser user, long schemeId, String projKeyOrId) For the issue type scheme specified by theschemeId, removes the project association given byprojKeyOrId.setProjectAssociations(ApplicationUser user, long schemeId, List<String> projectIdsOrKeys) Replaces the project-scheme associations for the issue type scheme specified by theschemeIdwith the projects given by theprojectIdsOrKeyscollection.updateIssueTypeScheme(ApplicationUser user, long schemeId, String name, String description, List<String> issueTypeIds, String defaultIssueTypeId) Updates the issue type scheme specified byschemeIdto have the given name, description, issue types, and default issue type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.jira.config.IssueTypeSchemeService
addProjectAssociations, createIssueTypeScheme, deleteIssueTypeScheme, getAssociatedProjects, getIssueTypeScheme, removeAllProjectAssociations, removeProjectAssociation, setProjectAssociations, updateIssueTypeScheme, updateIssueTypeScheme, updateIssueTypeScheme
-
Constructor Details
-
DefaultIssueTypeSchemeService
public DefaultIssueTypeSchemeService(SearchService searchService, IssueTypeSchemeManager issueTypeSchemeManager, ProjectService projectService, GlobalPermissionManager globalPermissionManager, I18nHelper.BeanFactory i18nFactory, IssueTypeService issueTypeService)
-
-
Method Details
-
createIssueTypeScheme
public ServiceOutcome<FieldConfigScheme> createIssueTypeScheme(ApplicationUser user, String name, String description, List<String> issueTypeIds, String defaultIssueTypeId) Description copied from interface:IssueTypeSchemeServiceCreates a new issue type scheme with the specified name, description, issue types, and default issue type. Newly created issue type schemes do not start out associated with any projects.This operation will fail validation and return an unsuccessful outcome if:
- the user is not a Jira administrator
- the name is null or an empty string
- no issue type ids are specified
- the new scheme's default issue type is not listed among the
issueTypeIds
- Specified by:
createIssueTypeSchemein interfaceIssueTypeSchemeService- Parameters:
user- user that performs the create operation. Must be a Jira administrator.name- what the new issue type scheme will be called. Must not be null or empty.description- optional additional information about the new schemeissueTypeIds- which issue types will be available to projects associated with this scheme. Must not be null or empty.defaultIssueTypeId- specifies which of the new scheme's issue types will be initially selected when creating a new issue (in a project associated with this scheme). Can be null (meaning no default), but otherwise must be an id found inissueTypeIds.- Returns:
- a service outcome containing the created issue type scheme or an error if something went wrong during the operation.
-
getAllIssueTypeSchemes
Description copied from interface:IssueTypeSchemeServiceRetrieves and returns all issue type schemes in the Jira.This operation will fail validation and return an unsuccessful outcome if:
- the user is not a Jira administrator
- Specified by:
getAllIssueTypeSchemesin interfaceIssueTypeSchemeService- Parameters:
user- user that performs the retrieval operation. Must be a Jira administrator.- Returns:
- a service outcome containing the issue type schemes found in the Jira
-
getIssueTypeScheme
Description copied from interface:IssueTypeSchemeServiceRetrieves the issue type scheme specified by theschemeId.This operation will fail validation and return an unsuccessful outcome if:
- the user is not a Jira administrator
- the schemeId does not correspond with a valid issue type scheme
- Specified by:
getIssueTypeSchemein interfaceIssueTypeSchemeService- Parameters:
user- user that performs the retrieval operation. Must be a Jira administrator.schemeId- unique id that references an existing issue type scheme to retrieve.- Returns:
- a service outcome containing the specified issue type scheme, if it exists.
-
updateIssueTypeScheme
public ServiceOutcome<FieldConfigScheme> updateIssueTypeScheme(ApplicationUser user, long schemeId, String name, String description, List<String> issueTypeIds, String defaultIssueTypeId) Description copied from interface:IssueTypeSchemeServiceUpdates the issue type scheme specified byschemeIdto have the given name, description, issue types, and default issue type. Project associations are not within the scope of this operation; usesetProjectAssociationsoraddProjectAssociationsinstead.This operation will fail validation and return an unsuccessful outcome if:
- the user is not a Jira administrator
- the schemeId does not correspond with a valid issue type scheme
- an attempt is made to update the system's default issue type scheme
- the name is null or an empty string
- no issue type ids are specified
- the new default issue type is not listed among the
issueTypeIdsbeing assigned - changing the scheme's issue types requires a migration of issues by any of its associated projects
- Specified by:
updateIssueTypeSchemein interfaceIssueTypeSchemeService- Parameters:
user- user that performs the update operation. Must be a Jira administrator.schemeId- unique id that references an existing issue type scheme to update.name- what the issue type scheme will be called after the update. Must not be null or empty.description- optional additional information about the updated schemeissueTypeIds- which issue types will be available to projects associated with this scheme. Must not be null or empty.defaultIssueTypeId- specifies which of the scheme's issue types will be initially selected when creating a new issue (in a project associated with this scheme). Can be null (meaning no default), but otherwise must be an id found inissueTypeIdsbeing assigned.- Returns:
- a service outcome containing the updated issue type scheme or an error if something went wrong during the operation.
-
deleteIssueTypeScheme
Description copied from interface:IssueTypeSchemeServiceDeletes the issue type scheme specified by theschemeId. Any projects associated with this scheme will revert to the global default issue type scheme.This operation will fail validation and return an unsuccessful outcome if:
- the user is not a Jira administrator
- the schemeId does not correspond with a valid issue type scheme
- an attempt is made to delete the system's default issue type scheme
- Specified by:
deleteIssueTypeSchemein interfaceIssueTypeSchemeService- Parameters:
user- user that performs the delete operation. Must be a Jira administrator.schemeId- unique id that references an existing issue type scheme to delete.- Returns:
- an empty service outcome indicating a successful deletion or an error if something went wrong during the operation.
-
addProjectAssociations
public ServiceOutcome<Void> addProjectAssociations(ApplicationUser user, long schemeId, List<String> projectIdsOrKeys) Description copied from interface:IssueTypeSchemeServiceAdds additional project-scheme associations between the issue type scheme specified by theschemeIdand the projects given by theprojectIdsOrKeyscollection. This operation does not modify or remove any existing project associations that the scheme has.This operation will fail validation and return an unsuccessful outcome if:
- the user is not a Jira administrator
- the schemeId does not correspond with a valid issue type scheme
- any of the
projectIdsOrKeysdoes not reference a valid project - associating the scheme with any of the specified projects requires an issue migration
- Specified by:
addProjectAssociationsin interfaceIssueTypeSchemeService- Parameters:
user- user that performs the association operation. Must be a Jira administrator.schemeId- unique id that references an existing issue type scheme to add project associations to.projectIdsOrKeys- lookup keys/ids for projects to be associated with the issue type scheme- Returns:
- an empty service outcome indicating the successful addition of associated projects or an error if something went wrong during the operation.
-
getAssociatedProjects
Description copied from interface:IssueTypeSchemeServiceRetrieves the project-scheme associations for the issue type scheme specified by theschemeId.This operation will fail validation and return an unsuccessful outcome if:
- the user is not a Jira administrator
- the schemeId does not correspond with a valid issue type scheme
- Specified by:
getAssociatedProjectsin interfaceIssueTypeSchemeService- Parameters:
user- user that performs the association operation. Must be a Jira administrator.schemeId- unique id that references an existing issue type scheme- Returns:
- the projects associated with the specified
schemeIdor an error if something went wrong during the operation.
-
setProjectAssociations
public ServiceOutcome<Void> setProjectAssociations(ApplicationUser user, long schemeId, List<String> projectIdsOrKeys) Description copied from interface:IssueTypeSchemeServiceReplaces the project-scheme associations for the issue type scheme specified by theschemeIdwith the projects given by theprojectIdsOrKeyscollection. Again, this operation overwrites any existing project associations that the scheme has.This operation will fail validation and return an unsuccessful outcome if:
- the user is not a Jira administrator
- the schemeId does not correspond with a valid issue type scheme
- any of the
projectIdsOrKeysdoes not reference a valid project - associating the scheme with any of the specified projects requires an issue migration
- Specified by:
setProjectAssociationsin interfaceIssueTypeSchemeService- Parameters:
user- user that performs the association operation. Must be a Jira administrator.schemeId- unique id that references an existing issue type scheme.projectIdsOrKeys- lookup keys/ids for projects to be associated with the issue type scheme- Returns:
- an empty service outcome indicating the successful replacement of associated projects or an error if something went wrong during the operation.
-
removeProjectAssociation
public ServiceOutcome<Void> removeProjectAssociation(ApplicationUser user, long schemeId, String projKeyOrId) Description copied from interface:IssueTypeSchemeServiceFor the issue type scheme specified by theschemeId, removes the project association given byprojKeyOrId.This operation will fail validation and return an unsuccessful outcome if:
- the user is not a Jira administrator
- the schemeId does not correspond with a valid issue type scheme
- the schemeId corresponds with the default global issue type scheme
- the projKeyOrId doesn't correspond with a project that the issue type scheme is associated with
- any of the
projectIdsOrKeysdoes not reference a valid project
- Specified by:
removeProjectAssociationin interfaceIssueTypeSchemeService- Parameters:
user- user that performs the removal operation. Must be a Jira administrator.schemeId- unique id that references an existing issue type scheme.projKeyOrId- key/id for the project that we're un-associating with the scheme- Returns:
- an empty service outcome indicating the successful removal of the associated project or an error if something went wrong during the operation.
-
removeAllProjectAssociations
Description copied from interface:IssueTypeSchemeServiceRemoves all project associations for the issue type scheme specified by theschemeId.This operation will fail validation and return an unsuccessful outcome if:
- the user is not a Jira administrator
- the schemeId does not correspond with a valid issue type scheme
- the schemeId corresponds with the default global issue type scheme
- Specified by:
removeAllProjectAssociationsin interfaceIssueTypeSchemeService- Parameters:
user- user that performs the removal operation. Must be a Jira administrator.schemeId- unique id that references an existing issue type scheme.- Returns:
- an empty service outcome indicating the successful removal of the associated projects or an error if something went wrong during the operation.
-
getNumIssuesMatchingTypesInProjects
public long getNumIssuesMatchingTypesInProjects(ApplicationUser user, Collection<Long> projectIds, Collection<String> issueTypeIds) throws SearchException Description copied from interface:IssueTypeSchemeServiceFor the projects specified byprojectIds, determines how many issues are of the types given byissueTypIds. This functionality is provided as a separate hook, as it can be implemented more efficiently this way rather than viagetIssuesMatchingTypesInProjects(..).size().- Specified by:
getNumIssuesMatchingTypesInProjectsin interfaceIssueTypeSchemeService- Parameters:
user- user that performs the lookup operation.projectIds- unique identifiers for the projects whose issues we'd like to inspect.issueTypeIds- unique identifiers for the issue types that we're looking for instances of in the projects.- Returns:
- the number of issues in the given projects that are of the types specified by
issueTypeIds - Throws:
SearchException
-
getIssuesMatchingTypesInProjects
public List<Issue> getIssuesMatchingTypesInProjects(ApplicationUser user, Collection<Long> projectIds, Collection<String> issueTypeIds) throws SearchException Description copied from interface:IssueTypeSchemeServiceFor the projects specified byprojectIds, finds the issues that are of the types given byissueTypIds. Note: rather than calling .size() on the results of this method, use the more efficientgetNumIssuesMatchingTypesInProjects(...)instead.- Specified by:
getIssuesMatchingTypesInProjectsin interfaceIssueTypeSchemeService- Parameters:
user- user that performs the lookup operation.projectIds- unique identifiers for the projects whose issues we'd like to inspect.issueTypeIds- unique identifiers for the issue types that we're looking for instances of in the projects.- Returns:
- List of Issues in the given projects that are of the types specified by
issueTypeIds - Throws:
SearchException
-
getIssuesMatchingTypesInProjectsUnsorted
public Stream<Issue> getIssuesMatchingTypesInProjectsUnsorted(ApplicationUser user, Collection<Long> projectIds, Collection<String> issueTypeIds) throws SearchException Description copied from interface:IssueTypeSchemeServiceFor the projects specified byprojectIds, finds the issues that are of the types given byissueTypIds.- Specified by:
getIssuesMatchingTypesInProjectsUnsortedin interfaceIssueTypeSchemeService- Parameters:
user- user that performs the lookup operation.projectIds- unique identifiers for the projects whose issues we'd like to inspect.issueTypeIds- unique identifiers for the issue types that we're looking for instances of in the projects.- Returns:
- Unsorted stream of Issues in the given projects that are of the types specified by
issueTypeIds. Note that it should be closed after use, e.g. using try-with-resources - Throws:
SearchException
-
getIssuesRequiringMigration
public ServiceOutcome<List<Issue>> getIssuesRequiringMigration(ApplicationUser user, Collection<String> chosenIssueTypeIds, List<Long> projectIds) Description copied from interface:IssueTypeSchemeServiceFigures out which issues in the specified projects would require migration if only thechosenIssueTypeIdswere made available to the projects.- Specified by:
getIssuesRequiringMigrationin interfaceIssueTypeSchemeService- Parameters:
user- user that performs the lookup operation.chosenIssueTypeIds- collection of issue type ids against which we're checking the need for issue migrations.projectIds- collection of unique identifiers for the projects whose issues may require migration.- Returns:
- a service outcome containing the list of issues requiring migration (if any) or an error if something went wrong during the operation.
-
getIssuesRequiringMigrationDueToSchemeAssociation
public ServiceOutcome<List<Issue>> getIssuesRequiringMigrationDueToSchemeAssociation(ApplicationUser user, FieldConfigScheme issueTypeScheme, List<Long> projectIds) Description copied from interface:IssueTypeSchemeServiceFigures out which issues in the specified projects would require migration if the givenissueTypeSchemewere to be associated with them.- Specified by:
getIssuesRequiringMigrationDueToSchemeAssociationin interfaceIssueTypeSchemeService- Parameters:
user- user that performs the lookup operation.issueTypeScheme- issue type scheme against which we're checking the need for issue migrations.projectIds- collection of unique identifiers for the projects whose issues may require migration.- Returns:
- a service outcome containing the list of issues requiring migration (if any) or an error if something went wrong during the operation.
-
errorCase
Description copied from interface:IssueTypeSchemeServiceCreates a failed service outcome with the specified errormsgandreason.- Specified by:
errorCasein interfaceIssueTypeSchemeService- Type Parameters:
T- generic type that corresponds with what the successful outcome would have been.- Parameters:
msg- string explanation of the failure.reason- Motivation/reason behind the failure.- Returns:
- a failed service outcome with the specified error.
-
getDefaultIssueType
Description copied from interface:IssueTypeSchemeServiceLooks up and returns the default issue type (the one that is presented as the initial/selected choice to users when creating a new Issue, for instance) for the specified issue type scheme.- Specified by:
getDefaultIssueTypein interfaceIssueTypeSchemeService- Parameters:
issueTypeScheme- scheme whose default issue type we'd like to look up.- Returns:
- the default issue type for the specified issue type scheme--or null if it is unspecified.
-