Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
724df641
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
724df641
编写于
4月 11, 2015
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/JENKINS-26781' into JENKINS-26781
上级
33041903
901194ae
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
58 addition
and
20 deletion
+58
-20
core/src/main/java/hudson/model/Descriptor.java
core/src/main/java/hudson/model/Descriptor.java
+44
-9
core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java
.../src/main/java/hudson/tools/DownloadFromUrlInstaller.java
+3
-3
core/src/main/resources/lib/form/class-entry.jelly
core/src/main/resources/lib/form/class-entry.jelly
+11
-8
未找到文件。
core/src/main/java/hudson/model/Descriptor.java
浏览文件 @
724df641
...
...
@@ -909,14 +909,20 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable {
if
(
formData
!=
null
)
{
for
(
Object
o
:
JSONArray
.
fromObject
(
formData
))
{
JSONObject
jo
=
(
JSONObject
)
o
;
String
kind
=
jo
.
optString
(
"$class"
,
null
);
if
(
kind
==
null
)
{
// Legacy: Remove once plugins have been staged onto $class
kind
=
jo
.
getString
(
"kind"
);
Descriptor
<
T
>
d
=
null
;
String
kind
=
jo
.
optString
(
"kind"
,
null
);
if
(
kind
!=
null
)
{
d
=
findById
(
descriptors
,
kind
);
}
if
(
d
==
null
)
{
kind
=
jo
.
getString
(
"$class"
);
d
=
findByDescribableClassName
(
descriptors
,
kind
);
if
(
d
==
null
)
d
=
findByClassName
(
descriptors
,
kind
);
}
Descriptor
<
T
>
d
=
find
(
descriptors
,
kind
);
if
(
d
!=
null
)
{
items
.
add
(
d
.
newInstance
(
req
,
jo
));
}
else
{
LOGGER
.
warning
(
"Received unexpected formData for descriptor "
+
kind
);
}
}
}
...
...
@@ -924,23 +930,52 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable {
return
items
;
}
/**
* Finds a descriptor from a collection by its id.
*/
public
static
@CheckForNull
<
T
extends
Descriptor
>
T
findById
(
Collection
<?
extends
T
>
list
,
String
id
)
{
for
(
T
d
:
list
)
{
if
(
d
.
getId
().
equals
(
id
))
return
d
;
}
return
null
;
}
/**
* Finds a descriptor from a collection by its class name.
* @deprecated Since we introduced {@link Descriptor#getId()}, it is a preferred method of identifying descriptor by a string.
*/
public
static
@CheckForNull
<
T
extends
Descriptor
>
T
find
(
Collection
<?
extends
T
>
list
,
String
className
)
{
public
static
@CheckForNull
<
T
extends
Descriptor
>
T
find
ByClassName
(
Collection
<?
extends
T
>
list
,
String
className
)
{
for
(
T
d
:
list
)
{
if
(
d
.
getClass
().
getName
().
equals
(
className
))
return
d
;
}
// Since we introduced Descriptor.getId(), it is a preferred method of identifying descriptor by a string.
// To make that migration easier without breaking compatibility, let's also match up with the id.
return
null
;
}
/**
* Finds a descriptor from a collection by the class name of the Describable it describes.
*/
public
static
@CheckForNull
<
T
extends
Descriptor
>
T
findByDescribableClassName
(
Collection
<?
extends
T
>
list
,
String
className
)
{
for
(
T
d
:
list
)
{
if
(
d
.
getId
().
equals
(
className
))
if
(
d
.
clazz
.
getName
().
equals
(
className
))
return
d
;
}
return
null
;
}
/**
* Finds a descriptor from a collection by its class name or ID.
* @deprecated choose between {@link #findById(java.util.Collection, String)} or {@link #findByClassName(java.util.Collection, String)}
*/
public
static
@CheckForNull
<
T
extends
Descriptor
>
T
find
(
Collection
<?
extends
T
>
list
,
String
string
)
{
T
d
=
findByClassName
(
list
,
string
);
if
(
d
!=
null
)
{
return
d
;
}
return
findById
(
list
,
string
);
}
public
static
@CheckForNull
Descriptor
find
(
String
className
)
{
return
find
(
ExtensionList
.
lookup
(
Descriptor
.
class
),
className
);
}
...
...
core/src/main/java/hudson/tools/DownloadFromUrlInstaller.java
浏览文件 @
724df641
...
...
@@ -122,7 +122,7 @@ public abstract class DownloadFromUrlInstaller extends ToolInstaller {
}
protected
Downloadable
createDownloadable
()
{
return
new
Downloadable
(
getId
());
return
new
Downloadable
(
get
Downloadable
Id
());
}
/**
...
...
@@ -130,7 +130,7 @@ public abstract class DownloadFromUrlInstaller extends ToolInstaller {
* <p>
* By default we use the fully-qualified class name of the {@link DownloadFromUrlInstaller} subtype.
*/
public
String
getId
()
{
public
String
get
Downloadable
Id
()
{
return
clazz
.
getName
().
replace
(
'$'
,
'.'
);
}
...
...
@@ -144,7 +144,7 @@ public abstract class DownloadFromUrlInstaller extends ToolInstaller {
* @return never null.
*/
public
List
<?
extends
Installable
>
getInstallables
()
throws
IOException
{
JSONObject
d
=
Downloadable
.
get
(
getId
()).
getData
();
JSONObject
d
=
Downloadable
.
get
(
get
Downloadable
Id
()).
getData
();
if
(
d
==
null
)
return
Collections
.
emptyList
();
return
Arrays
.
asList
(((
InstallableList
)
JSONObject
.
toBean
(
d
,
InstallableList
.
class
)).
list
);
}
...
...
core/src/main/resources/lib/form/class-entry.jelly
浏览文件 @
724df641
...
...
@@ -36,12 +36,15 @@ THE SOFTWARE.
</st:documentation>
<j:set var="clazz" value="${attrs.clazz ?: attrs.descriptor.clazz.name}" />
<f:invisibleEntry>
<!-- Legacy: Remove once plugins have been staged onto $class -->
<input type="hidden" name="stapler-class" value="${clazz}" />
<!-- Legacy: Remove once plugins have been staged onto $class -->
<j:if test="${attrs.descriptor != null}">
<input type="hidden" name="kind" value="${attrs.descriptor.id}" />
</j:if>
<input type="hidden" name="$class" value="${clazz}" />
<j:choose>
<j:when test="${descriptor != null and descriptor.id != clazz}">
<input type="hidden" name="kind" value="${attrs.descriptor.id}" />
</j:when>
<j:otherwise>
<!-- Legacy: Remove once plugins have been staged onto $class -->
<input type="hidden" name="stapler-class" value="${clazz}" />
<input type="hidden" name="$class" value="${clazz}" />
</j:otherwise>
</j:choose>
</f:invisibleEntry>
</j:jelly>
\ No newline at end of file
</j:jelly>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录