dvare rules

A Light weight Java business rule engine.

License

License

GroupId

GroupId

org.dvare
ArtifactId

ArtifactId

dvare-rules
Last Version

Last Version

1.1
Release Date

Release Date

Type

Type

jar
Description

Description

dvare rules
A Light weight Java business rule engine.
Source Code Management

Source Code Management

https://github.com/dvare/rules.git

Download dvare-rules

How to add to project

<!-- https://jarcasting.com/artifacts/org.dvare/dvare-rules/ -->
<dependency>
    <groupId>org.dvare</groupId>
    <artifactId>dvare-rules</artifactId>
    <version>1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.dvare/dvare-rules/
implementation 'org.dvare:dvare-rules:1.1'
// https://jarcasting.com/artifacts/org.dvare/dvare-rules/
implementation ("org.dvare:dvare-rules:1.1")
'org.dvare:dvare-rules:jar:1.1'
<dependency org="org.dvare" name="dvare-rules" rev="1.1">
  <artifact name="dvare-rules" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.dvare', module='dvare-rules', version='1.1')
)
libraryDependencies += "org.dvare" % "dvare-rules" % "1.1"
[org.dvare/dvare-rules "1.1"]

Dependencies

compile (5)

Group / Artifact Type Version
org.dvare : dvare-framework jar 2.2-SNAPSHOT
junit : junit jar 4.11
org.slf4j : slf4j-api jar 1.7.7
org.slf4j : slf4j-log4j12 jar 1.7.7
org.apache.commons : commons-lang3 jar 3.4

provided (2)

Group / Artifact Type Version
org.springframework : spring-beans jar 4.3.9.RELEASE
org.springframework : spring-context jar 4.3.9.RELEASE

Project Modules

There are no modules declared in this project.

Dvare Rules

A Light weight Java business rule engine.

Current version

  • The current stable version is 1.1 : Maven Central
  • The current snapshot version is 1.2-SNAPSHOT : Build Status In order to use snapshot versions, you need to add the following maven repository in your pom.xml:
<repository>
    <id>ossrh</id>
    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>

Maven dependency:

<dependencies>
        <dependency>
            <groupId>org.dvare</groupId>
            <artifactId>dvare-rules</artifactId>
            <version>1.1</version>
        </dependency>              
</dependencies>

Example

@Rule(name = "Dvare Rule")
public class DvareRule {
    private static Logger logger = Logger.getLogger(DvareRule.class);

    @Before
    public void beforeCondition() {
        logger.info("Before Condition ");
    }
    
    @Condition
    public boolean condition(@Fact("rule") String rule, @Fact("person")Person person,
                   @RuleEngineType DvareRuleEngine textualRuleEngine) throws InterpretException {
        return textualRuleEngine.register(rule, Person.class, person);
    }

    @After
    public void afterCondition() {
        logger.info("After Condition ");

    }

    @Success
    public void success() {
        logger.info("Rule Successfully Run");
    }

    @Fail
    public void fail() {
        logger.error("Rule Failed");
    }
}  


public class DvareRuleExample {
    private static Logger logger = Logger.getLogger(DvareRule.class);
    
     public static void main(String args[]) throws IllegalRuleException {
 
         Person male = new Person();
         male.setAge(25);
         male.setGender("Male");
         male.setTitle("Mr");
 
         Facts facts = new Facts();
         facts.add("rule", "age between [ 20 , 30 ] And title = 'Mr' And gender = 'Male'");
         facts.add("person", male);
         RuleEngine ruleEngine = new RuleEngineBuilder().facts(facts).build();
 
         DvareRule dvareRule = new DvareRule();
 
         ruleEngine.registerRule(dvareRule);
         ruleEngine.fireRules();
         boolean result = ruleEngine.getResult(dvareRule).getResult();
         System.out.println(result);
     }  
}

License

Dvare rules is released under the MIT license.

The MIT License (MIT)

Copyright (c) 2016-2017 DVARE (Data Validation and Aggregation Rule Engine)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Sogiftware.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
org.dvare

DVARE

Lightweight business rule framework

Versions

Version
1.1