Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
openSource
apollo
Commits
81e7900d
Commit
81e7900d
authored
Jul 28, 2016
by
lepdou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
83ae4032
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
34 deletions
+42
-34
Change.java
...a/com/ctrip/framework/apollo/portal/entity/vo/Change.java
+31
-0
ReleaseCompareResult.java
...amework/apollo/portal/entity/vo/ReleaseCompareResult.java
+2
-31
ChangeType.java
...a/com/ctrip/framework/apollo/portal/enums/ChangeType.java
+5
-0
ReleaseService.java
...ctrip/framework/apollo/portal/service/ReleaseService.java
+4
-3
No files found.
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/Change.java
0 → 100644
View file @
81e7900d
package
com
.
ctrip
.
framework
.
apollo
.
portal
.
entity
.
vo
;
import
com.ctrip.framework.apollo.portal.enums.ChangeType
;
public
class
Change
{
private
ChangeType
type
;
private
EntityPair
<
KVEntity
>
entity
;
public
Change
(
ChangeType
type
,
EntityPair
<
KVEntity
>
entity
)
{
this
.
type
=
type
;
this
.
entity
=
entity
;
}
public
ChangeType
getType
()
{
return
type
;
}
public
void
setType
(
ChangeType
type
)
{
this
.
type
=
type
;
}
public
EntityPair
<
KVEntity
>
getEntity
()
{
return
entity
;
}
public
void
setEntity
(
EntityPair
<
KVEntity
>
entity
)
{
this
.
entity
=
entity
;
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/vo/ReleaseCompareResult.java
View file @
81e7900d
package
com
.
ctrip
.
framework
.
apollo
.
portal
.
entity
.
vo
;
import
com.ctrip.framework.apollo.portal.enums.ChangeType
;
import
java.util.LinkedList
;
import
java.util.List
;
...
...
@@ -19,35 +21,4 @@ public class ReleaseCompareResult {
this
.
changes
=
changes
;
}
public
class
Change
{
private
ChangeType
type
;
private
EntityPair
<
KVEntity
>
entity
;
public
Change
(
ChangeType
type
,
EntityPair
<
KVEntity
>
entity
)
{
this
.
type
=
type
;
this
.
entity
=
entity
;
}
public
ChangeType
getType
()
{
return
type
;
}
public
void
setType
(
ChangeType
type
)
{
this
.
type
=
type
;
}
public
EntityPair
<
KVEntity
>
getEntity
()
{
return
entity
;
}
public
void
setEntity
(
EntityPair
<
KVEntity
>
entity
)
{
this
.
entity
=
entity
;
}
}
public
enum
ChangeType
{
ADD
,
MODIFY
,
DELETE
}
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/enums/ChangeType.java
0 → 100644
View file @
81e7900d
package
com
.
ctrip
.
framework
.
apollo
.
portal
.
enums
;
public
enum
ChangeType
{
ADD
,
MODIFY
,
DELETE
}
apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/service/ReleaseService.java
View file @
81e7900d
...
...
@@ -12,6 +12,7 @@ import com.ctrip.framework.apollo.portal.entity.form.NamespaceReleaseModel;
import
com.ctrip.framework.apollo.portal.entity.vo.KVEntity
;
import
com.ctrip.framework.apollo.portal.entity.vo.ReleaseCompareResult
;
import
com.ctrip.framework.apollo.portal.entity.vo.ReleaseVO
;
import
com.ctrip.framework.apollo.portal.enums.ChangeType
;
import
com.dianping.cat.Cat
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -100,10 +101,10 @@ public class ReleaseService {
String
secondValue
=
secondItems
.
get
(
key
);
//added
if
(
secondValue
==
null
)
{
compareResult
.
addEntityPair
(
ReleaseCompareResult
.
ChangeType
.
DELETE
,
new
KVEntity
(
key
,
firstValue
),
compareResult
.
addEntityPair
(
ChangeType
.
DELETE
,
new
KVEntity
(
key
,
firstValue
),
new
KVEntity
(
key
,
secondValue
));
}
else
if
(!
Objects
.
equal
(
firstValue
,
secondValue
))
{
compareResult
.
addEntityPair
(
ReleaseCompareResult
.
ChangeType
.
MODIFY
,
new
KVEntity
(
key
,
firstValue
),
compareResult
.
addEntityPair
(
ChangeType
.
MODIFY
,
new
KVEntity
(
key
,
firstValue
),
new
KVEntity
(
key
,
secondValue
));
}
...
...
@@ -115,7 +116,7 @@ public class ReleaseService {
String
value
=
entry
.
getValue
();
if
(
firstItems
.
get
(
key
)
==
null
)
{
compareResult
.
addEntityPair
(
ReleaseCompareResult
.
ChangeType
.
ADD
,
new
KVEntity
(
key
,
""
),
new
KVEntity
(
key
,
value
));
.
addEntityPair
(
ChangeType
.
ADD
,
new
KVEntity
(
key
,
""
),
new
KVEntity
(
key
,
value
));
}
}
...
...
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