Creating entity initialization extensions

Create an entity initialization extension to upload past data to an external data source. Initializing entities with meaningful history enables the solution to process incoming events immediately. You initialize entities only once.

Before you begin

Before you create your entity initialization extension, you must create a solution project, model the entities and events, and create an extension project.

About this task

Use the Entity Initialization Extension wizard to create an EntityInitializer class to initialize an entity. The EntityInitializer class contains two methods.

  • The createEntityFromEvent method is called when a specific event type occurs. In this method you specify how the event initializes the entity. The attributes of the entity defined in the model must match the Java™ implementation.
  • The initializeEntity method is always called during event initialization after createEntityFromEvent, unless null is returned.

Using the ConceptFactory class you can initialize a sub-class of the entity type from the event and emit new events. You can also make use of solution properties by using the extension API methods getSolutionProperties and getSolutionProperty.

You can initialize extension projects by writing initialization statements. The following example shows an initialization statement for a vehicle:
a vehicle is initialized from a vehicle activity, where this vehicle comes from the vehicle of this vehicle activity.

Procedure

  1. Click File > New > Other > Insight Designer > Entity Initialization Extension, and then click Next.

    The Entity Initialization Extension wizard is displayed.

  2. From the drop-down list, select the Extension Project in which you want to store the entity initialization extension.
  3. Enter a package name. The package name must comply with the Java package naming conventions. For example, com.example.mypackage.
  4. Enter a Java class name.
  5. Select an entity type. Entity types are defined in the business model definition file. The drop-down menu lists the entities defined in your model. If no entities are defined in the model you cannot create an implementation. For more information about defining entity types, see Business model definitions.
  6. Click Finish.
  7. Complete the Java file with the information necessary to connect to your external data source.