Extracting Business Rules from PL/SQL-Code



Ähnliche Dokumente
Trennen von Regeln und PL/SQL-Code

Business Rules Technologie

Order Ansicht Inhalt

Prozedurale Datenbank- Anwendungsprogrammierung

Exercise (Part XI) Anastasia Mochalova, Lehrstuhl für ABWL und Wirtschaftsinformatik, Kath. Universität Eichstätt-Ingolstadt 1

Exercise (Part II) Anastasia Mochalova, Lehrstuhl für ABWL und Wirtschaftsinformatik, Kath. Universität Eichstätt-Ingolstadt 1

Zeitlich abhängig von OWB?

Dynamisches SQL. Folien zum Datenbankpraktikum Wintersemester 2009/10 LMU München

Softwareupdate-Anleitung // AC Porty L Netzteileinschub

Exercise (Part VIII) Anastasia Mochalova, Lehrstuhl für ABWL und Wirtschaftsinformatik, Kath. Universität Eichstätt-Ingolstadt 1

miditech 4merge 4-fach MIDI Merger mit :

Support Technologies based on Bi-Modal Network Analysis. H. Ulrich Hoppe. Virtuelles Arbeiten und Lernen in projektartigen Netzwerken

CABLE TESTER. Manual DN-14003

Installation and update of the Schiebel SmartTool2. Installation und Update des Schiebel SmartTool2

VGM. VGM information. HAMBURG SÜD VGM WEB PORTAL USER GUIDE June 2016

SanStore: Kurzanleitung / SanStore: Quick reference guide

Mail direkt aus Oracle versenden - komfortabel und mit Umlauten

EU nimmt neues Programm Mehr Sicherheit im Internet in Höhe von 55 Millionen für mehr Sicherheit für Kinder im Internet an

Titelbild1 ANSYS. Customer Portal LogIn

ROOMS AND SUITES A place for dreaming. ZIMMER UND SUITEN Ein Platz zum Träumen

How to access licensed products from providers who are already operating productively in. General Information Shibboleth login...

Synchroner Spiegel & Applikationsverfügbarkeit. Johan van den Boogaart

WAS IST DER KOMPARATIV: = The comparative

Exercise (Part I) Anastasia Mochalova, Lehrstuhl für ABWL und Wirtschaftsinformatik, Kath. Universität Eichstätt-Ingolstadt 1

Word-CRM-Upload-Button. User manual

Analysis Add-On Data Lineage

FIRMWARE UPDATE TAPMOTION TD

Übung PL/SQL Trigger Lösungen

Whitepaper. Produkt: combit Relationship Manager. Datensatzhistorie mit dem SQL Server 2000 und combit GmbH Untere Laube Konstanz

Mash-Up Personal Learning Environments. Dr. Hendrik Drachsler

Übungsblatt 8- Lösungsvorschlag


VGM. VGM information. HAMBURG SÜD VGM WEB PORTAL - USER GUIDE June 2016

Dipl. Inf. Dipl. Math. Y. Orkunoglu Datum:

Funktionen. Überblick über Stored Functions. Syntax zum Schreiben einer Funktion. Schreiben einer Funktion

JTAGMaps Quick Installation Guide

KURZANLEITUNG. Firmware-Upgrade: Wie geht das eigentlich?

Can I use an older device with a new GSD file? It is always the best to use the latest GSD file since this is downward compatible to older versions.

Data Mining and Data Analysis using the Example of cross-border Traffic Management during Extreme Weather Events

Einkommensaufbau mit FFI:

HiOPC Hirschmann Netzmanagement. Anforderungsformular für eine Lizenz. Order form for a license

10.6 Programmier-Exits für Workitems

Challenges for the future between extern and intern evaluation

Oracle und LDAP. Zugriff auf LDAP-Daten aus einer Oracle-DB. Martin Busik

Exercise (Part V) Anastasia Mochalova, Lehrstuhl für ABWL und Wirtschaftsinformatik, Kath. Universität Eichstätt-Ingolstadt 1

MobiDM-App Handbuch für Windows Mobile

1. General information Login Home Current applications... 3

Preisliste für The Unscrambler X

ISO Reference Model

A.4 Beispiel zum -Versand über Smart Forms

CampusCenter. Anleitung zur Online-Einschreibung für Promovenden. Instructions for the PhD online enrollment procedure

Supplier Status Report (SSR)

Praktikum Entwicklung Mediensysteme (für Master)

Using TerraSAR-X data for mapping of damages in forests caused by the pine sawfly (Dprion pini) Dr. Klaus MARTIN

DIE NEUORGANISATION IM BEREICH DES SGB II AUSWIRKUNGEN AUF DIE ZUSAMMENARBEIT VON BUND LNDERN UND KOMMUNEN

Der Adapter Z250I / Z270I lässt sich auf folgenden Betriebssystemen installieren:

Coaching Agile Development Teams

CALCULATING KPI QUANTITY-INDEPENDENT ROUTE TIME

ReadMe zur Installation der BRICKware for Windows, Version ReadMe on Installing BRICKware for Windows, Version 6.1.2

USB Treiber updaten unter Windows 7/Vista

Workflows, Ansprüche und Grenzen der GNSS- Datenerfassung im Feld

Darstellung und Anwendung der Assessmentergebnisse

Abteilung Internationales CampusCenter

CNC ZUR STEUERUNG VON WERKZEUGMASCHINEN (GERMAN EDITION) BY TIM ROHR

Software development with continuous integration

EVANGELISCHES GESANGBUCH: AUSGABE FUR DIE EVANGELISCH-LUTHERISCHE LANDESKIRCHE SACHSEN. BLAU (GERMAN EDITION) FROM EVANGELISCHE VERLAGSAN

NVR Mobile Viewer for iphone/ipad/ipod Touch

ETHISCHES ARGUMENTIEREN IN DER SCHULE: GESELLSCHAFTLICHE, PSYCHOLOGISCHE UND PHILOSOPHISCHE GRUNDLAGEN UND DIDAKTISCHE ANSTZE (GERMAN

Aufbau eines IT-Servicekataloges am Fallbeispiel einer Schweizer Bank

Wer bin ich - und wenn ja wie viele?: Eine philosophische Reise. Click here if your download doesn"t start automatically

ONLINE LICENCE GENERATOR

Der SAS DataStep und die Prozedur SQL Cellent Finance Solutions GmbH Seite: 1

NoSQL mit Postgres 15. Juni 2015

Supplier Questionnaire

Produktinformation _185PNdeen


Data Structures and Algorithm Design

Powerful PL/SQL: Collections indizieren mit VARCHAR2- Indizes ein Praxisbeispiel

Mitglied der Leibniz-Gemeinschaft

PONS DIE DREI??? FRAGEZEICHEN, ARCTIC ADVENTURE: ENGLISCH LERNEN MIT JUSTUS, PETER UND BOB

FAHRZEUGENTWICKLUNG IM AUTOMOBILBAU FROM HANSER FACHBUCHVERLAG DOWNLOAD EBOOK : FAHRZEUGENTWICKLUNG IM AUTOMOBILBAU FROM HANSER FACHBUCHVERLAG PDF

Fußballtraining für jeden Tag: Die 365 besten Übungen (German Edition)

WP2. Communication and Dissemination. Wirtschafts- und Wissenschaftsförderung im Freistaat Thüringen

HIR Method & Tools for Fit Gap analysis

Introducing PAThWay. Structured and methodical performance engineering. Isaías A. Comprés Ureña Ventsislav Petkov Michael Firbach Michael Gerndt

Tube Analyzer LogViewer 2.3

Zum Download von ArcGIS 10, 10.1 oder 10.2 die folgende Webseite aufrufen (Serviceportal der TU):

Number of Maximal Partial Clones

The Mrs.Sporty Story Founders and History

Materialien zu unseren Lehrwerken

ORM & OLAP. Object-oriented Enterprise Application Programming Model for In-Memory Databases. Sebastian Oergel

Study guide written by René Koglbauer

Nießbrauch- und Wohnrechtsverträge richtig abschließen (German Edition)

Klausur BWL V Investition und Finanzierung (70172)

Die UN-Kinderrechtskonvention. Darstellung der Bedeutung (German Edition)

DOWNLOAD. Englisch in Bewegung. Spiele für den Englischunterricht. Britta Buschmann. Downloadauszug aus dem Originaltitel:

PONS DIE DREI??? FRAGEZEICHEN, ARCTIC ADVENTURE: ENGLISCH LERNEN MIT JUSTUS, PETER UND BOB

Geschäftsprozesse und Regeln

prorm Budget Planning promx GmbH Nordring Nuremberg

Transkript:

Extracting Business Rules from PL/SQL-Code Version 7, 13.07.03 Michael Rabben Knowledge Engineer Semantec GmbH, Germany

Why? Where are the business rules? Business Rules are already hidden as logic in your programming code Why extract business rules from code? To ease the process of business rule management, you need to extract the business rules from code and place them into a separate repository Major Advantages Business rules will be readable easily accessible understood more easily manageable maintainable reusable changed more quickly -> reduced time to market

Methodology is a defined and well structured reengineering process => Re-engineering is risk-free Example Determining billing due date of insurance contracts

Traditional PL/SQL code (1): PROCEDURE ICIS_Faell_datum_ermitteln ( p_vvs_begin IN DATE, /* Vertragsversionsbeginndatum */ p_aenderungstyp IN VARCHAR2, /* Änderungstyp der Deckung */ p_zws_code IN varchar2, /* Code für Zahlweise */ p_hauptfaelligkeit IN DATE, /* Hauptfälligkeit */ p_dpr_typ IN VARCHAR2, /* DPR-TYP */ p_datum_von IN DATE, /* Datum, ab dem erhoben wird */ p_datum_bis IN DATE, /* Datum, bis zu dem erhoben wird */ p_abr_in_monate IN NUMBER, /* Monatskennzeichen aus ZBD */ p_anz_monate IN NUMBER, /* Anzahl Monate gemäß p_zws_code (Falls 99 >> =0)*/ p_datum_faellig IN OUT DATE, /* Datum, an dem abgerechnet wird */ p_fpr_batch_entitaet IN OUT VARCHAR2, p_fpr_auspraegung IN OUT VARCHAR2, p_fpr_feh_fehlercode IN OUT VARCHAR2, p_fpr_fehlertext IN OUT VARCHAR2, p_returncode IN OUT NUMBER) IS /* Returncode der Prozedur */ /* Ermittlung des Fälligkeitsdatums gemäß Funktionsbeschreibung 9834a in der Fassung vom 2.10.1997 mw, 6.10.1997 mw, 25.11.1997 keine Sonderbehandlung für monatliche Zahlweise */ F_ORACLE CONSTANT NUMBER(1) := -2; F_SACH CONSTANT NUMBER(1) := -3; v_tagesdatum DATE; v_fr_erh_datum DATE; v_plus_monate NUMBER(2); BEGIN p_datum_faellig := TO_DATE ('01.01.1990', 'dd.mm.yyyy'); p_returncode := 0; v_tagesdatum := sysd_te; IF ( p_zws_code IN ('0', '99') OR p_dpr_typ = 'EP') THEN -- Einmalprämie p_datum_faellig := v_tagesdatum;

Traditional PL/SQL code (2): ELSIF p_zws_code = '81' --20020313_029HK: Neue Zahlweise berücksichtigen THEN -- Projektprämie IF p_datum_von < v_tagesdatum THEN p_datum_faellig := v_tagesdatum; ELSE p_datum_faellig := p_datum_von; END IF; --20020313_029HK: THEN --20020313_029HK: -- monatliche Zahlweise --20020313_029HK: ELSIF p_zws_code = '88' --20020313_029HK: IF p_datum_von < v_tagesdatum --20020313_029HK: THEN --20020313_029HK: p_datum_faellig := v_tagesdatum; --20020313_029HK: ELSE --20020313_029HK: p_datum_faellig := p_datum_von; --20020313_029HK: END IF; ELSIF p_zws_code IN ('1', '2', '4', '12') THEN -- ganz-, halb, viertel-jährliche ZW v_plus_monate := ROUND (12 / p_anz_monate); IF p_aenderungstyp = '7' THEN -- Folge p_datum_faellig := ADD_MONTHS (p_datum_von, NVL(p_abr_in_monate, 0)); ELSE -- Neuanlage, Änderungen /* Ermittlung des frühesten Erhebungsdatums */ v_fr_erh_datum := TO_DATE (LTRIM (TO_CHAR (p_hauptfaelligkeit, 'DDMM')) LTRIM (TO_CHAR (p_vvs_begin, 'YYYY')), 'DDMMYYYY'); -- HF im Versicherungsbeginnjahr IF v_fr_erh_datum > p_vvs_begin THEN v_fr_erh_datum := ADD_MONTHS (v_fr_erh_datum, -12); END IF;

Traditional PL/SQL code (3): WHILE v_fr_erh_datum <= ADD_MONTHS (p_vvs_begin, 0 - v_plus_monate) LOOP v_fr_erh_datum := ADD_MONTHS (v_fr_erh_datum, v_plus_monate); END LOOP; v_fr_erh_datum := ADD_MONTHS (v_fr_erh_datum, NVL(p_abr_in_monate,0)); IF p_datum_von < v_fr_erh_datum THEN IF v_fr_erh_datum > v_tagesdatum THEN p_datum_faellig := v_fr_erh_datum; ELSE p_datum_faellig := v_tagesdatum; END IF; ELSE IF p_datum_von > v_tagesdatum THEN p_datum_faellig := p_datum_von; ELSE p_datum_faellig := v_tagesdatum; END IF; END IF; END IF; ELSE p_returncode := F_SACH; p_fpr_batch_entitaet := 'Faelligkeitsdatum'; p_fpr_fehlertext := 'Zahlweise nicht definiert!'; RETURN; END IF; EXCEPTION WHEN OTHERS THEN p_returncode := F_ORACLE; p_fpr_batch_entitaet := 'Faelligkeitsdatum'; p_fpr_auspraegung := NULL; p_fpr_feh_fehlercode := 'ORA-' to_char(sqlcode); p_fpr_fehlertext := SQLERRM; RETURN; END ICIS_Faell_datum_ermitteln;

Extracted Business Rules If type_of_coverage is "single premium" Then update due_date to today If mode_of_billing is "once Then update due_date to today If mode_of_billing is "project_premium Then update due_date to latest among (today, charge_starting_date) If mode_of_billing is "periodic and change is automatic Then update due_date to charge_starting_date + months_to_billing If mode_of_billing is "periodic and change isn t automatic Then update due_date to latest among (today, charge_starting_date, next_periodic_date + months_to_billing)

Remaining PL/SQL code PROCEDURE ICIS_Faell_datum_ermitteln ( p_vvs_begin IN DATE, /* Vertragsversionsbeginndatum */ p_aenderungstyp IN VARCHAR2, /* Änderungstyp der Deckung */ p_zws_code IN varchar2, /* Code für Zahlweise */ p_hauptfaelligkeit IN DATE, /* Hauptfälligkeit */ p_dpr_typ IN VARCHAR2, /* DPR-TYP */ p_datum_von IN DATE, /* Datum, ab dem erhoben wird */ p_datum_bis IN DATE, /* Datum, bis zu dem erhoben wird */ p_abr_in_monate IN NUMBER, /* Monatskennzeichen aus ZBD */ p_anz_monate IN NUMBER, /* Anzahl Monate gemäß p_zws_code (Falls 99 >> =0)*/ p_datum_faellig IN OUT DATE, /* Datum, an dem abgerechnet wird */ p_fpr_batch_entitaet IN OUT VARCHAR2, p_fpr_auspraegung IN OUT VARCHAR2, p_fpr_feh_fehlercode IN OUT VARCHAR2, p_fpr_fehlertext IN OUT VARCHAR2, p_returncode IN OUT NUMBER) IS input_data = BR_interface.input_data; output_data = BR_interface.output_data; BEGIN BR_interface.Map_input_data (input_data "Contract", "beginning_of_new_version", p_vvs_begin, "automatic_change", p_aenderungstyp, "mode_of_billing", p_zws_code, "single_premium", p_dpr_typ, "beginning_of_new_version", p_datum_von, "months_to_billing", p_abr_in_monate, "next_periodic_date", v_fr_erh_datum); BR_Interface.DSR (input_data, output_data); BR_interface.Map_output_data (output_data, "Contract", "due_date", due_date); END ICIS_Faell_datum_ermitteln;

How is the re-engineering done? Overview 1. Analyze code 2. Create decision table 3. Generate V&V Report (automatically) 4. Generate decision tree (automatically) 5. Verify decision tree with code 6. Generate & optimize rules (automatically) 7. Replace code by calls to Business Rule repository

Process of re-engineering 1. Analyze code and extract conditions and actions to create decision table Conditions Actions 1. Due today 2. Due latest among (today, charge_starting_date) 3. Due charge_starting_date + months_to_billing 4. Due latest among (today, charge_starting_date, next_periodic_date)

Process of re-engineering 2. Create decision table and enter decisions into table Full table Optimized table

Process of re-engineering 3. Generate V & V Report and verify correctness and completeness of analysis

Process of re-engineering 4.+ 5. Create decision tree and verify analysis by comparing it with code

Process of re-engineering 6. Generate and optimize rules (a) Generated Rules (see bottom left)

Process of re-engineering 6. Generate and optimize rules (b) If type_of_coverage is "single premium" Then update due_date to today If mode_of_billing is "once Then update due_date to today Generated rules (in text form) If mode_of_billing is "project_premium Then update due_date to latest among (today, charge_starting_date) If mode_of_billing is "periodic and change is automatic Then update due_date to charge_starting_date + months_to_billing If mode_of_billing is "periodic and change isn t automatic Then update due_date to latest among (today, charge_starting_date, next_periodic_date + months_to_billing)

Process of re-engineering 6. Generate and optimize rules (c) You can modify rules easily

Process of re-engineering 7.Replace code by calls to Business Rules Repository (a) Call to Business Rule Engine: BR_Interface.DSR(input_data, output_data) DSR = DECISION SUPPORT REQUEST Data mapping: Map_input_data ( input_data BR_Class_name, BR_attribute_name_1, variable_name_1, ) BR_attribute_name_n, variable_name_n Map_output_data ( output_data, BR_Class_name, BR_attribute_name_1, variable_name_1, BR_attribute_name_n, variable_name_n )

Process of re-engineering 7.Replace code by calls to Business Rules Repository (b) Example PROCEDURE ICIS_Faell_datum_ermitteln ( p_vvs_begin IN DATE, /* Vertragsversionsbeginndatum */ p_aenderungstyp IN VARCHAR2, /* Änderungstyp der Deckung */ p_zws_code IN varchar2, /* Code für Zahlweise */ p_hauptfaelligkeit IN DATE, /* Hauptfälligkeit */ p_dpr_typ IN VARCHAR2, /* DPR-TYP */ p_datum_von IN DATE, /* Datum, ab dem erhoben wird */ p_datum_bis IN DATE, /* Datum, bis zu dem erhoben wird */ p_abr_in_monate IN NUMBER, /* Monatskennzeichen aus ZBD */ p_anz_monate IN NUMBER, /* Anzahl Monate gemäß p_zws_code (Falls 99 >> =0)*/ p_datum_faellig IN OUT DATE, /* Datum, an dem abgerechnet wird */ p_fpr_batch_entitaet IN OUT VARCHAR2, p_fpr_auspraegung IN OUT VARCHAR2, p_fpr_feh_fehlercode IN OUT VARCHAR2, p_fpr_fehlertext IN OUT VARCHAR2, p_returncode IN OUT NUMBER) IS input_data = BR_interface.input_data; output_data = BR_interface.output_data; BEGIN BR_interface.Map_input_data (input_data "Contract", "beginning_of_new_version", p_vvs_begin, "automatic_change", p_aenderungstyp, "mode_of_billing", p_zws_code, "single_premium", p_dpr_typ, "beginning_of_new_version", p_datum_von, "months_to_billing", p_abr_in_monate, "next_periodic_date", v_fr_erh_datum); BR_Interface.DSR (input_data, output_data); BR_interface.Map_output_data (output_data, "Contract", "due_date", due_date); END ICIS_Faell_datum_ermitteln;

Summary Our approach is a well-defined and structured re-engineering process Drastic reduction of traditional code Visibility of business rules Less cost of maintenance Allowing better management