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

What is it for?

AQ_Aggregate_Read is used for loading a stored Aggregate into the profile based on a (known) Aggregate Id


This service will read an aggregate based on an aggregate type and Id. This service consults the database of stored aggregates. It will load the entry with the provided Id. If the Id is not present in the database, the IDError exit is taken. Otherwise, the aggregate entry is loaded into the profile. In case of versioned aggregates, this service will read the aggregate based on aggregate Id in combination with version Id.

Parameters

Name
Direction
Description
Type
Occurrence
Required
AggregateTypeInputSelect the aggregate you want to read. This is a list of the aggregates definitions.AggregateSingle valuedtrue
AggregateIdInputThe attribute that holds the Id of the aggregate you want to read.Expression resulting in an integerSingle valuedtrue
VersionIDInputBidirectionalThe Id of the version to read.Expression resulting in an integerSingle valuedfalse
VersionIDOutputOutputThe attribute on which the Id of the version that is to be read will be stored.AttributeSingle valuedfalse
TargetInstanceOutputThe instance on which the Id of the version that is to be read will be stored in the attribute mentioned in VersionIDOutput.Expression resulting in an instanceSingle valuedfalse

How to - find the AggregateId

The AggregateId of the desired Aggregate can be found for example using a Service call type: AQ_Aggregate_Search or by displaying a Container type: AQ_Aggregate_List containing a Button.

Existing instances

When a singleton instance is present in the profile and an aggregate is read which holds this instance, the instances are merged. The merging rules are as follows:

  • When an attribute is filled in the profile and the same attribute is empty in the loaded aggregate, the value of attribute in the profile is kept. 
  • When an attribute is empty in the profile and the same attribute is filled in the loaded aggregate, the value of read attributeis used.

  • When an attribute is filled in both the profile as well as the aggregate, the read aggregate entry overrides the profile entry.

For each instance of a multiton, an instance is created. This means that instances of multitons are not merged, which has consequences when reading aggregates with multitons. Most likely, the profile must be cleared before reading such an aggregate.

Static instances have the same merge behavior.

Events

This service uses default events for a commit and for an exception. The IDError exit should be mapped to a custom event and will be triggered when the given AggregateId cannot be found.

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 read service with versioning.

ER diagram



Aggregate definition




Service definition

Visual overview of aggregate concepts

Aggregate





3 Comments

  1. Unknown User (m.gulpers)

    Unknown User (m.schadd)

    Waarom was deze ook alweer bidirectional? Munish Mahabiersing vroeg dat net tijdens de cursus en ik ben het weer vergeten (smile)

     

    1. Unknown User (m.schadd)

      Mhm, kan het me niet bedenken, wellicht gewoon een foutje van ons. Standard zijn types altijd bidirectional als je een type aan maakt in studio. Wellicht hebben we dat gewoon nooit aangepast en is dat naar hier ge-copypaste.

  2. Unknown User (e.marcelis)

    In Blueriq Knowledge Base Persistency Management guide#Versioning there is a part describing reading versioned aggregates. It says: "When reading a versioned aggregate entry, it is possible to skip the version Id as input, but specify it as output. This means that the aggregate read service will read the latest version of the aggregate entry and tell us which version this actually is."

    If this is the case I would like to add it to this documentation about AQ_Aggregate_Read too.