Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
梦中观雨
cat
提交
92336b90
C
cat
项目概览
梦中观雨
/
cat
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
cat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
92336b90
编写于
2月 10, 2015
作者:
Y
youyong205
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor code
上级
8cbd3d94
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
12 addition
and
24 deletion
+12
-24
cat-core/src/main/java/com/dianping/cat/service/ProjectService.java
...rc/main/java/com/dianping/cat/service/ProjectService.java
+11
-23
cat-home/src/main/java/com/dianping/cat/report/page/AbstractReportModel.java
...ava/com/dianping/cat/report/page/AbstractReportModel.java
+1
-1
未找到文件。
cat-core/src/main/java/com/dianping/cat/service/ProjectService.java
浏览文件 @
92336b90
...
...
@@ -3,7 +3,6 @@ package com.dianping.cat.service;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
...
...
@@ -51,11 +50,9 @@ public class ProjectService implements Initializable {
public
boolean
delete
(
Project
project
)
{
int
id
=
project
.
getId
();
Iterator
<
Entry
<
String
,
Project
>>
iterator
=
m_domainToProjects
.
entrySet
().
iterator
();
String
domainName
=
null
;
while
(
iterator
.
hasNext
())
{
Entry
<
String
,
Project
>
entry
=
iterator
.
next
();
for
(
Entry
<
String
,
Project
>
entry:
m_domainToProjects
.
entrySet
()){
Project
pro
=
entry
.
getValue
();
if
(
pro
.
getId
()
==
id
)
{
...
...
@@ -107,8 +104,8 @@ public class ProjectService implements Initializable {
return
project
;
}
public
Map
<
String
,
Department
>
getDepartment
(
Collection
<
String
>
domains
)
{
Map
<
String
,
Department
>
result
=
new
TreeMap
<
String
,
Department
>();
public
Map
<
String
,
Department
>
findDepartments
(
Collection
<
String
>
domains
)
{
Map
<
String
,
Department
>
departments
=
new
TreeMap
<
String
,
Department
>();
for
(
String
domain
:
domains
)
{
Project
project
=
findProject
(
domain
);
...
...
@@ -122,16 +119,16 @@ public class ProjectService implements Initializable {
department
=
bu
==
null
?
DEFAULT
:
bu
;
projectLine
=
productline
==
null
?
DEFAULT
:
productline
;
}
Department
temp
=
result
.
get
(
department
);
Department
temp
=
departments
.
get
(
department
);
if
(
temp
==
null
)
{
temp
=
new
Department
();
result
.
put
(
department
,
temp
);
departments
.
put
(
department
,
temp
);
}
temp
.
findOrCreatProjectLine
(
projectLine
).
addDomain
(
domain
);
}
return
result
;
return
departments
;
}
@Override
...
...
@@ -145,6 +142,7 @@ public class ProjectService implements Initializable {
m_domainToProjects
.
put
(
project
.
getDomain
(),
project
);
int
result
=
m_projectDao
.
insert
(
project
);
if
(
result
==
1
)
{
return
true
;
}
else
{
...
...
@@ -158,6 +156,7 @@ public class ProjectService implements Initializable {
project
.
setDomain
(
domain
);
project
.
setCmdbProductline
(
DEFAULT
);
project
.
setBu
(
DEFAULT
);
try
{
insert
(
project
);
m_domains
.
add
(
domain
);
...
...
@@ -206,11 +205,7 @@ public class ProjectService implements Initializable {
private
Map
<
String
,
ProjectLine
>
m_projectLines
=
new
TreeMap
<
String
,
ProjectLine
>();
public
ProjectLine
findOrCreatProjectLine
(
String
projectLine
)
{
if
(
projectLine
==
null
)
{
projectLine
=
"Default"
;
}
ProjectLine
line
=
m_projectLines
.
get
(
projectLine
);
ProjectLine
line
=
m_projectLines
.
get
(
String
.
valueOf
(
projectLine
));
if
(
line
==
null
)
{
line
=
new
ProjectLine
();
...
...
@@ -223,10 +218,6 @@ public class ProjectService implements Initializable {
public
Map
<
String
,
ProjectLine
>
getProjectLines
()
{
return
m_projectLines
;
}
public
void
setProjectLines
(
Map
<
String
,
ProjectLine
>
projectLines
)
{
m_projectLines
=
projectLines
;
}
}
public
static
class
ProjectLine
{
...
...
@@ -239,10 +230,6 @@ public class ProjectService implements Initializable {
public
List
<
String
>
getLineDomains
()
{
return
m_lineDomains
;
}
public
void
setLineDomains
(
List
<
String
>
lineDomains
)
{
m_lineDomains
=
lineDomains
;
}
}
public
class
ProjectReloadTask
implements
Task
{
...
...
@@ -275,4 +262,5 @@ public class ProjectService implements Initializable {
public
void
shutdown
()
{
}
}
}
cat-home/src/main/java/com/dianping/cat/report/page/AbstractReportModel.java
浏览文件 @
92336b90
...
...
@@ -105,7 +105,7 @@ public abstract class AbstractReportModel<A extends Action, M extends ActionCont
public
abstract
String
getDomain
();
public
Map
<
String
,
Department
>
getDomainGroups
()
{
return
m_projectService
.
getDepartment
(
getDomains
());
return
m_projectService
.
findDepartments
(
getDomains
());
}
public
abstract
Collection
<
String
>
getDomains
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录