TopLevelItemDescriptor.java 1.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
package hudson.model;

import org.kohsuke.stapler.StaplerRequest;

import java.util.List;
import java.util.ArrayList;

/**
 * {@link Descriptor} for {@link TopLevelItem}s.
 *
 * @author Kohsuke Kawaguchi
 */
public abstract class TopLevelItemDescriptor extends Descriptor<TopLevelItem> {
    protected TopLevelItemDescriptor(Class<? extends TopLevelItem> clazz) {
        super(clazz);
    }

K
kohsuke 已提交
18 19 20 21 22 23 24 25 26 27 28
    /**
     * {@inheritDoc}
     *
     * <p>
     * Used as the caption when the user chooses what job type to create.
     * The descriptor implementation also needs to have <tt>detail.jelly</tt>
     * script, which will be used to render the text below the caption
     * that expains the job type.
     */
    public abstract String getDisplayName();

29 30 31 32
    public final String getNewJobDetailPage() {
        return '/'+clazz.getName().replace('.','/').replace('$','/')+"/newJobDetail.jelly";
    }

33 34 35 36 37 38 39 40 41 42 43 44 45 46
    /**
     * @deprecated
     *      This is not a valid operation for {@link Job}s.
     */
    @Deprecated
    public TopLevelItem newInstance(StaplerRequest req) throws FormException {
        throw new UnsupportedOperationException();
    }

    /**
     * Creates a new {@link Job}.
     */
    public abstract TopLevelItem newInstance(String name);
}