|
|
|
@ -21,6 +21,8 @@ package org.wso2.carbon.device.mgt.mobile.impl.android;
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.*;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.AbstractMobileOperationManager;
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
|
|
|
|
@ -38,8 +40,8 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
|
|
|
|
|
private static final Log log = LogFactory.getLog(AndroidMobileOperationManager.class);
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean addOperation(Operation operation, List<DeviceIdentifier> devices) throws
|
|
|
|
|
OperationManagementException {
|
|
|
|
|
public boolean addOperation(Operation operation,
|
|
|
|
|
List<DeviceIdentifier> devices) throws OperationManagementException {
|
|
|
|
|
boolean status = false;
|
|
|
|
|
try {
|
|
|
|
|
MobileDeviceOperationMapping mobileDeviceOperationMapping = null;
|
|
|
|
@ -65,8 +67,7 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (MobileDeviceManagementDAOException e) {
|
|
|
|
|
String msg =
|
|
|
|
|
"Error while adding an operation " + operation.getCode() + "to Android devices";
|
|
|
|
|
String msg = "Error while adding an operation " + operation.getCode() + "to Android devices";
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
throw new OperationManagementException(msg, e);
|
|
|
|
|
}
|
|
|
|
@ -90,16 +91,14 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
|
|
|
|
|
.getMobileOperationIdsFromMobileDeviceOperations(
|
|
|
|
|
mobileDeviceOperationMappings);
|
|
|
|
|
for (Integer operationId : operationIds) {
|
|
|
|
|
mobileOperation = MobileDeviceManagementDAOFactory.getMobileOperationDAO()
|
|
|
|
|
.getMobileOperation(
|
|
|
|
|
mobileOperation = MobileDeviceManagementDAOFactory.getMobileOperationDAO().getMobileOperation(
|
|
|
|
|
operationId);
|
|
|
|
|
operationProperties =
|
|
|
|
|
MobileDeviceManagementDAOFactory.getMobileOperationPropertyDAO()
|
|
|
|
|
.getAllMobileOperationPropertiesOfOperation(
|
|
|
|
|
operationId);
|
|
|
|
|
mobileOperation.setProperties(operationProperties);
|
|
|
|
|
operations.add(MobileDeviceManagementUtil
|
|
|
|
|
.convertMobileOperationToOperation(mobileOperation));
|
|
|
|
|
operations.add(MobileDeviceManagementUtil.convertMobileOperationToOperation(mobileOperation));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (MobileDeviceManagementDAOException e) {
|
|
|
|
@ -158,7 +157,7 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<Feature> getFeaturesForDeviceType(String deviceType) throws FeatureManagementException {
|
|
|
|
|
public List<Feature> getFeatures(String deviceType) throws FeatureManagementException {
|
|
|
|
|
MobileFeatureDAO featureDAO = MobileDeviceManagementDAOFactory.getFeatureDAO();
|
|
|
|
|
MobileFeaturePropertyDAO featurePropertyDAO = MobileDeviceManagementDAOFactory.getFeaturePropertyDAO();
|
|
|
|
|
List<Feature> features = new ArrayList<Feature>();
|
|
|
|
@ -183,12 +182,11 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
|
|
|
|
|
features.add(feature);
|
|
|
|
|
}
|
|
|
|
|
} catch (MobileDeviceManagementDAOException e) {
|
|
|
|
|
String msg =
|
|
|
|
|
"Error while fetching the features for the device type " +
|
|
|
|
|
deviceType;
|
|
|
|
|
String msg = "Error while fetching the features for the device type " + deviceType;
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
throw new FeatureManagementException(msg, e);
|
|
|
|
|
}
|
|
|
|
|
return features;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|