|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthudson.model.AbstractModelObject
hudson.model.Actionable
hudson.model.AbstractItem
org.jvnet.hudson.test.MockFolder
public class MockFolder
Minimal implementation of a modifiable item group akin to the CloudBees Folders plugin. No UI, just enough implementation to test functionality of code which should deal with item full names, etc.
Nested Class Summary | |
---|---|
static class |
MockFolder.DescriptorImpl
|
Nested classes/interfaces inherited from interface hudson.ExtensionPoint |
---|
ExtensionPoint.LegacyInstancesAreScopedToHudson |
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu |
---|
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.MenuItem |
Field Summary |
---|
Fields inherited from class hudson.model.AbstractItem |
---|
description, displayName, name, PRONOUN |
Fields inherited from interface hudson.model.Saveable |
---|
NOOP |
Fields inherited from interface hudson.model.Item |
---|
BUILD, CANCEL, CONFIGURE, CREATE, DELETE, DISCOVER, EXTENDED_READ, PERMISSIONS, READ, WIPEOUT, WORKSPACE |
Method Summary | ||
---|---|---|
void |
addView(View view)
|
|
boolean |
canDelete(View view)
Determine whether a view may be deleted. |
|
|
copy(T src,
String name)
Copys a job. |
|
|
createProject(Class<T> type,
String name)
Convenience method to create a FreeStyleProject or similar. |
|
TopLevelItem |
createProject(TopLevelItemDescriptor type,
String name,
boolean notify)
Creates a new job. |
|
TopLevelItem |
createProjectFromXML(String name,
InputStream xml)
/** Creates a new job from its configuration XML. |
|
void |
deleteView(View view)
Deletes a view in this group. |
|
TopLevelItem |
doCreateItem(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
The request format follows that of <n:form xmlns:n="/lib/form"> . |
|
Collection<? extends Job> |
getAllJobs()
Gets all the jobs that this Item contains as descendants. |
|
TopLevelItemDescriptor |
getDescriptor()
Gets the descriptor for this instance. |
|
TopLevelItem |
getItem(String name)
Gets the Item inside this group that has a given name. |
|
ItemGroup<? extends TopLevelItem> |
getItemGroup()
Returns the ItemGroup from which the views in this group should render items. |
|
Collection<TopLevelItem> |
getItems()
Gets all the items in this collection in a read-only view. |
|
TopLevelItem |
getJob(String name)
Same as getItem(java.lang.String) but named this way as a WebMethod . |
|
View |
getPrimaryView()
If the view group renders one view in its own URL (like Jenkins top page does), then that view is called the primary view. |
|
File |
getRootDirFor(TopLevelItem child)
Assigns the root directory for children. |
|
Object |
getStaplerFallback()
|
|
String |
getUrlChildPrefix()
Gets the URL token that prefixes the URLs for child Item s. |
|
View |
getView(String name)
Gets a view of the given name. |
|
List<Action> |
getViewActions()
Returns actions that should be displayed in views. |
|
Collection<View> |
getViews()
Gets all the views in this group. |
|
ViewsTabBar |
getViewsTabBar()
Gets the TabBar for the views. |
|
void |
onDeleted(TopLevelItem item)
Internal method. |
|
void |
onLoad(ItemGroup<? extends Item> parent,
String name)
Called right after when a Item is loaded from disk. |
|
void |
onRenamed(TopLevelItem item,
String oldName,
String newName)
Internal method. |
|
void |
onViewRenamed(View view,
String oldName,
String newName)
View calls this method when it's renamed. |
Methods inherited from class hudson.model.Actionable |
---|
addAction, doContextMenu, getAction, getAction, getActions, getActions, getDynamic |
Methods inherited from class hudson.model.AbstractModelObject |
---|
getSearch, getSearchIndex, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface hudson.model.ItemGroup |
---|
getFullDisplayName, getFullName, getUrl |
Methods inherited from interface hudson.model.PersistenceRoot |
---|
getRootDir |
Methods inherited from interface hudson.model.Saveable |
---|
save |
Methods inherited from interface hudson.model.Item |
---|
delete, getAbsoluteUrl, getDisplayName, getFullDisplayName, getFullName, getName, getParent, getRelativeNameFrom, getRelativeNameFrom, getShortUrl, getUrl, onCopiedFrom, onCreatedFromScratch, save |
Methods inherited from interface hudson.search.SearchableModelObject |
---|
getSearch |
Methods inherited from interface hudson.search.SearchItem |
---|
getSearchIndex, getSearchName, getSearchUrl |
Methods inherited from interface hudson.security.AccessControlled |
---|
checkPermission, getACL, hasPermission |
Methods inherited from interface hudson.model.ViewGroup |
---|
getUrl |
Method Detail |
---|
public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException
AbstractItem
Item
is loaded from disk.
This is an opporunity to do a post load processing.
onLoad
in interface Item
onLoad
in class AbstractItem
name
- 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.
IOException
public Collection<TopLevelItem> getItems()
ItemGroup
getItems
in interface ItemGroup<TopLevelItem>
public TopLevelItem getItem(String name)
ItemGroup
Item
inside this group that has a given name.
getItem
in interface ItemGroup<TopLevelItem>
public Collection<? extends Job> getAllJobs()
AbstractItem
Item
contains as descendants.
getAllJobs
in interface Item
getAllJobs
in class AbstractItem
public <T extends TopLevelItem> T copy(T src, String name) throws IOException
ModifiableTopLevelItemGroup
copy
in interface ModifiableTopLevelItemGroup
src
- A TopLevelItem
to be copied.name
- Name of the newly created project.
TopLevelItem
.
IOException
public TopLevelItem createProjectFromXML(String name, InputStream xml) throws IOException
ModifiableTopLevelItemGroup
createProjectFromXML
in interface ModifiableTopLevelItemGroup
name
- Name of the newly created project.xml
- Item configuration as xml
TopLevelItem
.
IOException
public TopLevelItem createProject(TopLevelItemDescriptor type, String name, boolean notify) throws IOException
ModifiableTopLevelItemGroup
createProject
in interface ModifiableTopLevelItemGroup
type
- Descriptor for job typename
- Name for jobnotify
- Whether to fire onCreated method for all ItemListeners
IOException
public <T extends TopLevelItem> T createProject(Class<T> type, String name) throws IOException
FreeStyleProject
or similar.
IOException
public TopLevelItem doCreateItem(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws IOException, javax.servlet.ServletException
ModifiableItemGroup
<n:form xmlns:n="/lib/form">
.
doCreateItem
in interface ModifiableItemGroup<TopLevelItem>
IOException
javax.servlet.ServletException
public String getUrlChildPrefix()
ItemGroup
Item
s.
Like "job", "item", etc.
getUrlChildPrefix
in interface ItemGroup<TopLevelItem>
public File getRootDirFor(TopLevelItem child)
ItemGroup
root directory
for children.
getRootDirFor
in interface ItemGroup<TopLevelItem>
public void onRenamed(TopLevelItem item, String oldName, String newName) throws IOException
ItemGroup
Item
s when they are renamed by users.
onRenamed
in interface ItemGroup<TopLevelItem>
IOException
public void onDeleted(TopLevelItem item) throws IOException
ItemGroup
Item
s when they are deleted by users.
onDeleted
in interface ItemGroup<TopLevelItem>
IOException
public TopLevelItemDescriptor getDescriptor()
Describable
Descriptor
is a singleton for every concrete Describable
implementation, so if a.getClass()==b.getClass() then
a.getDescriptor()==b.getDescriptor() must hold.
getDescriptor
in interface Describable<TopLevelItem>
getDescriptor
in interface TopLevelItem
Describable.getDescriptor()
public void addView(View view) throws IOException
IOException
public boolean canDelete(View view)
ViewGroup
canDelete
in interface ViewGroup
public void deleteView(View view) throws IOException
ViewGroup
deleteView
in interface ViewGroup
IOException
public Collection<View> getViews()
ViewGroup
getViews
in interface ViewGroup
public View getView(String name)
ViewGroup
getView
in interface ViewGroup
public View getPrimaryView()
ViewGroup
If the view group doesn't do such rendering, this method can always return null.
This method was added later to ViewGroup
, so old plugins might not be implementing this.
To work around this, View
s can use View.getOwnerPrimaryView()
.
getPrimaryView
in interface ViewGroup
public void onViewRenamed(View view, String oldName, String newName)
ViewGroup
View
calls this method when it's renamed.
This method is intended to work as a notification to the ViewGroup
(so that it can adjust its internal data structure, for example.)
It is the caller's responsibility to ensure that the new name is a legal view name.
onViewRenamed
in interface ViewGroup
public ViewsTabBar getViewsTabBar()
ViewGroup
getViewsTabBar
in interface ViewGroup
public ItemGroup<? extends TopLevelItem> getItemGroup()
ViewGroup
ItemGroup
from which the views in this group should render items.
Generally speaking, Views render a subset of TopLevelItem
s that belong to this item group.
This method was added later to ViewGroup
, so old plugins might not be implementing this.
To work around this, View
s can use View.getOwnerItemGroup()
.
getItemGroup
in interface ViewGroup
ModifiableItemGroup
(if the container allows arbitrary addition)public List<Action> getViewActions()
ViewGroup
In this interface, the return value is used read-only. This doesn't prevent subtypes from returning modifiable actions, however.
This method was added later to ViewGroup
, so old plugins might not be implementing this.
To work around this, View
s can use View.getOwnerViewActions()
.
getViewActions
in interface ViewGroup
Actionable.getActions()
public Object getStaplerFallback()
getStaplerFallback
in interface org.kohsuke.stapler.StaplerFallback
public TopLevelItem getJob(String name)
getItem(java.lang.String)
but named this way as a WebMethod
.
Hudson.getJob(java.lang.String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |