mirror of
https://gitee.com/BDWare/common
synced 2025-01-10 01:44:16 +00:00
finish the draft version
This commit is contained in:
parent
07c8f40059
commit
a4bc017a15
@ -47,10 +47,12 @@ public class ContractNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateFunctionMap(String oldFunctionName, String newFunctionName) {
|
public void updateFunctionMap(String oldFunctionName, String newFunctionName) {
|
||||||
FunctionNode fn = functionMap.get(oldFunctionName);
|
FunctionNode fn = functionMap.getOrDefault(oldFunctionName, null);
|
||||||
|
if(fn != null) {
|
||||||
functionMap.remove(oldFunctionName);
|
functionMap.remove(oldFunctionName);
|
||||||
functionMap.put(newFunctionName, fn);
|
functionMap.put(newFunctionName, fn);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void addClass(ClassNode clzNode) {
|
public void addClass(ClassNode clzNode) {
|
||||||
getClzs().add(clzNode);
|
getClzs().add(clzNode);
|
||||||
|
@ -32,20 +32,13 @@ public class FunctionNode extends Script {
|
|||||||
private boolean isHomomorphicEncrypt;
|
private boolean isHomomorphicEncrypt;
|
||||||
private boolean isHomomorphicDecrypt;
|
private boolean isHomomorphicDecrypt;
|
||||||
private boolean isView;
|
private boolean isView;
|
||||||
|
private boolean isDoipOperation;
|
||||||
private String keyManagerID;
|
private String keyManagerID;
|
||||||
private String secretID;
|
private String secretID;
|
||||||
private JsonElement homoEncryptConf;
|
private JsonElement homoEncryptConf;
|
||||||
private JsonElement homoDecryptConf;
|
private JsonElement homoDecryptConf;
|
||||||
public transient Class compiledClazz;
|
public transient Class compiledClazz;
|
||||||
|
|
||||||
public DoipOperationInfo getDoipOperationInfo() {
|
|
||||||
return doipOperationInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDoipOperationInfo(DoipOperationInfo doipOperationInfo) {
|
|
||||||
this.doipOperationInfo = doipOperationInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FunctionNode(String name, String fileName) {
|
public FunctionNode(String name, String fileName) {
|
||||||
this.functionName = name;
|
this.functionName = name;
|
||||||
this.stmts = new ArrayList<>();
|
this.stmts = new ArrayList<>();
|
||||||
@ -68,6 +61,24 @@ public class FunctionNode extends Script {
|
|||||||
afterInvoke = new ArrayList<>();
|
afterInvoke = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DoipOperationInfo getDoipOperationInfo() {
|
||||||
|
return doipOperationInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDoipOperationInfo(DoipOperationInfo doipOperationInfo) {
|
||||||
|
this.doipOperationInfo = doipOperationInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDoipOperation(boolean doipOperation) {
|
||||||
|
isDoipOperation = doipOperation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isDoipOperation() {
|
||||||
|
return isDoipOperation;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Set<String> getDependentFunctions() {
|
public Set<String> getDependentFunctions() {
|
||||||
return dependentFunctions;
|
return dependentFunctions;
|
||||||
}
|
}
|
||||||
|
@ -6,13 +6,31 @@ import org.bdware.sc.node.ContractNode;
|
|||||||
import org.bdware.sc.util.JsonUtil;
|
import org.bdware.sc.util.JsonUtil;
|
||||||
|
|
||||||
public class DoipOperationInfo {
|
public class DoipOperationInfo {
|
||||||
public BasicOperations operationType;
|
public String operationType;
|
||||||
|
public String operationName;
|
||||||
|
public BasicOperations operation;
|
||||||
|
|
||||||
|
// todo 对于extension进行特别处理,getArg() == 2就行?这里合理吗?参考RouteInfo貌似合理?
|
||||||
public static DoipOperationInfo create(AnnotationNode annotationNode, ContractNode contractNode) {
|
public static DoipOperationInfo create(AnnotationNode annotationNode, ContractNode contractNode) {
|
||||||
DoipOperationInfo info = new DoipOperationInfo();
|
DoipOperationInfo info = new DoipOperationInfo();
|
||||||
if (annotationNode.getArgs().size() == 1) {
|
if (annotationNode.getArgs().size() == 1) {
|
||||||
String str = annotationNode.getArgs().get(0);
|
String str = annotationNode.getArgs().get(0);
|
||||||
info = JsonUtil.fromJson(str, DoipOperationInfo.class);
|
info = JsonUtil.fromJson(str, DoipOperationInfo.class);
|
||||||
|
|
||||||
|
// according to operationType to find operation and fill the corresponding fields
|
||||||
|
String opStr = info.operationType;
|
||||||
|
for (BasicOperations op : BasicOperations.values()) {
|
||||||
|
if (op.toString().equals(opStr)) {
|
||||||
|
info.operation = op;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(info.operation == null) info.operation = BasicOperations.Unknown;
|
||||||
|
|
||||||
|
// If operation is not Extension, set the operationName directly from operation
|
||||||
|
if(info.operation != BasicOperations.Extension) {
|
||||||
|
info.operationName = info.operation.getName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
System.out.println("[DoipOperationInfo] annotationNode:" + JsonUtil.toJson(annotationNode));
|
System.out.println("[DoipOperationInfo] annotationNode:" + JsonUtil.toJson(annotationNode));
|
||||||
return info;
|
return info;
|
||||||
|
Loading…
Reference in New Issue
Block a user