[rules-users] Changing asset metadata properties in Guvnor

morfeus929 cheh.viktor at gmail.com
Tue Mar 26 08:56:23 EDT 2013


My code is : 

URL baseURL = new
URL("http://localhost:8080/guvnor-5.5.0.Final-tomcat-6.0/");
		URL url = new URL(baseURL, "rest/packages/mortgages/assets/bobik");
		HttpURLConnection connection = (HttpURLConnection)url.openConnection();
        connection.setRequestProperty("Authorization",
                "Basic " + new Base64().encodeToString((
"admin:admin".getBytes() )));
        connection.setRequestMethod("GET");
        connection.setRequestProperty("Accept", MediaType.APPLICATION_XML);
        connection.connect();
        assertEquals (200, connection.getResponseCode());

        BufferedReader br = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
        JAXBContext context = JAXBContext.newInstance(Asset.class);
        Unmarshaller un = context.createUnmarshaller();
        Asset a = (Asset) un.unmarshal(br);
       
        a.setDescription("An updated description HH");
        
        a.getMetadata().setDisabled(false);
        a.getMetadata().setVersionNumber(2);

        System.out.println(a.getMetadata().isDisabled());
        System.out.println(a.getMetadata().getVersionNumber());

        
        connection.disconnect();

        HttpURLConnection conn2 = (HttpURLConnection)url.openConnection();
        conn2.setRequestProperty("Authorization",
                "Basic " + new Base64().encodeToString((
"admin:admin".getBytes() )));
        Marshaller ma = context.createMarshaller();
        conn2.setRequestMethod("PUT");
        conn2.setRequestProperty("Content-Type", MediaType.APPLICATION_XML);
        conn2.setRequestProperty("Content-Length",
Integer.toString(a.toString().getBytes().length));
        conn2.setUseCaches (false);
        conn2.setDoInput(true);
        conn2.setDoOutput(true);
        ma.marshal(a, conn2.getOutputStream());
        assertEquals (200, connection.getResponseCode());
        conn2.disconnect();


The problem i have is metadata of the rule does'nt get changed. I tried
almost everything. Description of the rule is changed, published date is
changed but metadata not. Why is that? What do i do wrong?



--
View this message in context: http://drools.46999.n3.nabble.com/rules-users-Changing-asset-metadata-properties-in-Guvnor-tp4023019p4023046.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list