hudson.model.View Java Examples
The following examples show how to use
hudson.model.View.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GitLabTagFilter.java From gitlab-branch-source-plugin with GNU General Public License v2.0 | 5 votes |
@Override public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) { for (TopLevelItem item : all) { if (added.contains(item)) { continue; } if (SCMHead.HeadByItem.findHead(item) instanceof GitLabSCMTagHead) { added.add(item); } } return added; }
Example #2
Source File: ConfigurationAsCodeTest.java From jenkins-build-monitor-plugin with MIT License | 5 votes |
@Test public void should_support_configuration_as_code() { Collection<View> views = Jenkins.getInstance().getViews(); assertThat(views.size(), is(1)); BuildMonitorView view = (BuildMonitorView) views.iterator().next(); assertThat(view.getTitle(), is("My Monitor")); assertThat(view.getIncludeRegex(), is(".+\\/(my-job-.*)\\/(master|demo)")); assertThat(view.getViewName(), is("My-Monitor")); assertThat(view.isRecurse(), is(true)); }
Example #3
Source File: RelativeLocation.java From jenkins-build-monitor-plugin with MIT License | 5 votes |
public String name() { ItemGroup ig = null; StaplerRequest request = Stapler.getCurrentRequest(); for( Ancestor a : request.getAncestors() ) { if(a.getObject() instanceof BuildMonitorView) { ig = ((View) a.getObject()).getOwnerItemGroup(); } } return Functions.getRelativeDisplayNameFrom(job, ig); }
Example #4
Source File: OrganizationContainer.java From DotCi with MIT License | 5 votes |
private void init(final String name) { if (this.icon == null) { this.icon = new OrganizationGravatarIcon(name); } this.mixin = new MixInImpl(this); if (this.views == null) { this.views = new CopyOnWriteArrayList<>(); } if (this.views.size() == 0) { final AllListView lv = new AllListView(this); this.views.add(lv); } if (this.viewsTabBar == null) { this.viewsTabBar = new DefaultViewsTabBar(); } if (this.primaryView == null) { this.primaryView = this.views.get(0).getViewName(); } this.mixin = new MixInImpl(this); this.viewGroupMixIn = new ViewGroupMixIn(this) { @Override protected List<View> views() { return OrganizationContainer.this.views; } @Override protected String primaryView() { return OrganizationContainer.this.primaryView; } @Override protected void primaryView(final String name) { OrganizationContainer.this.primaryView = name; } }; this.items = new CopyOnWriteMap.Tree<>(CaseInsensitiveComparator.INSTANCE); this.items = getJobsForThisContainer(); }
Example #5
Source File: TemplateDrivenMultiBranchProject.java From multi-branch-project-plugin with MIT License | 5 votes |
/** * Overrides view initialization to use BranchListView instead of AllView. * <br> * {@inheritDoc} */ @Override protected void initViews(List<View> views) throws IOException { BranchListView v = new BranchListView("All", this); v.setIncludeRegex(".*"); views.add(v); v.save(); }
Example #6
Source File: GitHubBranchFilter.java From github-branch-source-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) { for (TopLevelItem item:all) { if (added.contains(item)) { continue; } if (SCMHead.HeadByItem.findHead(item) instanceof BranchSCMHead) { added.add(item); } } return added; }
Example #7
Source File: GitHubPullRequestFilter.java From github-branch-source-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) { for (TopLevelItem item:all) { if (added.contains(item)) { continue; } if (SCMHead.HeadByItem.findHead(item) instanceof PullRequestSCMHead) { added.add(item); } } return added; }
Example #8
Source File: MockFolder.java From jenkins-test-harness with MIT License | 5 votes |
private ViewGroupMixIn vgmixin() { return new ViewGroupMixIn(this) { @Override protected List<View> views() { return views; } @Override protected String primaryView() { return primaryView != null ? primaryView : views.get(0).getViewName(); } @Override protected void primaryView(String newName) { primaryView = newName; } }; }
Example #9
Source File: ViewTracker.java From rocket-chat-notifier with Apache License 2.0 | 5 votes |
private void ensureInitialState(Collection<View> affectedViews) { for (View view : affectedViews) { String key = key(view); if (!results.containsKey(key)) { results.put(key, getResult(view)); } } }
Example #10
Source File: ViewTracker.java From rocket-chat-notifier with Apache License 2.0 | 5 votes |
private Result getResult(View view) { Result ret = Result.SUCCESS; for (TopLevelItem item : view.getAllItems()) { for (Job<?,?> job : item.getAllJobs()) { Run<?, ?> build = job.getLastCompletedBuild(); if(build != null) { Result result = build.getResult(); if(result.isBetterOrEqualTo(Result.FAILURE)) ret = ret.combine(result); } } } return ret; }
Example #11
Source File: FolderAuthorizationStrategyManagementLink.java From folder-auth-plugin with MIT License | 5 votes |
@Nonnull @Restricted(NoExternalUse.class) @SuppressWarnings("unused") // used by index.jelly public Set<Permission> getAgentPermissions() { HashSet<PermissionGroup> groups = new HashSet<>(PermissionGroup.getAll()); groups.remove(PermissionGroup.get(Run.class)); groups.remove(PermissionGroup.get(SCM.class)); groups.remove(PermissionGroup.get(View.class)); groups.remove(PermissionGroup.get(Item.class)); groups.remove(PermissionGroup.get(Hudson.class)); groups.remove(PermissionGroup.get(Permission.class)); return getSafePermissions(groups); }
Example #12
Source File: ViewTracker.java From rocket-chat-notifier with Apache License 2.0 | 5 votes |
private void fireDifference(Collection<View> affectedViews) { for (View view : affectedViews) { String key = key(view); Result newResult = getResult(view); Result oldResult = results.get(key); if(oldResult != null && !oldResult.equals(newResult)) { results.put(key, newResult); fireViewChanged(view, oldResult, newResult); } } }
Example #13
Source File: GitLabMergeRequestFilter.java From gitlab-branch-source-plugin with GNU General Public License v2.0 | 5 votes |
@Override public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) { for (TopLevelItem item : all) { if (added.contains(item)) { continue; } SCMHead head = SCMHead.HeadByItem.findHead(item); if (head instanceof GitLabSCMMergeRequestHead && (!originOnly || ((GitLabSCMMergeRequestHead) head).fromOrigin())) { added.add(item); } } return added; }
Example #14
Source File: ViewTracker.java From rocket-chat-notifier with Apache License 2.0 | 5 votes |
public void trackViews(Run<?, ?> run) { Collection<View> affectedViews = getViewsAffectedBy(run); if (run.isBuilding()) { ensureInitialState(affectedViews); } else { fireDifference(affectedViews); } }
Example #15
Source File: GitLabBranchFilter.java From gitlab-branch-source-plugin with GNU General Public License v2.0 | 5 votes |
@Override public List<TopLevelItem> filter(List<TopLevelItem> added, List<TopLevelItem> all, View filteringView) { for (TopLevelItem item : all) { if (added.contains(item)) { continue; } SCMHead head = SCMHead.HeadByItem.findHead(item); if (head instanceof GitLabSCMBranchHead && filter(item) && filter((GitLabSCMBranchHead) head)) { added.add(item); } } return added; }
Example #16
Source File: ViewTracker.java From rocket-chat-notifier with Apache License 2.0 | 5 votes |
private Collection<View> getViewsAffectedBy(Run<?, ?> run) { Collection<View> views = Jenkins.getInstance().getViews(); List<View> affected = new ArrayList<>(views.size()); TopLevelItem parent = getTopLevelParent(run); if (parent != null) { for (View view : views) { if (view.contains(parent)) { affected.add(view); } } } else { LOG.log(Level.WARNING, run.getParent().getClass() + " not instanceof TopLevelItem"); } return affected; }
Example #17
Source File: MockFolder.java From jenkins-test-harness with MIT License | 4 votes |
@Override public void onViewRenamed(View view, String oldName, String newName) { vgmixin().onViewRenamed(view, oldName, newName); }
Example #18
Source File: OrganizationContainer.java From DotCi with MIT License | 4 votes |
@Override public void onViewRenamed(final View view, final String oldName, final String newName) { throw new UnsupportedOperationException(); }
Example #19
Source File: OrganizationContainer.java From DotCi with MIT License | 4 votes |
@Override public View getPrimaryView() { return this.viewGroupMixIn.getPrimaryView(); }
Example #20
Source File: OrganizationContainer.java From DotCi with MIT License | 4 votes |
@Override public View getView(final String name) { return this.viewGroupMixIn.getView(name); }
Example #21
Source File: OrganizationContainer.java From DotCi with MIT License | 4 votes |
@Override public Collection<View> getViews() { return this.viewGroupMixIn.getViews(); }
Example #22
Source File: OrganizationContainer.java From DotCi with MIT License | 4 votes |
@Override public void deleteView(final View view) throws IOException { throw new UnsupportedOperationException(); }
Example #23
Source File: OrganizationContainer.java From DotCi with MIT License | 4 votes |
@Override public boolean canDelete(final View view) { return false; }
Example #24
Source File: RocketChatNotifier.java From rocket-chat-notifier with Apache License 2.0 | 4 votes |
@Override public void fireViewChanged(View view, Result oldResult, Result newResult) { chat(format("view/%s, %s -> %s", view.getDisplayName(), oldResult, newResult)); }
Example #25
Source File: ViewTracker.java From rocket-chat-notifier with Apache License 2.0 | 4 votes |
private void fireViewChanged(View view, Result oldResult, Result newResult) { for (ViewListener viewListener : listeners) { viewListener.fireViewChanged(view, oldResult, newResult); } }
Example #26
Source File: MockFolder.java From jenkins-test-harness with MIT License | 4 votes |
@Override public View getPrimaryView() { return vgmixin().getPrimaryView(); }
Example #27
Source File: MockFolder.java From jenkins-test-harness with MIT License | 4 votes |
@Override public View getView(String name) { return vgmixin().getView(name); }
Example #28
Source File: MockFolder.java From jenkins-test-harness with MIT License | 4 votes |
@Override public Collection<View> getViews() { return vgmixin().getViews(); }
Example #29
Source File: MockFolder.java From jenkins-test-harness with MIT License | 4 votes |
@Override public void deleteView(View view) throws IOException { vgmixin().deleteView(view); }
Example #30
Source File: MockFolder.java From jenkins-test-harness with MIT License | 4 votes |
@Override public boolean canDelete(View view) { return vgmixin().canDelete(view); }