Updated on 2025-08-15 GMT+08:00

Creating a Business Object

A business object (BO) is a software unit that encapsulates complete data models, service logic, and page display. It provides complete services for a scenario and specific services for upper-layer applications. Different users can customize BOs with specific functions. They can package these BOs and share them with others. Once a BO package is installed, it can be integrated into an application, providing access to its specialized services.

For example, a device BO provides unified device semantics for upper-layer applications and abstracts and encapsulates device capabilities excluding O&M. An alarm BO provides unified campus alarm semantics, obtains alarm data from subsystems and upper-layer applications, and displays data using a unified model. A GIS BO encapsulates and standardizes GIS APIs for tenant management, map management, and location services. You can use these BOs to develop smart smoke sensing applications for device data access, processing, and monitoring.

Creating a BO

  1. Go to the Huawei Cloud Astro Zero console.
  2. On the homepage, click Access Homepage. The application development page is displayed.

    If the system shows a message indicating that you do not have the developer permission, contact the administrator to add it, see How Do I Grant Developer Permissions to a Subuser After Authorization Fails?

  3. In the navigation pane, choose Assets. On the displayed page, click Create BO or .
  4. Set basic BO information and click OK.

    Figure 1 Setting basic information
    Table 1 Parameters for creating a BO

    Parameter

    Description

    Add Icon

    Click Add Icon to add an icon for the new BO.

    Label

    Label of the new BO, which is displayed on the page.

    Value: 1–80 characters.

    Name

    Name of the BO to be created. The name is the unique identifier of the BO in the system and cannot be changed after being created. The naming requirements are as follows:

    • The value cannot exceed 26 characters, including the prefix namespace.

      To prevent duplicate data names among different tenants, each tenant must define a unique namespace when first creating an application. A tenant can create only one namespace. After being created, the namespace cannot be modified.

    • Start with a letter and can contain only letters, digits, and underscores (_). It cannot end with an underscore (_).

    Category

    Category to which a BO belongs. Select a value from the drop-down list.

    Icon

    Icon displayed for a new BO in a category.

    Description

    Enter the description of the BO.

    Value: 1–255 characters.

    Advanced Setting > Runtime Version

    Runtime version that the developed asset packages depend on. If this version is inconsistent with the offline version, incompatibility issues may occur.

  5. On the BO development page, develop required objects, flows, events, and scripts.

    Figure 2 BO development page

    You can develop new system features or reuse existing similar features in the system. For example, if you want to reuse the existing flow queryProfiles, select Use existing flow when creating a flow, select the target flow, and click Add. For details about how to create a flow, see Creating a Blank Flow.

    Figure 3 Reusing features

    When creating a private BO API, you can bind flows, scripts, and objects. By defining service APIs, you can quickly customize required service APIs and register the API services with the gateway for third parties to use.

    Figure 4 Creating a private API
    • In the navigation pane of the application designer, choose Integrations. Click + next to Private API to create a private API.
    • If other applications use private APIs within this BO, the following rules apply: APIs bound to the flow resource type can be called by both flow and script. APIs bound to the script or object resource types are restricted to being called solely by script.

  6. After a BO is developed, you can package the BO and release it.

    Release the BO as an installation package, patch package, or source code package by referring to the operations in Releasing an Application As an Installation Package or Patch Package and Releasing and Deploying a Source Code Package. The installation package and patch package do not support secondary development. The source code package supports secondary development.

Importing a BO Installation Package or Patch Package

If another user needs to use a created BO, the user can import the BO installation package or patch package to Huawei Cloud Astro Zero. After the BO is imported, it can be used when you create an application.

  1. Go to the Huawei Cloud Astro Zero console.
  2. On the homepage, click Access Homepage. The application development page is displayed.

    If the system shows a message indicating that you do not have the developer permission, contact the administrator to add it, see How Do I Grant Developer Permissions to a Subuser After Authorization Fails?

  3. In the navigation pane, choose Assets.
  4. On the displayed page, click Install Asset.
  5. Upload the obtained BO installation package or patch package and click Confirm.

    After the import is successful, you can view the imported BO on the Assets > Installed tab page.

    Figure 5 Viewing the imported BO

  6. (Optional) After the BO asset package is imported, perform the following operations:

    • On the Installed tab page, move the cursor to of the target BO, and choose Edit. The BO editing page is displayed. The BO can only be viewed. Secondary development is not supported.
    • On the Installed tab page, move the cursor to of the target BO, and choose Detail. On the displayed page, you can view the events and event parameters defined in the BO.
    • On the Installed tab page, move the cursor to of the target BO, and choose Delete to delete the imported BO.

Importing the BO Source Code Package

If another user needs to use a created BO, the user can import the BO source code package to Huawei Cloud Astro Zero. After the BO is imported, it can be used when you create an application. The imported BO source code package supports secondary development.

  1. Go to the Huawei Cloud Astro Zero console.
  2. On the homepage, click Access Homepage. The application development page is displayed.

    If the system shows a message indicating that you do not have the developer permission, contact the administrator to add it, see How Do I Grant Developer Permissions to a Subuser After Authorization Fails?

  3. In the navigation pane, choose Assets.
  4. On the displayed page, click Import Project.
  5. Upload the obtained BO source code package and click the confirm button.

    After the import is successful, you can view the imported BO on the Assets > Developing tab page.

    Figure 6 Viewing the imported BO

  6. (Optional) After the BO source code package is imported, perform the following operations:

    • On the Developing tab page, move the cursor to of the target BO and choose Edit. The BO editing page is displayed. On the displayed page, you can perform secondary development on the BO.
    • On the Developing tab page, move the cursor to of the target BO and choose Clone to clone the BO. When a BO is cloned, the entire application structure is copied, but the object data of the application is not synchronized.
    • On the Developing tab page, move the cursor to the corresponding BO, click and choose Export to export the BO source code package to the local host.
    • On the Developing tab page, move the cursor to of the target BO and choose Delete to delete the BO.
    • On the Developing tab page, move the cursor to of the target BO and choose Detail. On the displayed page, you can modify the BO's label and runtime version and delete custom APIs.

Using BOs in Applications

When developing an application, you can add BOs to the application by adding dependencies. Once a BO is integrated, it becomes available for use within the application. For instance, on a standard page's service model, you can call the flows from the included BOs.

  1. Log in to the application designer by referring to Logging In to the Application Designer.
  2. In the navigation pane, choose Settings.
  3. On the displayed page, choose Dependencies and Openness > App Dependencies > Add.
  4. On the displayed page, select the target BO and click Confirm.

    Figure 7 Selecting the BO on which the application depends

    BOs that have been released as a source code package can be packaged together with associated upper-layer applications.

  5. Use the imported BO.

    In the service model of a standard page, you can call the flows from the included BO.

    1. On a standard page, select a widget (for example, a form) and click under the data binding area.
      Figure 8 Data binding
    2. In Select Model, click New. On the displayed page, set the model name, select Services, and click Next.
      Figure 9 Creating a model
    3. Call the flows from the included BO.
      Figure 10 Calling the flows from the included BO

Related Documents