The JavaScript to run the JobAssignment Task
Three variables will be passed to the Javascript as built-in variables
Issue Datatype
Return Type | Method Name | Description |
void | setAssignedUser(String user) | Assign a particular issue to a particular user |
void | addComment(String comment) | Append Threaded Comment to the issue |
String | getInstanceId() | Instacne Id, e.g. 9099D33FE61D0D1287401FB105FD341F |
String | getAssignedUser() | Get the existing assigned user loginID |
int | getRevision() | |
List<Tag> | getTag() | |
boolean | isSuppressed() | Always false, because the issue list does not contain any suppressed item |
List<String> | getThreadComments() | Get all threaded comments as a List of String, each line is in the format of Username Timestamp: Content |
String | getAnalysisEngine() | e.g. SCA, RTA, PTA |
String | getAnalyzer() | e.g. Dataflow, Controlflow, etc.. |
String | getCategory() | e.g. SQL Injection |
String | getCWE() | |
String | getKingdom() | |
String | getOWASP2004() | |
String | getOWASP2007() | |
String | getRuleId() | |
String | getSubType() | For Cross Site Scripting, this can be "Reflected" or "Persistent" |
String | getType() | |
String | getWASC24And2() | |
double | getConfidence() | A floating point between 0.0 to 5.0 |
double | getSeverity() | A integer from 1 to 5, 5 meaning very important |
String | getSinkFunction() | |
String | getSourceFunction() | |
String | getClassName() | |
String | getFilePath() | |
String | getFunction() | |
int | getLineNumber() | The priminary line number, -1 if unknown |
String | getPackage() | Package name, e.g. com.mypackage1.project1 |
String | getSourceFilePath() | |
String | getURL() |
Exampe:
var size = issues.size(); for(var i=0; i<size; i++) { var instance = issues.get(i); // only assign if it is not aissigned if ( null == instance.getAssignedUser() ) { var filepath = instance.getFilePath(); // need to prefixe with "/trunk/" for SVN... var lastUser = changeLog.get("/trunk/" + filepath); // and make sure this user is an authorized user in F360 server if ( null != lastUser && users.contains(lastUser) ) { instance.setAssignedUser(lastUser); instance.addComment("Auto-assigned to " + lastUser + " since the file is last modified by the user"); } else { print(lastUser + " modified " + filepath + " but is not an authorized developer\n"); } } } |