use of org.hisp.dhis.sms.config.SmsGatewayConfig in project dhis2-core by dhis2.
the class DefaultSmsConfigurationManager method initializeSmsConfig.
private void initializeSmsConfig() {
SmsConfiguration smsConfiguration = getSmsConfiguration();
if (smsConfiguration == null) {
log.info("SMS configuration not found");
return;
}
List<SmsGatewayConfig> gatewayList = smsConfiguration.getGateways();
if (gatewayList == null || gatewayList.isEmpty()) {
log.info("Gateway configuration not found");
return;
}
log.info("Gateway configurations found: " + gatewayList);
gatewayAdminService.loadGatewayConfigurationMap(smsConfiguration);
}
use of org.hisp.dhis.sms.config.SmsGatewayConfig in project dhis2-core by dhis2.
the class DefaultSmsConfigurationManager method setDefaultSMSGateway.
@Override
public boolean setDefaultSMSGateway(String gatewayId) {
boolean result = false;
SmsConfiguration config = getSmsConfiguration();
if (config == null) {
return result;
}
List<SmsGatewayConfig> smsGatewayList = config.getGateways();
for (SmsGatewayConfig gw : smsGatewayList) {
if (gw.getName().equals(gatewayId)) {
gw.setDefault(true);
result = true;
} else {
gw.setDefault(false);
}
}
updateSmsConfiguration(config);
return result;
}
use of org.hisp.dhis.sms.config.SmsGatewayConfig in project dhis2-core by dhis2.
the class DefaultSmsConfigurationManager method checkInstanceOfGateway.
@Override
public SmsGatewayConfig checkInstanceOfGateway(Class<?> clazz) {
if (getSmsConfiguration() == null) {
SmsConfiguration smsConfig = new SmsConfiguration(true);
updateSmsConfiguration(smsConfig);
}
for (SmsGatewayConfig gateway : getSmsConfiguration().getGateways()) {
if (gateway.getClass().equals(clazz)) {
return gateway;
}
}
return null;
}
Aggregations