SevLib: Severity Support Helper Functions

SevLib is a collection of helper functions that provides support to process severity levels that have been remapped via the Oracle JAF configuration property sevMap.

Access these functions through the rule context object property context.utils.SevLib. They may be useful when writing audit.

Name Returns Description
map(string sev) string Maps a severity. If severity is not mapped, the unmapped severity is returned. For example, map("major") will return the mapped value, or major if not remapped.
unmap(string sev) Array.<string> Unmaps a severity. If the severity does not represent a mapped severity value, the supplied severity is returned. If there more than one severity has been unmapped, it returns all unmapped severity strings in an arrary. For example, given the following:
"sevMap" :{
    "sevSet" : {
        "blocker" :  "mustfix",
        "critical" : "mustfix", 
        "major" :    "mustfix",
        "minor" :    "warning",
        "info" :     "warning"
    }
}

Then context.utils.sevLib.unmap('mustfix') returns ["blocker","critical","major"].

isMapped(string sev) boolean Test if a severity is a remapped severity.
getList() Array.<string> Returns an array of JAF default severities. For example, blocker, critical, and so on in ascending order of priority.
getMap() Object Returns an object whose properties are the JAF default properties, and the corresponding values are the user mapped severities. If severities have not been remapped, null is returned.
getInvertedMap() Object Returns an inverted form of the object returned by getMap(), whose properties are the remapped properties, and the corresponding values are the JAF default properties. If severities have not been remapped, null is returned.
isSev(string sev) boolean Returns true if the supplied severity is a valid value. May be a core severity or a remapped value.
getMsgSev(string msgId) string | null Returns the severity for the msgId (for example, JET-2000), or null if the msgId is not defined.
matchSeverityLevel(string sev) boolean Tests if the supplied severity is matched by the JAF configuration property severity value/expression.
isBlocker(string sev) boolean Returns true if the severity (mapped or unmapped) represents blocker.
isCritical(string sev) boolean Returns true if the severity (mapped or unmapped) represents critical.
isMajor(string sev) boolean Returns true if the severity (mapped or unmapped) represents major.
isMinor(string sev) boolean Returns true if the severity (mapped or unmapped) represents minor.
isInfo(string sev) boolean Returns true if the severity (mapped or unmapped) represents info.