|
@@ -1,6 +1,7 @@
|
|
package com.persagy.dmp.rwd.funcid.parse.parser.impl;
|
|
package com.persagy.dmp.rwd.funcid.parse.parser.impl;
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
|
+import com.fasterxml.jackson.databind.node.ObjectNode;
|
|
import com.persagy.dmp.rwd.enums.FuncidDataType;
|
|
import com.persagy.dmp.rwd.enums.FuncidDataType;
|
|
import com.persagy.dmp.rwd.funcid.parse.parser.ParserContext;
|
|
import com.persagy.dmp.rwd.funcid.parse.parser.ParserContext;
|
|
import com.persagy.dmp.rwd.funcid.parse.parser.ParserUtils;
|
|
import com.persagy.dmp.rwd.funcid.parse.parser.ParserUtils;
|
|
@@ -13,7 +14,7 @@ import java.util.List;
|
|
* @date: 2020-09-10
|
|
* @date: 2020-09-10
|
|
* @verison: 1.0
|
|
* @verison: 1.0
|
|
*/
|
|
*/
|
|
-public class AttachmentParser extends AbstractParser<String> {
|
|
|
|
|
|
+public class AttachmentParser extends AbstractParser<ObjectNode> {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public void checkDef(ParserContext context) {
|
|
public void checkDef(ParserContext context) {
|
|
@@ -21,7 +22,7 @@ public class AttachmentParser extends AbstractParser<String> {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void checkValue(ParserContext<String> context) {
|
|
|
|
|
|
+ public void checkValue(ParserContext<ObjectNode> context) {
|
|
super.checkValue(context);
|
|
super.checkValue(context);
|
|
if (context.isHasError()) {
|
|
if (context.isHasError()) {
|
|
return;
|
|
return;
|
|
@@ -36,39 +37,31 @@ public class AttachmentParser extends AbstractParser<String> {
|
|
Boolean isMultiple = def.getIsMultiple();
|
|
Boolean isMultiple = def.getIsMultiple();
|
|
Boolean isRegion = def.getIsRegion();
|
|
Boolean isRegion = def.getIsRegion();
|
|
|
|
|
|
- if (isMultiple && isRegion) {
|
|
|
|
- // 复数, 区间
|
|
|
|
- context.addError("不支持[Attachment 复数 区间]");
|
|
|
|
|
|
+ if (isRegion) {
|
|
|
|
+ // 区间
|
|
|
|
+ context.addError("不支持[Attachment]区间");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
- if (isMultiple && !isRegion) {
|
|
|
|
|
|
+ if (isMultiple) {
|
|
// 复数 非区间
|
|
// 复数 非区间
|
|
if (!ParserUtils.isArray(source, dataType)) {
|
|
if (!ParserUtils.isArray(source, dataType)) {
|
|
context.addError("值错误[" + sourceStr + "]");
|
|
context.addError("值错误[" + sourceStr + "]");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- List<String> value = ParserUtils.parseToList(sourceStr, String.class);
|
|
|
|
|
|
+ List<ObjectNode> value = ParserUtils.parseToList(sourceStr, ObjectNode.class);
|
|
if (value == null || value.size() == 0) {
|
|
if (value == null || value.size() == 0) {
|
|
context.addError("值错误[" + sourceStr + "]");
|
|
context.addError("值错误[" + sourceStr + "]");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
context.setArrayValue(value);
|
|
context.setArrayValue(value);
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!isMultiple && isRegion) {
|
|
|
|
- // 单数 区间
|
|
|
|
- context.addError("不支持[Attachment 单数 区间]");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!isMultiple && !isRegion) {
|
|
|
|
|
|
+ } else {
|
|
// 单数 非区间
|
|
// 单数 非区间
|
|
if (!ParserUtils.is(source, dataType)) {
|
|
if (!ParserUtils.is(source, dataType)) {
|
|
context.addError("值错误[" + sourceStr + "]");
|
|
context.addError("值错误[" + sourceStr + "]");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- String value = ParserUtils.parse(sourceStr, String.class);
|
|
|
|
|
|
+ ObjectNode value = ParserUtils.parse(sourceStr, ObjectNode.class);
|
|
context.setValue(value);
|
|
context.setValue(value);
|
|
}
|
|
}
|
|
}
|
|
}
|