Package org.netxms.client.assess
Class CompliancePolicy
java.lang.Object
org.netxms.client.assess.CompliancePolicy
Compliance policy: definition (JSON document), state, assignments and number of findings by effective state.
-
Constructor Summary
ConstructorsConstructorDescriptionCompliancePolicy(String definition) Create new policy from definition.CompliancePolicy(NXCPMessage msg, long baseId) Create policy from NXCP message. -
Method Summary
Modifier and TypeMethodDescriptionvoidfillMessage(NXCPMessage msg) Fill NXCP message with policy data.doubleGet compliance: part of assessed objects that are compliant.intdoubleGet coverage: part of objects in scope of the policy that could be assessed (are either compliant or violating the policy).intgetId()intintintgetTitle()intbooleanvoidsetDefinition(String definition) Set policy definition.voidsetEnabled(boolean enabled)
-
Constructor Details
-
CompliancePolicy
Create new policy from definition. Policy ID is taken from the definition; server validates definition when policy is saved.- Parameters:
definition- policy definition (JSON document)
-
CompliancePolicy
Create policy from NXCP message.- Parameters:
msg- NXCP messagebaseId- base field ID
-
-
Method Details
-
fillMessage
Fill NXCP message with policy data.- Parameters:
msg- NXCP message
-
getId
- Returns:
- policy ID
-
isEnabled
public boolean isEnabled()- Returns:
- true if policy is enabled
-
setEnabled
public void setEnabled(boolean enabled) - Parameters:
enabled- true if policy is enabled
-
getDefinition
- Returns:
- policy definition (JSON document)
-
setDefinition
Set policy definition. Policy ID is updated from the definition.- Parameters:
definition- policy definition (JSON document)
-
getRevision
public int getRevision()- Returns:
- policy revision from definition (0 if definition has no valid revision)
-
getTitle
- Returns:
- policy title from definition
-
getDescription
- Returns:
- policy description from definition
-
getRemediation
- Returns:
- remediation advice from definition
-
getSeverity
- Returns:
- policy severity from definition (UNKNOWN if definition has no valid severity)
-
getAssignments
- Returns:
- assignments of this policy
-
getFindingCount
public int getFindingCount()- Returns:
- number of findings (objects in scope of the policy)
-
getCompliantCount
public int getCompliantCount()- Returns:
- number of compliant objects
-
getViolationCount
public int getViolationCount()- Returns:
- number of objects violating the policy
-
getNotAssessableCount
public int getNotAssessableCount()- Returns:
- number of objects that cannot be assessed
-
getSuppressedCount
public int getSuppressedCount()- Returns:
- number of objects with suppressed finding
-
getCoverage
public double getCoverage()Get coverage: part of objects in scope of the policy that could be assessed (are either compliant or violating the policy). Objects with suppressed finding are not counted.- Returns:
- coverage (0 to 1) or -1 if there are no objects to calculate it from
-
getCompliance
public double getCompliance()Get compliance: part of assessed objects that are compliant. Objects that cannot be assessed and objects with suppressed finding are not counted, so compliance has to be read together with coverage.- Returns:
- compliance (0 to 1) or -1 if there are no assessed objects
-