public interface ProjectManager extends ProjectVcsRoots
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROJECT_ID_NAME
How we call the external project identifier in the UI.
|
Modifier and Type | Method and Description |
---|---|
SProject |
copyProject(SProject originalProject,
SProject targetParent,
CopyOptions options)
Copies the given project with all subprojects into another project.
|
SProject |
createProject(SProject originalProject,
java.lang.String newProjectName,
CopyOptions options)
|
SProject |
createProject(java.lang.String projectName)
Creates new project with specified name (name is case insensitive)
and automatically generated external id.
|
SBuildType |
findBuildTypeByConfigId(java.lang.String configId)
Searches for a build configuration with specified config id.
|
SBuildType |
findBuildTypeByExternalId(java.lang.String externalId)
Searches for a build configuration with specified external id.
|
SBuildType |
findBuildTypeById(java.lang.String internalId)
Searches for a build configuration with the specified internal id.
|
java.util.Collection<SBuildType> |
findBuildTypes(java.util.Collection<java.lang.String> buildTypeIds)
Returns collection of build types corresponding to the specified collection of build type ids.
|
java.util.Collection<SBuildType> |
findBuildTypesByExternalIds(java.util.Collection<java.lang.String> externalIds)
Returns collection of build types corresponding to the specified external ids.
|
BuildTypeTemplate |
findBuildTypeTemplateByConfigId(java.lang.String configId)
Searches for build type template by given config id.
|
BuildTypeTemplate |
findBuildTypeTemplateByExternalId(java.lang.String externalId)
Searches for build type template by given external id.
|
BuildTypeTemplate |
findBuildTypeTemplateById(java.lang.String id)
Searches for build type template by given internal id
|
SProject |
findProjectByConfigId(java.lang.String configId)
Looks for a project with the given config id.
|
SProject |
findProjectByExternalId(java.lang.String externalId)
Looks for a project with the given external id.
|
SProject |
findProjectById(java.lang.String internalId)
Looks for a project with the given internal id.
|
SProject |
findProjectByName(java.lang.String projectName)
Deprecated.
since 8.0, use
SProject.findProjectByName(String) |
java.lang.String |
findProjectExternalId(java.lang.String buildTypeId)
Searches for a project which contains a build type with the specified build type id.
|
java.lang.String |
findProjectId(java.lang.String buildTypeId)
Searches for a project which contains a build type with the specified build type id.
|
java.lang.String |
findProjectIdForTemplate(java.lang.String buildTypeTemplateId)
Searches for a project which contains a build type template with the specified id.
|
java.util.Collection<SProject> |
findProjects(java.util.Collection<java.lang.String> projectsIds)
Returns collection of projects corresponding to the specified internal ids.
|
java.util.Collection<SProject> |
findProjectsByExternalIds(java.util.Collection<java.lang.String> projectsIds)
Returns collection of projects corresponding to the specified external
ids.
|
java.util.List<SBuildType> |
getActiveBuildTypes()
Returns the list of build types that belong to non-archived projects only.
|
java.util.List<SProject> |
getActiveProjects()
Returns the list of active (non-archived) projects.
|
java.util.List<SBuildType> |
getAllBuildTypes()
Returns the list of all build configurations, including ones from archived projects.
|
java.util.List<SBuildType> |
getAllBuildTypes(User user)
Returns list of all build configurations sorted by project according to the order specified by user and then by build configuration name.
|
java.util.List<BuildTypeTemplate> |
getAllTemplates()
Returns list of all of the templates, including ones from archived projects.
|
java.util.List<SBuildType> |
getArchivedBuildTypes()
Returns list of build configurations from archived projects,
sorted by project and build configuration name.
|
java.util.List<SProject> |
getArchivedProjects()
Returns the list of archived projects.
|
java.util.Comparator<SBuildType> |
getBuildTypesComparator() |
SProject |
getCommonParentProject(java.util.Collection<SProject> projects)
Returns nearest common parent project for all projects in provided collection.
|
java.util.SortedMap<SProject,java.util.List<SBuildType>> |
getFilteredBuildTypes(User user,
BuildTypeFilter filter)
Returns sorted map of build configurations per project.
|
int |
getNumberOfBuildTypes()
Returns the total number of build configurations including ones from archived projects.
|
int |
getNumberOfProjects()
Returns total number of projects currently loaded in the server.
|
java.util.List<java.lang.String> |
getProjectIds()
A helper method which returns the list of all projectID configured on the server.
|
java.util.List<SProject> |
getProjects()
Returns the list of all projects, including archived.
|
java.util.List<SProject> |
getProjects(User user)
Returns list of all projects sorted according to the order specified by user
|
java.util.Comparator<SProject> |
getProjectsComparator() |
SProject |
getRootProject()
Returns the root project.
|
boolean |
isProjectExists(java.lang.String projectId)
Returns true if project with the specified id exists.
|
void |
removeProject(java.lang.String internalProjectId)
Removes project from the current list of projects.
|
findVcsRootByConfigId, findVcsRootByExternalId, findVcsRootById, findVcsRootsByIds, getAllVcsRoots
static final java.lang.String PROJECT_ID_NAME
@NotNull SProject getRootProject()
@NotNull java.util.List<SProject> getProjects()
@NotNull java.util.List<SProject> getActiveProjects()
@NotNull java.util.List<SProject> getArchivedProjects()
int getNumberOfProjects()
getProjects().size()
.@NotNull java.util.List<SProject> getProjects(@NotNull User user)
user
- the user@NotNull SProject createProject(@NotNull java.lang.String projectName) throws InvalidIdentifierException, InvalidNameException, DuplicateProjectNameException
projectName
- name of the new projectDuplicateProjectNameException
- if project with specified name already existsInvalidIdentifierException
InvalidNameException
@NotNull SProject copyProject(@NotNull SProject originalProject, @NotNull SProject targetParent, @NotNull CopyOptions options) throws MaxNumberOfBuildTypesReachedException, NotAllIdentifiersMappedException, InvalidNameException, DuplicateExternalIdException
Also persists projects when they're copied.
originalProject
- the project to copy.targetParent
- the parent of the newly created projectoptions
- copy option.MaxNumberOfBuildTypesReachedException
NotAllIdentifiersMappedException
InvalidNameException
DuplicateExternalIdException
CopyOptions
@Deprecated @NotNull SProject createProject(@NotNull SProject originalProject, @NotNull java.lang.String newProjectName, @NotNull CopyOptions options) throws InvalidIdentifierException, InvalidNameException, MaxNumberOfBuildTypesReachedException
copyProject(jetbrains.buildServer.serverSide.SProject, jetbrains.buildServer.serverSide.SProject, jetbrains.buildServer.serverSide.CopyOptions)
instead.copyProject(SProject, SProject, CopyOptions)
instead.originalProject
- original projectnewProjectName
- name for new project. If there exists project with same name
then " (1)", " (2)", ... suffix will be added to the specified name.options
- additional optionsMaxNumberOfBuildTypesReachedException
- if original project build configurations cannot be copied
because maximum number of build configurations is reached
or will be exceeded if project will be copiedInvalidIdentifierException
InvalidNameException
@Deprecated @Nullable SProject findProjectByName(@NotNull java.lang.String projectName)
SProject.findProjectByName(String)
projectName
- name of the project to search for@Nullable SProject findProjectById(@Nullable java.lang.String internalId)
The search includes archived projects.
internalId
- the internal id, case insensitive.internalId
is null.AccessDeniedException
- no access rights for the current userfindProjectByExternalId(String)
@Nullable SProject findProjectByExternalId(@Nullable java.lang.String externalId)
The search includes archived projects.
Since 8.1 the method also looks up the project by the previous external ids. So the result project can have a different external id after a call. But the later is impossible if there is a project that currently has aexternalId
.externalId
- the external id of the project to search for, case insensitive.externalId
is null.AccessDeniedException
- no access rights for the current userfindProjectById(String)
@Nullable SProject findProjectByConfigId(@Nullable java.lang.String configId)
The search includes archived projects.
configId
- the config id of the project to search for, case insensitive.AccessDeniedException
- no access rights for the current userfindProjectById(String)
@NotNull java.util.Collection<SProject> findProjects(@NotNull java.util.Collection<java.lang.String> projectsIds)
projectsIds
- collection of internal identifiers, case sensitive.@NotNull java.util.Collection<SProject> findProjectsByExternalIds(@NotNull java.util.Collection<java.lang.String> projectsIds)
Returns collection of projects corresponding to the specified external ids. The collection is guaranteed to be a mutable one.
projectsIds
- collection of external identifiers, case insensitive.@Nullable SBuildType findBuildTypeById(@Nullable java.lang.String internalId) throws AccessDeniedException
internalId
- the internal id of the build configuration to search for.AccessDeniedException
- if current authority holder doesn't have access to build configuration with given internal id.@Nullable SBuildType findBuildTypeByExternalId(@Nullable java.lang.String externalId) throws AccessDeniedException
externalId
.externalId
- the external id of the build configuration to search for.AccessDeniedException
- if current authority holder doesn't have access to build configuration with given external id.@Nullable SBuildType findBuildTypeByConfigId(@Nullable java.lang.String configId) throws AccessDeniedException
configId
- the config id of the build configuration to search for.AccessDeniedException
- if current authority holder doesn't have access to build configuration with given config id.@NotNull java.util.Collection<SBuildType> findBuildTypes(@NotNull java.util.Collection<java.lang.String> buildTypeIds)
buildTypeIds
- collection of build type internal ids@NotNull java.util.Collection<SBuildType> findBuildTypesByExternalIds(@NotNull java.util.Collection<java.lang.String> externalIds)
externalIds
- collection of external identifiers, case insensitive.@NotNull java.util.List<SBuildType> getAllBuildTypes()
@NotNull java.util.List<BuildTypeTemplate> getAllTemplates()
@NotNull java.util.List<SBuildType> getActiveBuildTypes()
@NotNull java.util.List<SBuildType> getArchivedBuildTypes()
int getNumberOfBuildTypes()
@NotNull java.util.List<SBuildType> getAllBuildTypes(@NotNull User user)
user
- user whose settings to use to sort build typesvoid removeProject(@NotNull java.lang.String internalProjectId) throws ProjectRemoveFailedException
internalProjectId
- internal id of project to removeProjectRemoveFailedException
- if remove failedjava.util.List<java.lang.String> getProjectIds()
java.util.SortedMap<SProject,java.util.List<SBuildType>> getFilteredBuildTypes(@NotNull User user, @Nullable BuildTypeFilter filter)
user
- the userfilter
- filter of build configurations, can be null@Nullable java.lang.String findProjectId(@NotNull java.lang.String buildTypeId)
buildTypeId
- id of a build type@Nullable java.lang.String findProjectExternalId(@NotNull java.lang.String buildTypeId)
buildTypeId
- id of a build type@Nullable java.lang.String findProjectIdForTemplate(@NotNull java.lang.String buildTypeTemplateId)
buildTypeTemplateId
- id of a build type templateboolean isProjectExists(@NotNull java.lang.String projectId)
findProjectById(String)
this method does not check permissions and will return true
if project exists even if user does not have permissions to access this project.projectId
- the internal id of the project@Nullable BuildTypeTemplate findBuildTypeTemplateById(@NotNull java.lang.String id)
id
- the internal id of template@Nullable BuildTypeTemplate findBuildTypeTemplateByExternalId(@Nullable java.lang.String externalId)
externalId
.externalId
- the external id of template@Nullable BuildTypeTemplate findBuildTypeTemplateByConfigId(@NotNull java.lang.String configId)
configId
- the config id of template@NotNull SProject getCommonParentProject(@NotNull java.util.Collection<SProject> projects)
projects
- projects to find common parent for@NotNull java.util.Comparator<SProject> getProjectsComparator()
@NotNull java.util.Comparator<SBuildType> getBuildTypesComparator()