Réalisation indexer en cours

This commit is contained in:
Nicolas Héron 2019-01-29 20:22:39 +01:00
commit 7798189414
16 changed files with 440 additions and 36 deletions

View file

@ -3,6 +3,7 @@ package org.chtijbug.drools;
import org.chtijbug.drools.logging.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@ -23,6 +24,20 @@ public class SessionContext {
private Fact fact;
private String groupID;
private String artefactID;
private String version;
private String containerId;
private String serverName;
private Date startTime;
private Date stopTime;
public SessionExecution getSessionExecution() {
return sessionExecution;
}
@ -83,15 +98,72 @@ public class SessionContext {
this.fireAllRulesExecution = fireAllRulesExecution;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getStopTime() {
return stopTime;
}
public void setStopTime(Date stopTime) {
this.stopTime = stopTime;
}
public String getGroupID() {
return groupID;
}
public void setGroupID(String groupID) {
this.groupID = groupID;
}
public String getArtefactID() {
return artefactID;
}
public void setArtefactID(String artefactID) {
this.artefactID = artefactID;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getContainerId() {
return containerId;
}
public void setContainerId(String containerId) {
this.containerId = containerId;
}
public String getServerName() {
return serverName;
}
public void setServerName(String serverName) {
this.serverName = serverName;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("SessionContext{");
sb.append("sessionExecution=").append(sessionExecution);
sb.append(", processExecution=").append(processExecution);
sb.append(", ruleExecution=").append(ruleExecution);
sb.append(", fireAllRulesExecution=").append(fireAllRulesExecution);
sb.append(", fact=").append(fact);
sb.append("groupID='").append(groupID).append('\'');
sb.append(", artefactID='").append(artefactID).append('\'');
sb.append(", version='").append(version).append('\'');
sb.append(", containerId='").append(containerId).append('\'');
sb.append(", serverName='").append(serverName).append('\'');
sb.append(", startTime=").append(startTime);
sb.append(", stopTime=").append(stopTime);
sb.append('}');
return sb.toString();
}

View file

@ -35,7 +35,7 @@ public class HistoryEvent implements Serializable {
private Long ruleBaseID;
private Long sessionId;
private DroolsChtijbugException droolsChtijbugException;
private ArrayList<KnowledgeResource> knowledgeResources = new ArrayList<>();
private ArrayList<KnowledgeResource> knowledgeResources = new ArrayList<KnowledgeResource>();
/**
* Mandatory for GWT Serialization

View file

@ -26,7 +26,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class DeleteFactEventStrategy implements AbstractMemoryEventHandlerStrategy {
;
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {

View file

@ -36,6 +36,7 @@ public class InsertedFactEventStrategy implements AbstractMemoryEventHandlerStra
fact.setRealFact(insertedFactHistoryEvent.getInsertedObject().getRealObject());
fact.setModificationDate(insertedFactHistoryEvent.getDateEvent());
fact.setFactType(FactType.INSERTED);
fact.setEventid(insertedFactHistoryEvent.getEventID());
RuleExecution existingInSessionRuleExecution = null;
if (insertedFactHistoryEvent.getRuleName() == null) { // inserted from a session
SessionExecution sessionExecution = sessionContext.getSessionExecution();

View file

@ -38,12 +38,14 @@ public class UpdatedFactEventStrategy implements AbstractMemoryEventHandlerStrat
factOldValue.setRealFact(updatedFactHistoryEvent.getObjectOldValue().getRealObject());
factOldValue.setModificationDate(updatedFactHistoryEvent.getDateEvent());
factOldValue.setFactType(FactType.UPDATED_OLDVALUE);
factOldValue.setEventid(updatedFactHistoryEvent.getEventID());
Fact factNewValue = new Fact();
factNewValue.setFullClassName(updatedFactHistoryEvent.getObjectNewValue().getFullClassName());
factNewValue.setObjectVersion(updatedFactHistoryEvent.getObjectNewValue().getObjectVersion());
factNewValue.setRealFact(updatedFactHistoryEvent.getObjectNewValue().getRealObject());
factNewValue.setModificationDate(updatedFactHistoryEvent.getDateEvent());
factNewValue.setFactType(FactType.UPDATED_NEWVALUE);
factNewValue.setEventid(updatedFactHistoryEvent.getEventID());
RuleExecution existingInSessionRuleExecution = null;
if (updatedFactHistoryEvent.getRuleName() == null) { // updated from a session
SessionExecution sessionExecution = sessionContext.getSessionExecution();

View file

@ -35,7 +35,7 @@ public class KnowledgeSessionFireAllRulesAndStartProcessEventStrategy implements
if (sessionFireAllRulesAndStartProcess.getInputObject() != null) {
DroolsFactObject inputObject = sessionFireAllRulesAndStartProcess.getInputObject();
Fact inputFact = new Fact();
inputFact.setEventid(sessionFireAllRulesAndStartProcess.getEventID());
inputFact.setEventid(sessionContext.getSessionExecution().getStartEventID());
inputFact.setFactType(FactType.INPUTDATA);
inputFact.setFullClassName(inputObject.getFullClassName());
inputFact.setRealFact(inputObject.getRealObject());
@ -46,7 +46,7 @@ public class KnowledgeSessionFireAllRulesAndStartProcessEventStrategy implements
if (sessionFireAllRulesAndStartProcess.getOutputObject() != null) {
DroolsFactObject outputObject = sessionFireAllRulesAndStartProcess.getOutputObject();
Fact outputFact = new Fact();
outputFact.setEventid(sessionFireAllRulesAndStartProcess.getEventID());
outputFact.setEventid(sessionContext.getSessionExecution().getStopEventID());
outputFact.setFactType(FactType.OUTPUTDATA);
outputFact.setFullClassName(outputObject.getFullClassName());
outputFact.setRealFact(outputObject.getRealObject());