Class BuildsManagerImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.BuildsManagerImpl
-
- All Implemented Interfaces:
BuildsManager,RunningBuildsManager
public class BuildsManagerImpl extends Object implements BuildsManager
Created 25.04.13 17:09- Author:
- Eugene Petrenko (eugene.petrenko@jetbrains.com)
-
-
Field Summary
Fields Modifier and Type Field Description static StringPROCESS_ITEMS_USE_LATEST_BUILDS
-
Constructor Summary
Constructors Constructor Description BuildsManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SBuildfindBuildInstanceByBuildNumber(String buildTypeId, String buildNumber)Returns the most recent build (ordered by changes) with the specified build numberSBuildfindBuildInstanceById(long buildId)Return the build which corresponds to given buildId.Collection<SBuild>findBuildInstances(Collection<Long> buildIds)Returns collection of builds corresponding to the specified builds ids.List<SBuild>findBuildInstancesByBuildNumber(String buildTypeId, String buildNumber)Returns builds in specified build configuration id having the specified build number.SBuildfindNextBuild(SBuild build, BuildDataFilter filter)Returns the next non personal build (finished or running) started after the specified build.SBuildfindPreviousBuild(SBuild buildData)Finds a non personal build (running or finished) which was started before the specified build and contains same or previous changes than the specified build.SBuildfindPreviousBuild(SBuild buildData, BuildDataFilter filter)Same asBuildsManager.findPreviousBuild(jetbrains.buildServer.serverSide.SBuild)but searches for a previous build among builds accepted by the specified filter.SRunningBuildfindRunningBuildById(long buildId)Searches for a running build by specified build id.intgetNumberOfRunningBuilds()Returns total number of currently running builds.SRunningBuildgetRunningBuildOnAgent(SBuildAgent agent)Returns running build running on the specified agent or null if there are no build on the agent.List<SRunningBuild>getRunningBuilds()Same as getRunningBuilds(null, null) List of running builds is sorted by build id in reverse order (most recent build first).List<SRunningBuild>getRunningBuilds(User user, BuildDataFilter filter)Returns all running builds including personal builds according to settings of the specified user.List<SRunningBuild>getRunningBuilds(User user, SBuildType buildType)Returns all running builds including personal builds which belong to the specified build configuration.Map<SBuildType,List<SRunningBuild>>getRunningStatus(User user, BuildDataFilter filter)Returns map of running builds per build configuration.voidprocessBuilds(BuildQueryOptions options, ItemProcessor<SBuild> processor)Returns the builds matched by theoptionsspecified.voidsetHistory(BuildHistoryEx history)voidsetProjectManager(ProjectManagerEx projectManager)voidsetRunningBuildsManager(RunningBuildsManagerImpl runningBuilds)voidsetSecurityContext(SecurityContextEx securityContext)
-
-
-
Field Detail
-
PROCESS_ITEMS_USE_LATEST_BUILDS
public static final String PROCESS_ITEMS_USE_LATEST_BUILDS
- See Also:
- Constant Field Values
-
-
Method Detail
-
setRunningBuildsManager
public void setRunningBuildsManager(RunningBuildsManagerImpl runningBuilds)
-
setHistory
public void setHistory(BuildHistoryEx history)
-
setSecurityContext
public void setSecurityContext(SecurityContextEx securityContext)
-
setProjectManager
public void setProjectManager(ProjectManagerEx projectManager)
-
findBuildInstanceById
@Nullable public SBuild findBuildInstanceById(long buildId)
Return the build which corresponds to given buildId. Build can be running, or it can be finished.- Specified by:
findBuildInstanceByIdin interfaceBuildsManager- Parameters:
buildId- build identifier- Returns:
- the build which corresponds to given buildId
- Throws:
AccessDeniedException- if the current authority holder doesn't have an access to the build with the givenid.- See Also:
BuildsManager.findBuildInstanceById(long)
-
findPreviousBuild
@Nullable public SBuild findPreviousBuild(@NotNull SBuild buildData)
Description copied from interface:BuildsManagerFinds a non personal build (running or finished) which was started before the specified build and contains same or previous changes than the specified build. The resulting build belongs to the same build configuration.- Specified by:
findPreviousBuildin interfaceBuildsManager- Parameters:
buildData- build to find previous build for- Returns:
- previous build in same build configuration or null if there is no previous build
-
findPreviousBuild
@Nullable public SBuild findPreviousBuild(@NotNull SBuild buildData, @NotNull BuildDataFilter filter)
Description copied from interface:BuildsManagerSame asBuildsManager.findPreviousBuild(jetbrains.buildServer.serverSide.SBuild)but searches for a previous build among builds accepted by the specified filter. Previous mean containing previous changes or with same changes but started before this one.- Specified by:
findPreviousBuildin interfaceBuildsManager- Parameters:
buildData- build to find previous build forfilter- build filter- Returns:
- previous build in same build configuration matching the specified filter or null if there is no previous build
-
findNextBuild
@Nullable public SBuild findNextBuild(@NotNull SBuild build, @NotNull BuildDataFilter filter)
Description copied from interface:BuildsManagerReturns the next non personal build (finished or running) started after the specified build.- Specified by:
findNextBuildin interfaceBuildsManager- Parameters:
build- build to find next build forfilter- build filter- Returns:
- next build in same build configuration, or null
- See Also:
BuildsManager.findPreviousBuild(SBuild, BuildDataFilter)
-
findBuildInstances
@NotNull public Collection<SBuild> findBuildInstances(@NotNull Collection<Long> buildIds)
Description copied from interface:BuildsManagerReturns collection of builds corresponding to the specified builds ids. Both running and finished builds can appear in the resulting collection. The collection will contain existing builds only. NOTE: RETURNED COLLECTION WILL NOT MAINTAIN REQUESTED ORDER!- Specified by:
findBuildInstancesin interfaceBuildsManager- Parameters:
buildIds- build identifiers to be searched for.- Returns:
- see above
-
findBuildInstanceByBuildNumber
public SBuild findBuildInstanceByBuildNumber(@NotNull String buildTypeId, @NotNull String buildNumber)
Description copied from interface:BuildsManagerReturns the most recent build (ordered by changes) with the specified build number- Specified by:
findBuildInstanceByBuildNumberin interfaceBuildsManager- Parameters:
buildTypeId- build configuration internal idbuildNumber- build number string- Returns:
- see above
-
findBuildInstancesByBuildNumber
@NotNull public List<SBuild> findBuildInstancesByBuildNumber(@NotNull String buildTypeId, @NotNull String buildNumber)
Description copied from interface:BuildsManagerReturns builds in specified build configuration id having the specified build number. Builds are ordered by changes, i.e. the most recent build first. The list may contain personal builds too.- Specified by:
findBuildInstancesByBuildNumberin interfaceBuildsManager- Parameters:
buildTypeId- build configuration internal idbuildNumber- build number- Returns:
- see above
-
processBuilds
public void processBuilds(@NotNull BuildQueryOptions options, @NotNull ItemProcessor<SBuild> processor)Description copied from interface:BuildsManagerReturns the builds matched by theoptionsspecified.- Specified by:
processBuildsin interfaceBuildsManager- Parameters:
options- query optionsprocessor- builds processor
-
findRunningBuildById
@Nullable public SRunningBuild findRunningBuildById(long buildId)
Description copied from interface:RunningBuildsManagerSearches for a running build by specified build id.- Specified by:
findRunningBuildByIdin interfaceRunningBuildsManager- Parameters:
buildId- id of the build- Returns:
- running build with specified build id or null if there are no running build with such build id.
-
getRunningBuildOnAgent
@Nullable public SRunningBuild getRunningBuildOnAgent(SBuildAgent agent)
Description copied from interface:RunningBuildsManagerReturns running build running on the specified agent or null if there are no build on the agent.- Specified by:
getRunningBuildOnAgentin interfaceRunningBuildsManager- Parameters:
agent- agent to search build- Returns:
- running build or null
-
getRunningBuilds
@NotNull public List<SRunningBuild> getRunningBuilds(@Nullable User user, @Nullable BuildDataFilter filter)
Description copied from interface:RunningBuildsManagerReturns all running builds including personal builds according to settings of the specified user. If user is not null then all non-personal builds and personal builds of this user will be returned. If user settings are configured to show all personal builds, then personal builds of other users will be returned as well. If user is null, then all personal and non-personal builds are returned. If filter is not null it will be applied to the result. List of running builds is sorted by build id in reverse order (most recent build first).- Specified by:
getRunningBuildsin interfaceRunningBuildsManager- Parameters:
user- owner of personal builds, can be nullfilter- filter to apply for builds, can be null- Returns:
- unmodifiable list of running builds
-
getRunningBuilds
@NotNull public List<SRunningBuild> getRunningBuilds(@Nullable User user, @NotNull SBuildType buildType)
Description copied from interface:RunningBuildsManagerReturns all running builds including personal builds which belong to the specified build configuration. If user is not null then all non-personal builds and personal builds of this user will be returned. If user settings are configured to show all personal builds, then personal builds of other users will be returned as well. If user is null, then all personal and non-personal builds are returned. List of running builds is sorted by build id in reverse order (most recent build first).- Specified by:
getRunningBuildsin interfaceRunningBuildsManager- Parameters:
user- owner of personal builds or nullbuildType- build configuration- Returns:
- see above
-
getRunningBuilds
@NotNull public List<SRunningBuild> getRunningBuilds()
Description copied from interface:RunningBuildsManagerSame as getRunningBuilds(null, null) List of running builds is sorted by build id in reverse order (most recent build first).- Specified by:
getRunningBuildsin interfaceRunningBuildsManager- Returns:
- see above
-
getNumberOfRunningBuilds
public int getNumberOfRunningBuilds()
Description copied from interface:RunningBuildsManagerReturns total number of currently running builds.- Specified by:
getNumberOfRunningBuildsin interfaceRunningBuildsManager- Returns:
- number of currently running builds.
-
getRunningStatus
public Map<SBuildType,List<SRunningBuild>> getRunningStatus(@Nullable User user, @Nullable BuildDataFilter filter)
Description copied from interface:RunningBuildsManagerReturns map of running builds per build configuration. Method returns all personal builds if user is null, otherwise only personal builds of this user are returned. If filter is not null it will be applied to the result. The resulting map will contain only those build configurations for which list or running builds is not empty. List of running builds is sorted by build id in reverse order (most recent build first).- Specified by:
getRunningStatusin interfaceRunningBuildsManager- Parameters:
user- owner of personal builds, can be nullfilter- filter to apply for builds, can be null- Returns:
- unmodifiable map of running builds per build type
-
-