File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\core\src\main\java\hudson\cli\SetBuildDescriptionCommand.java.html

1 package hudson.cli;
2
3 import hudson.Extension;
4 import hudson.model.AbstractProject;
5 import hudson.model.Run;
6 import hudson.remoting.Callable;
7
8 import java.io.IOException;
9 import java.io.Serializable;
10
11 import org.apache.commons.io.IOUtils;
12 import org.kohsuke.args4j.Argument;
13
14 @Extension
15 public class SetBuildDescriptionCommand extends CLICommand implements Serializable {
16
17 @Override
18 public String getShortDescription() {
19 return Messages.SetBuildDescriptionCommand_ShortDescription();
20 }
21
22 @Argument(metaVar="JOB",usage="Name of the job to build",required=true,index=0)
23 public transient AbstractProject<?,?> job;
24
25 @Argument(metaVar="BUILD#",usage="Number of the build",required=true,index=1)
26 public int number;
27
28 @Argument(metaVar="DESCRIPTION",required=true,usage="Description to be set. '=' to read from stdin.", index=2)
29 public String description;
30
31 protected int run() throws Exception {
32 Run run = job.getBuildByNumber(number);
33 run.checkPermission(Run.UPDATE);
34
35 if ("=".equals(description)) {
36 description = IOUtils.toString(stdin);
37 }
38
39 run.setDescription(description);
40
41 return 0;
42 }
43
44 }
45