Skip to content

Instantly share code, notes, and snippets.

@tkobayas
tkobayas / ProcessMainHQEx.java
Created July 13, 2012 02:20
jBPM HQ example
package com.sample;
import java.util.List;
import java.util.UUID;
import org.drools.KnowledgeBase;
import org.drools.SystemEventListenerFactory;
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
@Test
public void testJSONTypeInfoTopLevelOnly() {
Marshaller marshaller = MarshallerFactory.getMarshaller( getCustomClasses(), MarshallingFormat.JSON, getClass().getClassLoader() );
String rawContent = "{\"org.kie.server.api.marshalling.objects.PojoA\": "
+ "{\"name\": \"A\","
+ " \"pojoBList\":"
+ " [{\"name\": \"B1\","
+ " \"pojoCList\":"
+ " ["
+ " {\"name\": \"C1\"}, "
@Test
public void testJSONTypeInfoTopLevelOnly() {
Marshaller marshaller = MarshallerFactory.getMarshaller( getCustomClasses(), MarshallingFormat.JSON, getClass().getClassLoader() );
String rawContent = "{\"org.kie.server.api.marshalling.objects.PojoA\": "
+ "{\"name\": \"A\","
+ " \"pojoBList\":"
+ " [{\"name\": \"B1\","
+ " \"pojoCList\":"
+ " ["
+ " {\"name\": \"C1\"}, "
@tkobayas
tkobayas / ConcurrentNodeMemories.java
Created December 2, 2019 07:08
ksession reset : the other idea
public void resetAllMemories(StatefulKnowledgeSession session) {
InternalKnowledgeBase kBase = (InternalKnowledgeBase) session.getKieBase();
for (int i = 0; i < memories.length(); i++) {
Memory memory = memories.get(i);
if (memory != null) {
memory.reset();
if (memory instanceof PathMemory) {
SegmentMemory[] smems = ((PathMemory) memory).getSegmentMemories();
if (smems != null) {
package org.kie.kogito.queries;
unit LoanUnit;
import org.kie.kogito.queries.LoanApplication
rule SmallDeposit when
$l: /loanApplications[ applicant.age >= 20, deposit < 1000, amount <= 2000 ]
then
modify($l) { setApproved(true) };
end
package org.kie.kogito.queries;
unit LoanUnit;
import org.kie.kogito.queries.LoanApplication
rule SmallDeposit when
$l: /loanApplications[ applicant.age >= 20, deposit < 1000, amount <= 2000 ]
then
modify($l) { setApproved(true) };
end
package org.kie.kogito.queries;
unit LoanUnit;
import org.kie.kogito.queries.LoanApplication
rule SmallDepositApprove when
$l: /loanApplications[ applicant.age >= 20, deposit < 1000, amount <= 2000 ]
then
modify($l) { setApproved(true) };
end
diff --git a/kie-internal/src/main/java/org/kie/internal/builder/ChangeType.java b/kie-internal/src/main/java/org/kie/internal/builder/ChangeType.java
index 1af74ca..1cb589a 100644
--- a/kie-internal/src/main/java/org/kie/internal/builder/ChangeType.java
+++ b/kie-internal/src/main/java/org/kie/internal/builder/ChangeType.java
@@ -16,7 +16,7 @@
package org.kie.internal.builder;
public enum ChangeType {
- REMOVED, UPDATED, ADDED;
+ REMOVED, UPDATED, ADDED, MERGE;
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-examples</artifactId>
<version>0.7.0</version>
</parent>
<groupId>org.kie.kogito.examples</groupId>
<?xml version="1.0" encoding="UTF-8" ?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kie.kogito</groupId>
<artifactId>kogito-examples</artifactId>