public class JobServiceImpl extends Object implements JobService
Constructor and Description |
---|
JobServiceImpl() |
Modifier and Type | Method and Description |
---|---|
ImmutableJob |
addJob(PlanKey chainKey,
long stageId,
String jobKeyString,
String name,
String description,
boolean suspended)
Add a job to an existing stage in the plan
|
ImmutableJob |
cloneJob(String sourceJobKeyString,
PlanKey chainKey,
long stageId,
String newJobKeyString,
String name,
String description,
boolean suspended)
Copy the given job and give the copy the key, name, description and suspended state provided.
|
void |
deleteJob(PlanKey jobKey,
BambooClosures.Throwing1<ImmutableJob,WebValidationException>... runBefore)
Remove a job.
|
ImmutableJob |
getJob(PlanKey jobKey)
Get an individual job
|
List<ImmutableJob> |
getJobsForPlan(PlanKey planKey)
Assumption is made that
AbstractImmutableChain.getAllJobs() will return 2-level sorted list of jobs |
List<ImmutableJob> |
getJobsForStage(PlanKey planKey,
long stageId)
Get all jobs in a particular stage, ordered alphabetically
|
ImmutableJob |
updateJob(PlanKey jobKey,
String name,
String description,
boolean suspended,
long stageId,
BambooClosures.Throwing1<ImmutableJob,WebValidationException>... runBefore)
Update the details of a job
|
ErrorCollection |
validateJobForAdd(PlanKey planKey,
long stageId,
String jobKey,
String name,
String description,
boolean suspended)
Validates the parameters for adding a job.
|
ErrorCollection |
validateJobForClone(String sourceJobKeyString,
PlanKey chainKey,
long stageId,
String newJobKey,
String name,
String description,
Boolean suspended)
Validates the parameters for cloning a job.
|
ErrorCollection |
validateJobForUpdate(PlanKey jobKey,
String name,
String description,
boolean suspended,
long stageId)
Validate editing of a job
|
@NotNull public List<ImmutableJob> getJobsForPlan(@NotNull PlanKey planKey)
AbstractImmutableChain.getAllJobs()
will return 2-level sorted list of jobsgetJobsForPlan
in interface JobService
planKey
- of plan@NotNull public List<ImmutableJob> getJobsForStage(@NotNull PlanKey planKey, long stageId)
JobService
getJobsForStage
in interface JobService
planKey
- of planstageId
- id of the stage@NotNull public ImmutableJob getJob(@NotNull PlanKey jobKey)
JobService
getJob
in interface JobService
jobKey
- of the job to getpublic ErrorCollection validateJobForAdd(@NotNull PlanKey planKey, long stageId, @Nullable String jobKey, @Nullable String name, @Nullable String description, boolean suspended) throws WebValidationException
JobService
validateJobForAdd
in interface JobService
planKey
- of the plan to add job to.stageId
- of the stage to add the job to.jobKey
- key of the job to add. May be full or partial job key.name
- name of the job to add.description
- description of the job.suspended
- sets the job's suspended status.WebValidationException
@NotNull public ImmutableJob addJob(@NotNull PlanKey chainKey, long stageId, @Nullable String jobKeyString, @Nullable String name, @Nullable String description, boolean suspended) throws WebValidationException
JobService
addJob
in interface JobService
chainKey
- of the plan to add the jobstageId
- of the stage to add the jobjobKeyString
- of the job to add. May be full or partial job key.name
- name of the jobdescription
- description of the jobsuspended
- sets the job suspended statusWebValidationException
public ErrorCollection validateJobForClone(@Nullable String sourceJobKeyString, @NotNull PlanKey chainKey, long stageId, @Nullable String newJobKey, @Nullable String name, @Nullable String description, @Nullable Boolean suspended) throws WebValidationException
JobService
validateJobForClone
in interface JobService
sourceJobKeyString
- key of the job to clone. Must be full job key.chainKey
- key of the plan to add the new job to.stageId
- id of the stage to add the new job to.newJobKey
- key of the new job. May be full or partial job key.name
- name of the new job.description
- description of the new job.suspended
- suspended state of the new job.WebValidationException
public ImmutableJob cloneJob(@NotNull String sourceJobKeyString, @NotNull PlanKey chainKey, long stageId, @NotNull String newJobKeyString, @NotNull String name, @Nullable String description, boolean suspended) throws WebValidationException
JobService
cloneJob
in interface JobService
sourceJobKeyString
- key of the source job to copy. Must be full job key.chainKey
- of the plan to add the new job.stageId
- of the stage to add the new job.newJobKeyString
- key to give to the new job. May be full or partial job key.name
- The name of the cloned job.description
- The description of the cloned job.suspended
- The suspended state of the cloned job.WebValidationException
public void deleteJob(@NotNull PlanKey jobKey, @NotNull BambooClosures.Throwing1<ImmutableJob,WebValidationException>... runBefore) throws WebValidationException
JobService
deleteJob
in interface JobService
jobKey
- of jobrunBefore
- code to execute after security and validation has passed but before the deletion occurs.WebValidationException
@NotNull public ErrorCollection validateJobForUpdate(@NotNull PlanKey jobKey, @NotNull String name, @Nullable String description, boolean suspended, long stageId)
JobService
validateJobForUpdate
in interface JobService
jobKey
- of the job to updatename
- new name of the jobdescription
- new description of the jobsuspended
- sets the job suspended status@NotNull public ImmutableJob updateJob(@NotNull PlanKey jobKey, @NotNull String name, @Nullable String description, boolean suspended, long stageId, @NotNull BambooClosures.Throwing1<ImmutableJob,WebValidationException>... runBefore) throws WebValidationException
JobService
updateJob
in interface JobService
jobKey
- of the job to updatename
- new name of the jobdescription
- new description of the jobsuspended
- sets the job suspended statusstageId
- new stage for the jobrunBefore
- code to execute after security and validation has passed but before the update occurs.WebValidationException
Copyright © 2020 Atlassian Software Systems Pty Ltd. All rights reserved.