root / framework / trunk / extensions / lexicon / orm / reactor / read.cfm

Revision 336, 1.4 kB (checked in by scorfield, 2 years ago)

Shuffled all the sample lexicons into the new extensions directory and added the assertions
plugin. This is in preparation for the Fusebox 6 theme are extending through extensibility.
Note that the release script has not been updated so this is a stable BER.

Line 
1<cfscript>
2        // usage:
3        //              <reactor:read object="task" bean="thisTask">
4        //                      <reactor:parameter name="id" value="#attributes.id#" />
5        //              </reactor:read>
6        if (fb_.verbInfo.executionMode is "start") {
7                // validate attributes
8                // object - string
9                if (not structKeyExists(fb_.verbInfo.attributes,"object")) {
10                        fb_throw("fusebox.badGrammar.requiredAttributeMissing",
11                                                "Required attribute is missing",
12                                                "The attribute 'object' is required, for a 'read' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
13                }
14                // bean - string
15                if (not structKeyExists(fb_.verbInfo.attributes,"bean")) {
16                        fb_throw("fusebox.badGrammar.requiredAttributeMissing",
17                                                "Required attribute is missing",
18                                                "The attribute 'bean' is required, for a 'read' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
19                }
20               
21                // prepare for any parameters:
22                fb_.verbInfo.parameters = structNew();
23               
24        } else {
25                // generate code:
26                fb_.properties = "";
27                // gather up parameters:
28                for (fb_.p in fb_.verbInfo.parameters) {
29                        fb_.properties = listAppend(fb_.properties,'#fb_.p#="#fb_.verbInfo.parameters[fb_.p]#"');
30                }
31                fb_appendLine('<cfset #fb_.verbInfo.attributes.bean# = ' &
32                                'myFusebox.getApplication().getApplicationData().reactorFactory' &
33                                '.createRecord("#fb_.verbInfo.attributes.object#").load(#fb_.properties#) />');
34                fb_appendLine('<cfset myFusebox.trace("Reactor","Read Record") />');
35        }
36</cfscript>
Note: See TracBrowser for help on using the browser.