Project

General

Profile

Download (3.76 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
 * Copyright (C) 2007 EDIT
4
 * European Distributed Institute of Taxonomy 
5
 * http://www.e-taxonomy.eu
6
 * 
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.
9
 */
10

    
11
package eu.etaxonomy.cdm.api.service;
12

    
13
import java.util.List;
14

    
15
import org.hibernate.envers.query.criteria.AuditCriterion;
16

    
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.VersionableEntity;
20
import eu.etaxonomy.cdm.model.view.AuditEvent;
21
import eu.etaxonomy.cdm.model.view.AuditEventRecord;
22
import eu.etaxonomy.cdm.persistence.dao.common.AuditEventSort;
23

    
24
public interface IVersionableService<T extends VersionableEntity> extends IService<T> {
25
	
26
	/**
27
	 * Returns a paged list of audit events (in order) which affected the state of an entity t.
28
	 * The events returned either start at the AuditEvent in context and go forward in time 
29
	 * (AuditEventSort.FORWARDS) or backwards in time (AuditEventSort.BACKWARDS). If the 
30
	 * AuditEventContext is set to null, or to AuditEvent.CURRENT_VIEW, then all relevant
31
	 * AuditEvents are returned.
32
	 * 
33
	 * @param t
34
	 * @param pageSize
35
	 * @param pageNumber
36
	 * @param sort
37
	 * @param propertyPaths paths initialized on the returned objects - only applied to the objects returned from the first grouping
38
	 * @return a Pager containing audit event instances, plus metadata
39
	 */
40
	public Pager<AuditEventRecord<T>> pageAuditEvents(T t, Integer pageSize, Integer pageNumber, AuditEventSort sort, List<String> propertyPaths);
41
	
42
	/**
43
	 * A convenience method which returns a record of the next (relative to the audit event in context)
44
	 * audit event to affect the entity t.
45
	 * 
46
	 * @param t The versionable entity affected by these audit events
47
	 * @return a record of the next audit event to affect t, or null if the current event is the last to affect t
48
	 */
49
    public AuditEventRecord<T> getNextAuditEvent(T t);
50
	
51
	/**
52
	 * A convenience method which returns a record of the previous (relative to the audit event in context)
53
	 * audit event to affect the entity t.
54
	 * 
55
	 * @param t The versionable entity affected by these audit events
56
	 * @return a record of the previous audit event to affect t, or null if the current event is the first to affect t
57
	 */
58
	public AuditEventRecord<T> getPreviousAuditEvent(T t);
59
	
60
	/**
61
	 * Returns a list of all audit events occurring to objects of type T, optionally restricted to objects of type clazz
62
	 * between the AuditEvents from and to, inclusive, optionally filtered by other criteria
63
	 * 
64
	 * @param clazz Restrict the results returned to objects of this class
65
	 * @param from The audit event to start from (inclusive, or pass null to start from the beginning of the recordset)
66
	 * @param to The audit event to continue until (exclusive, or pass null to return audit events up to the time of the query)
67
	 * @param criteria Extra criteria to filter by
68
	 * @param pageSize The maximum number of objects returned (can be null for all matching objects)
69
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based, 
70
	 *                   can be null, equivalent of starting at the beginning of the recordset)
71
	 * @param sort Sort the events either forwards or backwards in time
72
	 * @param propertyPaths properties to be initialized
73
	 * @return
74
	 */
75
	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);
76
 
77

    
78
    /**
79
	 * checks whether the object is deletable concerning the configurator or not
80
	 */
81
	
82
	public DeleteResult isDeletable(T object, DeleteConfiguratorBase config);
83
	
84
}
(64-64/97)