[JBoss Tools] - How to edit a decision table contains rule like "not (TreatResult(id==$eid))" ?
by 安 耿
安 耿 [https://community.jboss.org/people/beliefer] created the discussion
"How to edit a decision table contains rule like "not (TreatResult(id==$eid))" ?"
To view the discussion, visit: https://community.jboss.org/message/792254#792254
--------------------------------------------------------------
I have finished a rule as follows:
rule "Your First Rule"
when
ExpressItemTemp($eid :eid)
not (TreatResult(id==$eid))
$total : Double(doubleValue >=138) from accumulate ($eit: ExpressItemTemp(itemid in ("7096760680","3096780174","2251556006","2252191048","2254989638","2251521962","12203694113","2252461508","2588839002","2254940542","2252775410","2252775398","2254081374","2251552580","2251509802"),eid == $eid, $rel : (itemprice*itemnum-discount)),sum( $rel ) )
then
System.out.println($eid+":"+$total);
insert(new TreatResult($eid));
end
but,how can I doing the same work with decision table?
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/792254#792254]
Start a new discussion in JBoss Tools at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 2 months
[jBPM] - Create a new asset in Guvnor through REST API (POST method)
by sayan dutta
sayan dutta [https://community.jboss.org/people/neokiing] created the discussion
"Create a new asset in Guvnor through REST API (POST method)"
To view the discussion, visit: https://community.jboss.org/message/794494#794494
--------------------------------------------------------------
Hi All,
I am trying to create an asset (.txt file ) in GUVNOR through REST API in JAVA. But the problem is when using the post method to create asset .. program is executing with no error but i am having SERVER_ERROR(http 500 error..) as a response.
Steps I followed :-
1.Created an asset named SayanFileTest2.Got the Asset Info in Atom -XML format ..
3.Replaced the asset name With new one (FileUploadTest1)
4.Called the post method to create a new entry in GUVNOR.
Can anybody please help me with this one? I am providing the code.. Please tell me what i am doing wrong in this and how to solve it.
(N.B. - I am using jboss-as-7.1.1.Final and drools-guvnor 5.3.0)
***********************
//package imported..
AbderaClient client =
**new** AbderaClient(abdera);
UsernamePasswordCredentials userpass =
**new** UsernamePasswordCredentials("admin","admin");
client.addCredentials(url.toExternalForm(),
**null**,"Basic",userpass);
ClientResponse resp = client.get(new URL("http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets/S...").toExternalForm (http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets/S...;
Document<Entry> doc = resp.getDocument();
Entry prevEntry = doc.getRoot(); // have done this to get the atom-entry at the first place
Entry newEntry = abdera.newEntry();
// copied the prevEntry to populate the below string
String newResponse ="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><atom:entry xmlns:atom=\" http://www.w3.org/2005/Atom\ http://www.w3.org/2005/Atom\" xmlns=\" http://www.w3.org/XML/1998/namespace\ http://www.w3.org/XML/1998/namespace\" xml:base=\" http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets/S... http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets/S..."><atom:title xmlns:atom=\" http://www.w3.org/2005/Atom\ http://www.w3.org/2005/Atom\" type=\"text\">SayanFileTest</atom:title><atom:id xmlns:atom=\" http://www.w3.org/2005/Atom/ http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets/S...">http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets/S...</atom:id><atom:published xmlns:atom=\" http://www.w3.org/2005/Atom/ 2013-01-23T14:10:33.173+05:30http://www.w3.org/2005/Atom\">2013-01-23T14:10:33.173+05:30</atom:published><atom:author xmlns:atom=\" http://www.w3.org/2005/Atom/ http://www.w3.org/2005/Atom\"><atom:name xmlns:atom=\" http://www.w3.org/2005/Atom/ adminhttp://www.w3.org/2005/Atom\">admin</atom:name></atom:author><atom:content xmlns:atom=\" http://www.w3.org/2005/Atom\ http://www.w3.org/2005/Atom\" type=\"application/octet-stream\" src=\" http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets/S... http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets/S..."></atom:content><atom:summary xmlns:atom=\" http://www.w3.org/2005/Atom\ http://www.w3.org/2005/Atom\" type=\"text\"></atom:summary><metadata xmlns=\"\"><uuid><value></value></uuid><categories></categories><format><value>.txt</value></format><state><value>Draft</value></state><versionNumber><value>2</value></versionNumber><checkinComment><value></value></checkinComment><archived><value>false</value></archived></metadata></atom:entry>";
// replaced the name of the previous asset
newResponse=newResponse.replaceAll("SayanFileTest","FileUploadTest1");
System.out.println(newResponse);
newEntry.setContent(newResponse);
client = new AbderaClient(abdera);
client.addCredentials(new URL("http://localhost:8080/drools-guvnor/").toExternalForm (http://localhost:8080/drools-guvnor/").toExternalForm)(), null,"Basic",new org.apache.commons.httpclient.UsernamePasswordCredentials("admin", "admin"));
RequestOptions options = client.getDefaultRequestOptions();
options.setContentType(MediaType.APPLICATION_ATOM_XML);
ClientResponse clientResponsePost = client.post(new URL("http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets").toExternalForm (http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets&q..., newEntry, options);
System.out.println(clientResponsePost.getType()+ "__________ " + clientResponsePost.getStatus());
*****************
I am a newbie in this. Any help will be really appreciated.
Thanks in advance ,
Sayan
import org.apache.abdera.model.Document;
import org.apache.abdera.model.Entry;
import org.apache.abdera.protocol.Response.ResponseType;
import org.apache.abdera.protocol.client.AbderaClient;
import org.apache.abdera.protocol.client.ClientResponse;
import org.apache.abdera.protocol.client.RequestOptions;
********
***
******// post method..******
******************
Abdera abdera= **new** Abdera();*****
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/794494#794494]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 2 months