Merge pull request #71 from pymma/kafka

Add clonning of values in fact logging to keep initial values - debug
This commit is contained in:
Nicolas Héron 2020-07-28 14:37:22 +02:00 committed by GitHub
commit b85546712d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 82 additions and 43 deletions

View file

@ -115,7 +115,7 @@ public class DroolsChtijbugRulesExecutionService {
Object result = null;
try {
messageHandlerResolver.setClassLoader(chtijbugObjectRequest.getObjectRequest().getClass().getClassLoader());
RuleBasePackage ruleBasePackage = this.ruleBasePackages.get(kci.getResource().getContainerId());
if (ruleBasePackage != null) {
Date startTime = new Date();

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtime.impl;
import com.rits.cloning.Cloner;
import com.rits.cloning.ObjenesisInstantiationStrategy;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
import org.chtijbug.drools.common.reflection.ReflectionUtils;
@ -384,8 +385,13 @@ public class RuleBaseStatefulSession implements RuleBaseSession {
Object inputObjectClone;
if (inputObject != null) {
this.insertByReflection(inputObject);
Cloner cloner = new Cloner();
inputObject.getClass().getClassLoader();
Thread currentThread = Thread.currentThread();
ClassLoader old = currentThread.getContextClassLoader();
currentThread.setContextClassLoader(inputObject.getClass().getClassLoader());
Cloner cloner = new Cloner(new ObjenesisInstantiationStrategy());
inputObjectClone=cloner.deepClone(inputObject);
currentThread.setContextClassLoader(old);
inputDroolsObject = DroolsFactObjectFactory.createFactObject(inputObjectClone);
}
if (processName != null && processName.length() > 0) {

View file

@ -55,7 +55,7 @@
<dependency>
<groupId>io.github.kostaskougios</groupId>
<artifactId>cloning</artifactId>
<version>1.10.3</version>
<version>1.O.O-chtijbug</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>

View file

@ -36,13 +36,17 @@ public class HistoryEvent implements Serializable {
private Long sessionId;
private DroolsChtijbugException droolsChtijbugException;
private ArrayList<KnowledgeResource> knowledgeResources = new ArrayList<KnowledgeResource>();
private ClassLoader businessClassLoader;
/**
* Mandatory for GWT Serialization
*/
public HistoryEvent() {
}
public void setBusinessClassLoader(ClassLoader businessClassLoader) {
this.businessClassLoader = businessClassLoader;
}
public HistoryEvent(Long eventID, Date dateEvent, TypeEvent typeEvent) {
this.eventID = eventID;

View file

@ -1,5 +1,6 @@
package org.chtijbug.drools.runtimeevent;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
@ -8,9 +9,10 @@ import org.chtijbug.drools.entity.history.HistoryEvent;
*/
public interface AbstractMemoryEventHandlerStrategy {
public abstract void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext);
public abstract void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner);
public abstract boolean isEventSupported(HistoryEvent historyEvent);
}

View file

@ -15,6 +15,8 @@
*/
package org.chtijbug.drools.runtimeevent;
import com.rits.cloning.Cloner;
import com.rits.cloning.ObjenesisInstantiationStrategy;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.runtimeevent.impl.fact.*;
@ -39,6 +41,8 @@ public class MessageHandlerResolver {
@Resource
private List<AbstractMemoryEventHandlerStrategy> allMemoryStrategies = new ArrayList<>();
private ClassLoader classLoader;
public MessageHandlerResolver() {
allMemoryStrategies.add(new DeleteFactEventStrategy());
allMemoryStrategies.add(new InsertedByRelectionFactEndEventStrategy());
@ -68,16 +72,19 @@ public class MessageHandlerResolver {
allMemoryStrategies.add(new AfterRuleflowGroupDeactivatedEventStrategy());
allMemoryStrategies.add(new BeforeRuleFiredEventStrategy());
}
public SessionContext getSessionFromHistoryEvent(List<HistoryEvent> historyEvents) {
Thread currentThread = Thread.currentThread();
ClassLoader old = currentThread.getContextClassLoader();
currentThread.setContextClassLoader(classLoader);
SessionContext sessionContext = new SessionContext();
Cloner cloner=new Cloner(new ObjenesisInstantiationStrategy());
for (HistoryEvent historyEvent : historyEvents) {
AbstractMemoryEventHandlerStrategy strategy = this.resolveMessageHandlerMemory(historyEvent);
if (strategy != null) {
try {
strategy.handleMessageInternally(historyEvent, sessionContext);
strategy.handleMessageInternally(historyEvent, sessionContext,cloner);
}catch (Exception e){
logger.error("MessageHandle for class" + historyEvent.getClass().toString(), historyEvent, e);
}
@ -85,6 +92,7 @@ public class MessageHandlerResolver {
}
sessionContext.getRuleflowGroups().clear();
currentThread.setContextClassLoader(old);
return sessionContext;
}
@ -95,4 +103,8 @@ public class MessageHandlerResolver {
}
return null;
}
public void setClassLoader(ClassLoader classLoader) {
this.classLoader=classLoader;
}
}

View file

@ -28,14 +28,12 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class DeleteFactEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext,Cloner cloner) {
DeletedFactHistoryEvent deletedFactHistoryEvent = (DeletedFactHistoryEvent) historyEvent;
Fact fact = new Fact();
fact.setFullClassName(deletedFactHistoryEvent.getDeletedObject().getFullClassName());
fact.setObjectVersion(deletedFactHistoryEvent.getDeletedObject().getObjectVersion());
Cloner cloner = new Cloner();
fact.setRealFact(cloner.deepClone(deletedFactHistoryEvent.getDeletedObject().getRealObject()));
fact.setModificationDate(deletedFactHistoryEvent.getDateEvent());
fact.setFactType(FactType.DELETED);

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.fact;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.fact.InsertedByReflectionFactEndHistoryEvent;
@ -26,7 +27,7 @@ public class InsertedByRelectionFactEndEventStrategy implements AbstractMemoryEv
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
}

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.fact;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.fact.InsertedByReflectionFactStartHistoryEvent;
@ -24,7 +25,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class InsertedByRelectionFactStartEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
}

View file

@ -29,12 +29,11 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class InsertedFactEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext,Cloner cloner) {
InsertedFactHistoryEvent insertedFactHistoryEvent = (InsertedFactHistoryEvent) historyEvent;
Fact fact = new Fact();
fact.setFullClassName(insertedFactHistoryEvent.getInsertedObject().getFullClassName());
fact.setObjectVersion(insertedFactHistoryEvent.getInsertedObject().getObjectVersion());
Cloner cloner = new Cloner();
fact.setRealFact(cloner.deepClone(insertedFactHistoryEvent.getInsertedObject().getRealObject()));
fact.setModificationDate(insertedFactHistoryEvent.getDateEvent());
fact.setFactType(FactType.INSERTED);

View file

@ -31,9 +31,8 @@ public class UpdatedFactEventStrategy implements AbstractMemoryEventHandlerStrat
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext,Cloner cloner) {
UpdatedFactHistoryEvent updatedFactHistoryEvent = (UpdatedFactHistoryEvent) historyEvent;
Cloner cloner=new Cloner();
Fact factOldValue = new Fact();
factOldValue.setFullClassName(updatedFactHistoryEvent.getObjectOldValue().getFullClassName());
factOldValue.setObjectVersion(updatedFactHistoryEvent.getObjectOldValue().getObjectVersion());

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionCreatedEvent;
@ -29,7 +30,7 @@ public class KnowledgeSessionCreateEventStrategy implements AbstractMemoryEventH
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
SessionExecution sessionExecution = new SessionExecution();
SessionCreatedEvent sessionCreatedEvent = (SessionCreatedEvent) historyEvent;
sessionExecution.setProcessingStartDate(new Date());

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionDisposedEvent;
@ -29,7 +30,7 @@ public class KnowledgeSessionDisposeEventStrategy implements AbstractMemoryEvent
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
SessionDisposedEvent sessionDisposedEvent = (SessionDisposedEvent) historyEvent;
SessionExecution existingSessionRutime = sessionContext.getSessionExecution();
existingSessionRutime.setEndDate(sessionDisposedEvent.getDateEvent());

View file

@ -29,7 +29,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class KnowledgeSessionFireAllRulesAndStartProcessEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext,Cloner cloner) {
SessionFireAllRulesAndStartProcess sessionFireAllRulesAndStartProcess = (SessionFireAllRulesAndStartProcess) historyEvent;
SessionExecution existingSessionRutime = sessionContext.getSessionExecution();
@ -40,7 +40,6 @@ public class KnowledgeSessionFireAllRulesAndStartProcessEventStrategy implements
inputFact.setEventid(sessionContext.getSessionExecution().getStartEventID());
inputFact.setFactType(FactType.INPUTDATA);
inputFact.setFullClassName(inputObject.getFullClassName());
Cloner cloner=new Cloner();
inputFact.setRealFact(cloner.deepClone(inputObject.getRealObject()));
inputFact.setModificationDate(sessionFireAllRulesAndStartProcess.getDateEvent());
inputFact.setObjectVersion(inputObject.getObjectVersion());
@ -52,7 +51,6 @@ public class KnowledgeSessionFireAllRulesAndStartProcessEventStrategy implements
outputFact.setEventid(sessionContext.getSessionExecution().getStopEventID());
outputFact.setFactType(FactType.OUTPUTDATA);
outputFact.setFullClassName(outputObject.getFullClassName());
Cloner cloner=new Cloner();
outputFact.setRealFact(cloner.deepClone(outputObject.getRealObject()));
outputFact.setModificationDate(sessionFireAllRulesAndStartProcess.getDateEvent());
outputFact.setObjectVersion(outputObject.getObjectVersion());

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionFireAllRulesBeginEvent;
@ -27,7 +28,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class KnowledgeSessionFireAllRulesBeginEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
SessionFireAllRulesBeginEvent sessionFireAllRulesBeginEvent = (SessionFireAllRulesBeginEvent) historyEvent;
SessionExecution existingSessionRutime = sessionContext.getSessionExecution();

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionFireAllRulesEndEvent;
@ -26,7 +27,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class KnowledgeSessionFireAllRulesEndEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
SessionFireAllRulesEndEvent sessionFireAllRulesEndEvent = (SessionFireAllRulesEndEvent) historyEvent;
FireAllRulesExecution fireAllRulesExecution = sessionContext.getFireAllRulesExecution();
fireAllRulesExecution.setStopEventID(sessionFireAllRulesEndEvent.getEventID());

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionFireAllRulesMaxNumberReachedEvent;
@ -25,7 +26,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class KnowledgeSessionFireAllRulesMaxRulesEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
SessionFireAllRulesMaxNumberReachedEvent sessionFireAllRulesMaxNumberReachedEvent = (SessionFireAllRulesMaxNumberReachedEvent) historyEvent;
FireAllRulesExecution fireAllRulesExecution = sessionContext.getFireAllRulesExecution();
fireAllRulesExecution.setMaxRulesEventID(sessionFireAllRulesMaxNumberReachedEvent.getEventID());

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionStartProcessBeginEvent;
@ -23,7 +24,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class KnowledgeSessionProcessBeginEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
}

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionStartProcessEndEvent;
@ -24,7 +25,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class KnowledgeSessionProcessEndEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
}

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.process;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.DroolsNodeType;
import org.chtijbug.drools.entity.history.HistoryEvent;
@ -28,7 +29,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterNodeInstanceTriggeredEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
AfterNodeInstanceTriggeredHistoryEvent afterNodeInstanceTriggeredHistoryEvent = (AfterNodeInstanceTriggeredHistoryEvent) historyEvent;
if (afterNodeInstanceTriggeredHistoryEvent.getNodeInstance().getNode().getNodeType() == DroolsNodeType.RuleNode) {
String ruleFLowName = afterNodeInstanceTriggeredHistoryEvent.getNodeInstance().getNode().getRuleflowGroupName();

View file

@ -15,6 +15,7 @@
*/
package org.chtijbug.drools.runtimeevent.impl.process;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.DroolsNodeType;
import org.chtijbug.drools.entity.history.HistoryEvent;
@ -27,7 +28,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterNodeLeftEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
AfterNodeLeftHistoryEvent afterNodeLeftHistoryEvent = (AfterNodeLeftHistoryEvent) historyEvent;
if (afterNodeLeftHistoryEvent.getNodeInstance().getNode().getNodeType() == DroolsNodeType.RuleNode) {
String ruleFlowName = afterNodeLeftHistoryEvent.getNodeInstance().getNode().getRuleflowGroupName();

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.process;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.AfterProcessEndHistoryEvent;
@ -26,7 +27,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterProcessEndHistoryEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
AfterProcessEndHistoryEvent afterProcessEndHistoryEvent = (AfterProcessEndHistoryEvent) historyEvent;
ProcessExecution processExecution = sessionContext.getProcessExecution();

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.process;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.AfterProcessStartHistoryEvent;
@ -24,7 +25,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterProcessStartEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
}

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.process;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.AfterVariableChangeChangedHistoryEvent;
@ -24,7 +25,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterVariableChangeEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
}

View file

@ -15,6 +15,7 @@
*/
package org.chtijbug.drools.runtimeevent.impl.process;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.BeforeNodeInstanceTriggeredHistoryEvent;
@ -23,7 +24,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class BeforeNodeInstanceTriggeredEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
}
@Override

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.process;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.BeforeNodeLeftHistoryEvent;
@ -24,7 +25,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class BeforeNodeLeftEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
}

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.process;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.BeforeProcessEndHistoryEvent;
@ -24,7 +25,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class BeforeProcessEndEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
}

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.process;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.BeforeProcessStartHistoryEvent;
@ -26,7 +27,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class BeforeProcessStartEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
BeforeProcessStartHistoryEvent beforeProcessStartHistoryEvent = (BeforeProcessStartHistoryEvent) historyEvent;
ProcessExecution processExecution = new ProcessExecution();

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.process;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.BeforeVariableChangeChangedHistoryEvent;
@ -24,7 +25,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class BeforeVariableChangeEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
}

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.rule;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.rule.AfterRuleFiredHistoryEvent;
@ -25,7 +26,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterRuleFiredEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
AfterRuleFiredHistoryEvent afterRuleFiredHistoryEvent = (AfterRuleFiredHistoryEvent) historyEvent;
RuleExecution ruleExecution = sessionContext.getRuleExecution();

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.rule;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.rule.AfterRuleFlowActivatedHistoryEvent;
@ -24,7 +25,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterRuleflowGroupActivatedEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
}

View file

@ -16,6 +16,7 @@
package org.chtijbug.drools.runtimeevent.impl.rule;
import com.rits.cloning.Cloner;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.rule.AfterRuleFlowDeactivatedHistoryEvent;
@ -24,7 +25,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterRuleflowGroupDeactivatedEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext, Cloner cloner) {
}

View file

@ -27,7 +27,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class BeforeRuleFiredEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext,Cloner cloner) {
BeforeRuleFiredHistoryEvent beforeRuleFiredHistoryEvent = (BeforeRuleFiredHistoryEvent) historyEvent;
RuleExecution ruleExecution = new RuleExecution();
sessionContext.setRuleExecution(ruleExecution);
@ -50,7 +50,6 @@ public class BeforeRuleFiredEventStrategy implements AbstractMemoryEventHandlerS
ruleExecution.setRuleName(beforeRuleFiredHistoryEvent.getRule().getRuleName());
ruleExecution.setPackageName(beforeRuleFiredHistoryEvent.getRule().getRulePackageName());
ruleExecution.setStartEventID(beforeRuleFiredHistoryEvent.getEventID());
Cloner cloner = new Cloner();
for (DroolsFactObject droolsFactObject : beforeRuleFiredHistoryEvent.getWhenObjects()) {
if (droolsFactObject != null) {
Fact fact = new Fact();

View file

@ -77,7 +77,7 @@
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest:2.1" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
<orderEntry type="library" name="Maven: commons-io:commons-io:2.1" level="project" />
<orderEntry type="module" module-name="cloning" />
<orderEntry type="library" name="Maven: io.github.kostaskougios:cloning:1.10.3" level="project" />
<orderEntry type="library" name="Maven: org.objenesis:objenesis:3.0.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.10.3" level="project" />

View file

@ -39,7 +39,7 @@
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:2.1" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest:2.1" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0.1" level="project" />
<orderEntry type="module" module-name="cloning" />
<orderEntry type="library" name="Maven: io.github.kostaskougios:cloning:1.10.3" level="project" />
<orderEntry type="library" name="Maven: org.objenesis:objenesis:3.0.1" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.10.3" level="project" />
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.10.3" level="project" />