Class RequirementServiceImpl
java.lang.Object
com.atlassian.bamboo.v2.build.requirement.RequirementServiceImpl
- All Implemented Interfaces:
RequirementService
-
Constructor Summary
ConstructorsConstructorDescriptionRequirementServiceImpl(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 ImmutableRequirementaddRequirement(@NotNull PlanKey jobKey, @NotNull String key, @NotNull ImmutableRequirement.MatchType matchType, @Nullable String matchValue) Add new requirement to a job.@NotNull ExecutableAgentsMatrixgetExecutableAgentMatrixForJob(@NotNull PlanKey jobKey) retrieve all executable agents for a particular job.@NotNull ImmutableRequirementgetRequirementForJob(@NotNull PlanKey jobKey, long requirementId) Get a single requirement for a job.@NotNull ImmutableRequirementgetRequirementForJobWithConsistencyGuarantee(@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.voidremoveRequirement(@NotNull PlanKey jobKey, long requirementId) Remove a specific requirement@NotNull ImmutableRequirementupdateRequirement(@NotNull PlanKey jobKey, long requirementId, @NotNull String key, @NotNull ImmutableRequirement.MatchType matchType, @Nullable String matchValue) Update an existing requirement.@NotNull ErrorCollectionvalidateRequirementForAdd(@NotNull PlanKey jobKey, @Nullable String key, @Nullable ImmutableRequirement.MatchType matchType, @Nullable String matchValue) Validate requirement details.@NotNull ErrorCollectionvalidateRequirementForUpdate(@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:RequirementServiceGet all requirements for jobs. If a branch job, will get master requirements.- Specified by:
getRequirementsForJobin 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:RequirementServiceretrieve all executable agents for a particular job. Includes all disabled and offline.- Specified by:
getExecutableAgentMatrixForJobin 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:RequirementServiceGet 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:
getRequirementForJobin 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:RequirementServiceGet 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:
getRequirementForJobWithConsistencyGuaranteein 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:RequirementServiceValidate requirement details. Assumes details will be used to add a new requirement- Specified by:
validateRequirementForAddin 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:RequirementServiceAdd new requirement to a job. Can only add requirements to the master job.- Specified by:
addRequirementin 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:RequirementServiceValidate requirement details- Specified by:
validateRequirementForUpdatein 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:RequirementServiceUpdate an existing requirement. Can only update requirements of master jobs- Specified by:
updateRequirementin 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:RequirementServiceRemove a specific requirement- Specified by:
removeRequirementin interfaceRequirementService- Parameters:
jobKey- requirement belongs torequirementId- of requirement to remove- Throws:
WebValidationException- if requirement is not allowed to be removed
-