提交 81e7900d 编写于 作者: L lepdou

update

上级 83ae4032
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;
}
}
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
}
}
package com.ctrip.framework.apollo.portal.enums;
public enum ChangeType {
ADD, MODIFY, DELETE
}
......@@ -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));
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册