crud-wrappers-stencils
Service icon

CRUD wrappers stencils

Stable version 1.3.0 (Compatible with OutSystems 11)
Uploaded
 on 16 October 2023
 by 
5.0
 (1 rating)
crud-wrappers-stencils

CRUD wrappers stencils

Documentation
1.0.0

CRUD Wrappers Stencils documentation

Description

The OutSystems best practices require that entities are exposed read only. Therefore we require public database actions (aka crud wrappers). This component provides a template for creating a new entity and the required crud wrappers.

Preparing a new core services module

  1. In Service Studio open module `Stencil_DBActions_Pat`
  2. If not already exist create a new service module. E.g. 'Demo_CS'
  3. Create a new user exception `ValidationException`
  4. Copy Server action  `NotificationListConcatenate` to your module. Note: You may want to move this action to a library and add a dependency instead.
  5. Create a Role to authorize users to edit your data e.g. `DemoEdit`
  6. In Module `Stencil_DBActions_Pat` go to the Logic Tab and copy Server Action `TemplateRoleCheck` to your module
  7. Fix the errors by replacing the TemplateRole with \<YourRole\>
  8. Rename the action `TemplateRoleCheck` to `\<YourRole\>RoleCheck`
  9. Repeat this step for each role you need.

Adding entities to the module


⚠️Warning Do NOT publish your module until you completed all the steps below!

  1. If not already open in service studio open your core service module and module `Stencil_DBActions_Pat`
  2. Copy TemplateEntity and paste it in your module and rename it to the desired name. E.g. `Town`
  3. Fill the description for the entity
  4. Change the expose read only property to "Yes"
  5. In module`Stencil_DBActions_Pat` Go to Logic tab (Ctrl+3)
  6. Copy the folder TemplateEntityDbActions to your module
  7. Go to Data tab (Ctrl-4) and locate the TemplateEntity in the Stencil_CoreServices_Pat referenced module
  8. Find all usages of the TemplateEntity (F12)
  9. Use the button: Replace all instances with your new entity (select in the popup)
  10. Remove the TemplateEntity dependency (Del)
  11. Using Ctrl + R: find string "TemplateEntity" and replace all occurrences with your new entity
  12. Designate a meaningful name to the FunctionalKey for your entity and using Ctrl + R find string `FunctionalKey` and replace all occurrences with that name
  13. Fix the errors one by one by clicking on each of them
  14. Add any the additional attributes to your entity
  15. Add additional checks to the `/<YourEntity/>_Validate`
  16. When done, check that all the TODO (To Be Done) items (shown as warnings in the TrueChange tab) and remove them when done.
  17. Publish your module

Repeat these step for each entity you want to add to your module.