|
Revision 275, 1.3 kB
(checked in by scorfield, 2 years ago)
|
|
Nathan Strutz wrote this lexicon.
|
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | <cfscript> |
|---|
| 2 | // @ Author Nathan Strutz |
|---|
| 3 | // Creates a dictionary of a given type from Reactor |
|---|
| 4 | // usage: |
|---|
| 5 | // 1. add the lexicon declaration to your circuit file: |
|---|
| 6 | // <circuit xmlns:reactor="reactor/"> |
|---|
| 7 | // 2. use the verb in a fuseaction: |
|---|
| 8 | // <reactor:dictionary alias="User" returnvariable="variables.userDictionary" /> |
|---|
| 9 | // |
|---|
| 10 | if (fb_.verbInfo.executionMode is "start") { |
|---|
| 11 | |
|---|
| 12 | // alias is required |
|---|
| 13 | if (not structKeyExists(fb_.verbInfo.attributes,"alias")) { |
|---|
| 14 | fb_throw("fusebox.badGrammar.requiredAttributeMissing", |
|---|
| 15 | "Required attribute is missing", |
|---|
| 16 | "The attribute 'alias' is required, for a 'dictionary' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
|---|
| 17 | } |
|---|
| 18 | // returnvariable is required |
|---|
| 19 | if (not structKeyExists(fb_.verbInfo.attributes,"returnvariable")) { |
|---|
| 20 | fb_throw("fusebox.badGrammar.requiredAttributeMissing", |
|---|
| 21 | "Required attribute is missing", |
|---|
| 22 | "The attribute 'returnvariable' is required, for a 'dictionary' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | fb_appendLine('<cfset #fb_.verbInfo.attributes.returnvariable# = myFusebox.getApplication().getApplicationData().reactor.createDictionary("#fb_.verbInfo.attributes.alias#") />'); |
|---|
| 26 | |
|---|
| 27 | // |
|---|
| 28 | } else { |
|---|
| 29 | // |
|---|
| 30 | // end mode - do nothing |
|---|
| 31 | } |
|---|
| 32 | </cfscript> |
|---|