/** * Allows {@link SCMDescriptor}s to choose which projects it wants to be configurable against. * * <p> * When this method returns false, this {@link SCM} will not appear in the configuration screen * for the given project. The default is true for {@link AbstractProject} but false for {@link Job}. * * @since 1.568 */ public boolean isApplicable(Job project) { if (project instanceof AbstractProject) { return isApplicable((AbstractProject) project); } else { return false; } }
@Deprecated public boolean isApplicable(AbstractProject project) { if (Util.isOverridden(SCMDescriptor.class, getClass(), "isApplicable", Job.class)) { return isApplicable((Job) project); } else { return true; } }
/** * Determines which kinds of SCMs are applicable to a given project. * @param project a project on which we might be configuring SCM, or null if unknown * @return all descriptors which {@link SCMDescriptor#isApplicable(Job)} to it, also filtered by {@link TopLevelItemDescriptor#isApplicable}; * or simply {@link #all} if there is no project * @since 1.568 */ public static List<SCMDescriptor<?>> _for(@CheckForNull final Job 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 TopLevelItemDescriptor) { TopLevelItemDescriptor apd = (TopLevelItemDescriptor) pd; if(!apd.isApplicable(scmDescriptor)) continue; } r.add(scmDescriptor); } return r; }
public boolean superIsApplicable(AbstractProject project) { return super.isApplicable(project); }
/** * Allows {@link SCMDescriptor}s to choose which projects it wants to be configurable against. * * <p> * When this method returns false, this {@link SCM} will not appear in the configuration screen * for the given project. The default is true for {@link AbstractProject} but false for {@link Job}. * * @since 1.568 */ public boolean isApplicable(Job project) { if (project instanceof AbstractProject) { return isApplicable((AbstractProject) project); } else { return false; } }
@Deprecated public boolean isApplicable(AbstractProject project) { if (Util.isOverridden(SCMDescriptor.class, getClass(), "isApplicable", Job.class)) { return isApplicable((Job) project); } else { return true; } }
@Override public boolean isApplicable(Descriptor descriptor) { if (descriptor instanceof SCMDescriptor) { SCMDescriptor d = (SCMDescriptor) descriptor; // TODO would prefer to have SCMDescriptor.isApplicable(Class<? extends Job>) try { if (!d.isApplicable(new WorkflowJob(null, null))) { return false; } } catch (RuntimeException x) { LOGGER.log(Level.FINE, "SCMDescriptor.isApplicable hack failed", x); } } return super.isApplicable(descriptor); }
@Override public boolean isApplicable(Descriptor descriptor) { if (descriptor instanceof SCMDescriptor) { SCMDescriptor d = (SCMDescriptor) descriptor; // TODO would prefer to have SCMDescriptor.isApplicable(Class<? extends Job>) try { if (!d.isApplicable(new WorkflowJob(null, null))) { return false; } } catch (RuntimeException x) { LOGGER.log(Level.FINE, "SCMDescriptor.isApplicable hack failed", x); } } return super.isApplicable(descriptor); }
@Override public boolean isApplicable(AbstractProject project) { initPython(); if (pexec.isImplemented(2)) { return pexec.execPythonBool("is_applicable", project); } else { return super.isApplicable(project); } }
/** * Determines which kinds of SCMs are applicable to a given project. * @param project a project on which we might be configuring SCM, or null if unknown * @return all descriptors which {@link SCMDescriptor#isApplicable(Job)} to it, also filtered by {@link TopLevelItemDescriptor#isApplicable}; * or simply {@link #all} if there is no project * @since 1.568 */ public static List<SCMDescriptor<?>> _for(@CheckForNull final Job 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 TopLevelItemDescriptor) { TopLevelItemDescriptor apd = (TopLevelItemDescriptor) pd; if(!apd.isApplicable(scmDescriptor)) continue; } r.add(scmDescriptor); } return r; }
/** * 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) { AbstractProjectDescriptor apd = (AbstractProjectDescriptor) pd; if(!apd.isApplicable(scmDescriptor)) continue; } r.add(scmDescriptor); } return r; } }
/** * 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) { AbstractProjectDescriptor apd = (AbstractProjectDescriptor) pd; if(!apd.isApplicable(scmDescriptor)) continue; } r.add(scmDescriptor); } return r; } }
/** * 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) { AbstractProjectDescriptor apd = (AbstractProjectDescriptor) pd; if(!apd.isApplicable(scmDescriptor)) continue; } r.add(scmDescriptor); } return r; } }
/** * 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) { AbstractProjectDescriptor apd = (AbstractProjectDescriptor) pd; if (!apd.isApplicable(scmDescriptor)) { continue; } } r.add(scmDescriptor); } return r; } }