Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
apollo
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
apollo
Commits
8cb5b3aa
Commit
8cb5b3aa
authored
Dec 28, 2019
by
Lei Jiang
Committed by
kezhenxu94
Dec 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Style] Add curly braces after `if` statements
parent
99a6f5dd
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
14 deletions
+35
-14
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceController.java
...k/apollo/adminservice/controller/NamespaceController.java
+11
-6
apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/BaseEntity.java
.../com/ctrip/framework/apollo/common/entity/BaseEntity.java
+6
-2
apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java
...va/com/ctrip/framework/apollo/common/utils/BeanUtils.java
+12
-4
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/util/InstanceConfigAuditUtil.java
...rk/apollo/configservice/util/InstanceConfigAuditUtil.java
+6
-2
No files found.
apollo-adminservice/src/main/java/com/ctrip/framework/apollo/adminservice/controller/NamespaceController.java
View file @
8cb5b3aa
...
@@ -47,8 +47,10 @@ public class NamespaceController {
...
@@ -47,8 +47,10 @@ public class NamespaceController {
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"namespaceName"
)
String
namespaceName
,
@RequestParam
String
operator
)
{
@PathVariable
(
"namespaceName"
)
String
namespaceName
,
@RequestParam
String
operator
)
{
Namespace
entity
=
namespaceService
.
findOne
(
appId
,
clusterName
,
namespaceName
);
Namespace
entity
=
namespaceService
.
findOne
(
appId
,
clusterName
,
namespaceName
);
if
(
entity
==
null
)
throw
new
NotFoundException
(
if
(
entity
==
null
)
{
throw
new
NotFoundException
(
String
.
format
(
"namespace not found for %s %s %s"
,
appId
,
clusterName
,
namespaceName
));
String
.
format
(
"namespace not found for %s %s %s"
,
appId
,
clusterName
,
namespaceName
));
}
namespaceService
.
deleteNamespace
(
entity
,
operator
);
namespaceService
.
deleteNamespace
(
entity
,
operator
);
}
}
...
@@ -63,8 +65,9 @@ public class NamespaceController {
...
@@ -63,8 +65,9 @@ public class NamespaceController {
@GetMapping
(
"/namespaces/{namespaceId}"
)
@GetMapping
(
"/namespaces/{namespaceId}"
)
public
NamespaceDTO
get
(
@PathVariable
(
"namespaceId"
)
Long
namespaceId
)
{
public
NamespaceDTO
get
(
@PathVariable
(
"namespaceId"
)
Long
namespaceId
)
{
Namespace
namespace
=
namespaceService
.
findOne
(
namespaceId
);
Namespace
namespace
=
namespaceService
.
findOne
(
namespaceId
);
if
(
namespace
==
null
)
if
(
namespace
==
null
)
{
throw
new
NotFoundException
(
String
.
format
(
"namespace not found for %s"
,
namespaceId
));
throw
new
NotFoundException
(
String
.
format
(
"namespace not found for %s"
,
namespaceId
));
}
return
BeanUtils
.
transform
(
NamespaceDTO
.
class
,
namespace
);
return
BeanUtils
.
transform
(
NamespaceDTO
.
class
,
namespace
);
}
}
...
@@ -73,8 +76,10 @@ public class NamespaceController {
...
@@ -73,8 +76,10 @@ public class NamespaceController {
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"clusterName"
)
String
clusterName
,
@PathVariable
(
"namespaceName"
)
String
namespaceName
)
{
@PathVariable
(
"namespaceName"
)
String
namespaceName
)
{
Namespace
namespace
=
namespaceService
.
findOne
(
appId
,
clusterName
,
namespaceName
);
Namespace
namespace
=
namespaceService
.
findOne
(
appId
,
clusterName
,
namespaceName
);
if
(
namespace
==
null
)
throw
new
NotFoundException
(
if
(
namespace
==
null
)
{
throw
new
NotFoundException
(
String
.
format
(
"namespace not found for %s %s %s"
,
appId
,
clusterName
,
namespaceName
));
String
.
format
(
"namespace not found for %s %s %s"
,
appId
,
clusterName
,
namespaceName
));
}
return
BeanUtils
.
transform
(
NamespaceDTO
.
class
,
namespace
);
return
BeanUtils
.
transform
(
NamespaceDTO
.
class
,
namespace
);
}
}
...
...
apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/BaseEntity.java
View file @
8cb5b3aa
...
@@ -90,8 +90,12 @@ public abstract class BaseEntity {
...
@@ -90,8 +90,12 @@ public abstract class BaseEntity {
@PrePersist
@PrePersist
protected
void
prePersist
()
{
protected
void
prePersist
()
{
if
(
this
.
dataChangeCreatedTime
==
null
)
dataChangeCreatedTime
=
new
Date
();
if
(
this
.
dataChangeCreatedTime
==
null
)
{
if
(
this
.
dataChangeLastModifiedTime
==
null
)
dataChangeLastModifiedTime
=
new
Date
();
dataChangeCreatedTime
=
new
Date
();
}
if
(
this
.
dataChangeLastModifiedTime
==
null
)
{
dataChangeLastModifiedTime
=
new
Date
();
}
}
}
@PreUpdate
@PreUpdate
...
...
apollo-common/src/main/java/com/ctrip/framework/apollo/common/utils/BeanUtils.java
View file @
8cb5b3aa
...
@@ -66,7 +66,9 @@ public class BeanUtils {
...
@@ -66,7 +66,9 @@ public class BeanUtils {
Set
<
String
>
emptyNames
=
new
HashSet
<>();
Set
<
String
>
emptyNames
=
new
HashSet
<>();
for
(
PropertyDescriptor
pd
:
pds
)
{
for
(
PropertyDescriptor
pd
:
pds
)
{
Object
srcValue
=
src
.
getPropertyValue
(
pd
.
getName
());
Object
srcValue
=
src
.
getPropertyValue
(
pd
.
getName
());
if
(
srcValue
==
null
)
emptyNames
.
add
(
pd
.
getName
());
if
(
srcValue
==
null
)
{
emptyNames
.
add
(
pd
.
getName
());
}
}
}
String
[]
result
=
new
String
[
emptyNames
.
size
()];
String
[]
result
=
new
String
[
emptyNames
.
size
()];
return
emptyNames
.
toArray
(
result
);
return
emptyNames
.
toArray
(
result
);
...
@@ -91,7 +93,9 @@ public class BeanUtils {
...
@@ -91,7 +93,9 @@ public class BeanUtils {
try
{
try
{
Class
<?>
clazz
=
list
.
get
(
0
).
getClass
();
Class
<?>
clazz
=
list
.
get
(
0
).
getClass
();
Field
field
=
deepFindField
(
clazz
,
key
);
Field
field
=
deepFindField
(
clazz
,
key
);
if
(
field
==
null
)
throw
new
IllegalArgumentException
(
"Could not find the key"
);
if
(
field
==
null
)
{
throw
new
IllegalArgumentException
(
"Could not find the key"
);
}
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
for
(
Object
o
:
list
)
{
for
(
Object
o
:
list
)
{
map
.
put
((
K
)
field
.
get
(
o
),
(
V
)
o
);
map
.
put
((
K
)
field
.
get
(
o
),
(
V
)
o
);
...
@@ -119,7 +123,9 @@ public class BeanUtils {
...
@@ -119,7 +123,9 @@ public class BeanUtils {
try
{
try
{
Class
<?>
clazz
=
list
.
get
(
0
).
getClass
();
Class
<?>
clazz
=
list
.
get
(
0
).
getClass
();
Field
field
=
deepFindField
(
clazz
,
key
);
Field
field
=
deepFindField
(
clazz
,
key
);
if
(
field
==
null
)
throw
new
IllegalArgumentException
(
"Could not find the key"
);
if
(
field
==
null
)
{
throw
new
IllegalArgumentException
(
"Could not find the key"
);
}
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
for
(
Object
o
:
list
)
{
for
(
Object
o
:
list
)
{
K
k
=
(
K
)
field
.
get
(
o
);
K
k
=
(
K
)
field
.
get
(
o
);
...
@@ -149,7 +155,9 @@ public class BeanUtils {
...
@@ -149,7 +155,9 @@ public class BeanUtils {
try
{
try
{
Class
<?>
clazz
=
list
.
get
(
0
).
getClass
();
Class
<?>
clazz
=
list
.
get
(
0
).
getClass
();
Field
field
=
deepFindField
(
clazz
,
key
);
Field
field
=
deepFindField
(
clazz
,
key
);
if
(
field
==
null
)
throw
new
IllegalArgumentException
(
"Could not find the key"
);
if
(
field
==
null
)
{
throw
new
IllegalArgumentException
(
"Could not find the key"
);
}
field
.
setAccessible
(
true
);
field
.
setAccessible
(
true
);
for
(
Object
o
:
list
)
{
for
(
Object
o
:
list
)
{
set
.
add
((
K
)
field
.
get
(
o
));
set
.
add
((
K
)
field
.
get
(
o
));
...
...
apollo-configservice/src/main/java/com/ctrip/framework/apollo/configservice/util/InstanceConfigAuditUtil.java
View file @
8cb5b3aa
...
@@ -242,8 +242,12 @@ public class InstanceConfigAuditUtil implements InitializingBean {
...
@@ -242,8 +242,12 @@ public class InstanceConfigAuditUtil implements InitializingBean {
@Override
@Override
public
boolean
equals
(
Object
o
)
{
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
this
==
o
)
{
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
InstanceConfigAuditModel
model
=
(
InstanceConfigAuditModel
)
o
;
InstanceConfigAuditModel
model
=
(
InstanceConfigAuditModel
)
o
;
return
Objects
.
equals
(
appId
,
model
.
appId
)
&&
return
Objects
.
equals
(
appId
,
model
.
appId
)
&&
Objects
.
equals
(
clusterName
,
model
.
clusterName
)
&&
Objects
.
equals
(
clusterName
,
model
.
clusterName
)
&&
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment