Class RequirementServiceImpl
java.lang.Object
com.atlassian.bamboo.v2.build.requirement.RequirementServiceImpl
- All Implemented Interfaces:
RequirementService
-
Constructor Summary
ConstructorDescriptionRequirementServiceImpl
(CachedPlanManager cachedPlanManager, com.atlassian.struts.TextProvider textProvider, PlanManager planManager, AuditLogService auditLogService, com.atlassian.event.api.EventPublisher eventPublisher, BambooPermissionManager bambooPermissionManager, CapabilityHelper capabilityHelper, TaskManager taskManager, ElasticFunctionalityFacade elasticFunctionalityFacade, ExecutableAgentsHelper executableAgentsHelper) -
Method Summary
Modifier and TypeMethodDescription@NotNull ImmutableRequirement
addRequirement
(@NotNull PlanKey jobKey, @NotNull String key, @NotNull ImmutableRequirement.MatchType matchType, @Nullable String matchValue) Add new requirement to a job.@NotNull ExecutableAgentsMatrix
getExecutableAgentMatrixForJob
(@NotNull PlanKey jobKey) retrieve all executable agents for a particular job.@NotNull ImmutableRequirement
getRequirementForJob
(@NotNull PlanKey jobKey, long requirementId) Get a single requirement for a job.@NotNull ImmutableRequirement
getRequirementForJobWithConsistencyGuarantee
(@NotNull PlanKey jobKey, long requirementId) Get a single requirement for a job.@NotNull List<? extends ImmutableRequirement>
getRequirementsForJob
(@NotNull PlanKey jobKey) Get all requirements for jobs.void
removeRequirement
(@NotNull PlanKey jobKey, long requirementId) Remove a specific requirement@NotNull ImmutableRequirement
updateRequirement
(@NotNull PlanKey jobKey, long requirementId, @NotNull String key, @NotNull ImmutableRequirement.MatchType matchType, @Nullable String matchValue) Update an existing requirement.@NotNull ErrorCollection
validateRequirementForAdd
(@NotNull PlanKey jobKey, @Nullable String key, @Nullable ImmutableRequirement.MatchType matchType, @Nullable String matchValue) Validate requirement details.@NotNull ErrorCollection
validateRequirementForUpdate
(@NotNull PlanKey jobKey, long requirementId, @Nullable String key, @Nullable ImmutableRequirement.MatchType matchType, @Nullable String matchValue) Validate requirement details
-
Constructor Details
-
RequirementServiceImpl
public RequirementServiceImpl(CachedPlanManager cachedPlanManager, com.atlassian.struts.TextProvider textProvider, PlanManager planManager, AuditLogService auditLogService, com.atlassian.event.api.EventPublisher eventPublisher, BambooPermissionManager bambooPermissionManager, CapabilityHelper capabilityHelper, TaskManager taskManager, ElasticFunctionalityFacade elasticFunctionalityFacade, ExecutableAgentsHelper executableAgentsHelper)
-
-
Method Details
-
getRequirementsForJob
@NotNull public @NotNull List<? extends ImmutableRequirement> getRequirementsForJob(@NotNull @NotNull PlanKey jobKey) throws WebValidationException Description copied from interface:RequirementService
Get all requirements for jobs. If a branch job, will get master requirements.- Specified by:
getRequirementsForJob
in interfaceRequirementService
- Parameters:
jobKey
- of job- Returns:
- RequirementSet for job
- Throws:
WebValidationException
- if job key invalid
-
getExecutableAgentMatrixForJob
@NotNull public @NotNull ExecutableAgentsMatrix getExecutableAgentMatrixForJob(@NotNull @NotNull PlanKey jobKey) throws WebValidationException Description copied from interface:RequirementService
retrieve all executable agents for a particular job. Includes all disabled and offline.- Specified by:
getExecutableAgentMatrixForJob
in interfaceRequirementService
- Returns:
- executableAgentMatrix (requirements to matching agents and images)
- Throws:
WebValidationException
-
getRequirementForJob
@NotNull public @NotNull ImmutableRequirement getRequirementForJob(@NotNull @NotNull PlanKey jobKey, long requirementId) Description copied from interface:RequirementService
Get a single requirement for a job. If a branch job, will retrieve requirement from master. In clustered mode, there is NO consistency guarantee.- Specified by:
getRequirementForJob
in interfaceRequirementService
- Parameters:
jobKey
- of jobrequirementId
- of requirement- Returns:
- requirement
-
getRequirementForJobWithConsistencyGuarantee
@NotNull public @NotNull ImmutableRequirement getRequirementForJobWithConsistencyGuarantee(@NotNull @NotNull PlanKey jobKey, long requirementId) Description copied from interface:RequirementService
Get a single requirement for a job. If a branch job, will retrieve requirement from master. There is a guarantee that the data will be up-to-date.- Specified by:
getRequirementForJobWithConsistencyGuarantee
in interfaceRequirementService
- Parameters:
jobKey
- of jobrequirementId
- of requirement- Returns:
- requirement
-
validateRequirementForAdd
@NotNull public @NotNull ErrorCollection validateRequirementForAdd(@NotNull @NotNull PlanKey jobKey, @Nullable @Nullable String key, @Nullable @Nullable ImmutableRequirement.MatchType matchType, @Nullable @Nullable String matchValue) Description copied from interface:RequirementService
Validate requirement details. Assumes details will be used to add a new requirement- Specified by:
validateRequirementForAdd
in interfaceRequirementService
- Parameters:
jobKey
- of job requirement will be added tokey
- of requirement to match with the capabilitymatchType
- e.g. exists, regex match, equalsmatchValue
- for regex and equals the value the requirement should match- Returns:
- error collection containing any validation errors
-
addRequirement
@NotNull public @NotNull ImmutableRequirement addRequirement(@NotNull @NotNull PlanKey jobKey, @NotNull @NotNull String key, @NotNull @NotNull ImmutableRequirement.MatchType matchType, @Nullable @Nullable String matchValue) throws WebValidationException Description copied from interface:RequirementService
Add new requirement to a job. Can only add requirements to the master job.- Specified by:
addRequirement
in interfaceRequirementService
- Parameters:
jobKey
- of job to add to, must not be a branchkey
- of requirement to match with the capabilitymatchType
- e.g. exists, regex match, equalsmatchValue
- for regex and equals the value the requirement should match- Returns:
- Created requirement
- Throws:
WebValidationException
- for any data related error.
-
validateRequirementForUpdate
@NotNull public @NotNull ErrorCollection validateRequirementForUpdate(@NotNull @NotNull PlanKey jobKey, long requirementId, @Nullable @Nullable String key, @Nullable @Nullable ImmutableRequirement.MatchType matchType, @Nullable @Nullable String matchValue) Description copied from interface:RequirementService
Validate requirement details- Specified by:
validateRequirementForUpdate
in interfaceRequirementService
- Parameters:
jobKey
- of job requirement belongs torequirementId
- if of the requirement being updatedkey
- of requirement to match with the capabilitymatchType
- e.g. exists, regex match, equalsmatchValue
- for regex and equals the value the requirement should match- Returns:
- error collection containing any validation errors
-
updateRequirement
@NotNull public @NotNull ImmutableRequirement updateRequirement(@NotNull @NotNull PlanKey jobKey, long requirementId, @NotNull @NotNull String key, @NotNull @NotNull ImmutableRequirement.MatchType matchType, @Nullable @Nullable String matchValue) throws WebValidationException Description copied from interface:RequirementService
Update an existing requirement. Can only update requirements of master jobs- Specified by:
updateRequirement
in interfaceRequirementService
- Parameters:
jobKey
- of job requirement belongs torequirementId
- if of the requirement being updatedkey
- of requirement to match with the capabilitymatchType
- e.g. exists, regex match, equalsmatchValue
- for regex and equals the value the requirement should match- Returns:
- Created requirement
- Throws:
WebValidationException
- for any data related error.
-
removeRequirement
public void removeRequirement(@NotNull @NotNull PlanKey jobKey, long requirementId) throws WebValidationException Description copied from interface:RequirementService
Remove a specific requirement- Specified by:
removeRequirement
in interfaceRequirementService
- Parameters:
jobKey
- requirement belongs torequirementId
- of requirement to remove- Throws:
WebValidationException
- if requirement is not allowed to be removed
-