hudson.model
Class ItemGroupMixIn

java.lang.Object
  extended by hudson.model.ItemGroupMixIn

public abstract class ItemGroupMixIn
extends Object

Defines a bunch of static methods to be used as a "mix-in" for ItemGroup implementations. Not meant for a consumption from outside ItemGroups.

Author:
Kohsuke Kawaguchi
See Also:
ViewGroupMixIn

Field Summary
static Function1<String,Item> KEYED_BY_NAME
          Item -> name function.
 
Constructor Summary
protected ItemGroupMixIn(ItemGroup parent, AccessControlled acl)
           
 
Method Summary
protected abstract  void add(TopLevelItem item)
          Adds a newly created item to the parent.
<T extends TopLevelItem>
T
copy(T src, String name)
          Copies an existing TopLevelItem to a new name.
 TopLevelItem createProject(TopLevelItemDescriptor type, String name, boolean notify)
           
 TopLevelItem createProjectFromXML(String name, InputStream xml)
           
 TopLevelItem createTopLevelItem(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Creates a TopLevelItem from the submission of the '/lib/hudson/newFromList/formList' or throws an exception if it fails.
protected abstract  File getRootDirFor(String name)
          Assigns the root directory for a prospective item.
static
<K,V extends Item>
Map<K,V>
loadChildren(ItemGroup parent, File modulesDir, Function1<? extends K,? super V> key)
          Loads all the child Items.
protected  String redirectAfterCreateItem(org.kohsuke.stapler.StaplerRequest req, TopLevelItem result)
          Computes the redirection target URL for the newly created TopLevelItem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYED_BY_NAME

public static final Function1<String,Item> KEYED_BY_NAME
Item -> name function.

Constructor Detail

ItemGroupMixIn

protected ItemGroupMixIn(ItemGroup parent,
                         AccessControlled acl)
Method Detail

add

protected abstract void add(TopLevelItem item)
Adds a newly created item to the parent.


getRootDirFor

protected abstract File getRootDirFor(String name)
Assigns the root directory for a prospective item.


loadChildren

public static <K,V extends Item> Map<K,V> loadChildren(ItemGroup parent,
                                                       File modulesDir,
                                                       Function1<? extends K,? super V> key)
Loads all the child Items.

Parameters:
modulesDir - Directory that contains sub-directories for each child item.

createTopLevelItem

public TopLevelItem createTopLevelItem(org.kohsuke.stapler.StaplerRequest req,
                                       org.kohsuke.stapler.StaplerResponse rsp)
                                throws IOException,
                                       javax.servlet.ServletException
Creates a TopLevelItem from the submission of the '/lib/hudson/newFromList/formList' or throws an exception if it fails.

Throws:
IOException
javax.servlet.ServletException

redirectAfterCreateItem

protected String redirectAfterCreateItem(org.kohsuke.stapler.StaplerRequest req,
                                         TopLevelItem result)
                                  throws IOException
Computes the redirection target URL for the newly created TopLevelItem.

Throws:
IOException

copy

public <T extends TopLevelItem> T copy(T src,
                                       String name)
                            throws IOException
Copies an existing TopLevelItem to a new name. The caller is responsible for calling ItemListener.fireOnCopied(Item, Item). This method cannot do that because it doesn't know how to make the newly added item reachable from the parent.

Throws:
IOException

createProjectFromXML

public TopLevelItem createProjectFromXML(String name,
                                         InputStream xml)
                                  throws IOException
Throws:
IOException

createProject

public TopLevelItem createProject(TopLevelItemDescriptor type,
                                  String name,
                                  boolean notify)
                           throws IOException
Throws:
IOException


Copyright © 2004-2013. All Rights Reserved.