Class SecuredProjectManager
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.auth.SecuredProjectManager
-
- All Implemented Interfaces:
ProjectManager,ProjectManagerEx,ProjectVcsRoots,ProjectVcsRootsEx
public class SecuredProjectManager extends Object implements ProjectManagerEx
- Author:
- Sergey.Anchipolevsky Date: 22.08.2007
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jetbrains.buildServer.serverSide.ProjectManagerEx
ProjectManagerEx.IdsMaps
-
-
Field Summary
-
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 SecuredProjectManager(SecurityContextEx securityContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckCanCreateBuildTypes(SProject targetProject, int numOfBuildTypes)Checks whether numOfBuildTypes build configurations can be created and throws exception if can'tSProjectcopyProject(SProject originalProject, SProject parentOfCopy, CopyOptions options)Copies the given project with all subprojects into another project.ProjectExcreateProject(String projectName)Creates new project with specified name (name is case insensitive).SProjectcreateProject(SProject originalProject, String newProjectName, CopyOptions options)Creates new project by copying all settings from original project.ProjectExcreateProjectInternal(EntityId<String> parentId, String externalId, String projectName)FileensureProjectsDirectoryExists()voidexecuteFSOperation(String description, Runnable persistAction)static List<SProject>filterProjects(List<SProject> list, Filter<BuildProject> projectFilter)SBuildTypefindBuildTypeByConfigId(String configId)Searches for a build configuration with specified config id.BuildTypeExfindBuildTypeByExternalId(String externalId)Looks for a build type with the given external id.BuildTypeExfindBuildTypeById(String internalId)Searches for a build configuration with the specified internal id.BuildTypeIdentityfindBuildTypeIdentityByExternalId(String extId)BuildTypeIdentityfindBuildTypeIdentityByInternalId(String intId)Collection<SBuildType>findBuildTypes(Collection<String> buildTypeIds)Filters collection of build types by preserving only accessible ones by current user.Collection<SBuildType>findBuildTypesByExternalIds(Collection<String> externalIds)Returns collection of build types corresponding to the specified external ids.BuildTypeTemplatefindBuildTypeTemplateByConfigId(String configId)Searches for build type template by given config id.BuildTypeTemplateExfindBuildTypeTemplateByExternalId(String externalId)Searches for build type template by given external id.BuildTypeTemplateExfindBuildTypeTemplateById(String id)Searches for build type template by given internal idSProjectfindProjectByConfigId(String configId)Looks for a project with the given config id.ProjectExfindProjectByExternalId(String externalId)Looks for a project with the given external id.ProjectExfindProjectById(String projectId)Looks for a project with the given internal id.SProjectfindProjectByName(String projectName)Searches for a project with the specified name (case insensitive) among direct subprojects of the root project.StringfindProjectExternalId(String buildTypeId)Searches for a project which contains a build type with the specified build type id.StringfindProjectId(String buildTypeId)Searches for a project which contains a build type with the specified build type id.StringfindProjectIdForTemplate(String buildTypeTemplateId)Searches for a project which contains a build type template with the specified id.Collection<SProject>findProjects(Collection<String> internalIds)Filters collection of projects by preserving only accessible ones by current user.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.SVcsRootfindVcsRootByConfigId(String configId)Finds VCS root by config idSVcsRootExfindVcsRootByExternalId(String externalId)Finds VCS root by external idSVcsRootExfindVcsRootById(long id)Finds VCS root by idSVcsRootExfindVcsRootByName(String name)Collection<SVcsRoot>findVcsRootsByIds(Collection<Long> ids)Finds all VCS roots having the specified ids.ProjectManagerEx.IdsMapsgenerateDefaultExternalIds(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)SProjectgetCommonParentProject(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.intgetNumberOfBuildTypes()Returns the total number of build configurations including ones from archived projects.intgetNumberOfProjects()Returns total number of projects currently loaded in the server.intgetNumberOfVcsRoots()Returns the total number of VCS roots, including ones from archived projectsintgetNumberOfVirtualBuildTypes()ProjectDataModelgetProjectDataModel()ProjectIdentifiersManagergetProjectIdentifiersManager()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()FilegetProjectsDirectory()ProjectExgetRootProject()Returns the root project.StringinternalBuildTypeIdToExternal(String buildTypeId)booleanisProjectExists(String projectId)Returns true if project with the specified id exists.booleanisProjectsModelInitialized()voidlockProject(String internalId)voidpersistAllProjects()Persists configuration of all projects (including archived).voidremoveProject(String internalProjectId)Removes project from the current list of projects.BackgroundPersistTaskremoveProjectLater(ConfigAction cause, SProject project)Removes the specified project in background<T> TrunWithExclusiveProjectModelLock(Supplier<T> supplier)Runs the specified supplier with the exclusive project model lock and returns its result.voidsetDelegate(ProjectManagerEx delegate)voidunlockProject(String internalId)voidupdateEntitiesRemovedMark()Finds all removed project ids and marks them as removed in database.
-
-
-
Constructor Detail
-
SecuredProjectManager
public SecuredProjectManager(@NotNull SecurityContextEx securityContext)
-
-
Method Detail
-
setDelegate
public void setDelegate(@NotNull ProjectManagerEx delegate)
-
getRootProject
@NotNull public ProjectEx getRootProject()
Description copied from interface:ProjectManagerExReturns the root project.- Specified by:
getRootProjectin interfaceProjectManager- Specified by:
getRootProjectin interfaceProjectManagerEx- Returns:
- root project.
-
getProjects
@NotNull public List<SProject> getProjects()
Description copied from interface:ProjectManagerReturns the list of all projects, including archived. The order: visible projects come first (sorted by name), then archived projects (sorted by name).- Specified by:
getProjectsin interfaceProjectManager- Returns:
- list of all projects
-
getActiveProjects
@NotNull public List<SProject> getActiveProjects()
Description copied from interface:ProjectManagerReturns the list of active (non-archived) projects. List is sorted by project name.- Specified by:
getActiveProjectsin interfaceProjectManager- Returns:
- list of non-archived projects
-
getArchivedProjects
@NotNull public List<SProject> getArchivedProjects()
Description copied from interface:ProjectManagerReturns the list of archived projects. List is sorted by project name.- Specified by:
getArchivedProjectsin interfaceProjectManager- Returns:
- list of archived projects
-
getNumberOfProjects
public int getNumberOfProjects()
Description copied from interface:ProjectManagerReturns total number of projects currently loaded in the server. The value always equals togetProjects().size().- Specified by:
getNumberOfProjectsin interfaceProjectManager- Returns:
- total number of projects
-
getProjects
@NotNull public List<SProject> getProjects(@NotNull User user)
Description copied from interface:ProjectManagerReturns list of all projects sorted according to the order specified by user- Specified by:
getProjectsin interfaceProjectManager- Parameters:
user- the user- Returns:
- see above
-
createProject
@NotNull public ProjectEx createProject(@NotNull String projectName) throws DuplicateProjectNameException
Description copied from interface:ProjectManagerExCreates 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:
createProjectin interfaceProjectManager- Specified by:
createProjectin 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)
-
copyProject
@NotNull public SProject copyProject(@NotNull SProject originalProject, @NotNull SProject parentOfCopy, @NotNull CopyOptions options) throws MaxNumberOfBuildTypesReachedException, InvalidIdentifierException, InvalidNameException, DuplicateExternalIdException
Description copied from interface:ProjectManagerCopies the given project with all subprojects into another project.Also persists projects when they're copied.
- Specified by:
copyProjectin interfaceProjectManager- Parameters:
originalProject- the project to copy.parentOfCopy- the parent of the newly created projectoptions- copy option.- Returns:
- the copy of the project
- Throws:
MaxNumberOfBuildTypesReachedExceptionInvalidIdentifierExceptionInvalidNameExceptionDuplicateExternalIdException- See Also:
CopyOptions
-
createProject
@NotNull public SProject createProject(@NotNull SProject originalProject, @NotNull String newProjectName, @NotNull CopyOptions options) throws MaxNumberOfBuildTypesReachedException
Description copied from interface:ProjectManagerCreates 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:
createProjectin 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
-
findProjectByName
@Nullable public SProject findProjectByName(@NotNull String projectName)
Description copied from interface:ProjectManagerSearches for a project with the specified name (case insensitive) among direct subprojects of the root project. The search includes archived projects.- Specified by:
findProjectByNamein 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:ProjectManagerExLooks for a project with the given internal id.- Specified by:
findProjectByIdin interfaceProjectManager- Specified by:
findProjectByIdin interfaceProjectManagerEx- Parameters:
projectId- the internal id, case insensitive.- Returns:
- the found project, or null if not found.
- See Also:
BuildProject.getProjectId(),ProjectManagerEx.findProjectByExternalId(String)
-
findProjectByExternalId
@Nullable public ProjectEx findProjectByExternalId(@Nullable String externalId)
Description copied from interface:ProjectManagerExLooks for a project with the given external id.- Specified by:
findProjectByExternalIdin interfaceProjectManager- Specified by:
findProjectByExternalIdin 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:ProjectManagerLooks for a project with the given config id.The search includes archived projects.
- Specified by:
findProjectByConfigIdin 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)
Filters collection of projects by preserving only accessible ones by current user.- Specified by:
findProjectsin interfaceProjectManager- Parameters:
internalIds-- Returns:
-
findProjectsByExternalIds
@NotNull public Collection<SProject> findProjectsByExternalIds(@NotNull Collection<String> externalIds)
Description copied from interface:ProjectManagerReturns collection of projects corresponding to the specified external ids. The collection is guaranteed to be a mutable one.
- Specified by:
findProjectsByExternalIdsin interfaceProjectManager- Parameters:
externalIds- collection of external identifiers, case insensitive.- Returns:
- see above
-
findBuildTypeIdentityByInternalId
@Nullable public BuildTypeIdentity findBuildTypeIdentityByInternalId(@NotNull String intId)
- Specified by:
findBuildTypeIdentityByInternalIdin interfaceProjectManagerEx
-
findBuildTypeById
@Nullable public BuildTypeEx findBuildTypeById(@Nullable String internalId)
Searches for a build configuration with the specified internal id.- Specified by:
findBuildTypeByIdin interfaceProjectManager- Specified by:
findBuildTypeByIdin 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.
- Throws:
AccessDeniedException- if the current authority holder doesn't have an access to the build configuration with the given internalid.- See Also:
ProjectManagerEx.findBuildTypeById(String)
-
findBuildTypeByExternalId
public BuildTypeEx findBuildTypeByExternalId(@Nullable String externalId) throws AccessDeniedException
Description copied from interface:ProjectManagerExLooks for a build type with the given external id.- Specified by:
findBuildTypeByExternalIdin interfaceProjectManager- Specified by:
findBuildTypeByExternalIdin 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.
- Throws:
AccessDeniedException- if current authority holder doesn't have access to build configuration with given external id.
-
findBuildTypeByConfigId
@Nullable public SBuildType findBuildTypeByConfigId(@Nullable String configId) throws AccessDeniedException
Description copied from interface:ProjectManagerSearches for a build configuration with specified config id.- Specified by:
findBuildTypeByConfigIdin 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.
-
persistAllProjects
public void persistAllProjects()
Description copied from interface:ProjectManagerExPersists configuration of all projects (including archived).- Specified by:
persistAllProjectsin interfaceProjectManagerEx
-
getAllBuildTypes
@NotNull public List<SBuildType> getAllBuildTypes()
Description copied from interface:ProjectManagerReturns 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:
getAllBuildTypesin interfaceProjectManager- Returns:
- list of all build configurations
-
getAllTemplates
@NotNull public List<BuildTypeTemplate> getAllTemplates()
Description copied from interface:ProjectManagerReturns list of all of the templates, including ones from archived projects. Ordering is the same as for build configurations.- Specified by:
getAllTemplatesin interfaceProjectManager- Returns:
- see above
-
getActiveBuildTypes
@NotNull public List<SBuildType> getActiveBuildTypes()
Description copied from interface:ProjectManagerReturns the list of build types that belong to non-archived projects only.- Specified by:
getActiveBuildTypesin interfaceProjectManager- Returns:
- list of non-archived build types
-
getArchivedBuildTypes
@NotNull public List<SBuildType> getArchivedBuildTypes()
Description copied from interface:ProjectManagerReturns list of build configurations from archived projects, sorted by project and build configuration name.- Specified by:
getArchivedBuildTypesin interfaceProjectManager- Returns:
- list of archived build configurations.
-
getNumberOfBuildTypes
public int getNumberOfBuildTypes()
Description copied from interface:ProjectManagerReturns the total number of build configurations including ones from archived projects.- Specified by:
getNumberOfBuildTypesin interfaceProjectManager- Returns:
- number of build configurations
-
getNumberOfVcsRoots
public int getNumberOfVcsRoots()
Description copied from interface:ProjectManagerReturns the total number of VCS roots, including ones from archived projects- Specified by:
getNumberOfVcsRootsin interfaceProjectManager- Returns:
- number of VCS roots
-
getAllBuildTypes
@NotNull public List<SBuildType> getAllBuildTypes(@NotNull User user)
Description copied from interface:ProjectManagerReturns list of all build configurations sorted by project according to the order specified by user and then by build configuration name.- Specified by:
getAllBuildTypesin interfaceProjectManager- Parameters:
user- user whose settings to use to sort build types- Returns:
- list of all build configurations.
-
checkCanCreateBuildTypes
public void checkCanCreateBuildTypes(@NotNull SProject targetProject, int numOfBuildTypes) throws MaxNumberOfBuildTypesReachedExceptionDescription copied from interface:ProjectManagerExChecks whether numOfBuildTypes build configurations can be created and throws exception if can't- Specified by:
checkCanCreateBuildTypesin 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
-
findProjectId
@Nullable public String findProjectId(@NotNull String buildTypeId)
Description copied from interface:ProjectManagerSearches 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:
findProjectIdin 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:ProjectManagerExAccepts a collection of build type ids, returns ids of projects where these build types belong.- Specified by:
findProjectsIdsin interfaceProjectManagerEx- Returns:
- see above
-
isProjectsModelInitialized
public boolean isProjectsModelInitialized()
- Specified by:
isProjectsModelInitializedin 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:
internalBuildTypeIdToExternalin interfaceProjectManagerEx- Returns:
- external identifier by the given internal one or null if external identifier was not found.
-
getProjectIdentifiersManager
@NotNull public ProjectIdentifiersManager getProjectIdentifiersManager()
- Specified by:
getProjectIdentifiersManagerin interfaceProjectManagerEx
-
findProjectExternalId
@Nullable public String findProjectExternalId(@NotNull String buildTypeId)
Description copied from interface:ProjectManagerSearches 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:
findProjectExternalIdin 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:ProjectManagerSearches 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:
findProjectIdForTemplatein 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:ProjectManagerReturns 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:
isProjectExistsin interfaceProjectManager- Parameters:
projectId- the internal id of the project- Returns:
- see above
-
getBuildTypesDependingOn
@NotNull public Map<SBuildType,List<SArtifactDependency>> getBuildTypesDependingOn(@NotNull Collection<SBuildType> types)
- Specified by:
getBuildTypesDependingOnin interfaceProjectManagerEx
-
findBuildTypeTemplateById
public BuildTypeTemplateEx findBuildTypeTemplateById(@NotNull String id)
Description copied from interface:ProjectManagerSearches for build type template by given internal id- Specified by:
findBuildTypeTemplateByIdin interfaceProjectManager- Specified by:
findBuildTypeTemplateByIdin interfaceProjectManagerEx- Parameters:
id- the internal id of template- Returns:
- found template or null
-
findBuildTypeTemplateByExternalId
@Nullable public BuildTypeTemplateEx findBuildTypeTemplateByExternalId(@NotNull String externalId)
Description copied from interface:ProjectManagerSearches 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:
findBuildTypeTemplateByExternalIdin interfaceProjectManager- Specified by:
findBuildTypeTemplateByExternalIdin 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:ProjectManagerSearches for build type template by given config id.- Specified by:
findBuildTypeTemplateByConfigIdin 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:ProjectManagerReturns nearest common parent project for all projects in provided collection.- Specified by:
getCommonParentProjectin interfaceProjectManager- Parameters:
projects- projects to find common parent for- Returns:
- common parent project
-
findBuildTypes
@NotNull public Collection<SBuildType> findBuildTypes(@NotNull Collection<String> buildTypeIds)
Filters collection of build types by preserving only accessible ones by current user.- Specified by:
findBuildTypesin interfaceProjectManager- Parameters:
buildTypeIds-- Returns:
-
findBuildTypesByExternalIds
@NotNull public Collection<SBuildType> findBuildTypesByExternalIds(@NotNull Collection<String> externalIds)
Description copied from interface:ProjectManagerReturns collection of build types corresponding to the specified external ids.- Specified by:
findBuildTypesByExternalIdsin interfaceProjectManager- Parameters:
externalIds- collection of external identifiers, case insensitive.- Returns:
- see above
-
removeProject
public void removeProject(@NotNull String internalProjectId) throws ProjectRemoveFailedExceptionDescription copied from interface:ProjectManagerRemoves project from the current list of projects. Project directory will be placed into the '_trash' folder.- Specified by:
removeProjectin 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:ProjectManagerExRemoves the specified project in background- Specified by:
removeProjectLaterin interfaceProjectManagerExproject- project to remove- Returns:
- background remove task
- Throws:
ProjectRemoveFailedException- when remove fails
-
getExistingProjectsIds
@NotNull public Set<String> getExistingProjectsIds(@NotNull Collection<String> projectIds)
Description copied from interface:ProjectManagerExAccepts a collection of project ids and and checks each of them for existence. Returns subset of project ids corresponding to existing projects.- Specified by:
getExistingProjectsIdsin interfaceProjectManagerEx- Parameters:
projectIds- project ids to check- Returns:
- subset of project ids corresponding to existing projects
-
getProjectIds
public List<String> getProjectIds()
Description copied from interface:ProjectManagerA helper method which returns the list of all projectID configured on the server.- Specified by:
getProjectIdsin 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:ProjectManagerReturns 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:
getFilteredBuildTypesin interfaceProjectManager- Parameters:
user- the userfilter- filter of build configurations, can be null- Returns:
- sorted map of build types per project
-
getProjectsDirectory
public File getProjectsDirectory()
- Specified by:
getProjectsDirectoryin interfaceProjectManagerEx
-
findVcsRootById
@Nullable public SVcsRootEx findVcsRootById(long id)
Description copied from interface:ProjectVcsRootsFinds VCS root by id- Specified by:
findVcsRootByIdin interfaceProjectVcsRoots- Specified by:
findVcsRootByIdin interfaceProjectVcsRootsEx- Parameters:
id- vcs root id- Returns:
- found VCS root or null
-
findVcsRootByExternalId
@Nullable public SVcsRootEx findVcsRootByExternalId(@NotNull String externalId)
Description copied from interface:ProjectVcsRootsFinds VCS root by external id- Specified by:
findVcsRootByExternalIdin interfaceProjectVcsRoots- Specified by:
findVcsRootByExternalIdin interfaceProjectVcsRootsEx- Parameters:
externalId- external vcs root id- Returns:
- found VCS root or null
-
findVcsRootByConfigId
@Nullable public SVcsRoot findVcsRootByConfigId(@NotNull String configId)
Description copied from interface:ProjectVcsRootsFinds VCS root by config id- Specified by:
findVcsRootByConfigIdin 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:ProjectVcsRootsFinds all VCS roots having the specified ids. Returns roots in the same order as provided ids.- Specified by:
findVcsRootsByIdsin interfaceProjectVcsRoots- Parameters:
ids- ids of VCS roots- Returns:
- collection of found VCS roots
-
findVcsRootByName
@Nullable public SVcsRootEx findVcsRootByName(@NotNull String name)
- Specified by:
findVcsRootByNamein interfaceProjectVcsRootsEx
-
ensureProjectsDirectoryExists
public File ensureProjectsDirectoryExists()
- Specified by:
ensureProjectsDirectoryExistsin interfaceProjectManagerEx
-
executeFSOperation
public void executeFSOperation(@NotNull String description, @NotNull Runnable persistAction)- Specified by:
executeFSOperationin interfaceProjectManagerEx
-
lockProject
public void lockProject(@NotNull String internalId)- Specified by:
lockProjectin interfaceProjectManagerEx
-
unlockProject
public void unlockProject(@NotNull String internalId)- Specified by:
unlockProjectin interfaceProjectManagerEx
-
getProjectPersisters
public Collection<ProjectFilePersister> getProjectPersisters()
- Specified by:
getProjectPersistersin interfaceProjectManagerEx
-
getProjectDataModel
@NotNull public ProjectDataModel getProjectDataModel()
- Specified by:
getProjectDataModelin interfaceProjectManagerEx
-
findBuildTypeIdentityByExternalId
@Nullable public BuildTypeIdentity findBuildTypeIdentityByExternalId(@NotNull String extId)
- Specified by:
findBuildTypeIdentityByExternalIdin interfaceProjectManagerEx
-
createProjectInternal
public ProjectEx createProjectInternal(@NotNull EntityId<String> parentId, @NotNull String externalId, @NotNull String projectName)
- Specified by:
createProjectInternalin interfaceProjectManagerEx
-
getNumberOfVirtualBuildTypes
public int getNumberOfVirtualBuildTypes()
- Specified by:
getNumberOfVirtualBuildTypesin interfaceProjectManagerEx
-
getBuildTypesComparator
@NotNull public Comparator<SBuildType> getBuildTypesComparator()
- Specified by:
getBuildTypesComparatorin 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.
-
getAllVcsRoots
@NotNull public List<SVcsRoot> getAllVcsRoots()
- Specified by:
getAllVcsRootsin interfaceProjectVcsRoots- Returns:
- all VCS roots configured in all projects
-
filterProjects
@NotNull public static List<SProject> filterProjects(@NotNull List<SProject> list, @NotNull Filter<BuildProject> projectFilter)
-
generateDefaultExternalIds
public ProjectManagerEx.IdsMaps generateDefaultExternalIds(@NotNull SProject project, @Nullable String changedExtId, boolean useCurrentIds, boolean generateForCopy)
Description copied from interface:ProjectManagerExGenerates 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:
generateDefaultExternalIdsin 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:ProjectManagerExMap where key is parent project internal id and value - all direct subprojects of this parent- Specified by:
getDirectSubProjectsMapin interfaceProjectManagerEx- Returns:
-
getProjectsComparator
@NotNull public Comparator<SProject> getProjectsComparator()
- Specified by:
getProjectsComparatorin interfaceProjectManager- Returns:
- Comparator to sort projects with server-wide custom ordering
-
runWithExclusiveProjectModelLock
public <T> T runWithExclusiveProjectModelLock(@NotNull Supplier<T> supplier) throws TimeoutException, InterruptedExceptionDescription copied from interface:ProjectManagerExRuns 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:
runWithExclusiveProjectModelLockin 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:ProjectManagerExFinds 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:
updateEntitiesRemovedMarkin interfaceProjectManagerEx
-
-