with changes with formatting

ayyoob 9 years ago
parent 67199866a0
commit c72ebbe367

@ -77,14 +77,20 @@ public class ApisAppClient {
} }
public String getBase64EncodedConsumerKeyAndSecret(String deviceType) { public String getBase64EncodedConsumerKeyAndSecret(String deviceType) {
if(!isEnabled) return null; if (!isEnabled) return null;
String consumerKeyAndSecret = deviceTypeToApiAppMap.get(deviceType); String consumerKeyAndSecret = deviceTypeToApiAppMap.get(deviceType);
if(consumerKeyAndSecret == null){ if (consumerKeyAndSecret == null) {
ArrayList<IotDeviceTypeConfig> iotDeviceTypeConfigs = new ArrayList<>(); ArrayList<IotDeviceTypeConfig> iotDeviceTypeConfigs = new ArrayList<>();
IotDeviceTypeConfig deviceTypeConfig = IotDeviceTypeConfigurationManager.getInstance().getIotDeviceTypeConfigMap().get(deviceType); IotDeviceTypeConfigurationManager deviceTypeConfigurationManager =
if(deviceTypeConfig != null) { IotDeviceTypeConfigurationManager.getInstance();
IotDeviceTypeConfig deviceTypeConfig = null;
if (deviceTypeConfigurationManager != null) {
deviceTypeConfig = deviceTypeConfigurationManager.getIotDeviceTypeConfigMap().get(
deviceType);
}
if (deviceTypeConfig != null) {
iotDeviceTypeConfigs.add(deviceTypeConfig); iotDeviceTypeConfigs.add(deviceTypeConfig);
}else{ } else {
deviceTypeConfig = new IotDeviceTypeConfig(); deviceTypeConfig = new IotDeviceTypeConfig();
deviceTypeConfig.setType(deviceType); deviceTypeConfig.setType(deviceType);
deviceTypeConfig.setApiApplicationName(deviceType); deviceTypeConfig.setApiApplicationName(deviceType);
@ -92,11 +98,11 @@ public class ApisAppClient {
} }
setBase64EncodedConsumerKeyAndSecret(iotDeviceTypeConfigs); setBase64EncodedConsumerKeyAndSecret(iotDeviceTypeConfigs);
consumerKeyAndSecret = deviceTypeToApiAppMap.get(deviceType); consumerKeyAndSecret = deviceTypeToApiAppMap.get(deviceType);
if(consumerKeyAndSecret==null){ if (consumerKeyAndSecret == null) {
log.warn("There is no API application for the device type " + deviceType); log.warn("There is no API application for the device type " + deviceType);
} }
} }
return consumerKeyAndSecret; return consumerKeyAndSecret;
} }
public void setBase64EncodedConsumerKeyAndSecret(List<IotDeviceTypeConfig> iotDeviceTypeConfigList) { public void setBase64EncodedConsumerKeyAndSecret(List<IotDeviceTypeConfig> iotDeviceTypeConfigList) {

Loading…
Cancel
Save