| 1 | <cfscript> |
|---|
| 2 | // usage inside other verbs: |
|---|
| 3 | // <transfer:parameter |
|---|
| 4 | // name="paramName" |
|---|
| 5 | // value="someVal" /> |
|---|
| 6 | if (fb_.verbInfo.executionMode is "start") { |
|---|
| 7 | // validate attributes |
|---|
| 8 | // <parameter> must have a parent verb this lexicon: |
|---|
| 9 | if (structKeyExists(fb_.verbInfo,"parent") and |
|---|
| 10 | fb_.verbInfo.parent.lexicon is fb_.verbInfo.lexicon and |
|---|
| 11 | listFind("delete,read,save",fb_.verbInfo.parent.lexiconVerb) neq 0) { |
|---|
| 12 | |
|---|
| 13 | // name - string - required |
|---|
| 14 | if (not structKeyExists(fb_.verbInfo.attributes,"name")) { |
|---|
| 15 | fb_throw("fusebox.badGrammar.requiredAttributeMissing", |
|---|
| 16 | "Required attribute is missing", |
|---|
| 17 | "The attribute 'name' is required, for a 'parameter' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
|---|
| 18 | } |
|---|
| 19 | // value - string - required |
|---|
| 20 | if (not structKeyExists(fb_.verbInfo.attributes,"value")) { |
|---|
| 21 | fb_throw("fusebox.badGrammar.requiredAttributeMissing", |
|---|
| 22 | "Required attribute is missing", |
|---|
| 23 | "The attribute 'value' is required, for a 'parameter' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
|---|
| 24 | } |
|---|
| 25 | // add this parameter to the parent data: |
|---|
| 26 | fb_.verbInfo.parent.parameters[fb_.verbInfo.attributes.name] = fb_.verbInfo.attributes.value; |
|---|
| 27 | |
|---|
| 28 | } else { |
|---|
| 29 | |
|---|
| 30 | fb_throw("fusebox.badGrammar.parameterInvalidParent", |
|---|
| 31 | "Verb 'parameter' has invalid parent verb", |
|---|
| 32 | "Found 'parameter' verb with no valid parent verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
|---|
| 33 | |
|---|
| 34 | } |
|---|
| 35 | |
|---|
| 36 | } |
|---|
| 37 | </cfscript> |
|---|