From b33be7d49d6c06bc8f1068bd6600b674bff470a8 Mon Sep 17 00:00:00 2001 From: harshanl Date: Mon, 2 Nov 2015 14:42:25 +0530 Subject: [PATCH] Fixed EMM-897 issue. --- .../impl/windows/dao/impl/WindowsFeatureDAOImpl.java | 9 ++++----- .../mobile/impl/windows/util/WindowsPluginConstants.java | 2 +- .../src/main/resources/dbscripts/plugins/windows/h2.sql | 4 ++-- .../main/resources/dbscripts/plugins/windows/mysql.sql | 5 ++--- .../main/resources/dbscripts/plugins/windows/oracle.sql | 1 - .../resources/dbscripts/plugins/windows/postgresql.sql | 1 - 6 files changed, 9 insertions(+), 13 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsFeatureDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsFeatureDAOImpl.java index da1bdfa47..c52cf72a8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsFeatureDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/impl/WindowsFeatureDAOImpl.java @@ -61,7 +61,6 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO { stmt.setString(3, mobileFeature.getDescription()); stmt.executeUpdate(); status = true; - status = true; } catch (SQLException e) { throw new WindowsFeatureManagementDAOException( "Error occurred while adding windows feature '" + @@ -135,7 +134,7 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO { Connection conn; try { conn = WindowsDAOFactory.getConnection(); - String sql = "DELETE FROM WIN_FEATURE WHERE FEATURE_ID = ?"; + String sql = "DELETE FROM WIN_FEATURE WHERE ID = ?"; stmt = conn.prepareStatement(sql); stmt.setInt(1, mblFeatureId); stmt.execute(); @@ -179,7 +178,7 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO { Connection conn; try { conn = WindowsDAOFactory.getConnection(); - String sql = "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM WIN_FEATURE WHERE ID = ?"; + String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM WIN_FEATURE WHERE ID = ?"; stmt = conn.prepareStatement(sql); stmt.setInt(1, mblFeatureId); rs = stmt.executeQuery(); @@ -210,7 +209,7 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO { Connection conn; try { conn = WindowsDAOFactory.getConnection(); - String sql = "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM WIN_FEATURE WHERE CODE = ?"; + String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM WIN_FEATURE WHERE CODE = ?"; stmt = conn.prepareStatement(sql); stmt.setString(1, mblFeatureCode); rs = stmt.executeQuery(); @@ -247,7 +246,7 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO { List features = new ArrayList<>(); try { conn = WindowsDAOFactory.getConnection(); - String sql = "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM WIN_FEATURE"; + String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM WIN_FEATURE"; stmt = conn.prepareStatement(sql); rs = stmt.executeQuery(); MobileFeature mobileFeature; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginConstants.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginConstants.java index e13b4642d..edae380d4 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginConstants.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/util/WindowsPluginConstants.java @@ -39,7 +39,7 @@ public class WindowsPluginConstants { public static final String DEVICE_NAME = "DEVICE_NAME"; //Properties related to WIN_FEATURE table - public static final String WINDOWS_FEATURE_ID = "FEATURE_ID"; + public static final String WINDOWS_FEATURE_ID = "ID"; public static final String WINDOWS_FEATURE_CODE = "CODE"; public static final String WINDOWS_FEATURE_NAME = "NAME"; public static final String WINDOWS_FEATURE_DESCRIPTION = "DESCRIPTION"; diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/h2.sql index 3954f3c5e..87f8da20a 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/h2.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/h2.sql @@ -22,9 +22,9 @@ -- Table `WIN_FEATURE` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `WIN_FEATURE` ( - `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 (`FEATURE_ID`) + PRIMARY KEY (`ID`) ); diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mysql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mysql.sql index 347f1ad2e..9ebf6519f 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mysql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/mysql.sql @@ -23,12 +23,11 @@ ENGINE = InnoDB; -- Table `WIN_FEATURE` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `WIN_FEATURE` ( - `FEATURE_ID` INT NOT NULL AUTO_INCREMENT, - `DEVICE_TYPE` VARCHAR(45) NOT NULL, + `ID` INT NOT NULL AUTO_INCREMENT, `CODE` VARCHAR(45) NULL, `NAME` VARCHAR(100) NULL, `DESCRIPTION` VARCHAR(200) NULL, - PRIMARY KEY (`FEATURE_ID`)) + PRIMARY KEY (`ID`)) ENGINE = InnoDB; diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/oracle.sql index 8a96b7947..7fc3f38d4 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/oracle.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/oracle.sql @@ -24,7 +24,6 @@ CREATE TABLE WIN_DEVICE ( -- ----------------------------------------------------- CREATE TABLE WIN_FEATURE ( ID INT NOT NULL, - DEVICE_TYPE VARCHAR(45) NOT NULL, CODE VARCHAR(45) NOT NULL, NAME VARCHAR(100) NOT NULL, DESCRIPTION VARCHAR(200) NULL, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/postgresql.sql index 865f30682..ae9ddb615 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/postgresql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/dbscripts/plugins/windows/postgresql.sql @@ -23,7 +23,6 @@ CREATE TABLE IF NOT EXISTS WIN_DEVICE ( -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS WIN_FEATURE ( ID SERIAL NOT NULL, - DEVICE_TYPE VARCHAR(45) NOT NULL, CODE VARCHAR(45) NULL, NAME VARCHAR(100) NULL, DESCRIPTION VARCHAR(200) NULL,