|
|
@ -22,14 +22,11 @@ import org.apache.commons.logging.Log;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceDAO;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceDAO;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
|
|
|
|
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.dto.MobileDevice;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.AndroidDAOFactory;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.AndroidDAOFactory;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.impl.android.util.AndroidPluginConstants;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.impl.android.util.AndroidPluginConstants;
|
|
|
|
import org.wso2.carbon.device.mgt.mobile.impl.android.util.AndroidUtils;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.sql.DataSource;
|
|
|
|
|
|
|
|
import java.sql.Connection;
|
|
|
|
import java.sql.Connection;
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
import java.sql.PreparedStatement;
|
|
|
|
import java.sql.ResultSet;
|
|
|
|
import java.sql.ResultSet;
|
|
|
@ -47,12 +44,11 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
private static final Log log = LogFactory.getLog(AndroidDeviceDAOImpl.class);
|
|
|
|
private static final Log log = LogFactory.getLog(AndroidDeviceDAOImpl.class);
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public MobileDevice getMobileDevice(String mblDeviceId)
|
|
|
|
public MobileDevice getMobileDevice(String mblDeviceId) throws MobileDeviceManagementDAOException {
|
|
|
|
throws MobileDeviceManagementDAOException {
|
|
|
|
Connection conn;
|
|
|
|
Connection conn = null;
|
|
|
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
MobileDevice mobileDevice = null;
|
|
|
|
MobileDevice mobileDevice = null;
|
|
|
|
ResultSet resultSet = null;
|
|
|
|
ResultSet rs = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
String selectDBQuery =
|
|
|
|
String selectDBQuery =
|
|
|
@ -61,29 +57,25 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
" FROM AD_DEVICE WHERE ANDROID_DEVICE_ID = ?";
|
|
|
|
" FROM AD_DEVICE WHERE ANDROID_DEVICE_ID = ?";
|
|
|
|
stmt = conn.prepareStatement(selectDBQuery);
|
|
|
|
stmt = conn.prepareStatement(selectDBQuery);
|
|
|
|
stmt.setString(1, mblDeviceId);
|
|
|
|
stmt.setString(1, mblDeviceId);
|
|
|
|
resultSet = stmt.executeQuery();
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
|
|
if (resultSet.next()) {
|
|
|
|
if (rs.next()) {
|
|
|
|
mobileDevice = new MobileDevice();
|
|
|
|
mobileDevice = new MobileDevice();
|
|
|
|
mobileDevice.setMobileDeviceId(resultSet.getString(AndroidPluginConstants.
|
|
|
|
mobileDevice.setMobileDeviceId(rs.getString(AndroidPluginConstants.
|
|
|
|
ANDROID_DEVICE_ID));
|
|
|
|
ANDROID_DEVICE_ID));
|
|
|
|
mobileDevice.setModel(resultSet.getString(AndroidPluginConstants.DEVICE_MODEL));
|
|
|
|
mobileDevice.setModel(rs.getString(AndroidPluginConstants.DEVICE_MODEL));
|
|
|
|
mobileDevice.setSerial(resultSet.getString(AndroidPluginConstants.SERIAL));
|
|
|
|
mobileDevice.setSerial(rs.getString(AndroidPluginConstants.SERIAL));
|
|
|
|
mobileDevice.setVendor(resultSet.getString(AndroidPluginConstants.VENDOR));
|
|
|
|
mobileDevice.setVendor(rs.getString(AndroidPluginConstants.VENDOR));
|
|
|
|
mobileDevice.setLatitude(resultSet.getString(AndroidPluginConstants.LATITUDE));
|
|
|
|
mobileDevice.setLatitude(rs.getString(AndroidPluginConstants.LATITUDE));
|
|
|
|
mobileDevice.setLongitude(resultSet.getString(AndroidPluginConstants.LONGITUDE));
|
|
|
|
mobileDevice.setLongitude(rs.getString(AndroidPluginConstants.LONGITUDE));
|
|
|
|
mobileDevice.setImei(resultSet.getString(AndroidPluginConstants.IMEI));
|
|
|
|
mobileDevice.setImei(rs.getString(AndroidPluginConstants.IMEI));
|
|
|
|
mobileDevice.setImsi(resultSet.getString(AndroidPluginConstants.IMSI));
|
|
|
|
mobileDevice.setImsi(rs.getString(AndroidPluginConstants.IMSI));
|
|
|
|
mobileDevice.setOsVersion(resultSet.getString(AndroidPluginConstants.OS_VERSION));
|
|
|
|
mobileDevice.setOsVersion(rs.getString(AndroidPluginConstants.OS_VERSION));
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> propertyMap = new HashMap<String, String>();
|
|
|
|
Map<String, String> propertyMap = new HashMap<String, String>();
|
|
|
|
propertyMap.put(AndroidPluginConstants.GCM_TOKEN,
|
|
|
|
propertyMap.put(AndroidPluginConstants.GCM_TOKEN, rs.getString(AndroidPluginConstants.GCM_TOKEN));
|
|
|
|
resultSet.getString(AndroidPluginConstants.GCM_TOKEN));
|
|
|
|
propertyMap.put(AndroidPluginConstants.DEVICE_INFO, rs.getString(AndroidPluginConstants.DEVICE_INFO));
|
|
|
|
propertyMap.put(AndroidPluginConstants.DEVICE_INFO,
|
|
|
|
propertyMap.put(AndroidPluginConstants.DEVICE_NAME, rs.getString(AndroidPluginConstants.DEVICE_NAME));
|
|
|
|
resultSet.getString(AndroidPluginConstants.DEVICE_INFO));
|
|
|
|
|
|
|
|
propertyMap.put(AndroidPluginConstants.DEVICE_NAME,
|
|
|
|
|
|
|
|
resultSet.getString(AndroidPluginConstants.DEVICE_NAME));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mobileDevice.setDeviceProperties(propertyMap);
|
|
|
|
mobileDevice.setDeviceProperties(propertyMap);
|
|
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
@ -96,7 +88,7 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
log.error(msg, e);
|
|
|
|
log.error(msg, e);
|
|
|
|
throw new MobileDeviceManagementDAOException(msg, e);
|
|
|
|
throw new MobileDeviceManagementDAOException(msg, e);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, resultSet);
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
AndroidDAOFactory.closeConnection();
|
|
|
|
AndroidDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -104,10 +96,9 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean addMobileDevice(MobileDevice mobileDevice)
|
|
|
|
public boolean addMobileDevice(MobileDevice mobileDevice) throws MobileDeviceManagementDAOException {
|
|
|
|
throws MobileDeviceManagementDAOException {
|
|
|
|
|
|
|
|
boolean status = false;
|
|
|
|
boolean status = false;
|
|
|
|
Connection conn = null;
|
|
|
|
Connection conn;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
@ -119,19 +110,13 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
stmt = conn.prepareStatement(createDBQuery);
|
|
|
|
stmt = conn.prepareStatement(createDBQuery);
|
|
|
|
stmt.setString(1, mobileDevice.getMobileDeviceId());
|
|
|
|
stmt.setString(1, mobileDevice.getMobileDeviceId());
|
|
|
|
|
|
|
|
|
|
|
|
if (mobileDevice.getDeviceProperties() == null) {
|
|
|
|
Map<String, String> properties = mobileDevice.getDeviceProperties();
|
|
|
|
mobileDevice.setDeviceProperties(new HashMap<String, String>());
|
|
|
|
stmt.setString(2, properties.get(AndroidPluginConstants.GCM_TOKEN));
|
|
|
|
}
|
|
|
|
stmt.setString(3, properties.get(AndroidPluginConstants.DEVICE_INFO));
|
|
|
|
|
|
|
|
|
|
|
|
stmt.setString(2, AndroidUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
|
|
|
|
|
|
|
AndroidPluginConstants.GCM_TOKEN));
|
|
|
|
|
|
|
|
stmt.setString(3, AndroidUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
|
|
|
|
|
|
|
AndroidPluginConstants.DEVICE_INFO));
|
|
|
|
|
|
|
|
stmt.setString(4, mobileDevice.getSerial());
|
|
|
|
stmt.setString(4, mobileDevice.getSerial());
|
|
|
|
stmt.setString(5, mobileDevice.getVendor());
|
|
|
|
stmt.setString(5, mobileDevice.getVendor());
|
|
|
|
stmt.setString(6, mobileDevice.getMobileDeviceId());
|
|
|
|
stmt.setString(6, mobileDevice.getMobileDeviceId());
|
|
|
|
stmt.setString(7, AndroidUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
|
|
|
stmt.setString(7, properties.get(AndroidPluginConstants.DEVICE_NAME));
|
|
|
|
AndroidPluginConstants.DEVICE_NAME));
|
|
|
|
|
|
|
|
stmt.setString(8, mobileDevice.getLongitude());
|
|
|
|
stmt.setString(8, mobileDevice.getLongitude());
|
|
|
|
stmt.setString(9, mobileDevice.getLongitude());
|
|
|
|
stmt.setString(9, mobileDevice.getLongitude());
|
|
|
|
stmt.setString(10, mobileDevice.getImei());
|
|
|
|
stmt.setString(10, mobileDevice.getImei());
|
|
|
@ -147,10 +132,8 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
String msg = "Error occurred while adding the Android device '" +
|
|
|
|
throw new MobileDeviceManagementDAOException("Error occurred while adding the Android device '" +
|
|
|
|
mobileDevice.getMobileDeviceId() + "' to the Android db.";
|
|
|
|
mobileDevice.getMobileDeviceId() + "' information to the Android plugin data store.", e);
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new MobileDeviceManagementDAOException(msg, e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -158,10 +141,9 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean updateMobileDevice(MobileDevice mobileDevice)
|
|
|
|
public boolean updateMobileDevice(MobileDevice mobileDevice) throws MobileDeviceManagementDAOException {
|
|
|
|
throws MobileDeviceManagementDAOException {
|
|
|
|
|
|
|
|
boolean status = false;
|
|
|
|
boolean status = false;
|
|
|
|
Connection conn = null;
|
|
|
|
Connection conn;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
@ -169,23 +151,15 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
"UPDATE AD_DEVICE SET GCM_TOKEN = ?, DEVICE_INFO = ?, SERIAL = ?, VENDOR = ?, " +
|
|
|
|
"UPDATE AD_DEVICE SET GCM_TOKEN = ?, DEVICE_INFO = ?, SERIAL = ?, VENDOR = ?, " +
|
|
|
|
"MAC_ADDRESS = ?, DEVICE_NAME = ?, LATITUDE = ?, LONGITUDE = ?, IMEI = ?, " +
|
|
|
|
"MAC_ADDRESS = ?, DEVICE_NAME = ?, LATITUDE = ?, LONGITUDE = ?, IMEI = ?, " +
|
|
|
|
"IMSI = ?, OS_VERSION = ?, DEVICE_MODEL = ? WHERE ANDROID_DEVICE_ID = ?";
|
|
|
|
"IMSI = ?, OS_VERSION = ?, DEVICE_MODEL = ? WHERE ANDROID_DEVICE_ID = ?";
|
|
|
|
|
|
|
|
|
|
|
|
stmt = conn.prepareStatement(updateDBQuery);
|
|
|
|
stmt = conn.prepareStatement(updateDBQuery);
|
|
|
|
|
|
|
|
|
|
|
|
if (mobileDevice.getDeviceProperties() == null) {
|
|
|
|
Map<String, String> properties = mobileDevice.getDeviceProperties();
|
|
|
|
mobileDevice.setDeviceProperties(new HashMap<String, String>());
|
|
|
|
stmt.setString(1, properties.get(AndroidPluginConstants.GCM_TOKEN));
|
|
|
|
}
|
|
|
|
stmt.setString(2, properties.get(AndroidPluginConstants.DEVICE_INFO));
|
|
|
|
|
|
|
|
|
|
|
|
stmt.setString(1, AndroidUtils.getDeviceProperty(
|
|
|
|
|
|
|
|
mobileDevice.getDeviceProperties(),
|
|
|
|
|
|
|
|
AndroidPluginConstants.GCM_TOKEN));
|
|
|
|
|
|
|
|
stmt.setString(2, AndroidUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
|
|
|
|
|
|
|
AndroidPluginConstants.DEVICE_INFO));
|
|
|
|
|
|
|
|
stmt.setString(3, mobileDevice.getSerial());
|
|
|
|
stmt.setString(3, mobileDevice.getSerial());
|
|
|
|
stmt.setString(4, mobileDevice.getVendor());
|
|
|
|
stmt.setString(4, mobileDevice.getVendor());
|
|
|
|
stmt.setString(5, mobileDevice.getMobileDeviceId());
|
|
|
|
stmt.setString(5, mobileDevice.getMobileDeviceId());
|
|
|
|
stmt.setString(6, AndroidUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
|
|
|
stmt.setString(6, properties.get(AndroidPluginConstants.DEVICE_NAME));
|
|
|
|
AndroidPluginConstants.DEVICE_NAME));
|
|
|
|
|
|
|
|
stmt.setString(7, mobileDevice.getLatitude());
|
|
|
|
stmt.setString(7, mobileDevice.getLatitude());
|
|
|
|
stmt.setString(8, mobileDevice.getLongitude());
|
|
|
|
stmt.setString(8, mobileDevice.getLongitude());
|
|
|
|
stmt.setString(9, mobileDevice.getImei());
|
|
|
|
stmt.setString(9, mobileDevice.getImei());
|
|
|
@ -216,7 +190,7 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
public boolean deleteMobileDevice(String mblDeviceId)
|
|
|
|
public boolean deleteMobileDevice(String mblDeviceId)
|
|
|
|
throws MobileDeviceManagementDAOException {
|
|
|
|
throws MobileDeviceManagementDAOException {
|
|
|
|
boolean status = false;
|
|
|
|
boolean status = false;
|
|
|
|
Connection conn = null;
|
|
|
|
Connection conn;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
@ -233,9 +207,8 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
String msg = "Error occurred while deleting android device " + mblDeviceId;
|
|
|
|
throw new MobileDeviceManagementDAOException("Error occurred while deleting android device '" +
|
|
|
|
log.error(msg, e);
|
|
|
|
mblDeviceId + "'", e);
|
|
|
|
throw new MobileDeviceManagementDAOException(msg, e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -243,15 +216,12 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<MobileDevice> getAllMobileDevices()
|
|
|
|
public List<MobileDevice> getAllMobileDevices() throws MobileDeviceManagementDAOException {
|
|
|
|
throws MobileDeviceManagementDAOException {
|
|
|
|
Connection conn;
|
|
|
|
|
|
|
|
|
|
|
|
Connection conn = null;
|
|
|
|
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
PreparedStatement stmt = null;
|
|
|
|
ResultSet resultSet = null;
|
|
|
|
ResultSet rs = null;
|
|
|
|
MobileDevice mobileDevice;
|
|
|
|
MobileDevice mobileDevice;
|
|
|
|
List<MobileDevice> mobileDevices = new ArrayList<MobileDevice>();
|
|
|
|
List<MobileDevice> mobileDevices = new ArrayList<MobileDevice>();
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
conn = AndroidDAOFactory.getConnection();
|
|
|
|
String selectDBQuery =
|
|
|
|
String selectDBQuery =
|
|
|
@ -259,29 +229,27 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
"VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION " +
|
|
|
|
"VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION " +
|
|
|
|
"FROM AD_DEVICE";
|
|
|
|
"FROM AD_DEVICE";
|
|
|
|
stmt = conn.prepareStatement(selectDBQuery);
|
|
|
|
stmt = conn.prepareStatement(selectDBQuery);
|
|
|
|
resultSet = stmt.executeQuery();
|
|
|
|
rs = stmt.executeQuery();
|
|
|
|
while (resultSet.next()) {
|
|
|
|
|
|
|
|
|
|
|
|
while (rs.next()) {
|
|
|
|
mobileDevice = new MobileDevice();
|
|
|
|
mobileDevice = new MobileDevice();
|
|
|
|
mobileDevice.setMobileDeviceId(resultSet.getString(AndroidPluginConstants.
|
|
|
|
mobileDevice.setMobileDeviceId(rs.getString(AndroidPluginConstants.
|
|
|
|
ANDROID_DEVICE_ID));
|
|
|
|
ANDROID_DEVICE_ID));
|
|
|
|
mobileDevice.setModel(resultSet.getString(AndroidPluginConstants.DEVICE_MODEL));
|
|
|
|
mobileDevice.setModel(rs.getString(AndroidPluginConstants.DEVICE_MODEL));
|
|
|
|
mobileDevice.setSerial(resultSet.getString(AndroidPluginConstants.SERIAL));
|
|
|
|
mobileDevice.setSerial(rs.getString(AndroidPluginConstants.SERIAL));
|
|
|
|
mobileDevice.setVendor(resultSet.getString(AndroidPluginConstants.VENDOR));
|
|
|
|
mobileDevice.setVendor(rs.getString(AndroidPluginConstants.VENDOR));
|
|
|
|
mobileDevice.setLatitude(resultSet.getString(AndroidPluginConstants.LATITUDE));
|
|
|
|
mobileDevice.setLatitude(rs.getString(AndroidPluginConstants.LATITUDE));
|
|
|
|
mobileDevice.setLongitude(resultSet.getString(AndroidPluginConstants.LONGITUDE));
|
|
|
|
mobileDevice.setLongitude(rs.getString(AndroidPluginConstants.LONGITUDE));
|
|
|
|
mobileDevice.setImei(resultSet.getString(AndroidPluginConstants.IMEI));
|
|
|
|
mobileDevice.setImei(rs.getString(AndroidPluginConstants.IMEI));
|
|
|
|
mobileDevice.setImsi(resultSet.getString(AndroidPluginConstants.IMSI));
|
|
|
|
mobileDevice.setImsi(rs.getString(AndroidPluginConstants.IMSI));
|
|
|
|
mobileDevice.setOsVersion(resultSet.getString(AndroidPluginConstants.OS_VERSION));
|
|
|
|
mobileDevice.setOsVersion(rs.getString(AndroidPluginConstants.OS_VERSION));
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> propertyMap = new HashMap<String, String>();
|
|
|
|
Map<String, String> propertyMap = new HashMap<String, String>();
|
|
|
|
propertyMap.put(AndroidPluginConstants.GCM_TOKEN,
|
|
|
|
propertyMap.put(AndroidPluginConstants.GCM_TOKEN, rs.getString(AndroidPluginConstants.GCM_TOKEN));
|
|
|
|
resultSet.getString(AndroidPluginConstants.GCM_TOKEN));
|
|
|
|
propertyMap.put(AndroidPluginConstants.DEVICE_INFO, rs.getString(AndroidPluginConstants.DEVICE_INFO));
|
|
|
|
propertyMap.put(AndroidPluginConstants.DEVICE_INFO,
|
|
|
|
propertyMap.put(AndroidPluginConstants.DEVICE_NAME, rs.getString(AndroidPluginConstants.DEVICE_NAME));
|
|
|
|
resultSet.getString(AndroidPluginConstants.DEVICE_INFO));
|
|
|
|
|
|
|
|
propertyMap.put(AndroidPluginConstants.DEVICE_NAME,
|
|
|
|
|
|
|
|
resultSet.getString(AndroidPluginConstants.DEVICE_NAME));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mobileDevice.setDeviceProperties(propertyMap);
|
|
|
|
mobileDevice.setDeviceProperties(propertyMap);
|
|
|
|
|
|
|
|
|
|
|
|
mobileDevices.add(mobileDevice);
|
|
|
|
mobileDevices.add(mobileDevice);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
@ -289,11 +257,9 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return mobileDevices;
|
|
|
|
return mobileDevices;
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
|
String msg = "Error occurred while fetching all Android device data'";
|
|
|
|
throw new MobileDeviceManagementDAOException("Error occurred while fetching all Android device data", e);
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new MobileDeviceManagementDAOException(msg, e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, resultSet);
|
|
|
|
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
|
|
|
AndroidDAOFactory.closeConnection();
|
|
|
|
AndroidDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|