use of org.hisp.dhis.external.conf.ConfigurationKey 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;
}
use of org.hisp.dhis.external.conf.ConfigurationKey in project dhis2-core by dhis2.
the class MetricsEnabler method matches.
@Override
public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
ConfigurationKey key = getConfigKey();
boolean isEnabled = !isTestRun(conditionContext) && getBooleanValue(getConfigKey());
log.info(String.format("Monitoring metric for key %s is %s", key.getKey(), isEnabled ? "enabled" : "disabled"));
return isEnabled;
}
Aggregations