Modifier and Type | Field and Description |
---|---|
static List<TopLevelItemDescriptor> |
LIST
|
static com.thoughtworks.xstream.XStream |
XSTREAM
Used to load/save job configuration.
|
static XStream2 |
XSTREAM2
|
Constructor and Description |
---|
Items() |
Modifier and Type | Method and Description |
---|---|
static DescriptorExtensionList<TopLevelItem,TopLevelItemDescriptor> |
all()
Returns all the registered
TopLevelItemDescriptor s. |
static List<TopLevelItemDescriptor> |
all(org.acegisecurity.Authentication a,
ItemGroup c)
Returns all the registered
TopLevelItemDescriptor s that the specified security principal is allowed to
create within the specified item group. |
static List<TopLevelItemDescriptor> |
all(ItemGroup c)
Returns all the registered
TopLevelItemDescriptor s that the current security principal is allowed to
create within the specified item group. |
static String |
computeRelativeNamesAfterRenaming(String oldFullName,
String newFullName,
String relativeNames,
ItemGroup context)
Computes the relative name of list of items after a rename or move occurred.
|
static boolean |
currentlyUpdatingByXml()
Checks whether we are in the middle of creating or configuring an item via XML.
|
static <T extends Item> |
findNearest(Class<T> type,
String name,
ItemGroup context)
Finds an item whose name (when referenced from the specified context) is closest to the given name.
|
static <T extends Item> |
fromNameList(ItemGroup context,
String list,
Class<T> type)
Does the opposite of
toNameList(Collection) . |
static <T extends Item> |
fromNameList(String list,
Class<T> type)
Deprecated.
as of 1.406
Use
fromNameList(ItemGroup, String, Class) |
static <T extends Item> |
getAllItems(ItemGroup root,
Class<T> type)
|
static String |
getCanonicalName(ItemGroup context,
String path)
Computes the canonical full name of a relative path in an
ItemGroup context, handling relative
positions ".." and "." as absolute path starting with "/". |
static XmlFile |
getConfigFile(File dir)
The file we save our configuration.
|
static XmlFile |
getConfigFile(Item item)
The file we save our configuration.
|
static TopLevelItemDescriptor |
getDescriptor(String fqcn)
Deprecated.
Underspecified what the parameter is.
Descriptor.getId() ? A Describable class name? |
static Item |
load(ItemGroup parent,
File dir)
Loads a
Item from a config file. |
static <I extends AbstractItem & TopLevelItem> |
move(I item,
DirectlyModifiableTopLevelItemGroup destination)
Moves an item between folders (or top level).
|
static String |
toNameList(Collection<? extends Item> items)
Converts a list of items into a comma-separated list of full names.
|
static <V,T extends Throwable> |
whileUpdatingByXml(hudson.remoting.Callable<V,T> callable)
Runs a block while making
currentlyUpdatingByXml() be temporarily true. |
@Deprecated public static final List<TopLevelItemDescriptor> LIST
TopLevelItem
types.public static final com.thoughtworks.xstream.XStream XSTREAM
Job
in a plugin, try to put the alias so
that it produces a reasonable XML.public static final XStream2 XSTREAM2
public static <V,T extends Throwable> V whileUpdatingByXml(hudson.remoting.Callable<V,T> callable) throws T extends Throwable
currentlyUpdatingByXml()
be temporarily true.
Use this when you are creating or changing an item.V
- a return value type (may be Void
)T
- an error type (may be Error
)callable
- a block, typically running load(hudson.model.ItemGroup, java.io.File)
or Item.onLoad(hudson.model.ItemGroup<? extends hudson.model.Item>, java.lang.String)
callable
returnedT
- anything callable
throwsT extends Throwable
public static boolean currentlyUpdatingByXml()
newInstance
parameter for Trigger.start(J, boolean)
.whileUpdatingByXml(hudson.remoting.Callable<V, T>)
is currently being called, false for example when merely starting Jenkins or reloading from diskpublic static DescriptorExtensionList<TopLevelItem,TopLevelItemDescriptor> all()
TopLevelItemDescriptor
s.public static List<TopLevelItemDescriptor> all(ItemGroup c)
TopLevelItemDescriptor
s that the current security principal is allowed to
create within the specified item group.public static List<TopLevelItemDescriptor> all(org.acegisecurity.Authentication a, ItemGroup c)
TopLevelItemDescriptor
s that the specified security principal is allowed to
create within the specified item group.public static TopLevelItemDescriptor getDescriptor(String fqcn)
Descriptor.getId()
? A Describable
class name?public static String toNameList(Collection<? extends Item> items)
@Deprecated public static <T extends Item> List<T> fromNameList(String list, Class<T> type)
fromNameList(ItemGroup, String, Class)
public static <T extends Item> List<T> fromNameList(ItemGroup context, @Nonnull String list, @Nonnull Class<T> type)
toNameList(Collection)
.public static String getCanonicalName(ItemGroup context, String path)
ItemGroup
context, handling relative
positions ".." and "." as absolute path starting with "/". The resulting name is the item fullName from Jenkins
root.public static String computeRelativeNamesAfterRenaming(String oldFullName, String newFullName, String relativeNames, ItemGroup context)
ItemListener.onLocationChanged(hudson.model.Item, java.lang.String, java.lang.String)
.
In a hierarchical context, when a plugin has a reference to a job as ../foo/bar
this method will
handle the relative path as "foo" is renamed to "zot" to compute ../zot/bar
oldFullName
- the old full name of the itemnewFullName
- the new full name of the itemrelativeNames
- coma separated list of Item relative namescontext
- the {link ItemGroup} relative names refer topublic static Item load(ItemGroup parent, File dir) throws IOException
Item
from a config file.dir
- The directory that contains the config file, not the config file itself.IOException
public static <T extends Item> List<T> getAllItems(ItemGroup root, Class<T> type)
@CheckForNull public static <T extends Item> T findNearest(Class<T> type, String name, ItemGroup context)
T
- the type of item being consideredtype
- same as T
name
- the supplied namecontext
- a context to start from (used to compute relative names)public static <I extends AbstractItem & TopLevelItem> I move(I item, DirectlyModifiableTopLevelItemGroup destination) throws IOException, IllegalArgumentException
item
- some item (job or folder)destination
- the destination of the move (a folder or Jenkins
); not the current parent (or you could just call AbstractItem.renameTo(java.lang.String)
)item
)IOException
- if the move fails, or some subsequent step fails (directory might have already been moved)IllegalArgumentException
- if the move would really be a rename, or the destination cannot accept the item, or the destination already has an item of that nameCopyright © 2017. All rights reserved.