From 1abb674b7ef2f289dfa953901397e122fc9dff36 Mon Sep 17 00:00:00 2001 From: hasuniea Date: Fri, 23 Oct 2015 14:49:01 +0530 Subject: [PATCH] refactored WindowsFeatureImpl --- .../mgt/mobile/impl/windows/dao/WindowsDAOFactory.java | 3 ++- .../impl/windows/dao/impl/WindowsFeatureDAOImpl.java | 8 ++++---- .../src/main/resources/dbscripts/plugins/h2_windows.sql | 5 ++++- pom.xml | 2 +- 4 files changed, 11 insertions(+), 7 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/WindowsDAOFactory.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/WindowsDAOFactory.java index 3c1ba0424..170023c69 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/WindowsDAOFactory.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/dao/WindowsDAOFactory.java @@ -23,6 +23,7 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import org.wso2.carbon.device.mgt.mobile.dao.*; import org.wso2.carbon.device.mgt.mobile.impl.windows.dao.impl.WindowsDeviceDAOImpl; +import org.wso2.carbon.device.mgt.mobile.impl.windows.dao.impl.WindowsFeatureDAOImpl; import javax.sql.DataSource; import java.sql.Connection; @@ -61,7 +62,7 @@ public class WindowsDAOFactory extends MobileDeviceManagementDAOFactory @Override public MobileFeatureDAO getMobileFeatureDao() { - return null; + return new WindowsFeatureDAOImpl(); } @Override 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 e69e20997..a8c110942 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 @@ -187,7 +187,7 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO { public MobileFeature getFeatureByCode(String mblFeatureCode) throws MobileDeviceManagementDAOException { PreparedStatement stmt = null; ResultSet rs = null; - Connection conn = null; + Connection conn; try { conn = WindowsDAOFactory.getConnection(); @@ -226,15 +226,15 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO { public List getAllFeatures() throws MobileDeviceManagementDAOException { PreparedStatement stmt = null; ResultSet rs = null; - Connection conn = null; - List features = new ArrayList(); + Connection conn; + List features = new ArrayList<>(); try { conn = WindowsDAOFactory.getConnection(); String sql = "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM WINDOWS_FEATURE"; stmt = conn.prepareStatement(sql); rs = stmt.executeQuery(); - MobileFeature mobileFeature = null; + MobileFeature mobileFeature; while (rs.next()) { mobileFeature = new MobileFeature(); 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 638f3bf67..041cffa7f 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 @@ -40,6 +40,9 @@ VALUES 
('INSTALL_STORE_APPLICATION', 'Install Public App', 'Install Public App'), 
 ('REMOVE_APPLICATION', 'Uninstall App', 'Uninstall App'), 
('DEVICE_LOCK', 'Device Lock', 'Device Lock'), +('DEVICE_RING', 'Ring', 'Ring the device'), +('DISENROLL', 'DisEnroll', 'DisEnroll the device'), +('LOCKRESET', 'LockReset', 'Lock Reset device'), 
('CELLULAR', 'Cellular', 'Cellular'), 
('APN', 'APN', 'APN'), 
('RESTRICTION', 'Restrictions', 'Restrictions operation'), @@ -61,5 +64,5 @@ VALUES ('VPN', 'VPN', 'VPN operation'), ('PER_APP_VPN', 'Per App VPN', 'Per app VPN operation'), ('APP_TO_PER_APP_VPN_MAPPING', 'VPN App mapping', 'App to per app VPN mapping operation'), -('ENTERPRISE_WIPE', 'Enterprise Wipe', 'Enterprise wipe operation'), +('WIPE_DATA', 'Enterprise Wipe', 'Enterprise wipe operation'), ('APP_LOCK', 'App lock', 'App lock operation'); diff --git a/pom.xml b/pom.xml index 03f61fdd7..dd2b325c1 100644 --- a/pom.xml +++ b/pom.xml @@ -522,7 +522,7 @@ - 4.4.1 + 4.4.2 [4.4.0, 4.5.0) 1.5.4