use of org.hisp.dhis.audit.AuditScope in project dhis2-core by dhis2.
the class AuditMatrixConfigurer method configure.
public Map<AuditScope, Map<AuditType, Boolean>> configure() {
Map<AuditScope, Map<AuditType, Boolean>> matrix = new HashMap<>();
for (AuditScope value : AuditScope.values()) {
Optional<ConfigurationKey> confKey = ConfigurationKey.getByKey(PROPERTY_PREFIX + value.name().toLowerCase());
if (confKey.isPresent() && !StringUtils.isEmpty(config.getProperty(confKey.get()))) {
String[] configuredTypes = config.getProperty(confKey.get()).split(AUDIT_TYPE_STRING_SEPAR);
Map<AuditType, Boolean> matrixAuditTypes = new HashMap<>();
for (AuditType auditType : AuditType.values()) {
matrixAuditTypes.put(auditType, ArrayUtils.contains(configuredTypes, auditType.name()));
}
matrix.put(value, matrixAuditTypes);
} else {
matrix.put(value, DEFAULT_AUDIT_CONFIGURATION);
}
}
return matrix;
}
Aggregations