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

    • Running tasks concurrently on multiple threads
    • getExternalFilesDir (Context)
    • getSupportFragmentManager (FragmentActivity)
    • startActivity (Activity)
    • Path (java.nio.file)
    • Arrays (java.util)
      This class contains various methods for manipulating arrays (such as sorting and searching). This cl
    • UUID (java.util)
      UUID is an immutable representation of a 128-bit universally unique identifier (UUID). There are mul
    • AtomicInteger (java.util.concurrent.atomic)
      An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
    • Cipher (javax.crypto)
      This class provides access to implementations of cryptographic ciphers for encryption and decryption
    • Logger (org.apache.log4j)
      This is the central class in the log4j package. Most logging operations, except configuration, are d
    • 21 Best Atom Packages for 2021
    Tabnine Logo
    • Products

      Search for Java codeSearch for JavaScript code
    • IDE Plugins

      IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
    • Company

      About UsContact UsCareers
    • Resources

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