|
|
@ -134,6 +134,7 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
|
|
|
configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
|
|
|
List<ConfigurationEntry> configs = configuration.getConfiguration();
|
|
|
|
List<ConfigurationEntry> configs = configuration.getConfiguration();
|
|
|
|
|
|
|
|
NotifierFrequency notifierFrequency = new NotifierFrequency();
|
|
|
|
for (ConfigurationEntry entry : configs) {
|
|
|
|
for (ConfigurationEntry entry : configs) {
|
|
|
|
if (AndroidConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) {
|
|
|
|
if (AndroidConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) {
|
|
|
|
License license = new License();
|
|
|
|
License license = new License();
|
|
|
@ -145,30 +146,18 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
|
|
|
MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, license);
|
|
|
|
MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, license);
|
|
|
|
licenseEntry = entry;
|
|
|
|
licenseEntry = entry;
|
|
|
|
} else if (AndroidConstants.TenantConfigProperties.NOTIFIER_FREQUENCY.equals(entry.getName())) {
|
|
|
|
} else if (AndroidConstants.TenantConfigProperties.NOTIFIER_FREQUENCY.equals(entry.getName())) {
|
|
|
|
List<Device> deviceList = AndroidAPIUtils.
|
|
|
|
if (entry.getValue() != null) {
|
|
|
|
getDeviceManagementService().
|
|
|
|
notifierFrequency.setValue(Integer.parseInt(entry.getValue().toString()));
|
|
|
|
getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, false);
|
|
|
|
} else {
|
|
|
|
List<DeviceIdentifier> deviceIdList = new ArrayList<>();
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST)
|
|
|
|
for (Device device : deviceList) {
|
|
|
|
.entity("No value specified for notifierFrequency.").build();
|
|
|
|
if (EnrolmentInfo.Status.REMOVED != device.getEnrolmentInfo().getStatus()) {
|
|
|
|
|
|
|
|
deviceIdList.add(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!deviceIdList.isEmpty()) {
|
|
|
|
} else if (AndroidConstants.TenantConfigProperties.NOTIFIER_TYPE.equals(entry.getName())) {
|
|
|
|
if (entry.getValue() != null) {
|
|
|
|
if (entry.getValue() != null) {
|
|
|
|
NotifierFrequency notifierFrequency = new NotifierFrequency();
|
|
|
|
notifierFrequency.setType(Integer.parseInt(entry.getValue().toString()));
|
|
|
|
notifierFrequency.setValue(Integer.parseInt(entry.getValue().toString()));
|
|
|
|
} else {
|
|
|
|
ProfileOperation operation = new ProfileOperation();
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST)
|
|
|
|
operation.setCode(AndroidConstants.OperationCodes.NOTIFIER_FREQUENCY);
|
|
|
|
.entity("No value specified for notifierType.").build();
|
|
|
|
operation.setPayLoad(notifierFrequency.toJSON());
|
|
|
|
|
|
|
|
operation.setEnabled(true);
|
|
|
|
|
|
|
|
AndroidAPIUtils.getDeviceManagementService().addOperation(
|
|
|
|
|
|
|
|
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID,
|
|
|
|
|
|
|
|
operation, deviceIdList);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return Response.status(Response.Status.BAD_REQUEST)
|
|
|
|
|
|
|
|
.entity("No value specified for notifierFrequency.").build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -178,6 +167,7 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
|
|
|
}
|
|
|
|
}
|
|
|
|
configuration.setConfiguration(configs);
|
|
|
|
configuration.setConfiguration(configs);
|
|
|
|
AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
|
|
|
|
AndroidAPIUtils.getDeviceManagementService().saveConfiguration(configuration);
|
|
|
|
|
|
|
|
notifyDevices(notifierFrequency);
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
} catch (DeviceManagementException e) {
|
|
|
|
msg = "Error occurred while modifying configuration settings of Android platform";
|
|
|
|
msg = "Error occurred while modifying configuration settings of Android platform";
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
@ -203,6 +193,27 @@ public class DeviceTypeConfigurationServiceImpl implements DeviceTypeConfigurati
|
|
|
|
.entity("Android platform configuration has been updated successfully.").build();
|
|
|
|
.entity("Android platform configuration has been updated successfully.").build();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void notifyDevices(NotifierFrequency notifierFrequency) throws DeviceManagementException,
|
|
|
|
|
|
|
|
OperationManagementException, InvalidDeviceException {
|
|
|
|
|
|
|
|
List<Device> deviceList = AndroidAPIUtils.
|
|
|
|
|
|
|
|
getDeviceManagementService().
|
|
|
|
|
|
|
|
getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID, false);
|
|
|
|
|
|
|
|
List<DeviceIdentifier> deviceIdList = new ArrayList<>();
|
|
|
|
|
|
|
|
for (Device device : deviceList) {
|
|
|
|
|
|
|
|
if (EnrolmentInfo.Status.REMOVED != device.getEnrolmentInfo().getStatus()) {
|
|
|
|
|
|
|
|
deviceIdList.add(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!deviceIdList.isEmpty()) {
|
|
|
|
|
|
|
|
ProfileOperation operation = new ProfileOperation();
|
|
|
|
|
|
|
|
operation.setCode(AndroidConstants.OperationCodes.NOTIFIER_FREQUENCY);
|
|
|
|
|
|
|
|
operation.setPayLoad(notifierFrequency.toJSON());
|
|
|
|
|
|
|
|
operation.setEnabled(true);
|
|
|
|
|
|
|
|
AndroidAPIUtils.getDeviceManagementService().addOperation(
|
|
|
|
|
|
|
|
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID,
|
|
|
|
|
|
|
|
operation, deviceIdList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GET
|
|
|
|
@GET
|
|
|
|
@Path("/license")
|
|
|
|
@Path("/license")
|
|
|
|