[rules-users] This (ordered) record validation approach is working

Swindells, Thomas TSwindells at nds.com
Thu Dec 8 05:30:26 EST 2011


Is this presentation available anywhere?

> -----Original Message-----
> From: rules-users-bounces at lists.jboss.org [mailto:rules-users-
> bounces at lists.jboss.org] On Behalf Of Wolfgang Laun
> Sent: 08 December 2011 07:13
> To: Rules Users List
> Subject: Re: [rules-users] This (ordered) record validation approach is
> working
>
> In my Rules Fest 2011 boot camp "Rule-Based Programming Design Patterns"
> I presented a generic solution using linked rule engines for this and similar
> problems.
> -W
>
>
> On 08/12/2011, ronalbury <ronalbury at gmail.com> wrote:
> > I didn't get any feedback when I posted earlier today, so I went ahead
> > and implemented what I thought would work ... and I figured I should
> > share it here since it seems to be working pretty well.
> >
> > I created a Rule Flow as follows:
> >    A Rule-Flow-Group that validates the arrays.  Unfortunately I
> > sometimes get multiple related arrays of records instead of a single array of
> records.
> > I confirm that records with mandatory values have arrays with at least
> > one element, and confirm that the related arrays are of equal length.
> > Errors are logged.
> >
> >    A subsequent Rule-Flow-Group that manages inserts.  The data
> > actually comes to me as one data structure comprised of sub-records of
> > various types, and I have DRL files for each record type.  Some of the
> > sub-records are optional, and since subsequent rules would erroneously
> > flag empty sub-records as errors I have rules here which only allow
> > optional records containing values to be inserted into the system.  I
> > am currently using for-loops in the THEN section of some rules to deal
> > with the array problem and would like to know if there is a better
> > way.  No errors are generated here.
> >
> >    A subsequent Rule-Flow-Group that validates data.  The data is all
> > sent to me as Strings, even though many of the values are numbers, dates,
> etc.
> > This Rule-Flow group tests the various fields using regular
> > expressions, and if a regular expression fails then the record is flagged as
> having an error.
> > Optional fields are dealt with by the regular expression allowing a blank.
> > Errors are logged.
> >
> >    A Diverging Gateway that splits the data into two ... records
> > without validation errors are allowed to progress to the
> > value-checking Rule-Flow group ... those with errors have nothing more
> > done to them.  I realize that I could, for instance, let records with
> > bogus numbers thru as long as my string-to-integer routine is robust,
> > however I don't want to flag the same record multiple times (once by
> > reg-ex and then again by the next Rule-Flow-Group).
> >
> >    A subsequent Rule-Flow-Group that checks the values and ranges of
> > the numbers, dates, etc, and does other types of validation (e.g. if
> > fieldA has a value greater than 20 then fieldB must be set to "XYZ").
> > Errors are logged.
> >
> >
> > This Rule-Flow approach currently seems to be solving all of my
> > problems, and it allows me to keep the rules simple and well
> > structured such that most of them are reusable in other parts of our
> system.
> >
> > I'm interested in getting feedback on this approach ... it seems to be
> > working pretty well for me.  It allows me to deal with ordering issues
> > and many of the if/else issues, while keeping the rules simple enough
> > for our non-technical analysts to review without needing a developer
> > to sit next to them.
> >
> > I realize this is a pretty mundane application for a powerful rules
> > system, but it seems like a good fit nonetheless.
> >
> > Thanks
> >    Ron
> >
> > --
> > View this message in context:
> > http://drools.46999.n3.nabble.com/This-ordered-record-validation-appro
> > ach-is-working-tp3568933p3568933.html
> > Sent from the Drools: User forum mailing list archive at Nabble.com.
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users


**************************************************************************************
This message is confidential and intended only for the addressee. If you have received this message in error, please immediately notify the postmaster at nds.com and delete it from your system as well as any copies. The content of e-mails as well as traffic data may be monitored by NDS for employment and security purposes. To protect the environment please do not print this e-mail unless necessary.

NDS Limited. Registered Office: One London Road, Staines, Middlesex, TW18 4EX, United Kingdom. A company registered in England and Wales. Registered no. 3080780. VAT no. GB 603 8808 40-00
**************************************************************************************




More information about the rules-users mailing list