mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fetch enrollment Id if it is not already in the device
This commit is contained in:
parent
55c3f93deb
commit
4943635a61
@ -1973,16 +1973,17 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateOperation(Device device, Operation operation) throws OperationManagementException {
|
public void updateOperation(Device device, Operation operation) throws OperationManagementException {
|
||||||
EnrolmentInfo enrolmentInfo = device.getEnrolmentInfo();
|
|
||||||
if (enrolmentInfo == null) {
|
|
||||||
throw new OperationManagementException(
|
|
||||||
"Device not found for device id:" + device.getDeviceIdentifier() + " " + "type:" +
|
|
||||||
device.getType());
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
pluginRepository.getOperationManager(device.getType(), this.getTenantId())
|
EnrolmentInfo enrolmentInfo = device.getEnrolmentInfo();
|
||||||
.updateOperation(device.getEnrolmentInfo().getId(), operation,
|
if (enrolmentInfo == null || device.getEnrolmentInfo().getId() <= 0) {
|
||||||
new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
pluginRepository.getOperationManager(device.getType(), this.getTenantId())
|
||||||
|
.updateOperation(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()),
|
||||||
|
operation);
|
||||||
|
} else {
|
||||||
|
pluginRepository.getOperationManager(device.getType(), this.getTenantId())
|
||||||
|
.updateOperation(device.getEnrolmentInfo().getId(), operation,
|
||||||
|
new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
|
||||||
|
}
|
||||||
if (DeviceManagerUtil.isPublishOperationResponseEnabled()) {
|
if (DeviceManagerUtil.isPublishOperationResponseEnabled()) {
|
||||||
List<String> permittedOperations = DeviceManagerUtil.getEnabledOperationsForResponsePublish();
|
List<String> permittedOperations = DeviceManagerUtil.getEnabledOperationsForResponsePublish();
|
||||||
if (permittedOperations.contains(operation.getCode())
|
if (permittedOperations.contains(operation.getCode())
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user