Class FileOrderComparator

java.lang.Object
de.hybris.platform.acceleratorservices.dataimport.batch.FileOrderComparator
All Implemented Interfaces:
Comparator<File>, org.springframework.beans.factory.InitializingBean

public class FileOrderComparator extends Object implements Comparator<File>, org.springframework.beans.factory.InitializingBean
Comparator that compares files based on their file names. On this behalf a priorities are configurable for file name prefixes. Files with a lower priority value are considered more important and imported first. This ensures some files are imported before others (e.g. products before prices).
  • Constructor Details

    • FileOrderComparator

      public FileOrderComparator()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • compare

      public int compare(File file, File otherFile)
      Specified by:
      compare in interface Comparator<File>
    • getPriority

      protected Integer getPriority(File file)
      Retrieves the priority for a file.
      Parameters:
      file - the file to get priority from
      Returns:
      the configured priority, if one exists, otherwise the default priority
    • setPrefixPriority

      public void setPrefixPriority(Map<String,Integer> prefixPriority)
      Parameters:
      prefixPriority - the prefixPriority to set
    • getPrefixPriority

      protected Map<String,Integer> getPrefixPriority()
      Returns:
      prefixPriority