44
1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1 , Ajit Singh 2 , Kumaraswamy Ponnambalam 1 , Raymond Lee 2 1 Systems Design Engineering, University of Waterloo 2 Electrical and Computer Engineering, University of Waterloo

1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

Embed Size (px)

Citation preview

Page 1: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

1

Automating Business Rule Adaptation for

Web-Based Information Systems

Mei Tian1, Ajit Singh2,

Kumaraswamy Ponnambalam1, Raymond Lee2

1Systems Design Engineering, University of Waterloo

2 Electrical and Computer Engineering, University of Waterloo

Page 2: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

2

Presentation Outline

• Introduction

• Business Rule Model

• Implementation

• Case Study

• Future Work

Page 3: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

3

Web-Based Information Systems

back-end database

business logic

middleware

client application

JRMPhttp

• Three-Tier architecture

Page 4: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

4

What Are Business Rules?

• Formal statements about the data and

processes of an enterprise

• Presented as program logic in enterprise

application

Page 5: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

5

Business Rule Examples

• If a customer buys product worth more than $100 in an order, he will get a 10% discount.

• If the product in warehouse is less than 5, reorder this product.

• Shipping fee is $20 for each order.

Page 6: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

6

Why Automation

• Business rules change quickly

• Business rules are often embedded with the

data access and application logic

• To speed up the application development

• To reduce maintenance cost

Page 7: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

7

Research Subareas

• Business rule representation

• Business rule extraction

• Business rule management

• Business rule processing

Page 8: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

8

Research Background

• Business rules representation

External

Conceptual

Internal

Users,analyzers Structured English, etc.

Designer, developer BRML, etc.

Physical machine Binary code

Page 9: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

9

Research Background

• Business rule extraction

• Data analyzing

• Programming analyzing

• Hybrid

Page 10: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

10

Research Background

• Business rule management

• Repository-based method

• artificial Intelligence

Page 11: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

11

Research Background

• Business rules processing

• Procedural programming

• SQL trigger

• Declarative programming

• Constraint programming

Page 12: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

12

Challenges

• No standard business rule model

• No distributed business rule framework

• Difficult to define a flexible rule interface

• How to find the rule firing order without an inference engine

Page 13: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

13

Assumptions

• Rules have been found somehow

• Rules are correct with no conflict and redundancy

• Target to small/middle size information systems

• Not use artificial intelligence

Page 14: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

14

Solution Strategies (1)

• A general business rule model

• A rule system and a distributed business

rule framework

Page 15: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

15

Solution Strategies (2)

• A EJB design pattern and the bean

relationship information

• Rule dependency graph, rule-firing-

history, and rule label

Page 16: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

16

Business Rule Model

OrganizationModelname: String

ruleType: Stringpriority: StringtriggeredClass: StringtriggerMethod: StringtriggerLocation: Stringimplementor: Stringdescription: String

name: Stringeffective:Dateexpiration:Date

BusinessRuleSet

BusinessRule1*

* 1 CommonKnowledge

Model

*

*

1

*

TermRule FactRule ActionRule DerivationRule

ApplicationRuleSet

appName:String setName:Stringsource:String

ShareRuleSet

RuleChecker

description: String 1 *

Legend: class * 1 Many-to-one association generalization

Implementer1*ruleName:String

Page 17: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

17

Business Rule Types

TermRule FactRule ActionRule DerivationRule

name: StringruleType: Stringpriority: StringtriggeredClass: StringtriggerMethod: StringtriggerLocation: Stringimplementor: StringDescription: String

BusinessRule

TransformationRule

InitialDerivationRule

SelfDerivationRule

IndirectDerivationRule

InferenceRule

ValidationRule

Legend: class generalization

Page 18: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

18

Term Rule

• Defines the vocabulary of a business

• Not implemented as a part of an Information

System(IS)

• Example:

A telephone line is an asset.

Page 19: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

19

Fact Rule• Documents the relationship between items

• Aggregation, association, generalization

• belongs to, identified by

• In an IS, implemented as relationship between classes, entity beans, or tables

• Example: A student has a student ID.

Page 20: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

20

Action Rule• States the conditions under which actions

must be taken

•Transformation Rule: Transforms the execution

from one event to another

•Validation Rule: States what kind of value for an

attribute is valid

Page 21: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

21

Action Rule Examples

• Transformation Rule Example:

After a user pays, ship the products and

deduct the quantity from product inventory.

• Validation Rule Example:

The product inventory must be greater than zero.

Page 22: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

22

InitialDerivation Rule

• Describes initialization value of an class attribute.

• Example:

The first customer ID is “1000”

Page 23: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

23

SelfDerivation Rule

• Describes how an attribute’ value is derived from former instance’s value on the same attribute.

• Example:

a new customer ID = max(customerID) + 1

Page 24: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

24

IndirectDerivation Rule

• Describes how the value of one attribute is derived by some other attributes through a mathematic formula or inference.

• Example:

invoice total value = product total value

+ tax value – discount

Page 25: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

25

Rule Automation Technologies

• Java Technology

- Ensures portability and vendor independency

• Enterprise Java Beans

- Simplifies building of distributed application

• MS-SQL 6.5 as back-end database

Page 26: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

26

Enterprise Java Beans

• Server-side component architecture

• Simplifies building distributed applications

• Enterprise beans

- Entity beans

- Session beans

Page 27: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

27

Rule Adaptation Automation System

Rule Engine

Application Server

Rule Builder

Rule Beans

Rule Adaptation Automation System

HTTP

JDBC

EJB Beans Generator

JDBC

Deploy

EJB Finder

Rule Repository

Page 28: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

28

Case: Maria’s Computer Product Store

• User authentication

• An Online catalogue and shopping cart

• Invoice generation

• Bill Functionality

• Special price promotion

Page 29: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

29

MCPS-Business Flow

Login

User Profile

Product List View Shopping Cart

Check Out

Invoice

Rule Execution Feedback

New Customer

Service List

Page 30: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

30

MCPS-Object Model (Business Logic Tier)

Account Wrapper

Customer Wrapper

Invoice Wrapper

Account Customer Invoice

ShoppingCart

Transactions Transactions Wrapper

Product

Product Wrapper

1

1

1

1

1

1

1

1

1

* 1

1

1

*11

1

1

1 *1 1

Page 31: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

31

Rules in MCPS (1)

• Validation Rule

• The account balance must be greater than 0.

• Transformation Rule

• After generating an invoice, deduct the user’s

account balance by the invoice amount.

Page 32: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

32

Rules in MCPS (2)

• InitialDerivation Rule

• The customer ID for the first customer is 1000.

• The account ID for the first account is 1000.

• The invoice ID for the first invoice is 1000.

Page 33: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

33

Rules in MCPS (3)

• SelfDerivation Rule

• A new customer ID is the current maximum

customer ID add one.

• the rule for new account ID

• the rule for new invoice ID

Page 34: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

34

Rules in MCPS (4)

• IndirectDerivation Rule

• The Shipping fee is $20 for each order.

• The tax value is 15% of the product total value

Page 35: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

35

Rules in MCPS (5)

• IndirectDerivation Rule

•The invoice total value is the amount of product total value, tax value, and shipping fee.

Page 36: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

36

Rules in MCPS (6)

• IndirectDerivation Rule

• If a customer buys products worth more than $100, he will get a 10% discount.

Page 37: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

37

Case Build Procedure

Test andModification

Object model for business

logic tier

Object Model for

Presentationtier

Business rulesGenerate beans

Write ShoppingCartsession bean

Build rulesArrange

rule sequenceWrite Jsp files

Design

Develop

Page 38: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

38

MCPS Architecture(Technology View)

HTTP Request

HTML

WorkStation

Browser

Application Server

Database

Java Bean

JSP

Session bean

Rule Engine

Entity Bean

UI Logic

Business Logic

Page 39: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

39

Metrics Analysis 

Line Of Code (Loc)

CPS MCPS MCPS(Hand-

coded)

Hand-codePercentage

Java Files 8643 13774 1588 12%

JSP Files 9316 1159 1159 100%

Deployment Files 681 1025 9 0.1%

Other 315      

Overall 18955 15958 2756 17%

Page 40: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

40

RAAS Features (1)

• 3-tier architecture

• Automatically triggers the rules at run time

• Changes the rules without re-deploying the

application systems

Page 41: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

41

RAAS Features (2)

• Decides rule sequence for IndirectDerivation rules

• Re-evaluates rules based on changed conditions

Page 42: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

42

Contributions

• Proposed a general and extensible business rule model

• Explored a component-based distributed business rule framework

Page 43: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

43

Future Work

• Enhance the rule model

• Performance issue

• Extracting rules from legacy system and specification documents

Page 44: 1 Automating Business Rule Adaptation for Web-Based Information Systems Mei Tian 1, Ajit Singh 2, Kumaraswamy Ponnambalam 1, Raymond Lee 2 1 Systems Design

44

Questions ??