Skip to end of metadata
Go to start of metadata

 

By enabling historization, you can view all changes made on a single building block. The "History" tab in the single element view displays those changes. Historization can be switched on/off on the System page. In addition, it is also possible to enable/disable historization and to get the history of a building block via the REST API.

Switch History on/off

The history can be enabled/disabled via a the following REST resouce:

PUT  api/historystate?enable=true/false

The response status is 204 in case of success and the response body is empty.

Get History status

The following REST resouce can be used to check if historization is enabled or disabled:

GET  api/historystate

The status of the response is 200 and its body contains a json with the current state of the history:

{
  "enabled": true or false
}

Get building block history

Existing building blocks

To retrieve the list of changes for a single building block, you can use the following REST resource:

GET  api/history/{BuildingBlockType}/{id}

For an existing building block (with the given id) the response will have status 200 and contain a json of the following form:

{
  "history": [
    {
      "author": "system",
      "time": "2017-01-20T13:54:19",
      "changetype": "UPDATE",
      "changes": [
        {
          "featureName": "Complexity",
          "featureType": "ENUMERATION",
          "isMultiple": false,
          "addedValue": [
            "average"
          ],
          "removedValue": [
            "high"
          ]
        }
      ]
    },
    {
      "author": "system",
      "time": "2017-01-20T13:39:15",
      "historyEnabled": true,
      "changetype": "UPDATE",
      "changes": []
    }
  ]
}

The history list contains all changes made to the building block. For each change, the author, the timestamp and the type ("UPDATE", "INSERT" or "DELETE") is specified in addition to a list of all changed features and details about added and/or removed values. Furthermore, the history of a building block contains entries for the time when the history was enabled/disabled. These entries contain the additional property "historyEnabled": true/false. Meta model changes, like a new assignement of an attribute to the building block type, are also logged in the history.

Deleted buidling blocks

It is also possible to retrieve the history for a building block which has been deleted as long as the former ID is still known. In this case, the latest history entry will have the change type "DELETED" and the list of feature changes will contain the properties of the building block at the time of deletion:

{
      "author": "system",
      "time": "2017-01-23T09:25:59",
      "changetype": "DELETE",
      "changes": [ ... ]
}

Non-existing building blocks

If an invalid ID is used in the history REST resource, you will still get a list of history entries as response. This list contains all general changes to the specific type of building block, i.e. enabling/disabling historization or meta model changes.

 

 

  • No labels