Class ResponsibilityFacadeImpl
- java.lang.Object
-
- jetbrains.buildServer.responsibility.impl.ResponsibilityFacadeImpl
-
- All Implemented Interfaces:
BuildProblemResponsibilityFacade
,BuildTypeResponsibilityFacade
,ResponsibilityFacadeEx
,TestNameResponsibilityFacade
public class ResponsibilityFacadeImpl extends Object implements ResponsibilityFacadeEx, BuildTypeResponsibilityFacade, TestNameResponsibilityFacade, BuildProblemResponsibilityFacade
The thread-safety and persistence is granted byResponsibilityManager
.- Author:
- Maxim Podkolzine (maxim.podkolzine@jetbrains.com)
-
-
Constructor Summary
Constructors Constructor Description ResponsibilityFacadeImpl(EventDispatcher<BuildServerListener> events, TestName2Index testName2Index, TestInvestigationAuditLog testInvestigationAuditLog, BuildProblemInvestigationAuditLog buildProblemInvestigationAuditLog, BuildTypeInvestigationAuditLog buildTypeInvestigationAuditLog)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static String
buildProblemId(long testNameId, String projectId)
static String
buildProblemId(BuildProblemInfo buildProblem, String projectId)
List<TestNameResponsibilityEntry>
findAllTestNameResponsibilities(long testNameId, String projectId)
Returns all responsibility entries for the test name in a project.List<TestNameResponsibilityEntry>
findAllTestNameResponsibilities(TestName testName, String projectId)
Returns all responsibility entries for the test name in a project.List<BuildProblemResponsibilityEntry>
findBuildProblemResponsibilities(BuildProblemInfo buildProblem, String projectId)
Returns all responsibility entries for a build problem in the project's treeBuildProblemResponsibilityEntry
findBuildProblemResponsibility(BuildProblemInfo buildProblem, String projectId)
Returns responsibility entry for a build problem direct in a project, or null if it does not existResponsibilityEntry
findBuildTypeResponsibility(BuildType buildType)
Returns the responsibility entry for a build type, or null if it does not exist.List<BuildProblemResponsibilityEntry>
findEffectiveBuildProblemResponsibilities(BuildProblemInfo buildProblem, String projectId)
Returns all responsibility entries for a build problem in the project and it's parentsTestNameResponsibilityEntry
findTestNameResponsibility(TestName testName, String projectId)
Returns the responsibility entry for a test name in a project, or null if it does not exist.static String
getProblemProjectId(String problemId)
SProject
getProject(ResponsibilityEntry entry)
String
getProjectId(ResponsibilityEntry entry)
TODO: temporary solution, should be moved to ResponsibilityEntry interface (kir)Map<User,List<ResponsibilityEntry>>
getResponsibilitiesMap(String projectId)
Returns the map of all responsibility entries classified by users.static long
getTestNameId(String problemId)
List<BuildProblemResponsibilityEntry>
getUserBuildProblemResponsibilities(User user, String projectId)
Returns the list of responsibility entries associated with the specified user in a specified project.List<BuildTypeResponsibilityEntry>
getUserBuildTypeResponsibilities(User user, String projectId)
Returns the list of entries associated with the user (if specified) in a specified project (or globally).List<TestNameResponsibilityEntry>
getUserTestNameResponsibilities(User user, String projectId)
Returns the list of entries associated with the user (if specified) in a specified project.List<TestNameResponsibilityEntry>
getUserTestNameResponsibilities(User user, Collection<String> projectIds)
Same as {TestNameResponsibilityFacade.getUserTestNameResponsibilities(User, String)
but performs operation for set of project ids.static boolean
isProjectMatches(String problemId, String projectId)
static Pair<Long,String>
parseTestProblemId(String problemId)
void
removeBuildProblemResponsibility(BuildProblemInfo buildProblem, String projectId)
Removes responsibility entry associated with specified build problemvoid
removeBuildTypeResponsibility(BuildType buildType)
Deletes the build type entry associated with the build type.void
removeTestNameResponsibility(TestName testName, String projectId)
Removes the responsibility entry associated with the test name.void
setBuildProblemResponsibility(Collection<BuildProblemInfo> buildProblems, String projectId, ResponsibilityEntry entry)
Sets responsibility for several build problems at once in a specified project.void
setBuildProblemResponsibility(Collection<BuildProblemInfo> buildProblems, String projectId, ResponsibilityEntry entry, boolean removeResponsibilitiesInChildProjects)
Sets responsibility for several build problems at once in a specified projectvoid
setBuildProblemResponsibility(BuildProblemInfo buildProblem, String projectId, ResponsibilityEntry entry)
Sets the responsibility for build problem in a specified projectvoid
setBuildTypeResponsibility(BuildType buildType, ResponsibilityEntry entry)
Sets the responsibility entry for the build type.void
setProjectManager(ProjectManager projectManager)
void
setResponsibilityManager(ResponsibilityManager responsibilityManager)
void
setTestNameResponsibility(Collection<TestName> testNames, String projectId, ResponsibilityEntry entry)
Sets the responsibility for several tests at once in a specified project.void
setTestNameResponsibility(Collection<TestName> testNames, String projectId, ResponsibilityEntry entry, boolean removeResponsibilitiesInChildProjects)
Sets the responsibility for several tests at once in a specified project.void
setTestNameResponsibility(TestName testName, String projectId, ResponsibilityEntry entry)
Sets the responsibility entry for the test name in a specified project.
-
-
-
Field Detail
-
BP_PREFIX
@NonNls public static final String BP_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ResponsibilityFacadeImpl
public ResponsibilityFacadeImpl(@NotNull EventDispatcher<BuildServerListener> events, @NotNull TestName2Index testName2Index, @NotNull TestInvestigationAuditLog testInvestigationAuditLog, @NotNull BuildProblemInvestigationAuditLog buildProblemInvestigationAuditLog, @NotNull BuildTypeInvestigationAuditLog buildTypeInvestigationAuditLog)
-
-
Method Detail
-
setResponsibilityManager
public void setResponsibilityManager(ResponsibilityManager responsibilityManager)
-
setProjectManager
public void setProjectManager(ProjectManager projectManager)
-
findBuildTypeResponsibility
public ResponsibilityEntry findBuildTypeResponsibility(@NotNull BuildType buildType)
Description copied from interface:BuildTypeResponsibilityFacade
Returns the responsibility entry for a build type, or null if it does not exist.- Specified by:
findBuildTypeResponsibility
in interfaceBuildTypeResponsibilityFacade
- Parameters:
buildType
- the build type- Returns:
- responsibility entry, or null
-
getUserBuildTypeResponsibilities
@NotNull public List<BuildTypeResponsibilityEntry> getUserBuildTypeResponsibilities(@Nullable User user, @Nullable String projectId)
Description copied from interface:BuildTypeResponsibilityFacade
Returns the list of entries associated with the user (if specified) in a specified project (or globally).- Specified by:
getUserBuildTypeResponsibilities
in interfaceBuildTypeResponsibilityFacade
- Parameters:
user
- the responsible user; null means all usersprojectId
- the project id; null means all projects- Returns:
- list of responsibilities
-
setBuildTypeResponsibility
public void setBuildTypeResponsibility(@NotNull BuildType buildType, @NotNull ResponsibilityEntry entry)
Description copied from interface:BuildTypeResponsibilityFacade
Sets the responsibility entry for the build type.Note: if new reporter user isn't set (
entry.getReporterUser() == null
), it is not overwritten.- Specified by:
setBuildTypeResponsibility
in interfaceBuildTypeResponsibilityFacade
- Parameters:
buildType
- the build typeentry
- responsibility entry
-
removeBuildTypeResponsibility
public void removeBuildTypeResponsibility(@NotNull BuildType buildType)
Description copied from interface:BuildTypeResponsibilityFacade
Deletes the build type entry associated with the build type. Does nothing, if it doesn't exist.- Specified by:
removeBuildTypeResponsibility
in interfaceBuildTypeResponsibilityFacade
- Parameters:
buildType
- the build type
-
findTestNameResponsibility
public TestNameResponsibilityEntry findTestNameResponsibility(@NotNull TestName testName, @NotNull String projectId)
Description copied from interface:TestNameResponsibilityFacade
Returns the responsibility entry for a test name in a project, or null if it does not exist.- Specified by:
findTestNameResponsibility
in interfaceTestNameResponsibilityFacade
- Parameters:
testName
- the test nameprojectId
- project internal id- Returns:
- responsibility entry, or null
-
findAllTestNameResponsibilities
@NotNull public List<TestNameResponsibilityEntry> findAllTestNameResponsibilities(@NotNull TestName testName, @NotNull String projectId)
Description copied from interface:TestNameResponsibilityFacade
Returns all responsibility entries for the test name in a project.- Specified by:
findAllTestNameResponsibilities
in interfaceTestNameResponsibilityFacade
- Parameters:
testName
- the test nameprojectId
- project internal id- Returns:
- list of entries for this test; since 2018.1 entries of the given projectId go first in the list
-
findAllTestNameResponsibilities
@NotNull public List<TestNameResponsibilityEntry> findAllTestNameResponsibilities(long testNameId, @NotNull String projectId)
Description copied from interface:TestNameResponsibilityFacade
Returns all responsibility entries for the test name in a project.- Specified by:
findAllTestNameResponsibilities
in interfaceTestNameResponsibilityFacade
- Parameters:
testNameId
- the test name IDprojectId
- project internal id- Returns:
- list of entries for this test; since 2018.1 entries of the given projectId go first in the list
-
getUserTestNameResponsibilities
@NotNull public List<TestNameResponsibilityEntry> getUserTestNameResponsibilities(@Nullable User user, @Nullable String projectId)
Description copied from interface:TestNameResponsibilityFacade
Returns the list of entries associated with the user (if specified) in a specified project.- Specified by:
getUserTestNameResponsibilities
in interfaceTestNameResponsibilityFacade
- Parameters:
user
- the responsible user; null means all usersprojectId
- the project internal id; null means all projects- Returns:
- list of responsibilities
-
getUserTestNameResponsibilities
@NotNull public List<TestNameResponsibilityEntry> getUserTestNameResponsibilities(@Nullable User user, @NotNull Collection<String> projectIds)
Description copied from interface:TestNameResponsibilityFacade
Same as {TestNameResponsibilityFacade.getUserTestNameResponsibilities(User, String)
but performs operation for set of project ids.- Specified by:
getUserTestNameResponsibilities
in interfaceTestNameResponsibilityFacade
- Parameters:
user
- the responsible user; null means all usersprojectIds
- collection of project internal ids- Returns:
- list of responsibilities in requested projects
-
removeTestNameResponsibility
public void removeTestNameResponsibility(@NotNull TestName testName, @NotNull String projectId)
Description copied from interface:TestNameResponsibilityFacade
Removes the responsibility entry associated with the test name.- Specified by:
removeTestNameResponsibility
in interfaceTestNameResponsibilityFacade
- Parameters:
testName
- the test nameprojectId
- the project internal id
-
setTestNameResponsibility
public void setTestNameResponsibility(@NotNull TestName testName, @NotNull String projectId, @NotNull ResponsibilityEntry entry)
Description copied from interface:TestNameResponsibilityFacade
Sets the responsibility entry for the test name in a specified project.Note: if new reporter user isn't set (
entry.getReporterUser() == null
), it is not overwritten.- Specified by:
setTestNameResponsibility
in interfaceTestNameResponsibilityFacade
- Parameters:
testName
- the test nameprojectId
- the project internal identry
- responsibility entry
-
setTestNameResponsibility
public void setTestNameResponsibility(@NotNull Collection<TestName> testNames, @NotNull String projectId, @NotNull ResponsibilityEntry entry)
Description copied from interface:TestNameResponsibilityFacade
Sets the responsibility for several tests at once in a specified project.- Specified by:
setTestNameResponsibility
in interfaceTestNameResponsibilityFacade
- Parameters:
testNames
- collection of test namesprojectId
- the project internal identry
- new responsibility entry- See Also:
#setTestNameResponsibility(TestName, String, ResponsibilityEntry, Boolean)
-
setTestNameResponsibility
public void setTestNameResponsibility(@NotNull Collection<TestName> testNames, @NotNull String projectId, @NotNull ResponsibilityEntry entry, boolean removeResponsibilitiesInChildProjects)
Description copied from interface:TestNameResponsibilityFacade
Sets the responsibility for several tests at once in a specified project.- Specified by:
setTestNameResponsibility
in interfaceTestNameResponsibilityFacade
- Parameters:
testNames
- collection of test namesprojectId
- the project internal identry
- new responsibility entryremoveResponsibilitiesInChildProjects
- indiciates whether relevant responsibilities in child projects should be removed.
-
getResponsibilitiesMap
@NotNull public Map<User,List<ResponsibilityEntry>> getResponsibilitiesMap(@Nullable String projectId)
Description copied from interface:ResponsibilityFacadeEx
Returns the map of all responsibility entries classified by users. Both build type and test responsibilities are included.- Specified by:
getResponsibilitiesMap
in interfaceResponsibilityFacadeEx
- Returns:
- the map of all responsibility entries classified by users
-
getProjectId
public String getProjectId(ResponsibilityEntry entry)
Description copied from interface:ResponsibilityFacadeEx
TODO: temporary solution, should be moved to ResponsibilityEntry interface (kir)- Specified by:
getProjectId
in interfaceResponsibilityFacadeEx
- Returns:
- project ID for the given ResponsibilityEntry
-
getProject
public SProject getProject(ResponsibilityEntry entry)
- Specified by:
getProject
in interfaceResponsibilityFacadeEx
-
buildProblemId
@NotNull public static String buildProblemId(@NotNull BuildProblemInfo buildProblem, @NotNull String projectId)
-
isProjectMatches
public static boolean isProjectMatches(@Nullable String problemId, @Nullable String projectId)
-
getTestNameId
public static long getTestNameId(@NotNull String problemId)
-
parseTestProblemId
@Nullable public static Pair<Long,String> parseTestProblemId(@NotNull String problemId)
-
setBuildProblemResponsibility
public void setBuildProblemResponsibility(@NotNull BuildProblemInfo buildProblem, @NotNull String projectId, @NotNull ResponsibilityEntry entry)
Description copied from interface:BuildProblemResponsibilityFacade
Sets the responsibility for build problem in a specified project- Specified by:
setBuildProblemResponsibility
in interfaceBuildProblemResponsibilityFacade
- Parameters:
buildProblem
- build problemprojectId
- project internal id
-
setBuildProblemResponsibility
public void setBuildProblemResponsibility(@NotNull Collection<BuildProblemInfo> buildProblems, @NotNull String projectId, @NotNull ResponsibilityEntry entry)
Description copied from interface:BuildProblemResponsibilityFacade
Sets responsibility for several build problems at once in a specified project. Cleans up responsibilities in the child projects.- Specified by:
setBuildProblemResponsibility
in interfaceBuildProblemResponsibilityFacade
- Parameters:
buildProblems
- collection of build problemsprojectId
- project internal identry
- new responsibility entry- See Also:
BuildProblemResponsibilityFacade.setBuildProblemResponsibility(Collection, String, ResponsibilityEntry, boolean)
-
setBuildProblemResponsibility
public void setBuildProblemResponsibility(@NotNull Collection<BuildProblemInfo> buildProblems, @NotNull String projectId, @NotNull ResponsibilityEntry entry, boolean removeResponsibilitiesInChildProjects)
Description copied from interface:BuildProblemResponsibilityFacade
Sets responsibility for several build problems at once in a specified project- Specified by:
setBuildProblemResponsibility
in interfaceBuildProblemResponsibilityFacade
- Parameters:
buildProblems
- collection of build problemsprojectId
- project internal identry
- new responsibility entryremoveResponsibilitiesInChildProjects
- indicates whether relevant responsibilities in the child projects should be removed.- See Also:
BuildProblemResponsibilityFacade.setBuildProblemResponsibility(jetbrains.buildServer.serverSide.problems.BuildProblemInfo, String, ResponsibilityEntry)
-
findBuildProblemResponsibility
@Nullable public BuildProblemResponsibilityEntry findBuildProblemResponsibility(@NotNull BuildProblemInfo buildProblem, @NotNull String projectId)
Description copied from interface:BuildProblemResponsibilityFacade
Returns responsibility entry for a build problem direct in a project, or null if it does not exist- Specified by:
findBuildProblemResponsibility
in interfaceBuildProblemResponsibilityFacade
- Parameters:
buildProblem
- build problemprojectId
- project internal id- Returns:
- responsibility entry, or null
-
findBuildProblemResponsibilities
@NotNull public List<BuildProblemResponsibilityEntry> findBuildProblemResponsibilities(@NotNull BuildProblemInfo buildProblem, @NotNull String projectId)
Description copied from interface:BuildProblemResponsibilityFacade
Returns all responsibility entries for a build problem in the project's tree- Specified by:
findBuildProblemResponsibilities
in interfaceBuildProblemResponsibilityFacade
- Parameters:
buildProblem
- build problemprojectId
- project internal id- Returns:
- responsibility entries list; since 2018.1 entries for the specified project go first in the list
-
findEffectiveBuildProblemResponsibilities
@NotNull public List<BuildProblemResponsibilityEntry> findEffectiveBuildProblemResponsibilities(@NotNull BuildProblemInfo buildProblem, @NotNull String projectId)
Description copied from interface:BuildProblemResponsibilityFacade
Returns all responsibility entries for a build problem in the project and it's parents- Specified by:
findEffectiveBuildProblemResponsibilities
in interfaceBuildProblemResponsibilityFacade
projectId
- project internal id- Returns:
- responsibility entries list
-
getUserBuildProblemResponsibilities
@NotNull public List<BuildProblemResponsibilityEntry> getUserBuildProblemResponsibilities(@Nullable User user, @Nullable String projectId)
Description copied from interface:BuildProblemResponsibilityFacade
Returns the list of responsibility entries associated with the specified user in a specified project.- Specified by:
getUserBuildProblemResponsibilities
in interfaceBuildProblemResponsibilityFacade
- Parameters:
user
- the responsible user; null means all usersprojectId
- the project internal id; null means all projects- Returns:
- list of responsibility entries
-
removeBuildProblemResponsibility
public void removeBuildProblemResponsibility(@NotNull BuildProblemInfo buildProblem, @NotNull String projectId)
Description copied from interface:BuildProblemResponsibilityFacade
Removes responsibility entry associated with specified build problem- Specified by:
removeBuildProblemResponsibility
in interfaceBuildProblemResponsibilityFacade
- Parameters:
buildProblem
- buils problemprojectId
- project internal id
-
-