LSPS documentation logo
LSPS Documentation
Creating CRUD Components in Forms

CRUD components are implemented in the scaffolding-forms module of the Scaffolding Library by the following components:

  • Entity Detail renders as a form with data of a shared record
  • Entity List renders as a grid with shared record fields and the option to display their details in a popup as well as the Create button below the table

Note that Scaffolding components work only over data of a shared record type.

Creating a CRUD Component over One Entity

The CRUD component for a single entity form is called the EntityDetail component. It provides editable values of a record instance along with any related record instances.

To create a CRUD component over one shared record instance, do the following:

  1. Import the scaffolding-forms module into your Project and Module:
    1. In the GO-BPMN Explorer, right-click your Project, click Add Library; in the popup select Select a built-in library and select the Scaffolding Library in the Library drop-down box.
    2. In the GO-BPMN Explorer, click your module. In the Imports tab of the Properties view, click Add. In the pop-up, select the scaffolding-forms module.
  2. Into a form, insert the Entity Detail component available under Custom Components.
  3. Define the Record Proxy Set property of the component. This is the proxy Set that holds the entity displayed in the EntityDetail. For example, you can create a form variable proxySet and initialize it in the form constructor so it creates a proxy of the entity:
    AuthorCrudDetailForm {
        public AuthorCrudDetailForm(){
          //form variable with the proxy set:
          proxySet := createProxySet(null);
          //form variable with the proxy entity:
          orwellProxy := proxySet.proxy(getAuthorByName("orwell"));
        } ...
    
  4. Set the proxy record from the proxy set as the underlying entity with the setEntity() call, for example on the Init tab, c.setEntity(orwellProxy).
  5. If required, create a component that will call merge() on your proxy set to apply any changes.
    //example click listener on a Submit button
    { e -> proxySet.merge(false); Forms.submit()}
    

Creating a CRUD Component over Multiple Entities

To create a CRUD component with all shared record instances displayed in a tabular manner, do the following:

  1. Import the scaffolding-forms module into your Project and Module:
    1. In the GO-BPMN Explorer, right-click your Project, click Add Library; in the popup select Select a built-in library and select the Scaffolding Library in the Library drop-down box.
    2. In the GO-BPMN Explorer, click your module. In the Imports tab of the Properties view, click Add. In the pop-up, select the scaffolding-forms module.
  2. Into your form, insert the Entity Overview component available under Custom Components.
  3. Define the Entity Type in the properties of the component: This is the shared record type of your data.
  4. To allow selecting rows, call setSelectable(true) on the component. You can request the current selection with the getSelection() call.

To create a new record, click the Create button below the table. If you the component uses a record that has subtypes, they will be able to select the subtype they want to create.

selectingSubtype.png
Selecting a subtype for a new shared record
Note that details of each entity can be displayed in a popup by clicking the Open Detail button . If the underlying shared record has a relationship to another record, you can open the details of the related record from the popup.

openingEntityDetail.png
Opening detail of a related record