|
|
@ -601,32 +601,33 @@ public class OperationManagerImpl implements OperationManager {
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
OperationManagementDAOFactory.openConnection();
|
|
|
|
OperationManagementDAOFactory.openConnection();
|
|
|
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = operationDAO.
|
|
|
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation deviceSpecificOperation = operationDAO.
|
|
|
|
getOperationByDeviceAndId(enrolmentInfo.getId(),
|
|
|
|
getOperationByDeviceAndId(enrolmentInfo.getId(),
|
|
|
|
operationId);
|
|
|
|
operationId);
|
|
|
|
if (dtoOperation.getType().
|
|
|
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation dtoOperation = deviceSpecificOperation;
|
|
|
|
|
|
|
|
if (deviceSpecificOperation.getType().
|
|
|
|
equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) {
|
|
|
|
equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) {
|
|
|
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation;
|
|
|
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation commandOperation;
|
|
|
|
commandOperation =
|
|
|
|
commandOperation =
|
|
|
|
(org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO.
|
|
|
|
(org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) commandOperationDAO.
|
|
|
|
getOperation(dtoOperation.getId());
|
|
|
|
getOperation(deviceSpecificOperation.getId());
|
|
|
|
dtoOperation.setEnabled(commandOperation.isEnabled());
|
|
|
|
dtoOperation.setEnabled(commandOperation.isEnabled());
|
|
|
|
} else if (dtoOperation.getType().
|
|
|
|
} else if (deviceSpecificOperation.getType().
|
|
|
|
equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) {
|
|
|
|
equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) {
|
|
|
|
dtoOperation = configOperationDAO.getOperation(dtoOperation.getId());
|
|
|
|
dtoOperation = configOperationDAO.getOperation(deviceSpecificOperation.getId());
|
|
|
|
} else if (dtoOperation.getType().equals(
|
|
|
|
} else if (deviceSpecificOperation.getType().equals(
|
|
|
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE)) {
|
|
|
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE)) {
|
|
|
|
dtoOperation = profileOperationDAO.getOperation(dtoOperation.getId());
|
|
|
|
dtoOperation = profileOperationDAO.getOperation(deviceSpecificOperation.getId());
|
|
|
|
} else if (dtoOperation.getType().equals(
|
|
|
|
} else if (deviceSpecificOperation.getType().equals(
|
|
|
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY)) {
|
|
|
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY)) {
|
|
|
|
dtoOperation = policyOperationDAO.getOperation(dtoOperation.getId());
|
|
|
|
dtoOperation = policyOperationDAO.getOperation(deviceSpecificOperation.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (dtoOperation == null) {
|
|
|
|
if (dtoOperation == null) {
|
|
|
|
throw new OperationManagementException("Operation not found for operation Id:" + operationId +
|
|
|
|
throw new OperationManagementException("Operation not found for operation Id:" + operationId +
|
|
|
|
" device id:" + deviceId.getId());
|
|
|
|
" device id:" + deviceId.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
operation = OperationDAOUtil.convertOperation(dtoOperation);
|
|
|
|
dtoOperation.setStatus(deviceSpecificOperation.getStatus());
|
|
|
|
|
|
|
|
operation = OperationDAOUtil.convertOperation(deviceSpecificOperation);
|
|
|
|
} catch (OperationManagementDAOException e) {
|
|
|
|
} catch (OperationManagementDAOException e) {
|
|
|
|
throw new OperationManagementException("Error occurred while retrieving the list of " +
|
|
|
|
throw new OperationManagementException("Error occurred while retrieving the list of " +
|
|
|
|
"operations assigned for '" + deviceId.getType() +
|
|
|
|
"operations assigned for '" + deviceId.getType() +
|
|
|
@ -904,12 +905,18 @@ public class OperationManagerImpl implements OperationManager {
|
|
|
|
|
|
|
|
|
|
|
|
private OperationDAO lookupOperationDAO(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation operation) {
|
|
|
|
private OperationDAO lookupOperationDAO(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation operation) {
|
|
|
|
|
|
|
|
|
|
|
|
if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation) {
|
|
|
|
if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation ||
|
|
|
|
|
|
|
|
operation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.COMMAND)) {
|
|
|
|
return commandOperationDAO;
|
|
|
|
return commandOperationDAO;
|
|
|
|
} else if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.ProfileOperation) {
|
|
|
|
} else if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.ProfileOperation ||
|
|
|
|
|
|
|
|
operation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.PROFILE)) {
|
|
|
|
return profileOperationDAO;
|
|
|
|
return profileOperationDAO;
|
|
|
|
} else if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.ConfigOperation) {
|
|
|
|
} else if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.ConfigOperation ||
|
|
|
|
|
|
|
|
operation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.CONFIG)) {
|
|
|
|
return configOperationDAO;
|
|
|
|
return configOperationDAO;
|
|
|
|
|
|
|
|
} else if (operation instanceof org.wso2.carbon.device.mgt.core.dto.operation.mgt.PolicyOperation ||
|
|
|
|
|
|
|
|
operation.getType().equals(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Type.POLICY)) {
|
|
|
|
|
|
|
|
return policyOperationDAO;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return operationDAO;
|
|
|
|
return operationDAO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|