I use Drool Guvnor version 5.2.0.BRMS. I try to updating my Web decision
table with Rest API from user guide
http://docs.jboss.org/drools/release/5.3.0.Final/drools-guvnor-docs/html/...
*This my source code:*
*package com.sample;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import javax.ws.rs.core.Response;
import org.apache.cxf.jaxrs.client.WebClient;
import org.drools.ide.common.client.modeldriven.dt52.DTCellValue52;
import org.drools.ide.common.client.modeldriven.dt52.GuidedDecisionTable52;
import org.drools.ide.common.server.util.GuidedDTXMLPersistence;
public class Update {
public static void main(String args[]){
WebClient client = WebClient.create("http://127.0.0.1:8081/");
String authorizationHeader = "Basic " +
org.apache.cxf.common.util.Base64Utility.encode("admin:admin".getBytes());
client.header("Authorization", authorizationHeader);
String
content=client.path("jboss-brms/rest/packages/mortgages/assets/Pricing%20loans/source").accept("text/plain").get(String.class);
//List<DTCellValue52> lData = new ArrayList<DTCellValue52>();
List<List<DTCellValue52>> llData = new
ArrayList<List<DTCellValue52>>();
System.out.println(content);
GuidedDecisionTable52 dt =
GuidedDTXMLPersistence.getInstance().unmarshal(content);
//llData = dt.getData();
String oldContent =
GuidedDTXMLPersistence.getInstance().marshal(dt);
System.out.println("Original : \n============\n"+oldContent);
llData = dt.getData();
System.out.println("Numeric List idx-1 data-0 =
"+llData.get(1).get(2).getNumericValue());
llData.get(1).get(2).setNumericValue(new BigDecimal(5000));
dt.setData(llData);
String newContent =
GuidedDTXMLPersistence.getInstance().marshal(dt);
System.out.println("Become : \n============\n"+newContent);
WebClient client2 = WebClient.create("http://127.0.0.1:8081/");
client2.header("Authorization", authorizationHeader);
Response response=
client2.path("jboss-brms/rest/packages/mortgages/assets/Pricing%20loans/source").accept("text/xml").put(newContent);
System.out.println("succeed");
System.out.println(response.getMetadata());
}
}*
I just try to set new value with 5000.
This code doesn't retrieve error, but the result is not true. My "Pricing
loan" asset still not updated with new set value.
Anyone can help?
Best Regards.