Class FileSorterUtil

java.lang.Object
fr.paris.lutece.portal.service.util.FileSorterUtil

public class FileSorterUtil extends Object
  • Field Details

  • Constructor Details

    • FileSorterUtil

      public FileSorterUtil()
  • Method Details

    • sortByPropertiesPrecedence

      public static List<String> sortByPropertiesPrecedence(List<String> set)
      Sorts properties file paths into their loading order, from the weakest location to the strongest: the plugins, the themes, the override directory, then the override/plugins directory, each one in alphabetical order. The files are loaded in this order into one set of properties, so a key set in several files takes the value of the last one, as in Lutece 7. A path may be relative, the way the classpath scan returns it, or start with a slash.

      The configuration is exposed to MicroProfile Config through two ConfigSources, so the four ranks never appear together in one list: the base source is given the plugins and the themes only, the override source the two override directories only. This order therefore arbitrates inside a source. Between the two sources, it is their ConfigSource ordinal that makes the override values win, not this sort.

      Parameters:
      set - The list of properties file paths
      Returns:
      The paths in the order they must be loaded
    • sortedByPathAndExtensionList

      public static List<String> sortedByPathAndExtensionList(List<String> set)
      Sorts the list of file paths by both path priority and extension priority. First, the list is sorted by path priority, and then by extension priority.
      Parameters:
      set - The list of file paths to be sorted
      Returns:
      The sorted list of file paths
    • sortByPathPriority

      public static List<String> sortByPathPriority(List<String> set)
      Sorts the list of file paths in descending order based on path priority. Paths with higher priority values will appear later in the list.
      Parameters:
      set - The list of file paths to sort in descending path priority
      Returns:
      The list of file paths sorted in descending path priority
    • sortByPathPriorityDescending

      public static List<String> sortByPathPriorityDescending(List<String> set)
      Sorts the list of file paths based on path priority. Paths are prioritized based on specific prefixes (e.g., PATH_OVERRIDE_PLUGINS, PATH_OVERRIDE_CORE, etc.).
      Parameters:
      set - The list of file paths to sort by path priority
      Returns:
      The list of file paths sorted by path priority
    • sortByExtensionPriority

      public static List<String> sortByExtensionPriority(List<String> set)
      Sorts the list of file paths based on extension priority. Extensions are prioritized (e.g., .xml, .json, .properties, etc.). If two files have the same extension priority, they are sorted alphabetically.
      Parameters:
      set - The list of file paths to sort by extension priority
      Returns:
      The list of file paths sorted by extension priority