Committing large number of changes relating to versioning implementation (#108)
[cdmlib.git] / cdmlib-persistence / src / main / java / eu / etaxonomy / cdm / persistence / view / IAuditEventDao.java
1 package eu.etaxonomy.cdm.persistence.view;
2
3 import java.util.List;
4 import java.util.UUID;
5
6 import eu.etaxonomy.cdm.model.view.AuditEvent;
7 import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
8
9
10 public interface IAuditEventDao {
11
12 /**
13 * Find the AuditEvent with an identifier equal to the parameter
14 *
15 * @param id
16 * @return an AuditEvent, or null if there is no AuditEvent with that identifier
17 */
18 public AuditEvent findById(Integer id);
19
20 /**
21 * Find the AuditEvent with a uuid (surrogate key) equal to the uuid supplied
22 *
23 * @param uuid
24 * @return an AuditEvent, or null if there is no AuditEvent with a uuid which matches
25 */
26 public AuditEvent findByUuid(UUID uuid);
27
28 /**
29 * Count the AuditEvents in this database
30 *
31 * @return the total number of AuditEvents in this database
32 */
33 public int count();
34
35 /**
36 * Returns a sublist of AuditEvent instances stored in the database.
37 * A maximum of 'limit' objects are returned, starting at object with index 'start'.
38 *
39 * @param limit the maximum number of entities returned (can be null to return all entities)
40 * @param start
41 * @param sort Whether the list is sorted going forward in time (AuditEventSort.FORWARDS)
42 * or backwards (AuditEventSort.BACKWARDS)
43 * @return a List of AuditEvent instances
44 */
45 public List<AuditEvent> list(Integer limit, Integer start,AuditEventSort sort);
46
47 /**
48 * Returns the AuditEvent immediately proceeding the audit event passed as an argument
49 *
50 * @param auditEvent
51 * @return the AuditEvent immediately proceeding, or null if the AuditEvent passed is
52 * the most recent event
53 */
54 public AuditEvent getNextAuditEvent(AuditEvent auditEvent);
55
56 /**
57 * Returns the AuditEvent immediately preceding the audit event passed as an argument
58 *
59 * @param auditEvent
60 * @return the AuditEvent immediately preceding, or null if the AuditEvent passed is
61 * the first event in the database
62 */
63 public AuditEvent getPreviousAuditEvent(AuditEvent auditEvent);
64
65 /**
66 * Checks whether an AuditEvent with a matching uuid exists in the database
67 *
68 * @param uuid
69 * @return true if an AuditEvent with a matching uuid exists in the database, false otherwise
70 */
71 public boolean exists(UUID uuid);
72 }