Remove operation existence check in update operation

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

@ -1912,16 +1912,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
device.getType()); device.getType());
} }
try { 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()) pluginRepository.getOperationManager(device.getType(), this.getTenantId())
.updateOperation(deviceIdentifier, operation); .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())
@ -1948,10 +1941,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
String msg = "Error occurred while publishing event."; String msg = "Error occurred while publishing event.";
log.error(msg, e); log.error(msg, e);
throw new OperationManagementException(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