Page History
Info | ||||
---|---|---|---|---|
| ||||
AQ_Aggregate_Update is used for updating an already created (=stored) 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.
...
This service will update an aggregate based on an aggregate type and Id. This service consults the database of stored aggregates. It will update the entry with the provided Id. If the Id is not present in the database, the IDError exit is taken. In case of versioned aggregates, a new version is created with a higher version Id. The old version can still be accessed when needed.
Parameters
Name | Direction | Description | Type | Occurrence | Required |
---|---|---|---|---|---|
AggregateType | Input | Select the aggregate you want to update. This is a list of the aggregates definitions. | Aggregate | Single valued | true |
AggregateId | Input | The attribute that holds the ID of the aggregate you want to update. | Integer | Single valued | true |
CreateNewVersion | Input | Specifies whether the update creates a new version (true) or overwrites the existing version (false). | Boolean | Single valued | true |
VersionIDOutput | BiDirectional | The attribute on which you want to store the version Id of the update. | Attribute | Single valued | false |
TargetInsance | Input | The instance on which the Id of the version that is to be updated will be stored in the attribute mentioned in VersionIDOutput. | Expression resulting in an attribute | Single valued | false |
StoreInstances | Input | The starting point instance(s) for storing. | Expression(s) resulting in instance(s) | Multi valued | false |
User-set vs system-set
When updating 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
Updating an aggregate stores also a set of metadata information in the database:
Field | Type | Description |
---|---|---|
LastUpdatedByUsername | String | User name of the person/system that updated the aggregate |
LastUpdatedByID | String | Unique Id of the user. A user name can have duplicates, the user Id makes the user unique |
LastUpdated | Datetime | Update time stamp of the aggregate |
Latest | Boolean | Specifies whether the aggregate is the latest version |
Version | Integer | Version of the aggregate |
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 an update service with versioning.
ER diagram | Aggregate definition |
Service definition |