Initial COMMIT

This commit is contained in:
Nicolas Héron 2018-08-24 18:00:03 +02:00
commit 2fd8b2f53d
254 changed files with 26776 additions and 0 deletions

View file

@ -0,0 +1,99 @@
package org.chtijbug.drools;
import org.chtijbug.drools.logging.*;
import org.chtijbug.drools.logging.RuleExecution;
import java.util.ArrayList;
import java.util.List;
/**
* Created by nheron on 11/06/15.
*/
public class SessionContext {
private SessionExecution sessionExecution;
private ProcessExecution processExecution;
private List<RuleflowGroup> ruleflowGroups = new ArrayList<>();
private RuleExecution ruleExecution;
private FireAllRulesExecution fireAllRulesExecution;
private Fact fact;
public SessionExecution getSessionExecution() {
return sessionExecution;
}
public void setSessionExecution(SessionExecution sessionExecution) {
this.sessionExecution = sessionExecution;
}
public ProcessExecution getProcessExecution() {
return processExecution;
}
public void setProcessExecution(ProcessExecution processExecution) {
this.processExecution = processExecution;
}
public List<RuleflowGroup> getRuleflowGroups() {
return ruleflowGroups;
}
public void setRuleflowGroups(List<RuleflowGroup> ruleflowGroups) {
this.ruleflowGroups = ruleflowGroups;
}
public RuleflowGroup findRuleFlowGroup(String name) {
RuleflowGroup result = null;
for (RuleflowGroup r : ruleflowGroups) {
if (r.getRuleflowGroup() != null && r.getRuleflowGroup().equals(name)) {
result = r;
}
}
return result;
}
public RuleExecution getRuleExecution() {
return ruleExecution;
}
public void setRuleExecution(RuleExecution ruleExecution) {
this.ruleExecution = ruleExecution;
}
public Fact getFact() {
return fact;
}
public void setFact(Fact fact) {
this.fact = fact;
}
public FireAllRulesExecution getFireAllRulesExecution() {
return fireAllRulesExecution;
}
public void setFireAllRulesExecution(FireAllRulesExecution fireAllRulesExecution) {
this.fireAllRulesExecution = fireAllRulesExecution;
}
@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('}');
return sb.toString();
}
}

View file

@ -0,0 +1,175 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.Serializable;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
/**
* @author nheron
*/
public class DroolsFactObject implements Serializable {
private static Logger logger = LoggerFactory.getLogger(DroolsFactObject.class);
/**
*
*/
private static final long serialVersionUID = 8185674445343213645L;
private transient Object realObject;
protected int version;
private String fullClassName;
private int hashCode;
private List<DroolsFactObjectAttribute> listfactObjectAttributes = new ArrayList<DroolsFactObjectAttribute>();
private String realObject_JSON;
private static ObjectMapper mapper = new ObjectMapper();
private ClassLoader classLoader = null;
/**
*
*/
public DroolsFactObject() {
realObject = null;
}
public DroolsFactObject(Object realObject, int version) throws IOException {
this.realObject = realObject;
this.version = version;
Writer strWriter = new StringWriter();
mapper.writeValue(strWriter, realObject);
this.realObject_JSON = strWriter.toString();
if (realObject != null) {
this.classLoader = realObject.getClass().getClassLoader();
}
}
public void updateRealObjectFromJSON() throws ClassNotFoundException, IOException {
if (this.realObject_JSON != null) {
ClassLoader localClassLoader=null;
try {
localClassLoader = Thread.currentThread()
.getContextClassLoader();
}catch (ClassCastException e){
logger.info("DroolsFactObject.updateRealObjectFromJSON",e);
}
try {
Class targetClass=null;
if (this.classLoader != null) {
Thread.currentThread().setContextClassLoader(
this.classLoader);
targetClass=this.classLoader.loadClass(this.fullClassName);
}
if (targetClass==null){
targetClass=Class.forName(this.fullClassName);
}
Object result = null;
result = mapper.readValue(this.realObject_JSON,targetClass );
this.realObject = result;
} catch (ClassNotFoundException e) {
logger.error("getRealObjectFromJSON");
} catch (IOException e) {
e.printStackTrace();
} finally {
if (localClassLoader!= null) {
Thread.currentThread().setContextClassLoader(localClassLoader);
}
}
}
}
public Object getRealObjectFromJSON() {
try {
this.updateRealObjectFromJSON();
} catch (ClassNotFoundException e) {
logger.error("getRealObjectFromJSON");
} catch (IOException e) {
e.printStackTrace();
}
return realObject;
}
;
public String getRealObject_JSON() {
return realObject_JSON;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("DroolsFactObject");
sb.append("{fullClassName='").append(fullClassName).append('\'');
sb.append(", hashCode=").append(hashCode);
sb.append(", version=").append(version);
sb.append(", listfactObjectAttributes=").append(listfactObjectAttributes);
sb.append("attributes :\n");
for (DroolsFactObjectAttribute foa : this.getListfactObjectAttributes()) {
sb.append("- " + foa.getAttributeType() + " " + foa.getAttributeName() + "=" + foa.getAttributeValue() + "\n");
}
sb.append(", realObject=").append(realObject);
sb.append('}');
return sb.toString();
}
public int getObjectVersion() {
return version;
}
public int getNextObjectVersion() {
return version + 1;
}
public List<DroolsFactObjectAttribute> getListfactObjectAttributes() {
return listfactObjectAttributes;
}
public void setListfactObjectAttributes(List<DroolsFactObjectAttribute> listfactObjectAttributes) {
this.listfactObjectAttributes = listfactObjectAttributes;
}
public String getFullClassName() {
return fullClassName;
}
public void setFullClassName(String fullClassName) {
this.fullClassName = fullClassName;
}
public int getHashCode() {
return hashCode;
}
public void setHashCode(int hashCode) {
this.hashCode = hashCode;
}
public Object getRealObject() {
return realObject;
}
}

View file

@ -0,0 +1,65 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
/**
* @author nheron
*/
public class DroolsFactObjectAttribute implements Serializable {
private static final long serialVersionUID = 2251337648100424168L;
private String attributeName;
private String attributeValue;
private String attributeType;
/**
*
*/
public DroolsFactObjectAttribute() {
}
public DroolsFactObjectAttribute(String attributeName, String attributeValue, String attributeType) {
this.attributeName = attributeName;
this.attributeValue = attributeValue;
this.attributeType = attributeType;
}
public String getAttributeName() {
return attributeName;
}
public void setAttributeName(String attributeName) {
this.attributeName = attributeName;
}
public String getAttributeType() {
return attributeType;
}
public void setAttributeType(String attributeType) {
this.attributeType = attributeType;
}
public String getAttributeValue() {
return attributeValue;
}
public void setAttributeValue(String attributeValue) {
this.attributeValue = attributeValue;
}
}

View file

@ -0,0 +1,65 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
public class DroolsJbpmVariableObject implements Serializable {
private final transient Object variableValue;
private String variableId;
private String variableInstanceId;
public DroolsJbpmVariableObject() {
this.variableValue = null;
}
public DroolsJbpmVariableObject(String variableId, String variableInstanceId, Object variableValue) {
this.variableId = variableId;
this.variableInstanceId = variableInstanceId;
this.variableValue = variableValue;
}
public String getVariableInstanceId() {
return variableInstanceId;
}
public void setVariableInstanceId(String variableInstanceId) {
this.variableInstanceId = variableInstanceId;
}
public String getVariableId() {
return variableId;
}
public void setVariableId(String variableId) {
this.variableId = variableId;
}
public Object getVariableValue() {
return variableValue;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("DroolsJbpmVariableObject{");
sb.append("variableId='").append(variableId).append('\'');
sb.append(", variableValue=").append(variableValue);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,90 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
/**
* @author nheron
*/
public class DroolsNodeInstanceObject implements Serializable {
/**
*
*/
private static final long serialVersionUID = 9121172218519979577L;
protected String id;
protected DroolsNodeObject node;
/**
*
*/
public DroolsNodeInstanceObject() {
}
protected DroolsNodeInstanceObject(String id, DroolsNodeObject node) {
this.id = id;
this.node = node;
}
public static DroolsNodeInstanceObject createDroolsNodeInstanceObject(String nodeInstanceId, DroolsNodeObject nodeObject) {
return new DroolsNodeInstanceObject(nodeInstanceId, nodeObject);
}
public String getId() {
return id;
}
public DroolsNodeObject getNode() {
return node;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DroolsNodeInstanceObject other = (DroolsNodeInstanceObject) obj;
if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
return false;
}
if (this.node != other.node && (this.node == null || !this.node.equals(other.node))) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 5;
hash = 71 * hash + (this.id != null ? this.id.hashCode() : 0);
hash = 71 * hash + (this.node != null ? this.node.hashCode() : 0);
return hash;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("DroolsNodeInstanceObject");
sb.append("{id='").append(id).append('\'');
sb.append(", node=").append(node.toString());
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,108 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
/**
* @author nheron
*/
public class DroolsNodeObject implements Serializable {
/**
*
*/
private static final long serialVersionUID = 2149698078767524188L;
protected String id;
private DroolsNodeType nodeType = DroolsNodeType.Other;
private String ruleflowGroupName;
/**
*
*/
public DroolsNodeObject() {
}
public DroolsNodeObject(String id, DroolsNodeType nodeType) {
this.id = id;
this.nodeType = nodeType;
}
protected DroolsNodeObject(String id) {
this.id = id;
this.nodeType = DroolsNodeType.Other;
}
public static DroolsNodeObject createDroolsNodeObject(String id, DroolsNodeType nodeType) {
return new DroolsNodeObject(id, nodeType);
}
public String getId() {
return id;
}
public DroolsNodeType getNodeType() {
return nodeType;
}
public void setNodeType(DroolsNodeType nodeType) {
this.nodeType = nodeType;
}
public String getRuleflowGroupName() {
return ruleflowGroupName;
}
public void setRuleflowGroupName(String ruleflowGroupName) {
if (ruleflowGroupName != null && ruleflowGroupName.length() > 0) {
this.nodeType = DroolsNodeType.RuleNode;
}
this.ruleflowGroupName = ruleflowGroupName;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DroolsNodeObject other = (DroolsNodeObject) obj;
if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 53 * hash + (this.id != null ? this.id.hashCode() : 0);
return hash;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("DroolsNodeObject");
sb.append("{id='").append(id).append('\'');
sb.append("nodeType='").append(nodeType).append('\'');
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,26 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity;
/**
* Created by IntelliJ IDEA.
* Date: 28/03/14
* Time: 14:29
* To change this template use File | Settings | File Templates.
*/
public enum DroolsNodeType {
RuleNode, StartNode, SplitNode, JoinNode, EndNode, Other
}

View file

@ -0,0 +1,145 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* @author nheron
*/
public class DroolsProcessInstanceObject implements Serializable {
private static final long serialVersionUID = 5436434746711988139L;
protected String id;
protected DroolsProcessObject process;
protected Map<String, DroolsNodeInstanceObject> nodeInstances;
private String name;
private String packageName;
private String type;
private String version;
/**
*
*/
public DroolsProcessInstanceObject() {
}
protected DroolsProcessInstanceObject(String id, DroolsProcessObject process) {
this.id = id;
this.name = process.getName();
this.packageName = process.getPackageName();
this.type = process.getType();
this.version = process.getVersion();
this.process = process;
nodeInstances = new HashMap<String, DroolsNodeInstanceObject>();
}
public static DroolsProcessInstanceObject createDroolsProcessInstanceObject(String processInstanceID, DroolsProcessObject process) {
return new DroolsProcessInstanceObject(processInstanceID, process);
}
public String getId() {
return id;
}
public DroolsProcessObject getProcess() {
return process;
}
public void addDroolsNodeInstanceObject(DroolsNodeInstanceObject droolsNodeInstanceObject) {
nodeInstances.put(droolsNodeInstanceObject.getId(), droolsNodeInstanceObject);
}
public DroolsNodeInstanceObject getDroolsNodeInstanceObjet(String id) {
return nodeInstances.get(id);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DroolsProcessInstanceObject other = (DroolsProcessInstanceObject) obj;
if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
return false;
}
if (this.process != other.process && (this.process == null || !this.process.equals(other.process))) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 7;
hash = 17 * hash + (this.id != null ? this.id.hashCode() : 0);
hash = 17 * hash + (this.process != null ? this.process.hashCode() : 0);
return hash;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("DroolsProcessInstanceObject");
sb.append("{id='").append(id).append('\'');
sb.append(", name='").append(name).append('\'');
sb.append(", packageName='").append(packageName).append('\'');
sb.append(", type='").append(type).append('\'');
sb.append(", version='").append(version).append('\'');
sb.append(", process=").append(process);
sb.append(", nodeInstances=").append(nodeInstances);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,116 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
/**
* @author nheron
*/
public class DroolsProcessObject implements Serializable {
private static final long serialVersionUID = 4718079763911002405L;
protected String id;
protected String name;
protected String packageName;
protected String type;
protected String version;
protected Map<String, DroolsNodeObject> nodeLists;
public DroolsProcessObject() {
}
public DroolsProcessObject(String id, String name, String packageName, String type, String version) {
this.id = id;
this.name = name;
this.packageName = packageName;
this.type = type;
this.version = version;
this.nodeLists = new HashMap<String, DroolsNodeObject>();
}
public static DroolsProcessObject createDroolsProcessObject(String id, String processInstanceID, String packageName, String type, String version) {
return new DroolsProcessObject(id, processInstanceID, packageName, type, version);
}
public void addDroolsNodeObject(DroolsNodeObject droolsNodeObject) {
nodeLists.put(droolsNodeObject.getId(), droolsNodeObject);
}
public DroolsNodeObject getDroolsNodeObjet(String id) {
return nodeLists.get(id);
}
public String getId() {
return id;
}
public String getName() {
return name;
}
public String getPackageName() {
return packageName;
}
public String getType() {
return type;
}
public String getVersion() {
return version;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DroolsProcessObject other = (DroolsProcessObject) obj;
if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
return false;
}
return true;
}
@Override
public int hashCode() {
int hash = 3;
hash = 41 * hash + (this.name != null ? this.name.hashCode() : 0);
hash = 41 * hash + (this.packageName != null ? this.packageName.hashCode() : 0);
return hash;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("DroolsProcessObject");
sb.append("{id='").append(id).append('\'');
sb.append(", name='").append(name).append('\'');
sb.append(", packageName='").append(packageName).append('\'');
sb.append(", type='").append(type).append('\'');
sb.append(", version='").append(version).append('\'');
sb.append(", nodeLists=").append(nodeLists);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,55 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
/**
* Created by IntelliJ IDEA.
* Date: 23/11/12
* Time: 15:13
* To change this template use File | Settings | File Templates.
*/
public class DroolsRuleFlowGroupObject implements Serializable {
private int ruleFlowInstanceID;
private String name;
public DroolsRuleFlowGroupObject() {
}
public DroolsRuleFlowGroupObject(int ruleFlowInstanceID, String name) {
this.ruleFlowInstanceID = ruleFlowInstanceID;
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("DroolsRuleFlowGroupObject");
sb.append("{ruleFlowInstanceID=").append(ruleFlowInstanceID);
sb.append(", name='").append(name).append('\'');
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,84 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity;
import java.io.Serializable;
/**
* @author Bertrand Gressier
*/
public class DroolsRuleObject implements Serializable {
/**
*
*/
private static final long serialVersionUID = -716077698281963299L;
protected String ruleName;
protected String rulePackageName;
protected String ruleFlowGroup;
/**
*
*/
public DroolsRuleObject() {
}
/**
* @param ruleName - the rule name added to the knowledge base
* @param rulePackageName - the package of the rule
*/
protected DroolsRuleObject(String ruleName, String rulePackageName) {
this.ruleName = ruleName;
this.rulePackageName = rulePackageName;
}
public static DroolsRuleObject createDroolRuleObject(String ruleName, String rulePackageName) {
return new DroolsRuleObject(ruleName, rulePackageName);
}
/**
* @return the ruleName
*/
public String getRuleName() {
return ruleName;
}
/**
* @return the rulePackageName
*/
public String getRulePackageName() {
return rulePackageName;
}
public String getRuleFlowGroup() {
return ruleFlowGroup;
}
public void setRuleFlowGroup(String ruleFlowGroup) {
this.ruleFlowGroup = ruleFlowGroup;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Rule object with name :" + getRuleName();
}
}

View file

@ -0,0 +1,23 @@
package org.chtijbug.drools.entity.history;
import java.util.concurrent.atomic.AtomicLong;
public final class EventCounter {
private AtomicLong nextEventId = new AtomicLong(1L);
private EventCounter() {
}
public static EventCounter newCounter() {
return new EventCounter();
}
public Long next() {
return nextEventId.getAndIncrement();
}
public Long current() {
return nextEventId.get();
}
}

View file

@ -0,0 +1,75 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import org.chtijbug.drools.runtime.listener.HistoryListener;
import java.io.Serializable;
import java.util.LinkedList;
import java.util.List;
/**
* @author nheron
*/
public class HistoryContainer implements Serializable {
private static final long serialVersionUID = 5645452451089006572L;
protected List<HistoryEvent> listHistoryEvent = new LinkedList<HistoryEvent>();
private Long sessionID;
private HistoryListener historylistener = null;
public HistoryContainer() {
}
/**
*
*/
public HistoryContainer(Long sessionID, HistoryListener historylistener) {
this.sessionID = sessionID;
this.historylistener = historylistener;
}
public Long getSessionID() {
return sessionID;
}
public void setSessionID(Long sessionID) {
this.sessionID = sessionID;
}
public List<HistoryEvent> getListHistoryEvent() {
return listHistoryEvent;
}
public void addHistoryElement(Long ruleBaseID, Long sessionID, HistoryEvent newHistoryElement) {
DroolsChtijbugException error = null;
newHistoryElement.setRuleBaseID(ruleBaseID);
newHistoryElement.setSessionId(sessionID);
try {
if (historylistener != null) {
historylistener.fireEvent(newHistoryElement);
}
} catch (DroolsChtijbugException e) {
error = e;
} finally {
if (error != null) {
newHistoryElement.setDroolsChtijbugException(error);
}
this.listHistoryEvent.add(newHistoryElement);
}
}
}

View file

@ -0,0 +1,105 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
/**
* @author nheron
*/
public class HistoryEvent implements Serializable {
/**
*
*/
private static final long serialVersionUID = -6640538290066213804L;
protected Date dateEvent;
protected TypeEvent typeEvent;
private Long eventID;
private Long ruleBaseID;
private Long sessionId;
private DroolsChtijbugException droolsChtijbugException;
private ArrayList<KnowledgeResource> knowledgeResources = new ArrayList<>();
/**
* Mandatory for GWT Serialization
*/
public HistoryEvent() {
}
public HistoryEvent(Long eventID, Date dateEvent, TypeEvent typeEvent) {
this.eventID = eventID;
this.dateEvent = dateEvent;
this.typeEvent = typeEvent;
}
public ArrayList<KnowledgeResource> getKnowledgeResources() {
return knowledgeResources;
}
public void setKnowledgeResources(ArrayList<KnowledgeResource> knowledgeResources) {
this.knowledgeResources = knowledgeResources;
}
public DroolsChtijbugException getDroolsChtijbugException() {
return droolsChtijbugException;
}
public void setDroolsChtijbugException(DroolsChtijbugException droolsChtijbugException) {
this.droolsChtijbugException = droolsChtijbugException;
}
public Date getDateEvent() {
return dateEvent;
}
public TypeEvent getTypeEvent() {
return typeEvent;
}
public Long getEventID() {
return eventID;
}
public void setEventID(Long eventID) {
this.eventID = eventID;
}
public Long getRuleBaseID() {
return ruleBaseID;
}
public void setRuleBaseID(Long ruleBaseID) {
this.ruleBaseID = ruleBaseID;
}
public Long getSessionId() {
return sessionId;
}
public void setSessionId(Long sessionId) {
this.sessionId = sessionId;
}
public enum TypeEvent {
Fact, Rule, BPMN, RuleFlowGroup, KnowledgeBaseSingleton, Session
}
}

View file

@ -0,0 +1,27 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history;
import java.io.Serializable;
/**
* Created by IntelliJ IDEA.
* Date: 25/04/14
* Time: 11:14
* To change this template use File | Settings | File Templates.
*/
public interface KnowledgeResource extends Serializable {
}

View file

@ -0,0 +1,65 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.fact;
import org.chtijbug.drools.entity.DroolsFactObject;
import org.chtijbug.drools.entity.DroolsFactObjectAttribute;
import java.util.Date;
/**
* @author nheron
*/
public class DeletedFactHistoryEvent extends FactHistoryEvent {
/**
*
*/
private static final long serialVersionUID = -1924924006386653359L;
protected DroolsFactObject deletedObject;
/**
*
*/
public DeletedFactHistoryEvent() {
}
public DeletedFactHistoryEvent(Long eventID, DroolsFactObject deletedObject, Long ruleBaseId, Long sessionId) {
super(eventID, new Date(), ruleBaseId, sessionId);
this.deletedObject = deletedObject;
}
public DroolsFactObject getDeletedObject() {
return deletedObject;
}
public void setDeletedObject(DroolsFactObject deletedObject) {
this.deletedObject = deletedObject;
}
@Override
public String toString() {
StringBuilder str = new StringBuilder();
str.append(super.toString() + "\n");
str.append("retracted Object : " + deletedObject.getFullClassName() + "\n");
str.append("version Object : " + deletedObject.getObjectVersion() + "\n");
str.append("attributes :\n");
for (DroolsFactObjectAttribute foa : deletedObject.getListfactObjectAttributes()) {
str.append("- " + foa.getAttributeType() + " " + foa.getAttributeName() + "=" + foa.getAttributeValue() + "\n");
}
return str.toString();
}
}

View file

@ -0,0 +1,83 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.fact;
import org.chtijbug.drools.entity.history.HistoryEvent;
import java.util.Date;
/**
* @author nheron
*/
public abstract class FactHistoryEvent extends HistoryEvent {
/**
*
*/
private static final long serialVersionUID = 5320437389177977457L;
private String ruleName = null;
private String rulePackageName = null;
private String ruleflowGroup = null;
/**
* Mandatory for GWT Serialization
*/
public FactHistoryEvent() {
}
public FactHistoryEvent(Long eventID, Date dateEvent, Long ruleBaseId, Long sessionId) {
super(eventID, dateEvent, TypeEvent.Fact);
this.setRuleBaseID(ruleBaseId);
this.setSessionId(sessionId);
}
public String getRuleName() {
return ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
public String getRulePackageName() {
return rulePackageName;
}
public void setRulePackageName(String rulePackageName) {
this.rulePackageName = rulePackageName;
}
public String getRuleflowGroup() {
return ruleflowGroup;
}
public void setRuleflowGroup(String ruleflowGroup) {
this.ruleflowGroup = ruleflowGroup;
}
/*
* (non-Javadoc)
*
* @see org.chtijbug.drools.entity.history.HistoryEvent#toString()
*/
@Override
public String toString() {
return super.toString();
}
}

View file

@ -0,0 +1,48 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.fact;
import java.util.Date;
/**
* @author nheron
*/
public class InsertedByReflectionFactEndHistoryEvent extends FactHistoryEvent {
public InsertedByReflectionFactEndHistoryEvent() {
}
public InsertedByReflectionFactEndHistoryEvent(Long eventID, Long ruleBaseId, Long sessionId) {
super(eventID, new Date(), ruleBaseId, sessionId);
}
/*
* (non-Javadoc)
*
* @see org.chtijbug.drools.entity.history.HistoryEvent#toString()
*/
@Override
public String toString() {
StringBuilder str = new StringBuilder();
str.append(super.toString() + "\n");
str.append("End InsertBuReflectionEndHistoryEvent\n");
return str.toString();
}
}

View file

@ -0,0 +1,69 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.fact;
import org.chtijbug.drools.entity.DroolsFactObject;
import org.chtijbug.drools.entity.DroolsFactObjectAttribute;
import java.util.Date;
/**
* @author nheron
*/
public class InsertedByReflectionFactStartHistoryEvent extends FactHistoryEvent {
protected DroolsFactObject topObject;
public InsertedByReflectionFactStartHistoryEvent() {
}
public InsertedByReflectionFactStartHistoryEvent(Long eventID, DroolsFactObject topObject, Long ruleBaseId, Long sessionId) {
super(eventID, new Date(), ruleBaseId, sessionId);
this.topObject = topObject;
}
public DroolsFactObject getTopObject() {
return topObject;
}
public void setTopObject(DroolsFactObject topObject) {
this.topObject = topObject;
}
/*
* (non-Javadoc)
*
* @see org.chtijbug.drools.entity.history.HistoryEvent#toString()
*/
@Override
public String toString() {
StringBuilder str = new StringBuilder();
str.append(super.toString() + "\n");
if (topObject != null) {
str.append("inserted Top Object : " + topObject.getFullClassName() + "\n");
str.append("version Object : " + topObject.getObjectVersion() + "\n");
str.append("attributes :\n");
for (DroolsFactObjectAttribute foa : topObject.getListfactObjectAttributes()) {
str.append("- " + foa.getAttributeType() + " " + foa.getAttributeName() + "=" + foa.getAttributeValue() + "\n");
}
}
return str.toString();
}
}

View file

@ -0,0 +1,69 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.fact;
import org.chtijbug.drools.entity.DroolsFactObject;
import org.chtijbug.drools.entity.DroolsFactObjectAttribute;
import java.util.Date;
/**
* @author nheron
*/
public class InsertedFactHistoryEvent extends FactHistoryEvent {
/**
*
*/
private static final long serialVersionUID = -4530420814276942059L;
protected DroolsFactObject insertedObject;
public InsertedFactHistoryEvent() {
}
public InsertedFactHistoryEvent(Long eventID, DroolsFactObject insertedObject, Long ruleBaseId, Long sessionId) {
super(eventID, new Date(), ruleBaseId, sessionId);
this.insertedObject = insertedObject;
}
public DroolsFactObject getInsertedObject() {
return insertedObject;
}
public void setInsertedObject(DroolsFactObject insertedObject) {
this.insertedObject = insertedObject;
}
/*
* (non-Javadoc)
*
* @see org.chtijbug.drools.entity.history.HistoryEvent#toString()
*/
@Override
public String toString() {
StringBuilder str = new StringBuilder();
str.append(super.toString() + "\n");
str.append("inserted Object : " + insertedObject.getFullClassName() + "\n");
str.append("version Object : " + insertedObject.getObjectVersion() + "\n");
str.append("attributes :\n");
for (DroolsFactObjectAttribute foa : insertedObject.getListfactObjectAttributes()) {
str.append("- " + foa.getAttributeType() + " " + foa.getAttributeName() + "=" + foa.getAttributeValue() + "\n");
}
return str.toString();
}
}

View file

@ -0,0 +1,84 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.fact;
import org.chtijbug.drools.entity.DroolsFactObject;
import org.chtijbug.drools.entity.DroolsFactObjectAttribute;
import java.util.Date;
/**
* @author nheron
*/
public class UpdatedFactHistoryEvent extends FactHistoryEvent {
/**
*
*/
private static final long serialVersionUID = 2427277089998136875L;
protected DroolsFactObject objectOldValue;
protected DroolsFactObject objectNewValue;
/**
*
*/
public UpdatedFactHistoryEvent() {
}
public UpdatedFactHistoryEvent(Long eventID, DroolsFactObject objectOldValue, DroolsFactObject objectNewValue, Long ruleBaseId, Long sessionId) {
super(eventID, new Date(), ruleBaseId, sessionId);
this.objectOldValue = objectOldValue;
this.objectNewValue = objectNewValue;
}
public DroolsFactObject getObjectNewValue() {
return objectNewValue;
}
public void setObjectNewValue(DroolsFactObject objectNewValue) {
this.objectNewValue = objectNewValue;
}
public DroolsFactObject getObjectOldValue() {
return objectOldValue;
}
public void setObjectOldValue(DroolsFactObject objectOldValue) {
this.objectOldValue = objectOldValue;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append(super.toString() + "\n");
sb.append("UpdatedFactHistoryEvent");
sb.append("Update Object : " + objectNewValue.getFullClassName() + "\n");
sb.append("{objectOldValue=").append("\n");
sb.append("version Object : " + objectOldValue.getObjectVersion() + "\n");
sb.append("attributes :\n");
for (DroolsFactObjectAttribute foa : objectOldValue.getListfactObjectAttributes()) {
sb.append("- " + foa.getAttributeType() + " " + foa.getAttributeName() + "=" + foa.getAttributeValue() + "\n");
}
sb.append(", objectNewValue=").append(objectNewValue);
sb.append("version Object : " + objectNewValue.getObjectVersion() + "\n");
sb.append("attributes :\n");
for (DroolsFactObjectAttribute foa : objectNewValue.getListfactObjectAttributes()) {
sb.append("- " + foa.getAttributeType() + " " + foa.getAttributeName() + "=" + foa.getAttributeValue() + "\n");
}
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,37 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.knowledge;
import org.chtijbug.drools.entity.history.KnowledgeResource;
import java.util.Date;
public class KnowledgeBaseAddResourceEvent extends KnowledgeBaseEvent {
public KnowledgeBaseAddResourceEvent(Long eventID, Date dateEvent, Long ruleBaseID) {
super(eventID, dateEvent, ruleBaseID);
}
public KnowledgeBaseAddResourceEvent(Long eventID, Date dateEvent, Long ruleBaseID, KnowledgeResource knowledgeResource) {
super(eventID, dateEvent, ruleBaseID);
this.getKnowledgeResources().add(knowledgeResource);
}
public KnowledgeBaseAddResourceEvent() {
}
}

View file

@ -0,0 +1,33 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.knowledge;
import java.util.Date;
/**
* Created by IntelliJ IDEA.
* Date: 05/06/13
* Time: 12:08
* To change this template use File | Settings | File Templates.
*/
public class KnowledgeBaseCreateSessionEvent extends KnowledgeBaseEvent {
public KnowledgeBaseCreateSessionEvent(Long eventID, Date dateEvent, Long ruleBaseID) {
super(eventID, dateEvent, ruleBaseID);
}
public KnowledgeBaseCreateSessionEvent() {
}
}

View file

@ -0,0 +1,33 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.knowledge;
import java.util.Date;
/**
* Created by IntelliJ IDEA.
* Date: 05/06/13
* Time: 12:06
* To change this template use File | Settings | File Templates.
*/
public class KnowledgeBaseCreatedEvent extends KnowledgeBaseEvent {
public KnowledgeBaseCreatedEvent(Long eventID, Date dateEvent, Long ruleBaseID) {
super(eventID, dateEvent, ruleBaseID);
}
public KnowledgeBaseCreatedEvent() {
}
}

View file

@ -0,0 +1,37 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.knowledge;
import org.chtijbug.drools.entity.history.KnowledgeResource;
import java.util.Date;
public class KnowledgeBaseDelResourceEvent extends KnowledgeBaseEvent {
public KnowledgeBaseDelResourceEvent(Long eventID, Date dateEvent, Long ruleBaseID) {
super(eventID, dateEvent, ruleBaseID);
}
public KnowledgeBaseDelResourceEvent(Long eventID, Date dateEvent, Long ruleBaseID, KnowledgeResource knowledgeResource) {
super(eventID, dateEvent, ruleBaseID);
this.getKnowledgeResources().add(knowledgeResource);
}
public KnowledgeBaseDelResourceEvent() {
}
}

View file

@ -0,0 +1,37 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.knowledge;
import java.io.Serializable;
import java.util.Date;
/**
* Created by IntelliJ IDEA.
* Date: 25/02/14
* Time: 16:17
* To change this template use File | Settings | File Templates.
*/
public class KnowledgeBaseDisposeEvent extends KnowledgeBaseEvent implements Serializable {
public KnowledgeBaseDisposeEvent() {
}
public KnowledgeBaseDisposeEvent(Long eventID, Date dateEvent, Long ruleBaseID) {
super(eventID, dateEvent, ruleBaseID);
}
}

View file

@ -0,0 +1,48 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.knowledge;
import org.chtijbug.drools.entity.history.HistoryEvent;
import java.util.Date;
/**
* Created by IntelliJ IDEA.
* Date: 05/06/13
* Time: 11:04
* To change this template use File | Settings | File Templates.
*/
public class KnowledgeBaseEvent extends HistoryEvent {
public KnowledgeBaseEvent(Long eventID, Date dateEvent, Long ruleBaseID) {
super(eventID, dateEvent, TypeEvent.KnowledgeBaseSingleton);
this.setRuleBaseID(ruleBaseID);
}
public KnowledgeBaseEvent() {
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("KnowledgeBaseEvent");
sb.append("{ruleBaseID=").append(this.getRuleBaseID());
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,42 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.knowledge;
import org.chtijbug.drools.entity.history.KnowledgeResource;
import java.util.Date;
/**
* Created by IntelliJ IDEA.
* Date: 05/06/13
* Time: 12:09
* To change this template use File | Settings | File Templates.
*/
public class KnowledgeBaseInitialLoadEvent extends KnowledgeBaseEvent {
public KnowledgeBaseInitialLoadEvent(Long eventID, Date dateEvent, Long ruleBaseID) {
super(eventID, dateEvent, ruleBaseID);
}
public KnowledgeBaseInitialLoadEvent(Long eventID, Date dateEvent, Long ruleBaseID, KnowledgeResource knowledgeResource) {
super(eventID, dateEvent, ruleBaseID);
this.getKnowledgeResources().add(knowledgeResource);
}
public KnowledgeBaseInitialLoadEvent() {
super();
}
}

View file

@ -0,0 +1,41 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.knowledge;
import org.chtijbug.drools.entity.history.KnowledgeResource;
import java.util.Date;
/**
* Created by IntelliJ IDEA.
* Date: 05/06/13
* Time: 12:06
* To change this template use File | Settings | File Templates.
*/
public class KnowledgeBaseReloadedEvent extends KnowledgeBaseEvent {
public KnowledgeBaseReloadedEvent(Long eventID, Date dateEvent, Long ruleBaseID) {
super(eventID, dateEvent, ruleBaseID);
}
public KnowledgeBaseReloadedEvent(Long eventID, Date dateEvent, Long ruleBaseID, KnowledgeResource knowledgeResource) {
super(eventID, dateEvent, ruleBaseID);
this.getKnowledgeResources().add(knowledgeResource);
}
public KnowledgeBaseReloadedEvent() {
}
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.process;
import org.chtijbug.drools.entity.DroolsNodeInstanceObject;
/**
* @author nheron
*/
public class AfterNodeInstanceTriggeredHistoryEvent extends ProcessHistoryEvent {
/**
*
*/
private static final long serialVersionUID = 7909713944850159592L;
protected DroolsNodeInstanceObject nodeInstance;
/**
*
*/
public AfterNodeInstanceTriggeredHistoryEvent() {
}
public AfterNodeInstanceTriggeredHistoryEvent(Long eventID, DroolsNodeInstanceObject nodeInstance, Long ruleBaseId, Long sessionId) {
super(eventID, ruleBaseId, sessionId);
this.nodeInstance = nodeInstance;
}
public DroolsNodeInstanceObject getNodeInstance() {
return nodeInstance;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append(super.toString() + "\n");
sb.append("NodeInstanceBeforeHistoryEvent");
sb.append("{nodeInstance=").append(nodeInstance);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.process;
import org.chtijbug.drools.entity.DroolsNodeInstanceObject;
/**
* @author nheron
*/
public class AfterNodeLeftHistoryEvent extends ProcessHistoryEvent {
private static final long serialVersionUID = 1117121703139545755L;
protected DroolsNodeInstanceObject nodeInstance;
/**
*
*/
public AfterNodeLeftHistoryEvent() {
}
public AfterNodeLeftHistoryEvent(Long eventID, DroolsNodeInstanceObject nodeInstance, Long ruleBaseId, Long sessionId) {
super(eventID, ruleBaseId, sessionId);
this.nodeInstance = nodeInstance;
}
public DroolsNodeInstanceObject getNodeInstance() {
return nodeInstance;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append(super.toString() + "\n");
sb.append("NodeInstanceAfterHistoryEvent");
sb.append("{nodeInstance=").append(nodeInstance);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,50 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.process;
import org.chtijbug.drools.entity.DroolsProcessInstanceObject;
/**
* @author nheron
*/
public class AfterProcessEndHistoryEvent extends ProcessHistoryEvent {
private static final long serialVersionUID = 6327973844897501016L;
/**
*
*/
public AfterProcessEndHistoryEvent() {
}
public AfterProcessEndHistoryEvent(Long eventID, DroolsProcessInstanceObject processInstance, Long ruleBaseId, Long sessionId) {
super(eventID, ruleBaseId, sessionId);
this.processInstance = processInstance;
}
public DroolsProcessInstanceObject getProcessInstance() {
return processInstance;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("ProcessEndHistoryEvent");
sb.append("{processInstance=").append(processInstance.toString());
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,48 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.process;
import org.chtijbug.drools.entity.DroolsProcessInstanceObject;
/**
* @author nheron
*/
public class AfterProcessStartHistoryEvent extends ProcessHistoryEvent {
/**
*
*/
public AfterProcessStartHistoryEvent() {
}
public AfterProcessStartHistoryEvent(Long eventID, DroolsProcessInstanceObject processInstance, Long ruleBaseId, Long sessionId) {
super(eventID, ruleBaseId, sessionId);
this.processInstance = processInstance;
}
public DroolsProcessInstanceObject getProcessInstance() {
return processInstance;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("AfterProcessStartHistoryEvent{");
sb.append("processInstance=").append(processInstance);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,76 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.process;
import org.chtijbug.drools.entity.DroolsJbpmVariableObject;
import org.chtijbug.drools.entity.DroolsProcessObject;
/**
* Created by IntelliJ IDEA.
* Date: 18/02/14
* Time: 15:17
* To change this template use File | Settings | File Templates.
*/
public class AfterVariableChangeChangedHistoryEvent extends ProcessHistoryEvent {
private DroolsJbpmVariableObject oldValue;
private DroolsJbpmVariableObject newValue;
private DroolsProcessObject droolsProcessObject;
public AfterVariableChangeChangedHistoryEvent() {
}
public AfterVariableChangeChangedHistoryEvent(Long eventID, DroolsProcessObject droolsProcessObject, Long ruleBaseId, Long sessionId, DroolsJbpmVariableObject oldValue, DroolsJbpmVariableObject newValue) {
super(eventID, ruleBaseId, sessionId);
this.oldValue = oldValue;
this.newValue = newValue;
this.droolsProcessObject = droolsProcessObject;
}
public DroolsJbpmVariableObject getOldValue() {
return oldValue;
}
public void setOldValue(DroolsJbpmVariableObject oldValue) {
this.oldValue = oldValue;
}
public DroolsJbpmVariableObject getNewValue() {
return newValue;
}
public void setNewValue(DroolsJbpmVariableObject newValue) {
this.newValue = newValue;
}
public DroolsProcessObject getDroolsProcessObject() {
return droolsProcessObject;
}
public void setDroolsProcessObject(DroolsProcessObject droolsProcessObject) {
this.droolsProcessObject = droolsProcessObject;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("AfterVariableChangeChangedHistoryEvent{");
sb.append("oldValue=").append(oldValue);
sb.append(", newValue=").append(newValue);
sb.append(", droolsProcessObject=").append(droolsProcessObject);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,54 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.process;
import org.chtijbug.drools.entity.DroolsNodeInstanceObject;
/**
* @author nheron
*/
public class BeforeNodeInstanceTriggeredHistoryEvent extends ProcessHistoryEvent {
/**
*
*/
private static final long serialVersionUID = 7909713944850159592L;
protected DroolsNodeInstanceObject nodeInstance;
/**
*
*/
public BeforeNodeInstanceTriggeredHistoryEvent() {
}
public BeforeNodeInstanceTriggeredHistoryEvent(Long eventID, DroolsNodeInstanceObject nodeInstance, Long ruleBaseId, Long sessionId) {
super(eventID, ruleBaseId, sessionId);
this.nodeInstance = nodeInstance;
}
public DroolsNodeInstanceObject getNodeInstance() {
return nodeInstance;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append(super.toString() + "\n");
sb.append("NodeInstanceBeforeHistoryEvent");
sb.append("{nodeInstance=").append(nodeInstance);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.process;
import org.chtijbug.drools.entity.DroolsNodeInstanceObject;
/**
* @author nheron
*/
public class BeforeNodeLeftHistoryEvent extends ProcessHistoryEvent {
private static final long serialVersionUID = 1117121703139545755L;
protected DroolsNodeInstanceObject nodeInstance;
/**
*
*/
public BeforeNodeLeftHistoryEvent() {
}
public BeforeNodeLeftHistoryEvent(Long eventID, DroolsNodeInstanceObject nodeInstance, Long ruleBaseId, Long sessionId) {
super(eventID, ruleBaseId, sessionId);
this.nodeInstance = nodeInstance;
}
public DroolsNodeInstanceObject getNodeInstance() {
return nodeInstance;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append(super.toString() + "\n");
sb.append("NodeInstanceAfterHistoryEvent");
sb.append("{nodeInstance=").append(nodeInstance);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,49 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.process;
import org.chtijbug.drools.entity.DroolsProcessInstanceObject;
/**
* @author nheron
*/
public class BeforeProcessEndHistoryEvent extends ProcessHistoryEvent {
/**
*
*/
public BeforeProcessEndHistoryEvent() {
}
public BeforeProcessEndHistoryEvent(Long eventID, DroolsProcessInstanceObject processInstance, Long ruleBaseId, Long sessionId) {
super(eventID, ruleBaseId, sessionId);
this.processInstance = processInstance;
}
public DroolsProcessInstanceObject getProcessInstance() {
return processInstance;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("BeforeProcessEndHistoryEvent");
sb.append("{processInstance=").append(processInstance.toString());
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.process;
import org.chtijbug.drools.entity.DroolsProcessInstanceObject;
/**
* @author nheron
*/
public class BeforeProcessStartHistoryEvent extends ProcessHistoryEvent {
/**
*
*/
public BeforeProcessStartHistoryEvent() {
}
public BeforeProcessStartHistoryEvent(Long eventID, DroolsProcessInstanceObject processInstance, Long ruleBaseId, Long sessionId) {
super(eventID, ruleBaseId, sessionId);
this.processInstance = processInstance;
}
public DroolsProcessInstanceObject getProcessInstance() {
return processInstance;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("BeforeProcessStartHistoryEvent{");
sb.append("processInstance=").append(processInstance);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,66 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.process;
import org.chtijbug.drools.entity.DroolsJbpmVariableObject;
import org.chtijbug.drools.entity.DroolsProcessObject;
/**
* Created by IntelliJ IDEA.
* Date: 18/02/14
* Time: 15:17
* To change this template use File | Settings | File Templates.
*/
public class BeforeVariableChangeChangedHistoryEvent extends ProcessHistoryEvent {
private DroolsJbpmVariableObject oldValue;
private DroolsProcessObject droolsProcessObject;
public BeforeVariableChangeChangedHistoryEvent() {
}
public BeforeVariableChangeChangedHistoryEvent(Long eventID, DroolsProcessObject droolsProcessObject, Long ruleBaseId, Long sessionId, DroolsJbpmVariableObject oldValue) {
super(eventID, ruleBaseId, sessionId);
this.oldValue = oldValue;
this.droolsProcessObject = droolsProcessObject;
}
public DroolsJbpmVariableObject getOldValue() {
return oldValue;
}
public void setOldValue(DroolsJbpmVariableObject oldValue) {
this.oldValue = oldValue;
}
public DroolsProcessObject getDroolsProcessObject() {
return droolsProcessObject;
}
public void setDroolsProcessObject(DroolsProcessObject droolsProcessObject) {
this.droolsProcessObject = droolsProcessObject;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("BeforeVariableChangeChangedHistoryEvent{");
sb.append("oldValue=").append(oldValue);
sb.append(", droolsProcessObject=").append(droolsProcessObject);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,53 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.process;
import org.chtijbug.drools.entity.DroolsProcessInstanceObject;
import org.chtijbug.drools.entity.history.HistoryEvent;
import java.util.Date;
/**
* @author nheron
*/
public class ProcessHistoryEvent extends HistoryEvent {
protected DroolsProcessInstanceObject processInstance;
public ProcessHistoryEvent() {
}
public ProcessHistoryEvent(Long eventID, Long ruleBaseId, Long sessionId) {
super(eventID, new Date(), TypeEvent.BPMN);
this.setRuleBaseID(ruleBaseId);
this.setSessionId(sessionId);
}
public DroolsProcessInstanceObject getProcessInstance() {
return processInstance;
}
public void setProcessInstance(DroolsProcessInstanceObject processInstance) {
this.processInstance = processInstance;
}
@Override
public String toString() {
return super.toString();
}
}

View file

@ -0,0 +1,57 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.rule;
import org.chtijbug.drools.entity.DroolsRuleObject;
/**
* @author nheron
*/
public class AfterRuleFiredHistoryEvent extends RuleHistoryEvent {
/**
*
*/
private static final long serialVersionUID = -8587421328193577240L;
/**
*
*/
public AfterRuleFiredHistoryEvent() {
}
public AfterRuleFiredHistoryEvent(Long eventID, int ruleInstanceID, DroolsRuleObject rule, Long ruleBaseId, Long sessionId) {
super(eventID, ruleInstanceID, rule, ruleBaseId, sessionId);
}
/*
* (non-Javadoc)
*
* @see org.chtijbug.drools.entity.history.HistoryEvent#toString()
*/
@Override
public String toString() {
StringBuilder str = new StringBuilder();
str.append(super.toString() + "\n");
str.append("End Rule :\n");
return str.toString();
}
}

View file

@ -0,0 +1,35 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.rule;
import org.chtijbug.drools.entity.DroolsRuleFlowGroupObject;
/**
* Created by IntelliJ IDEA.
* Date: 21/02/12
* Time: 20:49
* To change this template use File | Settings | File Templates.
*/
public class AfterRuleFlowActivatedHistoryEvent extends RuleFlowHistoryEvent {
public AfterRuleFlowActivatedHistoryEvent() {
}
public AfterRuleFlowActivatedHistoryEvent(Long eventID, DroolsRuleFlowGroupObject droolsRuleFlowGroupObject, Long ruleBaseId, Long sessionId) {
super(eventID, droolsRuleFlowGroupObject, ruleBaseId, sessionId);
}
}

View file

@ -0,0 +1,33 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.rule;
import org.chtijbug.drools.entity.DroolsRuleFlowGroupObject;
/**
* Created by IntelliJ IDEA.
* Date: 21/02/12
* Time: 20:54
* To change this template use File | Settings | File Templates.
*/
public class AfterRuleFlowDeactivatedHistoryEvent extends RuleFlowHistoryEvent {
public AfterRuleFlowDeactivatedHistoryEvent() {
}
public AfterRuleFlowDeactivatedHistoryEvent(Long eventID, DroolsRuleFlowGroupObject droolsRuleFlowGroupObject, Long ruleBaseId, Long sessionId) {
super(eventID, droolsRuleFlowGroupObject, ruleBaseId, sessionId);
}
}

View file

@ -0,0 +1,62 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.rule;
import org.chtijbug.drools.entity.DroolsFactObject;
import org.chtijbug.drools.entity.DroolsRuleObject;
import java.util.ArrayList;
/**
* Created by IntelliJ IDEA.
* Date: 21/02/12
* Time: 20:29
* To change this template use File | Settings | File Templates.
*/
public class BeforeRuleFiredHistoryEvent extends RuleHistoryEvent {
protected ArrayList<DroolsFactObject> whenObjects;
/**
*
*/
public BeforeRuleFiredHistoryEvent() {
}
public BeforeRuleFiredHistoryEvent(Long eventID, int ruleInstanceID, DroolsRuleObject rule, Long ruleBaseId, Long sessionId) {
super(eventID, ruleInstanceID, rule, ruleBaseId, sessionId);
this.whenObjects = new ArrayList<DroolsFactObject>();
}
public ArrayList<DroolsFactObject> getWhenObjects() {
return whenObjects;
}
@Override
public String toString() {
StringBuilder str = new StringBuilder();
str.append(super.toString() + "\n");
str.append("When objects :\n");
for (DroolsFactObject fact : whenObjects) {
if (fact != null) {
str.append("**" + fact.toString() + "\n");
}
}
return str.toString();
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.rule;
import org.chtijbug.drools.entity.DroolsRuleFlowGroupObject;
import org.chtijbug.drools.entity.history.HistoryEvent;
import java.util.Date;
/**
* Created by IntelliJ IDEA.
* Date: 23/11/12
* Time: 15:10
* To change this template use File | Settings | File Templates.
*/
public class RuleFlowHistoryEvent extends HistoryEvent {
/**
*
*/
private DroolsRuleFlowGroupObject droolsRuleFlowGroupObject;
public RuleFlowHistoryEvent() {
}
public RuleFlowHistoryEvent(Long eventID, DroolsRuleFlowGroupObject droolsRuleFlowGroupObject, Long ruleBaseId, Long sessionId) {
super(eventID, new Date(), HistoryEvent.TypeEvent.RuleFlowGroup);
this.droolsRuleFlowGroupObject = droolsRuleFlowGroupObject;
this.setRuleBaseID(ruleBaseId);
this.setSessionId(sessionId);
}
public DroolsRuleFlowGroupObject getDroolsRuleFlowGroupObject() {
return droolsRuleFlowGroupObject;
}
}

View file

@ -0,0 +1,71 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.rule;
import org.chtijbug.drools.entity.DroolsRuleObject;
import org.chtijbug.drools.entity.history.HistoryEvent;
import java.util.Date;
/**
* @author nheron
*/
public class RuleHistoryEvent extends HistoryEvent {
private static final long serialVersionUID = 7433690026159716847L;
protected DroolsRuleObject rule;
/**
* ruleInstanceID
* Each rule that is executed in a sessoin gets a ruleInstanceID
*/
private int ruleInstanceId;
/**
*
*/
public RuleHistoryEvent() {
}
public RuleHistoryEvent(Long eventID, int ruleInstanceId, DroolsRuleObject rule, Long ruleBaseId, Long sessionId) {
super(eventID, new Date(), HistoryEvent.TypeEvent.Rule);
this.ruleInstanceId = ruleInstanceId;
this.rule = rule;
this.setRuleBaseID(ruleBaseId);
this.setSessionId(sessionId);
}
public DroolsRuleObject getRule() {
return rule;
}
public void setRule(DroolsRuleObject rule) {
this.rule = rule;
}
public int getRuleInstanceId() {
return ruleInstanceId;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("RuleHistoryEvent{");
sb.append("rule=").append(rule);
sb.append(", ruleInstanceId=").append(ruleInstanceId);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,31 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.session;
/**
* Created by IntelliJ IDEA.
* Date: 05/06/13
* Time: 12:09
* To change this template use File | Settings | File Templates.
*/
public class SessionCreatedEvent extends SessionEvent {
public SessionCreatedEvent(Long eventID, Long ruleBaseId, Long sessionId) {
super(eventID, ruleBaseId, sessionId);
}
public SessionCreatedEvent() {
}
}

View file

@ -0,0 +1,31 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.session;
/**
* Created by IntelliJ IDEA.
* Date: 05/06/13
* Time: 12:09
* To change this template use File | Settings | File Templates.
*/
public class SessionDisposedEvent extends SessionEvent {
public SessionDisposedEvent(Long eventID, Long ruleBaseId, Long sessionId) {
super(eventID, ruleBaseId, sessionId);
}
public SessionDisposedEvent() {
}
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.session;
import org.chtijbug.drools.entity.history.HistoryEvent;
import java.util.Date;
/**
* Created by IntelliJ IDEA.
* Date: 05/06/13
* Time: 11:04
* To change this template use File | Settings | File Templates.
*/
public class SessionEvent extends HistoryEvent {
public SessionEvent(Long eventID, Long ruleBaseId, Long sessionId) {
super(eventID, new Date(), TypeEvent.Session);
this.setRuleBaseID(ruleBaseId);
this.setSessionId(sessionId);
}
public SessionEvent() {
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("SessionEvent");
return sb.toString();
}
}

View file

@ -0,0 +1,48 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.session;
import org.chtijbug.drools.entity.DroolsFactObject;
/**
* Created by IntelliJ IDEA.
* Date: 03/07/14
* Time: 10:09
* To change this template use File | Settings | File Templates.
*/
public class SessionFireAllRulesAndStartProcess extends SessionEvent {
protected DroolsFactObject inputObject;
protected DroolsFactObject outputObject;
public SessionFireAllRulesAndStartProcess(Long eventID, Long ruleBaseId, Long sessionId, DroolsFactObject inputObject, DroolsFactObject outputObject) {
super(eventID, ruleBaseId, sessionId);
this.inputObject = inputObject;
this.outputObject = outputObject;
}
public SessionFireAllRulesAndStartProcess() {
}
public DroolsFactObject getInputObject() {
return inputObject;
}
public DroolsFactObject getOutputObject() {
return outputObject;
}
}

View file

@ -0,0 +1,31 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.session;
/**
* Created by IntelliJ IDEA.
* Date: 05/06/13
* Time: 12:10
* To change this template use File | Settings | File Templates.
*/
public class SessionFireAllRulesBeginEvent extends SessionEvent {
public SessionFireAllRulesBeginEvent(Long eventID, Long ruleBaseId, Long sessionId) {
super(eventID, ruleBaseId, sessionId);
}
public SessionFireAllRulesBeginEvent() {
}
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.session;
/**
* Created by IntelliJ IDEA.
* Date: 05/06/13
* Time: 12:11
* To change this template use File | Settings | File Templates.
*/
public class SessionFireAllRulesEndEvent extends SessionEvent {
private long executionTime;
private long numberRulesExecuted;
public SessionFireAllRulesEndEvent(Long eventID, Long ruleBaseId, Long sessionId, long executionTime, long numberRulesExecuted) {
super(eventID, ruleBaseId, sessionId);
this.executionTime = executionTime;
this.numberRulesExecuted = numberRulesExecuted;
}
public SessionFireAllRulesEndEvent() {
}
public long getExecutionTime() {
return executionTime;
}
public long getNumberRulesExecuted() {
return numberRulesExecuted;
}
}

View file

@ -0,0 +1,62 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.session;
/**
* Created by IntelliJ IDEA.
* Date: 05/06/13
* Time: 16:38
* To change this template use File | Settings | File Templates.
*/
public class SessionFireAllRulesMaxNumberReachedEvent extends SessionEvent {
private int numberOfRulesExecuted = 0;
private int maxNumberOfRulesForSession = 0;
public SessionFireAllRulesMaxNumberReachedEvent(Long eventID, int numberOfRulesExecuted, int maxNumberOfRulesForSession, Long ruleBaseId, Long sessionId) {
super(eventID, ruleBaseId, sessionId);
this.numberOfRulesExecuted = numberOfRulesExecuted;
this.maxNumberOfRulesForSession = maxNumberOfRulesForSession;
}
public SessionFireAllRulesMaxNumberReachedEvent() {
}
public int getNumberOfRulesExecuted() {
return numberOfRulesExecuted;
}
public void setNumberOfRulesExecuted(int numberOfRulesExecuted) {
this.numberOfRulesExecuted = numberOfRulesExecuted;
}
public int getMaxNumberOfRulesForSession() {
return maxNumberOfRulesForSession;
}
public void setMaxNumberOfRulesForSession(int maxNumberOfRulesForSession) {
this.maxNumberOfRulesForSession = maxNumberOfRulesForSession;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("SessionFireAllRulesMaxNumberReachedEvent");
sb.append("{numberOfRulesExecuted=").append(numberOfRulesExecuted);
sb.append(", maxNumberOfRulesForSession=").append(maxNumberOfRulesForSession);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,51 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.session;
/**
* Created by IntelliJ IDEA.
* Date: 05/06/13
* Time: 12:11
* To change this template use File | Settings | File Templates.
*/
public class SessionStartProcessBeginEvent extends SessionEvent {
private String processName;
public SessionStartProcessBeginEvent(Long eventID, String processName, Long ruleBaseId, Long sessionId) {
super(eventID, ruleBaseId, sessionId);
this.processName = processName;
}
public SessionStartProcessBeginEvent() {
}
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer();
sb.append("SessionStartProcessBeginEvent");
sb.append("{processName='").append(processName).append('\'');
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,61 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.entity.history.session;
/**
* Created by IntelliJ IDEA.
* Date: 05/06/13
* Time: 12:12
* To change this template use File | Settings | File Templates.
*/
public class SessionStartProcessEndEvent extends SessionEvent {
private String processName;
private String processInstanceId;
public SessionStartProcessEndEvent(Long eventID, String processName, Long ruleBaseId, Long sessionId, String processInstanceId) {
super(eventID, ruleBaseId, sessionId);
this.processName = processName;
this.processInstanceId = processInstanceId;
}
public SessionStartProcessEndEvent() {
}
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public String getProcessInstanceId() {
return processInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
this.processInstanceId = processInstanceId;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("SessionStartProcessEndEvent{");
sb.append("processName='").append(processName).append('\'');
sb.append(", processInstanceId='").append(processInstanceId).append('\'');
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,103 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
import java.util.Date;
public class Fact {
private Object realFact;
private Integer objectVersion;
private String fullClassName;
private Date modificationDate;
private FactType factType;
private Long eventid;
public Fact() {
}
public Object getRealFact() {
return realFact;
}
public void setRealFact(Object realFact) {
this.realFact = realFact;
}
public Integer getObjectVersion() {
return objectVersion;
}
public void setObjectVersion(Integer objectVersion) {
this.objectVersion = objectVersion;
}
public String getFullClassName() {
return fullClassName;
}
public void setFullClassName(String fullClassName) {
this.fullClassName = fullClassName;
}
public FactType getFactType() {
return factType;
}
public void setFactType(FactType factType) {
this.factType = factType;
}
public Date getModificationDate() {
return modificationDate;
}
public void setModificationDate(Date modificationDate) {
this.modificationDate = modificationDate;
}
public Long getEventid() {
return eventid;
}
public void setEventid(Long eventid) {
this.eventid = eventid;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("Fact{");
sb.append(", jsonFact='").append(realFact).append('\'');
sb.append(", objectVersion=").append(objectVersion);
sb.append(", fullClassName='").append(fullClassName).append('\'');
sb.append(", modificationDate=").append(modificationDate);
sb.append(", factType=").append(factType);
sb.append(", eventid=").append(eventid);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,28 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
public enum FactType {
WHEN, INSERTED, UPDATED_OLDVALUE, UPDATED_NEWVALUE, DELETED, INPUTDATA, OUTPUTDATA;
public static FactType getEnum(String factType) {
for (FactType type : FactType.values()) {
if (type.name().equals(type))
return type;
}
return null;
}
}

View file

@ -0,0 +1,154 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
import java.util.Date;
public class FireAllRulesExecution {
private Date startDate;
private Date endDate;
private Long nbreRulesFired;
private Long maxNbreRulesDefinedForSession;
private Long executionTime;
private Long startEventID;
private FireAllRulesExecutionStatus fireAllRulesExecutionStatus;
private Long stopEventID;
private Long maxRulesEventID;
public FireAllRulesExecution() {
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Long getStartEventID() {
return startEventID;
}
public void setStartEventID(Long startEventID) {
this.startEventID = startEventID;
}
public Long getNbreRulesFired() {
return nbreRulesFired;
}
public void setNbreRulesFired(Long nbreRulesFired) {
this.nbreRulesFired = nbreRulesFired;
}
public Long getExecutionTime() {
return executionTime;
}
public void setExecutionTime(Long executionTime) {
this.executionTime = executionTime;
}
public FireAllRulesExecutionStatus getFireAllRulesExecutionStatus() {
return fireAllRulesExecutionStatus;
}
public void setFireAllRulesExecutionStatus(FireAllRulesExecutionStatus fireAllRulesExecutionStatus) {
this.fireAllRulesExecutionStatus = fireAllRulesExecutionStatus;
}
public Long getMaxNbreRulesDefinedForSession() {
return maxNbreRulesDefinedForSession;
}
public void setMaxNbreRulesDefinedForSession(Long maxNbreRulesDefinedForSession) {
this.maxNbreRulesDefinedForSession = maxNbreRulesDefinedForSession;
}
public Long getStopEventID() {
return stopEventID;
}
public void setStopEventID(Long stopEventID) {
this.stopEventID = stopEventID;
}
public Long getMaxRulesEventID() {
return maxRulesEventID;
}
public void setMaxRulesEventID(Long maxRulesEventID) {
this.maxRulesEventID = maxRulesEventID;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("FireRulesRuntime{");
sb.append(", startDate=").append(startDate);
sb.append(", endDate=").append(endDate);
sb.append(", nbreRulesFired=").append(nbreRulesFired);
sb.append(", maxNbreRulesDefinedForSession=").append(maxNbreRulesDefinedForSession);
sb.append(", executionTime=").append(executionTime);
sb.append(", startEventID=").append(startEventID);
sb.append(", fireRulesRuntimeStatus=").append(fireAllRulesExecutionStatus);
sb.append('}');
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof FireAllRulesExecution)) return false;
FireAllRulesExecution that = (FireAllRulesExecution) o;
if (!startDate.equals(that.startDate)) return false;
return true;
}
@Override
public int hashCode() {
int result = startDate.hashCode();
return result;
}
}

View file

@ -0,0 +1,20 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
public enum FireAllRulesExecutionStatus {
STARTED, STOPPED, CRASHED, MAXNBRULES
}

View file

@ -0,0 +1,20 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
public class NodeRuntime {
}

View file

@ -0,0 +1,60 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
/**
* Created by alexandre on 17/07/2014.
*/
public class Page {
private Integer currentIndex;
private Long totalCount;
/**
* Setting a default value tha we can override
*/
private Integer maxItemPerPage = 5;
public Page() {/** nop */}
public Page(Integer currentIndex, Long totalCount, Integer maxItemPerPage) {
this.currentIndex = currentIndex;
this.totalCount = totalCount;
this.maxItemPerPage = maxItemPerPage;
}
public Integer getCurrentIndex() {
return currentIndex;
}
public void setCurrentIndex(Integer currentIndex) {
this.currentIndex = currentIndex;
}
public Long getTotalCount() {
return totalCount;
}
public void setTotalCount(Long totalCount) {
this.totalCount = totalCount;
}
public Integer getMaxItemPerPage() {
return maxItemPerPage;
}
public void setMaxItemPerPage(Integer maxItemPerPage) {
this.maxItemPerPage = maxItemPerPage;
}
}

View file

@ -0,0 +1,8 @@
package org.chtijbug.drools.logging;
/**
* Created by nheron on 10/03/15.
*/
public enum PlatformRuntimeEnvironment {
DEV, INT, PROD
}

View file

@ -0,0 +1,101 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
import com.google.common.base.Objects;
import java.util.Date;
public class PlatformRuntimeFilter {
private String packageName;
private String status;
private String hostname;
private Date startDate;
private Date endDate;
private String onlyRunningInstances;
private Page page;
public PlatformRuntimeFilter() {/* nop */}
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getHostname() {
return hostname;
}
public void setHostname(String hostname) {
this.hostname = hostname;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getOnlyRunningInstances() {
return onlyRunningInstances;
}
public void setOnlyRunningInstances(String onlyRunningInstances) {
this.onlyRunningInstances = onlyRunningInstances;
}
public Page getPage() {
return page;
}
public void setPage(Page page) {
this.page = page;
}
@Override
public String toString() {
return Objects.toStringHelper(this)
.add("packageName", packageName)
.add("status", status)
.add("hostname", hostname)
.add("startDate", startDate)
.add("endDate", endDate)
.add("onlyRunningInstances", onlyRunningInstances)
.toString();
}
}

View file

@ -0,0 +1,30 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
public enum PlatformRuntimeInstanceStatus {
INITMODE, STARTED, NOT_JOINGNABLE, STOPPED, CRASHED;
public static PlatformRuntimeInstanceStatus getEnum(String assetStatus) {
for (PlatformRuntimeInstanceStatus status : PlatformRuntimeInstanceStatus.values()) {
if (status.name().equals(assetStatus))
return status;
}
return null;
}
}

View file

@ -0,0 +1,8 @@
package org.chtijbug.drools.logging;
/**
* Created by nheron on 26/02/15.
*/
public enum PlatformRuntimeMode {
Debug, platformRuntimeMode, Info
}

View file

@ -0,0 +1,188 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
import java.util.Date;
import java.util.LinkedList;
public class ProcessExecution {
private String processName;
private Date startDate;
private Date endDate;
private ProcessExecutionStatus processExecutionStatus;
private Long startEventID;
private Long stopEventID;
private String ProcessInstanceId;
private String processPackageName;
private String processVersion;
private String processType;
private String processId;
private LinkedList<RuleflowGroup> ruleflowGroups = new LinkedList<RuleflowGroup>();
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Long getStartEventID() {
return startEventID;
}
public void setStartEventID(Long startEventID) {
this.startEventID = startEventID;
}
public Long getStopEventID() {
return stopEventID;
}
public void setStopEventID(Long stopEventID) {
this.stopEventID = stopEventID;
}
public ProcessExecutionStatus getProcessExecutionStatus() {
return processExecutionStatus;
}
public void setProcessExecutionStatus(ProcessExecutionStatus processExecutionStatus) {
this.processExecutionStatus = processExecutionStatus;
}
public String getProcessInstanceId() {
return ProcessInstanceId;
}
public void setProcessInstanceId(String processInstanceId) {
ProcessInstanceId = processInstanceId;
}
public String getProcessPackageName() {
return processPackageName;
}
public void setProcessPackageName(String processPackageName) {
this.processPackageName = processPackageName;
}
public String getProcessVersion() {
return processVersion;
}
public void setProcessVersion(String processVersion) {
this.processVersion = processVersion;
}
public String getProcessType() {
return processType;
}
public void setProcessType(String processType) {
this.processType = processType;
}
public String getProcessId() {
return processId;
}
public void setProcessId(String processId) {
this.processId = processId;
}
public LinkedList<RuleflowGroup> getRuleflowGroups() {
return ruleflowGroups;
}
public void setRuleflowGroups(LinkedList<RuleflowGroup> ruleflowGroups) {
this.ruleflowGroups = ruleflowGroups;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("ProcessRuntime{");
sb.append(", processName='").append(processName).append('\'');
sb.append(", startDate=").append(startDate);
sb.append(", endDate=").append(endDate);
sb.append(", processRuntimeStatus=").append(processExecutionStatus);
sb.append(", startEventID=").append(startEventID);
sb.append(", ProcessInstanceId='").append(ProcessInstanceId).append('\'');
sb.append(", processPackageName='").append(processPackageName).append('\'');
sb.append(", processVersion='").append(processVersion).append('\'');
sb.append(", processType='").append(processType).append('\'');
sb.append(", processId='").append(processId).append('\'');
sb.append('}');
return sb.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof ProcessExecution)) return false;
ProcessExecution that = (ProcessExecution) o;
if (!processName.equals(that.processName)) return false;
if (!startDate.equals(that.startDate)) return false;
return true;
}
@Override
public int hashCode() {
int result = processName.hashCode();
result = 31 * result + startDate.hashCode();
return result;
}
}

View file

@ -0,0 +1,21 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
public enum ProcessExecutionStatus {
SESSIONSTARTED, JBPMSTARTED, JBPMSTOPPED, CRASHED
}

View file

@ -0,0 +1,112 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
import org.chtijbug.drools.logging.Fact;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class RuleExecution {
private String ruleName;
private String packageName;
private Date startDate;
private Date endDate;
private Long startEventID;
private Long stopEventID;
private List<Fact> whenFacts = new ArrayList<Fact>();
private List<Fact> thenFacts = new ArrayList<Fact>();
public String getRuleName() {
return ruleName;
}
public void setRuleName(String ruleName) {
this.ruleName = ruleName;
}
public String getPackageName() {
return packageName;
}
public void setPackageName(String packageName) {
this.packageName = packageName;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Long getStartEventID() {
return startEventID;
}
public void setStartEventID(Long startEventID) {
this.startEventID = startEventID;
}
public Long getStopEventID() {
return stopEventID;
}
public void setStopEventID(Long stopEventID) {
this.stopEventID = stopEventID;
}
public List<Fact> getWhenFacts() {
return whenFacts;
}
public void setWhenFacts(List<Fact> whenFacts) {
this.whenFacts = whenFacts;
}
public List<Fact> getThenFacts() {
return thenFacts;
}
public void setThenFacts(List<Fact> thenFacts) {
this.thenFacts = thenFacts;
}
}

View file

@ -0,0 +1,129 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
import java.util.Date;
import java.util.LinkedList;
public class RuleflowGroup {
private String ruleflowGroup;
private LinkedList<RuleExecution> ruleExecutionList = new LinkedList<>();
private Date startDate;
private Date endDate;
private Long startEventID;
private Long stopEventID;
private RuleflowGroupStatus ruleflowGroupStatus;
public String getRuleflowGroup() {
return ruleflowGroup;
}
public void setRuleflowGroup(String ruleflowGroup) {
this.ruleflowGroup = ruleflowGroup;
}
public LinkedList<RuleExecution> getRuleExecutionList() {
return ruleExecutionList;
}
public void setRuleExecutionList(LinkedList<RuleExecution> ruleExecutionList) {
this.ruleExecutionList = ruleExecutionList;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public RuleflowGroupStatus getRuleflowGroupStatus() {
return ruleflowGroupStatus;
}
public void setRuleflowGroupStatus(RuleflowGroupStatus ruleflowGroupStatus) {
this.ruleflowGroupStatus = ruleflowGroupStatus;
}
public Long getStartEventID() {
return startEventID;
}
public void setStartEventID(Long startEventID) {
this.startEventID = startEventID;
}
public Long getStopEventID() {
return stopEventID;
}
public void setStopEventID(Long stopEventID) {
this.stopEventID = stopEventID;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof RuleflowGroup)) return false;
RuleflowGroup that = (RuleflowGroup) o;
if (!ruleflowGroup.equals(that.ruleflowGroup)) return false;
return true;
}
@Override
public int hashCode() {
int result = ruleflowGroup.hashCode();
return result;
}
@Override
public String toString() {
final StringBuffer sb = new StringBuffer("RuleflowGroupRuntime{");
sb.append(", ruleflowGroup='").append(ruleflowGroup).append('\'');
sb.append(", startDate=").append(startDate);
sb.append(", endDate=").append(endDate);
sb.append(", ruleflowGroupRuntimeStatus=").append(ruleflowGroupStatus);
sb.append('}');
return sb.toString();
}
}

View file

@ -0,0 +1,21 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
public enum RuleflowGroupStatus {
STARTED, STOPPED, CRASHED
}

View file

@ -0,0 +1,178 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class SessionExecution {
private Long id;
private Long sessionId;
private Date startDate;
private Date endDate;
private Long startEventID;
private Long stopEventID;
private PlatformRuntimeMode platformRuntimeMode = PlatformRuntimeMode.Debug;
private SessionExecutionStatus sessionExecutionStatus;
private List<RuleExecution> ruleExecutions = new ArrayList<>();
private List<ProcessExecution> processExecutions = new ArrayList<>();
private List<FireAllRulesExecution> fireAllRulesExecutions = new ArrayList<>();
private List<Fact> facts = new ArrayList<Fact>();
private Date processingStartDate;
private Date processingStopDate;
public SessionExecution() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getSessionId() {
return sessionId;
}
public void setSessionId(Long sessionId) {
this.sessionId = sessionId;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public Long getStartEventID() {
return startEventID;
}
public void setStartEventID(Long startEventID) {
this.startEventID = startEventID;
}
public Long getStopEventID() {
return stopEventID;
}
public void setStopEventID(Long stopEventID) {
this.stopEventID = stopEventID;
}
public SessionExecutionStatus getSessionExecutionStatus() {
return sessionExecutionStatus;
}
public void setSessionExecutionStatus(SessionExecutionStatus sessionExecutionStatus) {
this.sessionExecutionStatus = sessionExecutionStatus;
}
public List<FireAllRulesExecution> getFireAllRulesExecutions() {
return fireAllRulesExecutions;
}
public void setFireAllRulesExecutions(List<FireAllRulesExecution> fireAllRulesExecutions) {
this.fireAllRulesExecutions = fireAllRulesExecutions;
}
public List<RuleExecution> getRuleExecutions() {
return ruleExecutions;
}
public void setRuleExecutions(List<RuleExecution> ruleExecutions) {
this.ruleExecutions = ruleExecutions;
}
public List<ProcessExecution> getProcessExecutions() {
return processExecutions;
}
public void setProcessExecutions(List<ProcessExecution> processExecutions) {
this.processExecutions = processExecutions;
}
public List<Fact> getFacts() {
return facts;
}
public void setFacts(List<Fact> facts) {
this.facts = facts;
}
public java.util.Collection<Fact> getFactsByType(final FactType factType) {
if (this.getFacts().isEmpty())
return Lists.newArrayList();
return Collections2.filter(this.getFacts(), new Predicate<Fact>() {
@Override
public boolean apply(Fact fact) {
return fact.getFactType().equals(factType);
}
});
}
public Date getProcessingStartDate() {
return processingStartDate;
}
public void setProcessingStartDate(Date processionStartDate) {
this.processingStartDate = processionStartDate;
}
public Date getProcessingStopDate() {
return processingStopDate;
}
public void setProcessingStopDate(Date processingStopDate) {
this.processingStopDate = processingStopDate;
}
public PlatformRuntimeMode getPlatformRuntimeMode() {
return platformRuntimeMode;
}
public void setPlatformRuntimeMode(PlatformRuntimeMode platformRuntimeMode) {
this.platformRuntimeMode = platformRuntimeMode;
}
}

View file

@ -0,0 +1,21 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.logging;
public enum SessionExecutionStatus {
STARTED, DISPOSED, CRASHED
}

View file

@ -0,0 +1,63 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtime;
import java.io.Serializable;
/**
* Created by IntelliJ IDEA.
* Date: 24/04/12
* Time: 18:11
* To change this template use File | Settings | File Templates.
*/
public class DroolsChtijbugException extends Exception implements Serializable {
public static String insertByReflection = "insertByReflection";
public static String MaxNumberRuleExecutionReached = "MaxNumberRuleExecutionReached";
public static String fireAllRules = "fireAllRules";
public static String KbaseAcquire = "KbaseAcquire";
public static String KbaseNotInitialised = "KbaseNotInitialised";
public static String ErrorToLoadAgent = "ErrorToLoadAgent";
public static String UnknowFileExtension = "UnknowFileExtension";
public static String ErrorRegisteringMBeans = "";
public static String RessourceAlreadyAdded = "RessourceAlreadyAdded";
public static String RessourceDoesNotExist = "RessourceNotExisting";
private String key;
private String Description;
private Exception originException;
public DroolsChtijbugException() {
}
public DroolsChtijbugException(String key, String description, Exception originException) {
super(key + description, originException);
this.key = key;
Description = description;
this.originException = originException;
}
public String getKey() {
return key;
}
public String getDescription() {
return Description;
}
public Exception getOriginException() {
return originException;
}
}

View file

@ -0,0 +1,29 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtime.listener;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.runtime.DroolsChtijbugException;
import java.io.Serializable;
public interface HistoryListener extends Serializable {
public void fireEvent(HistoryEvent newHistoryEvent) throws DroolsChtijbugException;
}

View file

@ -0,0 +1,16 @@
package org.chtijbug.drools.runtimeevent;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
/**
* Created by nheron on 11/06/15.
*/
public interface AbstractMemoryEventHandlerStrategy {
public abstract void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext);
public abstract boolean isEventSupported(HistoryEvent historyEvent);
}

View file

@ -0,0 +1,96 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.runtimeevent.impl.fact.*;
import org.chtijbug.drools.runtimeevent.impl.knowledgeSession.*;
import org.chtijbug.drools.runtimeevent.impl.process.*;
import org.chtijbug.drools.runtimeevent.impl.rule.AfterRuleFiredEventStrategy;
import org.chtijbug.drools.runtimeevent.impl.rule.AfterRuleflowGroupActivatedEventStrategy;
import org.chtijbug.drools.runtimeevent.impl.rule.AfterRuleflowGroupDeactivatedEventStrategy;
import org.chtijbug.drools.runtimeevent.impl.rule.BeforeRuleFiredEventStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
public class MessageHandlerResolver {
private static final Logger logger = LoggerFactory.getLogger(MessageHandlerResolver.class);
@Resource
private List<AbstractMemoryEventHandlerStrategy> allMemoryStrategies = new ArrayList<>();
public MessageHandlerResolver() {
allMemoryStrategies.add(new DeleteFactEventStrategy());
allMemoryStrategies.add(new InsertedByRelectionFactEndEventStrategy());
allMemoryStrategies.add(new InsertedByRelectionFactStartEventStrategy());
allMemoryStrategies.add(new InsertedFactEventStrategy());
allMemoryStrategies.add(new UpdatedFactEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionCreateEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionDisposeEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionFireAllRulesAndStartProcessEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionFireAllRulesBeginEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionFireAllRulesEndEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionFireAllRulesMaxRulesEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionProcessBeginEventStrategy());
allMemoryStrategies.add(new KnowledgeSessionProcessEndEventStrategy());
allMemoryStrategies.add(new AfterNodeInstanceTriggeredEventStrategy());
allMemoryStrategies.add(new AfterNodeLeftEventStrategy());
allMemoryStrategies.add(new AfterProcessEndHistoryEventStrategy());
allMemoryStrategies.add(new AfterProcessStartEventStrategy());
allMemoryStrategies.add(new AfterVariableChangeEventStrategy());
allMemoryStrategies.add(new BeforeNodeInstanceTriggeredEventStrategy());
allMemoryStrategies.add(new BeforeNodeLeftEventStrategy());
allMemoryStrategies.add(new BeforeProcessEndEventStrategy());
allMemoryStrategies.add(new BeforeProcessStartEventStrategy());
allMemoryStrategies.add(new BeforeVariableChangeEventStrategy());
allMemoryStrategies.add(new AfterRuleFiredEventStrategy());
allMemoryStrategies.add(new AfterRuleflowGroupActivatedEventStrategy());
allMemoryStrategies.add(new AfterRuleflowGroupDeactivatedEventStrategy());
allMemoryStrategies.add(new BeforeRuleFiredEventStrategy());
}
public SessionContext getSessionFromHistoryEvent(List<HistoryEvent> historyEvents) {
SessionContext sessionContext = new SessionContext();
for (HistoryEvent historyEvent : historyEvents) {
AbstractMemoryEventHandlerStrategy strategy = this.resolveMessageHandlerMemory(historyEvent);
if (strategy != null) {
try {
strategy.handleMessageInternally(historyEvent, sessionContext);
}catch (Exception e){
logger.error("MessageHandle for class" + historyEvent.getClass().toString(), historyEvent, e);
}
}
}
return sessionContext;
}
public AbstractMemoryEventHandlerStrategy resolveMessageHandlerMemory(HistoryEvent historyEvent) {
for (AbstractMemoryEventHandlerStrategy strategy : allMemoryStrategies) {
if (strategy.isEventSupported(historyEvent))
return strategy;
}
return null;
}
}

View file

@ -0,0 +1,59 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.fact;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.fact.DeletedFactHistoryEvent;
import org.chtijbug.drools.logging.Fact;
import org.chtijbug.drools.logging.FactType;
import org.chtijbug.drools.logging.RuleExecution;
import org.chtijbug.drools.logging.SessionExecution;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class DeleteFactEventStrategy implements AbstractMemoryEventHandlerStrategy {
;
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
DeletedFactHistoryEvent deletedFactHistoryEvent = (DeletedFactHistoryEvent) historyEvent;
Fact fact = new Fact();
fact.setFullClassName(deletedFactHistoryEvent.getDeletedObject().getFullClassName());
fact.setObjectVersion(deletedFactHistoryEvent.getDeletedObject().getObjectVersion());
fact.setRealFact(deletedFactHistoryEvent.getDeletedObject().getRealObject());
fact.setModificationDate(deletedFactHistoryEvent.getDateEvent());
fact.setFactType(FactType.DELETED);
RuleExecution existingInSessionRuleExecution = null;
if (deletedFactHistoryEvent.getRuleName() == null) { // inserted from a session
SessionExecution sessionExecution = sessionContext.getSessionExecution();
sessionExecution.getFacts().add(fact);
} else { // inserted from a rule that is not in a ruleflow/process
existingInSessionRuleExecution = sessionContext.getRuleExecution();
existingInSessionRuleExecution.getThenFacts().add(fact);
}
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof DeletedFactHistoryEvent;
}
}

View file

@ -0,0 +1,40 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.fact;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.fact.InsertedByReflectionFactEndHistoryEvent;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class InsertedByRelectionFactEndEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof InsertedByReflectionFactEndHistoryEvent;
}
}

View file

@ -0,0 +1,39 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.fact;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.fact.InsertedByReflectionFactStartHistoryEvent;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class InsertedByRelectionFactStartEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof InsertedByReflectionFactStartHistoryEvent;
}
}

View file

@ -0,0 +1,57 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.fact;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.fact.InsertedFactHistoryEvent;
import org.chtijbug.drools.logging.Fact;
import org.chtijbug.drools.logging.FactType;
import org.chtijbug.drools.logging.RuleExecution;
import org.chtijbug.drools.logging.SessionExecution;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class InsertedFactEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
InsertedFactHistoryEvent insertedFactHistoryEvent = (InsertedFactHistoryEvent) historyEvent;
Fact fact = new Fact();
fact.setFullClassName(insertedFactHistoryEvent.getInsertedObject().getFullClassName());
fact.setObjectVersion(insertedFactHistoryEvent.getInsertedObject().getObjectVersion());
fact.setRealFact(insertedFactHistoryEvent.getInsertedObject().getRealObject());
fact.setModificationDate(insertedFactHistoryEvent.getDateEvent());
fact.setFactType(FactType.INSERTED);
RuleExecution existingInSessionRuleExecution = null;
if (insertedFactHistoryEvent.getRuleName() == null) { // inserted from a session
SessionExecution sessionExecution = sessionContext.getSessionExecution();
sessionExecution.getFacts().add(fact);
} else { // inserted from a rule that is not in a ruleflow/process
existingInSessionRuleExecution = sessionContext.getRuleExecution();
existingInSessionRuleExecution.getThenFacts().add(fact);
}
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof InsertedFactHistoryEvent;
}
}

View file

@ -0,0 +1,66 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.fact;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.fact.UpdatedFactHistoryEvent;
import org.chtijbug.drools.logging.Fact;
import org.chtijbug.drools.logging.FactType;
import org.chtijbug.drools.logging.RuleExecution;
import org.chtijbug.drools.logging.SessionExecution;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class UpdatedFactEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
UpdatedFactHistoryEvent updatedFactHistoryEvent = (UpdatedFactHistoryEvent) historyEvent;
Fact factOldValue = new Fact();
factOldValue.setFullClassName(updatedFactHistoryEvent.getObjectOldValue().getFullClassName());
factOldValue.setObjectVersion(updatedFactHistoryEvent.getObjectOldValue().getObjectVersion());
factOldValue.setRealFact(updatedFactHistoryEvent.getObjectOldValue().getRealObject());
factOldValue.setModificationDate(updatedFactHistoryEvent.getDateEvent());
factOldValue.setFactType(FactType.UPDATED_OLDVALUE);
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);
RuleExecution existingInSessionRuleExecution = null;
if (updatedFactHistoryEvent.getRuleName() == null) { // updated from a session
SessionExecution sessionExecution = sessionContext.getSessionExecution();
sessionExecution.getFacts().add(factOldValue);
sessionExecution.getFacts().add(factNewValue);
} else { // updated from a rule that is not in a ruleflow/process
existingInSessionRuleExecution = sessionContext.getRuleExecution();
existingInSessionRuleExecution.getThenFacts().add(factOldValue);
existingInSessionRuleExecution.getThenFacts().add(factNewValue);
}
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof UpdatedFactHistoryEvent;
}
}

View file

@ -0,0 +1,50 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionCreatedEvent;
import org.chtijbug.drools.logging.SessionExecution;
import org.chtijbug.drools.logging.SessionExecutionStatus;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
import java.util.Date;
public class KnowledgeSessionCreateEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
SessionExecution sessionExecution = new SessionExecution();
SessionCreatedEvent sessionCreatedEvent = (SessionCreatedEvent) historyEvent;
sessionExecution.setProcessingStartDate(new Date());
sessionExecution.setStartDate(sessionCreatedEvent.getDateEvent());
sessionExecution.setSessionId(sessionCreatedEvent.getSessionId());
sessionExecution.setStartEventID(sessionCreatedEvent.getEventID());
sessionExecution.setSessionExecutionStatus(SessionExecutionStatus.STARTED);
sessionContext.setSessionExecution(sessionExecution);
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof SessionCreatedEvent;
}
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionDisposedEvent;
import org.chtijbug.drools.logging.SessionExecution;
import org.chtijbug.drools.logging.SessionExecutionStatus;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
import java.util.Date;
public class KnowledgeSessionDisposeEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
SessionDisposedEvent sessionDisposedEvent = (SessionDisposedEvent) historyEvent;
SessionExecution existingSessionRutime = sessionContext.getSessionExecution();
existingSessionRutime.setEndDate(sessionDisposedEvent.getDateEvent());
existingSessionRutime.setProcessingStopDate(new Date());
existingSessionRutime.setStopEventID(sessionDisposedEvent.getEventID());
existingSessionRutime.setSessionExecutionStatus(SessionExecutionStatus.DISPOSED);
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof SessionDisposedEvent;
}
}

View file

@ -0,0 +1,67 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.DroolsFactObject;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionFireAllRulesAndStartProcess;
import org.chtijbug.drools.logging.Fact;
import org.chtijbug.drools.logging.FactType;
import org.chtijbug.drools.logging.SessionExecution;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class KnowledgeSessionFireAllRulesAndStartProcessEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
SessionFireAllRulesAndStartProcess sessionFireAllRulesAndStartProcess = (SessionFireAllRulesAndStartProcess) historyEvent;
SessionExecution existingSessionRutime = sessionContext.getSessionExecution();
if (existingSessionRutime != null) {
if (sessionFireAllRulesAndStartProcess.getInputObject() != null) {
DroolsFactObject inputObject = sessionFireAllRulesAndStartProcess.getInputObject();
Fact inputFact = new Fact();
inputFact.setEventid(sessionFireAllRulesAndStartProcess.getEventID());
inputFact.setFactType(FactType.INPUTDATA);
inputFact.setFullClassName(inputObject.getFullClassName());
inputFact.setRealFact(inputObject.getRealObject());
inputFact.setModificationDate(sessionFireAllRulesAndStartProcess.getDateEvent());
inputFact.setObjectVersion(inputObject.getObjectVersion());
existingSessionRutime.getFacts().add(inputFact);
}
if (sessionFireAllRulesAndStartProcess.getOutputObject() != null) {
DroolsFactObject outputObject = sessionFireAllRulesAndStartProcess.getOutputObject();
Fact outputFact = new Fact();
outputFact.setEventid(sessionFireAllRulesAndStartProcess.getEventID());
outputFact.setFactType(FactType.OUTPUTDATA);
outputFact.setFullClassName(outputObject.getFullClassName());
outputFact.setRealFact(outputObject.getRealObject());
outputFact.setModificationDate(sessionFireAllRulesAndStartProcess.getDateEvent());
outputFact.setObjectVersion(outputObject.getObjectVersion());
existingSessionRutime.getFacts().add(outputFact);
}
}
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof SessionFireAllRulesAndStartProcess;
}
}

View file

@ -0,0 +1,48 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionFireAllRulesBeginEvent;
import org.chtijbug.drools.logging.FireAllRulesExecution;
import org.chtijbug.drools.logging.FireAllRulesExecutionStatus;
import org.chtijbug.drools.logging.SessionExecution;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class KnowledgeSessionFireAllRulesBeginEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
SessionFireAllRulesBeginEvent sessionFireAllRulesBeginEvent = (SessionFireAllRulesBeginEvent) historyEvent;
SessionExecution existingSessionRutime = sessionContext.getSessionExecution();
FireAllRulesExecution fireAllRulesExecution = new FireAllRulesExecution();
fireAllRulesExecution.setStartEventID(sessionFireAllRulesBeginEvent.getEventID());
fireAllRulesExecution.setStartDate(sessionFireAllRulesBeginEvent.getDateEvent());
fireAllRulesExecution.setFireAllRulesExecutionStatus(FireAllRulesExecutionStatus.STARTED);
existingSessionRutime.getFireAllRulesExecutions().add(fireAllRulesExecution);
sessionContext.setFireAllRulesExecution(fireAllRulesExecution);
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof SessionFireAllRulesBeginEvent;
}
}

View file

@ -0,0 +1,47 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionFireAllRulesEndEvent;
import org.chtijbug.drools.logging.FireAllRulesExecution;
import org.chtijbug.drools.logging.FireAllRulesExecutionStatus;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class KnowledgeSessionFireAllRulesEndEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
SessionFireAllRulesEndEvent sessionFireAllRulesEndEvent = (SessionFireAllRulesEndEvent) historyEvent;
FireAllRulesExecution fireAllRulesExecution = sessionContext.getFireAllRulesExecution();
fireAllRulesExecution.setStopEventID(sessionFireAllRulesEndEvent.getEventID());
fireAllRulesExecution.setEndDate(sessionFireAllRulesEndEvent.getDateEvent());
fireAllRulesExecution.setFireAllRulesExecutionStatus(FireAllRulesExecutionStatus.STOPPED);
fireAllRulesExecution.setNbreRulesFired(Long.valueOf(sessionFireAllRulesEndEvent.getNumberRulesExecuted()));
fireAllRulesExecution.setExecutionTime(Long.valueOf(sessionFireAllRulesEndEvent.getExecutionTime()));
sessionContext.setFireAllRulesExecution(null);
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof SessionFireAllRulesEndEvent;
}
}

View file

@ -0,0 +1,43 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionFireAllRulesMaxNumberReachedEvent;
import org.chtijbug.drools.logging.FireAllRulesExecution;
import org.chtijbug.drools.logging.FireAllRulesExecutionStatus;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class KnowledgeSessionFireAllRulesMaxRulesEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
SessionFireAllRulesMaxNumberReachedEvent sessionFireAllRulesMaxNumberReachedEvent = (SessionFireAllRulesMaxNumberReachedEvent) historyEvent;
FireAllRulesExecution fireAllRulesExecution = sessionContext.getFireAllRulesExecution();
fireAllRulesExecution.setMaxRulesEventID(sessionFireAllRulesMaxNumberReachedEvent.getEventID());
fireAllRulesExecution.setEndDate(sessionFireAllRulesMaxNumberReachedEvent.getDateEvent());
fireAllRulesExecution.setFireAllRulesExecutionStatus(FireAllRulesExecutionStatus.MAXNBRULES);
fireAllRulesExecution.setNbreRulesFired(Long.valueOf(sessionFireAllRulesMaxNumberReachedEvent.getNumberOfRulesExecuted()));
fireAllRulesExecution.setMaxNbreRulesDefinedForSession(Long.valueOf(sessionFireAllRulesMaxNumberReachedEvent.getMaxNumberOfRulesForSession()));
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof SessionFireAllRulesMaxNumberReachedEvent;
}
}

View file

@ -0,0 +1,36 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionStartProcessBeginEvent;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class KnowledgeSessionProcessBeginEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof SessionStartProcessBeginEvent;
}
}

View file

@ -0,0 +1,37 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.knowledgeSession;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.session.SessionStartProcessEndEvent;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class KnowledgeSessionProcessEndEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof SessionStartProcessEndEvent;
}
}

View file

@ -0,0 +1,58 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.process;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.DroolsNodeType;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.AfterNodeInstanceTriggeredHistoryEvent;
import org.chtijbug.drools.logging.ProcessExecution;
import org.chtijbug.drools.logging.RuleflowGroup;
import org.chtijbug.drools.logging.RuleflowGroupStatus;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterNodeInstanceTriggeredEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
AfterNodeInstanceTriggeredHistoryEvent afterNodeInstanceTriggeredHistoryEvent = (AfterNodeInstanceTriggeredHistoryEvent) historyEvent;
if (afterNodeInstanceTriggeredHistoryEvent.getNodeInstance().getNode().getNodeType() == DroolsNodeType.RuleNode) {
String ruleFLowName = afterNodeInstanceTriggeredHistoryEvent.getNodeInstance().getNode().getRuleflowGroupName();
ProcessExecution processExecution = sessionContext.getProcessExecution();
RuleflowGroup ruleflowGroup = sessionContext.findRuleFlowGroup(ruleFLowName);
if (ruleflowGroup == null && processExecution != null) {
ruleflowGroup = new RuleflowGroup();
ruleflowGroup.setRuleflowGroup(ruleFLowName);
sessionContext.getRuleflowGroups().add(ruleflowGroup);
processExecution.getRuleflowGroups().add(ruleflowGroup);
}
ruleflowGroup.setStartDate(afterNodeInstanceTriggeredHistoryEvent.getDateEvent());
ruleflowGroup.setStartEventID(afterNodeInstanceTriggeredHistoryEvent.getEventID());
ruleflowGroup.setRuleflowGroupStatus(RuleflowGroupStatus.STARTED);
}
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof AfterNodeInstanceTriggeredHistoryEvent;
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.process;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.DroolsNodeType;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.AfterNodeLeftHistoryEvent;
import org.chtijbug.drools.logging.ProcessExecution;
import org.chtijbug.drools.logging.RuleflowGroup;
import org.chtijbug.drools.logging.RuleflowGroupStatus;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterNodeLeftEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
AfterNodeLeftHistoryEvent afterNodeLeftHistoryEvent = (AfterNodeLeftHistoryEvent) historyEvent;
if (afterNodeLeftHistoryEvent.getNodeInstance().getNode().getNodeType() == DroolsNodeType.RuleNode) {
String ruleFlowName = afterNodeLeftHistoryEvent.getNodeInstance().getNode().getRuleflowGroupName();
RuleflowGroup ruleflowGroup = sessionContext.findRuleFlowGroup(ruleFlowName);
ProcessExecution processExecution = sessionContext.getProcessExecution();
if (ruleflowGroup != null) {
ruleflowGroup.setEndDate(afterNodeLeftHistoryEvent.getDateEvent());
ruleflowGroup.setStopEventID(afterNodeLeftHistoryEvent.getEventID());
ruleflowGroup.setRuleflowGroupStatus(RuleflowGroupStatus.STOPPED);
}
}
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof AfterNodeLeftHistoryEvent;
}
}

View file

@ -0,0 +1,44 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.process;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.AfterProcessEndHistoryEvent;
import org.chtijbug.drools.logging.ProcessExecution;
import org.chtijbug.drools.logging.ProcessExecutionStatus;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterProcessEndHistoryEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
AfterProcessEndHistoryEvent afterProcessEndHistoryEvent = (AfterProcessEndHistoryEvent) historyEvent;
ProcessExecution processExecution = sessionContext.getProcessExecution();
processExecution.setEndDate(afterProcessEndHistoryEvent.getDateEvent());
processExecution.setStopEventID(afterProcessEndHistoryEvent.getEventID());
processExecution.setProcessExecutionStatus(ProcessExecutionStatus.JBPMSTOPPED);
sessionContext.setProcessExecution(null);
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof AfterProcessEndHistoryEvent;
}
}

View file

@ -0,0 +1,37 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.process;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.AfterProcessStartHistoryEvent;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterProcessStartEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof AfterProcessStartHistoryEvent;
}
}

View file

@ -0,0 +1,37 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.process;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.AfterVariableChangeChangedHistoryEvent;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterVariableChangeEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof AfterVariableChangeChangedHistoryEvent;
}
}

View file

@ -0,0 +1,36 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.process;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.BeforeNodeInstanceTriggeredHistoryEvent;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class BeforeNodeInstanceTriggeredEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof BeforeNodeInstanceTriggeredHistoryEvent;
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.process;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.BeforeNodeLeftHistoryEvent;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class BeforeNodeLeftEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof BeforeNodeLeftHistoryEvent;
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.process;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.BeforeProcessEndHistoryEvent;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class BeforeProcessEndEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof BeforeProcessEndHistoryEvent;
}
}

View file

@ -0,0 +1,55 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.process;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.BeforeProcessStartHistoryEvent;
import org.chtijbug.drools.logging.ProcessExecution;
import org.chtijbug.drools.logging.ProcessExecutionStatus;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class BeforeProcessStartEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
BeforeProcessStartHistoryEvent beforeProcessStartHistoryEvent = (BeforeProcessStartHistoryEvent) historyEvent;
ProcessExecution processExecution = new ProcessExecution();
processExecution.setProcessInstanceId(beforeProcessStartHistoryEvent.getProcessInstance().getId());
processExecution.setProcessName(beforeProcessStartHistoryEvent.getProcessInstance().getName());
processExecution.setProcessPackageName(beforeProcessStartHistoryEvent.getProcessInstance().getPackageName());
processExecution.setProcessType(beforeProcessStartHistoryEvent.getProcessInstance().getType());
processExecution.setProcessVersion(beforeProcessStartHistoryEvent.getProcessInstance().getVersion());
processExecution.setStartEventID(beforeProcessStartHistoryEvent.getEventID());
processExecution.setStartDate(beforeProcessStartHistoryEvent.getDateEvent());
processExecution.setProcessExecutionStatus(ProcessExecutionStatus.JBPMSTARTED);
sessionContext.setProcessExecution(processExecution);
sessionContext.getSessionExecution().getProcessExecutions().add(processExecution);
sessionContext.getRuleflowGroups().clear();
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof BeforeProcessStartHistoryEvent;
}
}

View file

@ -0,0 +1,38 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.process;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.process.BeforeVariableChangeChangedHistoryEvent;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class BeforeVariableChangeEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof BeforeVariableChangeChangedHistoryEvent;
}
}

View file

@ -0,0 +1,45 @@
/*
* Copyright 2014 Pymma Software
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chtijbug.drools.runtimeevent.impl.rule;
import org.chtijbug.drools.SessionContext;
import org.chtijbug.drools.entity.history.HistoryEvent;
import org.chtijbug.drools.entity.history.rule.AfterRuleFiredHistoryEvent;
import org.chtijbug.drools.logging.RuleExecution;
import org.chtijbug.drools.runtimeevent.AbstractMemoryEventHandlerStrategy;
public class AfterRuleFiredEventStrategy implements AbstractMemoryEventHandlerStrategy {
@Override
public void handleMessageInternally(HistoryEvent historyEvent, SessionContext sessionContext) {
AfterRuleFiredHistoryEvent afterRuleFiredHistoryEvent = (AfterRuleFiredHistoryEvent) historyEvent;
RuleExecution ruleExecution = sessionContext.getRuleExecution();
ruleExecution.setEndDate(afterRuleFiredHistoryEvent.getDateEvent());
ruleExecution.setStopEventID(afterRuleFiredHistoryEvent.getEventID());
sessionContext.setRuleExecution(null);
}
@Override
public boolean isEventSupported(HistoryEvent historyEvent) {
return historyEvent instanceof AfterRuleFiredHistoryEvent;
}
}

Some files were not shown because too many files have changed in this diff Show more