mirror of
https://gitee.com/BDWare/common
synced 2025-01-10 09:54:13 +00:00
feat: support jsontype in executeContract
This commit is contained in:
parent
022b1d3902
commit
42745687ab
@ -1,6 +1,8 @@
|
|||||||
package org.bdware.sc.redo;
|
package org.bdware.sc.redo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -11,16 +13,16 @@ public class TransRecord implements Serializable,Comparable<TransRecord>{
|
|||||||
boolean needSeq = false;
|
boolean needSeq = false;
|
||||||
int seq;
|
int seq;
|
||||||
String functionName;
|
String functionName;
|
||||||
String arg;
|
JsonElement arg;
|
||||||
public Map<String,String> executes = new HashMap<String,String>(); //<innvokdeID,(flag1<seperate>flag<seperate>result)>
|
public Map<String,String> executes = new HashMap<String,String>(); //<innvokdeID,(flag1<seperate>flag<seperate>result)>
|
||||||
|
|
||||||
public TransRecord(String s1,String s2,int sequence) {
|
public TransRecord(String s1,JsonElement s2,int sequence) {
|
||||||
this.functionName = s1;
|
this.functionName = s1;
|
||||||
this.arg = s2;
|
this.arg = s2;
|
||||||
seq = sequence;
|
seq = sequence;
|
||||||
needSeq = true;
|
needSeq = true;
|
||||||
}
|
}
|
||||||
public TransRecord(String s1,String s2) {
|
public TransRecord(String s1,JsonElement s2) {
|
||||||
this.functionName = s1;
|
this.functionName = s1;
|
||||||
this.arg = s2;
|
this.arg = s2;
|
||||||
}
|
}
|
||||||
@ -29,7 +31,7 @@ public class TransRecord implements Serializable,Comparable<TransRecord>{
|
|||||||
return functionName;
|
return functionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getArg() {
|
public JsonElement getArg() {
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,9 @@ public class JsonUtil {
|
|||||||
public static JsonObject parseStringAsJsonObject(String json) {
|
public static JsonObject parseStringAsJsonObject(String json) {
|
||||||
return JsonParser.parseString(json).getAsJsonObject();
|
return JsonParser.parseString(json).getAsJsonObject();
|
||||||
}
|
}
|
||||||
|
public static JsonElement parseString(String json) {
|
||||||
|
return JsonParser.parseString(json);
|
||||||
|
}
|
||||||
public static JsonObject parseReaderAsJsonObject(Reader reader) {
|
public static JsonObject parseReaderAsJsonObject(Reader reader) {
|
||||||
return JsonParser.parseReader(reader).getAsJsonObject();
|
return JsonParser.parseReader(reader).getAsJsonObject();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package org.bdware.sc.bean;
|
package org.bdware.sc.bean;
|
||||||
|
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonPrimitive;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
public class ContractRequest extends SM2Verifiable
|
public class ContractRequest extends SM2Verifiable
|
||||||
@ -21,7 +24,7 @@ public class ContractRequest extends SM2Verifiable
|
|||||||
// action = rsaPrivKeyEncoded(aesKey);
|
// action = rsaPrivKeyEncoded(aesKey);
|
||||||
String action;
|
String action;
|
||||||
// arg = aesKeyEncoded({action,arg});
|
// arg = aesKeyEncoded({action,arg});
|
||||||
String arg;
|
JsonElement arg;
|
||||||
String requestID;
|
String requestID;
|
||||||
boolean fromDebug = false;
|
boolean fromDebug = false;
|
||||||
|
|
||||||
@ -71,11 +74,15 @@ public class ContractRequest extends SM2Verifiable
|
|||||||
this.requesterDOI = requesterDOI;
|
this.requesterDOI = requesterDOI;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getArg() {
|
public JsonElement getArg() {
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ContractRequest setArg(String arg) {
|
public ContractRequest setArg(String arg) {
|
||||||
|
return setArg(new JsonPrimitive(arg));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContractRequest setArg(JsonElement arg) {
|
||||||
this.arg = arg;
|
this.arg = arg;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user