|
|
@ -20,7 +20,6 @@ package org.wso2.carbon.device.mgt.core.operation.mgt.dao.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.CommandOperation;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation;
|
|
|
|
import org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation;
|
|
|
|
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOException;
|
|
|
|
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOException;
|
|
|
@ -37,6 +36,7 @@ import java.util.List;
|
|
|
|
public class CommandOperationDAOImpl extends OperationDAOImpl {
|
|
|
|
public class CommandOperationDAOImpl extends OperationDAOImpl {
|
|
|
|
|
|
|
|
|
|
|
|
private static final Log log = LogFactory.getLog(CommandOperationDAOImpl.class);
|
|
|
|
private static final Log log = LogFactory.getLog(CommandOperationDAOImpl.class);
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int addOperation(Operation operation) throws OperationManagementDAOException {
|
|
|
|
public int addOperation(Operation operation) throws OperationManagementDAOException {
|
|
|
|
|
|
|
|
|
|
|
@ -138,7 +138,9 @@ public class CommandOperationDAOImpl extends OperationDAOImpl {
|
|
|
|
Operation operation;
|
|
|
|
Operation operation;
|
|
|
|
|
|
|
|
|
|
|
|
List<Operation> operationList = new ArrayList<Operation>();
|
|
|
|
List<Operation> operationList = new ArrayList<Operation>();
|
|
|
|
|
|
|
|
List<CommandOperation> commandOperationList = new ArrayList<CommandOperation>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CommandOperation commandOperation = null;
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
@ -152,15 +154,19 @@ public class CommandOperationDAOImpl extends OperationDAOImpl {
|
|
|
|
stmt.setString(2, status.toString());
|
|
|
|
stmt.setString(2, status.toString());
|
|
|
|
|
|
|
|
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
int operationId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
while (rs.next()) {
|
|
|
|
|
|
|
|
commandOperation = new CommandOperation();
|
|
|
|
|
|
|
|
commandOperation.setEnabled(rs.getInt("ENABLED") == 0 ? false : true);
|
|
|
|
|
|
|
|
commandOperation.setId(rs.getInt("OPERATION_ID"));
|
|
|
|
|
|
|
|
commandOperationList.add(commandOperation);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
operationId = rs.getInt("OPERATION_ID");
|
|
|
|
for(CommandOperation cmOperation:commandOperationList){
|
|
|
|
operation = super.getOperation(operationId);
|
|
|
|
operation = super.getOperation(cmOperation.getId());
|
|
|
|
operation.setEnabled(rs.getInt("ENABLED") == 0?false:true);
|
|
|
|
operation.setEnabled(cmOperation.isEnabled());
|
|
|
|
operationList.add(operation);
|
|
|
|
operationList.add(operation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
String errorMsg = "SQL error occurred while retrieving the operation available for the device'" + deviceId +
|
|
|
|
String errorMsg = "SQL error occurred while retrieving the operation available for the device'" + deviceId +
|
|
|
|
"' with status '" + status.toString();
|
|
|
|
"' with status '" + status.toString();
|
|
|
|