Skip to content

Releases: j-easy/easy-rules

v4.1.0

06 Dec 21:37
702a368
Compare
Choose a tag to compare

This version is a minor release which comes with the following new features, enhancements and bug fixes:

New features

  • Issue #283: Add size method in Rules API
  • Issue #288: Update Rules#register / Rules#unregister methods to accept varargs
  • Issue #271: Add support for Apache JEXL

Bug fixes

  • Issue #291: Update RuleProxy to accept types implementing Comparable

Documentation

  • Issue #316: Update Javadoc about rule comparison
  • Issue #320: Document composite rules about their thread unsafety

I would like to thank all contributors who helped making this release possible!

v4.0.0

17 May 07:56
c9b31b0
Compare
Choose a tag to compare

This is a major release which is based on Java 8. This version comes with a number of new features and bug fixes (See detailed list below). Moreover, some breaking changes have been introduced to fix a couple of design inconsistencies in v3. Here are the major changes:

  • Introducing a new Fact domain concept which replaces the Map<String, Object> data structure used in v3. This new concept has a number of advantages like type safety, better encapsulation and a cleaner API.
  • MVEL/SpEL conditions now throw runtime exceptions instead of catching them and returning false. This makes it possible to correctly unit test conditions as well as listen to evaluation errors with a rule listener (a new method RuleListener#onEvaluationError has been introduced for this purpose).
  • SpEL conditions and actions should now use the #{ ... } template by default. This is configurable but it has been made the default to be consistent with Spring's default template parser.

Moreover, thanks to this major Java version upgrade, a lot of improvements have been introduced in the API (like using default methods in interfaces, adding @FunctionalInterface where appropriate, etc) as well as in the code base (using lambdas and streams where it made sense, using new reflection APIs introduced in Java 8, etc).

Here is the list of issues resolved in this release:

New features

  • issue #276: Add Fact concept
  • issue #250: Add a clear method in Facts API
  • issue #259: Add BeanResolver to SpELAction and SpELCondition

Bug fixes

  • issue #267: Facts#asMap should return an immutable map or a copy of the facts
  • issue #211: MVELCondition does not re-throw exceptions
  • issue #257: Inconsistent SpEL expression templating between SpELRule and SpELRuleFactory

Enhancements

  • issue #268: Improve Javadoc of Facts#iterator to mention that it should not be used to remove facts
  • issue #253: Add default methods in interfaces

I would like to thank all contributors who made this release possible by reporting issues, testing fixes, requesting features and participating in discussions: @readilychen, @elitacco, @snok3r, @AleksandrPalchuk, @turiandras, @Alexey1Gavrilov, @yunfengwang and @R-Gerard ! Thank you all for your contributions!

A special BIG thank you to @zhhaojie for following up on issues, helping in design discussions and all the time and effort put on Easy Rules!

Migration guide from v3 to v4

Moved APIs

The following APIs have been moved between packages for better cohesion:

  • RulesEngineParameters has been moved from package org.jeasy.rules.core to org.jeasy.rules.api
  • CompositeRule and its implementations (ActivationRuleGroup, UnitRuleGroup and ConditionalRuleGroup) have been moved from the root package org.jeasy.rules.support to a dedicated package org.jeasy.rules.support.composite
  • RuleDefinitionReader and its implementations (AbstractRuleDefinitionReader, YamlRuleDefintionReader and JsonRuleDefintionReader) have been moved from the root package org.jeasy.rules.support to a dedicated packageorg.jeasy.rules.support.reader

Action: Update import statements where the aforementioned classes are used

Removed APIs

For both MVEL and SpEL modules, the ParserContext is now passed to rules and rule factories at construction time. Hence, all overloaded methods where the parser context is passed as a parameter (which are now useless) have been removed:

  • Methods org.jeasy.rules.mvel.MVELRule.when(String, ParserContext) and org.jeasy.rules.mvel.MVELRule.then(String, ParserContext)
  • Methods org.jeasy.rules.mvel.MVELRuleFactory.createRule(Reader, ParserContext) and org.jeasy.rules.mvel.MVELRuleFactory.createRules(Reader, ParserContext)
  • Methods org.jeasy.rules.spel.SpELRule.when(String, ParserContext) and org.jeasy.rules.spel.SpELRule.then(String, ParserContext)
  • Methods org.jeasy.rules.spel.SpELRuleFactory.createRule(Reader, ParserContext) and org.jeasy.rules.spel.SpELRuleFactory.createRules(Reader, ParserContext)
  • Methods org.jeasy.rules.support.AbstractRuleFactory.createSimpleRule(RuleDefinition, ParserContext) and org.jeasy.rules.support.AbstractRuleFactory.createCompositeRule(RuleDefinition, ParserContext) do not take a ParserContext as parameter anymore.

Action: Pass the parser context at construction time (to the rule or the rule factory) and call new methods that do not take the parser context as parameter.

Changed APIs

Due to the introduction of the new Fact concept (issue #276), the following method signatures have been changed:

  • Facts#put(String, Object) does not return the previous associated value if any, the return type is now void
  • Facts#remove(String) does not return the removed fact anymore, the return type is now void
  • Facts#iterator now returns a Iterator<Fact> instead of Iterator<Map.Entry<String, Object>>

Actions:

  • Update the assigned variable type where those methods are called.
  • For Facts#put, since the previously associated value if any is not returned anymore, one can query the Facts API to see if there is a fact mapped for the given name before calling put.
  • ForFacts#remove, since the removed fact is not returned anymore, one can query the Facts API
    to get the fact before removing it.

v3.4.0

08 Dec 21:17
034f488
Compare
Choose a tag to compare

This is a minor release with a few enhancements and bug fixes:

Enhancements

  • Issue #221: RuleProxy can be speed up by caching reflective access
  • Issue #238: Make AbstractRulesEngine public
  • Issue #223: Remove DefaultRuleListener and DefaultRulesEngineListener

Bug fixes

  • Issue #239: RulesEngine listeners are not invoked when registered in an InferenceRulesEngine

Many thanks to all contributors for their help in this release!

❗️ Please note that this is the last release in the v3 line. Next version will be 4.0.0 and will be based on Java 8.

v3.3.0

25 Apr 21:32
Compare
Choose a tag to compare

This release is a minor version with the following changes:

Features and enhancements

  • #156: Add composite rule support from a rule descriptor file
  • #166: Change default log level to DEBUG
  • #197: Add support for parser context in MVEL conditions/actions
  • #202: Add support to read rules from JSON objects
  • #204: Add support for Spring Expression Language

Bug fixes

  • #157: RulesEngine#getListeners and RulesEngine#getRulesEngineListeners should return a unmodifiable list of listeners
  • #158: RulesEngine#getParameters should return a copy of the parameters
  • #165: Incorrect rule validation for non annotated fact parameters
  • #194: MVELAction does not re-throw exceptions
  • #203: ConditionalRuleGroup has wrong priority control

❗️ Heads-up: Even though this is a minor release, there is a small breaking change in the MVELRuleFactory API. It was not possible to introduce SpEL and JSON support without introducing this breaking change, and waiting for a major release (Java 8 baseline) did not make sense. Semantic versioning rules are not as easy to implement as Easy Rules 😄

Many thanks to @Jeff-Jia, @wuhaidu, @khaledabderrahim, @ramnaresh2051, @kayeight, @amitvj1 and @mr0815mr for their contributions to this release!

v3.2.0

09 Apr 21:17
Compare
Choose a tag to compare

This is the second maintenance release of the 3.x line. It introduces a new module called easy-rules-support. This module contains support classes that were in the easy-rules-core module. For instance, the org.jeasy.rules.core.CompositeRule has been moved to easy-rules-support as org.jeasy.rules.support.CompositeRule and made abstract. 3 implementations of composite rules are now provided out of the box:

  • UnitRuleGroup: All or nothing semantics (exactly the same as CompositeRule in previous versions)
  • ActivationRuleGroup: XOR logic, ie only one rule of the group will be triggered (issue #122)
  • ConditionalRuleGroup: A primary rule acts as a precondition to trigger the rule group (issue #130)

This release comes with other new features and some bug fixes:

Features

  • Issue #96: Set priority through @Rule annotation
  • Issue #133: Read YAML rule descriptor from a String
  • Issue #138: Load multiple rules from a single yaml file

Bug fixes

  • Issue #139: NPE If a null Fact is injected through annotation
  • Issue #143: Proxy toString() is not equal to original object toString()
  • Issue #141: NPE in MVELRuleDefinitionReader if rule name, description or priority is not specified

Deprecations

  • Issue #145: Deprecate MVELRuleFactory#createRuleFrom(java.io.File). A new method that takes a java.io.Reader is to be used instead to be able to read rules not only from files (with a FileReader), but also from Strings (with a StringReader) or any other reader implementation.
  • Issue #122: org.jeasy.rules.core.CompositeRule is deprecated. It has been moved to the new easy-rules-support module and is now abstract.

I would like to thank @dagframstad, @danrivcap, @bpoussin and @paulbrejla for their contributions to this release.

v3.1.0

18 Dec 10:55
Compare
Choose a tag to compare

This release is another important milestone for Easy Rules! We finally managed to get some long awaited features out 😄

The major additions of v3.1 are:

  • New inference rules engine
  • New Condition, Action and RuleBuilder APIs
  • Support for using expression language to define rules

This release has also introduced a lot of API improvements thanks to some amazing contributors! Here is the full list of changes:

Features:

  • issue #36: Use Expression Language to define rules
  • issue #88: Add inference rules engine
  • issue #113: Use SLF4J instead of java.util.logging
  • issue #121: Add rules engine listener
  • issue #119: Add Condition / Action APIs

Bug fixes:

  • issue #91: Log performance in silent mode
  • issue #100: Rule proxy's equals return unexpected result

Enhancements

  • issue #123: cast friendly Facts
  • issue #118: Use toString() to print engine parameters
  • issue #111: Remove unnecessary method and interface
  • issue #115: Override equals()/hashCode()/toString() same as BasicRule
  • issue #104: [subFacts]: Conditions or Actions can have subclass of Facts as parameter
  • issue #95: Improve the Facts api
  • issue #94: A little optimization in RuleProxy.java

Deprecations

  • issue #126: Deprecate RulesEngineBuilder
  • issue #91: Methods RulesEngineParameters#setSilentMode and RulesEngineParameters#isSilentMode as well as constructors taking silentMode parameter

I would like to thank @wg1j, @sanmibuh, @shivmitra, @cemo and @khandelwalankit for their contributions!

v3.0.0

30 May 21:06
Compare
Choose a tag to compare

This is a big milestone for Easy Rules since the beginning! v2.x was a successful line but we must admit it suffered from a couple of design decisions:

  1. Rules were designed to encapsulate data (BOM) they operate on. This works fine, but is not very friendly to concurrent threads
  2. The rules engine was designed to encapsulate the set of rules it operates on. For the same reason as 1) , this make the engine not thread safe

v3 is finally here to fix these issues! Please find below the most important changes and additions.

Important notes about v3

  • Easy Rules is now part of the jeasy project. Hence, the maven's groupId has changed from org.easyrules toorg.jeasy

  • Online documentation has been moved from www.easyrules.org to the wiki of the github project. The www.easyrules.org site will be shutdown on 31/07/2017.

  • Gitter chat room has been moved from https://gitter.im/easyrules/easyrules to https://gitter.im/j-easy/easy-rules

Major changes

  • issue #37 : Add working memory abstraction through the Facts API
  • issue #86 : Add rules set abstraction through the Rules API
  • issue #87 : Add @Fact annotation to inject facts in conditions and actions methods of rules

The DefaultRulesEngine class is now public. Keys APIs (Rule, RulesEngine and RuleListener) have been updated to accept Rules and Facts in their methods signatures. Please refer to the javadoc for all details about these changes.

Deprecations

  • issue #79 : deprecate rules engine name parameter
  • issue #74 : remove spring support that was deprecated in v2.5
  • issue #75 : remove quartz support that was deprecated in v2.5

This release would not have been possible without the help of some awseome contributors! We are grateful to all of them! Thank you for your time and effort.

v2.5.0

18 May 21:08
Compare
Choose a tag to compare

This is the latest version in v2.x line. It adds the following features and bug fixes:

Features

  • issue #64 : Add ability to unregister a rule by name
  • issue #65 : Add Spring Boot Starter for Easy Rules
  • issue #72 : Add ability to get notified with rule evaluation result in the RuleListener API

Fixed bugs

  • issue #66 : Core annotations are not inherited in child classes
  • issue #68 : @SpringRule annotation is not inherited in child classes

In this version, support for Spring and Quartz has been deprecated and will be removed in v3.0.

Many thanks to @khandelwalankit, @cogito-clarus, @careerscale, @cgonul, @pklovesbacon and @yisraelU for reporting issues and testing fixes.

A special thank to @andersonkyle for adding a spring boot starter to easy rules!
A big thank goes to @will-gilbert for implementing easy rules tutorials with groovy!

v2.4.0

08 Feb 23:48
Compare
Choose a tag to compare

This is a minor release with the following changes:

Features

  • issue #52: add skipOnFirstNonTriggeredRule parameter

Bug fixes

  • issue #57: incorrect sorting of rules when BasicRule.getPriority method is overridden

Enhancements

  • issue #63: Utils class should not be public

Deprecations

  • issue #47: JMX support has been deprecated in v2.3 and removed in this version

Many thanks to all contributors, especially @toudidel and @spearway and @JurMarky, for reporting issues, fixing bugs and implementing features.

v2.3.0

24 Aug 21:23
Compare
Choose a tag to compare

New features

  • issue #34 : add method beforeEvaluate in RuleListener
  • issue #39 : add method getListeners in RulesEngine to get registered listeners
  • issue #40 : add method checkRules in RulesEngine to check rules without firing them
  • issue #41 : add possibility to create composite rules from annotated rules

Fixed bugs

  • issue #32 : unable to use Easy Rules in android due to JMX
  • issue #38 : unable to set rules engine name in spring factory bean

Improvements

  • issue #46 : improve JUL log record format

Deprecation

  • issue #47 : deprecate JMX managed rules and rules engine