Class FinishedBuildImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.BaseBuild
-
- jetbrains.buildServer.serverSide.impl.FinishedBuildImpl
-
- All Implemented Interfaces:
Build,BuildEx,BuildPromotionOwner,FinishedBuildEx,ParametersSupport,SBuild,SFinishedBuild
- Direct Known Subclasses:
SecuredFinishedBuildImpl
public class FinishedBuildImpl extends BaseBuild implements FinishedBuildEx
- Author:
- Eugene Zhuravlev Date: Feb 4, 2006
-
-
Field Summary
-
Fields inherited from class jetbrains.buildServer.serverSide.impl.BaseBuild
myBuildId, myContext, myStatsCallCounter, REMOTE_ARTIFACTS_PREFIX
-
-
Constructor Summary
Constructors Constructor Description FinishedBuildImpl(long buildId, long buildPromotionId, String buildTypeId, String agentName, int agentTypeId, Date buildStartTimeServer, Date buildStartTimeAgent, Date buildFinishTimeServer, Status buildStatus, String finalStatusText, String buildNumber, boolean pinned, boolean personal, CanceledInfo canceledInfo, String rawTriggeredBy, String buildDescription, BuildPromotionEx buildPromotion, BuildContext context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeforeDelete(boolean sendEvent)This method should be called before build is going to be deleted.voidbuildEvictedFromCache()This method is called when the build is about to be removed from the cachebooleanequals(Object o)BuildAgentExgetAgent()StringgetAgentName()Returns agent name where build is running or happened to run if finished.longgetBuildCounter()StringgetBuildDescription()Returns build description set to this build explicitly or null.BuildLogExgetBuildLog()Returns build log.BuildLogExgetBuildLogIfInitialized()StringgetBuildNumber()Returns build number in the user defined format (unresolved parameters in build number will be replaced with '???').BuildPromotionExgetBuildPromotion()Returns build promotionBuildStatisticsgetBuildStatistics(BuildStatisticsOptions options)Same asSBuild.getFullStatistics()but with more control of data being loaded.StatusgetBuildStatus()Returns current build statusBuildTypeExgetBuildType()Returns build configuration this build belongs to.StringgetBuildTypeExternalId()Returns the build type external ID.StringgetBuildTypeId()Returns build configuration internal idShortStatisticsgetCachedShortStatistics(boolean calculateIfAbsent)Return cached short statistics for this build.CanceledInfogetCanceledInfo()Returns info related to interrupted build.SortedMap<BuildTypeEx,BuildPromotionEx>getDeploymentStatus()DategetFinishDate()Returns finish timestamp for the build.DategetFinishOnAgentDate()Returns timestamp when the build finished on agent (server time) ornullif it is still running on agent.CommentgetPinComment()Returns the pin/unpin commentStringgetProjectExternalId()Returns external id of the project this build belongs to.StringgetProjectId()Returns internal id of the project this build belongs to.StringgetRawBuildNumber()Returns raw build number (i.e.StatusDescriptorgetStatusDescriptor()Returns status descriptor of the buildinthashCode()booleanisAgentLessBuild()booleanisCompositeBuild()Returns true if this build is a composite build.booleanisDetachedFromAgent()Returns true if this build was detached from agent at some point.booleanisFinished()booleanisPersonal()Returns if this build has been run to test personal changesbooleanisPinned()Returns true if this build is pinnedvoidnotifyOnBuildProblemsChanged(List<BuildProblemData> before, List<BuildProblemData> after)voidresetFullStatisticsCache()voidresetShortStatisticsCache()voidsetLabel(String labelValue, String message, List<VcsRootInstance> rootsToLabel)Sets a label on files in VCS repository used by this build in the specified VCS rootsvoidsetLabel(String labelValue, List<VcsRootInstance> rootsToLabel)Sets a label on files in VCS repository used by this build in the specified VCS rootsvoidsetPinned(boolean pinned)Sets pin status for this build.voidsetPinned(boolean pinned, User user, String comment)Sets pin status for this build.voidsetStatusText(String newText)StringtoString()voidupdatePinInfo()Reload pin status from the databasevoidupdateStatusText()Recalculate status line text-
Methods inherited from class jetbrains.buildServer.serverSide.impl.BaseBuild
addBuildProblem, addUserBuildProblem, buildProblemsChanged, convertToAgentTime, convertToServerTime, createShortStatistics, deleteBuildProblem, doGetBuildFinishParameters, doGetBuildStartParameters, getArtifactDependencies, getArtifacts, getArtifactsDirectory, getAuditLogFactory, getAuditLogProvider, getBranch, getBuildComment, getBuildContext, getBuildFeaturesOfType, getBuildFinishParameters, getBuildId, getBuildNumberParameters, getBuildNumberWithoutRefs, getBuildOwnParameters, getBuildProblems, getBuildStartParameters, getBuildTypeName, getChanges, getClientStartDate, getClientTimeZone, getCommitters, getCompilationErrorMessages, getContainingChanges, getCustomDataStorage, getCustomDataStorageIdsByPrefix, getDetachFromAgentReceivedTimestamp, getDownloadedArtifacts, getDuration, getDurationOnAgent, getFailureReasons, getFileContent, getFirstInternalError, getFirstInternalErrorMessage, getFullName, getFullStatistics, getId, getLabels, getLogMessages, getOwner, getParametersProvider, getPreviousFinished, getProvidedArtifacts, getQueuedDate, getRecentlyFinishedBuild, getRelatedIssues, getRemoteArtifacts, getRemoteArtifactsByType, getRevisions, getSequenceBuild, getServerStartDate, getSettingsDigestFile, getSettingsDigestFromFile, getShortStatistics, getStartDate, getStatisticValue, getStatisticValues, getStatus, getTags, getTemporaryCustomDataStorage, getTestMessages, getTriggeredBy, getValueResolver, getValueResolver, getValueResolver, getVariablesProvider, getVcsRootEntries, getWaitReasons, hasBuildFinishParameters, hasBuildProblemOfType, hasTests, initMetrics, isArtifactsExists, isHasInternalArtifactsOnly, isHasRelatedIssues, isInternalError, isOutdated, isOutOfChangesSequence, isPersonalPatchAvailable, isResponsibleNeeded, isStartedOnAgent, isTimedOut, isUsedByOtherBuilds, muteBuildProblems, muteBuildProblems, now, nowDate, preloadFailedTests, publishStatisticValue, resetBuildFinalParameters, setBuildComment, setBuildStartTimes, setTags, setTags, updateExternalArtifactsInfoOnAccess
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jetbrains.buildServer.Build
getBuildId, getBuildTypeName, getCompilationErrorMessages, getDuration, getFullName, getLogMessages, getStartDate, getTestMessages
-
Methods inherited from interface jetbrains.buildServer.serverSide.BuildPromotionOwner
getSequenceBuild
-
Methods inherited from interface jetbrains.buildServer.serverSide.impl.FinishedBuildEx
getBuildFinishParameters, getBuildStartParameters
-
Methods inherited from interface jetbrains.buildServer.serverSide.ParametersSupport
getParametersProvider
-
Methods inherited from interface jetbrains.buildServer.serverSide.SBuild
addBuildProblem, addUserBuildProblem, convertToAgentTime, convertToServerTime, getArtifactDependencies, getArtifacts, getArtifactsDirectory, getBranch, getBuildComment, getBuildFeaturesOfType, getBuildOwnParameters, getChanges, getClientStartDate, getClientTimeZone, getCommitters, getContainingChanges, getCustomDataStorage, getDownloadedArtifacts, getFailureReasons, getFileContent, getFirstInternalError, getFirstInternalErrorMessage, getFullStatistics, getLabels, getOwner, getPreviousFinished, getProvidedArtifacts, getQueuedDate, getRecentlyFinishedBuild, getRelatedIssues, getRemoteArtifacts, getRemoteArtifactsByType, getRevisions, getServerStartDate, getShortStatistics, getStatisticValue, getStatisticValues, getTags, getTriggeredBy, getValueResolver, getVcsRootEntries, getWaitReasons, hasBuildProblemOfType, hasTests, isArtifactsExists, isHasInternalArtifactsOnly, isHasRelatedIssues, isInternalError, isOutdated, isOutOfChangesSequence, isResponsibleNeeded, isStartedOnAgent, isUsedByOtherBuilds, muteBuildProblems, setBuildComment, setTags, setTags
-
-
-
-
Constructor Detail
-
FinishedBuildImpl
public FinishedBuildImpl(long buildId, long buildPromotionId, @NotNull String buildTypeId, String agentName, int agentTypeId, @NotNull Date buildStartTimeServer, Date buildStartTimeAgent, @NotNull Date buildFinishTimeServer, @NotNull Status buildStatus, String finalStatusText, String buildNumber, boolean pinned, boolean personal, CanceledInfo canceledInfo, String rawTriggeredBy, String buildDescription, @NotNull BuildPromotionEx buildPromotion, @NotNull BuildContext context)
-
-
Method Detail
-
getBuildTypeId
@NotNull public String getBuildTypeId()
Description copied from interface:BuildReturns build configuration internal id- Specified by:
getBuildTypeIdin interfaceBuild- Overrides:
getBuildTypeIdin classBaseBuild- Returns:
- ID of the configuration this build belongs to.
-
getBuildTypeExternalId
@NotNull public String getBuildTypeExternalId()
Description copied from interface:BuildReturns the build type external ID.If the external identifier does not exist (this might happen for a running build if the build type was deleted, and a new build type with same external id was created), a
BuildPromotion#NOT_EXISTING_BUILD_TYPE_IDvalue is returned.- Specified by:
getBuildTypeExternalIdin interfaceBuild- Overrides:
getBuildTypeExternalIdin classBaseBuild- Returns:
- build type external ID
-
getBuildType
@Nullable public BuildTypeEx getBuildType()
Description copied from interface:SBuildReturns build configuration this build belongs to.- Specified by:
getBuildTypein interfaceBuild- Specified by:
getBuildTypein interfaceSBuild- Overrides:
getBuildTypein classBaseBuild- Returns:
- build configuration descriptor.
-
isAgentLessBuild
public boolean isAgentLessBuild()
- Specified by:
isAgentLessBuildin interfaceSBuild- Overrides:
isAgentLessBuildin classBaseBuild- Returns:
- true if this build does not require an agent (for now this is true for composite builds only)
-
isDetachedFromAgent
public boolean isDetachedFromAgent()
Description copied from interface:SBuildReturns true if this build was detached from agent at some point.- Specified by:
isDetachedFromAgentin interfaceSBuild- Overrides:
isDetachedFromAgentin classBaseBuild- Returns:
- see above
-
isCompositeBuild
public boolean isCompositeBuild()
Description copied from interface:SBuildReturns true if this build is a composite build.- Specified by:
isCompositeBuildin interfaceSBuild- Returns:
- see above
-
getBuildNumber
@NotNull public String getBuildNumber()
Description copied from interface:BuildReturns build number in the user defined format (unresolved parameters in build number will be replaced with '???').- Specified by:
getBuildNumberin interfaceBuild- Returns:
- presentable build number
-
isPinned
public boolean isPinned()
Description copied from interface:SBuildReturns true if this build is pinned
-
setPinned
public void setPinned(boolean pinned, @Nullable User user, @Nullable String comment)Description copied from interface:SFinishedBuildSets pin status for this build. Pinned builds will not be cleaned by the server cleanup process.- Specified by:
setPinnedin interfaceSFinishedBuild- Parameters:
pinned- whether to pin build or not.user- user who pins/unpins buildcomment- comment
-
setPinned
public void setPinned(boolean pinned)
Description copied from interface:SFinishedBuildSets pin status for this build. Pinned builds will not be cleaned by the server cleanup process.- Specified by:
setPinnedin interfaceSFinishedBuild- Parameters:
pinned- whether to pin build or not.
-
updatePinInfo
public void updatePinInfo()
Description copied from interface:FinishedBuildExReload pin status from the database- Specified by:
updatePinInfoin interfaceFinishedBuildEx
-
getPinComment
@Nullable public Comment getPinComment()
Description copied from interface:SFinishedBuildReturns the pin/unpin comment- Specified by:
getPinCommentin interfaceSFinishedBuild- Returns:
- the pin/unpin comment or null if the build has never been pinned/unpinned
-
getFinishDate
@NotNull public Date getFinishDate()
Description copied from interface:SFinishedBuildReturns finish timestamp for the build.- Specified by:
getFinishDatein interfaceBuild- Specified by:
getFinishDatein interfaceSFinishedBuild- Returns:
- Date/time when the build has been finished.
-
getFinishOnAgentDate
@NotNull public Date getFinishOnAgentDate()
Description copied from interface:SBuildReturns timestamp when the build finished on agent (server time) ornullif it is still running on agent.- Specified by:
getFinishOnAgentDatein interfaceSBuild- Specified by:
getFinishOnAgentDatein interfaceSFinishedBuild- Overrides:
getFinishOnAgentDatein classBaseBuild- Returns:
- see above
-
getAgentName
public String getAgentName()
Description copied from interface:BuildReturns agent name where build is running or happened to run if finished.- Specified by:
getAgentNamein interfaceBuild- Returns:
- Agent name where build has been started on
-
getStatusDescriptor
public StatusDescriptor getStatusDescriptor()
Description copied from interface:BuildReturns status descriptor of the build- Specified by:
getStatusDescriptorin interfaceBuild- Returns:
- Descriptor of the current status of the build
-
getBuildDescription
@Nullable public String getBuildDescription()
Description copied from interface:SBuildReturns build description set to this build explicitly or null.- Specified by:
getBuildDescriptionin interfaceSBuild- Returns:
- see above
-
resetFullStatisticsCache
public void resetFullStatisticsCache()
- Specified by:
resetFullStatisticsCachein interfaceFinishedBuildEx
-
resetShortStatisticsCache
public void resetShortStatisticsCache()
- Specified by:
resetShortStatisticsCachein interfaceFinishedBuildEx
-
getProjectId
@Nullable public String getProjectId()
Description copied from interface:BuildReturns internal id of the project this build belongs to. Same as getBuildType().getProjectId().- Specified by:
getProjectIdin interfaceBuild- Returns:
- internal id of the project this build belongs to. Same as getBuildType().getProjectId().
-
getProjectExternalId
@Nullable public String getProjectExternalId()
Description copied from interface:BuildReturns external id of the project this build belongs to. Same as getBuildType().getProjectId().- Specified by:
getProjectExternalIdin interfaceBuild- Returns:
- external id of the project this build belongs to. Same as getBuildType().getProjectId().
-
isFinished
public boolean isFinished()
- Specified by:
isFinishedin interfaceBuild- Returns:
- true if the build was finished and was saved to the history
-
setLabel
public void setLabel(String labelValue, List<VcsRootInstance> rootsToLabel) throws VcsException
Description copied from interface:SFinishedBuildSets a label on files in VCS repository used by this build in the specified VCS roots- Specified by:
setLabelin interfaceSFinishedBuild- Parameters:
labelValue- VCS label to set (references to properties are not supported)rootsToLabel- VCS roots to label- Throws:
VcsException- if labeling failed
-
setLabel
public void setLabel(String labelValue, @Nullable String message, List<VcsRootInstance> rootsToLabel) throws VcsException
Description copied from interface:SFinishedBuildSets a label on files in VCS repository used by this build in the specified VCS roots- Specified by:
setLabelin interfaceSFinishedBuild- Parameters:
labelValue- label to setrootsToLabel- VCS roots to label- Throws:
VcsException
-
getBuildLog
@NotNull public BuildLogEx getBuildLog()
Description copied from interface:SBuildReturns build log.- Specified by:
getBuildLogin interfaceBuildEx- Specified by:
getBuildLogin interfaceFinishedBuildEx- Specified by:
getBuildLogin interfaceSBuild- Returns:
- build log.
-
getBuildLogIfInitialized
@Nullable public BuildLogEx getBuildLogIfInitialized()
- Specified by:
getBuildLogIfInitializedin interfaceFinishedBuildEx
-
getCachedShortStatistics
@Nullable public ShortStatistics getCachedShortStatistics(boolean calculateIfAbsent)
Description copied from interface:BuildExReturn cached short statistics for this build.- Specified by:
getCachedShortStatisticsin interfaceBuildEx- Parameters:
calculateIfAbsent- if true, then statistics is calculated if it is not cached yet, if false and there is no statistics in cache, then null is returned- Returns:
- see above
-
getBuildStatistics
@NotNull public BuildStatistics getBuildStatistics(@NotNull BuildStatisticsOptions options)
Description copied from interface:SBuildSame asSBuild.getFullStatistics()but with more control of data being loaded.- Specified by:
getBuildStatisticsin interfaceSBuild- Overrides:
getBuildStatisticsin classBaseBuild- Parameters:
options- options- Returns:
- build statistics according to specified options
-
getRawBuildNumber
public String getRawBuildNumber()
Description copied from interface:SBuildReturns raw build number (i.e. build number with unresolved parameters if they exist) in contradistinction toBuild.getBuildNumber()method which will return build number with all unresolved parameters replaced with ???.- Specified by:
getRawBuildNumberin interfaceSBuild- Specified by:
getRawBuildNumberin classBaseBuild- Returns:
- raw build number which can contain unresolved parameters
-
getBuildCounter
public long getBuildCounter()
- Specified by:
getBuildCounterin classBaseBuild
-
getBuildPromotion
@NotNull public BuildPromotionEx getBuildPromotion()
Description copied from interface:BuildPromotionOwnerReturns build promotion- Specified by:
getBuildPromotionin interfaceBuildEx- Specified by:
getBuildPromotionin interfaceBuildPromotionOwner- Specified by:
getBuildPromotionin interfaceFinishedBuildEx- Specified by:
getBuildPromotionin classBaseBuild- Returns:
- see above.
-
beforeDelete
public void beforeDelete(boolean sendEvent)
Description copied from interface:FinishedBuildExThis method should be called before build is going to be deleted. This method will send corresponding event, and will remember state (build promotion) inside the build to make sure this instance of the build can still be used even after data is deleted from database.- Specified by:
beforeDeletein interfaceFinishedBuildEx
-
buildEvictedFromCache
public void buildEvictedFromCache()
Description copied from interface:FinishedBuildExThis method is called when the build is about to be removed from the cache- Specified by:
buildEvictedFromCachein interfaceFinishedBuildEx
-
getCanceledInfo
public CanceledInfo getCanceledInfo()
Description copied from interface:BuildReturns info related to interrupted build. If build is finished, not interrupted, the value is null.- Specified by:
getCanceledInfoin interfaceBuild- Returns:
- info about canceled reason and canceler if build was actually interrupted, null otherwise.
-
isPersonal
public boolean isPersonal()
Description copied from interface:BuildReturns if this build has been run to test personal changes- Specified by:
isPersonalin interfaceBuild- Overrides:
isPersonalin classBaseBuild- Returns:
- true is the build has been started as personal, and its changes were not committed to the VCS
-
setStatusText
public void setStatusText(@NotNull String newText)- Specified by:
setStatusTextin interfaceFinishedBuildEx
-
updateStatusText
public void updateStatusText()
Description copied from interface:FinishedBuildExRecalculate status line text- Specified by:
updateStatusTextin interfaceFinishedBuildEx
-
getDeploymentStatus
@NotNull public SortedMap<BuildTypeEx,BuildPromotionEx> getDeploymentStatus()
- Specified by:
getDeploymentStatusin interfaceFinishedBuildEx- Returns:
- map of environment build configurations depending directly on configuration of this build by snapshot or artifact dependencies to the latest triggered build promotion which is using this build. If there is no triggered build yet, then corresponding value in map entry is null.
-
getAgent
@NotNull public BuildAgentEx getAgent()
-
getBuildStatus
public Status getBuildStatus()
Description copied from interface:BuildReturns current build status- Specified by:
getBuildStatusin interfaceBuild- Overrides:
getBuildStatusin classBaseBuild- Returns:
- Current build status
-
notifyOnBuildProblemsChanged
public void notifyOnBuildProblemsChanged(@NotNull List<BuildProblemData> before, @NotNull List<BuildProblemData> after)- Specified by:
notifyOnBuildProblemsChangedin classBaseBuild
-
-