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)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classWorkContextDelegate.WorkContextBuilder
-
Constructor Summary
Constructors Constructor Description WorkContextDelegate()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareAllPatternsDetected(WorkReport report)Compares the DETECT_PATTERNS to the DESIRED_PATTERNS to see if all were detectedList<Pattern>getDesiredPatterns(WorkContext context)Map<Clue,List<File>>getDetectedClue(WorkContext context)Map<Clue,List<File>>getDetectedClue(WorkReport report)List<Pattern>getDetectedPatterns(WorkContext context)List<Pattern>getDetectedPatterns(WorkReport report)Set<File>getFilesToScan(WorkContext context)Set<File>getFoldersToScan(WorkContext context)booleanisThisClueDetected(Clue clue, WorkContext context)Checks if a specific Clue is detectedbooleanisThisClueDetected(Clue clue, WorkReport report)Checks if a specific Clue is detectedbooleanisThisPatternDetected(Pattern pattern, WorkReport report)voidmarkClueAsDetected(Clue clue, File file, WorkContext context)Updates the WorkContext DETECTED_CLUE collection with this cluevoidprocessResultsAfterScan(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_PATTERNSbooleanvalidateAndIntializeContext(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
-
-
-
Method Detail
-
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 detectedcontext- 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 detectedcontext- 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 detectedfile- File that triggered the detectioncontext- 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
-
-