Merge branch 'device-delete-fix' into 'master'

Remove operation existence check in update operation

See merge request entgra/carbon-device-mgt!546
reporting
Dharmakeerthi Lasantha 5 years ago
commit 38fdfb1005

@ -1912,16 +1912,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
device.getType());
}
try {
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(device.getDeviceIdentifier(), device.getType());
if (!pluginRepository.getOperationManager(device.getType(), this.getTenantId())
.isOperationExist(deviceIdentifier, operation.getId())) {
String msg = "Operation with operation id: " + operation.getId()
+ " does not exist.";
log.error(msg);
throw new BadRequestException(msg);
}
pluginRepository.getOperationManager(device.getType(), this.getTenantId())
.updateOperation(deviceIdentifier, operation);
.updateOperation(device.getEnrolmentInfo().getId(), operation,
new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
if (DeviceManagerUtil.isPublishOperationResponseEnabled()) {
List<String> permittedOperations = DeviceManagerUtil.getEnabledOperationsForResponsePublish();
if (permittedOperations.contains(operation.getCode())
@ -1948,10 +1941,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
String msg = "Error occurred while publishing event.";
log.error(msg, e);
throw new OperationManagementException(msg, e);
} catch (BadRequestException e) {
String msg = "Error occurred due to invalid request";
log.error(msg, e);
throw new OperationManagementException(msg, e);
}
}

Loading…
Cancel
Save