Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*******************************************************************************
*
* Copyright (c) 2004-2012 Oracle Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*
* Kohsuke Kawaguchi, Winston Prakash, Tom Huybrechts
*
*******************************************************************************/
package hudson.model;
import hudson.DescriptorExtensionList;
import hudson.Extension;
import hudson.ExtensionPoint;
import hudson.Util;
import hudson.model.Descriptor.FormException;
import static hudson.model.Hudson.checkGoodName;
import hudson.model.Node.Mode;
import hudson.scm.ChangeLogSet.Entry;
import hudson.search.CollectionSearchIndex;
import hudson.search.SearchIndexBuilder;
import hudson.security.*;
import hudson.util.AbstractRunList;
import hudson.util.BuildHistoryList;
import hudson.util.DescriptorList;
import hudson.util.RunList;
import hudson.widgets.Widget;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import org.eclipse.hudson.security.HudsonSecurityEntitiesHolder;
import org.eclipse.hudson.security.team.Team;
import org.eclipse.hudson.security.team.TeamManager;
import org.eclipse.hudson.security.team.TeamManager.TeamNotFoundException;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
/**
* Encapsulates the rendering of the list of {@link TopLevelItem}s that
* {@link Hudson} owns.
*
*
This is an extension point in Hudson, allowing different kind of
* rendering to be added as plugins.
*
*
Note for implementors
{@link View} subtypes need the
* newViewDetail.jelly page, which is included in the "new view" page.
* This page should have some description of what the view is about.
*
* @author Kohsuke Kawaguchi
* @see ViewDescriptor
* @see ViewGroup
*/
@ExportedBean
public abstract class View extends AbstractModelObject implements AccessControlled, Describable, ExtensionPoint {
/**
* Container of this view. Set right after the construction and never change
* thereafter.
*/
protected /*final*/ ViewGroup owner;
/**
* Name of this view.
*/
protected String name;
/**
* Message displayed in the view page.
*/
protected String description;
/**
* If true, only show relevant executors
*/
protected boolean filterExecutors;
/**
* If true, only show relevant queue items
*/
protected boolean filterQueue;
protected transient List transientActions;
protected View(String name) {
this.name = name;
}
protected View(String name, ViewGroup owner) {
this.name = name;
this.owner = owner;
}
/**
* Gets all the items in this collection in a read-only view.
*/
@Exported(name = "jobs")
public abstract Collection getItems();
/**
* Gets the {@link TopLevelItem} of the given name.
*/
public TopLevelItem getItem(String name) {
return Hudson.getInstance().getItem(name);
}
/**
* Alias for {@link #getItem(String)}. This is the one used in the URL
* binding.
*/
public final TopLevelItem getJob(String name) {
return getItem(name);
}
/**
* Checks if the job is in this collection.
*/
public abstract boolean contains(TopLevelItem item);
/**
* Gets the name of all this collection.
*
* @see #rename(String)
*/
@Exported(visibility = 2, name = "name")
public String getViewName() {
return name;
}
/**
* Renames this view.
*/
public void rename(String newName) throws Failure, FormException {
if (name.equals(newName)) {
return; // noop
}
checkGoodName(newName);
if (owner.getView(newName) != null) {
throw new FormException(Messages.Hudson_ViewAlreadyExists(newName), "name");
}
String oldName = name;
name = newName;
owner.onViewRenamed(this, oldName, newName);
}
/**
* Gets the {@link ViewGroup} that this view belongs to.
*/
public ViewGroup getOwner() {
return owner;
}
/**
* Message displayed in the top page. Can be null. Includes HTML.
*/
@Exported
public String getDescription() {
return description;
}
public ViewDescriptor getDescriptor() {
return (ViewDescriptor) Hudson.getInstance().getDescriptorOrDie(getClass());
}
public String getDisplayName() {
return getViewName();
}
/**
* By default, return true to render the "Edit view" link on the page. This
* method is really just for the default "All" view to hide the edit link so
* that the default Hudson top page remains the same as before 1.316.
*
* @since 1.316
*/
public boolean isEditable() {
return true;
}
/**
* If true, only show relevant executors
*/
public boolean isFilterExecutors() {
return filterExecutors;
}
/**
* If true, only show relevant queue items
*/
public boolean isFilterQueue() {
return filterQueue;
}
/**
* Gets the {@link Widget}s registered on this object.
*
*
For now, this just returns the widgets registered to Hudson.
*/
public List getWidgets() {
return Collections.unmodifiableList(Hudson.getInstance().getWidgets());
}
/**
* If true, this is a view that renders the top page of Hudson.
*/
public boolean isDefault() {
return Hudson.getInstance().getPrimaryView() == this;
}
public List getComputers() {
Computer[] computers = Hudson.getInstance().getComputers();
if (!isFilterExecutors()) {
return Arrays.asList(computers);
}
List result = new ArrayList();
boolean roam = false;
HashSet