Fixed indentation. UI module changes

revert-dabc3590
Dulitha Wijewantha 10 years ago
parent ba8f6621a4
commit f1193b5647

@ -54,11 +54,11 @@ public class MobileDeviceManagementUtil {
DocumentBuilder docBuilder = factory.newDocumentBuilder(); DocumentBuilder docBuilder = factory.newDocumentBuilder();
return docBuilder.parse(file); return docBuilder.parse(file);
} catch (Exception e) { } catch (Exception e) {
throw new DeviceManagementException( throw new DeviceManagementException("Error occurred while parsing file, while converting " +
"Error occurred while parsing file, while converting " +
"to a org.w3c.dom.Document : " + e.getMessage(), e); "to a org.w3c.dom.Document : " + e.getMessage(), e);
} }
} }
private static String getPropertyValue(Device device, String property) { private static String getPropertyValue(Device device, String property) {
for (Device.Property prop : device.getProperties()) { for (Device.Property prop : device.getProperties()) {
if (property.equals(prop.getName())) { if (property.equals(prop.getName())) {
@ -78,6 +78,7 @@ public class MobileDeviceManagementUtil {
} }
return prop; return prop;
} }
public static MobileDevice convertToMobileDevice(Device device) { public static MobileDevice convertToMobileDevice(Device device) {
MobileDevice mobileDevice = null; MobileDevice mobileDevice = null;
if (device != null) { if (device != null) {
@ -114,8 +115,7 @@ public class MobileDeviceManagementUtil {
return device; return device;
} }
public static MobileOperation convertToMobileOperation( public static MobileOperation convertToMobileOperation(org.wso2.carbon.device.mgt.common.Operation operation) {
org.wso2.carbon.device.mgt.common.Operation operation) {
MobileOperation mobileOperation = new MobileOperation(); MobileOperation mobileOperation = new MobileOperation();
MobileOperationProperty operationProperty = null; MobileOperationProperty operationProperty = null;
List<MobileOperationProperty> properties = new LinkedList<MobileOperationProperty>(); List<MobileOperationProperty> properties = new LinkedList<MobileOperationProperty>();

@ -18,25 +18,30 @@
var utility = require("/modules/utility.js"); var utility = require("/modules/utility.js");
var DeviceIdentifier = Packages.org.wso2.carbon.device.mgt.common.DeviceIdentifier; var DeviceIdentifier = Packages.org.wso2.carbon.device.mgt.common.DeviceIdentifier;
var DeviceManagerUtil = Packages.org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
var log = new Log(); var log = new Log();
var deviceManagementService = utility.getDeviceManagementService(); var deviceManagementService = utility.getDeviceManagementService();
var listDevices = function () { var listDevices = function () {
var devices = deviceManagementService.getAllDevices("android"); var devices = deviceManagementService.getAllDevices("android");
var deviceList = []; var deviceList = [];
for (i = 0; i < devices.size(); i++) { for (i = 0; i < devices.size(); i++) {
var device = devices.get(i); var device = devices.get(i);
var propertiesList = DeviceManagerUtil.convertPropertiesToMap(device.getProperties());
deviceList.push({ deviceList.push({
"identifier": device.getDeviceIdentifier(), "identifier": device.getDeviceIdentifier(),
"name": device.getName(), "name": device.getName(),
"ownership": device.getOwnership(), "ownership": device.getOwnership(),
"owner": device.getOwner(), "owner": device.getOwner(),
"deviceType": device.getType(), "deviceType": device.getType(),
"vendor": device.getProperties().get("vendor"), "vendor": propertiesList.get("vendor"),
"model": device.getProperties().get("model"), "model": propertiesList.get("model"),
"osVersion": device.getProperties().get("osVersion") "osVersion": propertiesList.get("osVersion")
}); });
} }
return deviceList; return deviceList;
@ -50,9 +55,11 @@ var getDevice = function(type, deviceId){
} }
var viewDevice = function(type, deviceId){ var viewDevice = function(type, deviceId){
var device = this.getDevice(type, deviceId); var device = this.getDevice(type, deviceId);
var entries = device.getProperties().entrySet(); var propertiesList = DeviceManagerUtil.convertPropertiesToMap(device.getProperties());
var entries = propertiesList.entrySet();
var iterator = entries.iterator(); var iterator = entries.iterator();
var properties = {}; var properties = {};
while(iterator.hasNext()){ while(iterator.hasNext()){
@ -67,9 +74,9 @@ var viewDevice = function(type, deviceId){
"ownership": device.getOwnership(), "ownership": device.getOwnership(),
"owner": device.getOwner(), "owner": device.getOwner(),
"deviceType": device.getType(), "deviceType": device.getType(),
"vendor": device.getProperties().get("vendor"), "vendor": propertiesList.get("vendor"),
"model": device.getProperties().get("model"), "model": propertiesList.get("model"),
"osVersion": device.getProperties().get("osVersion"), "osVersion": propertiesList.get("osVersion"),
"properties": properties "properties": properties
}; };
} }
Loading…
Cancel
Save