|
|
@ -58,16 +58,17 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = this.getConnection();
|
|
|
|
conn = this.getConnection();
|
|
|
|
String selectDBQuery =
|
|
|
|
String selectDBQuery =
|
|
|
|
"SELECT ANDROID_DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, VENDOR, MAC_ADDRESS, " +
|
|
|
|
"SELECT ANDROID_DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, " +
|
|
|
|
"DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION FROM AD_DEVICE WHERE" +
|
|
|
|
"VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION" +
|
|
|
|
" 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 resultSet = stmt.executeQuery();
|
|
|
|
ResultSet resultSet = stmt.executeQuery();
|
|
|
|
|
|
|
|
|
|
|
|
if (resultSet.next()) {
|
|
|
|
if (resultSet.next()) {
|
|
|
|
mobileDevice = new MobileDevice();
|
|
|
|
mobileDevice = new MobileDevice();
|
|
|
|
mobileDevice.setMobileDeviceId(resultSet.getString(AndroidPluginConstants.ANDROID_DEVICE_ID));
|
|
|
|
mobileDevice.setMobileDeviceId(resultSet.getString(AndroidPluginConstants.
|
|
|
|
|
|
|
|
ANDROID_DEVICE_ID));
|
|
|
|
mobileDevice.setModel(resultSet.getString(AndroidPluginConstants.DEVICE_MODEL));
|
|
|
|
mobileDevice.setModel(resultSet.getString(AndroidPluginConstants.DEVICE_MODEL));
|
|
|
|
mobileDevice.setSerial(resultSet.getString(AndroidPluginConstants.SERIAL));
|
|
|
|
mobileDevice.setSerial(resultSet.getString(AndroidPluginConstants.SERIAL));
|
|
|
|
mobileDevice.setVendor(resultSet.getString(AndroidPluginConstants.VENDOR));
|
|
|
|
mobileDevice.setVendor(resultSet.getString(AndroidPluginConstants.VENDOR));
|
|
|
@ -88,7 +89,8 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
mobileDevice.setDeviceProperties(propertyMap);
|
|
|
|
mobileDevice.setDeviceProperties(propertyMap);
|
|
|
|
|
|
|
|
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
log.debug("Android device " + mblDeviceId + " data has been fetched from Android database.");
|
|
|
|
log.debug("Android device " + mblDeviceId + " data has been fetched from " +
|
|
|
|
|
|
|
|
"Android database.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
@ -112,8 +114,8 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
conn = this.getConnection();
|
|
|
|
conn = this.getConnection();
|
|
|
|
String createDBQuery =
|
|
|
|
String createDBQuery =
|
|
|
|
"INSERT INTO AD_DEVICE(ANDROID_DEVICE_ID, GCM_TOKEN, DEVICE_INFO, SERIAL, " +
|
|
|
|
"INSERT INTO AD_DEVICE(ANDROID_DEVICE_ID, GCM_TOKEN, DEVICE_INFO, SERIAL, " +
|
|
|
|
"VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION, DEVICE_MODEL)" +
|
|
|
|
"VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, " +
|
|
|
|
" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
|
|
"OS_VERSION, DEVICE_MODEL) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
|
|
|
|
|
|
|
|
|
|
stmt = conn.prepareStatement(createDBQuery);
|
|
|
|
stmt = conn.prepareStatement(createDBQuery);
|
|
|
|
stmt.setString(1, mobileDevice.getMobileDeviceId());
|
|
|
|
stmt.setString(1, mobileDevice.getMobileDeviceId());
|
|
|
@ -142,8 +144,8 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
if (rows > 0) {
|
|
|
|
if (rows > 0) {
|
|
|
|
status = true;
|
|
|
|
status = true;
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
if (log.isDebugEnabled()) {
|
|
|
|
log.debug("Android device " + mobileDevice.getMobileDeviceId() + " data has been added" +
|
|
|
|
log.debug("Android device " + mobileDevice.getMobileDeviceId() + " data has been" +
|
|
|
|
" to the Android database.");
|
|
|
|
" added to the Android database.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (SQLException e) {
|
|
|
|
} catch (SQLException e) {
|
|
|
@ -166,9 +168,9 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = this.getConnection();
|
|
|
|
conn = this.getConnection();
|
|
|
|
String updateDBQuery =
|
|
|
|
String updateDBQuery =
|
|
|
|
"UPDATE AD_DEVICE SET GCM_TOKEN = ?, DEVICE_INFO = ?, SERIAL = ?, VENDOR = ?, MAC_ADDRESS = ?, " +
|
|
|
|
"UPDATE AD_DEVICE SET GCM_TOKEN = ?, DEVICE_INFO = ?, SERIAL = ?, VENDOR = ?, " +
|
|
|
|
"DEVICE_NAME = ?, LATITUDE = ?, LONGITUDE = ?, IMEI = ?, IMSI = ?, OS_VERSION = ?, DEVICE_MODEL = ? " +
|
|
|
|
"MAC_ADDRESS = ?, DEVICE_NAME = ?, LATITUDE = ?, LONGITUDE = ?, IMEI = ?, " +
|
|
|
|
"WHERE ANDROID_DEVICE_ID = ?";
|
|
|
|
"IMSI = ?, OS_VERSION = ?, DEVICE_MODEL = ? WHERE ANDROID_DEVICE_ID = ?";
|
|
|
|
|
|
|
|
|
|
|
|
stmt = conn.prepareStatement(updateDBQuery);
|
|
|
|
stmt = conn.prepareStatement(updateDBQuery);
|
|
|
|
|
|
|
|
|
|
|
@ -252,13 +254,15 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
conn = this.getConnection();
|
|
|
|
conn = this.getConnection();
|
|
|
|
String selectDBQuery =
|
|
|
|
String selectDBQuery =
|
|
|
|
"SELECT ANDROID_DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, VENDOR, " +
|
|
|
|
"SELECT ANDROID_DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, " +
|
|
|
|
"MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, 0S_VERSION FROM AD_DEVICE";
|
|
|
|
"VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION " +
|
|
|
|
|
|
|
|
"FROM AD_DEVICE";
|
|
|
|
stmt = conn.prepareStatement(selectDBQuery);
|
|
|
|
stmt = conn.prepareStatement(selectDBQuery);
|
|
|
|
ResultSet resultSet = stmt.executeQuery();
|
|
|
|
ResultSet resultSet = stmt.executeQuery();
|
|
|
|
while (resultSet.next()) {
|
|
|
|
while (resultSet.next()) {
|
|
|
|
mobileDevice = new MobileDevice();
|
|
|
|
mobileDevice = new MobileDevice();
|
|
|
|
mobileDevice.setMobileDeviceId(resultSet.getString(AndroidPluginConstants.ANDROID_DEVICE_ID));
|
|
|
|
mobileDevice.setMobileDeviceId(resultSet.getString(AndroidPluginConstants.
|
|
|
|
|
|
|
|
ANDROID_DEVICE_ID));
|
|
|
|
mobileDevice.setModel(resultSet.getString(AndroidPluginConstants.DEVICE_MODEL));
|
|
|
|
mobileDevice.setModel(resultSet.getString(AndroidPluginConstants.DEVICE_MODEL));
|
|
|
|
mobileDevice.setSerial(resultSet.getString(AndroidPluginConstants.SERIAL));
|
|
|
|
mobileDevice.setSerial(resultSet.getString(AndroidPluginConstants.SERIAL));
|
|
|
|
mobileDevice.setVendor(resultSet.getString(AndroidPluginConstants.VENDOR));
|
|
|
|
mobileDevice.setVendor(resultSet.getString(AndroidPluginConstants.VENDOR));
|
|
|
|