, ,

Maintain Domain Classes and Forms in LCDP.ai Low-Code Development Platform

Lawrence Liu Avatar

·

, ,

·

Maintain Domain Classes and Forms in LCDP.ai Low-Code Development Platform

A comprehensive guide to maintain domain classes and forms within the LCDP.ai low-code development platform.

Purpose of the Blog

The purpose of this blog is to provide a comprehensive guide to creating and modifying domain classes and forms within the LCDP.ai low-code development platform.

This blog aims to demystify the process of defining domain models, setting field attributes, and configuring metadata, enabling developers to leverage the platform’s capabilities more effectively.

By following the step-by-step instructions and best practices outlined in this blog, developers can create robust, data-driven applications with ease, ultimately accelerating the development process and enhancing the overall quality of their software.

Who Should Read This Blog

This blog is targeted at developers and software engineers who are working with or planning to work with the LCDP.ai low-code development platform.

It is particularly useful for those who are responsible for designing and implementing the data model and form design of their applications. Additionally, it can serve as a valuable resource for project managers and architects who need to understand the capabilities and limitations of the platform to make informed decisions about its adoption and use in their projects.

Overall, anyone involved in the development process of applications on the LCDP.ai platform can benefit from the insights and guidance provided in this blog.

What are Domain Classes and Why are They Important?

Domain classes, also known as entity classes or business objects, are a fundamental concept in object-oriented programming and domain-driven design.

They represent the core entities, concepts, and data structures in a business domain or application. In a typical application, domain classes encapsulate the state and behavior of real-world objects. For example, in an e-commerce system, you might have domain classes like Customer, Product, Order, and Invoice. Each class has properties (attributes) that represent the object’s data, and methods that define its behavior and operations.

Domain classes are important because they provide a clear, organized model of the business entities and their relationships. By encapsulating business logic and data access within domain classes, you can achieve a more modular, maintainable application design. This promotes reuse, makes the code easier to understand and test, and helps enforce business rules and data integrity. In a low-code development platform like LCDP.ai, domain classes also play a crucial role in simplifying application development.

By defining the domain model visually, you can quickly generate database tables, user interfaces, and API endpoints without writing code manually. This accelerates development and reduces the need for repetitive boilerplate code.

Brief Overview of LCDP.ai and Its Low-Code Capabilities

LCDP.ai is a powerful low-code development platform that enables rapid application development and delivery. It provides a visual, model-driven approach to building enterprise-grade applications without the need for extensive coding.

  • Visual domain modeling: LCDP.ai provides a user-friendly interface for defining domain classes, their properties, relationships, and metadata. Developers can create complex data models by simply creating records in the UI, specifying types and constraints, and configuring advanced options.
  • Automatic database generation: Based on the defined domain model, LCDP.ai automatically generates the corresponding database tables and schemas.
  • Runtime UI generation and customization: LCDP.ai can automatically generate user interfaces (forms, tables, detail views) from the domain model. These UI components are fully customizable, allowing developers to modify the layout, styling, and behavior to fit their specific requirements.
  • Security and access control: LCDP.ai includes built-in security features, such as user authentication and role-based access control (RBAC). Developers can define granular permissions and access rules to ensure data protection and compliance.

By leveraging these low-code capabilities, LCDP.ai significantly reduces development time and effort compared to traditional coding approaches. It empowers both professional developers and business users to build and deploy applications quickly, while maintaining high quality and performance.

Create and Modify Domain Models via the User Interface

Creating and modifying domain models in the LCDP.ai platform is a straightforward process that can be accomplished through the user interface. This guide will walk you through the steps from logging in to the platform to navigating to the “DomainClass” list page, where you can manage your domain models.

  1. Register for a Demo Account: If you do not already have an account on our demo system, you can register for a new demo account by visiting https://muyan.muyan.io/account?scene=register. Follow the instructions provided to create your account.
  2. Log In to the Platform: Once you have registered, you can log in to the LCDP.ai platform by navigating to https://muyan.muyan.io. Enter your credentials to access your account.
  3. Access the DomainClass List Page: After logging in, you will be taken to the dashboard of the LCDP.ai platform. To access the domain models:
    • Click on the “Development” menu option located in the sidebar or top navigation bar, depending on your screen size and layout.In the dropdown menu that appears, select “DomainClass” to navigate to the list of domain models.
    The “DomainClass” list page is where you can view, create, and modify your domain models.
    From here, you can start creating a new domain model or edit an existing one.
Login to LCDP.ai low code development platform and go to domain class list page
  1. Here is a screenshot of the operation path to create or modify a domain model:
  1. Create or Modify a Domain Model: To create a new domain model, click on the “Create” button on the “DomainClass” list page. You will be taken to a form where you can define the properties of your domain model.

When creating or modifying a domain model, you’ll need to focus on the following basic properties:

  • Short Name: Enter a short, unique identifier for your domain model. This name will be used as a reference in your code. The short name should follow any naming conventions or restrictions specific to your platform.
  • ExtInfo Configuration: The ExtInfo field in a domain model allows you to specify additional metadata that can influence the behavior of the domain model. This metadata is provided in the form of a JSON object. Here are some common properties that can be set in the ExtInfo:
    • inlineSearchColumns: This property specifies which fields should be used for quick search in the front-end object input controls. For example, if you want to use the “name” and “label” fields for search, you can set it as follows: "inlineSearchColumns": ["name", "label"]
    • labelField: This property determines which field should be displayed as the label for the object in the front-end controls. For example, if you want to use the “label” field as the identifier, you can set it as follows: "labelField": "label"
    • loadAfter: This property specifies the order in which the domain model should be loaded when importing seed data. If you want the current domain model to be loaded after “DynamicLogic” and “DynamicFieldDefinition”, you can set it as follows: "loadAfter": ["DynamicLogic", "DynamicFieldDefinition"]
    Here’s an example of a complete ExtInfo configuration:{ "inlineSearchColumns": ["name", "label"], "labelField": "label", "loadAfter": ["DynamicLogic", "DynamicFieldDefinition"] }When setting the ExtInfo for your domain model, make sure to validate the JSON syntax and ensure that the properties you include are supported by your platform. This metadata can greatly enhance the functionality and usability of your domain model, so it’s important to configure it according to your specific needs.
  • Fields: Add fields to your model by specifying their attributes. For each field, you will need to provide the following information:
    • Name: The unique identifier for the field within the domain model.
    • Data Type: Select the data type for the field. The available options include STRING, BOOLEAN, BIG_DECIMAL, INTEGER, LONG, DOUBLE, LOCAL_DATE, ZONED_DATETIME, JSON_STRING, DOMAIN_OBJECT, and DOMAIN_OBJECT_LIST.
    • Reference Domain: If the data type is DOMAIN_OBJECT or DOMAIN_OBJECT_LIST, specify the reference domain model.
    • Nullable: Indicate whether the field can be null.
    • Editable: Specify whether the field can be edited after the domain model is created.
    • Default Value: Provide a default value for the field, if applicable.
    • Options: For fields with a predefined set of options, enter a JSON array of options (e.g., [“option1”, “option2”]).
    • Ext Info: For fields that require additional metadata, such as BIG_DECIMAL fields, specify this metadata in the Ext Info field. For example:{ “scale”: 2, “precision”: 10 }

After defining the basic properties and adding fields to your domain model, save your changes and test the domain model within the LCDP.ai platform to ensure everything is configured correctly.

Testing the Domain Model Definition

To test the CRUD operations of your new domain model, you will need to define a menu, a table list, and create and update forms. Follow these steps to set up and test your domain model:

  1. Define the Menu:Navigate to System Configuration -> UI Display -> Menus in the LCDP.ai platform. Create a new menu item named “Customer.” This menu will be used to access the table list and forms for your domain model.

Define the Forms

Go to Development -> Domain Classes. In the list page, find your domain class and click on the forms icon in the “Forms” column. A drawer will pop up from the bottom, showing a list of all forms associated with the domain class.

Create a table_list form for your domain class. This form will display a list of records and provide options for creating, viewing, editing, and deleting records. When creating the table_list form, link it to the “Customer” menu created in Step 1.

Create a create form for your domain class. This form will be used to create new records. Associate the role_developer and role_admin roles to this form to ensure that only users with these roles can access the form.

Create an update form for your domain class. This form will be used to update existing records. Similarly, associate the role_developer and role_admin roles to this form.

  1. Test CRUD Operations: Once the menu, table list, create form, and update form are defined, navigate to the “Customer” menu item in the LCDP.ai platform.
  2. Test creating a new record by using the create form. Ensure that the form fields match the attributes of your domain model and that the record is saved correctly.
  3. Test viewing and updating an existing record by using the table list and update form. Make changes to the record and verify that the updates are saved correctly.
  4. Test deleting a record from the table list and confirm that the record is removed from the list.

By following these steps, you can effectively test the CRUD operations for your new domain model definition and ensure that everything is working as expected.

Understanding the Table Name Convention

In the LCDP.ai low-code development platform, the table name for each domain model is automatically generated based on the tenant ID and the short name of the domain model. The convention used is tenantId_shortname, where tenantId is the unique identifier of the tenant and shortname is the short name specified for the domain model.

This naming convention ensures that the table names are unique across different tenants and easily identifiable. It also helps in organizing the database schema in a structured manner, making it easier to manage and maintain the data.


Discover more from LCDP.ai Infinity Code

Subscribe to get the latest posts to your email.

Leave a Reply