Summary

CRUD configuration is made of five sections:

Crud

The crud section is shown in the following screenshot.

The fields are:

  • Name: a name of your choice for this crud.
  • Database: the database on which the query will run.
  • Query: the HQL query to retrieve the rows.
  • Search title: the title of the search page.
  • Create title: the title of the create page.
  • Read title: the title of the read page.
  • Edit title: the title of the edit page.
  • Variable: the name of the attribute in request scope where the object will be stored. 
  • Large result set: check this to enable optimizations for large result sets. If set, result set navigation (i.e., the first/previous/next/last links in the read page) will be disabled.
  • Rows per page: number of rows for search pagination. Leave blank to display all the search results in one page, without pagination.

The first time you enter the HQL query you must save the configuration so that properties (see the section below) are updated according to the table you are querying.

Properties

The properties section allows you choose which properties (columns) will be displayed and how.

The columns of the table are the following:

  1. Enable/Disable checkbox: if checked the will be visible in forms. If not checked, the property will not be visible in any form and will be accessible only programmatically through the API.  
  2. Name: the property (column) name in the database.
  3. Label: the label of the property. If it is blank the label is generated from the property name replacing underscores with white spaces.
  4. Insertable: Is this property insertable in the create form?
  5. Updateable: Is this property updatable in the update form? 
  6. In summary: Is this property "in summary", i.e., present in search results?
  7. Searchable: Is this property "searchable", i.e., present in search forms?

Selection providers

Selection providers are a generalization of foreign keys. Selection providers define the allowed values for a column (or set of columns). For more information, see the page on table administration.

Selection providers turn a plain field (e.g., an integer value) into a selection of options.

  1. Columns: the column(s) for which a foreign key or selection provider is available.
  2. Selection provider: the foreign key or selection provider to be used for the column(s).
  3. Display mode: choose between dropdown, radio and auto-complete.
  4. Search display mode: selection providers are used for search forms too. Choose between dropdown, radio, auto-complete, multiple select and checkbox.
  5. Create new href: a link to create a new option on the fly.
  6. Create new text: the text label for the link to create a new option.

Both "create new ..." parameters (5. and 6.) can be dynamically interpolated using OGNL, making it possible, for example, to change the URL according to some rule, or to internationalize the link text, etc. As usual, the dynamic parts start with %{ and terminate with }. The root object of the OGNL context is the CRUD action itself, so you can access its properties and methods. A couple of examples:

  • I18n in the link text: %{getMessage("my.link.text")}
  • Generating a dynamic link: /project/%{object.id}/members?create=

Script

The script section allows you to view and edit the Groovy action that backs the CRUD page. For more information see CRUD customization.