You are viewing the documentation for Blueriq 17. Documentation for other versions is available in our documentation directory.

What is it for?

AQ_Aggregate_Create is used for creating (=storing) a defined aggregate

Creating and updating aggregates

When creating or updating an aggregate, a snapshot is made of the current profile that includes instances of all entities defined in the aggregate, and all those instances' relations that were included in the aggregate.

By default, all instances of singleton entities are included and no instances of multiton entities are included. The StoreInstances parameter is used to define which multiton instances are stored in the aggregateThe unique Id of the created aggregate will be saved in a selected attribute. This Id can then be used in other services to Read, Update or Delete the aggregate.

If the attribute selected for the AggregateId is not part of a singleton then the target instance parameter can be used to select the instance on which the aggregate Id must be stored. If the target instance has no value, then it is assumed that the selected attribute either belongs to a singleton entity, or that there is an active instance present. If not, an error is thrown. The target instance must be single valued.

Parameters

Name
Direction
Description
Type
Occurrences
Required
AggregateTypeInputSelect the aggregate you want to create and store. This is a list of the aggregate definitions.AggregateSingle valuedYes
AggregateIdOutputThe attribute on which you want to store the created aggregate Id.AttributeSingle valuedYes
TargetInstanceInputThe instance you want to use for storing the aggregate Id.Expression resulting in an instanceSingle valuedNo
VersionIDOutputOutputThe attribute on which you want to store the version Id of the created aggregate.AttributeSingle valuedNo
StoreInstancesInputThe starting point instance(s) for storing.Expression(s) resulting in instance(s)Multi valuedNo

User-set vs system-set

When storing an aggregate, only values that are user-set are stored, all system-set values are not stored. The data of the aggregate is stored in a XML blob.

Default metadata

Storing an aggregate also stores a set of metadata information in the database:

Field
Type
Description
AggregateIDIntegerUnique Id of the aggregate
TypeStringAggregate type
CreatedByUserNameStringUser name of the person/system that created the aggregate
CreatedByIDStringUnique Id of the user. A user name can have duplicates, the user Id makes the user unique
CreationDateDatetimeCreation time stamp of the aggregate

Events

This service uses default events for a commit and for an exception. 

The Unauthorized exit is triggered when the user does not have one of the roles that is set on the Aggregate definition.

Example

Below an example is given for a create service with versioning.

Service call definition

Aggregate definition

Visual overview of aggregate concepts

Aggregate