mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Fetch device according to the device identifier
This commit is contained in:
parent
39b85a3b44
commit
14c6773b57
@ -59,7 +59,7 @@ public interface OperationManager {
|
||||
|
||||
public Operation getNextPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException;
|
||||
|
||||
public void updateOperation(int deviceId, int operationId, Operation.Status operationStatus) throws
|
||||
public void updateOperation(DeviceIdentifier deviceId, int operationId, Operation.Status operationStatus) throws
|
||||
OperationManagementException;
|
||||
|
||||
public void deleteOperation(int operationId) throws OperationManagementException;
|
||||
|
||||
@ -465,7 +465,7 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOperation(int deviceId, int operationId, Operation.Status operationStatus)
|
||||
public void updateOperation(DeviceIdentifier deviceId, int operationId, Operation.Status operationStatus)
|
||||
throws OperationManagementException {
|
||||
DeviceManagementDataHolder.getInstance().getOperationManager().updateOperation(deviceId,operationId,
|
||||
operationStatus);
|
||||
|
||||
@ -263,7 +263,7 @@ public class OperationManagerImpl implements OperationManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOperation(int deviceId, int operationId, Operation.Status operationStatus)
|
||||
public void updateOperation(DeviceIdentifier deviceIdentifier, int operationId, Operation.Status operationStatus)
|
||||
throws OperationManagementException {
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
@ -279,11 +279,19 @@ public class OperationManagerImpl implements OperationManager {
|
||||
}
|
||||
dtoOperation.setStatus(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.valueOf
|
||||
(operationStatus.toString()));
|
||||
Device device = deviceManagementService.getCoreDevice(deviceIdentifier);
|
||||
|
||||
OperationManagementDAOFactory.beginTransaction();
|
||||
operationDAO.updateOperation(dtoOperation);
|
||||
operationDAO.updateOperationStatus(deviceId,operationId,
|
||||
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.valueOf(operationStatus.toString()));
|
||||
operationDAO.updateOperationStatus(device.getId(), operationId,
|
||||
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status
|
||||
.valueOf(operationStatus.toString()));
|
||||
OperationManagementDAOFactory.commitTransaction();
|
||||
}catch (DeviceManagementException ex){
|
||||
log.error("Error occurred while fetch the device for device identifier: " + deviceIdentifier.getId() + " " +
|
||||
"type:" + deviceIdentifier.getType(), ex);
|
||||
throw new OperationManagementException("Error occurred while update operation", ex);
|
||||
|
||||
} catch (OperationManagementDAOException ex) {
|
||||
try {
|
||||
OperationManagementDAOFactory.rollbackTransaction();
|
||||
|
||||
@ -149,7 +149,7 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOperation(int deviceId, int operationId, Operation.Status operationStatus) throws
|
||||
public void updateOperation(DeviceIdentifier deviceId, int operationId, Operation.Status operationStatus) throws
|
||||
OperationManagementException {
|
||||
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().updateOperation(deviceId, operationId,
|
||||
operationStatus);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user