Class WorkContextDelegate

java.lang.Object
com.redhat.parodos.patterndetection.context.WorkContextDelegate

public class WorkContextDelegate extends Object
Contains helper methods for working with the data in the WorkContext.
Author:
Luke Shannon (Github: lshannon)
  • Constructor Details

    • WorkContextDelegate

      public WorkContextDelegate()
  • Method Details

    • validateAndIntializeContext

      public boolean validateAndIntializeContext(WorkContext context)
      Checks if the WorkContext has everything to perform the Detection: - START_DIRECTORY : the root location to begin processing the files - START_FILE : the root java.util.File to begin processing the files
      Parameters:
      context - easy-flow WorkContext
      Returns:
      true if everything, false if required parameter is missing
    • areAllPatternsDetected

      public boolean areAllPatternsDetected(WorkReport report)
      Compares the DETECT_PATTERNS to the DESIRED_PATTERNS to see if all were detected
      Parameters:
      report - WorkReport passed in at the start of the Scan
      Returns:
      true is all Patterns were detect, false is not all the Patterns were detected
    • getFilesToScan

      public Set<File> getFilesToScan(WorkContext context)
    • getDetectedClue

      public Map<Clue,List<File>> getDetectedClue(WorkReport report)
    • getDetectedClue

      public Map<Clue,List<File>> getDetectedClue(WorkContext context)
    • getDesiredPatterns

      public List<Pattern> getDesiredPatterns(WorkContext context)
    • getDetectedPatterns

      public List<Pattern> getDetectedPatterns(WorkReport report)
    • getDetectedPatterns

      public List<Pattern> getDetectedPatterns(WorkContext context)
    • getFoldersToScan

      public Set<File> getFoldersToScan(WorkContext context)
    • isThisPatternDetected

      public boolean isThisPatternDetected(Pattern pattern, WorkReport report)
    • isThisClueDetected

      public boolean isThisClueDetected(Clue clue, WorkReport report)
      Checks if a specific Clue is detected
      Parameters:
      clue - Clue to check if it was detected
      context - WorkContext used through out the Scan
      Returns:
      true if the Clue was detected, false if it was not
    • isThisClueDetected

      public boolean isThisClueDetected(Clue clue, WorkContext context)
      Checks if a specific Clue is detected
      Parameters:
      clue - Clue to check if it was detected
      context - WorkContext used through out the Scan
      Returns:
      true if the Clue was detected, false if it was not
    • markClueAsDetected

      public void markClueAsDetected(Clue clue, File file, WorkContext context)
      Updates the WorkContext DETECTED_CLUE collection with this clue
      Parameters:
      clue - Clue that has been detected
      file - File that triggered the detection
      context - WorkContext used during the Scan
    • processResultsAfterScan

      public void processResultsAfterScan(WorkContext context)
      This checks all the DESIRED_PATTERNS and compares them to the detected CLUE(S) to see if any of the DESIRED_PATTERNS could become DETECTED_PATTERNS
      Parameters:
      context - WorkContext used during the Scan