T - the bean type for this ActionProviders perform(...)-method. Must match
MetaData.getBindClass() of the Datasource used by the Actionpublic interface ActionProvider<T>
ActionProvider usually performs a CRUD-action on a domain object. The implementing class needs to be
defined in the application's beans.xml. This bean is then being referenced in a concrete Action:
<action id="update">
<config>
<title id="issue.update" />
<params>
<param name="form_action" />
<param name="issueName" />
<param name="edit" />
</params>
</config>
<condition expression="${form_action eq 'update' and not empty issueName}" />
<datasource id="issue">
<params>
<param name="issueName">${issueName}</param>
<param name="edit">${edit}</param>
</params>
</datasource>
<bean id="issues">
<option name="action" id="update" issue="${issueName}" />
</bean>
</action>
There is no need to implement one ActionProvider per Action, since the Bean can be
parameterized using different BeanOptions. So for example, the above defined bean could also be used for
creating a new domain object, using another BeanOption:
<action id="create">
<config>
<title id="issue.create" />
</config>
<condition expression="${form_action eq 'create'}" />
<datasource id="new_issue">
<params>
<param name="form_action" />
</params>
</datasource>
<bean id="issues">
<option name="action" id="create" />
</bean>
</action>
The distinction between create and update then can be done like this:
if ("create".equals(options.getOptionValue("action", "id"))) {
// create new domain object
} else if ("update".equals(options.getOptionValue("action", "id"))){
// update existing domain object
}
| Modifier and Type | Method and Description |
|---|---|
void |
perform(Site site,
Application application,
Environment environment,
Options options,
Request request,
T formBean,
FieldProcessor fieldProcessor)
Performs an action on the given
formBean |
void perform(Site site, Application application, Environment environment, Options options, Request request, T formBean, FieldProcessor fieldProcessor)
formBeansite - the current Siteapplication - the current Applicationenvironment - the current Environmentoptions - the Options for this ActionProviderrequest - the current RequestformBean - the bean which has been createdfieldProcessor - the FieldProcessor containing all writable FieldDefinitions for this actionCopyright © 2011–2021 aiticon GmbH. All rights reserved.