Skip to content

Commit cedba91

Browse files
author
吴炳亨
authored
Merge pull request #306 from NigelWu95/dev
fix indexmap when storage datasource set and fix huawei obsobject's c…
2 parents 3f4e964 + 1927c89 commit cedba91

File tree

5 files changed

+124
-122
lines changed

5 files changed

+124
-122
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version=8.4.6
1+
version=8.4.7
22

33
package_no_test:
44
mvn clean package -Dmaven.test.skip=true

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.qiniu</groupId>
88
<artifactId>qsuits</artifactId>
9-
<version>8.4.6</version>
9+
<version>8.4.7</version>
1010
<name>qsuits</name>
1111
<description>qiniu-suits is a efficient tools for qiniu api implemented by java8.</description>
1212
<url>https://github.com/NigelWu95/qiniu-suits-java</url>

src/main/java/com/qiniu/entry/CommonParams.java

+54-54
Original file line numberDiff line numberDiff line change
@@ -1045,70 +1045,70 @@ private void setIndexMap() throws IOException {
10451045
setIndex(entryParam.getValue("filepath-index", "filepath").trim(), "filepath");
10461046
} else { // 存储数据源的 keys 定义
10471047
keys.addAll(ConvertingUtils.defaultFileFields);
1048-
if ("upyun".equals(source)) {
1049-
fieldsMode = 1;
1050-
keys.remove(ConvertingUtils.defaultEtagField);
1051-
keys.remove(ConvertingUtils.defaultTypeField);
1052-
keys.remove(ConvertingUtils.defaultStatusField);
1053-
keys.remove(ConvertingUtils.defaultMd5Field);
1054-
keys.remove(ConvertingUtils.defaultOwnerField);
1055-
} else if ("huawei".equals(source)) {
1056-
fieldsMode = 2;
1057-
keys.remove(ConvertingUtils.defaultStatusField);
1058-
} else if (isStorageSource && !"qiniu".equals(source)) {
1059-
fieldsMode = 3;
1060-
keys.remove(ConvertingUtils.defaultMimeField);
1061-
keys.remove(ConvertingUtils.defaultStatusField);
1062-
keys.remove(ConvertingUtils.defaultMd5Field);
1063-
}
10641048
if (useDefault && isStorageSource) {
1049+
if ("upyun".equals(source)) {
1050+
fieldsMode = 1;
1051+
keys.remove(ConvertingUtils.defaultEtagField);
1052+
keys.remove(ConvertingUtils.defaultTypeField);
1053+
keys.remove(ConvertingUtils.defaultStatusField);
1054+
keys.remove(ConvertingUtils.defaultMd5Field);
1055+
keys.remove(ConvertingUtils.defaultOwnerField);
1056+
} else if ("huawei".equals(source)) {
1057+
fieldsMode = 2;
1058+
keys.remove(ConvertingUtils.defaultStatusField);
1059+
} else if (!"qiniu".equals(source)) {
1060+
fieldsMode = 3;
1061+
keys.remove(ConvertingUtils.defaultMimeField);
1062+
keys.remove(ConvertingUtils.defaultStatusField);
1063+
keys.remove(ConvertingUtils.defaultMd5Field);
1064+
}
10651065
for (String key : keys) indexMap.put(key, key);
10661066
} else {
10671067
setIndexes(keys, indexes, fieldIndex);
1068-
}
1069-
if (ProcessUtils.needFilepath(process) || "file".equals(parse)) {
1070-
// 由于 filepath 可能依据 parent 和文件名生成,故列表第一列亦可能为文件名,所以要确保没有设置 parent 才能给默认的 filepath-index=0
1071-
String filepathIndex = entryParam.getValue("filepath-index", "").trim();
1072-
if ("".equals(filepathIndex)) {
1073-
zeroDefault = true;
1074-
if (entryParam.getValue("parent-path", null) == null) {
1075-
indexMap.put(fieldIndex ? "filepath" : "0", "filepath");
1068+
if (ProcessUtils.needFilepath(process) || "file".equals(parse)) {
1069+
// 由于 filepath 可能依据 parent 和文件名生成,故列表第一列亦可能为文件名,所以要确保没有设置 parent 才能给默认的 filepath-index=0
1070+
String filepathIndex = entryParam.getValue("filepath-index", "").trim();
1071+
if ("".equals(filepathIndex)) {
1072+
zeroDefault = true;
1073+
if (entryParam.getValue("parent-path", null) == null) {
1074+
indexMap.put(fieldIndex ? "filepath" : "0", "filepath");
1075+
} else {
1076+
indexMap.put(fieldIndex ? "key" : "0", "key");
1077+
}
10761078
} else {
1077-
indexMap.put(fieldIndex ? "key" : "0", "key");
1079+
indexMap.put(filepathIndex, "filepath");
10781080
}
1079-
} else {
1080-
indexMap.put(filepathIndex, "filepath");
1081-
}
1082-
} else if (ProcessUtils.needUrl(process)) {
1083-
// 由于 url 可能依据 domain 和文件名生成,故列表第一列亦可能为文件名,所以要确保没有设置 domain 才能给默认的 url-index=0
1084-
String urlIndex = entryParam.getValue("url-index", "").trim();
1085-
if ("".equals(urlIndex)) {
1086-
zeroDefault = true;
1087-
if (entryParam.getValue("domain", null) == null) {
1088-
indexMap.put(fieldIndex ? "url" : "0", "url");
1081+
} else if (ProcessUtils.needUrl(process)) {
1082+
// 由于 url 可能依据 domain 和文件名生成,故列表第一列亦可能为文件名,所以要确保没有设置 domain 才能给默认的 url-index=0
1083+
String urlIndex = entryParam.getValue("url-index", "").trim();
1084+
if ("".equals(urlIndex)) {
1085+
zeroDefault = true;
1086+
if (entryParam.getValue("domain", null) == null) {
1087+
indexMap.put(fieldIndex ? "url" : "0", "url");
1088+
} else {
1089+
indexMap.put(fieldIndex ? "key" : "0", "key");
1090+
}
10891091
} else {
1090-
indexMap.put(fieldIndex ? "key" : "0", "key");
1092+
indexMap.put(urlIndex, "url");
1093+
}
1094+
} else if (ProcessUtils.needId(process)) {
1095+
String idIndex = entryParam.getValue("id-index", "").trim();
1096+
if ("".equals(idIndex)) {
1097+
zeroDefault = true;
1098+
indexMap.put(fieldIndex ? "id" : "0", "id");
1099+
} else {
1100+
indexMap.put(idIndex, "id");
10911101
}
10921102
} else {
1093-
indexMap.put(urlIndex, "url");
1094-
}
1095-
} else if (ProcessUtils.needId(process)) {
1096-
String idIndex = entryParam.getValue("id-index", "").trim();
1097-
if ("".equals(idIndex)) {
1098-
zeroDefault = true;
1099-
indexMap.put(fieldIndex ? "id" : "0", "id");
1100-
} else {
1101-
indexMap.put(idIndex, "id");
1103+
indexMap.put(fieldIndex ? "key" : "0", "key");
1104+
if (ProcessUtils.needToKey(process))
1105+
// move/copy/rename 等操作不设置默认 toKey,因为大部分情况是增加或删除前缀,需要优先考虑,查看 processor 的实现
1106+
setIndex(entryParam.getValue("toKey-index", "").trim(), "toKey");
1107+
if (ProcessUtils.needFops(process))
1108+
setIndex(entryParam.getValue("fops-index", fieldIndex ? "fops" : "1").trim(), "fops");
1109+
if (ProcessUtils.needAvinfo(process))
1110+
setIndex(entryParam.getValue("avinfo-index", fieldIndex ? "avinfo" : "1").trim(), "avinfo");
11021111
}
1103-
} else {
1104-
indexMap.put(fieldIndex ? "key" : "0", "key");
1105-
if (ProcessUtils.needToKey(process))
1106-
// move/copy/rename 等操作不设置默认 toKey,因为大部分情况是增加或删除前缀,需要优先考虑,查看 processor 的实现
1107-
setIndex(entryParam.getValue("toKey-index", "").trim(), "toKey");
1108-
if (ProcessUtils.needFops(process))
1109-
setIndex(entryParam.getValue("fops-index", fieldIndex ? "fops" : "1").trim(), "fops");
1110-
if (ProcessUtils.needAvinfo(process))
1111-
setIndex(entryParam.getValue("avinfo-index", fieldIndex ? "avinfo" : "1").trim(), "avinfo");
11121112
}
11131113
}
11141114

0 commit comments

Comments
 (0)