public interface ProjectService extends ProjectSupplier
| Modifier and Type | Method and Description |
|---|---|
Project |
create(ProjectCreateRequest request)
Creates a new
Project and sets its avatar, if provided. |
boolean |
delete(Project project)
Deletes the specified
project, if it exists. |
Page<Project> |
findAll(PageRequest pageRequest)
Retrieves a page of projects which are visible for the current user.
|
List<String> |
findAllKeys()
Retrieves the
keys for all projects the current user can see. |
CacheableAvatarSupplier |
getAvatar(int projectId,
int size)
Retrieves the current avatar for the specified project at a requested size.
|
Project |
getById(int id)
|
Project |
getByKey(String key)
|
Project |
getByName(String name)
|
Page<Project> |
search(ProjectSearchRequest searchRequest,
PageRequest pageRequest)
|
Project |
update(ProjectUpdateRequest request)
Update a project's data with new values.
|
void |
updateAvatar(int projectId,
AvatarSupplier supplier)
Updates the specified project's avatar, replacing it with the one contained in the provided
supplier. |
void |
updateAvatar(int projectId,
String uri)
Updates the specified project's avatar, replacing it with the one contained in the provided data URI.
|
getByKey, getByName@Nonnull Project create(@Nonnull ProjectCreateRequest request)
Project and sets its avatar, if provided.
Note: Both the project key and name must be unique.
request - describes the project to createProjectCreationCanceledException - if creation is canceled by an event listenerServiceException - if the specified AbstractProjectRequest.getKey()
or AbstractProjectRequest.getName() is not uniqueboolean delete(Project project)
project, if it exists.
Personal projects cannot be deleted. Additionally, if the project contains any
repositories, they must all be deleted before the project
can be deleted.
project - the project to deletetrue if the project was deleted; otherwise false if the project did not existProjectDeletionCanceledException - if deletion is canceled by an event listenerIntegrityException - if the project is personal,
or has repositoriesServiceException - if the project exists and could not be deleted@Nonnull Page<Project> findAll(@Nonnull PageRequest pageRequest)
Note: Personal projects are never included in the returned page.
pageRequest - the bounds of the pageprojects to which the current user has access@Nonnull List<String> findAllKeys()
keys for all projects the current user can see.
Note: Personal projects keys are never included in the returned list.
Warning: This mechanism is not paged. For systems with large numbers of projects, the returned list may
be very large. For callers wishing to iterate over all existing projects, findAll(PageRequest) is the
correct mechanism to use.
@Nonnull CacheableAvatarSupplier getAvatar(int projectId, int size)
The requested size will be normalised to fall within a well-defined set sizes. The supported sizes are:
projectId - the ID of the project to retrieve the avatar forsize - the desired height and width for the avatar@Nullable Project getById(int id)
getById in interface ProjectSupplierid - the ID of the project to retrievenull if no such project existsAuthorisationException - if the current user does not have permission to
access the requested project@Nullable Project getByKey(@Nonnull String key)
getByKey in interface ProjectSupplierkey - the key of the project to retrievenull if the key does not match an existing projectAuthorisationException - if the current user does not have permission to
access the requested project@Nullable Project getByName(@Nonnull String name)
getByName in interface ProjectSuppliername - the name of the project to retrievenull if the name does not match an existing projectAuthorisationException - if the current user does not have permission to
access the requested project@Nonnull Page<Project> search(@Nonnull ProjectSearchRequest searchRequest, @Nonnull PageRequest pageRequest)
searchRequest - a criteria describing the projects to returnpageRequest - the bounds of the pageprojects which match the provided
criteriaProjectSearchRequest@Nonnull Project update(@Nonnull ProjectUpdateRequest request)
keys and names must be unique, so if the provided values match those of another Project an exception will be
thrown.
Personal projects cannot be updated. Their keys,
names and descriptions are managed by the system.
request - describes the project to update and the updates to applyjavax.validation.ConstraintViolationException - if the updated key or name collide with another projectIntegrityException - if the project is personalProjectModificationCanceledException - if modification is canceled by an event listenervoid updateAvatar(int projectId,
@Nonnull
AvatarSupplier supplier)
supplier.
Previous avatars are not retained. When a project's avatar is updated, the previous avatar is removed. To reuse a previous avatar, it must be provided again.
Personal project avatars cannot be updated. Their avatars are drawn from their
owning users. If Gravatar support is enabled, personal project avatars may
be updated by changing the user's avatar in Gravatar. Otherwise, they may not be updated at all.
projectId - the ID of the project to update the avatar forsupplier - a supplier providing access to the new avatar to useIntegrityException - if the project is personalvoid updateAvatar(int projectId,
@Nonnull
String uri)
data:(content type, e.g. image/png);base64,(data)
If the data is not Base64-encoded, or if a character set is defined in the URI, it will be rejected.
Previous avatars are not retained. When a project's avatar is updated, the previous avatar is removed. To reuse a previous avatar, it must be provided again.
Personal project avatars cannot be updated. Their avatars are drawn from their
owning users. If Gravatar support is enabled, personal project avatars may
be updated by changing the user's avatar in Gravatar. Otherwise, they may not be updated at all.
projectId - the ID of the project to update the avatar foruri - a data URI containing a Base64-encoded avatar imageIntegrityException - if the project is personalCopyright © 2021 Atlassian. All rights reserved.