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 Actions.
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) |
org.kohsuke.stapler.HttpResponse |
doDisable()
Stapler action method to disable the folder.
|
void |
doDoRename(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp) |
org.kohsuke.stapler.HttpResponse |
doEnable()
Stapler action method to enable the folder.
|
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
Views 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.
|
boolean |
isDisabled()
Is this folder disabled.
|
protected I |
itemsPut(String name,
I item) |
static <K,V extends hudson.model.TopLevelItem> |
loadChildren(AbstractFolder<V> parent,
File modulesDir,
hudson.util.Function1<? extends K,? super V> key)
Loads all the child
Items. |
static void |
loadJobTotal() |
void |
makeDisabled(boolean disabled)
Makes the folder disabled.
|
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() |
protected void |
setDisabled(boolean disabled)
Sets the folder as disabled.
|
void |
setIcon(FolderIcon icon) |
void |
setPrimaryView(hudson.model.View v) |
protected void |
submit(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp) |
protected boolean |
supportsMakeDisabled()
Determines whether the folder supports being made disabled.
|
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, updateByXmldoContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamicgetSearch, getSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendErrorclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetAbsoluteUrl, 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
IOExceptionpublic void addAction(hudson.model.Action a)
addAction in class hudson.model.Actionablepublic void replaceAction(hudson.model.Action a)
replaceAction in class hudson.model.Actionablepublic 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 TransientActionFactorya - 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 TransientActionFactorya - 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 TransientActionFactoryclazz - 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 TransientActionFactoryclazz - 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 static <K,V extends hudson.model.TopLevelItem> Map<K,V> loadChildren(AbstractFolder<V> parent, File modulesDir, hudson.util.Function1<? extends K,? super V> key)
Items.K - the key typeV - the child type.parent - the parent of the children.modulesDir - Directory that contains sub-directories for each child item.key - the key generating function.public void onLoad(hudson.model.ItemGroup<? extends hudson.model.Item> parent,
String name)
throws IOException
onLoad in interface hudson.model.ItemonLoad in class hudson.model.AbstractItemIOExceptionpublic AbstractFolderDescriptor getDescriptor()
getDescriptor in interface hudson.model.Describable<hudson.model.TopLevelItem>getDescriptor in interface hudson.model.TopLevelItempublic hudson.util.DescribableList<AbstractFolderProperty<?>,AbstractFolderPropertyDescriptor> getProperties()
addProperty(com.cloudbees.hudson.plugins.folder.AbstractFolderProperty).public void addProperty(AbstractFolderProperty p) throws IOException
IOExceptionprotected 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()
Views 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)
name - the name of the child.null if there is no such child.getUrlChildPrefix()public String getPronoun()
getPronoun in class hudson.model.AbstractItempublic Collection<?> getOverrides()
getOverrides in interface org.kohsuke.stapler.StaplerOverridablepublic void addView(hudson.model.View v)
throws IOException
addView in interface hudson.model.ModifiableViewGroupIOExceptionpublic boolean canDelete(hudson.model.View view)
canDelete in interface hudson.model.ViewGrouppublic void deleteView(hudson.model.View view)
throws IOException
deleteView in interface hudson.model.ViewGroupIOExceptionpublic hudson.model.View getView(String name)
getView in interface hudson.model.ViewGroup@Exported public Collection<hudson.model.View> getViews()
getViews in interface hudson.model.ViewGrouppublic AbstractFolderViewHolder getFolderViews()
public void resetFolderViews()
@Exported public hudson.model.View getPrimaryView()
getPrimaryView in interface hudson.model.ViewGrouppublic void setPrimaryView(hudson.model.View v)
public void onViewRenamed(hudson.model.View view,
String oldName,
String newName)
onViewRenamed in interface hudson.model.ViewGrouppublic hudson.views.ViewsTabBar getViewsTabBar()
getViewsTabBar in interface hudson.model.ViewGrouppublic hudson.model.ItemGroup<? extends hudson.model.TopLevelItem> getItemGroup()
getItemGroup in interface hudson.model.ViewGrouppublic List<hudson.model.Action> getViewActions()
getViewActions in interface hudson.model.ViewGrouppublic hudson.model.View getStaplerFallback()
getStaplerFallback in interface org.kohsuke.stapler.StaplerFallbackprotected hudson.search.SearchIndexBuilder makeSearchIndex()
makeSearchIndex in class hudson.model.AbstractModelObjectpublic jenkins.model.ModelObjectWithContextMenu.ContextMenu doChildrenContextMenu(org.kohsuke.stapler.StaplerRequest request,
org.kohsuke.stapler.StaplerResponse response)
doChildrenContextMenu in interface jenkins.model.ModelObjectWithChildrenpublic void doCreateView(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException,
ParseException,
hudson.model.Descriptor.FormException
IOExceptionjavax.servlet.ServletExceptionParseExceptionhudson.model.Descriptor.FormExceptionpublic hudson.util.FormValidation doViewExistsCheck(@QueryParameter
String value)
value - the name of the child.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.ItemgetAllJobs 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.AccessDeniedExceptionpublic void onRenamed(I item, String oldName, String newName) throws IOException
onRenamed in interface hudson.model.ItemGroup<I extends hudson.model.TopLevelItem>IOExceptionpublic void onDeleted(I item) throws IOException
onDeleted in interface hudson.model.ItemGroup<I extends hudson.model.TopLevelItem>IOExceptionpublic void delete()
throws IOException,
InterruptedException
delete in interface hudson.model.Itemdelete in class hudson.model.AbstractItemIOExceptionInterruptedExceptionpublic boolean isDisabled()
true if and only if the folder is disabled.FolderJobQueueDecisionHandlerprotected void setDisabled(boolean disabled)
disabled - true if and only if the folder is to be disabled.protected boolean supportsMakeDisabled()
true if and only if setDisabled(boolean) is implementedpublic void makeDisabled(boolean disabled)
throws IOException
disabled - true if the folder should be disabled.IOException - if the operation could not complete.@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class)
public org.kohsuke.stapler.HttpResponse doDisable()
throws IOException,
javax.servlet.ServletException
IOException - if the folder could not be disabled.javax.servlet.ServletException - if something goes wrong.@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class)
public org.kohsuke.stapler.HttpResponse doEnable()
throws IOException,
javax.servlet.ServletException
IOException - if the folder could not be disabled.javax.servlet.ServletException - if something goes wrong.public void save()
throws IOException
save in interface hudson.model.Itemsave in interface hudson.model.Saveablesave in class hudson.model.AbstractItemIOExceptionpublic void renameTo(String newName) throws IOException
renameTo in class hudson.model.AbstractItemIOExceptionpublic void doSubmitDescription(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
doSubmitDescription in class hudson.model.AbstractItemIOExceptionjavax.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
IOExceptionjavax.servlet.ServletExceptionhudson.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
IOExceptionjavax.servlet.ServletExceptionhudson.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
IOExceptionjavax.servlet.ServletException@CheckForNull protected String renameBlocker()
Copyright © 2016–2017. All rights reserved.