public String getDisplayName() { Set<SCMDescriptor<?>> descriptors = new HashSet<SCMDescriptor<?>>(); for (SCM scm : job().getSCMs()) { descriptors.add(scm.getDescriptor()); } return descriptors.size() == 1 ? Messages.SCMTrigger_getDisplayName(descriptors.iterator().next().getDisplayName()) : Messages.SCMTrigger_BuildAction_DisplayName(); }
/** * 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; } }
/** * Picks up a {@link RepositoryBrowser} that matches the * given {@link SCM} from existing other jobs. * * @return * null if no applicable configuration was found. */ private RepositoryBrowser infer() { for( AbstractProject p : Jenkins.getInstance().allItems(AbstractProject.class) ) { SCM scm = p.getScm(); if (scm!=null && scm.getClass()==owner.getClass() && scm.getBrowser()!=null && ((SCMDescriptor)scm.getDescriptor()).isBrowserReusable(scm,owner)) { return scm.getBrowser(); } } return null; } }
@Override public SCM newInstance(StaplerRequest req, JSONObject formData) throws FormException { return super.newInstance(req, formData); }
public boolean superConfigure(StaplerRequest req, JSONObject json) throws FormException { return super.configure(req, json); }
public void superLoad() { super.load(); }
@Override public SCM newInstance(StaplerRequest staplerRequest, JSONObject jsonObject) throws FormException { return super.newInstance(staplerRequest, jsonObject); }
public boolean superConfigure(StaplerRequest req) throws FormException { return super.configure(req); }
@SuppressWarnings({"ConstantConditions"}) @Override public void load() { initPython(); if (pexec.isImplemented(0)) { pexec.execPythonVoid("load"); } else { super.load(); } }
@Override public SCM newInstance(StaplerRequest staplerRequest, JSONObject jsonObject) throws FormException { return super.newInstance(staplerRequest, jsonObject); }
List<String> scmNames = new ArrayList<>(); for (SCM s : scmItem.getSCMs()) { scmNames.add(s.getDescriptor().getDisplayName());
@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 configure(StaplerRequest req, JSONObject formData) throws FormException { save(); return super.configure(req,formData); }
public boolean superIsBrowserReusable(T x, T y) { return super.isBrowserReusable(x, y); }
@Override public void load() { super.load(); if (credentials != null && !credentials.isEmpty()) { SecurityContext oldContext = ACL.impersonate(ACL.SYSTEM); try { BulkChange bc = new BulkChange(this); try { mayHaveLegacyPerJobCredentials = true; CredentialsStore store = CredentialsProvider.lookupStores(Jenkins.getInstance()).iterator().next(); for (Map.Entry<String, Credential> e : credentials.entrySet()) { migrateCredentials(store, e.getKey(), e.getValue()); } save(); bc.commit(); } catch (IOException e) { LOGGER.log(Level.WARNING, "Could not migrate stored credentials", e); } finally { bc.abort(); } } finally { SecurityContextHolder.setContext(oldContext); } } }
@Override public SCM newInstance(StaplerRequest req, JSONObject formData) throws FormException { return super.newInstance(req, formData); }
public String getDisplayName() { Set<SCMDescriptor<?>> descriptors = new HashSet<SCMDescriptor<?>>(); for (SCM scm : job().getSCMs()) { descriptors.add(scm.getDescriptor()); } return descriptors.size() == 1 ? Messages.SCMTrigger_getDisplayName(descriptors.iterator().next().getDisplayName()) : Messages.SCMTrigger_BuildAction_DisplayName(); }
/** * 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; }
@Override public boolean configure(StaplerRequest req, JSONObject json) throws FormException { save(); return super.configure(req, json); } }
@Override public boolean isBrowserReusable(T x, T y) { initPython(); if (pexec.isImplemented(1)) { return pexec.execPythonBool("is_browser_reusable", x, y); } else { return super.isBrowserReusable(x, y); } }