@ExportedBean public abstract class AbstractItem extends Actionable implements Item, org.kohsuke.stapler.HttpDeletable, AccessControlled, DescriptorByNameOwner
Item.ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem| Modifier and Type | Field and Description |
|---|---|
protected String |
description
Project description.
|
protected String |
displayName |
protected String |
name
Project name.
|
static AlternativeUiTextProvider.Message<AbstractItem> |
PRONOUN
Replaceable pronoun of that points to a job.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractItem(ItemGroup parent,
String name) |
| Modifier and Type | Method and Description |
|---|---|
void |
checkPermission(Permission p)
Short for
getACL().checkPermission(p) |
void |
delete()
Deletes this item.
|
void |
delete(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp) |
void |
doConfigDotXml(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Accepts config.xml submission, as well as serve it.
|
void |
doDoDelete(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Deletes this item.
|
void |
doReload()
Reloads this job from the disk.
|
protected void |
doSetName(String name)
Just update
name without performing the rename operation,
which would involve copying files and etc. |
void |
doSubmitDescription(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Accepts the new description.
|
String |
getAbsoluteUrl()
Returns the absolute URL of this item.
|
ACL |
getACL()
Returns the
ACL for this object. |
abstract Collection<? extends Job> |
getAllJobs()
Gets all the jobs that this
Item contains as descendants. |
Api |
getApi()
Remote API access.
|
XmlFile |
getConfigFile() |
String |
getDescription()
Gets the project description HTML.
|
Descriptor |
getDescriptorByName(String className)
Exposes all
Descriptors by its name to URL. |
String |
getDisplayName()
Gets the human readable short name of this item.
|
String |
getDisplayNameOrNull() |
String |
getFullDisplayName()
Works like
Item.getDisplayName() but return
the full path that includes all the display names
of the ancestors. |
String |
getFullName()
Gets the full name of this item, like "abc/def/ghi".
|
String |
getName()
Gets the name of the item.
|
ItemGroup |
getParent()
This bridge method is to maintain binary compatibility with
Item.getParent(). |
String |
getPronoun()
Get the term used in the UI to represent this kind of
Item. |
String |
getRelativeDisplayNameFrom(ItemGroup p)
Gets the display name of the current item relative to the given group.
|
String |
getRelativeNameFrom(Item item)
Short for
getRelativeNameFrom(item.getParent()) |
String |
getRelativeNameFrom(ItemGroup p)
Gets the relative name to this item from the specified group.
|
String |
getRelativeNameFromGroup(ItemGroup p)
This method only exists to disambiguate
getRelativeNameFrom(ItemGroup) and getRelativeNameFrom(Item) |
File |
getRootDir()
Gets the root directory on the file system that this
Item can use freely for storing the configuration data. |
String |
getSearchName()
Default implementation that returns the display name.
|
String |
getSearchUrl()
Returns the URL of this item relative to the parent
SearchItem. |
String |
getShortUrl()
Returns the URL of this item relative to the parent
ItemGroup. |
String |
getUrl()
Returns the URL of this item relative to the context root of the application.
|
boolean |
hasPermission(Permission p)
Short for
getACL().hasPermission(p) |
void |
movedTo(DirectlyModifiableTopLevelItemGroup destination,
AbstractItem newItem,
File destDir)
Notify this item it's been moved to another location, replaced by newItem (might be the same object, but not guaranteed).
|
void |
onCopiedFrom(Item src)
When a
Item is copied from existing one,
the files are first copied on the file system,
then it will be loaded, then this method will be invoked
to perform any implementation-specific work. |
void |
onCreatedFromScratch()
When an item is created from scratch (instead of copied),
this method will be invoked.
|
void |
onLoad(ItemGroup<? extends Item> parent,
String name)
Called right after when a
Item is loaded from disk. |
protected void |
performDelete()
Does the real job of deleting the item.
|
protected void |
renameTo(String newName)
Renames this item.
|
static AbstractItem |
resolveForCLI(String name)
Used for CLI binding.
|
void |
save()
Save the settings to a file.
|
void |
setDescription(String description)
Sets the project description HTML.
|
void |
setDisplayName(String displayName) |
void |
setDisplayNameOrNull(String displayName)
This method exists so that the Job configuration pages can use
getDisplayNameOrNull so that nothing is shown in the display name text
box if the display name is not set.
|
String |
toString() |
void |
updateByXml(Source source)
Updates an Item by its XML definition.
|
void |
updateByXml(StreamSource source)
Deprecated.
as of 1.473
Use
updateByXml(Source) |
void |
writeConfigDotXml(OutputStream os)
Writes
config.xml to the specified output stream. |
addAction, doContextMenu, getAction, getAction, getActions, getActions, getAllActions, getDynamic, replaceActiongetSearch, getSearchIndex, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendErrorclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetSearchgetSearchIndexprotected transient String name
protected volatile String description
protected String displayName
public static final AlternativeUiTextProvider.Message<AbstractItem> PRONOUN
public void onCreatedFromScratch()
ItemonCreatedFromScratch in interface Item@Exported(visibility=999) public String getName()
Item
The name must be unique among other Items that belong
to the same parent.
This name is also used for directory name, so it cannot contain any character that's not allowed on the file system.
getName in interface ItemItem.getFullName()public String getPronoun()
Item. Must start with a capital letter.@Exported public String getDisplayName()
ItemThis method should try to return a short concise human readable string that describes this item. The string need not be unique.
The returned string should not include the display names
of ancestor items.
getDisplayName in interface ItemgetDisplayName in interface ModelObject@Exported public String getDisplayNameOrNull()
public void setDisplayNameOrNull(String displayName) throws IOException
displayName - IOExceptionpublic void setDisplayName(String displayName) throws IOException
IOExceptionpublic File getRootDir()
PersistenceRootItem can use freely for storing the configuration data.
This parameter is given by the ItemGroup when
Item is loaded from memory.
getRootDir in interface PersistenceRoot@WithBridgeMethods(value=Jenkins.class, castRequired=true) @Nonnull public ItemGroup getParent()
Item.getParent().@Exported public String getDescription()
public void setDescription(String description) throws IOException
IOExceptionprotected void doSetName(String name)
name without performing the rename operation,
which would involve copying files and etc.protected void renameTo(String newName) throws IOException
IOExceptionpublic void movedTo(DirectlyModifiableTopLevelItemGroup destination, AbstractItem newItem, File destDir) throws IOException
Derived classes can override this method to add some specific behavior on move, but have to call parent method so the item is actually setup within it's new parent.
public abstract Collection<? extends Job> getAllJobs()
Item contains as descendants.getAllJobs in interface Itempublic final String getFullName()
Item
Full name consists of names of Items
that lead from the root Jenkins to this Item,
separated by '/'. This is the unique name that identifies this
Item inside the whole Jenkins.
getFullName in interface ItemJenkins.getItemByFullName(String,Class)public final String getFullDisplayName()
ItemItem.getDisplayName() but return
the full path that includes all the display names
of the ancestors.getFullDisplayName in interface Itempublic String getRelativeDisplayNameFrom(ItemGroup p)
p - the ItemGroup used as point of reference for the itempublic String getRelativeNameFromGroup(ItemGroup p)
getRelativeNameFrom(ItemGroup) and getRelativeNameFrom(Item)getRelativeNameFrom(ItemGroup)public String getRelativeNameFrom(ItemGroup p)
ItemgetRelativeNameFrom in interface Itemp - The ItemGroup instance used as context to evaluate the relative name of this AbstractItempublic String getRelativeNameFrom(Item item)
ItemgetRelativeNameFrom(item.getParent())getRelativeNameFrom in interface Itempublic void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException
Item is loaded from disk.
This is an opportunity to do a post load processing.onLoad in interface Itemname - Name of the directory (not a path --- just the name portion) from
which the configuration was loaded. This usually becomes the
name of this item.IOExceptionpublic void onCopiedFrom(Item src)
Item is copied from existing one,
the files are first copied on the file system,
then it will be loaded, then this method will be invoked
to perform any implementation-specific work.
onCopiedFrom in interface Itemsrc - Item from which it's copied from. The same type as this. Never null.public final String getUrl()
ItemgetUrl in interface Itemfor how to implement this.public String getShortUrl()
ItemItemGroup.getShortUrl in interface Itemfor how to implement this.public String getSearchUrl()
SearchItemSearchItem.getSearchUrl in interface SearchItem@Exported(visibility=999,
name="url")
public final String getAbsoluteUrl()
ItemStaplerRequest to figure out what the host name is,
so can be used only during processing client requests.getAbsoluteUrl in interface Itempublic final Api getApi()
public ACL getACL()
ACL for this object.getACL in interface AccessControlledpublic void checkPermission(Permission p)
getACL().checkPermission(p)checkPermission in interface AccessControlledpublic boolean hasPermission(Permission p)
getACL().hasPermission(p)hasPermission in interface AccessControlledpublic void save()
throws IOException
save in interface Itemsave in interface SaveableIOException - if the persistence failed.public final XmlFile getConfigFile()
public Descriptor getDescriptorByName(String className)
DescriptorByNameOwnerDescriptors by its name to URL.
Implementation should always delegate to Jenkins.getDescriptorByName(String).
getDescriptorByName in interface DescriptorByNameOwnerclassName - Either Descriptor.getId() (recommended) or the short name.public void doSubmitDescription(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
IOExceptionjavax.servlet.ServletExceptionpublic void doDoDelete(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException,
InterruptedException
/doDelete
since it predates <l:confirmationLink>. /delete goes to a Jelly page
which should now be unused by core but is left in case plugins are still using it.IOExceptionjavax.servlet.ServletExceptionInterruptedExceptionpublic void delete(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
delete in interface org.kohsuke.stapler.HttpDeletableIOExceptionjavax.servlet.ServletExceptionpublic void delete()
throws IOException,
InterruptedException
Any exception indicates the deletion has failed, but AbortException would prevent the caller
from showing the stack trace. This
delete in interface ItemIOExceptionInterruptedExceptionprotected void performDelete()
throws IOException,
InterruptedException
IOExceptionInterruptedException@WebMethod(name="config.xml")
public void doConfigDotXml(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException
IOException@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public void writeConfigDotXml(OutputStream os) throws IOException
config.xml to the specified output stream.
The user must have at least Item.EXTENDED_READ.
If he lacks Item.CONFIGURE, then any Secrets detected will be masked out.IOException@Deprecated public void updateByXml(StreamSource source) throws IOException
updateByXml(Source)IOExceptionpublic void updateByXml(Source source) throws IOException
source - source of the Item's new definition.
The source should be either a StreamSource or a SAXSource, other
sources may not be handled.IOExceptionpublic void doReload()
throws IOException
IOExceptionpublic String getSearchName()
getSearchName in interface SearchItemgetSearchName in class AbstractModelObject@CLIResolver public static AbstractItem resolveForCLI(String name) throws org.kohsuke.args4j.CmdLineException
org.kohsuke.args4j.CmdLineExceptionCopyright © 2019. All rights reserved.