View Javadoc

1   package org.rundeck.api;
2   
3   import java.util.Properties;
4   
5   /**
6    * Builder for adhoc command request
7    */
8   public class RunAdhocCommandBuilder {
9       private DefaultRunAdhocCommand command;
10  
11      public RunAdhocCommandBuilder() {
12          command = new DefaultRunAdhocCommand();
13      }
14  
15      public static RunAdhocCommandBuilder builder() {
16          return new RunAdhocCommandBuilder();
17      }
18  
19      public RunAdhocCommandBuilder setProject(String project) {
20          command.setProject(project);
21  
22          return this;
23      }
24  
25      public RunAdhocCommandBuilder setCommand(String commandString) {
26          command.setCommand(commandString);
27          return this;
28      }
29  
30      public RunAdhocCommandBuilder setNodeFilters(Properties nodeFilters) {
31          command.setNodeFilters(nodeFilters);
32          return this;
33      }
34  
35      public RunAdhocCommandBuilder setNodeThreadcount(Integer nodeThreadcount) {
36          command.setNodeThreadcount(nodeThreadcount);
37          return this;
38      }
39  
40      public RunAdhocCommandBuilder setNodeKeepgoing(Boolean nodeKeepgoing) {
41          command.setNodeKeepgoing(nodeKeepgoing);
42          return this;
43      }
44  
45      public RunAdhocCommandBuilder setAsUser(String asUser) {
46          command.setAsUser(asUser);
47          return this;
48      }
49  
50      public RunAdhocCommand build() {
51          DefaultRunAdhocCommand built = command;
52          command = new DefaultRunAdhocCommand();
53          return built;
54      }
55  }