|
18 | 18 | */
|
19 | 19 | package ubic.gemma.persistence.service.common.auditAndSecurity;
|
20 | 20 |
|
21 |
| -import ubic.gemma.model.common.auditAndSecurity.Auditable; |
22 | 21 | import ubic.gemma.model.common.auditAndSecurity.AuditEvent;
|
| 22 | +import ubic.gemma.model.common.auditAndSecurity.Auditable; |
23 | 23 | import ubic.gemma.model.common.auditAndSecurity.eventType.AuditEventType;
|
24 | 24 | import ubic.gemma.persistence.service.BaseDao;
|
25 | 25 |
|
| 26 | +import javax.annotation.Nullable; |
26 | 27 | import java.util.Collection;
|
27 | 28 | import java.util.Date;
|
28 | 29 | import java.util.List;
|
|
35 | 36 | public interface AuditEventDao extends BaseDao<AuditEvent> {
|
36 | 37 |
|
37 | 38 | /**
|
38 |
| - * @param auditable auditable |
39 |
| - * @return events for the given auditable. |
| 39 | + * Obtain the audit events associated to a given auditable. |
| 40 | + * <p> |
| 41 | + * Events are sorted by date in ascending order. |
40 | 42 | */
|
41 | 43 | List<AuditEvent> getEvents( Auditable auditable );
|
42 | 44 |
|
43 | 45 | /**
|
44 |
| - * @param auditable auditable |
45 |
| - * @param type type |
46 |
| - * @return the last AuditEvent of the specified type from the given auditable. |
| 46 | + * Obtain the creation events for the given auditables. |
| 47 | + * <p> |
| 48 | + * If an auditable has more than one creation event (which is in itself a bug), the earliest one is returned. |
| 49 | + */ |
| 50 | + <T extends Auditable> Map<T, AuditEvent> getCreateEvents( Collection<T> auditables ); |
| 51 | + |
| 52 | + /** |
| 53 | + * Obtain the latest event of a given type for a given auditable. |
| 54 | + * @see #getLastEvent(Auditable, Class) |
47 | 55 | */
|
| 56 | + @Nullable |
48 | 57 | AuditEvent getLastEvent( Auditable auditable, Class<? extends AuditEventType> type );
|
49 | 58 |
|
50 | 59 | /**
|
51 |
| - * Obtain the latest {@link AuditEvent} of a specified type, excluding a certain number of types. |
| 60 | + * Obtain the latest event of a given type, excluding a certain number of types. |
| 61 | + * @param type type of event to retrieve, augmented by its hierarchy |
| 62 | + * @param excludedTypes excluded event types (their hierarchy is also excluded) |
52 | 63 | */
|
| 64 | + @Nullable |
53 | 65 | AuditEvent getLastEvent( Auditable auditable, Class<? extends AuditEventType> type, Collection<Class<? extends AuditEventType>> excludedTypes );
|
54 | 66 |
|
55 |
| - Map<Class<? extends AuditEventType>, Map<Auditable, AuditEvent>> getLastEventsByType( |
56 |
| - Collection<? extends Auditable> auditables, Collection<Class<? extends AuditEventType>> types ); |
57 |
| - |
58 | 67 | /**
|
59 |
| - * Get auditables that have been Created since the given date |
60 |
| - * |
61 |
| - * @param date date |
62 |
| - * @return auditables |
| 68 | + * Obtain the latest events of a specified type for all given auditables. |
| 69 | + * @see #getLastEvent(Auditable, Class) |
63 | 70 | */
|
64 |
| - Collection<Auditable> getNewSinceDate( Date date ); |
| 71 | + <T extends Auditable> Map<T, AuditEvent> getLastEvents( Collection<T> auditables, Class<? extends AuditEventType> type ); |
65 | 72 |
|
66 | 73 | /**
|
67 |
| - * Get auditables that have been Updated since the given date |
68 |
| - * |
69 |
| - * @param date date |
70 |
| - * @return auditables |
| 74 | + * Obtain the latest events of a specified type for all auditable of a given type. |
| 75 | + * @see #getLastEvent(Auditable, Class) |
71 | 76 | */
|
72 |
| - Collection<Auditable> getUpdatedSinceDate( Date date ); |
| 77 | + <T extends Auditable> Map<T, AuditEvent> getLastEvents( Class<T> auditableClass, Class<? extends AuditEventType> type ); |
73 | 78 |
|
74 |
| - boolean hasEvent( Auditable a, Class<? extends AuditEventType> type ); |
75 |
| - |
76 |
| - void retainHavingEvent( Collection<? extends Auditable> a, Class<? extends AuditEventType> type ); |
77 |
| - |
78 |
| - void retainLackingEvent( Collection<? extends Auditable> a, Class<? extends AuditEventType> type ); |
| 79 | + /** |
| 80 | + * Get auditables that have been created since the given date. |
| 81 | + */ |
| 82 | + <T extends Auditable> Collection<T> getNewSinceDate( Class<T> auditableClass, Date date ); |
79 | 83 |
|
80 |
| - Map<Auditable, AuditEvent> getCreateEvents( Collection<? extends Auditable> auditables ); |
| 84 | + /** |
| 85 | + * Get auditables that have been updated since the given date. |
| 86 | + */ |
| 87 | + <T extends Auditable> Collection<T> getUpdatedSinceDate( Class<T> auditableClass, Date date ); |
81 | 88 | }
|
0 commit comments