mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge pull request #323 from madhawap/master
fix for the iOS device operations blocker
This commit is contained in:
commit
b30d312f21
@ -29,12 +29,12 @@ public class DeviceTypeIdentifier implements Serializable {
|
|||||||
private static final int DEFAULT_SHARE_WITH_ALL_TENANTS_ID = -1;
|
private static final int DEFAULT_SHARE_WITH_ALL_TENANTS_ID = -1;
|
||||||
|
|
||||||
public DeviceTypeIdentifier(String deviceType, int tenantId) {
|
public DeviceTypeIdentifier(String deviceType, int tenantId) {
|
||||||
this.deviceType = deviceType;
|
this.deviceType = deviceType.toLowerCase();
|
||||||
this.tenantId = tenantId;
|
this.tenantId = tenantId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeviceTypeIdentifier(String deviceType) {
|
public DeviceTypeIdentifier(String deviceType) {
|
||||||
this.deviceType = deviceType;
|
this.deviceType = deviceType.toLowerCase();
|
||||||
this.tenantId = DEFAULT_SHARE_WITH_ALL_TENANTS_ID;
|
this.tenantId = DEFAULT_SHARE_WITH_ALL_TENANTS_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,7 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addDeviceManagementProvider(DeviceManagementService provider) throws DeviceManagementException {
|
public void addDeviceManagementProvider(DeviceManagementService provider) throws DeviceManagementException {
|
||||||
String deviceType = provider.getType();
|
String deviceType = provider.getType().toLowerCase();
|
||||||
|
|
||||||
ProvisioningConfig provisioningConfig = provider.getProvisioningConfig();
|
ProvisioningConfig provisioningConfig = provider.getProvisioningConfig();
|
||||||
String tenantDomain = provisioningConfig.getProviderTenantDomain();
|
String tenantDomain = provisioningConfig.getProviderTenantDomain();
|
||||||
@ -87,7 +87,7 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeDeviceManagementProvider(DeviceManagementService provider) throws DeviceManagementException {
|
public void removeDeviceManagementProvider(DeviceManagementService provider) throws DeviceManagementException {
|
||||||
String deviceTypeName = provider.getType();
|
String deviceTypeName = provider.getType().toLowerCase();
|
||||||
DeviceTypeIdentifier deviceTypeIdentifier;
|
DeviceTypeIdentifier deviceTypeIdentifier;
|
||||||
ProvisioningConfig provisioningConfig = provider.getProvisioningConfig();
|
ProvisioningConfig provisioningConfig = provider.getProvisioningConfig();
|
||||||
if (provisioningConfig.isSharedWithAllTenants()) {
|
if (provisioningConfig.isSharedWithAllTenants()) {
|
||||||
@ -103,10 +103,10 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|||||||
|
|
||||||
public DeviceManagementService getDeviceManagementService(String type, int tenantId) {
|
public DeviceManagementService getDeviceManagementService(String type, int tenantId) {
|
||||||
//Priority need to be given to the tenant before public.
|
//Priority need to be given to the tenant before public.
|
||||||
DeviceTypeIdentifier deviceTypeIdentifier = new DeviceTypeIdentifier(type, tenantId);
|
DeviceTypeIdentifier deviceTypeIdentifier = new DeviceTypeIdentifier(type.toLowerCase(), tenantId);
|
||||||
DeviceManagementService provider = providers.get(deviceTypeIdentifier);
|
DeviceManagementService provider = providers.get(deviceTypeIdentifier);
|
||||||
if (provider == null) {
|
if (provider == null) {
|
||||||
deviceTypeIdentifier = new DeviceTypeIdentifier(type);
|
deviceTypeIdentifier = new DeviceTypeIdentifier(type.toLowerCase());
|
||||||
provider = providers.get(deviceTypeIdentifier);
|
provider = providers.get(deviceTypeIdentifier);
|
||||||
}
|
}
|
||||||
return provider;
|
return provider;
|
||||||
@ -153,10 +153,10 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|||||||
|
|
||||||
public OperationManager getOperationManager(String deviceType, int tenantId) {
|
public OperationManager getOperationManager(String deviceType, int tenantId) {
|
||||||
//Priority need to be given to the tenant before public.
|
//Priority need to be given to the tenant before public.
|
||||||
DeviceTypeIdentifier deviceTypeIdentifier = new DeviceTypeIdentifier(deviceType, tenantId);
|
DeviceTypeIdentifier deviceTypeIdentifier = new DeviceTypeIdentifier(deviceType.toLowerCase(), tenantId);
|
||||||
OperationManager operationManager = operationManagerRepository.getOperationManager(deviceTypeIdentifier);
|
OperationManager operationManager = operationManagerRepository.getOperationManager(deviceTypeIdentifier);
|
||||||
if (operationManager == null) {
|
if (operationManager == null) {
|
||||||
deviceTypeIdentifier = new DeviceTypeIdentifier(deviceType);
|
deviceTypeIdentifier = new DeviceTypeIdentifier(deviceType.toLowerCase());
|
||||||
operationManager = operationManagerRepository.getOperationManager(deviceTypeIdentifier);
|
operationManager = operationManagerRepository.getOperationManager(deviceTypeIdentifier);
|
||||||
}
|
}
|
||||||
return operationManager;
|
return operationManager;
|
||||||
@ -164,14 +164,15 @@ public class DeviceManagementPluginRepository implements DeviceManagerStartupLis
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void notifyObserver() {
|
public void notifyObserver() {
|
||||||
|
String deviceTypeName;
|
||||||
synchronized (providers) {
|
synchronized (providers) {
|
||||||
for (DeviceManagementService provider : providers.values()) {
|
for (DeviceManagementService provider : providers.values()) {
|
||||||
try {
|
try {
|
||||||
provider.init();
|
provider.init();
|
||||||
|
deviceTypeName = provider.getType().toLowerCase();
|
||||||
ProvisioningConfig provisioningConfig = provider.getProvisioningConfig();
|
ProvisioningConfig provisioningConfig = provider.getProvisioningConfig();
|
||||||
int tenantId = DeviceManagerUtil.getTenantId(provisioningConfig.getProviderTenantDomain());
|
int tenantId = DeviceManagerUtil.getTenantId(provisioningConfig.getProviderTenantDomain());
|
||||||
DeviceManagerUtil.registerDeviceType(provider.getType(), tenantId, provisioningConfig.isSharedWithAllTenants());
|
DeviceManagerUtil.registerDeviceType(deviceTypeName, tenantId, provisioningConfig.isSharedWithAllTenants());
|
||||||
registerPushNotificationStrategy(provider);
|
registerPushNotificationStrategy(provider);
|
||||||
//TODO:
|
//TODO:
|
||||||
//This is a temporory fix.
|
//This is a temporory fix.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user