HistoryService

public interface HistoryService

The HistoryService provides methods related with processing historical changes on the given instance of entity.

Methods

countHistoryRecords

long countHistoryRecords(Object instance)

Returns a number of historical revisions for the given instance.

Parameters:
  • instance – an instance to count historical revisions for
Returns:

a number of historical revisions of the instance

getHistoryForInstance

List getHistoryForInstance(Object instance, QueryParams queryParams)

Returns the historical data for the given instance. This method return historical data only for objects that are not in the MDS trash. For trash instances the return value will be incorrect.

Parameters:
  • instance – an instance created from the given entity definition.
  • queryParams – Query parameters such as page number, size of page and sort direction. If null method will return all history records.
Returns:

a list of historical data related with the given instance.

getSingleHistoryInstance

Object getSingleHistoryInstance(Object instance, Long historyId)

Returns a single historical revision for the given instance.

Parameters:
  • instance – an instance to retrieve historical revisions from
  • historyId – id of a historical revision
Returns:

Historical revision or null if not found

record

void record(Object instance)

Records changes made on the given instance of entity. The first historical data should be equal to data inside the given instance. Two instance of historical data should be connected using appropriate fields (defined in history class definition). This method should be used only for instances that are not in the MDS trash.

Parameters:
  • instance – an instance created from the given entity definition.