Welcome!

ColdFusion Authors: Maureen O'Gara, Hovhannes Avoyan, Yakov Fain, Pat Romanski, Liz McMillan

Related Topics: ColdFusion

ColdFusion: Article

Playing With(in) the Rules

The Rule Manager Façade

In order for the ruleApplies method to function properly the context CFC must provide the actual property values to the criteria-type CFCs for each downloaded email. Thus when the criteria-type CFC calls the method context.getFromHeader() the context CFC must return the "Sender" string value "s. isaac dealey <info@turnkey.to>" for any message sent by myself. This can be accomplished either by instantiating a CFC for each message and passing that CFC as an optional second argument to the RuleManager.ruleApplies() method, or a single context CFC may use an iterator property to indicate the current row of a query from which email information is retrieved. Although for this application I would recommend the latter approach for the sake of efficiency, individual context CFCs may be more appropriate for other applications.

Unfortunately the scope of this article doesn't allow me the luxury of providing a complete sample application. The sample code (which is available by viewing this article online) and the above paragraphs lack an explanation of how the folder for each filter is identified. There are several methods that could be applied, including an additional attribute in the XML node for each rule or additional structure in your database. You will need to address these details case-by-case in your applications.

Conclusion
Although I lament that this article could not examine many of the more useful nuances of the RuleManager façade it should arm you with enough information to start providing powerful self-service customization to your clients today. The previous paragraphs and code samples provide information about basic concepts, storage, formatting, user-interface and application in business-logic, as well as thorough explanations of all the necessary CFCs and methods and a step-by-step explanation of the flow of user-interface and application logic. For questions or to see a more thorough example, you may contact me directly or view the onTap framework documentation at www.fusiontap.com.

More Stories By Isaac Dealey

Isaac Dealey has worked with ColdFusion since 1997 (version 3) for clients from small businesses to large enterprises, including MCI and AT&T Wireless. He evangelizes ColdFusion as a volunteer member of Team Macromedia, is working toward becoming a technical instructor, and is available for speaking engagements.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.