revert-70aa11f8
harshanl 8 years ago
commit 01e2408ece

@ -22,10 +22,10 @@ var uriMatcher = new URIMatcher(String(uri));
var log = new Log("api/device-api.jag"); var log = new Log("api/device-api.jag");
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var deviceModule = require("/app/modules/device.js").deviceModule; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"]; var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
var user = session.get(constants.USER_SESSION_KEY); var user = session.get(constants.USER_SESSION_KEY);

@ -27,7 +27,7 @@ var uriMatcher = new URIMatcher(String(uri));
var log = new Log("api/policy-api.jag"); var log = new Log("api/policy-api.jag");
var constants = require("/modules/constants.js"); var constants = require("/modules/constants.js");
var policyModule = require("/modules/policy.js").policyModule; var policyModule = require("/app/modules/business-controllers/group.js")["groupModule"];
var result; var result;
if (uriMatcher.match("/{context}/api/policies/update")) { if (uriMatcher.match("/{context}/api/policies/update")) {

@ -24,8 +24,8 @@ var log = new Log("api/user-api.jag");
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var deviceModule = require("/app/modules/device.js").deviceModule; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var apiWrapperUtil = require("/app/modules/oauth/token-handlers.js")["handlers"]; var apiWrapperUtil = require("/app/modules/oauth/token-handlers.js")["handlers"];
var util = require("/app/modules/oauth/token-handler-utils.js")["utils"]; var util = require("/app/modules/oauth/token-handler-utils.js")["utils"];

@ -18,7 +18,7 @@
var deviceModule; var deviceModule;
deviceModule = function () { deviceModule = function () {
var log = new Log("/app/modules/device.js"); var log = new Log("/app/modules/business-controllers/device.js");
var utility = require('/app/modules/utility.js').utility; var utility = require('/app/modules/utility.js').utility;
var constants = require('/app/modules/constants.js'); var constants = require('/app/modules/constants.js');
@ -261,7 +261,7 @@ deviceModule = function () {
publicMethods.getDevicesCount = function () { publicMethods.getDevicesCount = function () {
var carbonUser = session.get(constants.USER_SESSION_KEY); var carbonUser = session.get(constants.USER_SESSION_KEY);
if (carbonUser) { if (carbonUser) {
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var uiPermissions = userModule.getUIPermissions(); var uiPermissions = userModule.getUIPermissions();
var url; var url;
if (uiPermissions.LIST_DEVICES) { if (uiPermissions.LIST_DEVICES) {

@ -18,9 +18,9 @@
var groupModule = {}; var groupModule = {};
(function (groupModule) { (function (groupModule) {
var log = new Log("/app/modules/group.js"); var log = new Log("/app/modules/business-controllers/group.js");
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var constants = require('/app/modules/constants.js'); var constants = require('/app/modules/constants.js');
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;

@ -0,0 +1,138 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
@Deprecated New
*/
//var operationModule = function () {
// var log = new Log("/app/modules/business-controllers/operation.js");
// var utility = require('/app/modules/utility.js').utility;
// var constants = require('/app/modules/constants.js');
// var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
// var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
//
// var publicMethods = {};
// var privateMethods = {};
//
// /**
// * This method reads the token from the Token client and return the access token.
// * If the token pair s not set in the session this will send a redirect to the login page.
// */
// function getAccessToken(deviceType, owner, deviceId) {
// var TokenClient = Packages.org.wso2.carbon.device.mgt.iot.apimgt.TokenClient;
// var accessTokenClient = new TokenClient(deviceType);
// var accessTokenInfo = accessTokenClient.getAccessToken(owner, deviceId);
// return accessTokenInfo.getAccess_token();
// }
//
// privateMethods.getOperationsFromFeatures = function (deviceType, operationType) {
// var url = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/features/" + deviceType;
// var featuresList = serviceInvokers.XMLHttp.get(url, function (responsePayload) {
// var features = responsePayload;
// var featureList = [];
// var feature;
// for (var i = 0; i < features.length; i++) {
// feature = {};
// var analyticStreams = utility.getDeviceTypeConfig(deviceType)["analyticStreams"];
// if (analyticStreams) {
// for (var stream in analyticStreams) {
// if (analyticStreams[stream].name == features[i].name) {
// feature.ui_unit = analyticStreams[stream].ui_unit;
// break;
// }
// }
// }
//
// feature["operation"] = features[i].code;
// feature["name"] = features[i].name;
// feature["description"] = features[i].description;
// feature["deviceType"] = deviceType;
// feature["params"] = [];
// var metaData = features[i].metadataEntries;
// if (metaData) {
// for (var j = 0; j < metaData.length; j++) {
// feature["params"].push(metaData[j].value);
// }
// featureList.push(feature);
// }
// }
// return featureList;
// }, function (responsePayload) {
// var response = {};
// response["status"] = "error";
// return response;
// }
// );
// return featuresList;
// };
//
// publicMethods.getControlOperations = function (deviceType) {
// var operations = privateMethods.getOperationsFromFeatures(deviceType, "operation");
// for (var op in operations) {
// var iconPath = utility.getOperationIcon(deviceType, operations[op].operation);
// if (iconPath) {
// operations[op]["icon"] = iconPath;
// }
// }
// return operations;
// };
//
// publicMethods.getMonitorOperations = function (deviceType) {
// return privateMethods.getOperationsFromFeatures(deviceType, "monitor");
// };
//
// publicMethods.handlePOSTOperation = function (deviceType, operation, deviceId, params) {
// var user = session.get(constants.USER_SESSION_KEY);
// var endPoint = devicemgtProps["httpsURL"] + '/' + deviceType + "/controller/" + operation;
// var header = '{"owner":"' + user.username + '","deviceId":"' + deviceId +
// '","protocol":"mqtt", "sessionId":"' + session.getId() + '", "' +
// constants.AUTHORIZATION_HEADER + '":"' + constants.BEARER_PREFIX +
// getAccessToken(deviceType, user.username, deviceId) + '"}';
// return post(endPoint, params, JSON.parse(header), "json");
// };
//
// publicMethods.handleGETOperation = function (deviceType, operation, operationName, deviceId) {
// var user = session.get(constants.USER_SESSION_KEY);
// var endPoint = devicemgtProps["httpsURL"] + '/' + deviceType + "/controller/" + operation;
// var header = '{"owner":"' + user.username + '","deviceId":"' + deviceId +
// '","protocol":"mqtt", "' + constants.AUTHORIZATION_HEADER + '":"' +
// constants.BEARER_PREFIX + getAccessToken(deviceType, user.username, deviceId) +
// '"}';
// var result = get(endPoint, {}, JSON.parse(header), "json");
// if (result.data) {
// var values = result.data.sensorValue.split(',');
// if (operationName == 'gps') {
// result.data.map = {
// lat: parseFloat(values[0]),
// lng: parseFloat(values[1])
// }
// } else {
// var sqSum = 0;
// for (var v in values) {
// sqSum += Math.pow(values[v], 2);
// }
// result.data[operationName] = Math.sqrt(sqSum);
// }
// delete result.data['sensorValue'];
// }
// return result;
// };
//
// return publicMethods;
//}();

@ -21,7 +21,7 @@
*/ */
var policyModule; var policyModule;
policyModule = function () { policyModule = function () {
var log = new Log("/app/modules/policy.js"); var log = new Log("/app/modules/business-controllers/policy.js");
var constants = require('/app/modules/constants.js'); var constants = require('/app/modules/constants.js');
var utility = require("/app/modules/utility.js")["utility"]; var utility = require("/app/modules/utility.js")["utility"];

@ -20,7 +20,7 @@
* This module contains user and roles related functionality. * This module contains user and roles related functionality.
*/ */
var userModule = function () { var userModule = function () {
var log = new Log("/app/modules/user.js"); var log = new Log("/app/modules/business-controllers/user.js");
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var utility = require("/app/modules/utility.js")["utility"]; var utility = require("/app/modules/utility.js")["utility"];

@ -24,7 +24,7 @@ var carbonServer = new carbonModule.server.Server({
}); });
application.put("carbonServer", carbonServer); application.put("carbonServer", carbonServer);
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var utility = require("/app/modules/utility.js")["utility"]; var utility = require("/app/modules/utility.js")["utility"];
var permissions = { var permissions = {

@ -37,7 +37,7 @@ var invokers = function () {
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var tokenUtil = require("/app/modules/oauth/token-handlers.js")["handlers"]; var tokenUtil = require("/app/modules/oauth/token-handlers.js")["handlers"];
/** /**

@ -1,134 +0,0 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
var operationModule = function () {
var log = new Log("/app/modules/operation.js");
var utility = require('/app/modules/utility.js').utility;
var constants = require('/app/modules/constants.js');
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var serviceInvokers = require("/app/modules/oauth/token-protected-service-invokers.js")["invokers"];
var publicMethods = {};
var privateMethods = {};
/**
* This method reads the token from the Token client and return the access token.
* If the token pair s not set in the session this will send a redirect to the login page.
*/
function getAccessToken(deviceType, owner, deviceId) {
var TokenClient = Packages.org.wso2.carbon.device.mgt.iot.apimgt.TokenClient;
var accessTokenClient = new TokenClient(deviceType);
var accessTokenInfo = accessTokenClient.getAccessToken(owner, deviceId);
return accessTokenInfo.getAccess_token();
}
privateMethods.getOperationsFromFeatures = function (deviceType, operationType) {
var url = devicemgtProps["httpsURL"] + constants.ADMIN_SERVICE_CONTEXT + "/features/" + deviceType;
var featuresList = serviceInvokers.XMLHttp.get(url, function (responsePayload) {
var features = responsePayload;
var featureList = [];
var feature;
for (var i = 0; i < features.length; i++) {
feature = {};
var analyticStreams = utility.getDeviceTypeConfig(deviceType)["analyticStreams"];
if (analyticStreams) {
for (var stream in analyticStreams) {
if (analyticStreams[stream].name == features[i].name) {
feature.ui_unit = analyticStreams[stream].ui_unit;
break;
}
}
}
feature["operation"] = features[i].code;
feature["name"] = features[i].name;
feature["description"] = features[i].description;
feature["deviceType"] = deviceType;
feature["params"] = [];
var metaData = features[i].metadataEntries;
if (metaData) {
for (var j = 0; j < metaData.length; j++) {
feature["params"].push(metaData[j].value);
}
featureList.push(feature);
}
}
return featureList;
}, function (responsePayload) {
var response = {};
response["status"] = "error";
return response;
}
);
return featuresList;
};
publicMethods.getControlOperations = function (deviceType) {
var operations = privateMethods.getOperationsFromFeatures(deviceType, "operation");
for (var op in operations) {
var iconPath = utility.getOperationIcon(deviceType, operations[op].operation);
if (iconPath) {
operations[op]["icon"] = iconPath;
}
}
return operations;
};
publicMethods.getMonitorOperations = function (deviceType) {
return privateMethods.getOperationsFromFeatures(deviceType, "monitor");
};
publicMethods.handlePOSTOperation = function (deviceType, operation, deviceId, params) {
var user = session.get(constants.USER_SESSION_KEY);
var endPoint = devicemgtProps["httpsURL"] + '/' + deviceType + "/controller/" + operation;
var header = '{"owner":"' + user.username + '","deviceId":"' + deviceId +
'","protocol":"mqtt", "sessionId":"' + session.getId() + '", "' +
constants.AUTHORIZATION_HEADER + '":"' + constants.BEARER_PREFIX +
getAccessToken(deviceType, user.username, deviceId) + '"}';
return post(endPoint, params, JSON.parse(header), "json");
};
publicMethods.handleGETOperation = function (deviceType, operation, operationName, deviceId) {
var user = session.get(constants.USER_SESSION_KEY);
var endPoint = devicemgtProps["httpsURL"] + '/' + deviceType + "/controller/" + operation;
var header = '{"owner":"' + user.username + '","deviceId":"' + deviceId +
'","protocol":"mqtt", "' + constants.AUTHORIZATION_HEADER + '":"' +
constants.BEARER_PREFIX + getAccessToken(deviceType, user.username, deviceId) +
'"}';
var result = get(endPoint, {}, JSON.parse(header), "json");
if (result.data) {
var values = result.data.sensorValue.split(',');
if (operationName == 'gps') {
result.data.map = {
lat: parseFloat(values[0]),
lng: parseFloat(values[1])
}
} else {
var sqSum = 0;
for (var v in values) {
sqSum += Math.pow(values[v], 2);
}
result.data[operationName] = Math.sqrt(sqSum);
}
delete result.data['sensorValue'];
}
return result;
};
return publicMethods;
}();

@ -19,7 +19,7 @@
function onRequest(context) { function onRequest(context) {
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var user = session.get(constants.USER_SESSION_KEY); var user = session.get(constants.USER_SESSION_KEY);
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var permissions = userModule.getUIPermissions(); var permissions = userModule.getUIPermissions();
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
@ -31,9 +31,9 @@ function onRequest(context) {
var page = {}; var page = {};
page.permissions = permissions; page.permissions = permissions;
page.enrollmentURL = devicemgtProps.enrollmentURL; page.enrollmentURL = devicemgtProps.enrollmentURL;
var deviceModule = require("/app/modules/device.js").deviceModule; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var groupModule = require("/app/modules/group.js").groupModule; var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"];
var policyModule = require("/app/modules/policy.js").policyModule; var policyModule = require("/app/modules/business-controllers/policy.js")["policyModule"];
page.device_count = deviceModule.getDevicesCount(); page.device_count = deviceModule.getDevicesCount();
page.group_count = groupModule.getGroupCount(); page.group_count = groupModule.getGroupCount();

@ -18,8 +18,8 @@
function onRequest(context) { function onRequest(context) {
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var deviceModule = require("/app/modules/device.js").deviceModule; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var groupName = request.getParameter("groupName"); var groupName = request.getParameter("groupName");
var groupOwner = request.getParameter("groupOwner"); var groupOwner = request.getParameter("groupOwner");
@ -42,7 +42,7 @@ function onRequest(context) {
page.currentUser = currentUser; page.currentUser = currentUser;
var deviceCount = 0; var deviceCount = 0;
if (groupName && groupOwner) { if (groupName && groupOwner) {
var groupModule = require("/app/modules/group.js").groupModule; var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"];
deviceCount = groupModule.getGroupDeviceCount(groupName, groupOwner); deviceCount = groupModule.getGroupDeviceCount(groupName, groupOwner);
} else { } else {
deviceCount = deviceModule.getDevicesCount(); deviceCount = deviceModule.getDevicesCount();

@ -18,7 +18,7 @@
function onRequest(context) { function onRequest(context) {
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var groupModule = require("/app/modules/group.js").groupModule; var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"];
var groupName = context.uriParams.name; var groupName = context.uriParams.name;
var groupOwner = context.uriParams.owner; var groupOwner = context.uriParams.owner;
var devices = groupModule.getGroupDevices(groupName, groupOwner).data; var devices = groupModule.getGroupDevices(groupName, groupOwner).data;

@ -17,8 +17,8 @@
*/ */
function onRequest(context) { function onRequest(context) {
var groupModule = require("/app/modules/group.js").groupModule; var groupModule = require("/app/modules/business-controllers/group.js")["groupModule"];
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var currentUser = session.get(constants.USER_SESSION_KEY); var currentUser = session.get(constants.USER_SESSION_KEY);
var page = {}; var page = {};

@ -28,8 +28,8 @@ function onRequest(context) {
} }
}); });
var page = {}; var page = {};
var policyModule = require("/app/modules/policy.js")["policyModule"]; var policyModule = require("/app/modules/business-controllers/group.js")["groupModule"];
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var response = policyModule.getAllPolicies(); var response = policyModule.getAllPolicies();
if (response["status"] == "success") { if (response["status"] == "success") {
var policyListToView = response["content"]; var policyListToView = response["content"];

@ -25,7 +25,7 @@
function onRequest(context) { function onRequest(context) {
//var log = new Log("/app/pages/cdmf.page.user.create server-side js"); //var log = new Log("/app/pages/cdmf.page.user.create server-side js");
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var page = {}; var page = {};

@ -17,7 +17,7 @@
*/ */
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var userName = request.getParameter("username"); var userName = request.getParameter("username");
var user = userModule.getUser(userName)["content"]; var user = userModule.getUser(userName)["content"];
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];

@ -17,7 +17,7 @@
*/ */
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var username = request.getParameter("username"); var username = request.getParameter("username");
var user = userModule.getUser(username)["content"]; var user = userModule.getUser(username)["content"];
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/user.js")["userModule"];
@ -38,7 +38,7 @@ function onRequest(context) {
if (response["status"] == "success") { if (response["status"] == "success") {
userRoles = response["content"]; userRoles = response["content"];
} }
var deviceModule = require("/app/modules/device.js").deviceModule; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
devices = deviceModule.getDevices(userName); devices = deviceModule.getDevices(userName);
} }
return {"user": user, "userRoles": userRoles, "devices": devices}; return {"user": user, "userRoles": userRoles, "devices": devices};

@ -27,7 +27,7 @@ function onRequest (context) {
} }
//For QR Code //For QR Code
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var permissions = userModule.getUIPermissions(); var permissions = userModule.getUIPermissions();
var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];

@ -23,7 +23,7 @@ function onRequest(context) {
var DTYPE_CONF_DEVICE_TYPE_LABEL_KEY = "label"; var DTYPE_CONF_DEVICE_TYPE_LABEL_KEY = "label";
var viewModel = {}; var viewModel = {};
var deviceModule = require("/app/modules/device.js").deviceModule; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var deviceTypes = deviceModule.getDeviceTypes(); var deviceTypes = deviceModule.getDeviceTypes();

@ -22,7 +22,7 @@ function onRequest(context) {
var deviceId = request.getParameter("id"); var deviceId = request.getParameter("id");
if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) { if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) {
var deviceModule = require("/app/modules/device.js").deviceModule; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var device = deviceModule.viewDevice(deviceType, deviceId); var device = deviceModule.viewDevice(deviceType, deviceId);
if (device) { if (device) {

@ -17,7 +17,7 @@
*/ */
function onRequest(context){ function onRequest(context){
var userModule = require("/app/modules/user.js").userModule; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var permissions = []; var permissions = [];
if(userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/notifications/list")){ if(userModule.isAuthorized("/permission/admin/device-mgt/emm-admin/notifications/list")){

@ -46,7 +46,7 @@ $(document).ready(function () {
$("#ast-container").on("click", ".new-notification", function(e){ $("#ast-container").on("click", ".new-notification", function(e){
var notificationId = $(this).data("id"); var notificationId = $(this).data("id");
var redirectUrl = $(this).data("url"); var redirectUrl = $(this).data("url");
var getNotificationsAPI = "/devicemgt_admin/notifications/"+notificationId+"/CHECKED"; var getNotificationsAPI = "/api/device-mgt/v1.0/notifications/"+notificationId+"/CHECKED";
var errorMsgWrapper = "#error-msg"; var errorMsgWrapper = "#error-msg";
var errorMsg = "#error-msg span"; var errorMsg = "#error-msg span";
invokerUtil.put( invokerUtil.put(
@ -87,7 +87,7 @@ function loadNotifications(){
var deviceListingSrc = deviceListing.attr("src"); var deviceListingSrc = deviceListing.attr("src");
var currentUser = deviceListing.data("currentUser"); var currentUser = deviceListing.data("currentUser");
$.template("notification-listing", deviceListingSrc, function (template) { $.template("notification-listing", deviceListingSrc, function (template) {
var serviceURL = "/devicemgt_admin/notifications"; var serviceURL = "/api/device-mgt/v1.0/notifications";
var successCallback = function (data) { var successCallback = function (data) {
var viewModel = {}; var viewModel = {};
data = JSON.parse(data); data = JSON.parse(data);

@ -17,8 +17,8 @@
*/ */
function onRequest(context) { function onRequest(context) {
var utility = require("/app/modules/device.js").utility; var utility = require("/app/modules/utility.js").utility;
var deviceModule = require("/app/modules/device.js").deviceModule; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
//get all device types //get all device types
var data = deviceModule.getDeviceTypes(); var data = deviceModule.getDeviceTypes();
var deviceTypesArray = []; var deviceTypesArray = [];

@ -21,7 +21,7 @@ function onRequest(context) {
var DTYPE_CONF_DEVICE_TYPE_LABEL_KEY = "label"; var DTYPE_CONF_DEVICE_TYPE_LABEL_KEY = "label";
var utility = require("/app/modules/utility.js").utility; var utility = require("/app/modules/utility.js").utility;
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var types = {}; var types = {};
types["types"] = []; types["types"] = [];

@ -27,7 +27,7 @@ function onRequest(context) {
return options.fn(this); return options.fn(this);
} }
}); });
var policyModule = require("/app/modules/policy.js")["policyModule"]; var policyModule = require("/app/modules/business-controllers/group.js")["groupModule"];
var response = policyModule.getAllPolicies(); var response = policyModule.getAllPolicies();
if (response["status"] == "success") { if (response["status"] == "success") {
var policyListToView = response["content"]; var policyListToView = response["content"];

@ -23,7 +23,7 @@
* @returns {*} A context object that returns the dynamic state of this page to be presented * @returns {*} A context object that returns the dynamic state of this page to be presented
*/ */
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var response = userModule.getRoles(); var response = userModule.getRoles();
if (response["status"] == "success") { if (response["status"] == "success") {

@ -23,7 +23,7 @@
* @returns {*} A context object that returns the dynamic state of this page to be presented * @returns {*} A context object that returns the dynamic state of this page to be presented
*/ */
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var uri = request.getRequestURI(); var uri = request.getRequestURI();
var uriMatcher = new URIMatcher(String(uri)); var uriMatcher = new URIMatcher(String(uri));
var isMatched = uriMatcher.match("/{context}/roles/edit-role-permission/{rolename}"); var isMatched = uriMatcher.match("/{context}/roles/edit-role-permission/{rolename}");

@ -23,7 +23,7 @@
* @returns {*} A context object that returns the dynamic state of this page to be presented * @returns {*} A context object that returns the dynamic state of this page to be presented
*/ */
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"]; var deviceMgtProps = require("/app/modules/conf-reader/main.js")["conf"];
var uri = request.getRequestURI(); var uri = request.getRequestURI();
var uriMatcher = new URIMatcher(String(uri)); var uriMatcher = new URIMatcher(String(uri));

@ -17,7 +17,7 @@
*/ */
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var response = userModule.getUsers(); var response = userModule.getUsers();
var users = {}; var users = {};
context["permissions"] = userModule.getUIPermissions(); context["permissions"] = userModule.getUIPermissions();

@ -27,7 +27,7 @@ function onRequest(context) {
return options.fn(this); return options.fn(this);
} }
}); });
var userModule = require("/app/modules/user.js")["userModule"]; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var mdmProps = require("/app/modules/conf-reader/main.js")["conf"]; var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
var constants = require("/app/modules/constants.js"); var constants = require("/app/modules/constants.js");
var uiPermissions = userModule.getUIPermissions(); var uiPermissions = userModule.getUIPermissions();

Loading…
Cancel
Save