Class SecuredPersonalBuildManager
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.auth.SecuredPersonalBuildManager
-
- All Implemented Interfaces:
PersonalBuildManagerEx,PersonalBuildManager
public class SecuredPersonalBuildManager extends Object implements PersonalBuildManagerEx
- Author:
- Pavel.Sher Date: 09.02.2009
-
-
Constructor Summary
Constructors Constructor Description SecuredPersonalBuildManager(SecurityContextEx securityContext)
-
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.SQueuedBuildaddRemoteRunToQueue(BuildType buildType, long changeListId, String comment)Schedules configuration to run specified personal changes.SQueuedBuildaddRemoteRunToQueue(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.voidbuildEmptyPatch(OutputStream agentOutput, SRunningBuild runningBuild)voidbuildPatch(OutputStream agentOutput, SRunningBuild runningBuild, SBuildType buildType, PatchMapLogger patchLogger)voidbuildPersonalPatch(OutputStream agentOutput, SRunningBuild runningBuild, long personalChangeId, PatchMapLogger patchLogger)voiddeleteIfScheduledForDeletion(SBuild build)Deletes personal build if it was marked for deletion.List<BuildPromotion>findBuildPromotionsByChangesId(long id)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.SVcsModificationgetModification(long changesId)ReturnsSVcsModificationobject for the personal modification with the given id.SVcsModificationgetModification(long changesId, boolean resolveCommitDecision)List<SVcsModification>getModifications(long userId)Returns collection ofSVcsModificationmodifications ran by the given user.PersonalChangeInfogetPersonalChangeInfo(long id)returns information about personal change by the change id (the same as modification id)StringgetPersonalChangeRelativeFilePath(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)booleanisApplicable(long personalChangeId, List<VcsRootInstanceEntry> vcsRootEntries)Returns true if personal change files can be applied to VCS roots of the specified build configuration.booleanisApplicable(SBuildType buildType, Collection<String> personalChangeFilePaths, boolean searchThroughDependencies)Returns true if personal change files can be applied to VCS roots of the specified build configuration.booleanisApplicable(VcsRootInstanceEntry vcsRootEntry, Collection<String> personalChangeFilePaths)Returns true if personal change files can be applied to specified VCS root entry.booleanisEmptyPersonalPatch(long changeId)booleanisProcessingChangeFile(File file)booleanisRelated(VcsRootInstanceEntry vcsRootEntry, Collection<String> filePaths)Returns true if files are related to specified VCS root entry.voidperformAction(long changeListId, Runnable action)longpublishChangeList(PersonalChangeInfo changeInfo, InputStream input)Deprecated.longpublishChangeList(PersonalChangeInfo changeInfo, InputStream input, PersonalChangeFormatType type)Publishes personal changes.longpublishEmptyChangeList(User user)voidremoveChangeIfEmpty(long changeId)voidschedulePersonalChangeForDeletion(long changeId, User user)Schedules personal change for deletion.voidsetAgentRestrictorFactory(AgentRestrictorFactory agentRestrictorFactory)voidsetBuildAgentManager(BuildAgentManager buildAgentManager)voidsetDelegate(PersonalBuildManagerEx delegate)voidsetDescription(long personalChangeId, String newDescription)Change description of the personal modificationvoidsetPersonalChangeStatus(long changeId, Status status)Changes personal change commit status (if the change was committed successfully).voidsetProjectManager(ProjectManager projectManager)voidstorePersonalChangeRelativePath(String path, String relativePath, long buildId)
-
-
-
Constructor Detail
-
SecuredPersonalBuildManager
public SecuredPersonalBuildManager(@NotNull SecurityContextEx securityContext)
-
-
Method Detail
-
setProjectManager
public void setProjectManager(ProjectManager projectManager)
-
setDelegate
public void setDelegate(PersonalBuildManagerEx delegate)
-
setBuildAgentManager
public void setBuildAgentManager(BuildAgentManager buildAgentManager)
-
setAgentRestrictorFactory
public void setAgentRestrictorFactory(AgentRestrictorFactory agentRestrictorFactory)
-
publishEmptyChangeList
public long publishEmptyChangeList(@NotNull User user)- Specified by:
publishEmptyChangeListin interfacePersonalBuildManagerEx
-
deleteIfScheduledForDeletion
public void deleteIfScheduledForDeletion(SBuild build)
Description copied from interface:PersonalBuildManagerExDeletes personal build if it was marked for deletion.- Specified by:
deleteIfScheduledForDeletionin interfacePersonalBuildManagerEx- Parameters:
build- build to delete
-
getPersonalModificationBuildTypeIds
@NotNull public Collection<String> getPersonalModificationBuildTypeIds(@NotNull VcsModification mod)
- Specified by:
getPersonalModificationBuildTypeIdsin interfacePersonalBuildManagerEx
-
buildPatch
public void buildPatch(OutputStream agentOutput, SRunningBuild runningBuild, SBuildType buildType, PatchMapLogger patchLogger) throws IOException
- Specified by:
buildPatchin interfacePersonalBuildManagerEx- Throws:
IOException
-
buildPersonalPatch
public void buildPersonalPatch(OutputStream agentOutput, SRunningBuild runningBuild, long personalChangeId, PatchMapLogger patchLogger) throws IOException
- Specified by:
buildPersonalPatchin interfacePersonalBuildManagerEx- Throws:
IOException
-
buildEmptyPatch
public void buildEmptyPatch(@NotNull OutputStream agentOutput, @NotNull SRunningBuild runningBuild) throws IOException- Specified by:
buildEmptyPatchin interfacePersonalBuildManagerEx- Throws:
IOException
-
storePersonalChangeRelativePath
public void storePersonalChangeRelativePath(String path, String relativePath, long buildId)
- Specified by:
storePersonalChangeRelativePathin interfacePersonalBuildManagerEx
-
getModification
@Nullable public SVcsModification getModification(long changesId)
Description copied from interface:PersonalBuildManagerReturnsSVcsModificationobject for the personal modification with the given id.- Specified by:
getModificationin interfacePersonalBuildManager- Parameters:
changesId- personal change id.- Returns:
- modification object for the personal change.
-
getModification
@Nullable public SVcsModification getModification(long changesId, boolean resolveCommitDecision)
- Specified by:
getModificationin interfacePersonalBuildManagerEx
-
isEmptyPersonalPatch
public boolean isEmptyPersonalPatch(long changeId)
- Specified by:
isEmptyPersonalPatchin interfacePersonalBuildManagerEx
-
getModifications
public List<SVcsModification> getModifications(long userId)
Description copied from interface:PersonalBuildManagerReturns collection ofSVcsModificationmodifications ran by the given user.- Specified by:
getModificationsin interfacePersonalBuildManager- Parameters:
userId- specified user.- Returns:
- all personal changes run by the user, resent first
-
addRemoteRunToQueue
@Nullable public SQueuedBuild addRemoteRunToQueue(@NotNull BuildType buildType, long changeListId, String comment)
Description copied from interface:PersonalBuildManagerSchedules configuration to run specified personal changes.- Specified by:
addRemoteRunToQueuein 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:PersonalBuildManagerSchedules configuration to run specified personal changes on specified agent.- Specified by:
addRemoteRunToQueuein 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:PersonalBuildManagerExCreates 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:
addRemoteRunsToQueuein interfacePersonalBuildManagerExchangeListId- personal change idcomment- comment- Returns:
- list of personal builds added to the queue
-
performAction
public void performAction(long changeListId, @NotNull Runnable action)- Specified by:
performActionin interfacePersonalBuildManagerEx
-
publishChangeList
@Deprecated public long publishChangeList(PersonalChangeInfo changeInfo, InputStream input) throws IOException
Deprecated.Description copied from interface:PersonalBuildManagerPublishes personal changes.- Specified by:
publishChangeListin 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(PersonalChangeInfo changeInfo, InputStream input, PersonalChangeFormatType type) throws IOException
Description copied from interface:PersonalBuildManagerPublishes personal changes.- Specified by:
publishChangeListin 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.
-
findBuildPromotionsByChangesId
@NotNull public List<BuildPromotion> findBuildPromotionsByChangesId(long id)
Description copied from interface:PersonalBuildManagerFinds personal build promotions by change id.- Specified by:
findBuildPromotionsByChangesIdin interfacePersonalBuildManager- Parameters:
id- 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:PersonalBuildManagerFinds personal build promotions by user id.- Specified by:
findBuildPromotionsByUserIdin 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:PersonalBuildManagerChanges personal change commit status (if the change was committed successfully).- Specified by:
setPersonalChangeStatusin interfacePersonalBuildManager- Parameters:
changeId- specified change id.status- commit status.
-
getPersonalChangeInfo
@Nullable public PersonalChangeInfo getPersonalChangeInfo(long id)
Description copied from interface:PersonalBuildManagerreturns information about personal change by the change id (the same as modification id)- Specified by:
getPersonalChangeInfoin interfacePersonalBuildManager- Parameters:
id- personal change id- Returns:
- data object containing information about personal change
-
schedulePersonalChangeForDeletion
public void schedulePersonalChangeForDeletion(long changeId, User user)Description copied from interface:PersonalBuildManagerSchedules 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:
schedulePersonalChangeForDeletionin 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:PersonalBuildManagerReturns sent content of the specified file.- Specified by:
getContentin 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(byte[] originData, VcsModification modification, VcsChangeInfo change) throws VcsExceptionDescription copied from interface:PersonalBuildManagerReturns applied patch from specified file on specified original data.- Specified by:
applyAndGetContentin 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:PersonalBuildManagerReturns last vcs repository content of the file specified.- Specified by:
getCurrentRepositoryContentForPersonallyChangedFilein 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:PersonalBuildManagerReturns relative personal change path mapped when personal patch was built to send it to an agent.- Specified by:
getPersonalChangeRelativeFilePathin 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:PersonalBuildManagerReturns true if personal change files can be applied to VCS roots of the specified build configuration.- Specified by:
isApplicablein 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:PersonalBuildManagerReturns true if personal change files can be applied to VCS roots of the specified build configuration.- Specified by:
isApplicablein 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)Description copied from interface:PersonalBuildManagerReturns true if personal change files can be applied to specified VCS root entry.- Specified by:
isApplicablein interfacePersonalBuildManager- Parameters:
vcsRootEntry- VCS root entrypersonalChangeFilePaths- paths to check- Returns:
- see above
-
isRelated
public boolean isRelated(@NotNull VcsRootInstanceEntry vcsRootEntry, @NotNull Collection<String> filePaths)Description copied from interface:PersonalBuildManagerReturns 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:
isRelatedin interfacePersonalBuildManager- Parameters:
vcsRootEntry- VCS root entryfilePaths- paths to check- Returns:
- see above
-
setDescription
public void setDescription(long personalChangeId, @NotNull String newDescription)Description copied from interface:PersonalBuildManagerChange description of the personal modification- Specified by:
setDescriptionin interfacePersonalBuildManager- Parameters:
personalChangeId- personal change idnewDescription- must not be empty
-
removeChangeIfEmpty
public void removeChangeIfEmpty(long changeId)
- Specified by:
removeChangeIfEmptyin interfacePersonalBuildManagerEx
-
isProcessingChangeFile
public boolean isProcessingChangeFile(@NotNull File file)- Specified by:
isProcessingChangeFilein interfacePersonalBuildManagerEx- Parameters:
file- change file to check- Returns:
- whether change file is created by manager, yet not registered in database
-
-