PageRenderTime 13ms CodeModel.GetById 1ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/hudson-core/src/main/java/hudson/cli/AbstractBuildRangeCommand.java

http://github.com/hudson/hudson
Java | 30 lines | 18 code | 7 blank | 5 comment | 0 complexity | 28b3b30794f157b9b7fb1203e00f8132 MD5 | raw file
 1package hudson.cli;
 2
 3import hudson.model.AbstractBuild;
 4import hudson.model.AbstractProject;
 5import hudson.model.Fingerprint.RangeSet;
 6import org.kohsuke.args4j.Argument;
 7
 8import java.io.IOException;
 9import java.util.List;
10
11/**
12 * {@link CLICommand} that acts on a series of {@link AbstractBuild}s.
13 *
14 * @author Kohsuke Kawaguchi
15 */
16public abstract class AbstractBuildRangeCommand extends CLICommand {
17    @Argument(metaVar="JOB",usage="Name of the job to build",required=true,index=0)
18    public AbstractProject<?,?> job;
19
20    @Argument(metaVar="RANGE",usage="Range of the build records to delete. 'N-M', 'N,M', or 'N'",required=true,index=1)
21    public String range;
22
23    protected int run() throws Exception {
24        RangeSet rs = RangeSet.fromString(range,false);
25
26        return act((List)job.getBuilds(rs));
27    }
28
29    protected abstract int act(List<AbstractBuild<?,?>> builds) throws IOException;
30}