Wiki source code of Datenquelle


Hide last authors
awa 1.1 1 {{content/}}
2
3 {{info}}
4 After the plugin has been installed, go to the {{designer/}} and add a form element of type //select//. You can then select the plugin as the data source in the //values// panel.
5 {{/info}}
6
7 == Interface IPluginDataSource ==
8
9 {{figure image="plugin_datasource_en.png"}}
10 Position of data source plugins in {{formcycle/}}'s program flow. They are run during the form rendering process.
11 {{/figure}}
12
13 === Use cases ===
14
15 This type of plugin can be used to provide select fields with custom data from external web services, such as a list of countries, zip codes, etc.
16
17 === Method signature ===
18
19 {{code language="java"}}
20 IPluginDataSourceRetVal resolve(IPluginDataSourceParams params) throws FCPluginException
21 {{/code}}
22
23 === Parameters ===
24
25 The method {{code language="none"}}resolve{{/code}} is passed an object implementing {{jpath path="de.xima.fc.interfaces.plugin.param.form.IPluginDataSourceParams"/}}, which contains getters for the following properties:
26
27 * **Projekt**
28 The form for which this plugin has been called.
29 * **Mandant**
30 The client to which the form belongs to.
31 * SessionAttributes
32 * RequestParameters
33
34 == Return value ==
35
36 The method must return an object implementing {{jpath path="de.xima.fc.interfaces.plugin.retval.form.IPluginDataSourceRetVal"/}}. The class {{jpath path="de.xima.fc.plugin.models.retval.form.PluginDataSourceRetVal"/}} provides a reference implementation.
37
38 This object allows you to return a serializable JSON array containing the value that should be shown in the select field. The array must consist of objects, each object must contain the properties {{code language="none"}}text{{/code}} and {{code language="none"}}value{{/code}}. The {{code language="none"}}text{{/code}} is what is displayed as the text of the select option, the {{code language="none"}}value{{/code}} is the value that is sent when the form is submitted. Optionally, the object may also have the property {{code language="none"}}title{{/code}}, which is used as the title attribute of the select option.
39
40 The exception //FCPluginException// will be thrown when an exception occurs while the plugin is being processed.