public class ItemListener extends Object implements ExtensionPoint
Item
.ExtensionPoint.LegacyInstancesAreScopedToHudson
Constructor and Description |
---|
ItemListener() |
Modifier and Type | Method and Description |
---|---|
static ExtensionList<ItemListener> |
all()
All the registered
ItemListener s. |
static void |
checkBeforeCopy(Item src,
ItemGroup parent)
Call before a job is copied into a new parent, to allow the
ItemListener implementations the ability
to veto the copy operation before it starts. |
static void |
fireLocationChange(Item rootItem,
String oldFullName)
|
static void |
fireOnCopied(Item src,
Item result) |
static void |
fireOnCreated(Item item) |
static void |
fireOnDeleted(Item item) |
static void |
fireOnUpdated(Item item) |
void |
onBeforeShutdown() |
void |
onCheckCopy(Item src,
ItemGroup parent)
Called before a job is copied into a new parent, providing the ability to veto the copy operation before it
starts.
|
void |
onCopied(Item src,
Item item)
Called after a new job is created by copying from an existing job.
|
void |
onCreated(Item item)
Called after a new job is created and added to
Jenkins ,
before the initial configuration page is provided. |
void |
onDeleted(Item item)
Called right before a job is going to be deleted.
|
void |
onLoaded()
Called after all the jobs are loaded from disk into
Jenkins
object. |
void |
onLocationChanged(Item item,
String oldFullName,
String newFullName)
Called after an item’s fully-qualified location has changed.
|
void |
onRenamed(Item item,
String oldName,
String newName)
Called after a job is renamed.
|
void |
onUpdated(Item item)
Called after a job has its configuration updated.
|
void |
register()
Deprecated.
as of 1.286
put
Extension on your class to have it auto-registered. |
public void onCreated(Item item)
Jenkins
,
before the initial configuration page is provided.
This is useful for changing the default initial configuration of newly created jobs. For example, you can enable/add builders, etc.
public void onCheckCopy(Item src, ItemGroup parent) throws Failure
src
- the item being copiedparent
- the proposed parentFailure
- to veto the operation.public void onCopied(Item src, Item item)
onCreated(Item)
.
If you choose to handle this method, think about whether you want to call super.onCopied or not.src
- The source item that the new one was copied from. Never null.item
- The newly created item. Never null.onCreated(Item)
.public void onLoaded()
Jenkins
object.public void onDeleted(Item item)
public void onRenamed(Item item, String oldName, String newName)
onLocationChanged(hudson.model.Item, java.lang.String, java.lang.String)
.item
- The job being renamed.oldName
- The old name of the job.newName
- The new name of the job. Same as Item.getName()
.public void onLocationChanged(Item item, String oldFullName, String newFullName)
onRenamed(hudson.model.Item, java.lang.String, java.lang.String)
will already have been called on this item or an ancestor.
And where applicable, onLocationChanged(hudson.model.Item, java.lang.String, java.lang.String)
will already have been called on its ancestors.
This method should be used (instead of onRenamed(hudson.model.Item, java.lang.String, java.lang.String)
) by any code
which seeks to keep (absolute) references to items up to date:
if a persisted reference matches oldFullName
, replace it with newFullName
.
item
- an item whose absolute position is now differentoldFullName
- the former Item.getFullName()
newFullName
- the current Item.getFullName()
Items.computeRelativeNamesAfterRenaming(java.lang.String, java.lang.String, java.lang.String, hudson.model.ItemGroup)
public void onUpdated(Item item)
public void onBeforeShutdown()
@Deprecated public void register()
Extension
on your class to have it auto-registered.public static ExtensionList<ItemListener> all()
ItemListener
s.public static void checkBeforeCopy(Item src, ItemGroup parent) throws Failure
ItemListener
implementations the ability
to veto the copy operation before it starts.src
- the item being copiedparent
- the proposed parentFailure
- if the copy operation has been vetoed.public static void fireOnCreated(Item item)
public static void fireOnUpdated(Item item)
public static void fireOnDeleted(Item item)
public static void fireLocationChange(Item rootItem, String oldFullName)
onRenamed(hudson.model.Item, java.lang.String, java.lang.String)
and onLocationChanged(hudson.model.Item, java.lang.String, java.lang.String)
as appropriate.rootItem
- the topmost item whose location has just changedoldFullName
- the previous Item.getFullName()
Copyright © 2004–2019. All rights reserved.