[Issue] #1769 Solve the bug of the clone configuration function

This commit is contained in:
ly 2019-08-31 10:39:42 +08:00
parent 815a339228
commit 40be568c01
4 changed files with 8 additions and 20 deletions

View File

@ -482,7 +482,7 @@ public class ConfigController {
return ResultBuilder.buildResult(ResultCodeEnum.NAMESPACE_NOT_EXIST, failedData);
}
}
List<ConfigInfo> configInfoList = null;
List<ConfigAllInfo> configInfoList = null;
try {
ZipUtils.UnZipResult unziped = ZipUtils.unzip(file.getBytes());
ZipUtils.ZipItem metaDataZipItem = unziped.getMetaDataItem();
@ -516,7 +516,7 @@ public class ConfigController {
+ "~" + tempDataId.substring(tempDataId.lastIndexOf(".") + 1);
}
String metaDataId = group + "." + tempDataId + ".app";
ConfigInfo ci = new ConfigInfo();
ConfigAllInfo ci = new ConfigAllInfo();
ci.setTenant(namespace);
ci.setGroup(group);
ci.setDataId(dataId);
@ -577,10 +577,10 @@ public class ConfigController {
return ResultBuilder.buildResult(ResultCodeEnum.DATA_EMPTY, failedData);
}
List<ConfigInfo> configInfoList4Clone = new ArrayList<>(queryedDataList.size());
List<ConfigAllInfo> configInfoList4Clone = new ArrayList<>(queryedDataList.size());
for(ConfigInfo ci : queryedDataList){
ConfigInfo ci4save = new ConfigInfo();
for(ConfigAllInfo ci : queryedDataList){
ConfigAllInfo ci4save = new ConfigAllInfo();
ci4save.setTenant(namespace);
ci4save.setType(ci.getType());
ci4save.setGroup(ci.getGroup());

View File

@ -97,12 +97,10 @@ public class ConfigAllInfo extends ConfigInfo {
this.effect = effect;
}
@Override
public String getType() {
return type;
}
@Override
public void setType(String type) {
this.type = type;
}

View File

@ -28,8 +28,6 @@ public class ConfigInfo extends ConfigInfoBase {
private String appName;
private String type;
public ConfigInfo() {
}
@ -65,14 +63,6 @@ public class ConfigInfo extends ConfigInfoBase {
this.appName = appName;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override
public int hashCode() {
return super.hashCode();
@ -87,7 +77,7 @@ public class ConfigInfo extends ConfigInfoBase {
public String toString() {
return "ConfigInfo{" + "id=" + getId() + ", dataId='" + getDataId() + '\'' + ", group='" + getGroup() + '\''
+ ", tenant='" + tenant + '\'' + ", appName='" + appName + '\'' + ", content='" + getContent() + '\''
+ ", md5='" + getMd5() + '\'' + ", type='" + type + '\'' + '}';
+ ", md5='" + getMd5() + '\'' + '}';
}
}

View File

@ -3466,7 +3466,7 @@ public class PersistService {
* failData: import failed data (only with abort for the same configs)
* skipData: data skipped at import (only with skip for the same configs)
*/
public Map<String, Object> batchInsertOrUpdate(List<ConfigInfo> configInfoList, String srcUser, String srcIp,
public Map<String, Object> batchInsertOrUpdate(List<ConfigAllInfo> configInfoList, String srcUser, String srcIp,
Map<String, Object> configAdvanceInfo, Timestamp time, boolean notify, SameConfigPolicy policy) throws NacosException {
int succCount = 0;
int skipCount = 0;
@ -3474,7 +3474,7 @@ public class PersistService {
List<Map<String, String>> skipData = null;
for (int i = 0; i < configInfoList.size(); i++) {
ConfigInfo configInfo = configInfoList.get(i);
ConfigAllInfo configInfo = configInfoList.get(i);
try {
ParamUtils.checkParam(configInfo.getDataId(), configInfo.getGroup(), "datumId", configInfo.getContent());
} catch (NacosException e) {