Package hudson.model

Class View

    • Field Detail

      • owner

        protected ViewGroup owner
        Container of this view. Set right after the construction and never change thereafter.
      • name

        protected String name
        Name of this view.
      • description

        protected String description
        Message displayed in the view page.
      • filterExecutors

        protected boolean filterExecutors
        If true, only show relevant executors
      • filterQueue

        protected boolean filterQueue
        If true, only show relevant queue items
      • CREATE

        public static final Permission CREATE
        Permission to create new views.
      • CONFIGURE

        public static final Permission CONFIGURE
      • NEW_PRONOUN

        public static final AlternativeUiTextProvider.Message<View> NEW_PRONOUN
        "Job" in "New Job". When a view is used in a context that restricts the child type, It might be useful to override this.
    • Method Detail

      • getItems

        @NonNull
        @Exported(name="jobs")
        public abstract Collection<TopLevelItem> getItems()
        Gets all the items in this collection in a read-only view.
      • getAllItems

        public Collection<TopLevelItem> getAllItems()
        Gets all the items recursively contained in this collection in a read-only view.

        The default implementation recursively adds the items of all contained Views in case this view implements ViewGroup, which should be enough for most cases.

        Since:
        1.520
      • contains

        public abstract boolean contains​(TopLevelItem item)
        Checks if the job is in this collection.
      • getViewName

        @Exported(visibility=2,
                  name="name")
        @NonNull
        public String getViewName()
        Gets the name of all this collection.
        See Also:
        rename(String)
      • getDescription

        @Exported
        public String getDescription()
        Message displayed in the top page. Can be null. Includes HTML.
      • setDescription

        @DataBoundSetter
        public void setDescription​(String description)
      • getAllProperties

        @Exported(name="property",
                  inline=true)
        public List<ViewProperty> getAllProperties()
        List of all ViewPropertys exposed primarily for the remoting API.
        Since:
        1.406
      • getDescriptor

        public ViewDescriptor getDescriptor()
        Description copied from interface: Describable
        Gets the descriptor for this instance.

        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.)

        Specified by:
        getDescriptor in interface Describable<View>
      • getNewPronoun

        public String getNewPronoun()
      • isEditable

        public boolean isEditable()
        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
      • isAutomaticRefreshEnabled

        @Deprecated
        public boolean isAutomaticRefreshEnabled()
        Deprecated.
        Auto-refresh has been removed
        Used to enable or disable automatic refreshes of the view.
        Since:
        1.557
      • isFilterExecutors

        public boolean isFilterExecutors()
        If true, only show relevant executors
      • isFilterQueue

        public boolean isFilterQueue()
        If true, only show relevant queue items
      • getWidgets

        public List<Widget> getWidgets()
        Gets the Widgets registered on this object.

        For now, this just returns the widgets registered to Hudson.

      • getColumns

        public Iterable<? extends ListViewColumn> getColumns()
        If this view uses <t:projectView> for rendering, this method returns columns to be displayed.
      • getIndenter

        public Indenter getIndenter()
        If this view uses t:projectView for rendering, this method returns the indenter used to indent each row.
      • isDefault

        public boolean isDefault()
        If true, this is a view that renders the top page of Hudson.
      • getApproximateQueueItemsQuickly

        @Deprecated
        public List<Queue.Item> getApproximateQueueItemsQuickly()
        Deprecated.
        Use getQueueItems(). As of 1.607 the approximation is no longer needed.
        Returns:
        The items in the queue.
      • getUrl

        public String getUrl()
        Returns the path relative to the context root. Doesn't start with '/' but ends with '/' (except returns empty string when this is the default view).
      • getViewUrl

        public String getViewUrl()
        Same as getUrl() except this returns a view/{name} path even for the default view.
      • getSearchUrl

        public String getSearchUrl()
        Description copied from interface: SearchItem
        Returns the URL of this item relative to the parent SearchItem.
        Specified by:
        getSearchUrl in interface SearchItem
        Returns:
        URL like "foo" or "foo/bar". The path can end with '/'. The path that starts with '/' will be interpreted as the absolute path (within the context path of Jenkins.)
      • getActions

        public List<Action> getActions()
        Returns the transient Actions associated with the top page.

        If views don't want to show top-level actions, this method can be overridden to return different objects.

        See Also:
        Jenkins.getActions()
      • updateTransientActions

        @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class)
        @Deprecated
        public void updateTransientActions()
        Deprecated.
        This method does nothing and should not be used
        No-op. Included to maintain backwards compatibility.
      • getAbsoluteUrl

        @Exported(visibility=2,
                  name="url")
        public String getAbsoluteUrl()
        Gets the absolute URL of this view.
      • getApi

        public Api getApi()
      • getPostConstructLandingPage

        public String getPostConstructLandingPage()
        Returns the page to redirect the user to, after the view is created. The returned string is appended to "/view/foobar/", so for example to direct the user to the top page of the view, return "", etc.
      • getACL

        @NonNull
        public ACL getACL()
        Returns the ACL for this object.
        Specified by:
        getACL in interface AccessControlled
        Returns:
        never null.
      • hasPeople

        @Deprecated
        public boolean hasPeople()
        Deprecated.
        Potentially very expensive call; do not use from Jelly views.
        Does this View has any associated user information recorded?
      • getPeople

        public View.People getPeople()
        Gets the users that show up in the changelog of this job collection.
      • makeSearchIndex

        protected void makeSearchIndex​(SearchIndexBuilder sib)
        Add a simple CollectionSearchIndex object to sib
        Parameters:
        sib - the SearchIndexBuilder
        Since:
        2.200
      • doSubmitDescription

        public void doSubmitDescription​(org.kohsuke.stapler.StaplerRequest req,
                                        org.kohsuke.stapler.StaplerResponse rsp)
                                 throws IOException,
                                        javax.servlet.ServletException
        Accepts the new description.
        Throws:
        IOException
        javax.servlet.ServletException
      • doDoDelete

        public void doDoDelete​(org.kohsuke.stapler.StaplerRequest req,
                               org.kohsuke.stapler.StaplerResponse rsp)
                        throws IOException,
                               javax.servlet.ServletException
        Deletes this view.
        Throws:
        IOException
        javax.servlet.ServletException
      • doCheckJobName

        @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class)
        public FormValidation doCheckJobName​(@QueryParameter
                                             String value)
        Makes sure that the given name is good as a job name. For use from newJob.
      • doItemCategories

        @Restricted(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
        An API REST method to get the allowed {$link TopLevelItem}s and its categories.
        Returns:
        A Categories entity that is shown as JSON file.
        Throws:
        IOException
        javax.servlet.ServletException
      • doRssAll

        public void doRssAll​(org.kohsuke.stapler.StaplerRequest req,
                             org.kohsuke.stapler.StaplerResponse rsp)
                      throws IOException,
                             javax.servlet.ServletException
        Throws:
        IOException
        javax.servlet.ServletException
      • doRssFailed

        public void doRssFailed​(org.kohsuke.stapler.StaplerRequest req,
                                org.kohsuke.stapler.StaplerResponse rsp)
                         throws IOException,
                                javax.servlet.ServletException
        Throws:
        IOException
        javax.servlet.ServletException
      • getBuilds

        public RunList getBuilds()
      • doRssLatest

        public void doRssLatest​(org.kohsuke.stapler.StaplerRequest req,
                                org.kohsuke.stapler.StaplerResponse rsp)
                         throws IOException,
                                javax.servlet.ServletException
        Throws:
        IOException
        javax.servlet.ServletException
      • doConfigDotXml

        @WebMethod(name="config.xml")
        public org.kohsuke.stapler.HttpResponse doConfigDotXml​(org.kohsuke.stapler.StaplerRequest req)
                                                        throws IOException
        Accepts config.xml submission, as well as serve it.
        Throws:
        IOException
      • updateByXml

        public void updateByXml​(Source source)
                         throws IOException
        Updates the View with the new XML definition.
        Parameters:
        source - source of the Item's new definition. The source should be either a StreamSource or SAXSource, other sources may not be handled.
        Throws:
        IOException
      • allInstantiable

        @NonNull
        public static List<ViewDescriptor> allInstantiable()
        Returns the ViewDescriptor instances that can be instantiated for the ViewGroup in the current StaplerRequest.

        NOTE: Historically this method is only ever called from a StaplerRequest

        Returns:
        the list of instantiable ViewDescriptor instances for the current StaplerRequest
      • getItemCreatePermission

        public static Permission getItemCreatePermission()
      • createViewFromXML

        public static View createViewFromXML​(String name,
                                             InputStream xml)
                                      throws IOException
        Instantiate View subtype from XML stream.
        Parameters:
        name - Alternative name to use or null to keep the one in xml.
        Throws:
        IOException