Class ProjectManagerImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.projects.ProjectManagerImpl
-
- All Implemented Interfaces:
ProjectManager
,ProjectManagerEx
,ProjectVcsRoots
,ProjectVcsRootsEx
public class ProjectManagerImpl extends Object implements ProjectManagerEx
- Author:
- Pavel.Sher Date: 05.05.2006
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jetbrains.buildServer.serverSide.ProjectManagerEx
ProjectManagerEx.IdsMaps
-
-
Field Summary
Fields Modifier and Type Field Description static Filter<SProject>
ACTIVE_PROJECTS_FILTER
static Filter<SProject>
ARCHIVED_PROJECTS_FILTER
-
Fields inherited from interface jetbrains.buildServer.serverSide.ProjectManager
PROJECT_ID_NAME
-
Fields inherited from interface jetbrains.buildServer.serverSide.ProjectManagerEx
ROOT_PROJECT_DESCRIPTION, ROOT_PROJECT_NAME
-
-
Constructor Summary
Constructors Constructor Description ProjectManagerImpl(EventDispatcher<BuildServerListener> dispatcher, ProjectsPaths paths, Trash trash, ProjectIdentifiersManager projectIdentifiersManager, VcsRootIdentifiersManager vcsRootIdentifiersManager, BuildTypeIdentifiersManager buildTypeIdentifiersManager, SecurityContextEx securityContext, ProjectSettingsManager projectSettingsManager, ConfigActionFactory configActionFactory, ProjectFeatureDescriptorFactory projectFeatureFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
checkCanCreateBuildTypes(SProject targetProject, int numOfBuildTypes)
Checks whether numOfBuildTypes build configurations can be created and throws exception if can'tboolean
checkProjectByExternalIdExists(String externalId)
SProject
copyProject(SProject originalProject, SProject targetParent, CopyOptions options)
Copies the given project with all subprojects into another project.ProjectEx
createProject(String projectName)
Creates new project with specified name (name is case insensitive).SProject
createProject(SProject originalProject, String newProjectName, CopyOptions options)
Deprecated.ProjectEx
createProjectInternal(EntityId<String> parentId, String externalId, String projectName)
jetbrains.buildServer.serverSide.impl.projects.ProjectModelWrapper
createTempModel()
File
ensureProjectsDirectoryExists()
void
executeFSOperation(String description, Runnable persistAction)
SBuildType
findBuildTypeByConfigId(String configId)
Searches for a build configuration with specified config id.BuildTypeImpl
findBuildTypeByExternalId(String externalId)
Looks for a build type with the given external id.BuildTypeImpl
findBuildTypeById(String internalId)
Searches for a build configuration with the specified internal id.BuildTypeIdentity
findBuildTypeIdentityByConfigId(String configId)
BuildTypeIdentity
findBuildTypeIdentityByExternalId(String extId)
BuildTypeIdentity
findBuildTypeIdentityByInternalId(String intId)
Collection<SBuildType>
findBuildTypes(Collection<String> buildTypeIds)
Returns collection of build types corresponding to the specified collection of build type ids.Collection<SBuildType>
findBuildTypesByExternalIds(Collection<String> externalIds)
Returns collection of build types corresponding to the specified external ids.BuildTypeTemplate
findBuildTypeTemplateByConfigId(String configId)
Searches for build type template by given config id.BuildTypeTemplateEx
findBuildTypeTemplateByExternalId(String externalId)
Searches for build type template by given external id.BuildTypeTemplateEx
findBuildTypeTemplateById(String id)
Searches for build type template by given internal idSProject
findProjectByConfigId(String configId)
Looks for a project with the given config id.ProjectEx
findProjectByExternalId(String externalId)
Looks for a project with the given external id.ProjectEx
findProjectById(String projectId)
Looks for a project with the given internal id.ProjectEx
findProjectByName(String projectName)
Searches for a project with the specified name (case insensitive) among direct subprojects of the root project.String
findProjectExternalId(String buildTypeId)
Searches for a project which contains a build type with the specified build type id.String
findProjectId(String buildTypeId)
Searches for a project which contains a build type with the specified build type id.String
findProjectIdForTemplate(String buildTypeTemplateId)
Searches for a project which contains a build type template with the specified id.Collection<SProject>
findProjects(Collection<String> internalIds)
Returns collection of projects corresponding to the specified internal ids.Collection<SProject>
findProjectsByExternalIds(Collection<String> externalIds)
Returns collection of projects corresponding to the specified external ids.Set<String>
findProjectsIds(Collection<String> buildTypeIds)
Accepts a collection of build type ids, returns ids of projects where these build types belong.SVcsRootEx
findVcsRootByConfigId(String configId)
Finds VCS root by config idSVcsRootEx
findVcsRootByExternalId(String externalId)
Finds VCS root by external idSVcsRootEx
findVcsRootById(long id)
Finds VCS root by idSVcsRootEx
findVcsRootByName(String name)
Collection<SVcsRoot>
findVcsRootsByIds(Collection<Long> ids)
Finds all VCS roots having the specified ids.ProjectManagerEx.IdsMaps
generateDefaultExternalIds(SProject project, String changedExtId, boolean useCurrentIds, boolean generateForCopy)
Generates identifiers for all nested entities (subprojects, VCS roots, build types and templates) of the given project.List<SBuildType>
getActiveBuildTypes()
Returns the list of build types that belong to non-archived projects only.List<SProject>
getActiveProjects()
Returns the list of active (non-archived) projects.List<SBuildType>
getAllBuildTypes()
Returns the list of all build configurations, including ones from archived projects.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.List<BuildTypeTemplate>
getAllTemplates()
Returns list of all of the templates, including ones from archived projects.List<SVcsRoot>
getAllVcsRoots()
List<SBuildType>
getArchivedBuildTypes()
Returns list of build configurations from archived projects, sorted by project and build configuration name.List<SProject>
getArchivedProjects()
Returns the list of archived projects.Comparator<SBuildType>
getBuildTypesComparator()
Map<SBuildType,List<SArtifactDependency>>
getBuildTypesDependingOn(Collection<SBuildType> types)
SProject
getCommonParentProject(Collection<SProject> projects)
Returns nearest common parent project for all projects in provided collection.Map<String,List<ProjectEx>>
getDirectSubProjectsMap()
Map where key is parent project internal id and value - all direct subprojects of this parentSet<String>
getExistingProjectsIds(Collection<String> projectIds)
Accepts a collection of project ids and and checks each of them for existence.SortedMap<SProject,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.int
getNumberOfVcsRoots()
Returns the total number of VCS roots, including ones from archived projectsint
getNumberOfVirtualBuildTypes()
ProjectDataModel
getProjectDataModel()
ProjectIdentifiersManager
getProjectIdentifiersManager()
List<String>
getProjectIds()
A helper method which returns the list of all projectID configured on the server.Collection<ProjectFilePersister>
getProjectPersisters()
List<SProject>
getProjects()
Returns the list of all projects, including archived.List<SProject>
getProjects(User user)
Returns list of all projects sorted according to the order specified by userComparator<SProject>
getProjectsComparator()
File
getProjectsDirectory()
ProjectEx
getRootProject()
Returns the root project.String
internalBuildTypeIdToExternal(String buildTypeId)
boolean
isProjectExists(String projectId)
Returns true if project with the specified id exists.boolean
isProjectsModelInitialized()
void
lockProject(String internalId)
void
persistAllProjects()
Persists configuration of all projects (including archived).void
removeProject(String internalProjectId)
Removes project from the current list of projects.BackgroundPersistTask
removeProjectLater(ConfigAction cause, SProject project)
Removes the specified project in background<T> T
runWithExclusiveProjectModelLock(Supplier<T> supplier)
Runs the specified supplier with the exclusive project model lock and returns its result.void
setAgentPoolManager(AgentPoolManager agentPoolManager)
void
setAuditLogFactory(AuditLogFactory auditLogFactory)
void
setBuildArtifactsLocationChecker(BuildArtifactsLocationChecker buildArtifactsLocationChecker)
void
setBuildTypeSettingsMapperFactory(BuildTypeSettingsMapperFactory buildTypeSettingsMapperFactory)
void
setConfigChangesCommitter(ConfigChangesCommitter configChangesCommitter)
void
setCopyProjectHelper(CopyProjectHelper copyProjectHelper)
void
setModel(ProjectDataModelImpl model)
void
setProjectFactory(ProjectFactory projectFactory)
void
setProjectPersisters(Collection<ProjectFilePersister> projectPersisters)
void
setProjectPersistingHandler(ProjectPersistingHandler FSOperation)
void
setRolesManager(RolesManager rolesManager)
void
setServer(BuildServerImpl server)
void
unlockProject(String internalId)
void
updateEntitiesRemovedMark()
Finds all removed project ids and marks them as removed in database.
-
-
-
Constructor Detail
-
ProjectManagerImpl
public ProjectManagerImpl(@NotNull EventDispatcher<BuildServerListener> dispatcher, @NotNull ProjectsPaths paths, @NotNull Trash trash, @NotNull ProjectIdentifiersManager projectIdentifiersManager, @NotNull VcsRootIdentifiersManager vcsRootIdentifiersManager, @NotNull BuildTypeIdentifiersManager buildTypeIdentifiersManager, @NotNull SecurityContextEx securityContext, @NotNull ProjectSettingsManager projectSettingsManager, @NotNull ConfigActionFactory configActionFactory, @NotNull ProjectFeatureDescriptorFactory projectFeatureFactory)
-
-
Method Detail
-
getProjectDataModel
@NotNull public ProjectDataModel getProjectDataModel()
- Specified by:
getProjectDataModel
in interfaceProjectManagerEx
-
getRootProject
@NotNull public ProjectEx getRootProject()
Description copied from interface:ProjectManagerEx
Returns the root project.- Specified by:
getRootProject
in interfaceProjectManager
- Specified by:
getRootProject
in interfaceProjectManagerEx
- Returns:
- root project.
-
setAgentPoolManager
public void setAgentPoolManager(AgentPoolManager agentPoolManager)
-
setServer
public void setServer(@NotNull BuildServerImpl server)
-
setProjectFactory
public void setProjectFactory(@NotNull ProjectFactory projectFactory)
-
setModel
public void setModel(@NotNull ProjectDataModelImpl model)
-
setAuditLogFactory
public void setAuditLogFactory(@NotNull AuditLogFactory auditLogFactory)
-
setBuildTypeSettingsMapperFactory
public void setBuildTypeSettingsMapperFactory(BuildTypeSettingsMapperFactory buildTypeSettingsMapperFactory)
-
setCopyProjectHelper
public void setCopyProjectHelper(CopyProjectHelper copyProjectHelper)
-
setRolesManager
public void setRolesManager(@NotNull RolesManager rolesManager)
-
setProjectPersisters
public void setProjectPersisters(Collection<ProjectFilePersister> projectPersisters)
-
setProjectPersistingHandler
public void setProjectPersistingHandler(@NotNull ProjectPersistingHandler FSOperation)
-
setConfigChangesCommitter
public void setConfigChangesCommitter(@NotNull ConfigChangesCommitter configChangesCommitter)
-
setBuildArtifactsLocationChecker
public void setBuildArtifactsLocationChecker(@NotNull BuildArtifactsLocationChecker buildArtifactsLocationChecker)
-
getProjects
@NotNull public List<SProject> getProjects()
Description copied from interface:ProjectManager
Returns the list of all projects, including archived. The order: visible projects come first (sorted by name), then archived projects (sorted by name).- Specified by:
getProjects
in interfaceProjectManager
- Returns:
- list of all projects
-
getActiveProjects
@NotNull public List<SProject> getActiveProjects()
Description copied from interface:ProjectManager
Returns the list of active (non-archived) projects. List is sorted by project name.- Specified by:
getActiveProjects
in interfaceProjectManager
- Returns:
- list of non-archived projects
-
getArchivedProjects
@NotNull public List<SProject> getArchivedProjects()
Description copied from interface:ProjectManager
Returns the list of archived projects. List is sorted by project name.- Specified by:
getArchivedProjects
in interfaceProjectManager
- Returns:
- list of archived projects
-
getNumberOfProjects
public int getNumberOfProjects()
Description copied from interface:ProjectManager
Returns total number of projects currently loaded in the server. The value always equals togetProjects().size()
.- Specified by:
getNumberOfProjects
in interfaceProjectManager
- Returns:
- total number of projects
-
getProjects
@NotNull public List<SProject> getProjects(@NotNull User user)
Description copied from interface:ProjectManager
Returns list of all projects sorted according to the order specified by user- Specified by:
getProjects
in interfaceProjectManager
- Parameters:
user
- the user- Returns:
- see above
-
createProject
@NotNull public ProjectEx createProject(@NotNull String projectName) throws DuplicateProjectNameException
Description copied from interface:ProjectManagerEx
Creates new project with specified name (name is case insensitive). Project external id is generated based on project name. The new project is created in root project.- Specified by:
createProject
in interfaceProjectManager
- Specified by:
createProject
in interfaceProjectManagerEx
- Parameters:
projectName
- name of the new project- Returns:
- newly created project
- Throws:
DuplicateProjectNameException
- if project with specified name already exists- See Also:
#createProject(String, String, String)
-
createProjectInternal
public ProjectEx createProjectInternal(@NotNull EntityId<String> parentId, @NotNull String externalId, @NotNull String projectName)
- Specified by:
createProjectInternal
in interfaceProjectManagerEx
-
createProject
@Deprecated @NotNull public SProject createProject(@NotNull SProject originalProject, @Nullable String newProjectName, @NotNull CopyOptions options) throws MaxNumberOfBuildTypesReachedException
Deprecated.Description copied from interface:ProjectManager
Creates new project by copying all settings from original project. Warning - this function doesn't copy all nested subprojects. UseProjectManager.copyProject(SProject, SProject, CopyOptions)
instead.- Specified by:
createProject
in interfaceProjectManager
- 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 copied
-
copyProject
@NotNull public SProject copyProject(@NotNull SProject originalProject, @NotNull SProject targetParent, @NotNull CopyOptions options)
Description copied from interface:ProjectManager
Copies the given project with all subprojects into another project.Also persists projects when they're copied.
- Specified by:
copyProject
in interfaceProjectManager
- Parameters:
originalProject
- the project to copy.targetParent
- the parent of the newly created projectoptions
- copy option.- Returns:
- the copy of the project
- See Also:
CopyOptions
-
findProjectByName
@Nullable public ProjectEx findProjectByName(@NotNull String projectName)
Description copied from interface:ProjectManager
Searches for a project with the specified name (case insensitive) among direct subprojects of the root project. The search includes archived projects.- Specified by:
findProjectByName
in interfaceProjectManager
- Parameters:
projectName
- name of the project to search for- Returns:
- a project or null if such a project does not exist
-
findProjectById
@Nullable public ProjectEx findProjectById(@Nullable String projectId)
Description copied from interface:ProjectManagerEx
Looks for a project with the given internal id.- Specified by:
findProjectById
in interfaceProjectManager
- Specified by:
findProjectById
in interfaceProjectManagerEx
- Parameters:
projectId
- the internal id, case insensitive.- Returns:
- the found project, or null if not found.
- See Also:
BuildProject.getProjectId()
,ProjectManagerEx.findProjectByExternalId(String)
-
checkProjectByExternalIdExists
public boolean checkProjectByExternalIdExists(@Nullable String externalId)
-
findProjectByExternalId
@Nullable public ProjectEx findProjectByExternalId(@Nullable String externalId)
Description copied from interface:ProjectManagerEx
Looks for a project with the given external id.- Specified by:
findProjectByExternalId
in interfaceProjectManager
- Specified by:
findProjectByExternalId
in interfaceProjectManagerEx
- Parameters:
externalId
- the external id, case insensitive.- Returns:
- the found project, or null if not found.
- See Also:
BuildProject.getExternalId()
,ProjectManagerEx.findProjectById(String)
-
findProjectByConfigId
@Nullable public SProject findProjectByConfigId(@Nullable String configId)
Description copied from interface:ProjectManager
Looks for a project with the given config id.The search includes archived projects.
- Specified by:
findProjectByConfigId
in interfaceProjectManager
- 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
- See Also:
ProjectManager.findProjectById(String)
-
findProjects
@NotNull public Collection<SProject> findProjects(@NotNull Collection<String> internalIds)
Description copied from interface:ProjectManager
Returns collection of projects corresponding to the specified internal ids.- Specified by:
findProjects
in interfaceProjectManager
- Parameters:
internalIds
- collection of internal identifiers, case sensitive.- Returns:
- collection of projects corresponding to the specified internal ids
-
findProjectsByExternalIds
@NotNull public Collection<SProject> findProjectsByExternalIds(@NotNull Collection<String> externalIds)
Description copied from interface:ProjectManager
Returns collection of projects corresponding to the specified external ids. The collection is guaranteed to be a mutable one.
- Specified by:
findProjectsByExternalIds
in interfaceProjectManager
- Parameters:
externalIds
- collection of external identifiers, case insensitive.- Returns:
- see above
-
findBuildTypeIdentityByInternalId
@Nullable public BuildTypeIdentity findBuildTypeIdentityByInternalId(@NotNull String intId)
- Specified by:
findBuildTypeIdentityByInternalId
in interfaceProjectManagerEx
-
findBuildTypeIdentityByExternalId
@Nullable public BuildTypeIdentity findBuildTypeIdentityByExternalId(@NotNull String extId)
- Specified by:
findBuildTypeIdentityByExternalId
in interfaceProjectManagerEx
-
findBuildTypeIdentityByConfigId
@Nullable public BuildTypeIdentity findBuildTypeIdentityByConfigId(@NotNull String configId)
-
findBuildTypeById
@Nullable public BuildTypeImpl findBuildTypeById(@Nullable String internalId)
Description copied from interface:ProjectManagerEx
Searches for a build configuration with the specified internal id.- Specified by:
findBuildTypeById
in interfaceProjectManager
- Specified by:
findBuildTypeById
in interfaceProjectManagerEx
- 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.
- See Also:
ProjectManager.findBuildTypeById(String)
-
findBuildTypeByExternalId
@Nullable public BuildTypeImpl findBuildTypeByExternalId(@Nullable String externalId)
Description copied from interface:ProjectManagerEx
Looks for a build type with the given external id.- Specified by:
findBuildTypeByExternalId
in interfaceProjectManager
- Specified by:
findBuildTypeByExternalId
in interfaceProjectManagerEx
- Parameters:
externalId
- the external id to look for a build type with, case insensitive.- Returns:
- the found build type, or null if not found.
-
findBuildTypeByConfigId
@Nullable public SBuildType findBuildTypeByConfigId(@Nullable String configId) throws AccessDeniedException
Description copied from interface:ProjectManager
Searches for a build configuration with specified config id.- Specified by:
findBuildTypeByConfigId
in interfaceProjectManager
- 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.
-
getAllBuildTypes
@NotNull public List<SBuildType> getAllBuildTypes()
Description copied from interface:ProjectManager
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.- Specified by:
getAllBuildTypes
in interfaceProjectManager
- Returns:
- list of all build configurations
-
getAllTemplates
@NotNull public List<BuildTypeTemplate> getAllTemplates()
Description copied from interface:ProjectManager
Returns list of all of the templates, including ones from archived projects. Ordering is the same as for build configurations.- Specified by:
getAllTemplates
in interfaceProjectManager
- Returns:
- see above
-
getActiveBuildTypes
@NotNull public List<SBuildType> getActiveBuildTypes()
Description copied from interface:ProjectManager
Returns the list of build types that belong to non-archived projects only.- Specified by:
getActiveBuildTypes
in interfaceProjectManager
- Returns:
- list of non-archived build types
-
getArchivedBuildTypes
@NotNull public List<SBuildType> getArchivedBuildTypes()
Description copied from interface:ProjectManager
Returns list of build configurations from archived projects, sorted by project and build configuration name.- Specified by:
getArchivedBuildTypes
in interfaceProjectManager
- Returns:
- list of archived build configurations.
-
getNumberOfBuildTypes
public int getNumberOfBuildTypes()
Description copied from interface:ProjectManager
Returns the total number of build configurations including ones from archived projects.- Specified by:
getNumberOfBuildTypes
in interfaceProjectManager
- Returns:
- number of build configurations
-
getNumberOfVcsRoots
public int getNumberOfVcsRoots()
Description copied from interface:ProjectManager
Returns the total number of VCS roots, including ones from archived projects- Specified by:
getNumberOfVcsRoots
in interfaceProjectManager
- Returns:
- number of VCS roots
-
getNumberOfVirtualBuildTypes
public int getNumberOfVirtualBuildTypes()
- Specified by:
getNumberOfVirtualBuildTypes
in interfaceProjectManagerEx
-
getAllBuildTypes
@NotNull public List<SBuildType> getAllBuildTypes(@NotNull User user)
Description copied from interface:ProjectManager
Returns list of all build configurations sorted by project according to the order specified by user and then by build configuration name.- Specified by:
getAllBuildTypes
in interfaceProjectManager
- Parameters:
user
- user whose settings to use to sort build types- Returns:
- list of all build configurations.
-
executeFSOperation
public void executeFSOperation(@NotNull String description, @NotNull Runnable persistAction)
- Specified by:
executeFSOperation
in interfaceProjectManagerEx
-
checkCanCreateBuildTypes
public void checkCanCreateBuildTypes(@NotNull SProject targetProject, int numOfBuildTypes) throws MaxNumberOfBuildTypesReachedException
Description copied from interface:ProjectManagerEx
Checks whether numOfBuildTypes build configurations can be created and throws exception if can't- Specified by:
checkCanCreateBuildTypes
in interfaceProjectManagerEx
- Parameters:
targetProject
- a project where build configurations will be creatednumOfBuildTypes
- number of build types to create- Throws:
MaxNumberOfBuildTypesReachedException
- if max number of build types reached
-
getProjectsDirectory
public File getProjectsDirectory()
- Specified by:
getProjectsDirectory
in interfaceProjectManagerEx
-
findVcsRootById
@Nullable public SVcsRootEx findVcsRootById(long id)
Description copied from interface:ProjectVcsRoots
Finds VCS root by id- Specified by:
findVcsRootById
in interfaceProjectVcsRoots
- Specified by:
findVcsRootById
in interfaceProjectVcsRootsEx
- Parameters:
id
- vcs root id- Returns:
- found VCS root or null
-
findVcsRootByExternalId
@Nullable public SVcsRootEx findVcsRootByExternalId(@NotNull String externalId)
Description copied from interface:ProjectVcsRoots
Finds VCS root by external id- Specified by:
findVcsRootByExternalId
in interfaceProjectVcsRoots
- Specified by:
findVcsRootByExternalId
in interfaceProjectVcsRootsEx
- Parameters:
externalId
- external vcs root id- Returns:
- found VCS root or null
-
findVcsRootByConfigId
@Nullable public SVcsRootEx findVcsRootByConfigId(@NotNull String configId)
Description copied from interface:ProjectVcsRoots
Finds VCS root by config id- Specified by:
findVcsRootByConfigId
in interfaceProjectVcsRoots
- Parameters:
configId
- the config is of vcs root- Returns:
- found VCS root or null
-
findVcsRootsByIds
@NotNull public Collection<SVcsRoot> findVcsRootsByIds(@NotNull Collection<Long> ids)
Description copied from interface:ProjectVcsRoots
Finds all VCS roots having the specified ids. Returns roots in the same order as provided ids.- Specified by:
findVcsRootsByIds
in interfaceProjectVcsRoots
- Parameters:
ids
- ids of VCS roots- Returns:
- collection of found VCS roots
-
findVcsRootByName
@Nullable public SVcsRootEx findVcsRootByName(@NotNull String name)
- Specified by:
findVcsRootByName
in interfaceProjectVcsRootsEx
-
getAllVcsRoots
@NotNull public List<SVcsRoot> getAllVcsRoots()
- Specified by:
getAllVcsRoots
in interfaceProjectVcsRoots
- Returns:
- all VCS roots configured in all projects
-
ensureProjectsDirectoryExists
public File ensureProjectsDirectoryExists()
- Specified by:
ensureProjectsDirectoryExists
in interfaceProjectManagerEx
-
lockProject
public void lockProject(@NotNull String internalId)
- Specified by:
lockProject
in interfaceProjectManagerEx
-
unlockProject
public void unlockProject(@NotNull String internalId)
- Specified by:
unlockProject
in interfaceProjectManagerEx
-
findProjectId
@Nullable public String findProjectId(@NotNull String buildTypeId)
Description copied from interface:ProjectManager
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.- Specified by:
findProjectId
in interfaceProjectManager
- Parameters:
buildTypeId
- id of a build type- Returns:
- project internal id of a project containing specified build type
-
findProjectsIds
@NotNull public Set<String> findProjectsIds(@NotNull Collection<String> buildTypeIds)
Description copied from interface:ProjectManagerEx
Accepts a collection of build type ids, returns ids of projects where these build types belong.- Specified by:
findProjectsIds
in interfaceProjectManagerEx
- Returns:
- see above
-
isProjectsModelInitialized
public boolean isProjectsModelInitialized()
- Specified by:
isProjectsModelInitialized
in interfaceProjectManagerEx
- Returns:
- true if projects configuration files were loaded from disk at least once (during the server startup).
-
internalBuildTypeIdToExternal
@Nullable public String internalBuildTypeIdToExternal(@NotNull String buildTypeId)
- Specified by:
internalBuildTypeIdToExternal
in interfaceProjectManagerEx
- Returns:
- external identifier by the given internal one or null if external identifier was not found.
-
getProjectIdentifiersManager
@NotNull public ProjectIdentifiersManager getProjectIdentifiersManager()
- Specified by:
getProjectIdentifiersManager
in interfaceProjectManagerEx
-
findProjectExternalId
@Nullable public String findProjectExternalId(@NotNull String buildTypeId)
Description copied from interface:ProjectManager
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.- Specified by:
findProjectExternalId
in interfaceProjectManager
- Parameters:
buildTypeId
- id of a build type- Returns:
- project external id of a project containing specified build type
-
findProjectIdForTemplate
@Nullable public String findProjectIdForTemplate(@NotNull String buildTypeTemplateId)
Description copied from interface:ProjectManager
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.- Specified by:
findProjectIdForTemplate
in interfaceProjectManager
- Parameters:
buildTypeTemplateId
- id of a build type template- Returns:
- project id of a project containing specified build type template
-
isProjectExists
public boolean isProjectExists(@NotNull String projectId)
Description copied from interface:ProjectManager
Returns true if project with the specified id exists. In contrast toProjectManager.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.- Specified by:
isProjectExists
in interfaceProjectManager
- Parameters:
projectId
- the internal id of the project- Returns:
- see above
-
findBuildTypes
@NotNull public Collection<SBuildType> findBuildTypes(@NotNull Collection<String> buildTypeIds)
Description copied from interface:ProjectManager
Returns collection of build types corresponding to the specified collection of build type ids. The returned collection will contain existing build types only.- Specified by:
findBuildTypes
in interfaceProjectManager
- Parameters:
buildTypeIds
- collection of build type internal ids- Returns:
- collection of existing build types
-
findBuildTypesByExternalIds
@NotNull public Collection<SBuildType> findBuildTypesByExternalIds(@NotNull Collection<String> externalIds)
Description copied from interface:ProjectManager
Returns collection of build types corresponding to the specified external ids.- Specified by:
findBuildTypesByExternalIds
in interfaceProjectManager
- Parameters:
externalIds
- collection of external identifiers, case insensitive.- Returns:
- see above
-
getBuildTypesDependingOn
@NotNull public Map<SBuildType,List<SArtifactDependency>> getBuildTypesDependingOn(@NotNull Collection<SBuildType> types)
- Specified by:
getBuildTypesDependingOn
in interfaceProjectManagerEx
-
findBuildTypeTemplateById
public BuildTypeTemplateEx findBuildTypeTemplateById(@NotNull String id)
Description copied from interface:ProjectManager
Searches for build type template by given internal id- Specified by:
findBuildTypeTemplateById
in interfaceProjectManager
- Specified by:
findBuildTypeTemplateById
in interfaceProjectManagerEx
- Parameters:
id
- the internal id of template- Returns:
- found template or null
-
findBuildTypeTemplateByExternalId
@Nullable public BuildTypeTemplateEx findBuildTypeTemplateByExternalId(@Nullable String externalId)
Description copied from interface:ProjectManager
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
.- Specified by:
findBuildTypeTemplateByExternalId
in interfaceProjectManager
- Specified by:
findBuildTypeTemplateByExternalId
in interfaceProjectManagerEx
- Parameters:
externalId
- the external id of template- Returns:
- found template or null, if template can't be found or external id is null.
-
findBuildTypeTemplateByConfigId
@Nullable public BuildTypeTemplate findBuildTypeTemplateByConfigId(@NotNull String configId)
Description copied from interface:ProjectManager
Searches for build type template by given config id.- Specified by:
findBuildTypeTemplateByConfigId
in interfaceProjectManager
- Parameters:
configId
- the config id of template- Returns:
- found template or null
-
getCommonParentProject
@NotNull public SProject getCommonParentProject(@NotNull Collection<SProject> projects)
Description copied from interface:ProjectManager
Returns nearest common parent project for all projects in provided collection.- Specified by:
getCommonParentProject
in interfaceProjectManager
- Parameters:
projects
- projects to find common parent for- Returns:
- common parent project
-
removeProject
public void removeProject(@NotNull String internalProjectId) throws ProjectRemoveFailedException
Description copied from interface:ProjectManager
Removes project from the current list of projects. Project directory will be placed into the '_trash' folder.- Specified by:
removeProject
in interfaceProjectManager
- Parameters:
internalProjectId
- internal id of project to remove- Throws:
ProjectRemoveFailedException
- if remove failed
-
removeProjectLater
@NotNull public BackgroundPersistTask removeProjectLater(@NotNull ConfigAction cause, @NotNull SProject project) throws ProjectRemoveFailedException
Description copied from interface:ProjectManagerEx
Removes the specified project in background- Specified by:
removeProjectLater
in interfaceProjectManagerEx
project
- project to remove- Returns:
- background remove task
- Throws:
ProjectRemoveFailedException
- when remove fails
-
getProjectIds
public List<String> getProjectIds()
Description copied from interface:ProjectManager
A helper method which returns the list of all projectID configured on the server.- Specified by:
getProjectIds
in interfaceProjectManager
- Returns:
- the list of all projectID configured on the server.
-
getFilteredBuildTypes
public SortedMap<SProject,List<SBuildType>> getFilteredBuildTypes(@NotNull User user, @Nullable BuildTypeFilter filter)
Description copied from interface:ProjectManager
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.- Specified by:
getFilteredBuildTypes
in interfaceProjectManager
- Parameters:
user
- the userfilter
- filter of build configurations, can be null- Returns:
- sorted map of build types per project
-
createTempModel
@NotNull public jetbrains.buildServer.serverSide.impl.projects.ProjectModelWrapper createTempModel()
-
persistAllProjects
public void persistAllProjects()
Description copied from interface:ProjectManagerEx
Persists configuration of all projects (including archived).- Specified by:
persistAllProjects
in interfaceProjectManagerEx
-
getProjectPersisters
public Collection<ProjectFilePersister> getProjectPersisters()
- Specified by:
getProjectPersisters
in interfaceProjectManagerEx
-
generateDefaultExternalIds
public ProjectManagerEx.IdsMaps generateDefaultExternalIds(@NotNull SProject project, @Nullable String changedExtId, boolean useCurrentIds, boolean generateForCopy)
Description copied from interface:ProjectManagerEx
Generates identifiers for all nested entities (subprojects, VCS roots, build types and templates) of the given project. Applicable to regenerate ids or to generate ids befor copying.- Specified by:
generateDefaultExternalIds
in interfaceProjectManagerEx
- Parameters:
project
- project to generate ids for its nested objects.changedExtId
- the new external id for this project.useCurrentIds
- use suffixes of the current external ids if possible.generateForCopy
- false means regenerate ids for the existent objects; true - for copies.- Returns:
- maps old id -> new id.
-
getDirectSubProjectsMap
@NotNull public Map<String,List<ProjectEx>> getDirectSubProjectsMap()
Description copied from interface:ProjectManagerEx
Map where key is parent project internal id and value - all direct subprojects of this parent- Specified by:
getDirectSubProjectsMap
in interfaceProjectManagerEx
- Returns:
-
getProjectsComparator
@NotNull public Comparator<SProject> getProjectsComparator()
- Specified by:
getProjectsComparator
in interfaceProjectManager
- Returns:
- Comparator to sort projects with server-wide custom ordering
-
getBuildTypesComparator
@NotNull public Comparator<SBuildType> getBuildTypesComparator()
- Specified by:
getBuildTypesComparator
in interfaceProjectManager
- 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.
-
getExistingProjectsIds
@NotNull public Set<String> getExistingProjectsIds(@NotNull Collection<String> projectIds)
Description copied from interface:ProjectManagerEx
Accepts a collection of project ids and and checks each of them for existence. Returns subset of project ids corresponding to existing projects.- Specified by:
getExistingProjectsIds
in interfaceProjectManagerEx
- Parameters:
projectIds
- project ids to check- Returns:
- subset of project ids corresponding to existing projects
-
runWithExclusiveProjectModelLock
public <T> T runWithExclusiveProjectModelLock(@NotNull Supplier<T> supplier) throws TimeoutException, InterruptedException
Description copied from interface:ProjectManagerEx
Runs the specified supplier with the exclusive project model lock and returns its result. The exclusive lock prevents model update from disk and entities addition/removal.- Specified by:
runWithExclusiveProjectModelLock
in interfaceProjectManagerEx
- Type Parameters:
T
- type of supplier's result- Parameters:
supplier
- supplier to run- Returns:
- see above
- Throws:
TimeoutException
- if exclusive lock cannot be acquired within the default timeoutInterruptedException
- if the thread was interrupted while waiting for a lock
-
updateEntitiesRemovedMark
public void updateEntitiesRemovedMark()
Description copied from interface:ProjectManagerEx
Finds all removed project ids and marks them as removed in database. Also finds all which are marked as removed but no longer removed, and unmarks them.- Specified by:
updateEntitiesRemovedMark
in interfaceProjectManagerEx
-
-