mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
fixed code issues
This commit is contained in:
parent
2776577729
commit
69299b69e8
@ -116,13 +116,13 @@ public class WindowsFeatureManager implements FeatureManager {
|
||||
featureDAO.deleteFeatureByCode(code);
|
||||
WindowsDAOFactory.commitTransaction();
|
||||
status = true;
|
||||
return status;
|
||||
} catch (MobileDeviceManagementDAOException e) {
|
||||
WindowsDAOFactory.rollbackTransaction();
|
||||
throw new DeviceManagementException("Error occurred while removing the feature", e);
|
||||
} finally {
|
||||
WindowsDAOFactory.closeConnection();
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -39,7 +39,8 @@ public class WindowsDAOFactory extends AbstractMobileDeviceManagementDAOFactory
|
||||
private static ThreadLocal<Connection> currentConnection = new ThreadLocal<>();
|
||||
|
||||
public WindowsDAOFactory() {
|
||||
this.dataSource = getDataSourceMap().get(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
|
||||
this.dataSource = getDataSourceMap().get(
|
||||
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -25,6 +25,7 @@ import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
|
||||
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.windows.dao.WindowsDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.windows.util.WindowsPluginConstants;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.windows.util.WindowsUtils;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
@ -60,17 +61,7 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO {
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
mobileDevice = new MobileDevice();
|
||||
mobileDevice.setMobileDeviceId(rs.getString(WindowsPluginConstants.DEVICE_ID));
|
||||
mobileDevice.setImei(rs.getString(WindowsPluginConstants.IMEI));
|
||||
mobileDevice.setImsi(rs.getString(WindowsPluginConstants.IMSI));
|
||||
mobileDevice.setModel(rs.getString(WindowsPluginConstants.DEVICE_MODEL));
|
||||
mobileDevice.setVendor(rs.getString(WindowsPluginConstants.VENDOR));
|
||||
mobileDevice.setLatitude(rs.getString(WindowsPluginConstants.LATITUDE));
|
||||
mobileDevice.setLongitude(rs.getString(WindowsPluginConstants.LONGITUDE));
|
||||
mobileDevice.setSerial(rs.getString(WindowsPluginConstants.SERIAL));
|
||||
mobileDevice.setOsVersion(rs.getString(WindowsPluginConstants.LATITUDE));
|
||||
|
||||
mobileDevice = WindowsUtils.loadMobileDevices(rs);
|
||||
Map<String, String> propertyMap = new HashMap<>();
|
||||
propertyMap.put(WindowsPluginConstants.CHANNEL_URI, rs.getString(WindowsPluginConstants.CHANNEL_URI));
|
||||
propertyMap.put(WindowsPluginConstants.DEVICE_INFO, rs.getString(WindowsPluginConstants.DEVICE_INFO));
|
||||
@ -225,15 +216,7 @@ public class WindowsDeviceDAOImpl implements MobileDeviceDAO {
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
mobileDevice = new MobileDevice();
|
||||
mobileDevice.setMobileDeviceId(rs.getString(WindowsPluginConstants.DEVICE_ID));
|
||||
mobileDevice.setVendor(rs.getString(WindowsPluginConstants.IMEI));
|
||||
mobileDevice.setLatitude(rs.getString(WindowsPluginConstants.IMSI));
|
||||
mobileDevice.setLongitude(rs.getString(WindowsPluginConstants.OS_VERSION));
|
||||
mobileDevice.setImei(rs.getString(WindowsPluginConstants.DEVICE_MODEL));
|
||||
mobileDevice.setImsi(rs.getString(WindowsPluginConstants.VENDOR));
|
||||
mobileDevice.setOsVersion(rs.getString(WindowsPluginConstants.LATITUDE));
|
||||
|
||||
mobileDevice = WindowsUtils.loadMatchingMobileDevices(rs);
|
||||
Map<String, String> propertyMap = new HashMap<>();
|
||||
propertyMap.put(WindowsPluginConstants.CHANNEL_URI, rs.getString(WindowsPluginConstants.CHANNEL_URI));
|
||||
propertyMap.put(WindowsPluginConstants.DEVICE_INFO, rs.getString(WindowsPluginConstants.DEVICE_INFO));
|
||||
|
||||
@ -18,12 +18,17 @@
|
||||
|
||||
package org.wso2.carbon.device.mgt.mobile.impl.windows.util;
|
||||
|
||||
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Contains utility methods used by Windows plugin.
|
||||
* Contains utility methods which are used by Windows plugin.
|
||||
*/
|
||||
public class WindowsUtils {
|
||||
|
||||
public static String getDeviceProperty(Map<String, String> deviceProperties, String property) {
|
||||
|
||||
String deviceProperty = deviceProperties.get(property);
|
||||
@ -32,4 +37,31 @@ public class WindowsUtils {
|
||||
}
|
||||
return deviceProperty;
|
||||
}
|
||||
|
||||
public static MobileDevice loadMobileDevices(ResultSet rs) throws SQLException {
|
||||
|
||||
MobileDevice mobileDevice = new MobileDevice();
|
||||
mobileDevice.setMobileDeviceId(rs.getString(WindowsPluginConstants.DEVICE_ID));
|
||||
mobileDevice.setImei(rs.getString(WindowsPluginConstants.IMEI));
|
||||
mobileDevice.setImsi(rs.getString(WindowsPluginConstants.IMSI));
|
||||
mobileDevice.setModel(rs.getString(WindowsPluginConstants.DEVICE_MODEL));
|
||||
mobileDevice.setVendor(rs.getString(WindowsPluginConstants.VENDOR));
|
||||
mobileDevice.setLatitude(rs.getString(WindowsPluginConstants.LATITUDE));
|
||||
mobileDevice.setLongitude(rs.getString(WindowsPluginConstants.LONGITUDE));
|
||||
mobileDevice.setSerial(rs.getString(WindowsPluginConstants.SERIAL));
|
||||
mobileDevice.setOsVersion(rs.getString(WindowsPluginConstants.LATITUDE));
|
||||
return mobileDevice;
|
||||
}
|
||||
|
||||
public static MobileDevice loadMatchingMobileDevices(ResultSet rs) throws SQLException {
|
||||
MobileDevice mobileDevice = new MobileDevice();
|
||||
mobileDevice.setMobileDeviceId(rs.getString(WindowsPluginConstants.DEVICE_ID));
|
||||
mobileDevice.setVendor(rs.getString(WindowsPluginConstants.IMEI));
|
||||
mobileDevice.setLatitude(rs.getString(WindowsPluginConstants.IMSI));
|
||||
mobileDevice.setLongitude(rs.getString(WindowsPluginConstants.OS_VERSION));
|
||||
mobileDevice.setImei(rs.getString(WindowsPluginConstants.DEVICE_MODEL));
|
||||
mobileDevice.setImsi(rs.getString(WindowsPluginConstants.VENDOR));
|
||||
mobileDevice.setOsVersion(rs.getString(WindowsPluginConstants.LATITUDE));
|
||||
return mobileDevice;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user