public class DefaultProjectService extends Object implements ProjectService
Modifier and Type | Class and Description |
---|---|
protected class |
DefaultProjectService.PermissionErrorResult
A GetProjectResult that indicates the calling user does not have permission to perform an action on a project.
|
protected class |
DefaultProjectService.ProjectNotFoundResult
A GetProjectResult that indicates a project was not found.
|
ProjectService.AbstractProjectResult, ProjectService.AbstractProjectValidationResult, ProjectService.CreateProjectValidationResult, ProjectService.DeleteProjectResult, ProjectService.DeleteProjectValidationResult, ProjectService.GetProjectResult, ProjectService.UpdateProjectRequest, ProjectService.UpdateProjectSchemesValidationResult, ProjectService.UpdateProjectValidationResult
DEFAULT_NAME_LENGTH, MAX_KEY_LENGTH, MAX_NAME_LENGTH, MIN_NAME_LENGTH, PROJECT_CATEGORY_ID, PROJECT_DESCRIPTION, PROJECT_KEY, PROJECT_LEAD, PROJECT_NAME, PROJECT_TYPE, PROJECT_URL
Constructor and Description |
---|
DefaultProjectService(JiraAuthenticationContext jiraAuthenticationContext,
ProjectManager projectManager,
ApplicationProperties applicationProperties,
PermissionManager permissionManager,
GlobalPermissionManager globalPermissionManager,
PermissionSchemeManager permissionSchemeManager,
NotificationSchemeManager notificationSchemeManager,
IssueSecuritySchemeManager issueSecuritySchemeManager,
SchemeFactory schemeFactory,
WorkflowSchemeManager workflowSchemeManager,
IssueTypeScreenSchemeManager issueTypeScreenSchemeManager,
CustomFieldManager customFieldManager,
NodeAssociationStore nodeAssociationStore,
VersionManager versionManager,
ProjectComponentManager projectComponentManager,
SharePermissionDeleteUtils sharePermissionDeleteUtils,
AvatarManager avatarManager,
I18nHelper.BeanFactory i18nFactory,
WorkflowManager workflowManager,
UserManager userManager,
ProjectEventManager projectEventManager,
ProjectKeyStore projectKeyStore,
ProjectTypeValidator projectTypeValidator,
ProjectCreateNotifier projectCreateNotifier,
ProjectTypeUpdatedNotifier projectTypeUpdatedNotifier,
com.atlassian.beehive.ClusterLockService clusterLockService,
ProjectTemplateManager projectTemplateManager,
ProjectSchemeAssociationManager projectSchemeAssociationManager,
TaskManager taskManager,
IssueManager issueManager) |
Modifier and Type | Method and Description |
---|---|
Project |
createProject(ProjectService.CreateProjectValidationResult result)
Using the validation result from
ProjectService.validateCreateProject(ApplicationUser, ProjectCreationData) a new project will be created. |
ProjectService.DeleteProjectResult |
deleteProject(ApplicationUser user,
ProjectService.DeleteProjectValidationResult deleteProjectValidationResult)
Deletes the project provided by the deleteProjectValidationResult.
|
ProjectService.DeleteProjectResult |
deleteProjectAsynchronous(ApplicationUser user,
ProjectService.DeleteProjectValidationResult deleteProjectValidationResult)
Deletes the project provided by the deleteProjectValidationResult in a backgound task and provides a progress URL
that may be used to monitor the delete progress.
|
ServiceOutcome<List<Project>> |
getAllProjects(ApplicationUser user)
Used to retrieve a list of
Project objects. |
ServiceOutcome<List<Project>> |
getAllProjectsForAction(ApplicationUser user,
ProjectAction action)
Used to retrieve a list of
Project objects. |
ServiceOutcome<List<Project>> |
getAllProjectsForAction(ApplicationUser user,
ProjectAction action,
boolean includeArchived)
Used to retrieve a list of
Project objects. |
protected I18nHelper |
getI18nBean(ApplicationUser user) |
int |
getMaximumKeyLength()
Used to retrieve the maximum length allowed for new project keys.
|
int |
getMaximumNameLength()
Used to retrieve the maximum length allowed for new project names.
|
ProjectService.GetProjectResult |
getProjectById(ApplicationUser user,
Long id)
Used to retrieve a
Project object by id. |
ProjectService.GetProjectResult |
getProjectById(Long id)
Used to retrieve a
Project object by id. |
ProjectService.GetProjectResult |
getProjectByIdForAction(ApplicationUser user,
Long id,
ProjectAction action)
Used to retrieve a
Project object by id providing the user can perform the
passed action on the project. |
ProjectService.GetProjectResult |
getProjectByKey(ApplicationUser user,
String key)
Used to retrieve a
Project object by key. |
ProjectService.GetProjectResult |
getProjectByKey(String key)
Used to retrieve a
Project object by key. |
ProjectService.GetProjectResult |
getProjectByKeyForAction(ApplicationUser user,
String key,
ProjectAction action)
Used to retrieve a
Project object by key providing the user can perform the
passed action on the project. |
long |
getProjectCount()
Used to retrieve the total number of
Project s, regardless of the permission to see those projects. |
String |
getProjectKeyDescription()
Get the project key description from the properties file.
|
protected JiraServiceContext |
getServiceContext(ApplicationUser user,
ErrorCollection errorCollection) |
boolean |
isValidAllProjectData(JiraServiceContext serviceContext,
ProjectCreationData projectCreationData)
|
boolean |
isValidProjectKey(JiraServiceContext serviceContext,
String key)
Validates the given project key.
|
boolean |
isValidRequiredProjectData(JiraServiceContext serviceContext,
ProjectCreationData projectCreationData)
Validate the fields required for creating a project.
|
protected ErrorCollection |
makeErrorCollection(ApplicationUser user,
String i18nKey,
ErrorCollection.Reason reason,
String... params)
Creates a new ErrorCollection instance for a single error message.
|
Project |
updateProject(ProjectService.UpdateProjectValidationResult result)
Using the validation result from
ProjectService.validateUpdateProject(ApplicationUser, String, String,
String, String, String, Long) this method performs the actual update on the project. |
void |
updateProjectSchemes(ProjectService.UpdateProjectSchemesValidationResult result,
Project project)
Updates the project schemes for a particular project, given a validation result and project to update.
|
io.atlassian.fugue.Either<Project,ErrorCollection> |
updateProjectType(ApplicationUser user,
Project project,
ProjectTypeKey newProjectType)
Updates the type of a project.
|
ProjectService.CreateProjectValidationResult |
validateCreateProject(ApplicationUser user,
ProjectCreationData projectCreationData)
This method needs to be called before creating a project to ensure all parameters are correct.
|
ProjectService.CreateProjectValidationResult |
validateCreateProjectBasedOnExistingProject(ApplicationUser user,
Long existingProjectId,
ProjectCreationData input)
Validates if the current user can create a new project with shared schemes based on the existing project
provided.
|
ProjectService.DeleteProjectValidationResult |
validateDeleteProject(ApplicationUser user,
String key)
Validation to delete a project is quite straightforward.
|
ProjectService.UpdateProjectValidationResult |
validateUpdateProject(ApplicationUser user,
ProjectService.UpdateProjectRequest updateProjectRequest)
Validates updating a project's details.
|
ProjectService.UpdateProjectValidationResult |
validateUpdateProject(ApplicationUser applicationUser,
Project originalProject,
String name,
String key,
String description,
ApplicationUser lead,
String url,
Long assigneeType,
Long avatarId)
Validates updating a project's details.
|
ProjectService.UpdateProjectValidationResult |
validateUpdateProject(ApplicationUser applicationUser,
Project originalProject,
String name,
String key,
String description,
String leadName,
String url,
Long assigneeType,
Long avatarId)
Validates updating a project's details.
|
ServiceResult |
validateUpdateProject(ApplicationUser user,
String key)
Validates that the given user is authorised to update a project.
|
ProjectService.UpdateProjectValidationResult |
validateUpdateProject(ApplicationUser user,
String name,
String key,
String description,
ApplicationUser lead,
String url,
Long assigneeType)
Validates updating a project's details.
|
ProjectService.UpdateProjectValidationResult |
validateUpdateProject(ApplicationUser user,
String name,
String key,
String description,
ApplicationUser lead,
String url,
Long assigneeType,
Long avatarId)
Validates updating a project's details.
|
ProjectService.UpdateProjectValidationResult |
validateUpdateProject(ApplicationUser user,
String name,
String key,
String description,
String leadName,
String url,
Long assigneeType)
Validates updating a project's details.
|
ProjectService.UpdateProjectValidationResult |
validateUpdateProject(ApplicationUser user,
String name,
String key,
String description,
String leadName,
String url,
Long assigneeType,
Long avatarId)
Validates updating a project's details.
|
ProjectService.UpdateProjectSchemesValidationResult |
validateUpdateProjectSchemes(ApplicationUser user,
Long permissionSchemeId,
Long notificationSchemeId,
Long issueSecuritySchemeId)
If the scheme ids are not null or -1 (-1 is often used to reset schemes), then an attempt will be made to
retrieve the scheme.
|
public DefaultProjectService(JiraAuthenticationContext jiraAuthenticationContext, ProjectManager projectManager, ApplicationProperties applicationProperties, PermissionManager permissionManager, GlobalPermissionManager globalPermissionManager, PermissionSchemeManager permissionSchemeManager, NotificationSchemeManager notificationSchemeManager, IssueSecuritySchemeManager issueSecuritySchemeManager, SchemeFactory schemeFactory, WorkflowSchemeManager workflowSchemeManager, IssueTypeScreenSchemeManager issueTypeScreenSchemeManager, CustomFieldManager customFieldManager, NodeAssociationStore nodeAssociationStore, VersionManager versionManager, ProjectComponentManager projectComponentManager, SharePermissionDeleteUtils sharePermissionDeleteUtils, AvatarManager avatarManager, I18nHelper.BeanFactory i18nFactory, WorkflowManager workflowManager, UserManager userManager, ProjectEventManager projectEventManager, ProjectKeyStore projectKeyStore, ProjectTypeValidator projectTypeValidator, ProjectCreateNotifier projectCreateNotifier, ProjectTypeUpdatedNotifier projectTypeUpdatedNotifier, com.atlassian.beehive.ClusterLockService clusterLockService, ProjectTemplateManager projectTemplateManager, ProjectSchemeAssociationManager projectSchemeAssociationManager, TaskManager taskManager, IssueManager issueManager)
public ProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser user, String name, String key, String description, ApplicationUser lead, String url, Long assigneeType)
ProjectService
ProjectService.validateCreateProject(ApplicationUser, ProjectCreationData)
method.
The only difference is that the project key will obviously not be validated.
A project can be updated by any user with the global admin permission or project admin permission for the project
in question.
WARNING: In 6.0-6.0.5, this method is available but does not work properly for renamed users (JRA-33843).validateUpdateProject
in interface ProjectService
user
- The user trying to update a projectname
- The name of the new projectkey
- The project key of the project to update.description
- An optional description for the projectlead
- The lead developer for the projecturl
- An optional URL for the projectassigneeType
- The default assignee for issues created in this project. May be either project lead, or
unassigned if unassigned issues are enabled.public ProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser user, String name, String key, String description, ApplicationUser lead, String url, Long assigneeType, Long avatarId)
ProjectService
ProjectService.validateCreateProject(ApplicationUser, ProjectCreationData)
method.
The only difference is that the project key will obviously not be validated.
A project can be updated by any user with the global admin permission or project admin permission for the project
in question.
WARNING: In 6.0-6.0.5, this method is available but does not work properly for renamed users (JRA-33843).validateUpdateProject
in interface ProjectService
user
- The user trying to update a projectname
- The name of the new projectkey
- The project key of the project to update.description
- An optional description for the projectlead
- The lead developer for the projecturl
- An optional URL for the projectassigneeType
- The default assignee for issues created in this project. May be either project lead, or
unassigned if unassigned issues are enabled.avatarId
- the id of an existing avatar.public ProjectService.DeleteProjectValidationResult validateDeleteProject(ApplicationUser user, String key)
ProjectService
validateDeleteProject
in interface ProjectService
user
- The user trying to delete a projectkey
- The key of the project to deletepublic ProjectService.DeleteProjectResult deleteProject(ApplicationUser user, ProjectService.DeleteProjectValidationResult deleteProjectValidationResult)
ProjectService
deleteProject
in interface ProjectService
user
- The user trying to delete a projectdeleteProjectValidationResult
- Result from the validation, which also contains all the project's details.public ProjectService.DeleteProjectResult deleteProjectAsynchronous(ApplicationUser user, ProjectService.DeleteProjectValidationResult deleteProjectValidationResult)
ProjectService
deleteProjectAsynchronous
in interface ProjectService
user
- The user trying to delete a projectdeleteProjectValidationResult
- Result from the validation, which also contains all the project's details.public ProjectService.GetProjectResult getProjectById(Long id)
ProjectService
Project
object by id.
This method returns a ProjectService.GetProjectResult
. The project will be null if no project for the id
specified can be found, or if the user making the request does not have the BROWSE project permission for the
project. In both of these cases, the errorCollection in the result object will contain an appropriate error
message.
The current user will be looked up via the JiraAuthenticationContext,
so do not call this method from a background thread.
Use ProjectService.getProjectById(com.atlassian.jira.user.ApplicationUser, Long)
instead.
getProjectById
in interface ProjectService
id
- The id of the project.public ProjectService.GetProjectResult getProjectByKey(String key)
ProjectService
Used to retrieve a Project
object by key. This method returns a ProjectService.GetProjectResult
. The project will be null if no project for the
key specified can be found, or if the user making the request does not have the BROWSE project permission for the
project. In both of these cases, the errorCollection in the result object will contain an appropriate error
message.
The current user will be looked up via the JiraAuthenticationContext,
so do not call this method from a background thread.
Use ProjectService.getProjectByKey(com.atlassian.jira.user.ApplicationUser, String)
instead.
getProjectByKey
in interface ProjectService
key
- The key of the project.@Nonnull public ProjectService.CreateProjectValidationResult validateCreateProject(ApplicationUser user, @Nonnull ProjectCreationData projectCreationData)
ProjectService
AssigneeTypes.PROJECT_LEAD
,
AssigneeTypes.UNASSIGNED
, or null to let JIRA decide on the best default
assignee. UNASSIGNED will also only be valid, if unassigned issues are enabled in the General Configuration.
All the projects created in JIRA must have a project type, and its value must correspond to one of the project types defined on the JIRA
instance. A validation error will be reported if no project type is passed or if it does not meet the previous criteria.
There are two ways to provide the project type to this method: directly via ProjectCreationData.getProjectTypeKey()
or
indirectly via ProjectCreationData.getProjectTemplateKey()
.
If a project template key is provided, this method will look up the project template and use the template's project type as
the type of the created project.
If both a project type and a template key are provided on the received ProjectCreationData
, the project
type defined on the template will be compared to the project type defined in the project creation date and, if
they don't match, a validation error will be reported.
Providing a template key is the preferred method for creating a project since templates ensure projects are created in a more
useful way for a particular use case.
The method will return a ProjectService.CreateProjectValidationResult
which
contains an ErrorCollection with any potential errors and all the project's details.validateCreateProject
in interface ProjectService
user
- The user performing the actionprojectCreationData
- An object encapsulating all the data for the project that will get created@Nonnull public ProjectService.CreateProjectValidationResult validateCreateProjectBasedOnExistingProject(ApplicationUser user, @Nonnull Long existingProjectId, @Nonnull ProjectCreationData input)
ProjectService
ProjectAction.EDIT_PROJECT_CONFIG
permissions for it. Beyond these checks, validation rules will be the same as ProjectService.validateCreateProject(ApplicationUser, ProjectCreationData)
.validateCreateProjectBasedOnExistingProject
in interface ProjectService
user
- The user performing the actionexistingProjectId
- An existing project id to use as the base for the new project being createdinput
- An object encapsulating all the data for the project that will get createdprotected JiraServiceContext getServiceContext(ApplicationUser user, ErrorCollection errorCollection)
public Project createProject(ProjectService.CreateProjectValidationResult result)
ProjectService
ProjectService.validateCreateProject(ApplicationUser, ProjectCreationData)
a new project will be created.
This method will throw an IllegalStateException if the validation result contains any errors.
Project creation involves creating the project itself and setting some defaults for workflow schemes and issue
type screen schemes.
If the validation result contains an existing project id, the new project will be created with shared schemes, that is
the a new project will be associated with the the same schemes as the existing project:
createProject
in interface ProjectService
result
- Result from the validation, which also contains all the project's details.public ProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser user, String name, String key, String description, String leadName, String url, Long assigneeType)
ProjectService
ProjectService.validateCreateProject(ApplicationUser, ProjectCreationData)
method.
The only difference is that the project key will obviously not be validated.
A project can be updated by any user with the global admin permission or project admin permission for the project
in question.validateUpdateProject
in interface ProjectService
user
- The user trying to update a projectname
- The name of the new projectkey
- The project key of the project to update.description
- An optional description for the projectleadName
- The username of the lead developer for the projecturl
- An optional URL for the projectassigneeType
- The default assignee for issues created in this project. May be either project lead, or
unassigned if unassigned issues are enabled.public ServiceResult validateUpdateProject(ApplicationUser user, String key)
ProjectService
validateUpdateProject
in interface ProjectService
user
- The user trying to update a projectkey
- The project key of the project to update.public ProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser applicationUser, Project originalProject, String name, String key, String description, ApplicationUser lead, String url, Long assigneeType, Long avatarId)
ProjectService
ProjectService.validateCreateProject(ApplicationUser, ProjectCreationData)
method.
A project can be updated by any user with the global admin permission or project admin permission for the project
in question. A project key can be updated by any user with the global admin permission.validateUpdateProject
in interface ProjectService
applicationUser
- The user trying to update a projectoriginalProject
- The project to update with the values put in arguments (Project
object should not be modified)name
- The name of the new projectkey
- The new project keydescription
- An optional description for the projectlead
- The lead developer for the projecturl
- An optional URL for the projectassigneeType
- The default assignee for issues created in this project. May be either project lead, or
unassigned if unassigned issues are enabled.public ProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser applicationUser, Project originalProject, String name, String key, String description, String leadName, String url, Long assigneeType, Long avatarId)
ProjectService
ProjectService.validateCreateProject(ApplicationUser, ProjectCreationData)
method.
A project can be updated by any user with the global admin permission or project admin permission for the project
in question. A project key can be updated by any user with the global admin permission.validateUpdateProject
in interface ProjectService
applicationUser
- The user trying to update a projectoriginalProject
- The project to update with the values put in arguments (Project
object should not be modified)name
- The name of the new projectkey
- The new project keydescription
- An optional description for the projectleadName
- The user key for the lead developer for the projecturl
- An optional URL for the projectassigneeType
- The default assignee for issues created in this project. May be either project lead, or
unassigned if unassigned issues are enabled.public ProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser user, String name, String key, String description, String leadName, String url, Long assigneeType, Long avatarId)
ProjectService
ProjectService.validateCreateProject(ApplicationUser, ProjectCreationData)
method.
The only difference is that the project key will obviously not be validated.
A project can be updated by any user with the global admin permission or project admin permission for the project
in question.validateUpdateProject
in interface ProjectService
user
- The user trying to update a projectname
- The name of the new projectkey
- The project key of the project to update.description
- An optional description for the projectleadName
- The username of the lead developer for the projecturl
- An optional URL for the projectassigneeType
- The default assignee for issues created in this project. May be either project lead, or
unassigned if unassigned issues are enabled.avatarId
- the id of an existing avatar.public ProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser user, ProjectService.UpdateProjectRequest updateProjectRequest)
ProjectService
ProjectService.validateCreateProject(ApplicationUser, ProjectCreationData)
method.
The only difference is that the project key will obviously not be validated.
validateUpdateProject
in interface ProjectService
updateProjectRequest
- includes the changes that will be made to the projectpublic Project updateProject(ProjectService.UpdateProjectValidationResult result)
ProjectService
ProjectService.validateUpdateProject(ApplicationUser, String, String,
String, String, String, Long)
this method performs the actual update on the project.updateProject
in interface ProjectService
result
- Result from the validation, which also contains all the project's details.public ProjectService.UpdateProjectSchemesValidationResult validateUpdateProjectSchemes(ApplicationUser user, Long permissionSchemeId, Long notificationSchemeId, Long issueSecuritySchemeId)
ProjectService
validateUpdateProjectSchemes
in interface ProjectService
permissionSchemeId
- The permission scheme that the new project should usenotificationSchemeId
- The notification scheme that the new project should use. Optional.issueSecuritySchemeId
- The issue security scheme that the new project should use. Optional.public void updateProjectSchemes(ProjectService.UpdateProjectSchemesValidationResult result, Project project)
ProjectService
updateProjectSchemes
in interface ProjectService
result
- Result from the validation, which also contains all the schemes details.project
- The project which will have its schemes updated.public boolean isValidAllProjectData(JiraServiceContext serviceContext, ProjectCreationData projectCreationData)
ProjectService
ProjectService.validateCreateProject(com.atlassian.jira.user.ApplicationUser, com.atlassian.jira.bc.project.ProjectCreationData)
instead.
Validates the given project fields. Any errors will be added to the
JiraServiceContext
.
The project type is mandatory and its value must correspond to one of the project types defined on the JIRA
instance. A validation error will be reported if the passed value is null or if it does not meet the previous criteria.isValidAllProjectData
in interface ProjectService
serviceContext
- containing the ErrorCollection that will be populated with any validation errors
that are encountered. It also contains the logged in user so the correct locale is used for the error messages.projectCreationData
- An object encapsulating all the data for the project that will get createdpublic boolean isValidRequiredProjectData(JiraServiceContext serviceContext, ProjectCreationData projectCreationData)
ProjectService
JiraServiceContext
.isValidRequiredProjectData
in interface ProjectService
serviceContext
- containing the ErrorCollection that will be populated with any validation errors that are
encounteredprojectCreationData
- An object encapsulating all the data for the project that will get createdpublic boolean isValidProjectKey(JiraServiceContext serviceContext, String key)
ProjectService
JiraServiceContext
.isValidProjectKey
in interface ProjectService
serviceContext
- containing the ErrorCollection that will be populated with any validation errors that are
encounteredkey
- The key to validate @Nonnullpublic String getProjectKeyDescription()
ProjectService
getProjectKeyDescription
in interface ProjectService
public ProjectService.GetProjectResult getProjectByIdForAction(ApplicationUser user, Long id, ProjectAction action)
ProjectService
Project
object by id providing the user can perform the
passed action on the project. This method returns a ProjectService.GetProjectResult
. The project will be null if no project for the
id specified can be found, or if the user making the request cannot perform the passed action on the project.
In both of these cases, the errorCollection in the result object will contain an appropriate error message.getProjectByIdForAction
in interface ProjectService
user
- The user retrieving the project.id
- The id of the project.action
- the action the user must be able to perform on the project.public ProjectService.GetProjectResult getProjectById(ApplicationUser user, Long id)
ProjectService
Project
object by id. This method returns a ProjectService.GetProjectResult
. The project will be null if no project for the id
specified can be found, or if the user making the request does not have the BROWSE project permission for the
project. In both of these cases, the errorCollection in the result object will contain an appropriate error
message.getProjectById
in interface ProjectService
user
- The user retrieving the project.id
- The id of the project.public ProjectService.GetProjectResult getProjectByKey(ApplicationUser user, String key)
ProjectService
Project
object by key. This method returns a ProjectService.GetProjectResult
. The project will be null if no project for the
key specified can be found, or if the user making the request does not have the BROWSE project permission for the
project. In both of these cases, the errorCollection in the result object will contain an appropriate error
message.getProjectByKey
in interface ProjectService
user
- The user retrieving the project.key
- The key of the project.public ProjectService.GetProjectResult getProjectByKeyForAction(ApplicationUser user, String key, ProjectAction action)
ProjectService
Project
object by key providing the user can perform the
passed action on the project. This method returns a ProjectService.GetProjectResult
. The project will be null if no project for the
key specified can be found, or if the user making the request cannot perform the passed action on the project.
In both of these cases, the errorCollection in the result object will contain an appropriate error message.getProjectByKeyForAction
in interface ProjectService
user
- The user retrieving the project.key
- The key of the project.action
- the action the user must be able to perform on the project.public int getMaximumNameLength()
ProjectService
getMaximumNameLength
in interface ProjectService
public int getMaximumKeyLength()
ProjectService
getMaximumKeyLength
in interface ProjectService
public long getProjectCount()
ProjectService
Project
s, regardless of the permission to see those projects.getProjectCount
in interface ProjectService
public ServiceOutcome<List<Project>> getAllProjects(ApplicationUser user)
ProjectService
Project
objects. This method returns a
ServiceOutcome
containing a list of projects. The list will be empty, if the user does not have
the BROWSE project permission for any project or no projects are visible when using anonymous access.getAllProjects
in interface ProjectService
user
- The user retrieving the list of projects or NULL when using anonymous access.public ServiceOutcome<List<Project>> getAllProjectsForAction(ApplicationUser user, ProjectAction action)
ProjectService
Project
objects. This method returns a
ServiceOutcome
containing a list of projects that the user can perform the passed
action on. The list will be empty if no projects match the passed action.getAllProjectsForAction
in interface ProjectService
user
- The user retrieving the list of projects or NULL when using anonymous access.action
- the action the user must be able to perform on the returned projects.public ServiceOutcome<List<Project>> getAllProjectsForAction(ApplicationUser user, ProjectAction action, boolean includeArchived)
ProjectService
Project
objects. This method returns a
ServiceOutcome
containing a list of projects that the user can perform the passed
action on. The list will be empty if no projects match the passed action.getAllProjectsForAction
in interface ProjectService
user
- The user retrieving the list of projects or NULL when using anonymous access.action
- the action the user must be able to perform on the returned projects.includeArchived
- return all projects, including the archived onespublic io.atlassian.fugue.Either<Project,ErrorCollection> updateProjectType(ApplicationUser user, Project project, ProjectTypeKey newProjectType)
ProjectService
ProjectTypeUpdatedHandler
s will be notified.
If an exception is thrown by one of the ProjectTypeUpdatedHandler
, the project type update will be rolled back.updateProjectType
in interface ProjectService
user
- The user performing the actionproject
- The project which type needs to be updatednewProjectType
- The new project typeprotected final I18nHelper getI18nBean(ApplicationUser user)
protected final ErrorCollection makeErrorCollection(ApplicationUser user, String i18nKey, ErrorCollection.Reason reason, String... params)
user
- the ApplicationUser for whom the message will be i18n'edi18nKey
- a String containing an i18n keyreason
- a Reason codeparams
- a String array containing the i18n params @return a new ErrorCollectionCopyright © 2002-2019 Atlassian. All Rights Reserved.