Class OverviewUtil


  • public final class OverviewUtil
    extends Object
    Utility class for the overview generation functionality.
    Version:
    2.10
    Author:
    Nicklas
    Last modified
    $Date: 2019-03-12 07:53:27 +0100 (tis, 12 mars 2019) $
    • Constructor Detail

      • OverviewUtil

        public OverviewUtil()
    • Method Detail

      • getStaticRules

        public static Map<String,​List<ValidationRuleAction>> 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 DbControl
        overview - The overview tree
        Returns:
        A map with a string key and list of validation rules as value
        Since:
        3.2
      • getValidationPresets

        public static Presets getValidationPresets​(SessionControl sc)
        Get the validation options presets for the currently logged in user. If changes are made to the presets call saveValidationPresets(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

        public static void saveValidationPresets​(SessionControl sc)
        Save the validation option presets for the logged in user. The presets are stored as user default settings (SessionControl.setUserDefaultSetting(String, String)) with the name experiment.overview.presets
        Parameters:
        sc - The session control for the logged in user
      • 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 access
        item - The item to generate the overview for
        project - The project that should be used for validation of default items
        Returns:
        An overview
        See Also:
        getNewOverview(DbControl, BasicItem, Project), getCurrentOverview(SessionControl)
      • getCurrentOverview

        public static GenericOverview getCurrentOverview​(SessionControl sc)
        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

        public static Node getCircularRef​(Node node,
                                          BasicItem item)
        Find the first parent node that has a reference to the given item.
        Parameters:
        node - The node to start looking at
        item - 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

        public 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 the ItemSubtype.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 access
        context - The current overview context (will be used to prepare the query for annotation types; see OverviewContext.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 access
        context - The current overview context
        item - The annotatable item that we should find parents for
        Returns:
        A set with the parents