Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
21ec2a72
J
jenkins
项目概览
LinuxSuRen
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
21ec2a72
编写于
5月 14, 2014
作者:
O
Oliver Gondža
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[JENKINS-22967] Make DirectlyModifiableView an interface rather than class
上级
8fc60f0c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
44 addition
and
42 deletion
+44
-42
core/src/main/java/hudson/model/DirectlyModifiableView.java
core/src/main/java/hudson/model/DirectlyModifiableView.java
+10
-41
core/src/main/java/hudson/model/ListView.java
core/src/main/java/hudson/model/ListView.java
+34
-1
core/src/main/resources/hudson/model/ListView/_api.jelly
core/src/main/resources/hudson/model/ListView/_api.jelly
+0
-0
未找到文件。
core/src/main/java/hudson/model/DirectlyModifiableView.java
浏览文件 @
21ec2a72
...
...
@@ -35,20 +35,12 @@ import org.kohsuke.stapler.QueryParameter;
import
org.kohsuke.stapler.interceptor.RequirePOST
;
/**
*
View
its items can be modified.
*
Marker interface for {@link View}
its items can be modified.
*
* @author ogondza
* @since TODO
*/
public
abstract
class
DirectlyModifiableView
extends
View
{
public
DirectlyModifiableView
(
String
name
)
{
super
(
name
);
}
public
DirectlyModifiableView
(
String
name
,
ViewGroup
owner
)
{
super
(
name
,
owner
);
}
public
interface
DirectlyModifiableView
{
/**
* Remove item from this view.
...
...
@@ -57,7 +49,7 @@ public abstract class DirectlyModifiableView extends View {
* @throws IOException Removal failed.
* @throws IllegalArgumentException View rejected to remove an item.
*/
public
abstract
boolean
remove
(
@Nonnull
TopLevelItem
item
)
throws
IOException
,
IllegalArgumentException
;
boolean
remove
(
@Nonnull
TopLevelItem
item
)
throws
IOException
,
IllegalArgumentException
;
/**
* Add item to this view.
...
...
@@ -65,46 +57,23 @@ public abstract class DirectlyModifiableView extends View {
* @throws IOException Adding failed.
* @throws IllegalArgumentException View rejected to add an item.
*/
public
abstract
void
add
(
@Nonnull
TopLevelItem
item
)
throws
IOException
,
IllegalArgumentException
;
void
add
(
@Nonnull
TopLevelItem
item
)
throws
IOException
,
IllegalArgumentException
;
/**
* Handle addJobToView web method.
*
* This method should @RequirePOST.
*
* @param name Item name.
*/
@RequirePOST
public
HttpResponse
doAddJobToView
(
@QueryParameter
String
name
)
throws
IOException
,
ServletException
{
checkPermission
(
View
.
CONFIGURE
);
if
(
name
==
null
)
throw
new
Failure
(
"Query parameter 'name' is required"
);
TopLevelItem
item
=
getOwnerItemGroup
().
getItem
(
name
);
if
(
item
==
null
)
throw
new
Failure
(
"Query parameter 'name' does not correspond to a known item"
);
if
(
contains
(
item
))
return
HttpResponses
.
ok
();
add
(
item
);
owner
.
save
();
return
HttpResponses
.
ok
();
}
HttpResponse
doAddJobToView
(
@QueryParameter
String
name
)
throws
IOException
,
ServletException
;
/**
* Handle removeJobFromView web method.
*
* This method should @RequirePOST.
*
* @param name Item name.
*/
@RequirePOST
public
HttpResponse
doRemoveJobFromView
(
@QueryParameter
String
name
)
throws
IOException
,
ServletException
{
checkPermission
(
View
.
CONFIGURE
);
if
(
name
==
null
)
throw
new
Failure
(
"Query parameter 'name' is required"
);
TopLevelItem
item
=
getOwnerItemGroup
().
getItem
(
name
);
if
(
remove
(
item
))
owner
.
save
();
return
HttpResponses
.
ok
();
}
HttpResponse
doRemoveJobFromView
(
@QueryParameter
String
name
)
throws
IOException
,
ServletException
;
}
core/src/main/java/hudson/model/ListView.java
浏览文件 @
21ec2a72
...
...
@@ -63,7 +63,7 @@ import org.kohsuke.stapler.interceptor.RequirePOST;
*
* @author Kohsuke Kawaguchi
*/
public
class
ListView
extends
DirectlyModifiableView
{
public
class
ListView
extends
View
implements
DirectlyModifiableView
{
/**
* List of job names. This is what gets serialized.
...
...
@@ -305,6 +305,39 @@ public class ListView extends DirectlyModifiableView {
return
null
;
}
@Override
@RequirePOST
public
HttpResponse
doAddJobToView
(
@QueryParameter
String
name
)
throws
IOException
,
ServletException
{
checkPermission
(
View
.
CONFIGURE
);
if
(
name
==
null
)
throw
new
Failure
(
"Query parameter 'name' is required"
);
TopLevelItem
item
=
getOwnerItemGroup
().
getItem
(
name
);
if
(
item
==
null
)
throw
new
Failure
(
"Query parameter 'name' does not correspond to a known item"
);
if
(
contains
(
item
))
return
HttpResponses
.
ok
();
add
(
item
);
owner
.
save
();
return
HttpResponses
.
ok
();
}
@Override
@RequirePOST
public
HttpResponse
doRemoveJobFromView
(
@QueryParameter
String
name
)
throws
IOException
,
ServletException
{
checkPermission
(
View
.
CONFIGURE
);
if
(
name
==
null
)
throw
new
Failure
(
"Query parameter 'name' is required"
);
TopLevelItem
item
=
getOwnerItemGroup
().
getItem
(
name
);
if
(
remove
(
item
))
owner
.
save
();
return
HttpResponses
.
ok
();
}
/**
* Handles the configuration submission.
*
...
...
core/src/main/resources/hudson/model/
DirectlyModifiable
View/_api.jelly
→
core/src/main/resources/hudson/model/
List
View/_api.jelly
浏览文件 @
21ec2a72
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录