|
|
@ -189,6 +189,37 @@ public class OperationManagerImpl implements OperationManager {
|
|
|
|
OperationManagementDAOFactory.beginTransaction();
|
|
|
|
OperationManagementDAOFactory.beginTransaction();
|
|
|
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation operationDto =
|
|
|
|
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation operationDto =
|
|
|
|
OperationDAOUtil.convertOperation(operation);
|
|
|
|
OperationDAOUtil.convertOperation(operation);
|
|
|
|
|
|
|
|
int enrolmentId;
|
|
|
|
|
|
|
|
boolean hasExistingTaskOperation;
|
|
|
|
|
|
|
|
List<DeviceIdentifier> pendingDeviceList = new ArrayList<>();
|
|
|
|
|
|
|
|
String operationCode = operationDto.getCode();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (DeviceIdentifier deviceId : authorizedDeviceList) {
|
|
|
|
|
|
|
|
Device device = getDevice(deviceId);
|
|
|
|
|
|
|
|
enrolmentId = device.getEnrolmentInfo().getId();
|
|
|
|
|
|
|
|
hasExistingTaskOperation = operationDAO.updateTaskOperation(enrolmentId, operationCode);
|
|
|
|
|
|
|
|
if (hasExistingTaskOperation) {
|
|
|
|
|
|
|
|
pendingDeviceList.add(deviceId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pendingDeviceList.size() > 0) {
|
|
|
|
|
|
|
|
if (authorizedDeviceList.size() == pendingDeviceList.size()) {
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
|
|
|
|
log.debug("All the devices contain a pending operation for the Operation Code: "
|
|
|
|
|
|
|
|
+ operationCode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Activity activity = new Activity();
|
|
|
|
|
|
|
|
//Send the operation statuses only for admin triggered operations
|
|
|
|
|
|
|
|
String deviceType = validDeviceIds.get(0).getType();
|
|
|
|
|
|
|
|
activity.setActivityStatus(this.getActivityStatus(deviceValidationResult, deviceAuthorizationResult,
|
|
|
|
|
|
|
|
deviceType));
|
|
|
|
|
|
|
|
return activity;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
authorizedDeviceList.removeAll(pendingDeviceList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int operationId = this.lookupOperationDAO(operation).addOperation(operationDto);
|
|
|
|
int operationId = this.lookupOperationDAO(operation).addOperation(operationDto);
|
|
|
|
boolean isNotRepeated = false;
|
|
|
|
boolean isNotRepeated = false;
|
|
|
|
boolean isScheduled = false;
|
|
|
|
boolean isScheduled = false;
|
|
|
@ -202,8 +233,6 @@ public class OperationManagerImpl implements OperationManager {
|
|
|
|
isScheduled = notificationStrategy.getConfig().isScheduled();
|
|
|
|
isScheduled = notificationStrategy.getConfig().isScheduled();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
boolean hasExistingTaskOperation;
|
|
|
|
|
|
|
|
int enrolmentId;
|
|
|
|
|
|
|
|
List<Device> devices = new ArrayList<>();
|
|
|
|
List<Device> devices = new ArrayList<>();
|
|
|
|
if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Control.NO_REPEAT == operationDto.
|
|
|
|
if (org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Control.NO_REPEAT == operationDto.
|
|
|
|
getControl()) {
|
|
|
|
getControl()) {
|
|
|
@ -211,7 +240,6 @@ public class OperationManagerImpl implements OperationManager {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//TODO have to create a sql to load device details from deviceDAO using single query.
|
|
|
|
//TODO have to create a sql to load device details from deviceDAO using single query.
|
|
|
|
String operationCode = operationDto.getCode();
|
|
|
|
|
|
|
|
for (DeviceIdentifier deviceId : authorizedDeviceList) {
|
|
|
|
for (DeviceIdentifier deviceId : authorizedDeviceList) {
|
|
|
|
Device device = getDevice(deviceId);
|
|
|
|
Device device = getDevice(deviceId);
|
|
|
|
devices.add(device);
|
|
|
|
devices.add(device);
|
|
|
|