public class EzTemplateChange
extends java.lang.Object
Job
s being updated so we don't re-trigger templating. Each record has a context (template or child) so
that a given Job
may be both a child and a temnplate itself, enabling cascading templating.
Cut'n'paste from BulkChange 1.642.3 for simplicity.Modifier and Type | Field and Description |
---|---|
static hudson.model.Saveable |
ALL
Magic
Saveable instance that can make BulkChange veto
all the save operations by making the contains(Saveable, Object) method return
true for everything. |
java.lang.Exception |
allocator |
Constructor and Description |
---|
EzTemplateChange(hudson.model.Saveable saveable,
java.lang.Object context)
Record that a given
Job is being templated |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Exits the scope of
BulkChange without saving the changes. |
void |
commit()
Saves the accumulated changes.
|
static boolean |
contains(hudson.model.Saveable s,
java.lang.Object context)
Checks if the given
Saveable is currently in the bulk change. |
static EzTemplateChange |
current()
Gets the
BulkChange instance currently in scope for the current thread. |
public final java.lang.Exception allocator
public static final hudson.model.Saveable ALL
Saveable
instance that can make BulkChange
veto
all the save operations by making the contains(Saveable, Object)
method return
true for everything.public EzTemplateChange(hudson.model.Saveable saveable, java.lang.Object context)
Job
is being templatedsaveable
- The Job
to be tracked.context
- THe context the object is tracked under.public void commit()
public void abort()
BulkChange
without saving the changes.
This can be used when a bulk change fails in the middle. Note that unlike a real transaction, this will not roll back the state of the object.
The abort method can be called after the commit method, in which case this method does nothing.
This is so that BulkChange
can be used naturally in the try/finally block.
public static EzTemplateChange current()
BulkChange
instance currently in scope for the current thread.public static boolean contains(hudson.model.Saveable s, java.lang.Object context)
Saveable
is currently in the bulk change.
The expected usage is from the Saveable.save()
implementation to check
if the actual persistence should happen now or not.