@ExportedBean public abstract class View extends AbstractModelObject implements AccessControlled, Describable<View>, ExtensionPoint, Saveable, ModelObjectWithChildren
TopLevelItem
s
that Jenkins
owns.
This is an extension point in Hudson, allowing different kind of rendering to be added as plugins.
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.
ViewDescriptor
,
ViewGroup
Modifier and Type | Class and Description |
---|---|
static class |
View.AsynchPeople
Variant of
View.AsynchPeople.People which can be displayed progressively, since it may be slow. |
static class |
View.People |
static class |
View.PropertyList |
static class |
View.UserInfo |
ExtensionPoint.LegacyInstancesAreScopedToHudson
Modifier and Type | Field and Description |
---|---|
static Permission |
CONFIGURE |
static Permission |
CREATE
Permission to create new views.
|
static Permission |
DELETE |
protected String |
description
Message displayed in the view page.
|
protected boolean |
filterExecutors
If true, only show relevant executors
|
protected boolean |
filterQueue
If true, only show relevant queue items
|
static DescriptorList<View> |
LIST
|
protected String |
name
Name of this view.
|
static AlternativeUiTextProvider.Message<View> |
NEW_PRONOUN
"Job" in "New Job".
|
protected ViewGroup |
owner
Container of this view.
|
static PermissionGroup |
PERMISSIONS |
static Permission |
READ |
static Comparator<View> |
SORTER |
Modifier | Constructor and Description |
---|---|
protected |
View(String name) |
protected |
View(String name,
ViewGroup owner) |
Modifier and Type | Method and Description |
---|---|
static DescriptorExtensionList<View,ViewDescriptor> |
all()
Returns all the registered
ViewDescriptor s. |
static List<ViewDescriptor> |
allInstantiable()
Returns the
ViewDescriptor instances that can be instantiated for the ViewGroup in the current
StaplerRequest . |
abstract boolean |
contains(TopLevelItem item)
Checks if the job is in this collection.
|
static View |
create(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp,
ViewGroup owner) |
static View |
createViewFromXML(String name,
InputStream xml)
Instantiate View subtype from XML stream.
|
FormValidation |
doCheckJobName(String value)
Makes sure that the given name is good as a job name.
|
ModelObjectWithContextMenu.ContextMenu |
doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest request,
org.kohsuke.stapler.StaplerResponse response)
Generates the context menu to list up all the children.
|
org.kohsuke.stapler.HttpResponse |
doConfigDotXml(org.kohsuke.stapler.StaplerRequest req)
Accepts
config.xml submission, as well as serve it. |
void |
doConfigSubmit(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Accepts submission from the configuration page.
|
abstract Item |
doCreateItem(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Creates a new
Item in this collection. |
void |
doDoDelete(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Deletes this view.
|
Categories |
doItemCategories(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp,
String iconStyle)
An API REST method to get the allowed {$link TopLevelItem}s and its categories.
|
void |
doRssAll(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp) |
void |
doRssFailed(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp) |
void |
doRssLatest(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp) |
void |
doSubmitDescription(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Accepts the new description.
|
String |
getAbsoluteUrl()
Gets the absolute URL of this view.
|
ACL |
getACL()
Returns the
ACL for this object. |
List<Action> |
getActions()
Returns the transient
Action s associated with the top page. |
Collection<TopLevelItem> |
getAllItems()
Gets all the items recursively contained in this collection in a read-only view.
|
List<ViewProperty> |
getAllProperties()
List of all
ViewProperty s exposed primarily for the remoting API. |
Api |
getApi() |
List<ViewPropertyDescriptor> |
getApplicablePropertyDescriptors()
Returns all the
ViewPropertyDescriptor s that can be potentially configured
on this view. |
List<Queue.Item> |
getApproximateQueueItemsQuickly()
Deprecated.
Use
getQueueItems() . As of 1.607 the approximation is no longer needed. |
View.AsynchPeople |
getAsynchPeople() |
RunList |
getBuilds() |
Iterable<? extends ListViewColumn> |
getColumns()
If this view uses
<t:projectView> for rendering, this method returns columns to be displayed. |
List<Computer> |
getComputers() |
String |
getDescription()
Message displayed in the top page.
|
ViewDescriptor |
getDescriptor()
Gets the descriptor for this instance.
|
String |
getDisplayName() |
Object |
getDynamic(String token) |
Indenter |
getIndenter()
If this view uses
t:projectView for rendering, this method returns the indenter used
to indent each row. |
TopLevelItem |
getItem(String name)
Gets the
TopLevelItem of the given name. |
static Permission |
getItemCreatePermission() |
abstract Collection<TopLevelItem> |
getItems()
Gets all the items in this collection in a read-only view.
|
TopLevelItem |
getJob(String name)
Alias for
getItem(String) . |
String |
getNewPronoun() |
ViewGroup |
getOwner()
Gets the
ViewGroup that this view belongs to. |
ItemGroup<? extends TopLevelItem> |
getOwnerItemGroup()
Deprecated.
call
ViewGroup.getItemGroup() directly |
View |
getOwnerPrimaryView()
Deprecated.
call
ViewGroup.getPrimaryView() directly |
List<Action> |
getOwnerViewActions()
Deprecated.
call
ViewGroup.getViewActions() directly |
View.People |
getPeople()
Gets the users that show up in the changelog of this job collection.
|
String |
getPostConstructLandingPage()
Returns the page to redirect the user to, after the view is created.
|
DescribableList<ViewProperty,ViewPropertyDescriptor> |
getProperties()
Gets the view properties configured for this view.
|
List<Queue.Item> |
getQueueItems() |
String |
getSearchUrl()
Returns the URL of this item relative to the parent
SearchItem . |
BuildTimelineWidget |
getTimeline() |
String |
getUrl()
Returns the path relative to the context root.
|
String |
getViewName()
Gets the name of all this collection.
|
String |
getViewUrl()
Same as
getUrl() except this returns a view/{name} path
even for the default view. |
List<ViewPropertyDescriptor> |
getVisiblePropertyDescriptors() |
List<Widget> |
getWidgets()
Gets the
Widget s registered on this object. |
boolean |
hasPeople()
Deprecated.
Potentially very expensive call; do not use from Jelly views.
|
boolean |
isAutomaticRefreshEnabled()
Deprecated.
Auto-refresh has been removed
|
boolean |
isDefault()
If true, this is a view that renders the top page of Hudson.
|
boolean |
isEditable()
By default, return true to render the "Edit view" link on the page.
|
boolean |
isFilterExecutors()
If true, only show relevant executors
|
boolean |
isFilterQueue()
If true, only show relevant queue items
|
SearchIndexBuilder |
makeSearchIndex()
Default implementation that returns empty index.
|
protected void |
makeSearchIndex(SearchIndexBuilder sib)
Add a simple CollectionSearchIndex object to sib
|
void |
onJobRenamed(Item item,
String oldName,
String newName)
Deprecated.
Does not work properly with moved jobs. Use
ItemListener.onLocationChanged(hudson.model.Item, java.lang.String, java.lang.String) instead. |
void |
rename(String newName)
Renames this view.
|
void |
save()
Persists the state of this object into XML.
|
void |
setDescription(String description) |
protected abstract void |
submit(org.kohsuke.stapler.StaplerRequest req)
Handles the configuration submission.
|
String |
toString() |
void |
updateByXml(Source source)
Updates the View with the new XML definition.
|
void |
updateTransientActions()
Deprecated.
This method does nothing and should not be used
|
void |
writeXml(OutputStream out) |
getSearch, getSearchIndex, getSearchName, requirePOST, sendError, sendError, sendError, sendError, sendError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2
protected ViewGroup owner
protected String name
protected String description
protected boolean filterExecutors
protected boolean filterQueue
@Deprecated public static final DescriptorList<View> LIST
public static final Comparator<View> SORTER
public static final PermissionGroup PERMISSIONS
public static final Permission CREATE
public static final Permission DELETE
public static final Permission CONFIGURE
public static final Permission READ
public static final AlternativeUiTextProvider.Message<View> NEW_PRONOUN
protected View(String name)
@NonNull @Exported(name="jobs") public abstract Collection<TopLevelItem> getItems()
public Collection<TopLevelItem> getAllItems()
The default implementation recursively adds the items of all contained Views
in case this view implements ViewGroup
, which should be enough for most cases.
public TopLevelItem getItem(String name)
TopLevelItem
of the given name.public final TopLevelItem getJob(String name)
getItem(String)
. This is the one used in the URL binding.public abstract boolean contains(TopLevelItem item)
@Exported(visibility=2, name="name") @NonNull public String getViewName()
rename(String)
public void rename(String newName) throws Failure, Descriptor.FormException
Failure
Descriptor.FormException
@Deprecated public ItemGroup<? extends TopLevelItem> getOwnerItemGroup()
ViewGroup.getItemGroup()
directly@Deprecated public View getOwnerPrimaryView()
ViewGroup.getPrimaryView()
directly@Deprecated public List<Action> getOwnerViewActions()
ViewGroup.getViewActions()
directly@Exported public String getDescription()
@DataBoundSetter public void setDescription(String description)
public DescribableList<ViewProperty,ViewPropertyDescriptor> getProperties()
public List<ViewPropertyDescriptor> getApplicablePropertyDescriptors()
ViewPropertyDescriptor
s that can be potentially configured
on this view. Returns both ViewPropertyDescriptor
s visible and invisible for user, see
getVisiblePropertyDescriptors()
to filter invisible one.public List<ViewPropertyDescriptor> getVisiblePropertyDescriptors()
ViewPropertyDescriptor
s that can be potentially configured on this View and are visible
for the user. Use DescriptorVisibilityFilter
to make a View property invisible for users.public void save() throws IOException
Saveable
For making a bulk change efficiently, see BulkChange
.
To support listeners monitoring changes to this object, call SaveableListener.fireOnChange(hudson.model.Saveable, hudson.XmlFile)
save
in interface Saveable
IOException
- if the persistence failed.@Exported(name="property", inline=true) public List<ViewProperty> getAllProperties()
ViewProperty
s exposed primarily for the remoting API.public ViewDescriptor getDescriptor()
Describable
Descriptor
is a singleton for every concrete Describable
implementation, so if a.getClass() == b.getClass()
then by default
a.getDescriptor() == b.getDescriptor()
as well.
(In rare cases a single implementation class may be used for instances with distinct descriptors.)
getDescriptor
in interface Describable<View>
public String getDisplayName()
getDisplayName
in interface ModelObject
public String getNewPronoun()
public boolean isEditable()
@Deprecated public boolean isAutomaticRefreshEnabled()
public boolean isFilterExecutors()
public boolean isFilterQueue()
public List<Widget> getWidgets()
Widget
s registered on this object.
For now, this just returns the widgets registered to Hudson.
public Iterable<? extends ListViewColumn> getColumns()
<t:projectView>
for rendering, this method returns columns to be displayed.public Indenter getIndenter()
t:projectView
for rendering, this method returns the indenter used
to indent each row.public boolean isDefault()
public List<Queue.Item> getQueueItems()
@Deprecated public List<Queue.Item> getApproximateQueueItemsQuickly()
getQueueItems()
. As of 1.607 the approximation is no longer needed.public String getUrl()
public String getViewUrl()
getUrl()
except this returns a view/{name} path
even for the default view.public String getSearchUrl()
SearchItem
SearchItem
.getSearchUrl
in interface SearchItem
public List<Action> getActions()
Action
s associated with the top page.
If views don't want to show top-level actions, this method can be overridden to return different objects.
Jenkins.getActions()
@Restricted(value=org.kohsuke.accmod.restrictions.DoNotUse.class) @Deprecated public void updateTransientActions()
@Exported(visibility=2, name="url") public String getAbsoluteUrl()
public Api getApi()
public String getPostConstructLandingPage()
public ACL getACL()
ACL
for this object.getACL
in interface AccessControlled
@Deprecated public void onJobRenamed(Item item, String oldName, String newName)
ItemListener.onLocationChanged(hudson.model.Item, java.lang.String, java.lang.String)
instead.@Deprecated public boolean hasPeople()
View
has any associated user information recorded?public View.People getPeople()
public View.AsynchPeople getAsynchPeople()
protected void makeSearchIndex(SearchIndexBuilder sib)
sib
- the SearchIndexBuilderpublic SearchIndexBuilder makeSearchIndex()
AbstractModelObject
makeSearchIndex
in class AbstractModelObject
public void doSubmitDescription(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
@POST public final void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormException
submit(StaplerRequest)
method.IOException
javax.servlet.ServletException
Descriptor.FormException
protected abstract void submit(org.kohsuke.stapler.StaplerRequest req) throws IOException, javax.servlet.ServletException, Descriptor.FormException
IOException
javax.servlet.ServletException
Descriptor.FormException
public void doDoDelete(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public abstract Item doCreateItem(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
Item
in this collection.
This method should call ModifiableItemGroup.doCreateItem(StaplerRequest, StaplerResponse)
and then add the newly created item to this view.
IOException
javax.servlet.ServletException
@Restricted(value=org.kohsuke.accmod.restrictions.DoNotUse.class) public FormValidation doCheckJobName(@QueryParameter String value)
newJob
.@Restricted(value=org.kohsuke.accmod.restrictions.DoNotUse.class) public Categories doItemCategories(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @QueryParameter String iconStyle) throws IOException, javax.servlet.ServletException
Categories
entity that is shown as JSON file.IOException
javax.servlet.ServletException
public void doRssAll(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public void doRssFailed(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
public RunList getBuilds()
public BuildTimelineWidget getTimeline()
public void doRssLatest(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
@WebMethod(name="config.xml") public org.kohsuke.stapler.HttpResponse doConfigDotXml(org.kohsuke.stapler.StaplerRequest req) throws IOException
config.xml
submission, as well as serve it.IOException
public void writeXml(OutputStream out) throws IOException
IOException
public void updateByXml(Source source) throws IOException
source
- source of the Item's new definition.
The source should be either a StreamSource
or SAXSource
, other sources
may not be handled.IOException
public ModelObjectWithContextMenu.ContextMenu doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) throws Exception
ModelObjectWithChildren
doChildrenContextMenu
in interface ModelObjectWithChildren
Exception
public static DescriptorExtensionList<View,ViewDescriptor> all()
ViewDescriptor
s.@NonNull public static List<ViewDescriptor> allInstantiable()
ViewDescriptor
instances that can be instantiated for the ViewGroup
in the current
StaplerRequest
.
NOTE: Historically this method is only ever called from a StaplerRequest
ViewDescriptor
instances for the current StaplerRequest
public static Permission getItemCreatePermission()
public static View create(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, ViewGroup owner) throws Descriptor.FormException, IOException, javax.servlet.ServletException
Descriptor.FormException
IOException
javax.servlet.ServletException
public static View createViewFromXML(String name, InputStream xml) throws IOException
name
- Alternative name to use or null
to keep the one in xml.IOException
Copyright © 2004–2021. All rights reserved.