@Override public List<Feature> getAllFeatures(String deviceType) throws FeatureManagerDAOException { Connection conn; PreparedStatement stmt = null; ResultSet resultSet = null; List<Feature> featureList = new ArrayList<Feature>(); try { conn = this.getConnection(); String query = "SELECT f.ID ID, f.NAME NAME, f.CODE CODE, f.DEVICE_TYPE DEVICE_TYPE," + " f.EVALUATION_RULE EVALUATION_RULE FROM DM_FEATURES f INNER JOIN DM_DEVICE_TYPE d " + "ON d.ID=f.DEVICE_TYPE WHERE d.NAME = ?"; stmt = conn.prepareStatement(query); stmt.setString(1, deviceType); resultSet = stmt.executeQuery(); while (resultSet.next()) { Feature feature = new Feature(); feature.setId(resultSet.getInt("ID")); feature.setCode(resultSet.getString("CODE")); feature.setName(resultSet.getString("NAME")); featureList.add(feature); } } catch (SQLException e) { throw new FeatureManagerDAOException("Unable to get the list of the features related device type " + "from database.", e); } finally { PolicyManagementDAOUtil.cleanupResources(stmt, resultSet); } return featureList; }
List<Feature> supportedFeatures = new ArrayList<Feature>(); Feature feature = new Feature(); feature.setCode("DEVICE_LOCK"); feature.setName("Device Lock"); feature.setDescription("Lock the device"); supportedFeatures.add(feature); feature = new Feature(); feature.setCode("CAMERA"); feature.setName("camera"); feature.setDescription("Enable or disable camera"); supportedFeatures.add(feature); feature = new Feature(); feature.setCode("DEVICE_INFO"); feature.setName("Device info"); feature.setDescription("Request device information"); supportedFeatures.add(feature); feature = new Feature(); feature.setCode("WIPE_DATA"); feature.setName("Wipe Data"); feature.setDescription("Factory reset the device"); supportedFeatures.add(feature); feature = new Feature(); feature.setCode("ENCRYPT_STORAGE"); feature.setName("Encrypt storage"); feature.setDescription("Encrypt storage"); supportedFeatures.add(feature); feature = new Feature(); feature.setCode("DEVICE_RING"); feature.setName("Ring");
private static org.wso2.carbon.device.mgt.common.Feature map(Feature feature) { org.wso2.carbon.device.mgt.common.Feature rv = new org.wso2.carbon.device.mgt.common.Feature(); rv.setId(feature.getId()); rv.setCode(feature.getCode()); rv.setDescription(feature.getDescription()); rv.setDeviceType(feature.getDeviceType()); List<org.wso2.carbon.device.mgt.common.Feature.MetadataEntry> metadataEntries = new ArrayList<>(); feature.getMetadataEntries().forEach(metadataEntry -> { metadataEntries.add(map(metadataEntry)); }); rv.setMetadataEntries(metadataEntries); return rv; }
private static List<Feature> getSupportedFeatures() { List<Feature> supportedFeatures = new ArrayList<Feature>(); Feature feature = new Feature(); feature.setCode("DEVICE_LOCK"); feature.setName("Device Lock"); feature.setDescription("Lock the device"); supportedFeatures.add(feature); feature = new Feature(); feature.setCode("DEVICE_LOCATION"); feature.setName("Location"); feature.setDescription("Request coordinates of device location"); supportedFeatures.add(feature); feature = new Feature(); feature.setCode("WIFI"); feature.setName("wifi"); feature.setDescription("Setting up wifi configuration"); supportedFeatures.add(feature); feature = new Feature(); feature.setCode("CAMERA"); feature.setName("camera"); feature.setDescription("Enable or disable camera"); supportedFeatures.add(feature); feature = new Feature(); feature.setCode("EMAIL"); feature.setName("Email"); feature.setDescription("Configure email settings"); supportedFeatures.add(feature); feature = new Feature(); feature.setCode("DEVICE_MUTE"); feature.setName("mute");
public static Feature convertToFeature(MobileFeature mobileFeature) { Feature feature = new Feature(); feature.setDescription(mobileFeature.getDescription()); feature.setDeviceType(mobileFeature.getDeviceType()); feature.setCode(mobileFeature.getCode()); feature.setName(mobileFeature.getName()); return feature; }