提交 087993bc 编写于 作者: K Kohsuke Kawaguchi

adding a new method to replace an existing job.

上级 56ebe8ff
......@@ -2068,6 +2068,24 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
return item;
}
/**
* Overwrites the existing item by new one.
*
* <p>
* This is a short cut for deleting an existing job and adding a new one.
*/
public synchronized void putItem(TopLevelItem item) throws IOException, InterruptedException {
String name = item.getName();
TopLevelItem old = items.get(name);
if (old ==item) return; // noop
checkPermission(Item.CREATE);
if (old!=null)
old.delete();
items.put(name,item);
ItemListener.fireOnCreated(item);
}
/**
* Creates a new job.
*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册