|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@PublicApi public interface ProjectService
Nested Class Summary | |
---|---|
static class |
ProjectService.AbstractProjectResult
|
static class |
ProjectService.AbstractProjectValidationResult
|
static class |
ProjectService.CreateProjectResult
|
static class |
ProjectService.CreateProjectValidationResult
|
static class |
ProjectService.DeleteProjectResult
|
static class |
ProjectService.DeleteProjectValidationResult
|
static class |
ProjectService.GetProjectResult
|
static class |
ProjectService.UpdateProjectSchemesValidationResult
|
static class |
ProjectService.UpdateProjectValidationResult
|
Field Summary | |
---|---|
static int |
DEFAULT_NAME_LENGTH
Default project name length |
static int |
MAX_KEY_LENGTH
Deprecated. use getMaximumKeyLength() instead |
static int |
MAX_NAME_LENGTH
Deprecated. use getMaximumNameLength() instead; |
static int |
MIN_NAME_LENGTH
The minimum length allowed for the project name field. |
static String |
PROJECT_DESCRIPTION
The default name of HTML fields containing a Project's description. |
static String |
PROJECT_KEY
The default name of HTML fields containing a Project's key. |
static String |
PROJECT_LEAD
The default name of HTML fields containing a Project's lead. |
static String |
PROJECT_NAME
The default name of HTML fields containing a Project's name. |
static String |
PROJECT_URL
The default name of HTML fields containing a Project's URL. |
Method Summary | |
---|---|
Project |
createProject(ProjectService.CreateProjectValidationResult createProjectValidationResult)
Using the validation result from validateCreateProject(User, String, String,
String, String, String, Long) a new project will be created. |
ProjectService.DeleteProjectResult |
deleteProject(ApplicationUser user,
ProjectService.DeleteProjectValidationResult deleteProjectValidationResult)
Deletes the project provided by the deleteProjectValidationResult. |
ProjectService.DeleteProjectResult |
deleteProject(com.atlassian.crowd.embedded.api.User user,
ProjectService.DeleteProjectValidationResult deleteProjectValidationResult)
Deletes the project provided by the deleteProjectValidationResult. |
ServiceOutcome<List<Project>> |
getAllProjects(ApplicationUser user)
Used to retrieve a list of Project objects. |
ServiceOutcome<List<Project>> |
getAllProjects(com.atlassian.crowd.embedded.api.User 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(com.atlassian.crowd.embedded.api.User user,
ProjectAction action)
Used to retrieve a list of Project objects. |
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(com.atlassian.crowd.embedded.api.User user,
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 |
getProjectByIdForAction(com.atlassian.crowd.embedded.api.User 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(com.atlassian.crowd.embedded.api.User user,
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. |
ProjectService.GetProjectResult |
getProjectByKeyForAction(com.atlassian.crowd.embedded.api.User 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. |
boolean |
isValidAllProjectData(JiraServiceContext serviceContext,
String name,
String key,
String leadName,
String url,
Long assigneeType)
Validates the given project fields. |
boolean |
isValidAllProjectData(JiraServiceContext serviceContext,
String name,
String key,
String leadName,
String url,
Long assigneeType,
Long avatarId)
Validates the given project fields. |
boolean |
isValidProjectKey(JiraServiceContext serviceContext,
String key)
Validates the given project key. |
boolean |
isValidRequiredProjectData(JiraServiceContext serviceContext,
String name,
String key,
String leadName)
Validate the fields required for creating a project. |
Project |
updateProject(ProjectService.UpdateProjectValidationResult updateProjectValidationResult)
Using the validation result from validateUpdateProject(User, 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. |
ProjectService.CreateProjectValidationResult |
validateCreateProject(com.atlassian.crowd.embedded.api.User user,
String name,
String key,
String description,
String leadName,
String url,
Long assigneeType)
This method needs to be called before creating a project to ensure all parameters are correct. |
ProjectService.CreateProjectValidationResult |
validateCreateProject(com.atlassian.crowd.embedded.api.User user,
String name,
String key,
String description,
String leadName,
String url,
Long assigneeType,
Long avatarId)
This method needs to be called before creating a project to ensure all parameters are correct. |
ProjectService.DeleteProjectValidationResult |
validateDeleteProject(ApplicationUser user,
String key)
Validation to delete a project is quite straightforward. |
ProjectService.DeleteProjectValidationResult |
validateDeleteProject(com.atlassian.crowd.embedded.api.User user,
String key)
Validation to delete a project is quite straightforward. |
ProjectService.UpdateProjectValidationResult |
validateUpdateProject(ApplicationUser user,
Project originalProject,
String name,
String key,
String description,
ApplicationUser lead,
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. |
ServiceResult |
validateUpdateProject(com.atlassian.crowd.embedded.api.User user,
String key)
Validates that the given user is authorised to update a project. |
ProjectService.UpdateProjectValidationResult |
validateUpdateProject(com.atlassian.crowd.embedded.api.User user,
String name,
String key,
String description,
String leadName,
String url,
Long assigneeType)
Validates updating a project's details. |
ProjectService.UpdateProjectValidationResult |
validateUpdateProject(com.atlassian.crowd.embedded.api.User 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. |
ProjectService.UpdateProjectSchemesValidationResult |
validateUpdateProjectSchemes(com.atlassian.crowd.embedded.api.User 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. |
Field Detail |
---|
static final String PROJECT_NAME
ErrorCollection
with error messages keyed
to this field name.
static final String PROJECT_KEY
ErrorCollection
with error messages keyed
to this field name.
static final String PROJECT_LEAD
ErrorCollection
with error messages keyed
to this field name.
static final String PROJECT_URL
ErrorCollection
with error messages keyed
to this field name.
static final String PROJECT_DESCRIPTION
ErrorCollection
with error messages keyed
to this field name.
static final int MAX_NAME_LENGTH
static final int MIN_NAME_LENGTH
static final int MAX_KEY_LENGTH
static final int DEFAULT_NAME_LENGTH
Method Detail |
---|
ProjectService.CreateProjectValidationResult validateCreateProject(com.atlassian.crowd.embedded.api.User user, String name, String key, String description, String leadName, String url, @Nullable Long assigneeType)
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.
The method will return a ProjectService.CreateProjectValidationResult
which
contains an ErrorCollection with any potential errors and all the project's details.
user
- The user trying to create a projectname
- The name of the new projectkey
- The project key of the new projectdescription
- An optional description for the projectleadName
- The username of the lead developer for the projecturl
- An optional URL for the new projectassigneeType
- Optional default assignee for issues created in this project (null for default).
ProjectService.CreateProjectValidationResult validateCreateProject(com.atlassian.crowd.embedded.api.User user, String name, String key, String description, String leadName, String url, @Nullable Long assigneeType, Long avatarId)
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.
The method will return a ProjectService.CreateProjectValidationResult
which
contains an ErrorCollection with any potential errors and all the project's details.
user
- The user trying to create a projectname
- The name of the new projectkey
- The project key of the new projectdescription
- An optional description for the projectleadName
- The username of the lead developer for the projecturl
- An optional URL for the new projectassigneeType
- Optional default assignee for issues created in this project (null for default).avatarId
- the id of an avatar.
Project createProject(ProjectService.CreateProjectValidationResult createProjectValidationResult)
validateCreateProject(User, String, String,
String, String, String, Long)
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.
createProjectValidationResult
- Result from the validation, which also contains all the project's details.
IllegalStateException
- if the validation result contains any errors.ServiceResult validateUpdateProject(com.atlassian.crowd.embedded.api.User user, String key)
user
- The user trying to update a projectkey
- The project key of the project to update.
ServiceResult validateUpdateProject(ApplicationUser user, String key)
user
- The user trying to update a projectkey
- The project key of the project to update.
ProjectService.UpdateProjectValidationResult validateUpdateProject(com.atlassian.crowd.embedded.api.User user, String name, String key, String description, String leadName, String url, Long assigneeType)
validateCreateProject(User,
String, String, String, String, String, Long)
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.
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.
ProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser user, String name, String key, String description, ApplicationUser lead, String url, Long assigneeType)
validateCreateProject(User,
String, String, String, String, String, Long)
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).
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.
ProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser user, Project originalProject, String name, String key, String description, ApplicationUser lead, String url, Long assigneeType, Long avatarId)
validateCreateProject(User,
String, String, String, String, String, Long)
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.
user
- 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 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.
ProjectService.UpdateProjectValidationResult validateUpdateProject(com.atlassian.crowd.embedded.api.User user, String name, String key, String description, String leadName, String url, Long assigneeType, Long avatarId)
validateCreateProject(User,
String, String, String, String, String, Long)
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.
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.
ProjectService.UpdateProjectValidationResult validateUpdateProject(ApplicationUser user, String name, String key, String description, ApplicationUser lead, String url, Long assigneeType, Long avatarId)
validateCreateProject(User,
String, String, String, String, String, Long)
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).
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.
Project updateProject(ProjectService.UpdateProjectValidationResult updateProjectValidationResult)
validateUpdateProject(User, String, String,
String, String, String, Long)
this method performs the actual update on the project.
updateProjectValidationResult
- Result from the validation, which also contains all the project's details.
IllegalStateException
- if the validation result contains any errors.ProjectService.DeleteProjectValidationResult validateDeleteProject(com.atlassian.crowd.embedded.api.User user, String key)
user
- The user trying to delete a projectkey
- The key of the project to delete
ProjectService.DeleteProjectValidationResult validateDeleteProject(ApplicationUser user, String key)
user
- The user trying to delete a projectkey
- The key of the project to delete
ProjectService.DeleteProjectResult deleteProject(com.atlassian.crowd.embedded.api.User user, ProjectService.DeleteProjectValidationResult deleteProjectValidationResult)
user
- The user trying to delete a projectdeleteProjectValidationResult
- Result from the validation, which also contains all the project's details.
ProjectService.DeleteProjectResult deleteProject(ApplicationUser user, ProjectService.DeleteProjectValidationResult deleteProjectValidationResult)
user
- The user trying to delete a projectdeleteProjectValidationResult
- Result from the validation, which also contains all the project's details.
ProjectService.UpdateProjectSchemesValidationResult validateUpdateProjectSchemes(com.atlassian.crowd.embedded.api.User user, Long permissionSchemeId, Long notificationSchemeId, Long issueSecuritySchemeId)
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.
ProjectService.UpdateProjectSchemesValidationResult validateUpdateProjectSchemes(ApplicationUser user, Long permissionSchemeId, Long notificationSchemeId, Long issueSecuritySchemeId)
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.
void updateProjectSchemes(ProjectService.UpdateProjectSchemesValidationResult result, Project project)
result
- Result from the validation, which also contains all the schemes details.project
- The project which will have its schemes updated.
IllegalStateException
- if the validation result contains any errors.boolean isValidAllProjectData(JiraServiceContext serviceContext, String name, String key, String leadName, String url, Long assigneeType)
JiraServiceContext
.
serviceContext
- containing the ErrorCollection that will be populated with any validation errors that are
encounteredname
- the name of the project @Nonnullkey
- the key of the project @NonnullleadName
- the username of the project lead @Nonnullurl
- the project URL (optional)assigneeType
- the default assignee type (optional - only appears on some forms)
boolean isValidAllProjectData(JiraServiceContext serviceContext, String name, String key, String leadName, String url, Long assigneeType, Long avatarId)
JiraServiceContext
.
serviceContext
- containing the ErrorCollection that will be populated with any validation errors that are
encounteredname
- the name of the project @Nonnullkey
- the key of the project @NonnullleadName
- the username of the project lead @Nonnullurl
- the project URL (optional)assigneeType
- the default assignee type (optional - only appears on some forms)avatarId
- the id of the avatar (null indicates default avatar)
boolean isValidRequiredProjectData(JiraServiceContext serviceContext, String name, String key, String leadName)
JiraServiceContext
.
serviceContext
- containing the ErrorCollection that will be populated with any validation errors that are
encounteredname
- the name of the project @Nonnullkey
- the key of the project @NonnullleadName
- the username of the project lead @Nonnull
boolean isValidProjectKey(JiraServiceContext serviceContext, String key)
JiraServiceContext
.
serviceContext
- containing the ErrorCollection that will be populated with any validation errors that are
encounteredkey
- The key to validate @Nonnull
String getProjectKeyDescription()
ProjectService.GetProjectResult getProjectById(com.atlassian.crowd.embedded.api.User user, Long id)
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.
user
- The user retrieving the project.id
- The id of the project.
ProjectService.GetProjectResult getProjectById(ApplicationUser user, Long id)
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.
user
- The user retrieving the project.id
- The id of the project.
ProjectService.GetProjectResult getProjectByIdForAction(com.atlassian.crowd.embedded.api.User user, Long id, ProjectAction action)
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.
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.
ProjectService.GetProjectResult getProjectByIdForAction(ApplicationUser user, Long id, ProjectAction action)
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.
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.
ProjectService.GetProjectResult getProjectByKey(com.atlassian.crowd.embedded.api.User user, String key)
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.
user
- The user retrieving the project.key
- The key of the project.
ProjectService.GetProjectResult getProjectByKey(ApplicationUser user, String key)
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.
user
- The user retrieving the project.key
- The key of the project.
ProjectService.GetProjectResult getProjectByKeyForAction(com.atlassian.crowd.embedded.api.User user, String key, ProjectAction action)
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.
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.
int getMaximumNameLength()
ProjectService.GetProjectResult getProjectByKeyForAction(ApplicationUser user, String key, ProjectAction action)
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.
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.
int getMaximumKeyLength()
long getProjectCount()
Project
s, regardless of the permission to see those projects.
ServiceOutcome<List<Project>> getAllProjects(com.atlassian.crowd.embedded.api.User user)
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.
user
- The user retrieving the list of projects or NULL when using anonymous access.
ServiceOutcome<List<Project>> getAllProjects(ApplicationUser user)
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.
user
- The user retrieving the list of projects or NULL when using anonymous access.
ServiceOutcome<List<Project>> getAllProjectsForAction(com.atlassian.crowd.embedded.api.User user, ProjectAction action)
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.
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.
ServiceOutcome<List<Project>> getAllProjectsForAction(ApplicationUser user, ProjectAction action)
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.
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.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |