Remove operation existence check in update operation

reporting
Pahansith Gunathilake 5 years ago committed by Dharmakeerthi Lasantha
parent 66a30ef131
commit 1112b285d5

@ -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