| 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> |
|---|