Fixed AndroidDAO layer to insert DEVICE_MODEL

revert-dabc3590
harshanL 10 years ago
parent a6a1f1aaf3
commit 8f631ce92e

@ -58,7 +58,7 @@ 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, SERIAL, VENDOR, MAC_ADDRESS, " + "SELECT ANDROID_DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, VENDOR, MAC_ADDRESS, " +
"DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, 0S_VERSION FROM AD_DEVICE WHERE" + "DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, 0S_VERSION FROM AD_DEVICE WHERE" +
" ANDROID_DEVICE_ID = ?"; " ANDROID_DEVICE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
@ -74,6 +74,8 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
resultSet.getString(AndroidPluginConstants.GCM_TOKEN)); resultSet.getString(AndroidPluginConstants.GCM_TOKEN));
propertyMap.put(AndroidPluginConstants.DEVICE_INFO, propertyMap.put(AndroidPluginConstants.DEVICE_INFO,
resultSet.getString(AndroidPluginConstants.DEVICE_INFO)); resultSet.getString(AndroidPluginConstants.DEVICE_INFO));
propertyMap.put(AndroidPluginConstants.DEVICE_MODEL,
resultSet.getString(AndroidPluginConstants.DEVICE_MODEL));
propertyMap.put(AndroidPluginConstants.SERIAL, propertyMap.put(AndroidPluginConstants.SERIAL,
resultSet.getString(AndroidPluginConstants.SERIAL)); resultSet.getString(AndroidPluginConstants.SERIAL));
propertyMap.put(AndroidPluginConstants.VENDOR, propertyMap.put(AndroidPluginConstants.VENDOR,
@ -120,8 +122,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)" + "VENDOR, MAC_ADDRESS, DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, OS_VERSION, DEVICE_MODEL)" +
" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery); stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, mobileDevice.getMobileDeviceId()); stmt.setString(1, mobileDevice.getMobileDeviceId());
@ -153,6 +155,8 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
AndroidPluginConstants.IMSI)); AndroidPluginConstants.IMSI));
stmt.setString(12, AndroidUtils.getDeviceProperty(mobileDevice.getDeviceProperties(), stmt.setString(12, AndroidUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
AndroidPluginConstants.OS_VERSION)); AndroidPluginConstants.OS_VERSION));
stmt.setString(13, AndroidUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
AndroidPluginConstants.DEVICE_MODEL));
int rows = stmt.executeUpdate(); int rows = stmt.executeUpdate();
if (rows > 0) { if (rows > 0) {
status = true; status = true;
@ -182,7 +186,7 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
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 = ?, MAC_ADDRESS = ?, " +
"DEVICE_NAME = ?, LATITUDE = ?, LONGITUDE = ?, IMEI = ?, IMSI = ?, OS_VERSION = ? " + "DEVICE_NAME = ?, LATITUDE = ?, LONGITUDE = ?, IMEI = ?, IMSI = ?, OS_VERSION = ?, DEVICE_MODEL = ? " +
"WHERE ANDROID_DEVICE_ID = ?"; "WHERE ANDROID_DEVICE_ID = ?";
stmt = conn.prepareStatement(updateDBQuery); stmt = conn.prepareStatement(updateDBQuery);
@ -214,7 +218,9 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
AndroidPluginConstants.IMSI)); AndroidPluginConstants.IMSI));
stmt.setString(11, AndroidUtils.getDeviceProperty(mobileDevice.getDeviceProperties(), stmt.setString(11, AndroidUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
AndroidPluginConstants.OS_VERSION)); AndroidPluginConstants.OS_VERSION));
stmt.setString(12, mobileDevice.getMobileDeviceId()); stmt.setString(12, AndroidUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
AndroidPluginConstants.DEVICE_MODEL));
stmt.setString(13, mobileDevice.getMobileDeviceId());
int rows = stmt.executeUpdate(); int rows = stmt.executeUpdate();
if (rows > 0) { if (rows > 0) {
status = true; status = true;
@ -274,7 +280,7 @@ 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, SERIAL, VENDOR, MAC_ADDRESS," + "SELECT ANDROID_DEVICE_ID, GCM_TOKEN, DEVICE_INFO, DEVICE_MODEL, SERIAL, VENDOR, MAC_ADDRESS," +
"DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, 0S_VERSION FROM AD_DEVICE"; "DEVICE_NAME, LATITUDE, LONGITUDE, IMEI, IMSI, 0S_VERSION FROM AD_DEVICE";
stmt = conn.prepareStatement(selectDBQuery); stmt = conn.prepareStatement(selectDBQuery);
ResultSet resultSet = stmt.executeQuery(); ResultSet resultSet = stmt.executeQuery();
@ -289,6 +295,8 @@ public class AndroidDeviceDAOImpl implements MobileDeviceDAO{
resultSet.getString(AndroidPluginConstants.GCM_TOKEN)); resultSet.getString(AndroidPluginConstants.GCM_TOKEN));
propertyMap.put(AndroidPluginConstants.DEVICE_INFO, propertyMap.put(AndroidPluginConstants.DEVICE_INFO,
resultSet.getString(AndroidPluginConstants.DEVICE_INFO)); resultSet.getString(AndroidPluginConstants.DEVICE_INFO));
propertyMap.put(AndroidPluginConstants.DEVICE_MODEL,
resultSet.getString(AndroidPluginConstants.DEVICE_MODEL));
propertyMap.put(AndroidPluginConstants.SERIAL, propertyMap.put(AndroidPluginConstants.SERIAL,
resultSet.getString(AndroidPluginConstants.SERIAL)); resultSet.getString(AndroidPluginConstants.SERIAL));
propertyMap.put(AndroidPluginConstants.VENDOR, propertyMap.put(AndroidPluginConstants.VENDOR,

@ -5,6 +5,7 @@
CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( CREATE TABLE IF NOT EXISTS `AD_DEVICE` (
`ANDROID_DEVICE_ID` VARCHAR(45) NOT NULL , `ANDROID_DEVICE_ID` VARCHAR(45) NOT NULL ,
`GCM_TOKEN` VARCHAR(45) NULL DEFAULT NULL , `GCM_TOKEN` VARCHAR(45) NULL DEFAULT NULL ,
`DEVICE_INFO` VARCHAR(100) NULL DEFAULT NULL ,
`IMEI` VARCHAR(45) NULL DEFAULT NULL , `IMEI` VARCHAR(45) NULL DEFAULT NULL ,
`IMSI` VARCHAR(45) NULL DEFAULT NULL , `IMSI` VARCHAR(45) NULL DEFAULT NULL ,
`OS_VERSION` VARCHAR(45) NULL DEFAULT NULL , `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL ,

Loading…
Cancel
Save