Compare commits

..

2 commits

Author SHA1 Message Date
nheron
e8c4413874 WIP migrate to Kotlin 2025-04-29 07:50:02 +02:00
c70afb8e53 Update kotlin version 2025-04-18 19:22:41 +02:00
19 changed files with 308 additions and 455 deletions

View file

@ -129,4 +129,4 @@ public class FactHandlerListener implements RuleRuntimeEventListener {
}
}
}
}

View file

@ -7,7 +7,6 @@ import org.chtijbug.drools.entity.history.fact.DeletedFactHistoryEvent;
import org.chtijbug.drools.entity.history.fact.InsertedFactHistoryEvent;
import org.chtijbug.drools.entity.history.fact.UpdatedFactHistoryEvent;
import org.chtijbug.drools.runtime.*;
import org.chtijbug.drools.runtime.listener.HistoryListener;
import org.junit.*;
/**

View file

@ -1,27 +0,0 @@
/*
* 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

@ -1,65 +0,0 @@
/*
* 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

@ -1,83 +0,0 @@
/*
* 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

@ -1,48 +0,0 @@
/*
* 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

@ -1,69 +0,0 @@
/*
* 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

@ -1,69 +0,0 @@
/*
* 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

@ -1,84 +0,0 @@
/*
* 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

@ -1,9 +1,10 @@
package org.chtijbug.drools.entity.history
import org.chtijbug.drools.runtime.DroolsChtijbugException
import java.io.Serializable
import java.util.*
open class HistoryEvent {
open class HistoryEvent : Serializable{
val serialVersionUID: Long = -6640538290066213804L
var dateEvent: Date? = null
@ -30,4 +31,4 @@ open class HistoryEvent {
enum class TypeEvent {
Fact, Rule, BPMN, RuleFlowGroup, KnowledgeBaseSingleton, Session
}
}
}

View file

@ -0,0 +1,6 @@
package org.chtijbug.drools.entity.history
import java.io.Serializable
interface KnowledgeResource : Serializable {
}

View file

@ -0,0 +1,44 @@
package org.chtijbug.drools.entity.history.fact
import org.chtijbug.drools.entity.DroolsFactObject
import java.util.*
class DeletedFactHistoryEvent : FactHistoryEvent {
private var deletedObject: DroolsFactObject? = null
/**
*
*/
constructor() {
}
constructor (eventID: Long?, deletedObject: DroolsFactObject, ruleBaseId: Long?, sessionId: Long?) :super(eventID, Date(), ruleBaseId, sessionId){
this.deletedObject = deletedObject
}
fun getDeletedObject(): DroolsFactObject {
return deletedObject!!
}
fun setDeletedObject(deletedObject: DroolsFactObject) {
this.deletedObject = deletedObject
}
override fun toString(): String {
val str = 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 (foa in deletedObject!!.getListfactObjectAttributes()) {
str.append("- " + foa.attributeType + " " + foa.attributeName + "=" + foa.attributeValue + "\n")
}
return str.toString()
}
}

View file

@ -0,0 +1,51 @@
package org.chtijbug.drools.entity.history.fact
import org.chtijbug.drools.entity.history.HistoryEvent
import java.util.*
open class FactHistoryEvent : HistoryEvent {
private var ruleName: String? = null
private var rulePackageName: String? = null
private var ruleflowGroup: String? = null
/**
* Mandatory for GWT Serialization
*/
constructor() {
}
constructor(eventID: Long?, dateEvent: Date?, ruleBaseId: Long?, sessionId: Long?) : super(eventID, dateEvent, TypeEvent.Fact){
this.ruleBaseID = ruleBaseId
this.sessionId = sessionId
}
fun getRuleName(): String? {
return ruleName
}
fun setRuleName(ruleName: String?) {
this.ruleName = ruleName
}
fun getRulePackageName(): String? {
return rulePackageName
}
fun setRulePackageName(rulePackageName: String?) {
this.rulePackageName = rulePackageName
}
fun getRuleflowGroup(): String? {
return ruleflowGroup
}
fun setRuleflowGroup(ruleflowGroup: String?) {
this.ruleflowGroup = ruleflowGroup
}
}

View file

@ -0,0 +1,27 @@
package org.chtijbug.drools.entity.history.fact
import java.util.*
class InsertedByReflectionFactEndHistoryEvent : FactHistoryEvent {
constructor() {
}
constructor(eventID: Long?, ruleBaseId: Long?, sessionId: Long?) :super(eventID, Date(), ruleBaseId, sessionId){
}
/*
* (non-Javadoc)
*
* @see org.chtijbug.drools.entity.history.HistoryEvent#toString()
*/
override fun toString(): String {
val str = StringBuilder()
str.append(super.toString() + "\n")
str.append("End InsertBuReflectionEndHistoryEvent\n")
return str.toString()
}
}

View file

@ -0,0 +1,52 @@
package org.chtijbug.drools.entity.history.fact
import org.chtijbug.drools.entity.DroolsFactObject
import java.util.*
class InsertedByReflectionFactStartHistoryEvent : FactHistoryEvent {
private var topObject: DroolsFactObject? = null
constructor() {
}
constructor(
eventID: Long?,
topObject: DroolsFactObject?,
ruleBaseId: Long?,
sessionId: Long?
) : super(eventID, Date(), ruleBaseId, sessionId){
this.topObject = topObject
}
fun getTopObject(): DroolsFactObject? {
return topObject
}
fun setTopObject(topObject: DroolsFactObject?) {
this.topObject = topObject
}
/*
* (non-Javadoc)
*
* @see org.chtijbug.drools.entity.history.HistoryEvent#toString()
*/
override fun toString(): String {
val str = 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 (foa in topObject!!.getListfactObjectAttributes()) {
str.append("- " + foa.attributeType + " " + foa.attributeName + "=" + foa.attributeValue + "\n")
}
}
return str.toString()
}
}

View file

@ -0,0 +1,49 @@
package org.chtijbug.drools.entity.history.fact
import org.chtijbug.drools.entity.DroolsFactObject
import java.util.*
class InsertedFactHistoryEvent : FactHistoryEvent {
private var insertedObject: DroolsFactObject? = null
constructor() {
}
constructor(
eventID: Long?,
insertedObject: DroolsFactObject,
ruleBaseId: Long?,
sessionId: Long?
) :super(eventID, Date(), ruleBaseId, sessionId){
this.insertedObject = insertedObject
}
fun getInsertedObject(): DroolsFactObject {
return insertedObject!!
}
fun setInsertedObject(insertedObject: DroolsFactObject) {
this.insertedObject = insertedObject
}
/*
* (non-Javadoc)
*
* @see org.chtijbug.drools.entity.history.HistoryEvent#toString()
*/
override fun toString(): String {
val str = 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 (foa in insertedObject!!.getListfactObjectAttributes()) {
str.append("- " + foa.attributeType + " " + foa.attributeName + "=" + foa.attributeValue + "\n")
}
return str.toString()
}
}

View file

@ -0,0 +1,69 @@
package org.chtijbug.drools.entity.history.fact
import org.chtijbug.drools.entity.DroolsFactObject
import java.util.*
class UpdatedFactHistoryEvent : FactHistoryEvent {
private var objectOldValue: DroolsFactObject? = null
private var objectNewValue: DroolsFactObject? = null
/**
*
*/
constructor() {
}
constructor(
eventID: Long?,
objectOldValue: DroolsFactObject,
objectNewValue: DroolsFactObject,
ruleBaseId: Long?,
sessionId: Long?
) :super(eventID, Date(), ruleBaseId, sessionId){
this.objectOldValue = objectOldValue
this.objectNewValue = objectNewValue
}
fun getObjectNewValue(): DroolsFactObject {
return objectNewValue!!
}
fun setObjectNewValue(objectNewValue: DroolsFactObject) {
this.objectNewValue = objectNewValue
}
fun getObjectOldValue(): DroolsFactObject {
return objectOldValue!!
}
fun setObjectOldValue(objectOldValue: DroolsFactObject) {
this.objectOldValue = objectOldValue
}
override fun toString(): String {
val sb = 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 (foa in objectOldValue!!.getListfactObjectAttributes()) {
sb.append("- " + foa.attributeType + " " + foa.attributeName + "=" + foa.attributeValue + "\n")
}
sb.append(", objectNewValue=").append(objectNewValue)
sb.append("version Object : " + objectNewValue!!.getObjectVersion() + "\n")
sb.append("attributes :\n")
for (foa in objectNewValue!!.getListfactObjectAttributes()) {
sb.append("- " + foa.attributeType + " " + foa.attributeName + "=" + foa.attributeValue + "\n")
}
sb.append('}')
return sb.toString()
}
}

View file

@ -6,9 +6,9 @@ import java.io.Serializable
interface HistoryListener : Serializable {
@Throws(DroolsChtijbugException::class)
open fun fireEvent(newHistoryEvent: HistoryEvent?)
fun fireEvent(newHistoryEvent: HistoryEvent?)
open fun withDetails(): Boolean
fun withDetails(): Boolean
open fun setDetails(details: Boolean?)
}
fun setDetails(details: Boolean?)
}

View file

@ -41,7 +41,7 @@
<postgres.version>42.2.8</postgres.version>
<postgresql.version>42.2.8</postgresql.version>
<activemq.version>5.15.10</activemq.version>
<kotlin.version>1.9.25</kotlin.version>
<kotlin.version>2.1.0</kotlin.version>
</properties>
@ -199,4 +199,4 @@
<tag>HEAD</tag>
</scm>
</project>
</project>