The aim of this design is to go some way to providing a software component that can provide application- and situation- specific messages, in a flexible and configurable way.
The most simple-minded and least flexible way to implement the functional spec would be to code long if-then-else constructions. The most sophisticated way would be to use a full-fledged business rules product. Our design intends to fall somewhere between these two extremes, tending to the simpler end of the spectrum.
The key points of the design are:
Rule: a condition and an action. Each rule will be tagged with a Domain and a Context attribute.
Message Rule: special kind of rule where the action results in a single message in string form.
Domain: represents an app or subject area (e.g. Online Reg)
Context: represents a situation in which messages will be retrieved (e.g. for Online Reg: Display Subject Selections; Approval; Add Subject)
The Message Rules Engine will be the software component that applications interact with to retrieve messages. An app will supply a domain, a context, and a set of input data. It will receive a list of messages appropriate for the domain and context.
The sequence diagram shows how the components of the message rules engine interact and how an application (e.g. Online Reg) interacts with the engine.
The class diagram shows the Java objects and their relationships, organized by package.
This package holds the MessageRulesEngine itself, and the MessageRuleService class.
This package holds all the business rules, implemented in Java. Each rule implements the MsgRule interface.
This package holds the domain classes representing the message rule metadata.
This package holds data access objects for retrieving and writing message rule metadata from and to the database.