3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.cdm
.api
.service
;
13 import java
.util
.List
;
15 import org
.hibernate
.envers
.query
.criteria
.AuditCriterion
;
17 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
18 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
19 import eu
.etaxonomy
.cdm
.model
.view
.AuditEvent
;
20 import eu
.etaxonomy
.cdm
.model
.view
.AuditEventRecord
;
21 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.AuditEventSort
;
23 public interface IVersionableService
<T
extends VersionableEntity
> extends IService
<T
> {
26 * Returns a paged list of audit events (in order) which affected the state of an entity t.
27 * The events returned either start at the AuditEvent in context and go forward in time
28 * (AuditEventSort.FORWARDS) or backwards in time (AuditEventSort.BACKWARDS). If the
29 * AuditEventContext is set to null, or to AuditEvent.CURRENT_VIEW, then all relevant
30 * AuditEvents are returned.
36 * @param propertyPaths paths initialized on the returned objects - only applied to the objects returned from the first grouping
37 * @return a Pager containing audit event instances, plus metadata
39 public Pager
<AuditEventRecord
<T
>> pageAuditEvents(T t
, Integer pageSize
, Integer pageNumber
, AuditEventSort sort
, List
<String
> propertyPaths
);
42 * A convenience method which returns a record of the next (relative to the audit event in context)
43 * audit event to affect the entity t.
45 * @param t The versionable entity affected by these audit events
46 * @return a record of the next audit event to affect t, or null if the current event is the last to affect t
48 public AuditEventRecord
<T
> getNextAuditEvent(T t
);
51 * A convenience method which returns a record of the previous (relative to the audit event in context)
52 * audit event to affect the entity t.
54 * @param t The versionable entity affected by these audit events
55 * @return a record of the previous audit event to affect t, or null if the current event is the first to affect t
57 public AuditEventRecord
<T
> getPreviousAuditEvent(T t
);
60 * Returns a list of all audit events occurring to objects of type T, optionally restricted to objects of type clazz
61 * between the AuditEvents from and to, inclusive, optionally filtered by other criteria
63 * @param clazz Restrict the results returned to objects of this class
64 * @param from The audit event to start from (inclusive, or pass null to start from the beginning of the recordset)
65 * @param to The audit event to continue until (exclusive, or pass null to return audit events up to the time of the query)
66 * @param criteria Extra criteria to filter by
67 * @param pageSize The maximum number of objects returned (can be null for all matching objects)
68 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based,
69 * can be null, equivalent of starting at the beginning of the recordset)
70 * @param sort Sort the events either forwards or backwards in time
71 * @param propertyPaths properties to be initialized
74 public Pager
<AuditEventRecord
<T
>> pageAuditEvents(Class
<?
extends T
> clazz
,AuditEvent from
,AuditEvent to
, List
<AuditCriterion
> criteria
, Integer pageSize
, Integer pageValue
, AuditEventSort sort
,List
<String
> propertyPaths
);