Class PersonalBuildManagerImpl
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.personal.PersonalBuildManagerImpl
-
- All Implemented Interfaces:
PersonalBuildManagerEx
,PersonalBuildManager
public class PersonalBuildManagerImpl extends Object implements PersonalBuildManagerEx
-
-
Constructor Summary
Constructors Constructor Description PersonalBuildManagerImpl(ServerPaths serverPaths, SecurityContextEx securityContext, NumericIdSequences idSequences)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description List<SQueuedBuild>
addRemoteRunsToQueue(Map<BuildType,SAgentRestrictor> buildTypeAgentRestrictorMap, long changeListId, String comment)
Creates personal builds for the specified build configurations and adds them into the queue on the corresponding agents.SQueuedBuild
addRemoteRunToQueue(BuildType buildType, long changeListId, String comment)
Schedules configuration to run specified personal changes.SQueuedBuild
addRemoteRunToQueue(BuildType buildType, BuildAgent agent, long changeListId, String comment)
Schedules configuration to run specified personal changes on specified agent.byte[]
applyAndGetContent(byte[] originData, VcsModification modification, VcsChangeInfo change)
Returns applied patch from specified file on specified original data.void
buildEmptyPatch(OutputStream agentOutput, SRunningBuild runningBuild)
void
buildPatch(OutputStream agentOutput, SRunningBuild runningBuild, SBuildType buildType, PatchMapLogger patchLogger)
void
buildPersonalPatch(OutputStream patchOutput, SRunningBuild runningBuild, long personalChangeId, PatchMapLogger patchLogger)
void
deleteIfScheduledForDeletion(SBuild build)
Deletes personal build if it was marked for deletion.List<BuildPromotion>
findBuildPromotionsByChangesId(long changeId)
Finds personal build promotions by change id.List<BuildPromotion>
findBuildPromotionsByUserId(long userId)
Finds personal build promotions by user id.byte[]
getContent(VcsModification modification, VcsChangeInfo change)
Returns sent content of the specified file.byte[]
getCurrentRepositoryContentForPersonallyChangedFile(VcsModification modification, String fileName, SBuildType buildType)
Returns last vcs repository content of the file specified.SVcsModification
getModification(long changesId)
ReturnsSVcsModification
object for the personal modification with the given id.SVcsModification
getModification(long changesId, boolean resolveCommitDecision)
List<SVcsModification>
getModifications(long userId)
Returns collection ofSVcsModification
modifications ran by the given user.PersonalChangeInfo
getPersonalChangeInfo(long changeId)
returns information about personal change by the change id (the same as modification id)String
getPersonalChangeRelativeFilePath(String original, long startedBuildId)
Returns relative personal change path mapped when personal patch was built to send it to an agent.Collection<String>
getPersonalModificationBuildTypeIds(VcsModification mod)
boolean
isApplicable(long personalChangeId, List<VcsRootInstanceEntry> vcsRootEntries)
Returns true if personal change files can be applied to VCS roots of the specified build configuration.boolean
isApplicable(SBuildType buildType, Collection<String> personalChangeFilePaths, boolean searchThroughDependencies)
Returns true if personal change files can be applied to VCS roots of the specified build configuration.boolean
isApplicable(VcsRootInstanceEntry vcsRootEntry, Collection<String> personalChangeFilePaths)
Deprecated.since 10.0boolean
isEmptyPersonalPatch(long changeId)
boolean
isProcessingChangeFile(File file)
boolean
isRelated(VcsRootInstanceEntry vcsRootEntry, Collection<String> personalChangeFilePaths)
Deprecated.since 10.0void
performAction(long changeListId, Runnable action)
long
publishChangeList(PersonalChangeInfo changeInfo, InputStream input)
Deprecated.long
publishChangeList(PersonalChangeInfo changeInfo, InputStream input, PersonalChangeFormatType type)
Publishes personal changes.long
publishEmptyChangeList(User user)
void
removeChangeIfEmpty(long changeId)
void
schedulePersonalChangeForDeletion(long changeId, User user)
Schedules personal change for deletion.void
setAgentRestrictorFactory(AgentRestrictorFactory agentRestrictorFactory)
void
setDescription(long personalChangeId, String newDescription)
Change description of the personal modificationvoid
setHistory(BuildHistoryEx history)
void
setPersonalBuildCleaner(PersonalBuildCleaner personalBuildCleaner)
void
setPersonalChangeStatus(long changeId, Status status)
Changes personal change commit status (if the change was committed successfully).void
setQueue(BuildQueueEx queue)
void
setRemoteBuildDataFacade(RemoteBuildDataFacade remoteBuildDataFacade)
void
setUserModel(UserModelEx userModel)
void
setVcsManager(VcsManagerEx vcsManager)
void
setVcsModificationContext(VcsModificationContext vcsModificationContext)
void
setVersionedSettingsManager(VersionedSettingsManager versionedSettingsManager)
void
storePersonalChangeRelativePath(String path, String relativePath, long buildId)
-
-
-
Constructor Detail
-
PersonalBuildManagerImpl
public PersonalBuildManagerImpl(@NotNull ServerPaths serverPaths, @NotNull SecurityContextEx securityContext, @NotNull NumericIdSequences idSequences)
-
-
Method Detail
-
setHistory
public void setHistory(BuildHistoryEx history)
-
setVcsManager
public void setVcsManager(VcsManagerEx vcsManager)
-
setQueue
public void setQueue(BuildQueueEx queue)
-
setPersonalBuildCleaner
public void setPersonalBuildCleaner(PersonalBuildCleaner personalBuildCleaner)
-
setVcsModificationContext
public void setVcsModificationContext(VcsModificationContext vcsModificationContext)
-
setUserModel
public void setUserModel(UserModelEx userModel)
-
setRemoteBuildDataFacade
public void setRemoteBuildDataFacade(@NotNull RemoteBuildDataFacade remoteBuildDataFacade)
-
setAgentRestrictorFactory
public void setAgentRestrictorFactory(AgentRestrictorFactory agentRestrictorFactory)
-
setVersionedSettingsManager
public void setVersionedSettingsManager(VersionedSettingsManager versionedSettingsManager)
-
deleteIfScheduledForDeletion
public void deleteIfScheduledForDeletion(@NotNull SBuild build)
Description copied from interface:PersonalBuildManagerEx
Deletes personal build if it was marked for deletion.- Specified by:
deleteIfScheduledForDeletion
in interfacePersonalBuildManagerEx
- Parameters:
build
- build to delete
-
getPersonalModificationBuildTypeIds
@NotNull public Collection<String> getPersonalModificationBuildTypeIds(@NotNull VcsModification mod)
- Specified by:
getPersonalModificationBuildTypeIds
in interfacePersonalBuildManagerEx
-
getModifications
@NotNull public List<SVcsModification> getModifications(long userId)
Description copied from interface:PersonalBuildManager
Returns collection ofSVcsModification
modifications ran by the given user.- Specified by:
getModifications
in interfacePersonalBuildManager
- Parameters:
userId
- specified user.- Returns:
- all personal changes run by the user, resent first
-
getModification
@Nullable public SVcsModification getModification(long changesId)
Description copied from interface:PersonalBuildManager
ReturnsSVcsModification
object for the personal modification with the given id.- Specified by:
getModification
in interfacePersonalBuildManager
- Parameters:
changesId
- personal change id.- Returns:
- modification object for the personal change.
-
getModification
@Nullable public SVcsModification getModification(long changesId, boolean resolveCommitDecision)
- Specified by:
getModification
in interfacePersonalBuildManagerEx
-
isEmptyPersonalPatch
public boolean isEmptyPersonalPatch(long changeId)
- Specified by:
isEmptyPersonalPatch
in interfacePersonalBuildManagerEx
-
removeChangeIfEmpty
public void removeChangeIfEmpty(long changeId)
- Specified by:
removeChangeIfEmpty
in interfacePersonalBuildManagerEx
-
buildPatch
public void buildPatch(OutputStream agentOutput, SRunningBuild runningBuild, SBuildType buildType, PatchMapLogger patchLogger) throws IOException
- Specified by:
buildPatch
in interfacePersonalBuildManagerEx
- Throws:
IOException
-
buildEmptyPatch
public void buildEmptyPatch(@NotNull OutputStream agentOutput, @NotNull SRunningBuild runningBuild) throws IOException
- Specified by:
buildEmptyPatch
in interfacePersonalBuildManagerEx
- Throws:
IOException
-
buildPersonalPatch
public void buildPersonalPatch(OutputStream patchOutput, SRunningBuild runningBuild, long personalChangeId, PatchMapLogger patchLogger) throws IOException
- Specified by:
buildPersonalPatch
in interfacePersonalBuildManagerEx
- Throws:
IOException
-
publishChangeList
@Deprecated public long publishChangeList(@NotNull PersonalChangeInfo changeInfo, @NotNull InputStream input) throws IOException
Deprecated.Description copied from interface:PersonalBuildManager
Publishes personal changes.- Specified by:
publishChangeList
in interfacePersonalBuildManager
- Parameters:
changeInfo
- personal changes information object.input
- input stream containing personal changes.- Returns:
- newly created personal change id.
- Throws:
IOException
- exception if the publishing process fails.
-
publishChangeList
public long publishChangeList(@NotNull PersonalChangeInfo changeInfo, @NotNull InputStream input, @NotNull PersonalChangeFormatType type) throws IOException
Description copied from interface:PersonalBuildManager
Publishes personal changes.- Specified by:
publishChangeList
in interfacePersonalBuildManager
- Parameters:
changeInfo
- personal changes information object.input
- input stream containing personal changes.type
- type of patch format (binary of unified diff).- Returns:
- newly created personal change id.
- Throws:
IOException
- exception if the publishing process fails.
-
isProcessingChangeFile
public boolean isProcessingChangeFile(@NotNull File file)
- Specified by:
isProcessingChangeFile
in interfacePersonalBuildManagerEx
- Parameters:
file
- change file to check- Returns:
- whether change file is created by manager, yet not registered in database
-
publishEmptyChangeList
public long publishEmptyChangeList(@NotNull User user)
- Specified by:
publishEmptyChangeList
in interfacePersonalBuildManagerEx
-
addRemoteRunToQueue
@Nullable public SQueuedBuild addRemoteRunToQueue(@NotNull BuildType buildType, long changeListId, String comment)
Description copied from interface:PersonalBuildManager
Schedules configuration to run specified personal changes.- Specified by:
addRemoteRunToQueue
in interfacePersonalBuildManager
- Parameters:
buildType
- specified build configuration.changeListId
- specified personal change id.comment
- user comment.- Returns:
- temporary created configuration id.
-
addRemoteRunToQueue
@Nullable public SQueuedBuild addRemoteRunToQueue(@NotNull BuildType buildType, @NotNull BuildAgent agent, long changeListId, String comment)
Description copied from interface:PersonalBuildManager
Schedules configuration to run specified personal changes on specified agent.- Specified by:
addRemoteRunToQueue
in interfacePersonalBuildManager
- Parameters:
buildType
- specified build configuration.agent
- specified agent.changeListId
- specified personal change id.comment
- user comment.- Returns:
- temporary created configuration id.
-
addRemoteRunsToQueue
@NotNull public List<SQueuedBuild> addRemoteRunsToQueue(@NotNull Map<BuildType,SAgentRestrictor> buildTypeAgentRestrictorMap, long changeListId, String comment)
Description copied from interface:PersonalBuildManagerEx
Creates personal builds for the specified build configurations and adds them into the queue on the corresponding agents. Note that if in the chains there are several personal builds to be created for the same build configuration these builds will be merged to one build.- Specified by:
addRemoteRunsToQueue
in interfacePersonalBuildManagerEx
changeListId
- personal change idcomment
- comment- Returns:
- list of personal builds added to the queue
-
performAction
public void performAction(long changeListId, @NotNull Runnable action)
- Specified by:
performAction
in interfacePersonalBuildManagerEx
-
findBuildPromotionsByChangesId
@NotNull public List<BuildPromotion> findBuildPromotionsByChangesId(long changeId)
Description copied from interface:PersonalBuildManager
Finds personal build promotions by change id.- Specified by:
findBuildPromotionsByChangesId
in interfacePersonalBuildManager
- Parameters:
changeId
- specified change id.- Returns:
- list of all personal build promotions, starting from oldest, ordering added since 2018.2.3
-
findBuildPromotionsByUserId
@NotNull public List<BuildPromotion> findBuildPromotionsByUserId(long userId)
Description copied from interface:PersonalBuildManager
Finds personal build promotions by user id.- Specified by:
findBuildPromotionsByUserId
in interfacePersonalBuildManager
- Parameters:
userId
- specified user id.- Returns:
- list of all personal build promotions owned by specified user.
-
setPersonalChangeStatus
public void setPersonalChangeStatus(long changeId, Status status)
Description copied from interface:PersonalBuildManager
Changes personal change commit status (if the change was committed successfully).- Specified by:
setPersonalChangeStatus
in interfacePersonalBuildManager
- Parameters:
changeId
- specified change id.status
- commit status.
-
getPersonalChangeInfo
@Nullable public PersonalChangeInfo getPersonalChangeInfo(long changeId)
Description copied from interface:PersonalBuildManager
returns information about personal change by the change id (the same as modification id)- Specified by:
getPersonalChangeInfo
in interfacePersonalBuildManager
- Parameters:
changeId
- personal change id- Returns:
- data object containing information about personal change
-
schedulePersonalChangeForDeletion
public void schedulePersonalChangeForDeletion(long changeId, User user)
Description copied from interface:PersonalBuildManager
Schedules personal change for deletion. If some build is in queue or finished it will be deleted immediately. If build is being ran it cancel request will be sent to the agent. Change will be marked as scheduled for deletion and will be excluded from user changes.- Specified by:
schedulePersonalChangeForDeletion
in interfacePersonalBuildManager
- Parameters:
changeId
- specified change id.user
- specified user. Only user who ran the change can delete it.
-
getContent
public byte[] getContent(VcsModification modification, VcsChangeInfo change) throws VcsException
Description copied from interface:PersonalBuildManager
Returns sent content of the specified file.- Specified by:
getContent
in interfacePersonalBuildManager
- Parameters:
modification
- specified personal modification.change
- specified file change.- Returns:
- file content.
- Throws:
VcsException
- throws exception if file content cannot be read.
-
applyAndGetContent
public byte[] applyAndGetContent(@NotNull byte[] originData, VcsModification modification, VcsChangeInfo change) throws VcsException
Returns applied patch from specified file on specified original data.- Specified by:
applyAndGetContent
in interfacePersonalBuildManager
- Parameters:
originData
- original data which will be used as base for patch.modification
- specified personal modification.change
- specified file change.- Returns:
- applied patch.
- Throws:
VcsException
- throws exception if file content cannot be read or patch cannot be applied.
-
getCurrentRepositoryContentForPersonallyChangedFile
public byte[] getCurrentRepositoryContentForPersonallyChangedFile(VcsModification modification, String fileName, SBuildType buildType) throws VcsException
Description copied from interface:PersonalBuildManager
Returns last vcs repository content of the file specified.- Specified by:
getCurrentRepositoryContentForPersonallyChangedFile
in interfacePersonalBuildManager
- Parameters:
modification
- specified modification.fileName
- specified file relative name.buildType
- specified configuration.- Returns:
- file content from the repository.
- Throws:
VcsException
- throws exception if content cannot be loaded from the repository.VcsFileNotFoundException
- if requested file does not exist in the repository.
-
getPersonalChangeRelativeFilePath
public String getPersonalChangeRelativeFilePath(String original, long startedBuildId)
Description copied from interface:PersonalBuildManager
Returns relative personal change path mapped when personal patch was built to send it to an agent.- Specified by:
getPersonalChangeRelativeFilePath
in interfacePersonalBuildManager
- Parameters:
original
- - original change full file path.startedBuildId
- - build id when change was used.- Returns:
- relative personal change path built for the specified build, null is change was not built yet.
-
isApplicable
public boolean isApplicable(long personalChangeId, @NotNull List<VcsRootInstanceEntry> vcsRootEntries)
Description copied from interface:PersonalBuildManager
Returns true if personal change files can be applied to VCS roots of the specified build configuration.- Specified by:
isApplicable
in interfacePersonalBuildManager
- Parameters:
personalChangeId
- personal change idvcsRootEntries
- vcs root entries- Returns:
- see above
-
isApplicable
public boolean isApplicable(@NotNull SBuildType buildType, @NotNull Collection<String> personalChangeFilePaths, boolean searchThroughDependencies)
Description copied from interface:PersonalBuildManager
Returns true if personal change files can be applied to VCS roots of the specified build configuration.- Specified by:
isApplicable
in interfacePersonalBuildManager
- Parameters:
buildType
- build configurationpersonalChangeFilePaths
- paths from the personal changesearchThroughDependencies
- whether to search through build configuration dependencies or not- Returns:
- see above
-
isApplicable
public boolean isApplicable(@NotNull VcsRootInstanceEntry vcsRootEntry, @NotNull Collection<String> personalChangeFilePaths)
Deprecated.since 10.0Description copied from interface:PersonalBuildManager
Returns true if personal change files can be applied to specified VCS root entry.- Specified by:
isApplicable
in interfacePersonalBuildManager
- Parameters:
vcsRootEntry
- VCS root entrypersonalChangeFilePaths
- paths to check- Returns:
- see above
-
isRelated
public boolean isRelated(@NotNull VcsRootInstanceEntry vcsRootEntry, @NotNull Collection<String> personalChangeFilePaths)
Deprecated.since 10.0Description copied from interface:PersonalBuildManager
Returns true if files are related to specified VCS root entry. By another words returns true if files are applicable to specified VCS root entry or would be applicable if VCS root entry is less specific (has path "a/b" instead of "a/b/c").- Specified by:
isRelated
in interfacePersonalBuildManager
- Parameters:
vcsRootEntry
- VCS root entrypersonalChangeFilePaths
- paths to check- Returns:
- see above
-
setDescription
public void setDescription(long personalChangeId, @NotNull String newDescription)
Description copied from interface:PersonalBuildManager
Change description of the personal modification- Specified by:
setDescription
in interfacePersonalBuildManager
- Parameters:
personalChangeId
- personal change idnewDescription
- must not be empty
-
storePersonalChangeRelativePath
public void storePersonalChangeRelativePath(String path, String relativePath, long buildId)
- Specified by:
storePersonalChangeRelativePath
in interfacePersonalBuildManagerEx
-
-