Tabnine Logo
KnowledgeBuilderFactory.newKnowledgeBuilder
Code IndexAdd Tabnine to your IDE (free)

How to use
newKnowledgeBuilder
method
in
org.kie.builder.KnowledgeBuilderFactory

Best Java code snippets using org.kie.builder.KnowledgeBuilderFactory.newKnowledgeBuilder (Showing top 4 results out of 315)

origin: org.jbpm/jbpm-simulation

public WorkingMemorySimulationRepository(boolean fireRulesOnStore, Resource... rules) {
  this.fireRulesOnStore = fireRulesOnStore;
  KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
  
  for (Resource path : rules) {
  
    kbuilder.add(path, ResourceType.DRL);
  }
  if (kbuilder.hasErrors()) {
    throw new RuntimeException("Error while building knowledge base: " + kbuilder.getErrors());
  }
  
  this.ksession = kbuilder.newKnowledgeBase().newStatefulKnowledgeSession();
  try {
    // register global for aggregated events
    ksession.setGlobal("simulation", new ArrayList<AggregatedActivitySimulationEvent>());
    ksession.setGlobal("summary", new ArrayList<AggregatedActivitySimulationEvent>());
    AggregatedProcessSimulationEvent init = new AggregatedProcessSimulationEvent("", 0, 0, 0);
    List processOnlyList = new ArrayList<AggregatedSimulationEvent>();
    processOnlyList.add(init);
    ksession.setGlobal("processEventsOnly", processOnlyList);
  } catch (Exception e) {
    // catch it as there could be no simulation global declared
  }
}

origin: org.jbpm/jbpm-simulation

public WorkingMemorySimulationRepository(boolean fireRulesOnStore, String... rules) {
  this.fireRulesOnStore = fireRulesOnStore;
  KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
  
  for (String path : rules) {
  
    kbuilder.add(ResourceFactory.newClassPathResource(path), ResourceType.DRL);
  }
  if (kbuilder.hasErrors()) {
    throw new RuntimeException("Error while building knowledge base: " + kbuilder.getErrors());
  }
  
  this.ksession = kbuilder.newKnowledgeBase().newStatefulKnowledgeSession();
  try {
    // register global for aggregated events
    ksession.setGlobal("simulation", new ArrayList<AggregatedActivitySimulationEvent>());
  } catch (Exception e) {
    // catch it as there could be no simulation global declared
  }
}

origin: org.jbpm/jbpm-simulation

  @Test
  public void testSimulationCommand() {
    
    PathFinder finder = PathFinderFactory.getInstance(this.getClass().getResourceAsStream("/BPMN2-ExclusiveSplit.bpmn2"));
    
    List<SimulationPath> paths = finder.findPaths(new SimulationFilterPathFormatConverter());
    SimulationContext context = SimulationContextFactory.newContext(new HardCodedSimulationDataProvider());
    
    KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
    
    builder.add(ResourceFactory.newClassPathResource("BPMN2-ExclusiveSplit.bpmn2"), ResourceType.BPMN2);
    
    KnowledgeBase kbase = builder.newKnowledgeBase();
    KieSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
    config.setOption(ClockTypeOption.get("pseudo") );
    
    for (SimulationPath sp : paths) {
    
      StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession(config, EnvironmentFactory.newEnvironment());
      ((SessionPseudoClock) session.getSessionClock()).advanceTime(System.currentTimeMillis(), TimeUnit.MILLISECONDS);
      
      session.execute(new SimulateProcessPathCommand("com.sample.test", context, sp));
    }
  }
}
origin: org.jbpm/jbpm-simulation

public static StatefulKnowledgeSession createSession(String process) {
  KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder();
org.kie.builderKnowledgeBuilderFactorynewKnowledgeBuilder

Popular methods of KnowledgeBuilderFactory

    Popular in Java

    • Updating database using SQL prepared statement
    • onCreateOptionsMenu (Activity)
    • requestLocationUpdates (LocationManager)
    • getOriginalFilename (MultipartFile)
      Return the original filename in the client's filesystem.This may contain path information depending
    • Thread (java.lang)
      A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
    • BigInteger (java.math)
      An immutable arbitrary-precision signed integer.FAST CRYPTOGRAPHY This implementation is efficient f
    • ResultSet (java.sql)
      An interface for an object which represents a database table entry, returned as the result of the qu
    • Calendar (java.util)
      Calendar is an abstract base class for converting between a Date object and a set of integer fields
    • Collection (java.util)
      Collection is the root of the collection hierarchy. It defines operations on data collections and t
    • Properties (java.util)
      A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
    • From CI to AI: The AI layer in your organization
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

      FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
    Get Tabnine for your IDE now