public abstract class AbstractFolder<I extends hudson.model.TopLevelItem>
extends hudson.model.AbstractItem
implements hudson.model.TopLevelItem, hudson.model.ItemGroup<I>, hudson.model.ModifiableViewGroup, org.kohsuke.stapler.StaplerFallback, jenkins.model.ModelObjectWithChildren, org.kohsuke.stapler.StaplerOverridable
ItemGroup
.
Base for Folder
and ComputedFolder
.
Extending Folders UI
As any other Item
type, folder types support extension of UI via Action
s.
These actions can be persisted or added via TransientActionFactory
.
See this page
for more details about actions.
In folders actions provide the following features:
index.jelly
.summary.jelly
.Modifier and Type | Class and Description |
---|---|
static class |
AbstractFolder.ItemListenerImpl |
static class |
AbstractFolder.RunListenerImpl |
Modifier and Type | Field and Description |
---|---|
protected Map<String,I> |
items
Child items, keyed by
Item.getName() . |
Modifier | Constructor and Description |
---|---|
protected |
AbstractFolder(hudson.model.ItemGroup parent,
String name)
Subclasses should also call
init() . |
Modifier and Type | Method and Description |
---|---|
void |
addAction(hudson.model.Action a) |
boolean |
addOrReplaceAction(hudson.model.Action a)
Add an action, replacing any existing actions of the (exact) same class.
|
void |
addProperty(AbstractFolderProperty p) |
void |
addView(hudson.model.View v) |
boolean |
canDelete(hudson.model.View view) |
void |
delete() |
void |
deleteView(hudson.model.View view) |
jenkins.model.ModelObjectWithContextMenu.ContextMenu |
doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest request,
org.kohsuke.stapler.StaplerResponse response) |
void |
doConfigSubmit(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp) |
void |
doCreateView(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp) |
void |
doDoRename(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp) |
org.kohsuke.stapler.HttpResponse |
doLastBuild(org.kohsuke.stapler.StaplerRequest req) |
void |
doSubmitDescription(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp) |
hudson.util.FormValidation |
doViewExistsCheck(String value)
Checks if a top-level view with the given name exists.
|
Collection<? extends hudson.model.Job> |
getAllJobs() |
hudson.model.HealthReport |
getBuildHealth()
Get the current health report for a folder.
|
List<hudson.model.HealthReport> |
getBuildHealthReports() |
AbstractFolderDescriptor |
getDescriptor() |
AbstractFolderViewHolder |
getFolderViews() |
hudson.util.DescribableList<FolderHealthMetric,FolderHealthMetricDescriptor> |
getHealthMetrics() |
FolderIcon |
getIcon()
Gets the icon used for this folder.
|
FolderIcon |
getIconColor() |
I |
getItem(String name) |
hudson.model.ItemGroup<? extends hudson.model.TopLevelItem> |
getItemGroup() |
Collection<I> |
getItems() |
I |
getJob(String name)
For URL binding.
|
protected File |
getJobsDir()
May be overridden, but
loadJobTotal() will be inaccurate in that case. |
Collection<?> |
getOverrides()
Overrides from job properties.
|
hudson.model.View |
getPrimaryView() |
String |
getPronoun() |
hudson.util.DescribableList<AbstractFolderProperty<?>,AbstractFolderPropertyDescriptor> |
getProperties()
May be used to enumerate or remove properties.
|
File |
getRootDirFor(I child) |
protected File |
getRootDirFor(String name) |
hudson.model.View |
getStaplerFallback()
Fallback to the primary view.
|
protected String |
getSuccessfulDestination()
Where user will be redirected after creating or reconfiguring a
AbstractFolder . |
String |
getUrlChildPrefix()
It is unwise to override this, lest links to children from nondefault
View s break. |
hudson.model.View |
getView(String name) |
List<hudson.model.Action> |
getViewActions() |
Collection<hudson.model.View> |
getViews() |
hudson.views.ViewsTabBar |
getViewsTabBar() |
protected void |
init() |
protected void |
initViews(List<hudson.model.View> views) |
void |
invalidateBuildHealthReports()
Invalidates the cache of build health reports.
|
static void |
loadJobTotal() |
protected hudson.search.SearchIndexBuilder |
makeSearchIndex() |
protected FolderIcon |
newDefaultFolderIcon() |
protected hudson.views.DefaultViewsTabBar |
newDefaultViewsTabBar() |
protected AbstractFolderViewHolder |
newFolderViewHolder() |
void |
onDeleted(I item) |
void |
onLoad(hudson.model.ItemGroup<? extends hudson.model.Item> parent,
String name) |
void |
onRenamed(I item,
String oldName,
String newName) |
void |
onViewRenamed(hudson.model.View view,
String oldName,
String newName) |
boolean |
removeAction(hudson.model.Action a)
Remove an action.
|
boolean |
removeActions(Class<? extends hudson.model.Action> clazz)
Removes any actions of the specified type.
|
protected String |
renameBlocker()
Allows a subclass to block renames under dynamic conditions.
|
void |
renameTo(String newName)
Renames this item container.
|
void |
replaceAction(hudson.model.Action a) |
boolean |
replaceActions(Class<? extends hudson.model.Action> clazz,
hudson.model.Action a)
Replaces any actions of the specified type by the supplied action.
|
void |
resetFolderViews() |
void |
save() |
void |
setIcon(FolderIcon icon) |
void |
setPrimaryView(hudson.model.View v) |
protected void |
submit(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp) |
checkPermission, delete, doConfigDotXml, doDoDelete, doReload, doSetName, getAbsoluteUrl, getACL, getApi, getConfigFile, getDescription, getDescriptorByName, getDisplayName, getDisplayNameOrNull, getFullDisplayName, getFullName, getName, getParent, getRelativeDisplayNameFrom, getRelativeNameFrom, getRelativeNameFrom, getRelativeNameFromGroup, getRootDir, getSearchName, getSearchUrl, getShortUrl, getUrl, hasPermission, movedTo, onCopiedFrom, onCreatedFromScratch, performDelete, resolveForCLI, setDescription, setDisplayName, setDisplayNameOrNull, toString, updateByXml, updateByXml
doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic
getSearch, getSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAbsoluteUrl, getDisplayName, getFullDisplayName, getFullName, getName, getParent, getRelativeNameFrom, getRelativeNameFrom, getShortUrl, getUrl, onCopiedFrom, onCreatedFromScratch
@Initializer(before=JOB_LOADED, fatal=false) public static void loadJobTotal()
protected void init()
protected hudson.views.DefaultViewsTabBar newDefaultViewsTabBar()
protected AbstractFolderViewHolder newFolderViewHolder()
protected FolderIcon newDefaultFolderIcon()
protected void initViews(List<hudson.model.View> views) throws IOException
IOException
public void addAction(hudson.model.Action a)
addAction
in class hudson.model.Actionable
public void replaceAction(hudson.model.Action a)
replaceAction
in class hudson.model.Actionable
public boolean addOrReplaceAction(@Nonnull hudson.model.Action a)
Actionable.getAllActions()
that happen before calls to this method may not see the update.
Note: this method does not affect transient actions contributed by a TransientActionFactory
a
- an action to add/replacetrue
if this actions changed as a result of the callpublic boolean removeAction(@Nullable hudson.model.Action a)
Actionable.getAllActions()
that happen before calls to this method may not see the update.
Note: this method does not affect transient actions contributed by a TransientActionFactory
a
- an action to remove (if null
then this will be a no-op)true
if this actions changed as a result of the callpublic boolean removeActions(@Nonnull Class<? extends hudson.model.Action> clazz)
Actionable.getAllActions()
that happen before calls to this method may not see the update.
Note: this method does not affect transient actions contributed by a TransientActionFactory
clazz
- the type of actions to removetrue
if this actions changed as a result of the callpublic boolean replaceActions(@Nonnull Class<? extends hudson.model.Action> clazz, hudson.model.Action a)
Actionable.getAllActions()
that happen before calls to this method may not see the update.
Note: this method does not affect transient actions contributed by a TransientActionFactory
clazz
- the type of actions to replace (note that the action you are replacing this with need not extend
this class)a
- the action to replace withtrue
if this actions changed as a result of the callpublic void onLoad(hudson.model.ItemGroup<? extends hudson.model.Item> parent, String name) throws IOException
onLoad
in interface hudson.model.Item
onLoad
in class hudson.model.AbstractItem
IOException
public AbstractFolderDescriptor getDescriptor()
getDescriptor
in interface hudson.model.Describable<hudson.model.TopLevelItem>
getDescriptor
in interface hudson.model.TopLevelItem
public hudson.util.DescribableList<AbstractFolderProperty<?>,AbstractFolderPropertyDescriptor> getProperties()
addProperty(com.cloudbees.hudson.plugins.folder.AbstractFolderProperty)
.public void addProperty(AbstractFolderProperty p) throws IOException
IOException
protected File getJobsDir()
loadJobTotal()
will be inaccurate in that case.public File getRootDirFor(I child)
getRootDirFor
in interface hudson.model.ItemGroup<I extends hudson.model.TopLevelItem>
public String getUrlChildPrefix()
View
s break.
TODO remove this warning if and when JENKINS-35243 is fixed in the baseline.
getUrlChildPrefix
in interface hudson.model.ItemGroup<I extends hudson.model.TopLevelItem>
public I getJob(String name)
getUrlChildPrefix()
public String getPronoun()
getPronoun
in class hudson.model.AbstractItem
public Collection<?> getOverrides()
getOverrides
in interface org.kohsuke.stapler.StaplerOverridable
public void addView(hudson.model.View v) throws IOException
addView
in interface hudson.model.ModifiableViewGroup
IOException
public boolean canDelete(hudson.model.View view)
canDelete
in interface hudson.model.ViewGroup
public void deleteView(hudson.model.View view) throws IOException
deleteView
in interface hudson.model.ViewGroup
IOException
public hudson.model.View getView(String name)
getView
in interface hudson.model.ViewGroup
@Exported public Collection<hudson.model.View> getViews()
getViews
in interface hudson.model.ViewGroup
public AbstractFolderViewHolder getFolderViews()
public void resetFolderViews()
@Exported public hudson.model.View getPrimaryView()
getPrimaryView
in interface hudson.model.ViewGroup
public void setPrimaryView(hudson.model.View v)
public void onViewRenamed(hudson.model.View view, String oldName, String newName)
onViewRenamed
in interface hudson.model.ViewGroup
public hudson.views.ViewsTabBar getViewsTabBar()
getViewsTabBar
in interface hudson.model.ViewGroup
public hudson.model.ItemGroup<? extends hudson.model.TopLevelItem> getItemGroup()
getItemGroup
in interface hudson.model.ViewGroup
public List<hudson.model.Action> getViewActions()
getViewActions
in interface hudson.model.ViewGroup
public hudson.model.View getStaplerFallback()
getStaplerFallback
in interface org.kohsuke.stapler.StaplerFallback
protected hudson.search.SearchIndexBuilder makeSearchIndex()
makeSearchIndex
in class hudson.model.AbstractModelObject
public jenkins.model.ModelObjectWithContextMenu.ContextMenu doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
doChildrenContextMenu
in interface jenkins.model.ModelObjectWithChildren
public void doCreateView(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, ParseException, hudson.model.Descriptor.FormException
IOException
javax.servlet.ServletException
ParseException
hudson.model.Descriptor.FormException
public hudson.util.FormValidation doViewExistsCheck(@QueryParameter String value)
public hudson.model.HealthReport getBuildHealth()
public void invalidateBuildHealthReports()
@Exported(name="healthReport") public List<hudson.model.HealthReport> getBuildHealthReports()
public hudson.util.DescribableList<FolderHealthMetric,FolderHealthMetricDescriptor> getHealthMetrics()
public org.kohsuke.stapler.HttpResponse doLastBuild(org.kohsuke.stapler.StaplerRequest req)
public FolderIcon getIcon()
public void setIcon(FolderIcon icon)
public FolderIcon getIconColor()
public Collection<? extends hudson.model.Job> getAllJobs()
getAllJobs
in interface hudson.model.Item
getAllJobs
in class hudson.model.AbstractItem
@Exported(name="jobs") public Collection<I> getItems()
getItems
in interface hudson.model.ItemGroup<I extends hudson.model.TopLevelItem>
public I getItem(String name) throws org.acegisecurity.AccessDeniedException
getItem
in interface hudson.model.ItemGroup<I extends hudson.model.TopLevelItem>
org.acegisecurity.AccessDeniedException
public void onRenamed(I item, String oldName, String newName) throws IOException
onRenamed
in interface hudson.model.ItemGroup<I extends hudson.model.TopLevelItem>
IOException
public void onDeleted(I item) throws IOException
onDeleted
in interface hudson.model.ItemGroup<I extends hudson.model.TopLevelItem>
IOException
public void delete() throws IOException, InterruptedException
delete
in interface hudson.model.Item
delete
in class hudson.model.AbstractItem
IOException
InterruptedException
public void save() throws IOException
save
in interface hudson.model.Item
save
in interface hudson.model.Saveable
save
in class hudson.model.AbstractItem
IOException
public void renameTo(String newName) throws IOException
renameTo
in class hudson.model.AbstractItem
IOException
public void doSubmitDescription(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
doSubmitDescription
in class hudson.model.AbstractItem
IOException
javax.servlet.ServletException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, hudson.model.Descriptor.FormException
IOException
javax.servlet.ServletException
hudson.model.Descriptor.FormException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @Nonnull protected String getSuccessfulDestination()
AbstractFolder
.HttpServletResponse.sendRedirect(String)
protected void submit(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException, hudson.model.Descriptor.FormException
IOException
javax.servlet.ServletException
hudson.model.Descriptor.FormException
@Restricted(value=org.kohsuke.accmod.restrictions.DoNotUse.class) public void doDoRename(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
IOException
javax.servlet.ServletException
@CheckForNull protected String renameBlocker()
Copyright © 2016–2017. All rights reserved.