View Javadoc

1   package org.rundeck.api;
2   
3   import java.util.Properties;
4   
5   /**
6    * Job run request builder
7    */
8   public class RunJobBuilder {
9       private DefaultRunJob jobRun;
10  
11      public static RunJobBuilder builder() {
12          return new RunJobBuilder();
13      }
14  
15      public RunJobBuilder() {
16          jobRun = new DefaultRunJob();
17      }
18  
19      public RunJobBuilder setJobId(String jobId) {
20          jobRun.setJobId(jobId);
21          return this;
22      }
23  
24      public RunJobBuilder setOptions(Properties options) {
25          jobRun.setOptions(options);
26          return this;
27      }
28  
29      public RunJobBuilder setNodeFilters(Properties nodeFilters) {
30          jobRun.setNodeFilters(nodeFilters);
31          return this;
32      }
33  
34      public RunJobBuilder setAsUser(String asUser) {
35          jobRun.setAsUser(asUser);
36          return this;
37      }
38  
39      public RunJob build() {
40          RunJob built = jobRun;
41          jobRun = new DefaultRunJob();
42          return built;
43      }
44  }