Project

General

Profile

Download (3.77 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 * Copyright (C) 2007 EDIT
3
 * European Distributed Institute of Taxonomy
4
 * http://www.e-taxonomy.eu
5
 *
6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7
 * See LICENSE.TXT at the top of this package for the full license terms.
8
 */
9

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

    
12
import java.util.List;
13
import java.util.UUID;
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>
25
        extends IService<T> {
26

    
27
	/**
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.
33
	 *
34
	 * @param t
35
	 * @param pageSize
36
	 * @param pageNumber
37
	 * @param sort
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
40
	 */
41
	public Pager<AuditEventRecord<T>> pageAuditEvents(T t, Integer pageSize, Integer pageNumber, AuditEventSort sort, List<String> propertyPaths);
42

    
43
	/**
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.
46
	 *
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
49
	 */
50
    public AuditEventRecord<T> getNextAuditEvent(T t);
51

    
52
	/**
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.
55
	 *
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
58
	 */
59
	public AuditEventRecord<T> getPreviousAuditEvent(T t);
60

    
61
	/**
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
64
	 *
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
74
	 * @return
75
	 */
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);
77

    
78

    
79
    /**
80
	 * checks whether the object is deletable concerning the configurator or not
81
	 */
82

    
83
	public DeleteResult isDeletable(UUID object, DeleteConfiguratorBase config);
84

    
85
}
(66-66/100)