root / framework / trunk / extensions / lexicon / orm / transfer / new.cfm

Revision 336, 1.9 kB (checked in by scorfield, 1 year 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        //              <transfer:new object="task" bean="thisTask" populate="true|false" />
4        if (fb_.verbInfo.executionMode is "start") {
5                // validate attributes
6                // object - string
7                if (not structKeyExists(fb_.verbInfo.attributes,"object")) {
8                        fb_throw("fusebox.badGrammar.requiredAttributeMissing",
9                                                "Required attribute is missing",
10                                                "The attribute 'object' is required, for a 'new' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
11                }
12                // bean - string
13                if (not structKeyExists(fb_.verbInfo.attributes,"bean")) {
14                        fb_throw("fusebox.badGrammar.requiredAttributeMissing",
15                                                "Required attribute is missing",
16                                                "The attribute 'bean' is required, for a 'new' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
17                }
18                // populate - boolean
19                if (not structKeyExists(fb_.verbInfo.attributes,"populate")) {
20                        fb_throw("fusebox.badGrammar.requiredAttributeMissing",
21                                                "Required attribute is missing",
22                                                "The attribute 'populate' is required, for a 'new' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
23                } else if (listFind("true,false,yes,no",fb_.verbInfo.attributes.populate) eq 0) {
24                        fb_throw("fusebox.badGrammar.invalidAttributeValue",
25                                                "Attribute has invalid value",
26                                                "The attribute 'populate' must either be ""true"" or ""false"", for a 'include' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
27                }
28               
29                // generate code:
30                fb_appendLine('<cfset #fb_.verbInfo.attributes.bean# = ' &
31                                'myFusebox.getApplication().getApplicationData().transferFactory' &
32                                '.getTransfer().new("#fb_.verbInfo.attributes.object#") />');
33                if (fb_.verbInfo.attributes.populate) {
34                        fb_appendLine('<cfset #fb_.verbInfo.attributes.bean#.setMemento(attributes) />');
35                }
36                fb_appendLine('<cfset myFusebox.trace("Transfer","Created New Bean") />');
37
38        } else {
39        }
40</cfscript>
Note: See TracBrowser for help on using the browser.