| 1 | <cfscript> |
|---|
| 2 | // usage: |
|---|
| 3 | // <transfer:read object="task" bean="thisTask"> |
|---|
| 4 | // <transfer:parameter name="id" value="#attributes.id#" /> |
|---|
| 5 | // </transfer: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_appendLine('<cfset _propertyMap = structNew() />'); |
|---|
| 27 | // gather up parameters: |
|---|
| 28 | for (fb_.p in fb_.verbInfo.parameters) { |
|---|
| 29 | fb_appendLine('<cfset _propertyMap.#fb_.p# = "#fb_.verbInfo.parameters[fb_.p]#" />'); |
|---|
| 30 | } |
|---|
| 31 | fb_appendLine('<cfset #fb_.verbInfo.attributes.bean# = ' & |
|---|
| 32 | 'myFusebox.getApplication().getApplicationData().transferFactory' & |
|---|
| 33 | '.getTransfer().readByPropertyMap("#fb_.verbInfo.attributes.object#",_propertyMap) />'); |
|---|
| 34 | fb_appendLine('<cfset myFusebox.trace("Transfer","Read Bean") />'); |
|---|
| 35 | } |
|---|
| 36 | </cfscript> |
|---|