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)

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.

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.

remove

void remove(Object instance)

Removes all historical data with information what changes were made on the given instance of entity.

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

setTrashFlag

void setTrashFlag(Object instance, Object trash, boolean flag)

Sets the trash flag for historical data related with the given instance object.

Parameters:
  • instance – an instance created from the given entity definition.
  • flag – true if instance was moved to trash; otherwise false.