Package net.sf.basedb.util.overview
Class OverviewUtil
java.lang.Object
net.sf.basedb.util.overview.OverviewUtil
Utility class for the overview generation functionality.
- Version:
- 2.10
- Author:
- Nicklas
- Last modified
- $Date: 2020-10-21 07:39:15 +0200 (Wed, 21 Oct 2020) $
-
Field Summary
Modifier and TypeFieldDescriptionprivate static final String
Name of setting to store saved presets.private static Map<String,
List<ValidationRuleAction>> -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Map<String,
List<ValidationRuleAction>> getAllRules
(DbControl dc, GenericOverview overview) Get all static and extension validation rules grouped by relationship.static Set<Annotatable>
getAnnotatableParents
(DbControl dc, OverviewContext context, Annotatable item) Get all annotatable parent items for the given item.static Node
getCircularRef
(Node node, BasicItem item) Find the first parent node that has a reference to the given item.static GenericOverview
Get the currently cached overview.static Set<AnnotationType>
getMiameAnnotationTypes
(DbControl dc, OverviewContext context, Item itemType) Get all annotation types that has been marked as "Required for MIAME".static GenericOverview
getNewOrCurrentOverview
(DbControl dc, BasicItem item, Project project) Get the current overview or create a new overview.static GenericOverview
getNewOverview
(DbControl dc, BasicItem item, Project project) Create a new overview for the given item and project.static Map<String,
List<ValidationRuleAction>> Get all static (built-in) validation rules grouped by relationship.static Presets
Get the validation options presets for the currently logged in user.static void
restrictToPushAnnotationSubtypes
(ItemQuery<? extends Subtypable> query) Add a restriction to the query that limit the returned result to those items that has a subtype with theItemSubtype.getPushAnnotations()
flag set.static void
Save the validation option presets for the logged in user.
-
Field Details
-
staticRules
-
presetsSetting
Name of setting to store saved presets. DO NOT CHANGE the name since since it is used in the database to store the presets.- See Also:
-
-
Constructor Details
-
OverviewUtil
public OverviewUtil()
-
-
Method Details
-
getStaticRules
Get all static (built-in) validation rules grouped by relationship. The key of the map is a title that groups related validation rules, for example: "Project default", "Missing items", etc.- Returns:
- A map with a string key and list of validation rules as value
- Since:
- 3.2
-
getAllRules
public static Map<String,List<ValidationRuleAction>> getAllRules(DbControl dc, GenericOverview overview) Get all static and extension validation rules grouped by relationship. The key of the map is a title that groups related validation rules, for example: "Project default", "Missing items", etc.- Parameters:
dc
- An open DbControloverview
- The overview tree- Returns:
- A map with a string key and list of validation rules as value
- Since:
- 3.2
-
getValidationPresets
Get the validation options presets for the currently logged in user. If changes are made to the presets callsaveValidationPresets(SessionControl)
to make sure the changes are saved to the database.- Parameters:
sc
- The session control for the logged in user- Returns:
- The validation option presets
-
saveValidationPresets
Save the validation option presets for the logged in user. The presets are stored as user default settings (SessionControl.setUserDefaultSetting(String, String)
) with the nameexperiment.overview.presets
- Parameters:
sc
- The session control for the logged in user
-
getNewOverview
Create a new overview for the given item and project. The created overview is cached and can be retrieved withgetCurrentOverview(SessionControl)
orgetNewOrCurrentOverview(DbControl, BasicItem, Project)
.- Parameters:
dc
- A DbControl to use for database accessitem
- The item to generate the overview forproject
- The project that should be used for validation of default items- Returns:
- An overview
- See Also:
-
getNewOrCurrentOverview
public static GenericOverview getNewOrCurrentOverview(DbControl dc, BasicItem item, Project project) Get the current overview or create a new overview. This method will first check if a cached overview for the same item/project exists. If it does, the existing overview is returned, otherwise a new overview is created.- Parameters:
dc
- A DbControl to use for database accessitem
- The item to generate the overview forproject
- The project that should be used for validation of default items- Returns:
- An overview
- See Also:
-
getCurrentOverview
Get the currently cached overview.- Parameters:
sc
- The session control that contains the cached overview- Returns:
- An overview, or null if no current overview exists
-
getCircularRef
Find the first parent node that has a reference to the given item.- Parameters:
node
- The node to start looking atitem
- The item to look for- Returns:
- The first parent node (including the given) that has a reference to the given item, or null if no such node exists
-
restrictToPushAnnotationSubtypes
Add a restriction to the query that limit the returned result to those items that has a subtype with theItemSubtype.getPushAnnotations()
flag set.- Since:
- 3.1
-
getMiameAnnotationTypes
public static Set<AnnotationType> getMiameAnnotationTypes(DbControl dc, OverviewContext context, Item itemType) Get all annotation types that has been marked as "Required for MIAME". The annotation types found by this method will be cached in the overview context. Subsequent calls will return the cached annotation types.- Parameters:
dc
- A DbControl to use for database accesscontext
- The current overview context (will be used to prepare the query for annotation types; seeOverviewContext.initQuery(ItemQuery, String)
itemType
- An optional item type that is used to limit what annotation types to look for- Returns:
- A set with the annotation types
-
getAnnotatableParents
public static Set<Annotatable> getAnnotatableParents(DbControl dc, OverviewContext context, Annotatable item) Get all annotatable parent items for the given item. The parents that are found by this method will be cached in the current overview context. Subsequent calls will return the cached information.- Parameters:
dc
- A DbControl to use for database accesscontext
- The current overview contextitem
- The annotatable item that we should find parents for- Returns:
- A set with the parents
-