Class FileRuleSet<IncludeRuleClass extends FileRule,​ExcludeRuleClass extends FileRule>

  • All Implemented Interfaces:
    jetbrains.buildServer.log.Loggable
    Direct Known Subclasses:
    CheckoutRules

    public abstract class FileRuleSet<IncludeRuleClass extends FileRule,​ExcludeRuleClass extends FileRule>
    extends java.lang.Object
    implements jetbrains.buildServer.log.Loggable
    • Field Detail

      • INCLUDE_PREFIX

        public static final java.lang.String INCLUDE_PREFIX
        Since:
        9.0
        See Also:
        Constant Field Values
      • EXCLUDE_PREFIX

        public static final java.lang.String EXCLUDE_PREFIX
        Since:
        9.0
        See Also:
        Constant Field Values
      • IGNORE_CASE_MARK

        public static final java.lang.String IGNORE_CASE_MARK
        Since:
        2017.1, see https://youtrack.jetbrains.com/issue/TW-27485
        See Also:
        Constant Field Values
    • Constructor Detail

      • FileRuleSet

        public FileRuleSet​(@NotNull
                           java.util.List<java.lang.String> lines)
      • FileRuleSet

        public FileRuleSet​(@NotNull
                           java.lang.String body)
    • Method Detail

      • convertToLines

        @NotNull
        public static java.util.List<java.lang.String> convertToLines​(@NotNull
                                                                      java.lang.String body)
        Accepts string and transforms it to the list of lines which can be passed to the FileRuleSet(List) constructor
        Parameters:
        body - text to split by lines
        Returns:
        list of lines
        Since:
        2019.1
      • preparePath

        @NotNull
        public java.lang.String preparePath​(@Nullable
                                            java.lang.String path)
      • postProcessCreatedRules

        protected void postProcessCreatedRules​(java.util.List<IncludeRuleClass> includeRules,
                                               java.util.List<ExcludeRuleClass> excludeRules)
      • doPostInitProcess

        protected abstract void doPostInitProcess​(@NotNull
                                                  java.util.List<IncludeRuleClass> includeRules,
                                                  @NotNull
                                                  java.util.List<ExcludeRuleClass> excludeRules)
      • createNewIncludeRule

        protected abstract IncludeRuleClass createNewIncludeRule​(java.lang.String rule)
      • createNewExcludeRule

        protected abstract ExcludeRuleClass createNewExcludeRule​(java.lang.String line)
      • sortByFrom

        protected static void sortByFrom​(@NotNull
                                         java.util.List<? extends FileRule> rules,
                                         boolean reverse)
      • getIncludeRules

        @NotNull
        public java.util.List<IncludeRuleClass> getIncludeRules()
      • getExcludeRules

        @NotNull
        public java.util.List<ExcludeRuleClass> getExcludeRules()
      • getBody

        @NotNull
        public java.util.List<java.lang.String> getBody()
      • shouldInclude

        public boolean shouldInclude​(java.lang.String path,
                                     java.util.Map<java.lang.String,​java.lang.String> props)
      • shouldInclude

        protected boolean shouldInclude​(java.lang.String path,
                                        @NotNull
                                        Filter<FileRule> includeExcludeRulesFilter)
      • shouldInclude

        protected boolean shouldInclude​(java.lang.String path,
                                        @NotNull
                                        java.util.List<IncludeRuleClass> includeRules,
                                        @NotNull
                                        java.util.List<FileRule> excludeRules)
      • createPropertiesFilter

        @NotNull
        protected Filter<FileRule> createPropertiesFilter​(java.util.Map<java.lang.String,​java.lang.String> props)
      • shouldInclude

        public boolean shouldInclude​(java.lang.String path)
      • shouldInclude

        public boolean shouldInclude​(@Nullable
                                     java.lang.String path,
                                     @NotNull
                                     IncludeRule rule)
      • getIncludeRuleFor

        @Nullable
        public IncludeRuleClass getIncludeRuleFor​(java.lang.String path)
      • isUnder

        public boolean isUnder​(java.lang.String parentPath)
        Parameters:
        parentPath - path which is a candidate for a parent of all include rules
        Returns:
        true if all include paths of these Checkout rules are under given parent path
      • isSubDir

        public static boolean isSubDir​(java.lang.String child,
                                       java.lang.String parent)
      • getIncludeRuleMerged

        @Nullable
        public IncludeRuleClass getIncludeRuleMerged()
        Return a common include rule for this CheckoutRules. Right part of the IncludeRule is not considered at all here.
         +:a/b
         +:a/c
         result = +:a
        
         +:a
         +:b  
         result = +:.
        
         +:a/b => foo
         +:a  => bar
         result = +:a => . 
        
        Returns:
        see above
        Since:
        7.0
      • findMostSpecific

        @Nullable
        protected static <T extends FileRule> T findMostSpecific​(java.lang.String path,
                                                                 java.util.List<T> rules)
      • isIgnoreCase

        public boolean isIgnoreCase()
      • setIgnoreCase

        public void setIgnoreCase​(boolean ignoreCase)
      • isEmpty

        public boolean isEmpty()
      • describe

        @NotNull
        public java.lang.String describe​(boolean verbose)
        Specified by:
        describe in interface jetbrains.buildServer.log.Loggable
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object