.. java:import:: org.motechproject.mds.query QueryParams .. java:import:: java.util List HistoryService ============== .. java:package:: org.motechproject.mds.service :noindex: .. java:type:: public interface HistoryService The \ ``HistoryService``\ provides methods related with processing historical changes on the given instance of entity. Methods ------- countHistoryRecords ^^^^^^^^^^^^^^^^^^^ .. java:method:: long countHistoryRecords(Object instance) :outertype: HistoryService getHistoryForInstance ^^^^^^^^^^^^^^^^^^^^^ .. java:method:: List getHistoryForInstance(Object instance, QueryParams queryParams) :outertype: HistoryService 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. :param instance: an instance created from the given entity definition. :param queryParams: Query parameters such as page number, size of page and sort direction. If null method will return all history records. :return: a list of historical data related with the given instance. record ^^^^^^ .. java:method:: void record(Object instance) :outertype: HistoryService 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. :param instance: an instance created from the given entity definition. remove ^^^^^^ .. java:method:: void remove(Object instance) :outertype: HistoryService Removes all historical data with information what changes were made on the given instance of entity. :param instance: an instance created from the given entity definition. setTrashFlag ^^^^^^^^^^^^ .. java:method:: void setTrashFlag(Object instance, Object trash, boolean flag) :outertype: HistoryService Sets the trash flag for historical data related with the given instance object. :param instance: an instance created from the given entity definition. :param flag: true if instance was moved to trash; otherwise false.