You can use changePoints in OCL to retrieve the recorded historical versions of one object over a timestamp range; it is for models where versioning is enabled on the class.
What changePoints returns
When versioning is enabled, MDriven records a change point each time a versioned object is modified. The changePoints operator retrieves the stored versions for an object whose change points fall within the requested timestamp range.
Use this operator when you need to inspect how one object changed over time. For example, you can retrieve the recorded versions of a Customer and evaluate each returned version in an OCL expression.
Syntax
self.changePoints(startTime, stopTime)| Argument | Meaning |
|---|---|
startTime
|
Integer timestamp in UTC ticks at which the search begins. |
stopTime
|
Integer timestamp at which the search stops. Use -1 to search until the end of recorded history.
|
Use changePoints
- Enable versioning on the class whose object history you need.
changePointsis intended for versioned classes. - Identify the object whose history you want to retrieve.
- Choose the starting timestamp in UTC ticks.
- Choose the ending timestamp, or use
-1to include the object's remaining recorded history. - Call
changePointson that object.
Examples
Retrieve the complete recorded history
The following expression retrieves every recorded version of the first Customer, from timestamp 0 to the latest recorded change point:
Customer.allInstances->first.changePoints(0, -1)Retrieve history within a selected range
Replace the timestamps with the UTC-tick range you need:
self.changePoints(startTime, stopTime)For example, use -1 as stopTime when the starting point is known but you want all change points recorded after that point.
Work with timestamps
The versions returned by changePoints have timestamps. Use objectTimeStamp when you need to access the timestamp of the current object version. This is also relevant when working with other versioning operators that expect a timestamp.
Notes
changePointsreturns recorded versions, not an unversioned object's current state.- A class must have versioning enabled before MDriven can record the changes that this operator retrieves.
-1has a specific meaning only forstopTime: search until the end of recorded history.
