Erhans,

I think you've found yourself onto the wrong mailing list. This is for the development OF drools, not WITH Drools. Please ask your question on the USER mailing list. Also please make sure you thoroughly read the mailing list guide, especially the netiquette points 1 to 17.
http://www.jboss.org/drools/lists

Mark

On 31/07/2012 09:43, Erhans Triadi wrote:
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/ch09.html#d0e2735

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.


_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev