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
.config
.DeleteConfiguratorBase
;
18 import eu
.etaxonomy
.cdm
.api
.service
.pager
.Pager
;
19 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
20 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
21 import eu
.etaxonomy
.cdm
.model
.view
.AuditEvent
;
22 import eu
.etaxonomy
.cdm
.model
.view
.AuditEventRecord
;
23 import eu
.etaxonomy
.cdm
.persistence
.dao
.common
.AuditEventSort
;
25 public interface IVersionableService
<T
extends VersionableEntity
> extends IService
<T
> {
28 * Returns a paged list of audit events (in order) which affected the state of an entity t.
29 * The events returned either start at the AuditEvent in context and go forward in time
30 * (AuditEventSort.FORWARDS) or backwards in time (AuditEventSort.BACKWARDS). If the
31 * AuditEventContext is set to null, or to AuditEvent.CURRENT_VIEW, then all relevant
32 * AuditEvents are returned.
38 * @param propertyPaths paths initialized on the returned objects - only applied to the objects returned from the first grouping
39 * @return a Pager containing audit event instances, plus metadata
41 public Pager
<AuditEventRecord
<T
>> pageAuditEvents(T t
, Integer pageSize
, Integer pageNumber
, AuditEventSort sort
, List
<String
> propertyPaths
);
44 * A convenience method which returns a record of the next (relative to the audit event in context)
45 * audit event to affect the entity t.
47 * @param t The versionable entity affected by these audit events
48 * @return a record of the next audit event to affect t, or null if the current event is the last to affect t
50 public AuditEventRecord
<T
> getNextAuditEvent(T t
);
53 * A convenience method which returns a record of the previous (relative to the audit event in context)
54 * audit event to affect the entity t.
56 * @param t The versionable entity affected by these audit events
57 * @return a record of the previous audit event to affect t, or null if the current event is the first to affect t
59 public AuditEventRecord
<T
> getPreviousAuditEvent(T t
);
62 * Returns a list of all audit events occurring to objects of type T, optionally restricted to objects of type clazz
63 * between the AuditEvents from and to, inclusive, optionally filtered by other criteria
65 * @param clazz Restrict the results returned to objects of this class
66 * @param from The audit event to start from (inclusive, or pass null to start from the beginning of the recordset)
67 * @param to The audit event to continue until (exclusive, or pass null to return audit events up to the time of the query)
68 * @param criteria Extra criteria to filter by
69 * @param pageSize The maximum number of objects returned (can be null for all matching objects)
70 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based,
71 * can be null, equivalent of starting at the beginning of the recordset)
72 * @param sort Sort the events either forwards or backwards in time
73 * @param propertyPaths properties to be initialized
76 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
);
80 * checks whether the object is deletable concerning the configurator or not
83 public List
<String
> isDeletable(T object
, DeleteConfiguratorBase config
);