/** @see View#getAsynchPeople */ public AsynchPeople(View parent) { this.parent = parent; items = parent.getItems(); unknown = null; }
protected Collection<TopLevelItem> all() { return getItems(); } @Override
/** * Does this {@link View} has any associated user information recorded? * @deprecated Potentially very expensive call; do not use from Jelly views. */ @Deprecated public boolean hasPeople() { return People.isApplicable(getItems()); }
@Override public Collection<TopLevelItem> getItems() { return getProxiedView().getItems(); }
private List<Queue.Item> filterQueue(List<Queue.Item> base) { if (!isFilterQueue()) { return base; } Collection<TopLevelItem> items = getItems(); return base.stream().filter(qi -> filterQueueItemTest(qi, items)) .collect(Collectors.toList()); }
/** * Gets all the items recursively contained in this collection in a read-only view. * <p> * The default implementation recursively adds the items of all contained Views * in case this view implements {@link ViewGroup}, which should be enough for most cases. * * @since 1.520 */ public Collection<TopLevelItem> getAllItems() { if (this instanceof ViewGroup) { final Collection<TopLevelItem> items = new LinkedHashSet<TopLevelItem>(getItems()); for(View view: ((ViewGroup) this).getViews()) { items.addAll(view.getAllItems()); } return Collections.unmodifiableCollection(items); } else { return getItems(); } }
public RunList(View view) {// this is a type unsafe operation Set<Job> jobs = new HashSet<Job>(); for (TopLevelItem item : view.getItems()) jobs.addAll(item.getAllJobs()); List<Iterable<R>> runLists = new ArrayList<Iterable<R>>(); for (Job job : jobs) { runLists.add(job.getBuilds()); } this.base = combine(runLists); }
public People(View parent) { this.parent = parent; this.users = toList(getUserInfo(parent.getItems())); }
public void doRssLatest( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { List<Run> lastBuilds = new ArrayList<Run>(); for (TopLevelItem item : getItems()) { if (item instanceof Job) { Job job = (Job) item; Run lb = job.getLastBuild(); if(lb!=null) lastBuilds.add(lb); } } RSS.forwardToRss(getDisplayName()+" last builds only", getUrl(), lastBuilds, Run.FEED_ADAPTER_LATEST, req, rsp ); }
public List<Computer> getComputers() { Computer[] computers = Jenkins.getInstance().getComputers(); if (!isFilterExecutors()) { return Arrays.asList(computers); } List<Computer> result = new ArrayList<Computer>(); HashSet<Label> labels = new HashSet<Label>(); for (Item item : getItems()) { if (item instanceof AbstractProject<?, ?>) { labels.addAll(((AbstractProject<?, ?>) item).getRelevantLabels()); } } for (Computer c : computers) { if (isRelevant(labels, c)) result.add(c); } return result; }
@Override public SearchIndexBuilder makeSearchIndex() { SearchIndexBuilder sib = super.makeSearchIndex(); sib.add(new CollectionSearchIndex<TopLevelItem>() {// for jobs in the view protected TopLevelItem get(String key) { return getItem(key); } protected Collection<TopLevelItem> all() { return getItems(); } @Override protected String getName(TopLevelItem o) { // return the name instead of the display for suggestion searching return o.getName(); } }); // add the display name for each item in the search index addDisplayNamesToSearchIndex(sib, getItems()); return sib; }
/** * Implementation can choose to provide different ACL for different views. * This can be used as a basis for more fine-grained access control. * * <p> * The default implementation makes the view visible if any of the items are visible * or the view is configurable. * * @since 1.220 */ public @Nonnull ACL getACL(final @Nonnull View item) { return ACL.lambda((a, permission) -> { ACL base = item.getOwner().getACL(); boolean hasPermission = base.hasPermission(a, permission); if (!hasPermission && permission == View.READ) { return base.hasPermission(a,View.CONFIGURE) || !item.getItems().isEmpty(); } return hasPermission; }); }
public ModelObjectWithContextMenu.ContextMenu doChildrenContextMenu(StaplerRequest request, StaplerResponse response) throws Exception { ModelObjectWithContextMenu.ContextMenu m = new ModelObjectWithContextMenu.ContextMenu(); for (TopLevelItem i : getItems()) m.add(i.getShortUrl(),i.getDisplayName()); return m; }
@Restricted(NoExternalUse.class) // for cc.xml.jelly public static Collection<TopLevelItem> getCCItems(View v) { if (Stapler.getCurrentRequest().getParameter("recursive") != null) { return v.getOwner().getItemGroup().getAllItems(TopLevelItem.class); } else { return v.getItems(); } }
/** @see View#getAsynchPeople */ public AsynchPeople(View parent) { this.parent = parent; items = parent.getItems(); unknown = null; }
/** * Does this {@link View} has any associated user information recorded? * @deprecated Potentially very expensive call; do not use from Jelly views. */ @Deprecated public boolean hasPeople() { return People.isApplicable(getItems()); }
private List<Queue.Item> filterQueue(List<Queue.Item> base) { if (!isFilterQueue()) { return base; } Collection<TopLevelItem> items = getItems(); return base.stream().filter(qi -> filterQueueItemTest(qi, items)) .collect(Collectors.toList()); }
public RunList(View view) {// this is a type unsafe operation Set<Job> jobs = new HashSet<Job>(); for (TopLevelItem item : view.getItems()) jobs.addAll(item.getAllJobs()); List<Iterable<R>> runLists = new ArrayList<Iterable<R>>(); for (Job job : jobs) { runLists.add(job.getBuilds()); } this.base = combine(runLists); }
public RunList(View view) {// this is a type unsafe operation for (Item item : view.getItems()) for (Job<?,?> j : item.getAllJobs()) addAll((Collection<R>)j.getBuilds()); Collections.sort(this,Run.ORDER_BY_DATE); }
private static void healthCounter(HealthReportContainer hrc, View view) { if (view instanceof NestedView) { for (View v : ((NestedView)view).getViews()) healthCounter(hrc, v); } else { for (TopLevelItem item : view.getItems()) if (item instanceof Job) { hrc.sum += ((Job)item).getBuildHealth().getScore(); hrc.count++; } } }