110 likes | 122 Views
Standard validation method with code generation in the ADEL system. 10. November 2015. Wiesbaden Erzsébet Kómár IT Department erzsebet.komar@ksh.hu. Introduction. Background Integrated Data Entry and Validation System – ADEL – SDE2015 Budapest
E N D
Standard validation method with code generationin the ADEL system 10. November 2015. Wiesbaden Erzsébet Kómár IT Department erzsebet.komar@ksh.hu
Introduction • Background • Integrated Data Entry and Validation System – ADEL – SDE2015 Budapest • Integrated, general, flexible, meta-driven, standardized • Oracle Database 11g • Oracle Fusion Middleware 11g (Forms, plsql, sqlplus) • Main topics of the presentation • Naming convention (in the database, in the file system) • Standard validation method with code generation • Examples in the presentation: 2015 / 1097 - Statistic of product procurements Agricultural survey
Applying naming convention • Objects in the database • {subject_user}.{subsystem}_{survey}_{content}_{year}[months] (tables) • MR15.YR_1097_MRAA0_150112 survey data table • MR15.YR_1097_HIBA_150112 survey error table • Validation functions • {type}{category}{scope}{measureID} (hitmraa003, vitmraa003) • type h=validation fn., v=variable, k=conditional fn. • category i=range, e=equal, r=relation • scope t=actual, e=previous, b=previous year, o=other survey • Applications and reports in the file system • {subsystem}{type}{short_filename}.{extension} • {subsystem}{type}{short_filename}_{survey}_{year}[months].{extension} • general error report adel\general\yrfroljh.sql • survey specific error report adel\2015\1097\yrfroljh_1097_150112.sql • survey specific online appl. adel\2015\1097\yrkfar_1097_150112.fmx • survey specific batch appl. adel\2015\1097\yrkfbe_1097_150112.fmx
Validation – roles & responsibilities • Defining – Statistician – with ELLA subsystem • describestheconditions, algorithm, meta characteristics • text format, notwithmathematical formula • Preparing – IT developer – with ADEL-META subsystem • creates DB objectswithDesigner • generateserrorhandlingpackage-storedinthedatabase • buildsthevalidationfunctions • generatesthevalidationfunctions – storedinthesurveyplsqllibrary The validationfunctionsarecalledfromthe online and batch validationapplications
The architecture of validation Application server Database MR15 Online application (yrkfar_1097_150112.fmx) Batch application (yrkfbe_1097_150112.fmx) survey data table (yr_1097_mraa0_150112) survey error table (yr_1097_hiba_150112) pl-sql library Specification: data & validation function declarations error handling pkg Specification Body: validation functions hitmra003 hetmra003 hetmra006 Body 6 6
Code generating with ADEL-META • Program codes are prepared by application (procedure) using • naming convention – names are combined by algorithm • database dictionary – meta information about DB objects • input parameters – year, survey code • Rules of error handling • every survey has its own error table • if a validation is false an error row is inserted, if an error is corrected the error row is deleted, if it is accepted the error row is updated • Rules of validation packages and functions • every survey data table has its own validation package • the name of the validation package (MRAA0) is the same as the name of the mesaure group code in the survey data table (YR_1097_MRAA0_150112) • every validation package has a specification part (with data & function declaration) and a body part (with program codes) • a validation function consists of nested functions (conditional, error handling) • the validations have standard structure
Standard structure of validation functions • Everyvalidation has standard structure 8
Simply example for validation • 2015 / 1097 – Statistic of product procurements • Validation (inthe ELLA subsystem): ifthequantity (mraa006) > 0 thentheprice (mraa003) / thequantity (mraa006) must be between 100 and 200 • Generatedvalidationfunction (ADEL-META) -- The unit price (e/c) must be beetween 100 and 200 (errormessagefromthe ADEL-META system) function hitmraa003 returnnumber is v_rcnumber; begin vitmraa003 := null; v_rc := c.fokelle('hitmraa003',std.onbat,std. my106, std.my103); -- meta levelcondition (c.fokelle -> generalfunction) if v_rc = 0 then v_rc := greatest(v_rc,ff.nagyobb (tmraa0.mraa006,0)); -- validationcondition (nagyobb = greaterfn. -> commonfunction) if v_rc = 0 then vitmraa003 := kf.osztas (tmraa0.mraa003, tmraa0.mraa006); -- operation (osztas = devidefn. -> commonfunction) v_rc := kf.kozott (vitmraa003, 100, 200); -- internalvalidation (kozott = betweenfn. -> commonfunction) end if; if (std.onbat='1' and std.my103='0') orstd.onbat='2' then mr15.hi_1097.hadmin (c.c0_rek.ceaa0_sq,v_rc, std.tev,std.mho,std.mc01,std.mc01_ex,torzs.mc005_v,torzs.tor_rek m005, torzs.tsz, v_mm805ba, vitmraa003 ,torzs.yw_sq, c.c0_rek.my106); -- errorhandling (hadmin -> generatedprocedure) end if; end if; return(kf.hkod(v_rc)); end hitmraa003;
Demos – recorded sessions • generating error handling package • building a new validation use common functions • generating validation functions • [validation with own special functions]