rjr201 | 22 May 2013 12:08
Picon

Re: How to dynamic remove or add the rules

You need to pass an Agenda Filter to the runRules() method that will filter
which rules are allowed to run.

For example.. 

public class MyAgendaFilter implements AgendaFilter {
 	/** List of rule names to be allowed to fired*/
 	ArrayList<String> rulesToFire;
 	
 	public MyAgendaFilter() {
 		rulesToFire = new ArrayList<String>();
 	}

	/**
 	 * Adds a rule to list of rules to be allowed to fire
 	 *  <at> param name Name of rule to be fired
 	 */
 	public void addRuleToFire(String name) {
 		rulesToFire.add(name);
 	}
 	
 	 <at> Override
 	public boolean accept(Activation activation) {
 		if (rulesToFire.contains(activation.getRule().getName())) { 
 			return true;
 		} else {
 			return false;	
 		}
 	}
}
(Continue reading)

abhinay_agarwal | 22 May 2013 11:19
Favicon
Gravatar

Reading a Guvnor PKG from drools API

Hey,

I was trying to read a package(ResourceType.PKG), which i downloaded from
Guvnor, using KnowledgeBuilder, but I consistently get the following error
while trying to access the file.

Here's my code and the error,

**Code**

KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
			kbuilder.add( ResourceFactory.newClassPathResource( "Goal Creation
Charges.pkg", getClass() ), ResourceType.PKG );
			if ( kbuilder.hasErrors() ) {
			System.err.println( kbuilder.getErrors().toString() );
			}
			kbase = KnowledgeBaseFactory.newKnowledgeBase();
			kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );

**Error**

java.lang.RuntimeException: java.io.StreamCorruptedException: invalid stream
header: 7061636B
	at
org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:724)
	at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
	at
org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:40)
	at
(Continue reading)

Ramon Buckland | 22 May 2013 10:55
Gravatar

Action Object and Condition Object in XLS DTABLE

Hi. 

I am working on Drools 5.5.0.Final and have a question regarding XLS and a Decision Table structure,

I have a ConditionObject and an ActionObject and wanted to know or see an example for XLS that produces a "does exist" for the ActionObject
in the when.

I can simply write the rule in a DRL, but translating how to make the XLS compiler create the same is proving challenging.

An example:

I want to produce a set of rules like below

rule "Test rule_11"
when
    $c : ConditionObject( somefield )
    EmbeddedObject(myField == AnEnum.SomeValue) from $c.embedded
    $a : ActionObject( )
then 
    $a.someMethod("value")
    $a.someMethod2(10)
    $a.someMethod3("A")
end

rule "Test rule_12"
// some other AnEnum checks.

What I can't work out is how I get the test of "existence" of the Action Object into the "when" for the rule, so that I can "use" the Object in the ACTION.
In addition, is there a away that I can avoid needing a whole column just for "existence of an object with a field.. collect as a variable $c : (ConditionObject( somefield )" ?

CONDITION CONDITION ACTION ACTION ACTION
$c : ConditionObject EmbeddedObject() from $c.embedded
$param myField == AnEnum.$param $a.someMethod("$param") $a.someMethod2($param) $a.someMethod3($param)
"Description" "Description" "Description" "Description" "Description"
somefield SomeValue value 10 A
somefield SomeOtherValue someOtherValue 50 B

This is the XLS of the above.


When this sheet is compiled, I get the following: How do I setup a "condition" for ActionObject to get in the when ?

package packageName;
//generated from Decision Table
// rule values at A8, header at A3
rule "Test rule_8"
when
$c : ConditionObject(somefield)
EmbeddedObject(myField == AnEnum.SomeValue) from $c.embedded
then
$a.someMethod("value")
$a.someMethod2(10)
$a.someMethod3(A)
end

// rule values at A9, header at A3
rule "Test rule_9"
when
$c : ConditionObject(somefield)
EmbeddedObject(myField == AnEnum.SomeOtherValue) from $c.embedded
then
$a.someMethod("someOtherValue")
$a.someMethod2(50)
$a.someMethod3(B)
end




_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Aleksandar Toshovski | 21 May 2013 18:54
Picon

Is it possible to leave the "then" block empty?

Hello,

I have many rules, which have exactly the same "then" block. Is it possible to leave the then cause empty? I only need to know is if a rule was activated or not and for this reason I'm using WorkingMemoryConsoleLogger.activationCreated().

Best Regards,
Aleksandar Toshovski

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
bhochhi | 21 May 2013 06:30
Picon
Favicon

Knowledge Agent unexpected behavior for remote resource at guvnor

I am trying to use KnowledgeAgent to auto update the knowledgebase when rules
are updated at guvnor. Following is my Test Class that creates the kAgent
and executes the rules every 3 Seconds.

/
import org.drools.KnowledgeBase;
import org.drools.agent.KnowledgeAgent;
import org.drools.agent.KnowledgeAgentConfiguration;
import org.drools.agent.KnowledgeAgentFactory;
import org.drools.io.ResourceFactory;
import org.drools.runtime.StatefulKnowledgeSession;

public class MainClass {
	
	public static void main(String[] st) throws Exception {

		KnowledgeAgentConfiguration aconf =
KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
		aconf.setProperty("drools.agent.newInstance", "true");
		final KnowledgeAgent kagent =
KnowledgeAgentFactory.newKnowledgeAgent("kagent", aconf);
		ResourceFactory.getResourceChangeNotifierService().start();
		ResourceFactory.getResourceChangeScannerService().start();
	
kagent.applyChangeSet(ResourceFactory.newClassPathResource("ChangeSet.xml"));
		KnowledgeBase kbase = kagent.getKnowledgeBase();
		while (true) {
			try {
				Thread.sleep(3000);
				kbase = kagent.getKnowledgeBase();
				System.out.println("Number of packages(should be 1):  " +
kbase.getKnowledgePackages().size());
				StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();
				session.insert("");
				System.out.println("Number of rules fired: " + session.fireAllRules());
				session.dispose();

			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}
/

And following is my ChangeSet.xml

/
<change-set xmlns='http://drools.org/drools-5.0/change-set'
    xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
    xs:schemaLocation='http://drools.org/drools-5.0/change-set
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-api/src/main/resources/change-set-1.0.0.xsd'
>
    <add>
    	<resource basicAuthentication="enabled" username="admin"
password="admin"
type="DRL"
source="http://localhost:8080/brms/rest/packages/ReceiverConfigurationRules/source"></resource> 
    </add>
</change-set>
/

And I have one rules package "ReceiverConfigurationRules" and simple drl
rule with no condition( so will always fire). 

So, when I run my program, for few times, it works as expected printing
number of packages and number of rule fired as "1". However as soon as
"DebugKnowledgeAgentEventListener" logs the following into the console, It
starts printing number of packages with kBase as "0" and number of rules
fired as "0". This is unexpected behavior. Is this a bug or am I missing
something important? 

==>[BeforeChangeSetAppliedEvent: org.drools.io.impl.ChangeSetImpl <at> 34f2e383]
==>[BeforeChangeSetProcessedEvent:
org.drools.io.impl.ChangeSetImpl <at> 34f2e383]
==>[BeforeResourceProcessedEvent(RESOURCE_MODIFIED): [UrlResource
path='http://localhost:8080/brms/rest/packages/ReceiverConfigurationRules/source']]
==>[AfterResourceProcessedEvent(RESOURCE_MODIFIED): [UrlResource
path='http://localhost:8080/brms/rest/packages/ReceiverConfigurationRules/source']]
==>[AfterChangeSetProcessedEvent: org.drools.io.impl.ChangeSetImpl <at> 34f2e383]
==>[KnowledgeBaseUpdatedEvent: org.drools.impl.KnowledgeBaseImpl <at> 3fd7ada9]
==>[AfterChangeSetAppliedEvent: org.drools.io.impl.ChangeSetImpl <at> 34f2e383]

Weird thing is when I use local resource like
source="file:\\\configRules.drl", everything is works perfect.   Have anyone
experienced such issue? I used drools 5.4.final core as well as 5.3 but same
issue. I appreciate your help in advance. 

--
View this message in context: http://drools.46999.n3.nabble.com/Knowledge-Agent-unexpected-behavior-for-remote-resource-at-guvnor-tp4023893.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Zahid Ahmed | 20 May 2013 15:35
Favicon

Issue in Integrating Guvnor and Form Builder

Hi,

 

I am having an issue in integrating GUVNOR and JBPM-FORM-BUILDER. I cannot find any link between form builder and guvnor. Although I can create/open form definitions in guvnor using form builder but, when I save the form definition a popup is displayed with disable drop downs of “Process ID” and ”TASK ID”

 

Problem :

                How to link forms with processes in guvnor. Do I have to keep form builder as standalone form designer, generate forms and then upload manually as FTLs in guvnor with names “<tasknam>-taskform” or there’s someway to directly link forms to human tasks.

 

1.       Standalone form builder

a.       Resources are not linked to guvnor process’s and tasks. Guvnor path provided in spring-components.xml (content pasted in email below)

 

2.       Form builder embedded in guvnor

a.       Resources are not linked to guvnor process’s and tasks. Guvnor path provided in spring-components.xml (content pasted in email below)

 

 

 

Environment :

 

Server Node:

1.       drools-guvnor.war

2.       designer.war

3.       jbpm-form-builder.war

               

Server tried with

a.       Jboss AS-7.1

2.       Guvnor 5.4.0

3.       Jbpm-form-builder 5.4

 

Guvnor   Preference.properties: path=>drools-guvnor.war/WEB-INF/classes/

 

#

# Global preferences for Guvnor web app.

 

visual-ruleflow=true

verifier=true

oryx-bpmn-editor=true

# asset.format.enabled.XYZ determines if format XYZ (as named inside guvnor extensions)

# is enabled on the current guvnor instalation

asset.format.enabled.formdef=true

 

# Date and language settings

drools.dateformat=dd-MMM-yyyy

drools.defaultlanguage=en

drools.defaultcountry=US

 

#RuleModeller (guided editor) checkbox default value

rule-modeller-onlyShowDSLStatements=false

 

#Designer configuration

designer.url=http://localhost:8080

#Do not change this unless you know what are you doing

designer.context=designer

designer.profile=jbpm

 

#FormBuilder configuration

#Do not change this unless you know what are you doing

formbuilder.url=http://localhost:8080

formbuilder.context=jbpm-form-builder

formbuilder.profile=guvnor

 

 

 

Form-builder . springcomponents.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xmlns:p="http://www.springframework.org/schema/p"

       xmlns:context="http://www.springframework.org/schema/context"

       xsi:schemaLocation="

          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd

          http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">

 

    <!-- Select configuration strategy -->

    <bean id="strategy" class="java.lang.String">

      <constructor-arg type="java.lang.String" value="guvnor"/>

    </bean>

 

    <!-- Guvnor configuration -->

   

    <bean id="guvnorUrl" class="java.lang.String">

      <constructor-arg type="java.lang.String" value="http://localhost:8080/drools-guvnor"/>

    </bean>

 

    <bean id="guvnorUser" class="java.lang.String">

      <constructor-arg type="java.lang.String" value="admin"/>

    </bean>

 

    <bean id="guvnorPass" class="java.lang.String">

      <constructor-arg type="java.lang.String" value="admin"/>

    </bean>

 

    <bean id="serviceFactory" class="org.jbpm.formbuilder.server.ServiceFactory" factory-method="getInstance"/>

 

    <!-- Guvnor services -->

 

    <bean id="guvnorFileService" class="org.jbpm.formbuilder.server.file.GuvnorFileService">

      <property name="baseUrl" ref="guvnorUrl"/>

      <property name="user" ref="guvnorUser"/>

      <property name="password" ref="guvnorPass"/>

    </bean>

   

    <bean id="guvnorFormService" class="org.jbpm.formbuilder.server.form.GuvnorFormDefinitionService">

      <property name="baseUrl" ref="guvnorUrl"/>

      <property name="user" ref="guvnorUser"/>

      <property name="password" ref="guvnorPass"/>

    </bean>

 

    <bean id="guvnorTaskService" class="org.jbpm.formbuilder.server.task.GuvnorTaskDefinitionService">

      <property name="baseUrl" ref="guvnorUrl"/>

      <property name="user" ref="guvnorUser"/>

      <property name="password" ref="guvnorPass"/>

    </bean>

   

    <bean id="guvnorMenuService" class="org.jbpm.formbuilder.server.menu.GuvnorMenuService">

    </bean>

   

</beans>

 

Regards,

Zahid

 

 

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
starfish15 | 19 May 2013 21:42
Picon
Favicon

BPMN2 Question

Hello,

I am very new to BPMN. We are currently using Drools 5.3 version. I face the
below error when i run the project. Also am trying to understand the running
of Call Activity. Anyways a flow does begin running and then it gives the
following error

java.lang.NoSuchFieldError: session
	at
org.jbpm.process.instance.impl.MVELReturnValueEvaluator.evaluate(MVELReturnValueEvaluator.java:91)
	at
org.jbpm.process.instance.impl.ReturnValueConstraintEvaluator.evaluate(ReturnValueConstraintEvaluator.java:128)
	at
org.jbpm.workflow.instance.node.SplitInstance.internalTrigger(SplitInstance.java:72)
	at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:124)
	at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:205)
	at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerCompleted(NodeInstanceImpl.java:164)
	at
org.jbpm.workflow.instance.node.ActionNodeInstance.triggerCompleted(ActionNodeInstance.java:55)
	at
org.jbpm.workflow.instance.node.ActionNodeInstance.internalTrigger(ActionNodeInstance.java:51)
	at
org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:124)

Not sure i understood this error. Would appreciate if some help could be
provided with what the error meant exactly.

Regards,
starfish.

--
View this message in context: http://drools.46999.n3.nabble.com/BPMN2-Question-tp4023888.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users

Zahid Ahmed | 19 May 2013 16:02
Favicon

Error Guvnor and Form Builder on Different Nodes in JBOSS

Hi,

 

I am having an issue in integrating GUVNOR and JBPM-FORM-BUILDER when I deploy guvnor and form builder on different nodes. I am getting Http-500 : Error getting task from Guvnor. Or I am getting  Http 404 : /jbpm-form-builder/embed. It asks for authentication to form-builder And the error comes after successful authentication. I cannot find any server log printed, only the error comes on screen. Attached is the screen shot.

 

All works fine when I deploy guvnor and form builder on the same node. But on different nodes the errors are seen while opening/creating the form definitions from guvnor.1

 

Environment :

 

Node 1:

1.       drools-guvnor.war

2.       designer.war

 

Node 2:

1.       jbpm-form-builder.war

               

Server tried with

a.       Jboss EAP6.0.1

b.      Jboss AS-7.1

2.       Guvnor 5.4.0

3.       Jbpm-form-builder 5.4

 

Guvnor   Preference.properties: path=>drools-guvnor.war/WEB-INF/classes/

 

#

# Global preferences for Guvnor web app.

 

visual-ruleflow=true

verifier=true

oryx-bpmn-editor=true

# asset.format.enabled.XYZ determines if format XYZ (as named inside guvnor extensions)

# is enabled on the current guvnor instalation

asset.format.enabled.formdef=true

 

# Date and language settings

drools.dateformat=dd-MMM-yyyy

drools.defaultlanguage=en

drools.defaultcountry=US

 

#RuleModeller (guided editor) checkbox default value

rule-modeller-onlyShowDSLStatements=false

 

#Designer configuration

designer.url=http://localhost:8080

#Do not change this unless you know what are you doing

designer.context=designer

designer.profile=jbpm

 

#FormBuilder configuration

#Do not change this unless you know what are you doing

formbuilder.url=http://localhost:8280

formbuilder.context=jbpm-form-builder

formbuilder.profile=guvnor

 

 

 

Form-builder . springcomponents.xml

 

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xmlns:p="http://www.springframework.org/schema/p"

       xmlns:context="http://www.springframework.org/schema/context"

       xsi:schemaLocation="

          http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

          http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd

          http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.0.xsd">

 

    <!-- Select configuration strategy -->

    <bean id="strategy" class="java.lang.String">

      <constructor-arg type="java.lang.String" value="guvnor"/>

    </bean>

 

    <!-- Guvnor configuration -->

   

    <bean id="guvnorUrl" class="java.lang.String">

      <constructor-arg type="java.lang.String" value="http://localhost:8080/drools-guvnor"/>

    </bean>

 

    <bean id="guvnorUser" class="java.lang.String">

      <constructor-arg type="java.lang.String" value="admin"/>

    </bean>

 

    <bean id="guvnorPass" class="java.lang.String">

      <constructor-arg type="java.lang.String" value="admin"/>

    </bean>

 

    <bean id="serviceFactory" class="org.jbpm.formbuilder.server.ServiceFactory" factory-method="getInstance"/>

 

    <!-- Guvnor services -->

 

    <bean id="guvnorFileService" class="org.jbpm.formbuilder.server.file.GuvnorFileService">

      <property name="baseUrl" ref="guvnorUrl"/>

      <property name="user" ref="guvnorUser"/>

      <property name="password" ref="guvnorPass"/>

    </bean>

   

    <bean id="guvnorFormService" class="org.jbpm.formbuilder.server.form.GuvnorFormDefinitionService">

      <property name="baseUrl" ref="guvnorUrl"/>

      <property name="user" ref="guvnorUser"/>

      <property name="password" ref="guvnorPass"/>

    </bean>

 

    <bean id="guvnorTaskService" class="org.jbpm.formbuilder.server.task.GuvnorTaskDefinitionService">

      <property name="baseUrl" ref="guvnorUrl"/>

      <property name="user" ref="guvnorUser"/>

      <property name="password" ref="guvnorPass"/>

    </bean>

   

    <bean id="guvnorMenuService" class="org.jbpm.formbuilder.server.menu.GuvnorMenuService">

    </bean>

   

</beans>

 

 

Regards,

Zahid

 

 

_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Michael Anstis | 17 May 2013 22:00
Picon
Gravatar

Re: [uberfire-users] Configurable and Reusable Editor

All Drools and jBPM components use the Uberfire framework.

Any individual component can be used in isolation (subject to inclusion of any dependencies) by any other Uberfire compliant application.

Vice-versa any 3rd party Uberfire compliant component can be used within the Kie Workbench extending its functionality.

On 17 May 2013 13:35, "Suminda Dharmasena" <sirinath <at> sakrio.com> wrote:
Hi,

The components and functionality can be used for larger tools than just jBPM and Drools solution through customisation. I think this should be kept in mind when developing.

Suminda
--
Suminda Sirinath Salpitikorala Dharmasena, B.Sc. Comp. & I.S. (Hon.) Lond., P.G.Dip. Ind. Maths. J'Pura, MIEEE, MACM, CEO Sakrīō! ▣ Address: 6G • 1st Lane • Pagoda Road • Nugegoda 10250 • Sri Lanka. ▣ Mobile+94-(0)711007945 ▣ Tele: +94-(0)11-5 864614 / 5 875614 / 2 825908 ▣ Web: http://www.sakrio.com 

This email is subjected to the email Terms of Use and Disclaimer: http://www.sakrio.com/email-legal. Please read this first.
--

_______________________________________________
uberfire-users mailing list
uberfire-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/uberfire-users
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
Ravi Gupta | 17 May 2013 20:29
Picon

fusion

How would one write a rule that checked if say Message has been inserted into the stream 10 times over the last 30 days?



_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
abhinay_agarwal | 17 May 2013 13:54
Favicon
Gravatar

Jboss Business Rules Management System (BRMS)

May I know which version of drools is bundled in Jboss Business Rules
Management System (BRMS) ?

Thanks,
Abhinay

--
View this message in context: http://drools.46999.n3.nabble.com/Jboss-Business-Rules-Management-System-BRMS-tp4023870.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
rules-users <at> lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users


Gmane