[jboss-user] [jBPM] - Re: Drools Simple rule evaluation
ous2k
do-not-reply at jboss.com
Tue Mar 27 19:16:17 EDT 2012
ous2k [https://community.jboss.org/people/ous2k] created the discussion
"Re: Drools Simple rule evaluation"
To view the discussion, visit: https://community.jboss.org/message/726755#726755
--------------------------------------------------------------
when i thougth about nightmare my mind was opened i think it was session pb like you said @Mauricio it worked
:)
package com.ocana.workflow.dabviewticketing.server.bo;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.drools.KnowledgeBase;
import org.drools.KnowledgeBaseFactory;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderError;
import org.drools.builder.KnowledgeBuilderErrors;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
import org.drools.io.impl.ClassPathResource;
import org.drools.logger.KnowledgeRuntimeLogger;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.KnowledgeSessionConfiguration;
import org.drools.runtime.StatefulKnowledgeSession;
import org.jbpm.process.instance.event.DefaultSignalManagerFactory;
import org.jbpm.process.instance.impl.DefaultProcessInstanceManagerFactory;
import org.drools.KnowledgeBase;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderError;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.impl.ClassPathResource;
import org.drools.logger.KnowledgeRuntimeLoggerFactory;
import org.drools.runtime.StatefulKnowledgeSession;
import org.drools.runtime.help.QuartzHelper;
import org.junit.Test;
import com.ocana.workflow.dabviewticketing.server.model.SystemStatus;
import com.ocana.workflow.dabviewticketing.server.model.Ticket;
public class JBPMClient {
public static final void main(String[] args) {
try {
StatefulKnowledgeSession ksession = createKnowledgeSession();
KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);
Ticket ticket = new Ticket();
ticket.setStatus("open");
ticket.setContent("testing content");
ticket.setOpeningDate(new Date());
ticket.setIdTicket(1);
ksession.insert(ticket);
ksession.fireAllRules();
} catch (Throwable t) {
t.printStackTrace();
}
}
private static StatefulKnowledgeSession createKnowledgeSession() {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory
.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("OpenStateRules.drl"),
ResourceType.DRL);
if (kbuilder.hasErrors()) {
if (kbuilder.getErrors().size() > 0) {
for (KnowledgeBuilderError kerror : kbuilder.getErrors()) {
System.err.println(kerror);
}
}
}
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
return ksession;
}
}
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/726755#726755]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120327/2ec63ee7/attachment.html
More information about the jboss-user
mailing list