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 String
PROCESS_ITEMS_USE_LATEST_BUILDS
-
Constructor Summary
Constructors Constructor Description BuildsManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SBuild
findBuildInstanceByBuildNumber(String buildTypeId, String buildNumber)
Returns the most recent build (ordered by changes) with the specified build numberSBuild
findBuildInstanceById(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.SBuild
findNextBuild(SBuild build, BuildDataFilter filter)
Returns the next non personal build (finished or running) started after the specified build.SBuild
findPreviousBuild(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.SBuild
findPreviousBuild(SBuild buildData, BuildDataFilter filter)
Same asBuildsManager.findPreviousBuild(jetbrains.buildServer.serverSide.SBuild)
but searches for a previous build among builds accepted by the specified filter.SRunningBuild
findRunningBuildById(long buildId)
Searches for a running build by specified build id.int
getNumberOfRunningBuilds()
Returns total number of currently running builds.SRunningBuild
getRunningBuildOnAgent(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.void
processBuilds(BuildQueryOptions options, ItemProcessor<SBuild> processor)
Returns the builds matched by theoptions
specified.void
setHistory(BuildHistoryEx history)
void
setProjectManager(ProjectManagerEx projectManager)
void
setRunningBuildsManager(RunningBuildsManagerImpl runningBuilds)
void
setSecurityContext(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:
findBuildInstanceById
in 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:BuildsManager
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. The resulting build belongs to the same build configuration.- Specified by:
findPreviousBuild
in 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:BuildsManager
Same 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:
findPreviousBuild
in 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:BuildsManager
Returns the next non personal build (finished or running) started after the specified build.- Specified by:
findNextBuild
in 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:BuildsManager
Returns 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:
findBuildInstances
in 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:BuildsManager
Returns the most recent build (ordered by changes) with the specified build number- Specified by:
findBuildInstanceByBuildNumber
in 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:BuildsManager
Returns 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:
findBuildInstancesByBuildNumber
in 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:BuildsManager
Returns the builds matched by theoptions
specified.- Specified by:
processBuilds
in interfaceBuildsManager
- Parameters:
options
- query optionsprocessor
- builds processor
-
findRunningBuildById
@Nullable public SRunningBuild findRunningBuildById(long buildId)
Description copied from interface:RunningBuildsManager
Searches for a running build by specified build id.- Specified by:
findRunningBuildById
in 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:RunningBuildsManager
Returns running build running on the specified agent or null if there are no build on the agent.- Specified by:
getRunningBuildOnAgent
in 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:RunningBuildsManager
Returns 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:
getRunningBuilds
in 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:RunningBuildsManager
Returns 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:
getRunningBuilds
in interfaceRunningBuildsManager
- Parameters:
user
- owner of personal builds or nullbuildType
- build configuration- Returns:
- see above
-
getRunningBuilds
@NotNull public List<SRunningBuild> getRunningBuilds()
Description copied from interface:RunningBuildsManager
Same as getRunningBuilds(null, null) List of running builds is sorted by build id in reverse order (most recent build first).- Specified by:
getRunningBuilds
in interfaceRunningBuildsManager
- Returns:
- see above
-
getNumberOfRunningBuilds
public int getNumberOfRunningBuilds()
Description copied from interface:RunningBuildsManager
Returns total number of currently running builds.- Specified by:
getNumberOfRunningBuilds
in interfaceRunningBuildsManager
- Returns:
- number of currently running builds.
-
getRunningStatus
public Map<SBuildType,List<SRunningBuild>> getRunningStatus(@Nullable User user, @Nullable BuildDataFilter filter)
Description copied from interface:RunningBuildsManager
Returns 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:
getRunningStatus
in 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
-
-