Package hudson.plugins.nested_view
Class NestedView
- java.lang.Object
-
- hudson.model.AbstractModelObject
-
- hudson.model.View
-
- hudson.plugins.nested_view.NestedView
-
- All Implemented Interfaces:
ExtensionPoint
,Describable<View>
,DescriptorByNameOwner
,ModelObject
,Saveable
,ViewGroup
,SearchableModelObject
,SearchItem
,AccessControlled
,ModelObjectWithChildren
,ModelObjectWithContextMenu
,org.kohsuke.stapler.StaplerProxy
public class NestedView extends View implements ViewGroup, org.kohsuke.stapler.StaplerProxy, ModelObjectWithContextMenu
View type that contains only another set of views. Allows grouping job views into multiple levels instead of one big list of tabs.- Author:
- Alan Harder, Kohsuke Kawaguchi, Romain Seguy
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
NestedView.DefaultViewProxy
static class
NestedView.DescriptorImpl
static class
NestedView.HealthReportContainer
Container for HealthReport with two methods matching hudson.model.Job so we can pass this to f:healthReport jelly.class
NestedView.OwnerConvertor
Handle owner attribute-
Nested classes/interfaces inherited from class hudson.model.View
View.AsynchPeople, View.People, View.PropertyList, View.UserInfo
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType
-
-
Field Summary
-
Fields inherited from class hudson.model.View
CONFIGURE, CREATE, DELETE, description, filterExecutors, filterQueue, LIST, name, NEW_PRONOUN, owner, PERMISSIONS, READ, SORTER
-
-
Constructor Summary
Constructors Constructor Description NestedView(String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canDelete(View view)
boolean
contains(TopLevelItem item)
void
deleteView(View view)
FormValidation
doCheckViewName(String value)
Checks if a nested view with the given name exists and make sure that the name is good as a view name.ModelObjectWithContextMenu.ContextMenu
doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
org.kohsuke.stapler.HttpResponse
doConfigDotXml(org.kohsuke.stapler.StaplerRequest req)
ModelObjectWithContextMenu.ContextMenu
doContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
Item
doCreateItem(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
void
doCreateView(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
FormValidation
doViewExistsCheck(String value)
Checks if a nested view with the given name exists.NestedViewColumns
getColumnsToShow()
View
getDefaultView()
NestedView.HealthReportContainer
getHealth()
Returns the health of this nested view.String
getImage(View w)
ItemGroup<? extends TopLevelItem>
getItemGroup()
List<TopLevelItem>
getItems()
View
getPrimaryView()
Object
getTarget()
String
getUrl()
View
getView(String name)
List<Action>
getViewActions()
static NestedView.HealthReportContainer
getViewHealth(View v)
Returns the health of a view, wether it is a normal or a nested one.Collection<View>
getViews()
ViewsTabBar
getViewsTabBar()
Result
getWorstResult()
Returns the worst result for this nested view.static Result
getWorstResult(View v)
Returns the worst result for a view, wether is a normal view or a nested one.boolean
hasPermission(Permission p)
void
onJobRenamed(Item item, String oldName, String newName)
void
onViewRenamed(View view, String oldName, String newName)
void
save()
protected void
submit(org.kohsuke.stapler.StaplerRequest req)
void
updateByXml(Source source)
Updates View by its XML definition.-
Methods inherited from class hudson.model.View
all, allInstantiable, create, createViewFromXML, doCheckJobName, doConfigSubmit, doDoDelete, doItemCategories, doRssAll, doRssFailed, doRssLatest, doSubmitDescription, getAbsoluteUrl, getACL, getActions, getAllItems, getAllProperties, getApi, getApplicablePropertyDescriptors, getApproximateQueueItemsQuickly, getAsynchPeople, getBuilds, getColumns, getComputers, getDescription, getDescriptor, getDisplayName, getDynamic, getIndenter, getItem, getItemCreatePermission, getJob, getNewPronoun, getOwner, getOwnerItemGroup, getOwnerPrimaryView, getOwnerViewActions, getPeople, getPostConstructLandingPage, getProperties, getQueueItems, getSearchUrl, getTimeline, getViewName, getViewUrl, getVisiblePropertyDescriptors, getWidgets, hasPeople, isAutomaticRefreshEnabled, isDefault, isEditable, isFilterExecutors, isFilterQueue, makeSearchIndex, makeSearchIndex, registerPermissions, rename, setDescription, toString, updateTransientActions, writeXml
-
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, requirePOST, sendError, sendError, sendError, sendError, sendError
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, getACL, hasAnyPermission, hasPermission, hasPermission2
-
Methods inherited from interface hudson.model.DescriptorByNameOwner
getDescriptorByName
-
Methods inherited from interface hudson.model.ModelObject
getDisplayName
-
Methods inherited from interface hudson.model.ViewGroup
getAllViews
-
-
-
-
Constructor Detail
-
NestedView
@DataBoundConstructor public NestedView(String name)
-
-
Method Detail
-
getItems
public List<TopLevelItem> getItems()
-
hasPermission
public boolean hasPermission(Permission p)
- Specified by:
hasPermission
in interfaceAccessControlled
-
contains
public boolean contains(TopLevelItem item)
-
doContextMenu
public ModelObjectWithContextMenu.ContextMenu doContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) throws IOException, org.apache.commons.jelly.JellyException
- Specified by:
doContextMenu
in interfaceModelObjectWithContextMenu
- Throws:
IOException
org.apache.commons.jelly.JellyException
-
doChildrenContextMenu
public ModelObjectWithContextMenu.ContextMenu doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) throws Exception
- Specified by:
doChildrenContextMenu
in interfaceModelObjectWithChildren
- Overrides:
doChildrenContextMenu
in classView
- Throws:
Exception
-
getUrl
public String getUrl()
-
getPrimaryView
public View getPrimaryView()
- Specified by:
getPrimaryView
in interfaceViewGroup
-
getItemGroup
public ItemGroup<? extends TopLevelItem> getItemGroup()
- Specified by:
getItemGroup
in interfaceViewGroup
-
getViewActions
public List<Action> getViewActions()
- Specified by:
getViewActions
in interfaceViewGroup
-
doCreateItem
public Item doCreateItem(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
- Specified by:
doCreateItem
in classView
- Throws:
IOException
javax.servlet.ServletException
-
doCheckViewName
public FormValidation doCheckViewName(@QueryParameter String value)
Checks if a nested view with the given name exists and make sure that the name is good as a view name.
-
doViewExistsCheck
public FormValidation doViewExistsCheck(@QueryParameter String value)
Checks if a nested view with the given name exists.
-
onJobRenamed
public void onJobRenamed(Item item, String oldName, String newName)
- Overrides:
onJobRenamed
in classView
-
submit
protected void submit(org.kohsuke.stapler.StaplerRequest req) throws IOException, javax.servlet.ServletException, Descriptor.FormException
- Specified by:
submit
in classView
- Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException
-
deleteView
public void deleteView(View view) throws IOException
- Specified by:
deleteView
in interfaceViewGroup
- Throws:
IOException
-
getViews
@Exported public Collection<View> getViews()
-
getDefaultView
public View getDefaultView()
-
getColumnsToShow
public NestedViewColumns getColumnsToShow()
-
onViewRenamed
public void onViewRenamed(View view, String oldName, String newName)
- Specified by:
onViewRenamed
in interfaceViewGroup
-
save
public void save() throws IOException
- Specified by:
save
in interfaceSaveable
- Overrides:
save
in classView
- Throws:
IOException
-
doCreateView
public void doCreateView(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, Descriptor.FormException
- Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException
-
getWorstResult
public Result getWorstResult()
Returns the worst result for this nested view.To get the worst result, this method browses all the jobs this view contains. Also, as soon as it finds the worst result possible (cf.
WORST_RESULT
), the browsing stops.The algorithm first analyzes normal views (that is, views which are not nested ones); Then, in a second time, it processes nested views, hoping that
WORST_RESULT
will be found as quick as possible, as mentionned previously.
-
getWorstResult
public static Result getWorstResult(View v)
Returns the worst result for a view, wether is a normal view or a nested one.
-
getHealth
public NestedView.HealthReportContainer getHealth()
Returns the health of this nested view.Notice that, if a job is contained in several sub-views of the current view, then it is taken into account only once to get accurate stats.
This algorithm has been derecursified, hence the stack stuff.
-
doConfigDotXml
@WebMethod(name="config.xml") public org.kohsuke.stapler.HttpResponse doConfigDotXml(org.kohsuke.stapler.StaplerRequest req) throws IOException
- Overrides:
doConfigDotXml
in classView
- Throws:
IOException
-
updateByXml
public void updateByXml(Source source) throws IOException
Updates View by its XML definition.- Overrides:
updateByXml
in classView
- Throws:
IOException
-
getViewHealth
public static NestedView.HealthReportContainer getViewHealth(View v)
Returns the health of a view, wether it is a normal or a nested one.
-
getViewsTabBar
public ViewsTabBar getViewsTabBar()
- Specified by:
getViewsTabBar
in interfaceViewGroup
-
getTarget
public Object getTarget()
- Specified by:
getTarget
in interfaceorg.kohsuke.stapler.StaplerProxy
-
-