GDPR Architects Executive Summary Architects Plans Testing

Dynamic Business Rules
We have two versions of Dynamic Business Rules (DBR), a Quick Fix and an Intelligent Dynamic Business Rules (IDBR). Our attempt is to briefly present both in the web page.

Quick Fix Dynamic Business Rules (DBR):
DBR is done by utilizing:

       • Properties files
       • Token Drive code
       • Lookup text files
       • Dictionary text files
       • Constant Java Classes

Intelligent Dynamic Business Rules (IDBR):
IDBR is an Intelligent framework which manages both static and dynamic business rules, and it also learns as it goes. Tracking and statistics are the main ingredients for IDBR to think in abstract. For example, if a client's bank account was compromised 9 times out of last 10 transaction. Then the chance of being compromised again is 90% and the security rules and handling must be raised to higher security level. Image #1 is the architect diagram for IDBR.

Dynamic Business Rules Architect
Dynamic Business Rules Architectฎ

Use Case:
              Dynamic Business Rules

Rules by definition can be one of the following: System, Policies, Regulations, Set of Laws, Convention, or simply what to do and what not to do. The Business Rules can be an ocean of constraints of what we just mentioned. Now, Dynamic Business Rules are definitely more complex than just Business Rules.

How can such rules be implemented to prevent constant and unmanageable changes to a running application.
How can a system admin adjust a running application by only updating a number of text files.

Briefly Describe This Use Case
In a nutshell, the following are the points which must be addressed:

• How Dynamic Business Rules would be implemented in a software system?
• How can Dynamic Business Rules be converted into a framework of Java code, database tables, files (text, XML, properties files, spreadsheet), web services and as well as interfacing with other systems such as Legacy systems?
• How to integrate such a framework into any Java system?
• How can non-technical administrators run such a framework without any knowledge of Java, XML, SQL, or any of the IT jargons?
• How to make such a framework intelligent where it makes decisions (dynamically)?

Primary Actor:
Running applications, admin and admin GUI tools.

Different businesses have different rules and finding a common set of rules would be difficult and may not be the best answer. Instead of finding common rules, we architected a number of tools and Java classes which are the basis for any dynamic business rules implementation.

Any running application needs dynamic data to make decisions. The source of data are Constant variables, Database, text file, system properties, properties files, XML files, .. etc and also the users input. Our question here is how to make these data accessible and dynamic without an overhead of time, code, access, .. etc. How to update such data without rewriting the application code.

Quick Fix Dynamic Business Rules (DBR):
Let us say we are parsing a resume (CV) of an Information Technology (IT) Engineer stored in text files. We need a file of tokens representing the IT buzzwords such as Java, Tomcat, cloud, ..etc.
The following are steps or processes our parser would perform:

Processes Rule Name Rule ID
Load IT token buzzwords in arrays of tokens LOAD_TOKENS 1000
Load the scores of all buzzword form score file (score can changes base on the job requirement) LOAD_SCORES 2000
Parse the files looking name, address, phone. email CONTACT_INFO 3000
Make a decision if the applicant is local resident LOCAL_YES_NO 4000
Search for each buzzword and keep the count BUZZ_COUNT 5000
Add all the score DECISION_SCORES 6000
Make an educated guess using the resume buzzword on what are the IT candidates main tasks TOTAL_SCORE 7000
Made a decision on all parsing DECISION_SCORES 8000

The business rules for this processes can be store in a properties file as:


As for the Business Rule Implementation using Java "for" loop and "switch" statement:

              switch (score)
                            case LOAD_TOKENS_1000:
                                          ... // all the Java method calls to perform such task
                            case LOAD_SCORES _2000:
                                          ... // all the Java method calls to perform such task

The sequence of the steps can by simply be changed by rearranging the string of tokens sequence in the properties file.

Intelligent Dynamic Business Rules (IDBR):
Our architect image is the the view from 2,000 feet, where we are presenting the relationships between the following:

• Applications
• Rules Manager & DataObjects(DO)
• Rules Loaders
• Rules Storage

Dynamic Business Rules Architect

They can be considered as tiers or Java packages with sub-packages. Each has specific roles to play. They are loosely coupled for reusability, modification and portability. We are creating a framework for our architect which can be integrated into any Java system. The framework can be integrated into and run on any application server with hardly any changes to it.

Static & Dynamic Sections
The goal is to build a framework which runs without any modification unless there are bugs or new static processes are required. We architected it with the following:

• Static Sections
• Dynamic Sections

Static Sections:

• It has all the static processes
• Each process has Functional, Structural and Miscellaneous methods
• Each method does its job with the help of a set of Business Rules DataObjects
• Business Rules DataObject has the information and the directions of what to do with the data it contains

Dynamic Sections:

• A Products-Service is composed of a number static processes IDs - a map of processes IDs
• Such a Product-Service map is created and modified by the System Administrators (outside our framework) and placed into Properties file, XML file, spreadsheets, database tables, or web services (outsiders - different companies)
• The Product-Service map of IDs is used by our framework to store a number of static processes into a map of processes for our framework to execute
• Business Rules DataObjects are populated from the Properties files, XML files, database tables, or web services (different companies)
• Business Rules DataObjects are used by our framework map of processes to run the Functional, Structural and Miscellaneous methods
• The Functional, Structural and Miscellaneous methods also calculate Weight-Score for both Validation and Decision Maker to perform their tasks
• Both Validation and Decision Maker have their own DataObjects that provide the dynamic data and guidelines for them to do their job (dynamically)
• Their output are stored and also used by the statistics package to perform the rules statistics, create reports and system performance
• The JAXB is used to validate any rules from an outsider
• The Exception Handlers will be provided with DataObjects that provide the dynamic data and guidelines for them to do their job (dynamically)

Our Dynamic Business Rules for Our Credit Repair Project
Rules Types and Real World Rules Example - TransUnion (FFI)
To make sense out of what we are presenting, we are using a real world example of TransUnion Business Rules for Fixed Format Inquiry (FFI). FFI is basically a web request to TransUnion to get a service. FFI is composed of a fixed number of segments. One of the TransUnion FFI (Auto Loan) requires the following (rules):

• All segments in the Fixed Format Inquiry (FFI) have a fixed length and segment type
• All FFI data, except for User Reference data, must be in UPPER CASE format.
• The most important of these is that each FFI must begin with a TU4I (Transaction Control)
• Segments must end with an END1 segment.
• Auto Loan Segment specifies the amount of the loan. The amount appears in whole dollar amount (for example, an amount of $160,000 is specified as 000160000).

The above is basically a service (dynamic) and it has rules. We broke all these rules into business processes (static). Each business process does one or more rule. For example, we created a process called


which will check for the start (TU4I) and the end (END1) segments and length of FFI request. This process is a Structural Rule Type (Have or Is). We also created another process called the "TU_FFI_AutoLoansProcess" which will place the amount of loan as specified, add the creditor information and submit such data with FFI request in the proper segment. This process is a functional (Can Do).

We basically categorize Rules Types as follows:

Rule Type Definition Examples
Static Done at coding time Business Processes
Dynamic Loaded at run time Products or Services
Structural Have or Is Start Date, End Date, MIN, MAX, STATE_DEPENDANT
Functional Can Do Calculation, Authentication, Conversion
Miscellaneous None of the above Application dependent

We are simplifying the rules into these types so we can build on them the more complex rules. We are breaking them into the following:

• Rules are design to service the companies' Products and Services.
• Products and Services are composed of Business Processes.
• Business Processes implements the rules. Therefore Business Processes are static. They do actions or check for Having or Is.
• Products and Services are dynamic, since Products and Services may change to handle customers demands or handle requests.
• Products and Services may change their static processes to do different actions or different check for Having or Is.

Our example of the TransUnion Business Rules may have different segments to handle different FFI where each segment is static by design.

Rules Storage
Our framework deals with technical, non-technical personals, databases, properties-text files, spreadsheets, XML files, other systems including legacy systems or any interfaces that use our output or provide us with input. Therefore, the data, types of data, data format and the data location should be considered in our framework handling. Therefore, we need to ask:

• Storage types?
• What are we storing?
• Who is handling what?

Storage types:

• Properties files - Framework
• XML files - Web Services & JAXB - outsiders input
• Database
• XML & Text files (Properties files), Spreadsheets - Legacy Systems or outsiders input

What are we storing?

Type Storage Media Examples
Map of all the Business Processes name and their IDs Properties file, database # ========================================================
# TransUnion PROCESS list and index value
# ========================================================
# ========================================================
# ========================================================
# Disabling Business Rules by setting to negative One (-1)
# ========================================================
Product or Services Processes Map Properties file, database # ========================================================
# TransUnion Process Names List for Auto Loans
# ========================================================
# ========================================================
Structural Rules -Index of action Properties file, database, XML files MIN=2001
Functional Rules - Index of action Properties file, database, XML files Calculation=25001
Miscellaneous Rules - Index of action Properties file, database, XML files Application dependent

Who is handling what?

Who What Handling
Developers Coding static processes
Implementing Business Rules in the static process
Creating Processing name and processes ID map (properties file or database)
Creating actions name and actions ID map (properties file or database)
Fixing bugs
Adding functionalities to the framework
Business Processes
System Administrators Creating and modifying Products-Services files (properties or database) with the required names of processes (static) needed for the specified Products-Services.
Creating and modifying the required data that will be stored in the data objects required by the Products-Services (processes) and store them in the database tables
Creating and modifying Products-Services files (properties or database) with the actions names that will be stored in the data objects required by the Products-Services (processes).
Products or Services
Outsiders Creating Products-Services files (properties, spreadsheets or XML) with the required names of processes (static) needed for the specified Products-Services. Products or Services
Java Collections Hashtable or HashMap<String, Integer> Process Name ID HashTable or HashMap
HashSet<Structural Processes Rule DO>
HashSet<Functional Processes Rule DO>
HashSet< Misc Processes Rule DO>
Map<Integer, TransUnion Rule Processes>HashMap
Map<Integer, Set> Structural Rules DO HashMap
Map<Integer, Set> Functional Rules DO HashMap
Map<Integer, Set> Misc Rules DO HashMap
Mapping products, serivecs, processes, data and actions to their proper ID (index)

Using Index and not String Names
Indexing is the Way-To-Go. Sadly to say we oppose using string as an ID and we are bias toward index. Therefore, we will present our bias view and leave our readers to decide for themselves. The following table is our attempt to shade some light on our views:

Issue Using String Using Index Comments
Different languages Bad Good Same index can be used with different language and mapping can be done to accommodate different languages
Abbreviation Bad N.A. Abbreviation may cause confusion and hard to trace
Meaning changes Bad N.A. Meaning of word may lead to confusion, constant changes and hard to trace
Mapping Good Excellent Mapping index is a lot easier than mapping string
Different industries with different names OK Excellent Same index can be mapped to different industries plus index may be composed of sub index to differentiate
Duplicate names Bad N.A. A serious issue when using string and specially in maintenance
Duplicate Values Bad Bad Index should be designed and used with restrictions so no hard coding is done; only constants are used
Comparison Good Excellent Faster and easier with index
Hashing OK N.A. Hashing string requires extra code and process time
Too many names may get to be ambiguous Bad Bad Same problem for both
Developers have the tendency to hard code Bad N.A. A serious issue when using string and specially in maintenance
Developers have the tendency to abbreviate Bad N.A. A serious issue when using string and specially in maintenance
Maintenance issues Bad Not Good Architect-design and management issues
Database table index OK Excellent Faster and easier with index
Used in loops OK Excellent Faster and easier with index
Comparison =, < , >, negative values OK Excellent Faster and easier with index
Ranges N.A. Excellent Faster and easier with index
switch statements for easy processing N.A. Excellent Faster and easier with index
No limit on the numbering and indexing N.A. Excellent Faster and easier with index
Index is easy to change N.A. Excellent Faster and easier with index
Index and sub-index N.A. Excellent Faster and may not be easier with index
Memory storage OK Good Index requires less memory space
Java Collections OK Good Hashtable or HashMap<String, Integer> Process Name ID HashTable or HashMap
HashSet<Structural Processes Rule DO>
HashSet<Functional Processes Rule DO>
HashSet< Misc Processes Rule DO>
Map<Integer, TransUnion Rule Processes>HashMap
Map<Integer, Set> Structural Rules DO HashMap
Map<Integer, Set> Functional Rules DO HashMap
Map<Integer, Set> Misc Rules DO HashMap

Using Java Collections and Synchronization
Data Structure is the basis for any framework. Data and data flow will be using such data structure; therefore data structure is a crucial step in building our system. HashMap (Java Collections) and HashTable implement the Map interface. These are best all-around implementation of the Map interface. Hashtable is synchronized, but HashMap is not synchronized. Synchronizing the HashMap is typically accomplished by synchronizing on some object that naturally encapsulates the map. If no such object exists, the map should be "wrapped" using the Collections.synchronizedMap method. This is best done at creation time, to prevent accidental unsynchronized access to the map:

               Map mySynchronizedHashMap = Collections.synchronizedMap(new HashMap(...));

The following table will present a quick view of what Java Collections can provide as a data structure plus a comparison to use Java Collection for our processes, products-services, indexing and mapping:

Feature Null Key No Yes N.A. Map permits the null Key, Hashtables does not
Null value No Yes Yes Map and Set permit the null element (value), Hashtables does not
Synchronized Yes No No Synchronization Wrappers:
     synchronizedCollection(Collection<T> c);
     synchronizedSet(Set<T> s);
     synchronizedList(List<T> list);
     synchronizedMap(Map<K,V> m);
iterator -Fail-safe No Yes Yes iterator in the HashMap and Set are fail-safe but the enumerator for the Hashtable isn't. If you change the map while iterating, you'll know - ConcurrentModificationException.
cannot contain duplicate elements Yes No No A Map is an object that maps keys to values. A map cannot contain duplicate keys. Each key can map to at most one value. It models the mathematical function abstraction. Set is a collection that cannot contain duplicate elements.
cannot contain duplicate keys No No N.A. No duplicate keys are allowed
Traversing - looping Yes Yes Yes Map allows you to iterate over keys, values, or key-value pairs; Hashtable does not provide the third option.

Java Collections and their implementation are ideal for our framework. Looking at our architect, we have the following:

• Process name and Process ID - HashMap or HashTable - We choose HashTable since we do not want null values or keys for processes names and IDs.
• Products-Services are used to map processes -HashMap
• DataObjects are grouped in a set with no duplicate - HasSet
• Index can use Integer as Key and the Value can be any of the above (HasSet, HashMap or HashTable)
• The output (DataObjects) of DecisionMaker can be stored in an ArrayList where statistic packages can do its tasks and store the result in the database.

Enabling and Disabling Business Rules
Enabling and Disabling Business Rules is a critical feature in any dynamic system. The cost or the effort of Enabling and Disabling Business Rules is also critical.
In our framework, System Administrators can Enabling and Disabling Business Rules by simply editing and changing properties file (the database table or the XML files) and setting the Process Name-Index to a negative one (-1 or any specified index).

               # ========================================================               
               # Disabling Business Rules by setting to negative One (-1)
               # ========================================================

We did illustrate that in the "What are we storing?" section for the "" file, in our TransUnion FFI example.
The handing of Enabling and Disabling Business Rules (ON-OFF - process ID) in the Java is done with the Java switch statement and the default part of the Java switch statement is responsible for the "OFF" handling as follows:

     while (localEnumeration.hasMoreElements())
               String processNameKey = (String)localEnumeration.nextElement();
               String static_processNameKey = dynamic_processRulesNameKeyListHashTable.get(processNameKey);
               Integer processID = (Integer)static_processNameIndexValuetHashTable.get(static_processNameKey);
               int processIndex = processID.intValue();

                              case Constants.TU_FFI_SEGMENT_START_END_LENGTH_PROCESS_INDEX:
                                             classTU_ProcessesHashMap.put(processID, new TU_FFI_SegmentStartEndLengthProcess());
                                             Set localStructuralProcessesRuleDOHashSet = passedBusinessRulesManager.getStructuralProcessesRuleDOset(processIndex);
                                             Set localFunctionalProcessesRuleDOHashSet = passedBusinessRulesManager.getFunctionalProcessesRuleDOset(processIndex);
                                             Set localMiscellaneousProcessesRuleDOHashSet = passedBusinessRulesManager.getMiscellaneousProcessesRuleDOset(processIndex);
                                             classTU_SetOfProcessesStructuralRulesDO_HashMap.put(processID, localStructuralProcessesRuleDOHashSet);
                                             classTU_SetOfProcessesFunctionalRulesDO_HashMap.put(processID, localFunctionalProcessesRuleDOHashSet);
                                             classTU_SetOfProcessesMiscellaneousRulesDO_HashMap.put(processID, localMiscellaneousProcessesRuleDOHashSet);
                                             // handing the OFF of the processes

JAXB and Validation
JAXB is the ideal choice to handle the web services specially if the Products-Services can be created by an outsider or another company branch. JAXB has the validation to insure that the Products-Services is consistent with existing processes.
Our attempt with the following tables is to illustrate how adding Home-Address to the TransUnion FFI would be requested by an outside company. The company would create the Schema and XML files as shown in the first table (Schemas and XML Document). JAXB will create proper DataObject with the values from the XML document as shown in DataObject, Process-Index Map and Constants table. Our framework will be using the DataObject to do the following:

• Map the process name to and index (ADD_HOME_ADDRESS_FUNCTION_ACTION=3001).
• Such an index will be parsed within a switch statement to perform the (ADD_HOME_ADDRESS_FUNCTION_ACTION_INDEX.) process.
• The process will be use the DataObject's private String nameValuePair ("name=Sam Eldin;street=123 SamEldin Street;city=Java Valley;state=ILL;zip=60192") to add the address to the FFI proper segment.
ruleName and rulesType will guide the process in performing it tasks.

<xsd:schema xmlns:xsd="">
<xsd:element name="TU_FFI_HOME_ADDRESS_PROCESS" type="DynamicBusinessRulesType"/>
     <xsd:complexType name="DynamicBusinessRulesType">
               <xsd:element name="HOME_ADDRESS" type="USAddress"/>
               <xsd:element name="FUNCTION_ACTION" type="xsd:string" minOccurs="1"/>
     <xsd:complexType name="USAddress">
               <xsd:element name="name" type="xsd:string"/>
               <xsd:element name="street" type="xsd:string"/>
               <xsd:element name="city" type="xsd:string"/>
               <xsd:element name="state" type="xsd:string"/>
               <xsd:element name="zip" type="xsd:decimal"/>
<?xml version="1.0"?>
               <name>Sam Eldin</name>
               <street>123 SamEldin Street</street>
               <city>Java Valley</city>

* This is a simple representation of the some of the fields
* being populated from the XML file after unmarshalling XML instance
* documents into Java DataObjects
* @author sameldin
public class FunctionalProcessesRuleDO
     private String ruleName = "ADD_HOME_ADDRESS_FUNCTION_ACTION";
     private int ruleIndex = 0; // will be mapped
     private int score = -1; // will be calculated
     private String rulesType = "FUNCTION_ACTION";
     private String nameValuePair =
          "name=Sam Eldin;street=123 SamEldin Street;
          city=Java Valley;state=ILL;zip=60192";
     public boolean equals(Object passedObject) {...}
     public int hashCode() {...}
ADD_HOME_ADDRESS_FUNCTION_ACTION=3001 public final static int TU_HAS_IS_INDEX = 2000;
public final static int TU_FUNCTION_ACTION_INDEX = 3000;

Weight-Score, Validation & Decision Maker
How do you make software intelligent?
To build intelligent software we need to ask: What is intelligence?
Intelligence comes from the Latin verb "intellegere", which means "to understand". Intelligence in human is used to describe the ability of the mind to do the following:
• Relate
• Reason
• Plan
• Solve problems
• Think abstractly
• Comprehend ideas
• Use language
• Learn

In Artificial intelligence (or AI) is to create “intelligent agents" or "rational agents", where an intelligent agent is a system that perceives its environment and takes actions which maximize its chances of success.
To make our framework intelligent, we need to have the framework performs the following processes:
• Plan scheduled processes
• Made decision based on business rules
• Track tasks and errors
• Handle errors and exceptions
• Create reports
• Help users make decision by giving users options to decide
Our framework has Weight-Score, Validation & Decision Maker as part of the application tier or package. We do need to present our approach of each and our readers have the right not agree with our approach.

Weight-Score may mean different things to different people. We are presenting them with following meaning-values:

• Weight = percentage of success
• Score = how good of a value it is
By multiplying theses values we can create a scale or a measure for Pass/Fail criteria and be able to make a decision based a mathematical formula that can be proposed by rules makers.
A simple example is presented here using our TransUnion FFI. Let us assume that rules-segments for Auto Loan TransUnion FFI Service call has the following segments.

• The most important of these is that each FFI must begin with a TU4I (Transaction Control)
• Segments must end with an END1 segment.
• Auto Loan Segment specifies the amount of the loan.
Errors in segment TU4I and END1 would result in an error and the FFI request would fail. We need to insure our processes need to calculate the Weight-Score that helps Decision Maker does its task. The following table is created to show how to use Weight-Score to make a decision. We assign Weight-Score for each segment to insure that the Weight-Score calculation will have a Pass/Fail total:

TU4I 0.2 -1 100
END1 0.2 -1 100
Auto Loan 10 0 2

Let us calculate Weight-Score for the following scenarios:

TU4I Failed -1 100 -100
END1 Passed 0.2 100 20
Auto Loan Passed 10 2 20
Total Weight-Score                -60

TU4I Passed 0.2 100 20
END1 Failed -1 100 -100
Auto Loan Passed 10 2 20
Total Weight-Score                -60

TU4I Passed 0.2 100 20
END1 Passed 0.2 100 20
Auto Loan Failed 0 2 0
Total Weight-Score                40

From scenarios, we can see the Weight-Score = -60 any time TU4I or END1 failed the test.
In the case where only the Auto Loan failed, the Weight-Score = 40 out of possible Weight-Score of 60. This can be considered for a decision to be made based on the ratio (40/60).
With same approach, the Weight-Score should be created by the Business Analysts and clients to insure the Weight-Score calculation would help the Decision Maker.

Validation or Confirmation is a process that ensures that rules are implemented by our framework. Validation is also a pre-Decision Maker step that supports Decision Maker and prevents redundancies.
The number of Dynamic Business Rules can be overwhelming and creating a customized Validation for each rule may end up to be a monumental task. Our approach is create the following:

• Validation Processor (Template)
• Decision Maker Reports

Validation Processor (Template)
It has the following properties:

• Time stamp - time when the validation is performed
• Rule Start date and End Date - to insure nothing is outdated
• A check list for the rule - Set of DataObjects - rules check points
• A set of Validation DataObjects that has the data and action needed for Validation Processor to do its tasks
• Weight-Score value - acceptable values for the rule

It performs the following tasks:

• Flags exceptions and errors - create exceptions and errors reports
• Handles exceptions and errors
• Validates the total Weight-Score
• Creates Decision Maker Report

Decision Maker Reports
Decision Maker Reports are ArrayLists which are the output of the Validation Processors to be used by Decision Makers to perform its tasks.

Decision Maker:
Decision Maker is also a processor that has its own DataObjects that has the data and action needed for Decision Maker Processor to do its tasks. Decision Maker processes the Decision Maker Reports created by the Validation Processor. It creates ArrayLists where statistic packages can do its tasks and stores the result in the database.

The Code and JARS
               Patience is a Virtue - Coming Soon


Pros & Cons
Our Dynamic Business Rules Framework is our attempt to present a Java Framework that is truly dynamic.
From experience, we know that new ideas or approaches coming from No-Name or No-Body team (like us) will meet a lot of skepticism and maybe a total rejection.
Well, we did have fun creating and coding it. It did take some serious thinking, planning, analysis, architecting-designing, coding, testing and creating the web pages to make it presentable.
We do want to thank all our friends and colleagues who were generous to devote time and helped us with a number of issues.
A special Thank to my Children who did the proofreading part even though nothing made any sense.

A real Java Framework Complicated
This is a true Dynamic Business Rules solution with actions, code and a running framework. Need lots of rules setup, Weight-Score formulas
A complete end-to-end solution Required a well defined analysis plan
System Administrators run the show and not Java developers Both dynamic and static processes and required actions may get mixed and life can get complicated
Scalable, expandable, loosely coupled architect-design Too many rules storage may create conflicts
A clear set of rules, processes, products and services Not too many people would approve or agree
True dynamic setup Overload of dynamic processes
Easy to integrate Too many tiers
Intelligent system New ideas are not easily taken by IT professionals

       Facebook Facebook Facebook Facebook Facebook
About us Contact Site Map Support Privacy Terms All rights reserved