Package jetbrains.buildServer.serverSide
Interface ProjectManager
-
- All Superinterfaces:
ProjectVcsRoots
public interface ProjectManager extends ProjectVcsRoots
- Author:
- Pavel.Sher Date: 05.05.2006
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PROJECT_ID_NAME
How we call the external project identifier in the UI.
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description SProject
copyProject(SProject originalProject, SProject targetParent, CopyOptions options)
Copies the given project with all subprojects into another project.SProject
createProject(java.lang.String projectName)
Creates new project with specified name (name is case insensitive) and automatically generated external id.SProject
createProject(SProject originalProject, java.lang.String newProjectName, CopyOptions options)
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 idSProject
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, useSProject.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 userjava.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.-
Methods inherited from interface jetbrains.buildServer.serverSide.ProjectVcsRoots
findVcsRootByConfigId, findVcsRootByExternalId, findVcsRootById, findVcsRootsByIds, getAllVcsRoots
-
-
-
-
Field Detail
-
PROJECT_ID_NAME
static final java.lang.String PROJECT_ID_NAME
How we call the external project identifier in the UI.- Since:
- 8.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRootProject
@NotNull SProject getRootProject()
Returns the root project.- Returns:
- root project.
- Since:
- 8.0
-
getProjects
@NotNull java.util.List<SProject> getProjects()
Returns the list of all projects, including archived. The order: visible projects come first (sorted by name), then archived projects (sorted by name).- Returns:
- list of all projects
-
getActiveProjects
@NotNull java.util.List<SProject> getActiveProjects()
Returns the list of active (non-archived) projects. List is sorted by project name.- Returns:
- list of non-archived projects
-
getArchivedProjects
@NotNull java.util.List<SProject> getArchivedProjects()
Returns the list of archived projects. List is sorted by project name.- Returns:
- list of archived projects
-
getNumberOfProjects
int getNumberOfProjects()
Returns total number of projects currently loaded in the server. The value always equals togetProjects().size()
.- Returns:
- total number of projects
-
getProjects
@NotNull java.util.List<SProject> getProjects(@NotNull User user)
Returns list of all projects sorted according to the order specified by user- Parameters:
user
- the user- Returns:
- see above
-
createProject
@NotNull SProject createProject(@NotNull java.lang.String projectName) throws InvalidIdentifierException, InvalidNameException, DuplicateProjectNameException
Creates new project with specified name (name is case insensitive) and automatically generated external id. This id is generated based on the given name (and ensuring that the new id is unique).- Parameters:
projectName
- name of the new project- Returns:
- newly created project
- Throws:
DuplicateProjectNameException
- if project with specified name already existsInvalidIdentifierException
InvalidNameException
-
copyProject
@NotNull SProject copyProject(@NotNull SProject originalProject, @NotNull SProject targetParent, @NotNull CopyOptions options) throws MaxNumberOfBuildTypesReachedException, NotAllIdentifiersMappedException, InvalidNameException, DuplicateExternalIdException
Copies the given project with all subprojects into another project.Also persists projects when they're copied.
- Parameters:
originalProject
- the project to copy.targetParent
- the parent of the newly created projectoptions
- copy option.- Returns:
- the copy of the project
- Throws:
MaxNumberOfBuildTypesReachedException
NotAllIdentifiersMappedException
InvalidNameException
DuplicateExternalIdException
- Since:
- 8.0
- See Also:
CopyOptions
-
createProject
@Deprecated @NotNull SProject createProject(@NotNull SProject originalProject, @NotNull java.lang.String newProjectName, @NotNull CopyOptions options) throws InvalidIdentifierException, InvalidNameException, MaxNumberOfBuildTypesReachedException
Deprecated.Creates new project by copying all settings from original project. Warning - this function doesn't copy all nested subprojects. UsecopyProject(SProject, SProject, CopyOptions)
instead.- Parameters:
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 options- Returns:
- newly created project
- Throws:
MaxNumberOfBuildTypesReachedException
- 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
-
findProjectByName
@Deprecated @Nullable SProject findProjectByName(@NotNull java.lang.String projectName)
Deprecated.since 8.0, useSProject.findProjectByName(String)
Searches for a project with the specified name (case insensitive) among direct subprojects of the root project. The search includes archived projects.- Parameters:
projectName
- name of the project to search for- Returns:
- a project or null if such a project does not exist
-
findProjectById
@Nullable SProject findProjectById(@Nullable java.lang.String internalId)
Looks for a project with the given internal id.The search includes archived projects.
- Parameters:
internalId
- the internal id, case insensitive.- Returns:
- the found project, or null if not found or
internalId
is null. - Throws:
AccessDeniedException
- no access rights for the current user- See Also:
findProjectByExternalId(String)
-
findProjectByExternalId
@Nullable SProject findProjectByExternalId(@Nullable java.lang.String externalId)
Looks for a project with the given external id.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
.- Parameters:
externalId
- the external id of the project to search for, case insensitive.- Returns:
- a project or null if project with such id does not exist or
externalId
is null. - Throws:
AccessDeniedException
- no access rights for the current user- Since:
- 8.0.
- See Also:
findProjectById(String)
-
findProjectByConfigId
@Nullable SProject findProjectByConfigId(@Nullable java.lang.String configId)
Looks for a project with the given config id.The search includes archived projects.
- Parameters:
configId
- the config id of the project to search for, case insensitive.- Returns:
- a project or null if project with such id does not exist
- Throws:
AccessDeniedException
- no access rights for the current user- Since:
- 9.0.
- See Also:
findProjectById(String)
-
findProjects
@NotNull java.util.Collection<SProject> findProjects(@NotNull java.util.Collection<java.lang.String> projectsIds)
Returns collection of projects corresponding to the specified internal ids.- Parameters:
projectsIds
- collection of internal identifiers, case sensitive.- Returns:
- collection of projects corresponding to the specified internal ids
-
findProjectsByExternalIds
@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.
- Parameters:
projectsIds
- collection of external identifiers, case insensitive.- Returns:
- see above
- Since:
- 8.0
-
findBuildTypeById
@Nullable SBuildType findBuildTypeById(@Nullable java.lang.String internalId) throws AccessDeniedException
Searches for a build configuration with the specified internal id.- Parameters:
internalId
- the internal id of the build configuration to search for.- Returns:
- a build configuration or null if build configuration with given internal id does not exist.
- Throws:
AccessDeniedException
- if current authority holder doesn't have access to build configuration with given internal id.- Since:
- 6.5 also finds personal build configurations
-
findBuildTypeByExternalId
@Nullable SBuildType findBuildTypeByExternalId(@Nullable java.lang.String externalId) throws AccessDeniedException
Searches for a build configuration with specified external id. Since 8.1 the method also looks up the build type by the previous external ids. So the result build type can have a different external id after a call. But the later is impossible if there is a build type that currently has aexternalId
.- Parameters:
externalId
- the external id of the build configuration to search for.- Returns:
- a build configuration or null if build configuration with given external id does not exist or the id is null.
- Throws:
AccessDeniedException
- if current authority holder doesn't have access to build configuration with given external id.- Since:
- 8.0
-
findBuildTypeByConfigId
@Nullable SBuildType findBuildTypeByConfigId(@Nullable java.lang.String configId) throws AccessDeniedException
Searches for a build configuration with specified config id.- Parameters:
configId
- the config id of the build configuration to search for.- Returns:
- a build configuration or null if build configuration with given config id does not exist.
- Throws:
AccessDeniedException
- if current authority holder doesn't have access to build configuration with given config id.- Since:
- 9.0
-
findBuildTypes
@NotNull java.util.Collection<SBuildType> findBuildTypes(@NotNull java.util.Collection<java.lang.String> buildTypeIds)
Returns collection of build types corresponding to the specified collection of build type ids. The returned collection will contain existing build types only.- Parameters:
buildTypeIds
- collection of build type internal ids- Returns:
- collection of existing build types
-
findBuildTypesByExternalIds
@NotNull java.util.Collection<SBuildType> findBuildTypesByExternalIds(@NotNull java.util.Collection<java.lang.String> externalIds)
Returns collection of build types corresponding to the specified external ids.- Parameters:
externalIds
- collection of external identifiers, case insensitive.- Returns:
- see above
- Since:
- 8.0
-
getAllBuildTypes
@NotNull java.util.List<SBuildType> getAllBuildTypes()
Returns the list of all build configurations, including ones from archived projects. The order: build configurations from visible projects come first, then from archived projects.- Returns:
- list of all build configurations
-
getAllTemplates
@NotNull java.util.List<BuildTypeTemplate> getAllTemplates()
Returns list of all of the templates, including ones from archived projects. Ordering is the same as for build configurations.- Returns:
- see above
- Since:
- 5.0
-
getActiveBuildTypes
@NotNull java.util.List<SBuildType> getActiveBuildTypes()
Returns the list of build types that belong to non-archived projects only.- Returns:
- list of non-archived build types
-
getArchivedBuildTypes
@NotNull java.util.List<SBuildType> getArchivedBuildTypes()
Returns list of build configurations from archived projects, sorted by project and build configuration name.- Returns:
- list of archived build configurations.
-
getNumberOfBuildTypes
int getNumberOfBuildTypes()
Returns the total number of build configurations including ones from archived projects.- Returns:
- number of build configurations
-
getAllBuildTypes
@NotNull java.util.List<SBuildType> getAllBuildTypes(@NotNull User user)
Returns list of all build configurations sorted by project according to the order specified by user and then by build configuration name.- Parameters:
user
- user whose settings to use to sort build types- Returns:
- list of all build configurations.
-
removeProject
void removeProject(@NotNull java.lang.String internalProjectId) throws ProjectRemoveFailedException
Removes project from the current list of projects. Project directory will be placed into the '_trash' folder.- Parameters:
internalProjectId
- internal id of project to remove- Throws:
ProjectRemoveFailedException
- if remove failed
-
getProjectIds
java.util.List<java.lang.String> getProjectIds()
A helper method which returns the list of all projectID configured on the server.- Returns:
- the list of all projectID configured on the server.
-
getFilteredBuildTypes
java.util.SortedMap<SProject,java.util.List<SBuildType>> getFilteredBuildTypes(@NotNull User user, @Nullable BuildTypeFilter filter)
Returns sorted map of build configurations per project. Build types can be filtered by specified BuildTypeFilter. Projects in the map are sorted according to the projects order specified by user.- Parameters:
user
- the userfilter
- filter of build configurations, can be null- Returns:
- sorted map of build types per project
-
findProjectId
@Nullable java.lang.String findProjectId(@NotNull java.lang.String buildTypeId)
Searches for a project which contains a build type with the specified build type id. Returns internal id of this project or null if such project does not exist. The search includes archived projects.- Parameters:
buildTypeId
- id of a build type- Returns:
- project internal id of a project containing specified build type
-
findProjectExternalId
@Nullable java.lang.String findProjectExternalId(@NotNull java.lang.String buildTypeId)
Searches for a project which contains a build type with the specified build type id. Returns external id of this project or null if such project does not exist. The search includes archived projects.- Parameters:
buildTypeId
- id of a build type- Returns:
- project external id of a project containing specified build type
- Since:
- 8.0
-
findProjectIdForTemplate
@Nullable java.lang.String findProjectIdForTemplate(@NotNull java.lang.String buildTypeTemplateId)
Searches for a project which contains a build type template with the specified id. Returns id of this project or null if such project does not exist. The search includes archived projects.- Parameters:
buildTypeTemplateId
- id of a build type template- Returns:
- project id of a project containing specified build type template
- Since:
- 6.5
-
isProjectExists
boolean isProjectExists(@NotNull java.lang.String projectId)
Returns true if project with the specified id exists. In contrast tofindProjectById(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.- Parameters:
projectId
- the internal id of the project- Returns:
- see above
- Since:
- 5.0
-
findBuildTypeTemplateById
@Nullable BuildTypeTemplate findBuildTypeTemplateById(@NotNull java.lang.String id)
Searches for build type template by given internal id- Parameters:
id
- the internal id of template- Returns:
- found template or null
- Since:
- 5.0
-
findBuildTypeTemplateByExternalId
@Nullable BuildTypeTemplate findBuildTypeTemplateByExternalId(@Nullable java.lang.String externalId)
Searches for build type template by given external id. Since 8.1 the method also looks up the template 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 template that currently has aexternalId
.- Parameters:
externalId
- the external id of template- Returns:
- found template or null, if template can't be found or external id is null.
- Since:
- 8.0
-
findBuildTypeTemplateByConfigId
@Nullable BuildTypeTemplate findBuildTypeTemplateByConfigId(@NotNull java.lang.String configId)
Searches for build type template by given config id.- Parameters:
configId
- the config id of template- Returns:
- found template or null
- Since:
- 9.0
-
getCommonParentProject
@NotNull SProject getCommonParentProject(@NotNull java.util.Collection<SProject> projects)
Returns nearest common parent project for all projects in provided collection.- Parameters:
projects
- projects to find common parent for- Returns:
- common parent project
- Since:
- 8.0
-
getProjectsComparator
@NotNull java.util.Comparator<SProject> getProjectsComparator()
- Returns:
- Comparator to sort projects with server-wide custom ordering
- Since:
- 9.1
-
getBuildTypesComparator
@NotNull java.util.Comparator<SBuildType> getBuildTypesComparator()
- Returns:
- Comparator to sort build configurations with server-wide custom ordering. Project ordering is not used by this comparator - use BuildTypeComparator to order build configurations from different projects.
- Since:
- 9.1
-
-