Create and Edit Business Objects in Oracle Visual Builder

You can create a business object in Oracle Visual Builder, such as an invoice, purchase order, or an audit. Think of a business object as a resource similar to a database table; it has fields that hold the data for your application. Like a database table, a business object provides the structure for data. Business objects are stored in a database. The apps in your visual application and other clients access the business objects by using their REST endpoints.

Create a Business Object

You use custom business objects to store data that isn't provided by an external service. The data in your custom business objects is stored in the database that was provisioned for your service instance.

When you create custom business objects, you specify each of the fields that your application needs. As you develop your application, you can modify your business objects to add and modify fields as needed. Your custom business object is exposed as a set of endpoints that provide REST APIs for operations that you can call from page components.

To create a business object:

  1. Click the Business Objects tab.
  2. Click Create Business Object.
  3. Enter the label for the business object and click Create.
    The ID value is filled in automatically based on the Label.

When you click Create, an artifact window for the new business object opens in the main window and displays the Overview tab. The window contains additional tabs for viewing and editing the various attributes of the business object: Fields, Security, Business Rules, Endpoints, and Data.

You can see the endpoints for the business object that are created by default in the Endpoints tab.

You can also create business objects using the Diagrammer.

View, Create, and Edit Business Object Relationships

The Relationships area of the Overview tab for a business object displays the relationships between that business object and other business objects in your application.

When you create a reference to another business object, the relationship between the current business object and the one being referenced is, by default, many-to-one. For example, when you create a reference from an Employee business object to a Department business object, the employee can belong to only one department, but a department typically has many employees.

The referenced business object, Department, also appears in the Endpoints tab for the Employee business object.

You can delete a relationship, but only if it's associated business objects aren't used anywhere in your application.

To create a new relationship:

  1. In the Business Objects tab, select the business object that you want to view.
    The contents of the Overview tab are displayed.
  2. Click the New Relationship icon next to Relationships.
  3. In the dialog box, select the business object you want to create a relationship with.
  4. Select the cardinality for each object (Many or One).
    You can click the Reverse Relationship button to switch between one-to-many and many-to-one. You can specify cardinalities of one-to-one and many-to-many between business objects, in addition to many-to-one and one-to-many. If you specify many-to-many, an intersection business object with two reference fields is automatically created. Its name is a concatenation of the two business objects. For an intersection business object, you can't deselect the Required check box in either of the reference fields, and the default delete rule is Cascade.
  5. Edit the properties of the Relationship field (the ID, the Display Label, the Default Display Field, the Required check box, the Delete Rule). For Delete Rule, the available choices are Cascade, Restrict, and Set To Null. Whether you can edit a property and what values are available depends on the type of relationship and the objects.
  6. Click Create.
  7. Click Save to save the new relationship.
The new relationship is displayed in the Relationships list. If you specified many-to-many as the cardinality, the new intersection business object is also displayed.

To edit a relationship, click the Edit icon next to the relationship name, and make the desired changes. Some fields can't be edited and are disabled. You can specify the Label and select the Default Display Field. You may be able to select the Required check box for the field, and you can specify a delete rule. The default delete rule is Restrict, but you may be able to select Cascade or Set To Null.

Add Fields to Business Objects

You can use the Fields tab of the artifact window to create fields for your business objects.

You can create new fields for your business object while it is in Development status.

To add a new field:

  1. Click the Fields tab of the business object that you want to edit.
  2. Click the + New Field button.
  3. In the Label field, enter the name of the field.
    The Id value is filled in automatically based on the field label.
  4. Select the Type of the field.
    The available types are String, Number, Boolean, Datetime, Date, Time, Reference, Email, Percentage, Phone, and Uri. For a Reference type, you’ll need to specify the Reference Business Object and the Default Display Field.
  5. Click Create.

Edit the Fields of Business Objects

You can use the Fields tab of the artifact window to modify the fields of your custom business objects.

You can edit the fields of business objects when your application is in Development status. You can edit fields to specify constraints.

To edit the properties of a field:

  1. Click the Fields tab of the business object that you want to edit.
    The Fields tab displays a table that lists all the fields that are defined in the schema for the business object.
  2. Select the row of the field that you want to edit.

    When you select a row in the table, the editor displays the properties that you can edit.

  3. Edit the properties of the field.
    The properties that are available will depend on the data type of the field. For example, you might be able to specify an initial value for the field using a static value, an expression, or a formula. You can also specify field constraints.
  4. Click Edit again to close the dialog box, and click Save.