From 243536fb7e6f8ab7ccfd9af65da18075038f83ad Mon Sep 17 00:00:00 2001 From: Kasun Delgolla Date: Wed, 9 Sep 2015 17:13:54 +0530 Subject: [PATCH 1/3] Changing the char length of GCM_TOKEN DB column. --- .../src/main/resources/dbscripts/plugins/h2_android.sql | 2 +- .../src/main/resources/dbscripts/plugins/mysql_android.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_android.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_android.sql index c6ae33335..f7b2d1818 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_android.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_android.sql @@ -4,7 +4,7 @@ -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( `ANDROID_DEVICE_ID` VARCHAR(45) NOT NULL , - `GCM_TOKEN` VARCHAR(45) NULL DEFAULT NULL , + `GCM_TOKEN` VARCHAR(1000) NULL DEFAULT NULL , `DEVICE_INFO` VARCHAR(8000) NULL DEFAULT NULL , `IMEI` VARCHAR(45) NULL DEFAULT NULL , `IMSI` VARCHAR(45) NULL DEFAULT NULL , diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_android.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_android.sql index dff474071..ae1211862 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_android.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_android.sql @@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( `ANDROID_DEVICE_ID` VARCHAR(45) NOT NULL , `DEVICE_INFO` VARCHAR(500) NULL DEFAULT NULL , - `GCM_TOKEN` VARCHAR(45) NULL DEFAULT NULL , + `GCM_TOKEN` VARCHAR(1000) NULL DEFAULT NULL , `IMEI` VARCHAR(45) NULL DEFAULT NULL , `IMSI` VARCHAR(45) NULL DEFAULT NULL , `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL , From 17ad655f7dd43d361624d48e6738a4dcc310a265 Mon Sep 17 00:00:00 2001 From: mharindu Date: Wed, 9 Sep 2015 19:36:20 +0530 Subject: [PATCH 2/3] Fixing issues of previous PRs --- .../impl/android/AndroidDeviceManager.java | 11 ++++---- .../dbscripts/plugins/h2_android.sql | 26 +++++++++---------- .../dbscripts/plugins/h2_windows.sql | 14 +++++----- .../dbscripts/plugins/mysql_android.sql | 20 +++++++------- .../dbscripts/plugins/mysql_windows.sql | 2 +- 5 files changed, 36 insertions(+), 37 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java index 5db5baa8b..a176e23f1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java @@ -118,8 +118,8 @@ public class AndroidDeviceManager implements DeviceManager { JAXBContext context = JAXBContext.newInstance(TenantConfiguration.class); Unmarshaller unmarshaller = context.createUnmarshaller(); return (TenantConfiguration) unmarshaller.unmarshal( - new StringReader(new String((byte[]) resource.getContent(), Charset - .forName(MobilePluginConstants.CHARSET_UTF8)))); + new StringReader(new String((byte[]) resource.getContent(), Charset. + forName(MobilePluginConstants.CHARSET_UTF8)))); } return new TenantConfiguration(); } catch (MobileDeviceMgtPluginException e) { @@ -288,8 +288,8 @@ public class AndroidDeviceManager implements DeviceManager { @Override public License getLicense(String languageCode) throws LicenseManagementException { - return licenseManager - .getLicense(AndroidDeviceManagementService.DEVICE_TYPE_ANDROID, languageCode); + return licenseManager. + getLicense(AndroidDeviceManagementService.DEVICE_TYPE_ANDROID, languageCode); } @Override @@ -320,8 +320,7 @@ public class AndroidDeviceManager implements DeviceManager { "updating the details of Android device : " + device.getDeviceIdentifier()); } AndroidDAOFactory.beginTransaction(); - status = daoFactory.getMobileDeviceDAO() - .updateMobileDevice(existingMobileDevice); + status = daoFactory.getMobileDeviceDAO().updateMobileDevice(existingMobileDevice); AndroidDAOFactory.commitTransaction(); } catch (MobileDeviceManagementDAOException e) { try { diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_android.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_android.sql index c6ae33335..3cef91277 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_android.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_android.sql @@ -3,30 +3,30 @@ -- Table `AD_DEVICE` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( - `ANDROID_DEVICE_ID` VARCHAR(45) NOT NULL , - `GCM_TOKEN` VARCHAR(45) NULL DEFAULT NULL , - `DEVICE_INFO` VARCHAR(8000) NULL DEFAULT NULL , - `IMEI` VARCHAR(45) NULL DEFAULT NULL , - `IMSI` VARCHAR(45) NULL DEFAULT NULL , - `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL , - `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL , - `VENDOR` VARCHAR(45) NULL DEFAULT NULL , + `ANDROID_DEVICE_ID` VARCHAR(45) NOT NULL, + `GCM_TOKEN` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_INFO` VARCHAR(8000) NULL DEFAULT NULL, + `IMEI` VARCHAR(45) NULL DEFAULT NULL, + `IMSI` VARCHAR(45) NULL DEFAULT NULL, + `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL, + `VENDOR` VARCHAR(45) NULL DEFAULT NULL, `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, `SERIAL` VARCHAR(45) NULL DEFAULT NULL, `MAC_ADDRESS` VARCHAR(45) NULL DEFAULT NULL, `DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL, - PRIMARY KEY (`ANDROID_DEVICE_ID`) ); + PRIMARY KEY (`ANDROID_DEVICE_ID`)); -- ----------------------------------------------------- -- Table `AD_FEATURE` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `AD_FEATURE` ( - `ID` INT NOT NULL AUTO_INCREMENT , + `ID` INT NOT NULL AUTO_INCREMENT, `CODE` VARCHAR(45) NOT NULL, - `NAME` VARCHAR(100) NULL , - `DESCRIPTION` VARCHAR(200) NULL , - PRIMARY KEY (`ID`) ); + `NAME` VARCHAR(100) NULL, + `DESCRIPTION` VARCHAR(200) NULL, + PRIMARY KEY (`ID`)); -- ----------------------------------------------------- diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_windows.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_windows.sql index 4268b0731..638f3bf67 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_windows.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/h2_windows.sql @@ -6,7 +6,7 @@ CREATE TABLE IF NOT EXISTS `WINDOWS_FEATURE` ( `CODE` VARCHAR(45) NOT NULL, `NAME` VARCHAR(100) NULL, `DESCRIPTION` VARCHAR(200) NULL, - PRIMARY KEY (`FEATURE_ID`) ); + PRIMARY KEY (`FEATURE_ID`)); -- ----------------------------------------------------- @@ -16,12 +16,12 @@ CREATE TABLE IF NOT EXISTS `WINDOWS_FEATURE` ( CREATE TABLE IF NOT EXISTS `WINDOWS_DEVICE` ( `MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL, `CHANNEL_URI` VARCHAR(100) NULL DEFAULT NULL, - `DEVICE_INFO` VARCHAR(8000) NULL DEFAULT NULL , - `IMEI` VARCHAR(45) NULL DEFAULT NULL , - `IMSI` VARCHAR(45) NULL DEFAULT NULL , - `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL , - `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL , - `VENDOR` VARCHAR(45) NULL DEFAULT NULL , + `DEVICE_INFO` VARCHAR(8000) NULL DEFAULT NULL, + `IMEI` VARCHAR(45) NULL DEFAULT NULL, + `IMSI` VARCHAR(45) NULL DEFAULT NULL, + `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL, + `VENDOR` VARCHAR(45) NULL DEFAULT NULL, `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, `SERIAL` VARCHAR(45) NULL DEFAULT NULL, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_android.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_android.sql index dff474071..2c5ed863c 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_android.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_android.sql @@ -3,13 +3,13 @@ -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `AD_DEVICE` ( `ANDROID_DEVICE_ID` VARCHAR(45) NOT NULL , - `DEVICE_INFO` VARCHAR(500) NULL DEFAULT NULL , - `GCM_TOKEN` VARCHAR(45) NULL DEFAULT NULL , - `IMEI` VARCHAR(45) NULL DEFAULT NULL , - `IMSI` VARCHAR(45) NULL DEFAULT NULL , - `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL , - `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL , - `VENDOR` VARCHAR(45) NULL DEFAULT NULL , + `DEVICE_INFO` VARCHAR(500) NULL DEFAULT NULL, + `GCM_TOKEN` VARCHAR(45) NULL DEFAULT NULL, + `IMEI` VARCHAR(45) NULL DEFAULT NULL, + `IMSI` VARCHAR(45) NULL DEFAULT NULL, + `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL, + `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL, + `VENDOR` VARCHAR(45) NULL DEFAULT NULL, `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, `SERIAL` VARCHAR(45) NULL DEFAULT NULL, @@ -23,10 +23,10 @@ ENGINE = InnoDB; -- Table `MBL_FEATURE` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `AD_FEATURE` ( - `ID` INT NOT NULL AUTO_INCREMENT , + `ID` INT NOT NULL AUTO_INCREMENT, `CODE` VARCHAR(45) NOT NULL, - `NAME` VARCHAR(100) NULL , - `DESCRIPTION` VARCHAR(200) NULL , + `NAME` VARCHAR(100) NULL, + `DESCRIPTION` VARCHAR(200) NULL, PRIMARY KEY (`ID`)) ENGINE = InnoDB; diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_windows.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_windows.sql index e69dc48ad..dfabdc009 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_windows.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/mysql_windows.sql @@ -24,7 +24,7 @@ ENGINE = InnoDB; -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `MBL_FEATURE` ( `FEATURE_ID` INT NOT NULL AUTO_INCREMENT, - `DEVICE_TYPE` VARCHAR(45) NOT NULL , + `DEVICE_TYPE` VARCHAR(45) NOT NULL, `CODE` VARCHAR(45) NULL, `NAME` VARCHAR(100) NULL, `DESCRIPTION` VARCHAR(200) NULL, From be6b6039fa1562cced959cf7573c366ae480c138 Mon Sep 17 00:00:00 2001 From: mharindu Date: Wed, 9 Sep 2015 20:14:56 +0530 Subject: [PATCH 3/3] Removed unnecessary newlines --- .../device/mgt/mobile/impl/android/util/AndroidUtils.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidUtils.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidUtils.java index d17768099..48753ed4c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidUtils.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/util/AndroidUtils.java @@ -26,8 +26,6 @@ import java.util.Map; public class AndroidUtils { public static String getDeviceProperty(Map deviceProperties, String property) { - - String deviceProperty = deviceProperties.get(property); - return deviceProperty; + return deviceProperties.get(property); } }