Réalisation indexer en cours
This commit is contained in:
parent
6f81acfb4c
commit
7798189414
16 changed files with 440 additions and 36 deletions
|
|
@ -20,9 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class ProjectPersistService {
|
public class ProjectPersistService {
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ import org.kie.server.services.api.KieServerRegistry;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -116,6 +117,7 @@ public class DroolsChtijbugRulesExecutionService {
|
||||||
|
|
||||||
RuleBasePackage ruleBasePackage = this.ruleBasePackages.get(kci.getResource().getContainerId());
|
RuleBasePackage ruleBasePackage = this.ruleBasePackages.get(kci.getResource().getContainerId());
|
||||||
if (ruleBasePackage != null) {
|
if (ruleBasePackage != null) {
|
||||||
|
Date startTime = new Date();
|
||||||
ChtijbugHistoryListener chtijbugHistoryListener = new ChtijbugHistoryListener();
|
ChtijbugHistoryListener chtijbugHistoryListener = new ChtijbugHistoryListener();
|
||||||
RuleBaseSession session = ruleBasePackage.createRuleBaseSession(sessionMaxNumberRulesToExecute, chtijbugHistoryListener, sessionName);
|
RuleBaseSession session = ruleBasePackage.createRuleBaseSession(sessionMaxNumberRulesToExecute, chtijbugHistoryListener, sessionName);
|
||||||
if (kieServerAddOnElement != null) {
|
if (kieServerAddOnElement != null) {
|
||||||
|
|
@ -129,11 +131,23 @@ public class DroolsChtijbugRulesExecutionService {
|
||||||
|
|
||||||
}
|
}
|
||||||
result = session.fireAllRulesAndStartProcess(chtijbugObjectRequest.getObjectRequest(), processID);
|
result = session.fireAllRulesAndStartProcess(chtijbugObjectRequest.getObjectRequest(), processID);
|
||||||
|
session.dispose();
|
||||||
|
Date stopTime = new Date();
|
||||||
SessionContext sessionContext = this.messageHandlerResolver.getSessionFromHistoryEvent(chtijbugHistoryListener.getHistoryEventLinkedList());
|
SessionContext sessionContext = this.messageHandlerResolver.getSessionFromHistoryEvent(chtijbugHistoryListener.getHistoryEventLinkedList());
|
||||||
|
sessionContext.setGroupID(kci.getResource().getReleaseId().getGroupId());
|
||||||
|
sessionContext.setArtefactID(kci.getResource().getReleaseId().getArtifactId());
|
||||||
|
sessionContext.setVersion(kci.getResource().getReleaseId().getVersion());
|
||||||
|
sessionContext.setContainerId(kci.getContainerId());
|
||||||
|
String serverName = System.getProperty("org.kie.server.id");
|
||||||
|
if (serverName!= null){
|
||||||
|
sessionContext.setServerName(serverName);
|
||||||
|
}
|
||||||
|
sessionContext.setStartTime(startTime);
|
||||||
|
sessionContext.setStopTime(stopTime);
|
||||||
chtijbugObjectRequest.setSessionLogging(sessionContext);
|
chtijbugObjectRequest.setSessionLogging(sessionContext);
|
||||||
chtijbugObjectRequest.setObjectRequest(result);
|
chtijbugObjectRequest.setObjectRequest(result);
|
||||||
logger.debug("Returning OK response with content '{}'", chtijbugObjectRequest.getObjectRequest());
|
logger.debug("Returning OK response with content '{}'", chtijbugObjectRequest.getObjectRequest());
|
||||||
session.dispose();
|
|
||||||
}
|
}
|
||||||
return chtijbugObjectRequest;
|
return chtijbugObjectRequest;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package org.chtijbug.drools;
|
||||||
import org.chtijbug.drools.logging.*;
|
import org.chtijbug.drools.logging.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -23,6 +24,20 @@ public class SessionContext {
|
||||||
|
|
||||||
private Fact fact;
|
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() {
|
public SessionExecution getSessionExecution() {
|
||||||
return sessionExecution;
|
return sessionExecution;
|
||||||
}
|
}
|
||||||
|
|
@ -83,15 +98,72 @@ public class SessionContext {
|
||||||
this.fireAllRulesExecution = fireAllRulesExecution;
|
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
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final StringBuffer sb = new StringBuffer("SessionContext{");
|
final StringBuffer sb = new StringBuffer("SessionContext{");
|
||||||
sb.append("sessionExecution=").append(sessionExecution);
|
sb.append("groupID='").append(groupID).append('\'');
|
||||||
sb.append(", processExecution=").append(processExecution);
|
sb.append(", artefactID='").append(artefactID).append('\'');
|
||||||
sb.append(", ruleExecution=").append(ruleExecution);
|
sb.append(", version='").append(version).append('\'');
|
||||||
sb.append(", fireAllRulesExecution=").append(fireAllRulesExecution);
|
sb.append(", containerId='").append(containerId).append('\'');
|
||||||
sb.append(", fact=").append(fact);
|
sb.append(", serverName='").append(serverName).append('\'');
|
||||||
|
sb.append(", startTime=").append(startTime);
|
||||||
|
sb.append(", stopTime=").append(stopTime);
|
||||||
sb.append('}');
|
sb.append('}');
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public class HistoryEvent implements Serializable {
|
||||||
private Long ruleBaseID;
|
private Long ruleBaseID;
|
||||||
private Long sessionId;
|
private Long sessionId;
|
||||||
private DroolsChtijbugException droolsChtijbugException;
|
private DroolsChtijbugException droolsChtijbugException;
|
||||||
private ArrayList<KnowledgeResource> knowledgeResources = new ArrayList<>();
|
private ArrayList<KnowledgeResource> knowledgeResources = new ArrayList<KnowledgeResource>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mandatory for GWT Serialization
|
* Mandatory for GWT Serialization
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
|
||||||
|
|
||||||
|
|
||||||
public class DeleteFactEventStrategy implements AbstractMemoryEventHandlerStrategy {
|
public class DeleteFactEventStrategy implements AbstractMemoryEventHandlerStrategy {
|
||||||
;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
|
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ public class InsertedFactEventStrategy implements AbstractMemoryEventHandlerStra
|
||||||
fact.setRealFact(insertedFactHistoryEvent.getInsertedObject().getRealObject());
|
fact.setRealFact(insertedFactHistoryEvent.getInsertedObject().getRealObject());
|
||||||
fact.setModificationDate(insertedFactHistoryEvent.getDateEvent());
|
fact.setModificationDate(insertedFactHistoryEvent.getDateEvent());
|
||||||
fact.setFactType(FactType.INSERTED);
|
fact.setFactType(FactType.INSERTED);
|
||||||
|
fact.setEventid(insertedFactHistoryEvent.getEventID());
|
||||||
RuleExecution existingInSessionRuleExecution = null;
|
RuleExecution existingInSessionRuleExecution = null;
|
||||||
if (insertedFactHistoryEvent.getRuleName() == null) { // inserted from a session
|
if (insertedFactHistoryEvent.getRuleName() == null) { // inserted from a session
|
||||||
SessionExecution sessionExecution = sessionContext.getSessionExecution();
|
SessionExecution sessionExecution = sessionContext.getSessionExecution();
|
||||||
|
|
|
||||||
|
|
@ -38,12 +38,14 @@ public class UpdatedFactEventStrategy implements AbstractMemoryEventHandlerStrat
|
||||||
factOldValue.setRealFact(updatedFactHistoryEvent.getObjectOldValue().getRealObject());
|
factOldValue.setRealFact(updatedFactHistoryEvent.getObjectOldValue().getRealObject());
|
||||||
factOldValue.setModificationDate(updatedFactHistoryEvent.getDateEvent());
|
factOldValue.setModificationDate(updatedFactHistoryEvent.getDateEvent());
|
||||||
factOldValue.setFactType(FactType.UPDATED_OLDVALUE);
|
factOldValue.setFactType(FactType.UPDATED_OLDVALUE);
|
||||||
|
factOldValue.setEventid(updatedFactHistoryEvent.getEventID());
|
||||||
Fact factNewValue = new Fact();
|
Fact factNewValue = new Fact();
|
||||||
factNewValue.setFullClassName(updatedFactHistoryEvent.getObjectNewValue().getFullClassName());
|
factNewValue.setFullClassName(updatedFactHistoryEvent.getObjectNewValue().getFullClassName());
|
||||||
factNewValue.setObjectVersion(updatedFactHistoryEvent.getObjectNewValue().getObjectVersion());
|
factNewValue.setObjectVersion(updatedFactHistoryEvent.getObjectNewValue().getObjectVersion());
|
||||||
factNewValue.setRealFact(updatedFactHistoryEvent.getObjectNewValue().getRealObject());
|
factNewValue.setRealFact(updatedFactHistoryEvent.getObjectNewValue().getRealObject());
|
||||||
factNewValue.setModificationDate(updatedFactHistoryEvent.getDateEvent());
|
factNewValue.setModificationDate(updatedFactHistoryEvent.getDateEvent());
|
||||||
factNewValue.setFactType(FactType.UPDATED_NEWVALUE);
|
factNewValue.setFactType(FactType.UPDATED_NEWVALUE);
|
||||||
|
factNewValue.setEventid(updatedFactHistoryEvent.getEventID());
|
||||||
RuleExecution existingInSessionRuleExecution = null;
|
RuleExecution existingInSessionRuleExecution = null;
|
||||||
if (updatedFactHistoryEvent.getRuleName() == null) { // updated from a session
|
if (updatedFactHistoryEvent.getRuleName() == null) { // updated from a session
|
||||||
SessionExecution sessionExecution = sessionContext.getSessionExecution();
|
SessionExecution sessionExecution = sessionContext.getSessionExecution();
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public class KnowledgeSessionFireAllRulesAndStartProcessEventStrategy implements
|
||||||
if (sessionFireAllRulesAndStartProcess.getInputObject() != null) {
|
if (sessionFireAllRulesAndStartProcess.getInputObject() != null) {
|
||||||
DroolsFactObject inputObject = sessionFireAllRulesAndStartProcess.getInputObject();
|
DroolsFactObject inputObject = sessionFireAllRulesAndStartProcess.getInputObject();
|
||||||
Fact inputFact = new Fact();
|
Fact inputFact = new Fact();
|
||||||
inputFact.setEventid(sessionFireAllRulesAndStartProcess.getEventID());
|
inputFact.setEventid(sessionContext.getSessionExecution().getStartEventID());
|
||||||
inputFact.setFactType(FactType.INPUTDATA);
|
inputFact.setFactType(FactType.INPUTDATA);
|
||||||
inputFact.setFullClassName(inputObject.getFullClassName());
|
inputFact.setFullClassName(inputObject.getFullClassName());
|
||||||
inputFact.setRealFact(inputObject.getRealObject());
|
inputFact.setRealFact(inputObject.getRealObject());
|
||||||
|
|
@ -46,7 +46,7 @@ public class KnowledgeSessionFireAllRulesAndStartProcessEventStrategy implements
|
||||||
if (sessionFireAllRulesAndStartProcess.getOutputObject() != null) {
|
if (sessionFireAllRulesAndStartProcess.getOutputObject() != null) {
|
||||||
DroolsFactObject outputObject = sessionFireAllRulesAndStartProcess.getOutputObject();
|
DroolsFactObject outputObject = sessionFireAllRulesAndStartProcess.getOutputObject();
|
||||||
Fact outputFact = new Fact();
|
Fact outputFact = new Fact();
|
||||||
outputFact.setEventid(sessionFireAllRulesAndStartProcess.getEventID());
|
outputFact.setEventid(sessionContext.getSessionExecution().getStopEventID());
|
||||||
outputFact.setFactType(FactType.OUTPUTDATA);
|
outputFact.setFactType(FactType.OUTPUTDATA);
|
||||||
outputFact.setFullClassName(outputObject.getFullClassName());
|
outputFact.setFullClassName(outputObject.getFullClassName());
|
||||||
outputFact.setRealFact(outputObject.getRealObject());
|
outputFact.setRealFact(outputObject.getRealObject());
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,18 @@
|
||||||
package org.chtijbug.drools.indexer.service;
|
package org.chtijbug.drools.indexer.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.chtijbug.drools.SessionContext;
|
||||||
|
import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionAction;
|
||||||
import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionPersistence;
|
import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionPersistence;
|
||||||
|
import org.chtijbug.drools.indexer.persistence.model.EventType;
|
||||||
|
import org.chtijbug.drools.indexer.persistence.repository.BusinessTransactionActionRepository;
|
||||||
import org.chtijbug.drools.indexer.persistence.repository.BusinessTransactionPersistenceRepository;
|
import org.chtijbug.drools.indexer.persistence.repository.BusinessTransactionPersistenceRepository;
|
||||||
import org.chtijbug.drools.logging.SessionExecution;
|
import org.chtijbug.drools.logging.*;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.UUID;
|
import java.util.*;
|
||||||
|
|
||||||
@Service("storeService")
|
@Service("storeService")
|
||||||
public class StoreLoggingService {
|
public class StoreLoggingService {
|
||||||
|
|
@ -16,8 +20,10 @@ public class StoreLoggingService {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private BusinessTransactionPersistenceRepository repository;
|
private BusinessTransactionPersistenceRepository transactionRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BusinessTransactionActionRepository actionRepository;
|
||||||
|
|
||||||
public void store(String fileName, String fileContent) {
|
public void store(String fileName, String fileContent) {
|
||||||
if (fileName!= null) {
|
if (fileName!= null) {
|
||||||
|
|
@ -40,16 +46,116 @@ public class StoreLoggingService {
|
||||||
item.setSecond(second);
|
item.setSecond(second);
|
||||||
item.setMillis(millis);
|
item.setMillis(millis);
|
||||||
item.setTransactionId(id);
|
item.setTransactionId(id);
|
||||||
|
item.setId(UUID.randomUUID().toString());
|
||||||
|
long ii=1;
|
||||||
try {
|
try {
|
||||||
SessionExecution object = mapper.readValue(fileContent,SessionExecution.class);
|
SessionContext sessionContext = mapper.readValue(fileContent,SessionContext.class);
|
||||||
|
item.setContainerId(sessionContext.getContainerId());
|
||||||
|
item.setGroupID(sessionContext.getGroupID());
|
||||||
|
item.setArtefactID(sessionContext.getArtefactID());
|
||||||
|
item.setVersion(sessionContext.getVersion());
|
||||||
|
|
||||||
item.setContent(object);
|
item.setServerName(sessionContext.getServerName());
|
||||||
|
Map<Long, BusinessTransactionAction> actions = new HashMap<>();
|
||||||
|
SessionExecution sessionExecution = sessionContext.getSessionExecution();
|
||||||
|
BusinessTransactionAction businessTransactionoutput=null;
|
||||||
|
for (Fact fact : sessionExecution.getFacts()){
|
||||||
|
BusinessTransactionAction businessTransactionAction = new BusinessTransactionAction();
|
||||||
|
businessTransactionAction.setId(UUID.randomUUID().toString());
|
||||||
|
businessTransactionAction.setBusinessTransactionId(item.getId());
|
||||||
|
if (fact.getFactType().equals(FactType.INPUTDATA)){
|
||||||
|
businessTransactionAction.setEventType(EventType.INPUT);
|
||||||
|
businessTransactionAction.setInputData(fact);
|
||||||
|
businessTransactionAction.setEventNumber(0);
|
||||||
|
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
||||||
|
}else if (fact.getFactType().equals(FactType.OUTPUTDATA)){
|
||||||
|
businessTransactionAction.setEventType(EventType.OUPUT);
|
||||||
|
businessTransactionAction.setOutputData(fact);
|
||||||
|
businessTransactionoutput=businessTransactionAction;
|
||||||
|
|
||||||
|
}else if (fact.getFactType().equals(FactType.INSERTED)){
|
||||||
|
businessTransactionAction.setEventType(EventType.INSERTFACT);
|
||||||
|
businessTransactionAction.setFact(fact);
|
||||||
|
businessTransactionAction.setEventNumber(ii++);
|
||||||
|
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
||||||
|
} else if (fact.getFactType().equals(FactType.UPDATED_NEWVALUE)){
|
||||||
|
businessTransactionAction.setEventType(EventType.UPDATEFACTNEWVALUE);
|
||||||
|
businessTransactionAction.setFact(fact);
|
||||||
|
businessTransactionAction.setEventNumber(ii++);
|
||||||
|
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
||||||
|
}else if (fact.getFactType().equals(FactType.UPDATED_OLDVALUE)){
|
||||||
|
businessTransactionAction.setEventType(EventType.UPDATEFACTOLDVALUE);
|
||||||
|
businessTransactionAction.setFact(fact);
|
||||||
|
businessTransactionAction.setEventNumber(ii++);
|
||||||
|
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
||||||
|
}else if (fact.getFactType().equals(FactType.DELETED)){
|
||||||
|
businessTransactionAction.setEventType(EventType.RETRACTFACT);
|
||||||
|
businessTransactionAction.setFact(fact);
|
||||||
|
businessTransactionAction.setEventNumber(ii++);
|
||||||
|
actions.put(businessTransactionAction.getEventNumber(),businessTransactionAction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (ProcessExecution processExecution : sessionExecution.getProcessExecutions()){
|
||||||
|
BusinessTransactionAction businessTransactionActionStart = new BusinessTransactionAction();
|
||||||
|
|
||||||
|
businessTransactionActionStart.setEventType(EventType.STARTPROCESS);
|
||||||
|
businessTransactionActionStart.setProcessID(processExecution.getProcessId());
|
||||||
|
businessTransactionActionStart.setBusinessTransactionId(item.getId());
|
||||||
|
businessTransactionActionStart.setEventNumber(ii++);
|
||||||
|
actions.put(businessTransactionActionStart.getEventNumber(),businessTransactionActionStart);
|
||||||
|
for (RuleflowGroup rfg : processExecution.getRuleflowGroups()){
|
||||||
|
BusinessTransactionAction businessTransactionActionStartRFG = new BusinessTransactionAction();
|
||||||
|
|
||||||
|
businessTransactionActionStartRFG.setBusinessTransactionId(item.getId());
|
||||||
|
businessTransactionActionStartRFG.setEventType(EventType.STARTRULEFLOWGROUP);
|
||||||
|
businessTransactionActionStartRFG.setRuleflowGroupName(rfg.getRuleflowGroup());
|
||||||
|
businessTransactionActionStartRFG.setEventNumber(ii++);
|
||||||
|
actions.put(businessTransactionActionStartRFG.getEventNumber(),businessTransactionActionStartRFG);
|
||||||
|
for (RuleExecution ruleExecution : rfg.getRuleExecutionList()){
|
||||||
|
BusinessTransactionAction businessTransactionActionRule = new BusinessTransactionAction();
|
||||||
|
|
||||||
|
businessTransactionActionRule.setEventType(EventType.RULE);
|
||||||
|
businessTransactionActionRule.setRuleflowGroupName(rfg.getRuleflowGroup());
|
||||||
|
businessTransactionActionRule.setRuleExecution(ruleExecution);
|
||||||
|
businessTransactionActionRule.setBusinessTransactionId(item.getId());
|
||||||
|
businessTransactionActionRule.setProcessID(processExecution.getProcessId());
|
||||||
|
businessTransactionActionRule.setEventNumber(ii++);
|
||||||
|
actions.put(businessTransactionActionRule.getEventNumber(),businessTransactionActionRule);
|
||||||
|
}
|
||||||
|
BusinessTransactionAction businessTransactionActionSTOPRFG = new BusinessTransactionAction();
|
||||||
|
|
||||||
|
businessTransactionActionSTOPRFG.setEventType(EventType.STOPTRULEFLOWGROUP);
|
||||||
|
businessTransactionActionSTOPRFG.setRuleflowGroupName(rfg.getRuleflowGroup());
|
||||||
|
businessTransactionActionSTOPRFG.setBusinessTransactionId(item.getId());
|
||||||
|
businessTransactionActionSTOPRFG.setEventNumber(ii++);
|
||||||
|
actions.put(businessTransactionActionSTOPRFG.getEventNumber(),businessTransactionActionSTOPRFG);
|
||||||
|
}
|
||||||
|
BusinessTransactionAction businessTransactionActionEnd = new BusinessTransactionAction();
|
||||||
|
businessTransactionActionEnd.setEventType(EventType.STOPPROCESS);
|
||||||
|
businessTransactionActionEnd.setProcessID(processExecution.getProcessId());
|
||||||
|
businessTransactionActionEnd.setBusinessTransactionId(item.getId());
|
||||||
|
businessTransactionActionEnd.setEventNumber(ii++);
|
||||||
|
actions.put(businessTransactionActionEnd.getEventNumber(),businessTransactionActionEnd);
|
||||||
|
}
|
||||||
|
if (businessTransactionoutput!= null) {
|
||||||
|
businessTransactionoutput.setEventNumber(ii++);
|
||||||
|
actions.put(businessTransactionoutput.getEventNumber(), businessTransactionoutput);
|
||||||
|
}
|
||||||
|
List<Long> keys = new ArrayList<Long>(actions.keySet());
|
||||||
|
Collections.sort(keys);
|
||||||
|
List<BusinessTransactionAction> sortedList= new LinkedList<>();
|
||||||
|
for (Long i : keys){
|
||||||
|
sortedList.add(actions.get(i));
|
||||||
|
}
|
||||||
|
transactionRepository.save(item);
|
||||||
|
actionRepository.saveAll(sortedList);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
item.setContent(fileContent);
|
|
||||||
item.setId(UUID.randomUUID().toString());
|
//item.setContent(fileContent);
|
||||||
repository.save(item);
|
|
||||||
|
// repository.save(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("coucou");
|
System.out.println("coucou");
|
||||||
|
|
|
||||||
|
|
@ -89,5 +89,14 @@
|
||||||
<orderEntry type="library" name="Maven: org.elasticsearch:jna:4.5.1" level="project" />
|
<orderEntry type="library" name="Maven: org.elasticsearch:jna:4.5.1" level="project" />
|
||||||
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.7" level="project" />
|
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.7" level="project" />
|
||||||
|
<orderEntry type="module" module-name="drools-framework-runtime-entity" />
|
||||||
|
<orderEntry type="module" module-name="drools-framework-common" />
|
||||||
|
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" 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="library" name="Maven: org.kie:kie-internal:7.16.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.kie:kie-api:7.16.0.Final" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.kie.soup:kie-soup-maven-support:7.16.0.Final" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
@ -43,6 +43,11 @@
|
||||||
<version>2.9.7</version>
|
<version>2.9.7</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.pymmasoftware.jbpm</groupId>
|
||||||
|
<artifactId>drools-framework-runtime-entity</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -0,0 +1,136 @@
|
||||||
|
package org.chtijbug.drools.indexer.persistence.model;
|
||||||
|
|
||||||
|
|
||||||
|
import org.chtijbug.drools.logging.Fact;
|
||||||
|
import org.chtijbug.drools.logging.RuleExecution;
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.Document;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.Field;
|
||||||
|
import org.springframework.data.elasticsearch.annotations.FieldType;
|
||||||
|
|
||||||
|
@Document(indexName = "droolsaction", type = "droolsAction")
|
||||||
|
public class BusinessTransactionAction {
|
||||||
|
@Id
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Field(type = FieldType.Text)
|
||||||
|
private EventType eventType;
|
||||||
|
|
||||||
|
private long eventNumber;
|
||||||
|
|
||||||
|
private String businessTransactionId;
|
||||||
|
|
||||||
|
@Field(type = FieldType.Object, includeInParent = true)
|
||||||
|
private Fact inputData;
|
||||||
|
|
||||||
|
@Field(type = FieldType.Object, includeInParent = true)
|
||||||
|
private Fact outputData;
|
||||||
|
|
||||||
|
@Field(type = FieldType.Object, includeInParent = true)
|
||||||
|
private RuleExecution ruleExecution;
|
||||||
|
|
||||||
|
@Field(type = FieldType.Object, includeInParent = true)
|
||||||
|
private Fact fact;
|
||||||
|
|
||||||
|
|
||||||
|
private String processID;
|
||||||
|
|
||||||
|
private String ruleflowGroupName;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EventType getEventType() {
|
||||||
|
return eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventType(EventType eventType) {
|
||||||
|
this.eventType = eventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getEventNumber() {
|
||||||
|
return eventNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventNumber(long eventNumber) {
|
||||||
|
this.eventNumber = eventNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBusinessTransactionId() {
|
||||||
|
return businessTransactionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBusinessTransactionId(String businessTransactionId) {
|
||||||
|
this.businessTransactionId = businessTransactionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Fact getInputData() {
|
||||||
|
return inputData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInputData(Fact inputData) {
|
||||||
|
this.inputData = inputData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Fact getOutputData() {
|
||||||
|
return outputData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutputData(Fact outputData) {
|
||||||
|
this.outputData = outputData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RuleExecution getRuleExecution() {
|
||||||
|
return ruleExecution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRuleExecution(RuleExecution ruleExecution) {
|
||||||
|
this.ruleExecution = ruleExecution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessID() {
|
||||||
|
return processID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessID(String processID) {
|
||||||
|
this.processID = processID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRuleflowGroupName() {
|
||||||
|
return ruleflowGroupName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRuleflowGroupName(String ruleflowGroupName) {
|
||||||
|
this.ruleflowGroupName = ruleflowGroupName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Fact getFact() {
|
||||||
|
return fact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFact(Fact fact) {
|
||||||
|
this.fact = fact;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
final StringBuffer sb = new StringBuffer("BusinessTransactionAction{");
|
||||||
|
sb.append("id='").append(id).append('\'');
|
||||||
|
sb.append(", eventType=").append(eventType);
|
||||||
|
sb.append(", eventNumber=").append(eventNumber);
|
||||||
|
sb.append(", businessTransactionId='").append(businessTransactionId).append('\'');
|
||||||
|
sb.append(", inputData=").append(inputData);
|
||||||
|
sb.append(", outputData=").append(outputData);
|
||||||
|
sb.append(", ruleExecution=").append(ruleExecution);
|
||||||
|
sb.append(", fact=").append(fact);
|
||||||
|
sb.append(", processID='").append(processID).append('\'');
|
||||||
|
sb.append(", ruleflowGroupName='").append(ruleflowGroupName).append('\'');
|
||||||
|
sb.append('}');
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,25 +4,39 @@ package org.chtijbug.drools.indexer.persistence.model;
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.elasticsearch.annotations.Document;
|
import org.springframework.data.elasticsearch.annotations.Document;
|
||||||
|
|
||||||
@Document(indexName = "droolshistory", type = "loggingDrools")
|
@Document(indexName = "droolstransaction", type = "droolsTransaction")
|
||||||
public class BusinessTransactionPersistence {
|
public class BusinessTransactionPersistence {
|
||||||
|
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
|
||||||
private String transactionId;
|
private String transactionId;
|
||||||
|
|
||||||
private Integer year ;
|
private Integer year;
|
||||||
private Integer month ;
|
|
||||||
private Integer day ;
|
private Integer month;
|
||||||
private Integer hour ;
|
|
||||||
|
private Integer day;
|
||||||
|
|
||||||
|
private Integer hour;
|
||||||
|
|
||||||
private Integer minute;
|
private Integer minute;
|
||||||
private Integer second ;
|
|
||||||
private Integer millis ;
|
private Integer second;
|
||||||
// @Field( type = FieldType.Object)
|
|
||||||
private Object content;
|
private Integer millis;
|
||||||
|
|
||||||
|
private String groupID;
|
||||||
|
|
||||||
|
private String artefactID;
|
||||||
|
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
private String containerId;
|
||||||
|
|
||||||
|
private String serverName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
|
|
@ -96,11 +110,45 @@ public class BusinessTransactionPersistence {
|
||||||
this.millis = millis;
|
this.millis = millis;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getContent() {
|
public String getGroupID() {
|
||||||
return content;
|
return groupID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setContent(Object content) {
|
public void setGroupID(String groupID) {
|
||||||
this.content = content;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
package org.chtijbug.drools.indexer.persistence.model;
|
||||||
|
|
||||||
|
public enum EventType {
|
||||||
|
INPUT,OUPUT,INSERTFACT, UPDATEFACTOLDVALUE, UPDATEFACTNEWVALUE,RETRACTFACT,RULE,STARTPROCESS,STOPPROCESS, STARTRULEFLOWGROUP,STOPTRULEFLOWGROUP
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
package org.chtijbug.drools.indexer.persistence.repository;
|
||||||
|
|
||||||
|
import org.chtijbug.drools.indexer.persistence.model.BusinessTransactionAction;
|
||||||
|
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||||
|
|
||||||
|
public interface BusinessTransactionActionRepository extends ElasticsearchRepository<BusinessTransactionAction,String> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -72,7 +72,6 @@ public class RuleService {
|
||||||
* remove facts from logging to avoid infinite loop when marshalling to json and size of logging
|
* remove facts from logging to avoid infinite loop when marshalling to json and size of logging
|
||||||
*/
|
*/
|
||||||
SessionExecution sessionExecution = chtijbutObjectResponse.getSessionLogging().getSessionExecution();
|
SessionExecution sessionExecution = chtijbutObjectResponse.getSessionLogging().getSessionExecution();
|
||||||
sessionExecution.getFacts().clear();
|
|
||||||
if (kieServerAddOnElement != null) {
|
if (kieServerAddOnElement != null) {
|
||||||
|
|
||||||
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
|
for (KieServerLoggingDefinition kieServerLoggingDefinition : kieServerAddOnElement.getKieServerLoggingDefinitions()) {
|
||||||
|
|
|
||||||
Loading…
Add table
editor.link_modal.header
Reference in a new issue