-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCaseTriggerHandler.cls
42 lines (35 loc) · 1.09 KB
/
CaseTriggerHandler.cls
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
public class CaseTriggerHandler {
//store Trigger.newMap
Map<Id, Case> newCases;
/*
Class Constructor
@param newTriggerCase
Map between Id and Case for new values
*/
public CaseTriggerHandler (Map<Id,Case> newTriggerCase) {
newCases = newTriggerCase;
}
/*
Parses the body of the case to determine if there are any URLs.
If there is at least 1 URL, then it will proceed to scan them
*/
public void handleTrigger() {
scanURLS newScan = new scanURLS();
for (Case cse : newCases.values()) {
Id caseID = cse.Id;
String bodyOfCase = cse.description;
//call the regular expression module to extract URLs
//keep unique URLs only after extraction
List<String> urls = ExtractURLs.ParseText(bodyOfCase);
Set<String> urlsList = new Set<String>(urls);
// re-do assignment rules if no urls in case
if (urlsList.isEmpty()) {
system.debug('No URLS were found in this case');
caseReassignmentPostScan.casePassAssignmentRule(caseID);
continue;
}
//if URLs were found, check for malicious URLs
scanURLS.checkURLMalicious(urlsList, caseID);
}
}
}