Package jetbrains.buildServer.serverSide
Interface ProjectManagerEx
-
- All Superinterfaces:
ProjectManager,ProjectVcsRoots,ProjectVcsRootsEx
- All Known Implementing Classes:
ProjectManagerImpl,SecuredProjectManager
public interface ProjectManagerEx extends ProjectManager, ProjectVcsRootsEx
- Author:
- Sergey.Anchipolevsky Date: 18.06.2007
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classProjectManagerEx.IdsMaps
-
Field Summary
Fields Modifier and Type Field Description static StringROOT_PROJECT_DESCRIPTIONThe Root project description.static StringROOT_PROJECT_NAMEThe Root project name.-
Fields inherited from interface jetbrains.buildServer.serverSide.ProjectManager
PROJECT_ID_NAME
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcheckCanCreateBuildTypes(SProject targetProject, int numOfBuildTypes)Checks whether numOfBuildTypes build configurations can be created and throws exception if can'tProjectExcreateProject(String projectName)Creates new project with specified name (name is case insensitive).ProjectExcreateProjectInternal(EntityId<String> parentId, String externalId, String projectName)FileensureProjectsDirectoryExists()voidexecuteFSOperation(String description, Runnable persistAction)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)BuildTypeTemplateExfindBuildTypeTemplateByExternalId(String externalId)Searches for build type template by given external id.BuildTypeTemplateExfindBuildTypeTemplateById(String id)Searches for build type template by given internal idProjectExfindProjectByExternalId(String externalId)Looks for a project with the given external id.ProjectExfindProjectById(String internalId)Looks for a project with the given internal id.Set<String>findProjectsIds(Collection<String> buildTypeIds)Accepts a collection of build type ids, returns ids of projects where these build types belong.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.Map<SBuildType,List<SArtifactDependency>>getBuildTypesDependingOn(Collection<SBuildType> types)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.intgetNumberOfVirtualBuildTypes()ProjectDataModelgetProjectDataModel()ProjectIdentifiersManagergetProjectIdentifiersManager()Collection<ProjectFilePersister>getProjectPersisters()FilegetProjectsDirectory()ProjectExgetRootProject()Returns the root project.StringinternalBuildTypeIdToExternal(String buildTypeId)booleanisProjectsModelInitialized()voidlockProject(String internalId)voidpersistAllProjects()Persists configuration of all projects (including archived).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.voidunlockProject(String internalId)voidupdateEntitiesRemovedMark()Finds all removed project ids and marks them as removed in database.-
Methods inherited from interface jetbrains.buildServer.serverSide.ProjectManager
copyProject, createProject, findBuildTypeByConfigId, findBuildTypes, findBuildTypesByExternalIds, findBuildTypeTemplateByConfigId, findProjectByConfigId, findProjectByName, findProjectExternalId, findProjectId, findProjectIdForTemplate, findProjects, findProjectsByExternalIds, getActiveBuildTypes, getActiveProjects, getAllBuildTypes, getAllBuildTypes, getAllTemplates, getArchivedBuildTypes, getArchivedProjects, getBuildTypesComparator, getCommonParentProject, getFilteredBuildTypes, getNumberOfBuildTypes, getNumberOfProjects, getNumberOfVcsRoots, getProjectIds, getProjects, getProjects, getProjectsComparator, isProjectExists, removeProject
-
Methods inherited from interface jetbrains.buildServer.serverSide.ProjectVcsRoots
findVcsRootByConfigId, findVcsRootsByIds, getAllVcsRoots
-
Methods inherited from interface jetbrains.buildServer.serverSide.ProjectVcsRootsEx
findVcsRootByExternalId, findVcsRootById, findVcsRootByName
-
-
-
-
Field Detail
-
ROOT_PROJECT_NAME
@NotNull static final String ROOT_PROJECT_NAME
The Root project name.- Since:
- 8.0
- See Also:
- Constant Field Values
-
ROOT_PROJECT_DESCRIPTION
@NotNull static final String ROOT_PROJECT_DESCRIPTION
The Root project description.- Since:
- 8.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRootProject
@NotNull ProjectEx getRootProject()
Returns the root project.- Specified by:
getRootProjectin interfaceProjectManager- Returns:
- root project.
- Since:
- 8.0
-
createProject
@NotNull ProjectEx createProject(@NotNull String projectName) throws InvalidIdentifierException, InvalidNameException, DuplicateProjectNameException
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:
createProjectin interfaceProjectManager- Parameters:
projectName- name of the new project- Returns:
- newly created project
- Throws:
DuplicateProjectNameException- if project with specified name already existsInvalidIdentifierExceptionInvalidNameException- See Also:
#createProject(String, String, String)
-
findBuildTypeIdentityByInternalId
@Nullable BuildTypeIdentity findBuildTypeIdentityByInternalId(@NotNull String intId)
-
findBuildTypeById
@Nullable BuildTypeEx findBuildTypeById(@Nullable String internalId) throws AccessDeniedException
Searches for a build configuration with the specified internal id.- Specified by:
findBuildTypeByIdin interfaceProjectManager- 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:
ProjectManager.findBuildTypeById(String)
-
findBuildTypeByExternalId
BuildTypeEx findBuildTypeByExternalId(@Nullable String externalId) throws AccessDeniedException
Looks for a build type with the given external id.- Specified by:
findBuildTypeByExternalIdin interfaceProjectManager- 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- Since:
- 8.0
-
findProjectById
@Nullable ProjectEx findProjectById(@Nullable String internalId)
Looks for a project with the given internal id.- Specified by:
findProjectByIdin interfaceProjectManager- Parameters:
internalId- the internal id, case insensitive.- Returns:
- the found project, or null if not found.
- See Also:
BuildProject.getProjectId(),findProjectByExternalId(String)
-
findProjectByExternalId
@Nullable ProjectEx findProjectByExternalId(@Nullable String externalId)
Looks for a project with the given external id.- Specified by:
findProjectByExternalIdin interfaceProjectManager- Parameters:
externalId- the external id, case insensitive.- Returns:
- the found project, or null if not found.
- Since:
- 8.0
- See Also:
BuildProject.getExternalId(),findProjectById(String)
-
persistAllProjects
void persistAllProjects()
Persists configuration of all projects (including archived).
-
checkCanCreateBuildTypes
void checkCanCreateBuildTypes(@NotNull SProject targetProject, int numOfBuildTypes) throws MaxNumberOfBuildTypesReachedExceptionChecks whether numOfBuildTypes build configurations can be created and throws exception if can't- 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
-
getBuildTypesDependingOn
@NotNull Map<SBuildType,List<SArtifactDependency>> getBuildTypesDependingOn(@NotNull Collection<SBuildType> types)
-
findBuildTypeTemplateById
@Nullable BuildTypeTemplateEx findBuildTypeTemplateById(@NotNull String id)
Description copied from interface:ProjectManagerSearches for build type template by given internal id- Specified by:
findBuildTypeTemplateByIdin interfaceProjectManager- Parameters:
id- the internal id of template- Returns:
- found template or null
-
findBuildTypeTemplateByExternalId
@Nullable 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- Parameters:
externalId- the external id of template- Returns:
- found template or null, if template can't be found or external id is null.
-
getProjectsDirectory
File getProjectsDirectory()
-
ensureProjectsDirectoryExists
File ensureProjectsDirectoryExists()
-
executeFSOperation
void executeFSOperation(@NotNull String description, @NotNull Runnable persistAction)
-
lockProject
void lockProject(@NotNull String internalId)
-
unlockProject
void unlockProject(@NotNull String internalId)
-
getProjectPersisters
Collection<ProjectFilePersister> getProjectPersisters()
-
getProjectDataModel
@NotNull ProjectDataModel getProjectDataModel()
-
findBuildTypeIdentityByExternalId
@Nullable BuildTypeIdentity findBuildTypeIdentityByExternalId(@NotNull String extId)
-
createProjectInternal
ProjectEx createProjectInternal(@NotNull EntityId<String> parentId, @NotNull String externalId, @NotNull String projectName)
-
getNumberOfVirtualBuildTypes
int getNumberOfVirtualBuildTypes()
-
generateDefaultExternalIds
ProjectManagerEx.IdsMaps generateDefaultExternalIds(@NotNull SProject project, @Nullable String changedExtId, boolean useCurrentIds, boolean generateForCopy) throws InvalidIdentifierException
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.- 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.
- Throws:
InvalidIdentifierException- if the specified external id is invalid- Since:
- 8.0
-
getDirectSubProjectsMap
@NotNull Map<String,List<ProjectEx>> getDirectSubProjectsMap()
Map where key is parent project internal id and value - all direct subprojects of this parent- Returns:
-
removeProjectLater
@NotNull BackgroundPersistTask removeProjectLater(@NotNull ConfigAction cause, @NotNull SProject project) throws ProjectRemoveFailedException
Removes the specified project in background- Parameters:
project- project to remove- Returns:
- background remove task
- Throws:
ProjectRemoveFailedException- when remove fails
-
getExistingProjectsIds
@NotNull Set<String> getExistingProjectsIds(@NotNull Collection<String> projectIds)
Accepts a collection of project ids and and checks each of them for existence. Returns subset of project ids corresponding to existing projects.- Parameters:
projectIds- project ids to check- Returns:
- subset of project ids corresponding to existing projects
-
runWithExclusiveProjectModelLock
<T> T runWithExclusiveProjectModelLock(@NotNull Supplier<T> supplier) throws TimeoutException, InterruptedExceptionRuns 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.- 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
void updateEntitiesRemovedMark()
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.
-
findProjectsIds
@NotNull Set<String> findProjectsIds(@NotNull Collection<String> buildTypeIds)
Accepts a collection of build type ids, returns ids of projects where these build types belong.- Parameters:
buildTypeIds-- Returns:
- see above
- Since:
- 2018.1.1
-
isProjectsModelInitialized
boolean isProjectsModelInitialized()
- Returns:
- true if projects configuration files were loaded from disk at least once (during the server startup).
- Since:
- 2021.2
-
internalBuildTypeIdToExternal
@Nullable String internalBuildTypeIdToExternal(@NotNull String buildTypeId)
- Returns:
- external identifier by the given internal one or null if external identifier was not found.
- Since:
- 2023.11
-
getProjectIdentifiersManager
@NotNull ProjectIdentifiersManager getProjectIdentifiersManager()
-
-