The entity loader editor provides access to the BOM vocabulary. You define the entities
from your solution BOM project that you want to load by writing a set of constructs. Once
defined, an entity with a specific entity ID can only be loaded once.
Before you begin
Before you create entity loaders, you must create a test client project.
About this task
In an entity loader, you can define test entities for a solution. The entity loader syntax is
controlled by the Intellirule editor, and the syntax is based on the business rules
language. Specific language constructs are available to use variables and to modify
an entity.
All the entities in an entity loader (.eldr) must be defined by using the
load <entity> construct. Entities
can be specified in no particular order.
Procedure
- Create an entity loader file.
- Click .
- In the Entity Loader wizard, select a test client
project in your workspace.
- Enter a name for your entity loader file.
- Click Finish.
The .eldr file is saved in the Entity
Loader folder in the test client project. The file opens in the
editor.
- Open the Text editor of the .eldr
file.
- Press Space or Ctrl+Space to view the available constructs.
- Double-click a construct to insert it in the definition.
To define a variable that identifies
the customer as
Jane, enter the following
line:
define 'the customer' as the
customer identified by "Jane" ;. You can then use this variable
to refer to
the customer in the
load construct. For example:
define 'the customer' as a new customer where the customer id is "Jane" ;
load 'the customer' ;
- Optional: Add concepts that are related to an entity. In the following example, a new customer, Jane, is identified by id, first name, and last
name.
define 'Jane' as a new customer where
the customer id is "jane@example.com",
the first name is "Jane" ,
the last name is "Doe" ;
load Jane ;
- Add a load construct for each
entity you want to include in your loader. The entity can refer to a variable
name or a new entity of a specific type.
You can use variables in an load
construct. For example, the following load uses the where construct to set the id attribute to the variable 'banana' and the description to
"A banana".
load a new product where
the id is 'banana' ,
the description is "A banana" ;
- Optional: Use the add construct to add new objects with
specific values. In the following example, the product banana is
added to the items in Janes
Cart:
define 'Janes Cart' as a new shopping cart where
the customer is Jane ,
the shopping cart id is "123456789" ;
add the product identified by 'banana' to the products of 'Janes Cart' ;
load 'Janes Cart' ;
- Check that all of the entities have a corresponding load construct, and each define, add, and load
construct ends with a semi-colon (;).
- Save the file.
Example
define 'Jane' as a new customer where
the customer id is "jane@example.com",
the first name is "Jane" ,
the last name is "Doe" ;
define 'Janes Cart' as a new shopping cart where
the customer is Jane ,
the shopping cart id is "123456789" ;
load Jane ;
define 'banana' as "BANANA";
load a new product where
the id is 'banana' ,
the description is "A banana" ;
add the product identified by 'banana' to the products of 'Janes Cart' ;
load 'Janes Cart' ;