|
||||||||||
| 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 Items. |
|
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
AbstractItemItem is loaded from disk.
This is an opporunity to do a post load processing.
onLoad in interface ItemonLoad in class AbstractItemname - 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 Collection<TopLevelItem> getItems()
ItemGroup
getItems in interface ItemGroup<TopLevelItem>public TopLevelItem getItem(String name)
ItemGroupItem inside this group that has a given name.
getItem in interface ItemGroup<TopLevelItem>public Collection<? extends Job> getAllJobs()
AbstractItemItem contains as descendants.
getAllJobs in interface ItemgetAllJobs in class AbstractItem
public <T extends TopLevelItem> T copy(T src,
String name)
throws IOException
ModifiableTopLevelItemGroup
copy in interface ModifiableTopLevelItemGroupsrc - 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 ModifiableTopLevelItemGroupname - 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 ModifiableTopLevelItemGrouptype - 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.ServletExceptionpublic String getUrlChildPrefix()
ItemGroupItems.
Like "job", "item", etc.
getUrlChildPrefix in interface ItemGroup<TopLevelItem>public File getRootDirFor(TopLevelItem child)
ItemGrouproot directory for children.
getRootDirFor in interface ItemGroup<TopLevelItem>
public void onRenamed(TopLevelItem item,
String oldName,
String newName)
throws IOException
ItemGroupItems when they are renamed by users.
onRenamed in interface ItemGroup<TopLevelItem>IOException
public void onDeleted(TopLevelItem item)
throws IOException
ItemGroupItems when they are deleted by users.
onDeleted in interface ItemGroup<TopLevelItem>IOExceptionpublic 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 TopLevelItemDescribable.getDescriptor()
public void addView(View view)
throws IOException
IOExceptionpublic boolean canDelete(View view)
ViewGroup
canDelete in interface ViewGroup
public void deleteView(View view)
throws IOException
ViewGroup
deleteView in interface ViewGroupIOExceptionpublic Collection<View> getViews()
ViewGroup
getViews in interface ViewGrouppublic View getView(String name)
ViewGroup
getView in interface ViewGrouppublic View getPrimaryView()
ViewGroupIf 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, Views can use View.getOwnerPrimaryView().
getPrimaryView in interface ViewGroup
public void onViewRenamed(View view,
String oldName,
String newName)
ViewGroupView 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 ViewGrouppublic ViewsTabBar getViewsTabBar()
ViewGroup
getViewsTabBar in interface ViewGrouppublic ItemGroup<? extends TopLevelItem> getItemGroup()
ViewGroupItemGroup from which the views in this group should render items.
Generally speaking, Views render a subset of TopLevelItems 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, Views can use View.getOwnerItemGroup().
getItemGroup in interface ViewGroupModifiableItemGroup (if the container allows arbitrary addition)public List<Action> getViewActions()
ViewGroupIn 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, Views can use View.getOwnerViewActions().
getViewActions in interface ViewGroupActionable.getActions()public Object getStaplerFallback()
getStaplerFallback in interface org.kohsuke.stapler.StaplerFallbackpublic 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 | |||||||||