Package hudson.model

Examples of hudson.model.Descriptor


     *      The signature doesn't use {@link BuildWrapperDescriptor} to maintain compatibility
     *      with {@link BuildWrapper} implementations before 1.150.
     */
    public static List<Descriptor<BuildWrapper>> getFor(AbstractProject<?, ?> project) {
        List<Descriptor<BuildWrapper>> result = new ArrayList<Descriptor<BuildWrapper>>();
        Descriptor pd = Jenkins.getInstance().getDescriptor((Class)project.getClass());

        for (Descriptor<BuildWrapper> w : BuildWrapper.all()) {
            if (pd instanceof AbstractProjectDescriptor && !((AbstractProjectDescriptor)pd).isApplicable(w))
                continue;
            if (w instanceof BuildWrapperDescriptor) {
View Full Code Here


     * Returns the list of {@link SCMDescriptor}s that are applicable to the given project.
     */
    public static List<SCMDescriptor<?>> _for(final AbstractProject project) {
        if(project==null)   return all();
       
        final Descriptor pd = Jenkins.getInstance().getDescriptor((Class) project.getClass());
        List<SCMDescriptor<?>> r = new ArrayList<SCMDescriptor<?>>();
        for (SCMDescriptor<?> scmDescriptor : all()) {
            if(!scmDescriptor.isApplicable(project))    continue;

            if (pd instanceof AbstractProjectDescriptor) {
View Full Code Here

    }

    private List<ExtensionComponent<D>> _load(Iterable<ExtensionComponent<Descriptor>> set) {
        List<ExtensionComponent<D>> r = new ArrayList<ExtensionComponent<D>>();
        for( ExtensionComponent<Descriptor> c : set ) {
            Descriptor d = c.getInstance();
            try {
                if(d.getT()==describableType)
                    r.add((ExtensionComponent)c);
            } catch (IllegalStateException e) {
                LOGGER.log(Level.SEVERE, d.getClass() + " doesn't extend Descriptor with a type parameter", e); // skip this one
            }
        }
        return r;
    }
View Full Code Here

    /**
     * Gets the {@link JobPropertyDescriptor} by name. Primarily used for making them web-visible.
     */
    public JobPropertyDescriptor getJobProperty(String shortClassName) {
        // combining these two lines triggers javac bug. See issue #610.
        Descriptor d = findDescriptor(shortClassName, JobPropertyDescriptor.all());
        return (JobPropertyDescriptor) d;
    }
View Full Code Here

     * @throws AssertionError
     *      If the descriptor is missing.
     * @since 1.326
     */
    public Descriptor getDescriptorOrDie(Class<? extends Describable> type) {
        Descriptor d = getDescriptor(type);
        if (d==null)
            throw new AssertionError(type+" is missing its descriptor");
        return d;
    }
View Full Code Here

     *      ','-separated list of properties whose help files should exist.
     */
    public void assertHelpExists(final Class<? extends Describable> type, final String properties) throws Exception {
        executeOnServer(new Callable<Object>() {
            public Object call() throws Exception {
                Descriptor d = hudson.getDescriptor(type);
                WebClient wc = createWebClient();
                for (String property : listProperties(properties)) {
                    String url = d.getHelpFile(property);
                    assertThat("Help file for the property " + property + " is missing on " + type, url,
                            Matchers.notNullValue());
                    wc.goTo(url); // make sure it successfully loads
                }
                return null;
View Full Code Here

     * Filters a descriptor for {@link BuildStep}s by using {@link BuildStepDescriptor#isApplicable(Class)}.
     */
    public static <T extends BuildStep&Describable<T>>
    List<Descriptor<T>> filter(List<Descriptor<T>> base, Class<? extends AbstractProject> type) {
        // descriptor of the project
        Descriptor pd = Jenkins.getInstance().getDescriptor((Class) type);

        List<Descriptor<T>> r = new ArrayList<Descriptor<T>>(base.size());
        for (Descriptor<T> d : base) {
            if (pd instanceof AbstractProjectDescriptor && !((AbstractProjectDescriptor)pd).isApplicable(d))
                continue;
View Full Code Here

         * @param request the current request.
         * @return the descriptors.
         */
        public List<AbstractMetaDataValueDescriptor> getValueDescriptors(StaplerRequest request) {
            Object containerObj = request.getAttribute(REQUEST_ATTR_METADATA_CONTAINER);
            Descriptor container = null;
            if ((containerObj != null) && containerObj instanceof Descriptor) {
                container = (Descriptor)containerObj;
            }
            List<AbstractMetaDataValueDescriptor> list = new LinkedList<AbstractMetaDataValueDescriptor>();
            ExtensionList<AbstractMetaDataValueDescriptor> extensionList =
View Full Code Here

     * Returns the list of {@link SCMDescriptor}s that are applicable to the given project.
     */
    public static List<SCMDescriptor<?>> _for(final AbstractProject project) {
        if(project==null)   return all();
       
        final Descriptor pd = Hudson.getInstance().getDescriptor((Class) project.getClass());
        List<SCMDescriptor<?>> r = new ArrayList<SCMDescriptor<?>>();
        for (SCMDescriptor<?> scmDescriptor : all()) {
            if(!scmDescriptor.isApplicable(project))    continue;

            if (pd instanceof AbstractProjectDescriptor) {
View Full Code Here

     *      The signature doesn't use {@link BuildWrapperDescriptor} to maintain compatibility
     *      with {@link BuildWrapper} implementations before 1.150.
     */
    public static List<Descriptor<BuildWrapper>> getFor(AbstractProject<?, ?> project) {
        List<Descriptor<BuildWrapper>> result = new ArrayList<Descriptor<BuildWrapper>>();
        Descriptor pd = Hudson.getInstance().getDescriptor((Class)project.getClass());

        for (Descriptor<BuildWrapper> w : BuildWrapper.all()) {
            if (pd instanceof AbstractProjectDescriptor && !((AbstractProjectDescriptor)pd).isApplicable(w))
                continue;
            if (w instanceof BuildWrapperDescriptor) {
View Full Code Here

TOP

Related Classes of hudson.model.Descriptor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.