Create and populate the Step entity
At the moment, your application contains only 10 purchase orders.
To make effective use of evaluations, you need more purchase orders in the product. In a real-world situation, you would expect:
- A greater volume of data, even during the early development phase of your application
- A more complex structure of entities in your model.
In the diagram below, you can see your two existing entities – Orders, Global, and the relation between them.

There is one significant missing part: the order process workflow itself. Each of the stages an order moves through represents a step in the process.
As a reminder, you are building this application for Kabels so they can monitor their business workflow process which comprises seven steps.
# |
Process step |
Generated events |
1 |
Purchase Orders Received |
New Order |
2 |
Validation |
Order Valid Order Review Invalid Order |
3 |
Scheduler |
Line Request Scheduled |
4 |
Production Line |
Line Request Completed |
5 |
Shipping |
Logistics Order ASN Shipped |
6 |
Purchase Order Invoicing |
Invoiced |
7 |
Receivables |
Payment Received |
To monitor this workflow, include an entity for process steps in your model. If you apply the same sort of thinking about steps that you did for orders, it might be that the model requires not just an entity for steps, but also a relationship between steps and Global. Something like the diagram below. Adding the relation to Global would enable you to summarize information about all steps.

Adding a relationship between orders and steps is also good to add visibility into what orders are in a step. This is the more complete picture of what your model will include:-
The direction of the relations you are going to create will be:
- From Step to Global (many to one)
- From Order to Step (because there can be more than one order in a step, but an order can never be in more than one step).


1. Create the Step entity
As you've seen before an entity is only part of the process. You must also create instances of that entity.
Before you can read data in your model, you need to first create the location where that data will be stored.
Step |
Action |
1 |
Click the Configuration icon > Entities.
|
2 |
Click the New Entity button.
- Create a new [mono or multi] dimensional entity:
- Name: Step
- Space: Model
- Description: Process Step
- Type: Configuration
|
3 |
On the Attributes tab, add the following observed attribute:
- Name: step Name
- Type: String
- Description: Name of this process step
Click Done. |
4 |
Add the following observed relation attribute:
- Name: ref2Global
- Reverse Name: 2Steps
- Description: Links steps to global
- Target: Global
Click Done.
|
5 |
On the Keys tab, create a key for the Step entity.
- Name: Key
- Attribute: step Name
Click Done. |
6 |
Click Save. |
2. Create a mapping and a route for Step
Now that the Step entity is created, create the means to populate the entity. To create the instances of the Step entity, you need to know the names of the process steps.
The test data you used in prior parts of the tutorial did not include information on the step names.
There are new data files, supplied as part of this . Unzip the DI_tutorial_Part4.zip .zip file into a directory. You should see three files:
Part-4-11-Steps.txt
Part-4-31-Days.txt
Part-4-10-Orders.txt
The Part-4-11-Steps.txt
file is the first one you will use. Note that in this data file there is no header record, only data fields. You now have an entity data to provision it.
To populate the Step entity, you're missing a mapping and a route.
Create a mapping for Step
Step |
Action |
1 |
Click the Data Integration icon > Mappings.
|
2 |
Click the New Mapping button. |
3 |
Give your mapping the following characteristics:
- Name: map
- Parameter: step Name, Type: String
|
4 |
Click the Add Instance Operation button:
- Select the Step entity.
- DEFAULT TIMES area – In the Resolution and Operations begin fields, , select Constant, then enter
{{}} .
- RESOLUTION area:
- Click the hyperlink and .
- Select the Create an instance option. This is the correct option for what to do if an instance of Step is not found.
- OPERATIONS area – Create the following two operations.
|
5 |
For the first operation:
- Add an to change the value of the relation to the .
- In the line for Value, select Constant, Global.
|
6 |
For the second operation:
- Add a set space operation.
- In the line for Space name, select Constant, .
|
7 |
Click Save. |
8 |
Click the Copy Snippet icon. |
Create a route for Step
Step |
Action |
1 |
On the left menu, click Routes.
|
2 |
Click the New Routing Context button and give your new route the following characteristics:
|
3 |
In the body of the route, enter the following:
- A
from uri statement that uses direct:file .
- Specify the
csv delimeter with skipHeaderRecord="false" .
- Wrap the
csv delimiter line in an unmarshal statement.
- Add log message information:
<log message="csv - ${body}"/> .
<split> the route.
- Add a
simple statement to retrieve the body of the file.
- Add log message information to know whether the split is successful:
<log message="split - ${body}"/> .
- Paste the snippet from the Step mapping. The step information is in
body[0] .
- Close the split statement, close the route.
|
4 |
Click Save. |
Once you're done, start the route, and use the sample text file as an input.
Check the results
To check the results, you can look at the logs and or click the Explore icon on the main menu to explore the Step entity. The order of the step names may vary.

If you do not see these results, you can check that the Step route you created matches the one below:
<routes xmlns="http://camel.apache.org/schema/spring" xmlns:u="http://www.systar.com/aluminium/camel-util">
<route>
<from uri="direct:file"/>
<unmarshal>
<csv delimiter="," skipHeaderRecord="false"/>
</unmarshal>
<log message="csv - ${body}"/>
<split>
<simple> ${body}</simple>
<log message="split - ${body}"/>
<setBody>
<u:map-create>
<u:map-entry key="step Name">
<simple>${body[0]}</simple>
</u:map-entry>
</u:map-create>
</setBody>
<to uri="tnd-absorption:mapStep"/>
</split>
</route>
</routes>