我是流口水的新手。尝试通过rest命令将值插入数据模型并设置另一个数据模型的变量。但是,当我发送getobject命令时,服务器返回到目前为止创建的所有对象。有什么方法可以获取最新创建的对象作为退货?
数据模型是:
...
ReqModel1:
private int val1int;
private int val2int;
private int val3int;
....
ReqModel2:
private ReqModel1 val1Model1;
private int val2int;
...
RespModel1:
private int inner1int;
private int inner2int;
private int inner3int;
...
RespModel2
private RespModel1 respValUpper1;
private int val2int;
private int val3String;
....
Drl file:
rule "Row 1 Ruler"
dialect "mvel"
when
$upper : ReqModel2( val1Model1.val1int == "5" )
then
RespModel2 $respUp = new RespModel2();
RespModel1 $respInner = new RespModel1();
$respInner.setInner1int(10);
$respUp.setRespValUpper1( $respInner );
insert( $respUp );
end
I'm using to following body for command:
{
"commands" : [
{
"insert": {
"out-identifier": "com.myspace.prjct.ReqModel2",
"return-object":true,
"object":{
"com.myspace.prjct.ReqModel2": {
"val1Model1":{
"val1int":"5"
}
}
}
}
},
{
"fire-all-rules": ""
},
{
"get-objects": {"out-identifier":"com.myspace.prjct.RespModel2"}
}
]
}
但是,当我发送请求时,它返回到目前为止创建的所有对象。 ... “ com.myspace.pronew.ReqModel2”:{ “ val1Model1”:{ “ val1int”:“ 5” }, “ val2int”:“ 3”, “ val3int”:“” } },{ “ com.myspace.pronew.ReqModel2”:{ “ val1Model1”:{ “ val1int”:“ 5” }, “ val2int”:“ 3”, “ val3int”:“” } ... “ com.myspace.pronew.ReqModel2”:{ “ val1Model1”:{ “ val1int”:“ 5” }, “ val2int”:“ 3”, “ val3int”:“” } },{ “ com.myspace.pronew.ReqModel2”:{ “ val1Model1”:{ “ val1int”:“ 5” }, “ val2int”:“ 3”, “ val3int”:“” } ... 我只想获取最新的ReqModel2对象。