public class SnapshotManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private DisabledInheritanceFilter |
disabledInheritanceFilter |
private java.lang.Integer |
projectId |
private java.util.Map<java.lang.Integer,AnnotationSetSnapshot> |
snapshots |
Constructor and Description |
---|
SnapshotManager()
Create a new snapshot manager.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<AnnotationSnapshot> |
findAnnotations(DbControl dc,
Annotatable item,
Filter<? super AnnotationSnapshot> filter,
boolean searchInherited) |
java.util.List<AnnotationSnapshot> |
findAnnotations(DbControl dc,
Annotatable item,
Filter<? super AnnotationSnapshot> filter,
boolean searchPrimary,
boolean searchInherited)
Utility method for calling
getSnapshot and findAnnotations
in one go. |
java.util.List<AnnotationSnapshot> |
findAnnotations(DbControl dc,
AnnotationSetSnapshot snapshot,
Filter<? super AnnotationSnapshot> filter,
boolean searchInherited)
Find annotations.
|
java.util.List<AnnotationSnapshot> |
findAnnotations(DbControl dc,
AnnotationSetSnapshot snapshot,
Filter<? super AnnotationSnapshot> filter,
boolean searchPrimary,
boolean searchInherited)
Search in a snapshot for all annotations matching a given filter.
|
static java.lang.String |
getCacheKey(int annotationSetId)
The static cache key under which the snapshot for the
annotation set with the given id is cached.
|
AnnotationSetSnapshot |
getSnapshot(DbControl dc,
int annotationSetId)
Get the annotation snapshot for the annotation set with the given id.
|
static boolean |
removeSnapshot(int annotationSetId)
Removes a snapshot from the static cache.
|
static int |
removeSnapshots(java.util.Collection<java.lang.Integer> annotationSetIds)
Removes a list of snapshots from the static cache.
|
static int |
removeSnapshots(java.util.List<java.lang.Integer> annotationSetIds) |
void |
setNoProject()
Revert to the default bahavior for loading project-specific annotations.
|
void |
setProject(Project project)
When a project is set, the snapshot manager will only
search for project-specific annotations explicitely belonging
to that project (or default values if project == null).
|
private final java.util.Map<java.lang.Integer,AnnotationSetSnapshot> snapshots
private DisabledInheritanceFilter disabledInheritanceFilter
private java.lang.Integer projectId
public static java.lang.String getCacheKey(int annotationSetId)
annotationSetId
- The ID of an annotation setpublic static boolean removeSnapshot(int annotationSetId)
annotationSetId
- The ID of the annotation setpublic static int removeSnapshots(java.util.List<java.lang.Integer> annotationSetIds)
removeSnapshots(Collection)
public static int removeSnapshots(java.util.Collection<java.lang.Integer> annotationSetIds)
annotationSetIds
- A list with IDs of annotation set spublic void setProject(Project project)
setNoProject()
) when searching for annotations to an
annotation type that doesn't have enabled project-specific annotations.
Calling this method with a null parameter IS NOT the same
as calling setNoProject()
.project
- The project or null to only search for default
values. Use setNoProject()
to revert to the default
behaviour (which load default values if a project-specific values
doesn't exists)public void setNoProject()
public AnnotationSetSnapshot getSnapshot(DbControl dc, int annotationSetId)
dc
- A DbControl to use if the snapshot has to be created from
the database cacheannotationSetId
- The id of the annotation setpublic java.util.List<AnnotationSnapshot> findAnnotations(DbControl dc, AnnotationSetSnapshot snapshot, Filter<? super AnnotationSnapshot> filter, boolean searchInherited)
public java.util.List<AnnotationSnapshot> findAnnotations(DbControl dc, AnnotationSetSnapshot snapshot, Filter<? super AnnotationSnapshot> filter, boolean searchPrimary, boolean searchInherited)
dc
- A DbControl to use for database access if a snapshot doesn't
exists for an inherited annotation setsnapshot
- The snapshot to searchfilter
- A filter that should match the wanted annotation snapshots
or null to match all annotationssearchPrimary
- TRUE if primary annotations should be searchedsearchInherited
- TRUE if inherited annotations should be searchedpublic java.util.List<AnnotationSnapshot> findAnnotations(DbControl dc, Annotatable item, Filter<? super AnnotationSnapshot> filter, boolean searchInherited)
public java.util.List<AnnotationSnapshot> findAnnotations(DbControl dc, Annotatable item, Filter<? super AnnotationSnapshot> filter, boolean searchPrimary, boolean searchInherited)
getSnapshot
and findAnnotations
in one go.getSnapshot(DbControl, int)
,
findAnnotations(DbControl, AnnotationSetSnapshot, Filter, boolean, boolean)