revert-70aa11f8
harshanl 8 years ago
commit a4b6bb85b1

@ -24,10 +24,7 @@ import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagement
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.NotificationManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.notification.mgt.dao.util.NotificationDAOUtil;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
@ -35,6 +32,36 @@ import java.util.List;
* This class holds the Oracle implementation of NotificationDAO which can be used to support Oracle db syntax.
*/
public class OracleNotificationDAOImpl extends AbstractNotificationDAOImpl {
@Override
public int addNotification(int deviceId, int tenantId, Notification notification) throws
NotificationManagementException {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs;
int notificationId = -1;
try {
conn = NotificationManagementDAOFactory.getConnection();
String sql = "INSERT INTO DM_NOTIFICATION(DEVICE_ID, OPERATION_ID, STATUS, DESCRIPTION, TENANT_ID) "
+ "VALUES (?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(sql, new int[] { 1 });
stmt.setInt(1, deviceId);
stmt.setInt(2, notification.getOperationId());
stmt.setString(3, notification.getStatus().toString());
stmt.setString(4, notification.getDescription());
stmt.setInt(5, tenantId);
stmt.execute();
rs = stmt.getGeneratedKeys();
if (rs.next()) {
notificationId = rs.getInt(1);
}
} catch (Exception e) {
throw new NotificationManagementException(
"Error occurred while adding the " + "Notification for device id : " + deviceId, e);
} finally {
NotificationDAOUtil.cleanupResources(stmt, null);
}
return notificationId;
}
@Override
public List<Notification> getAllNotifications(PaginationRequest request, int tenantId) throws

@ -226,13 +226,14 @@ deviceModule = function () {
publicMethods.getDevices = function (userName) {
var url = devicemgtProps["httpsURL"] +
devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/devices/user/" + userName;
devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/devices";
return serviceInvokers.XMLHttp.get(
url, function (responsePayload) {
for (var i = 0; i < responsePayload.length; i++) {
responsePayload[i].thumb = utility.getDeviceThumb(responsePayload[i].type);
var devices = JSON.parse(responsePayload.responseText).devices;
for (var i = 0; i < devices.length; i++) {
devices[i].thumb = utility.getDeviceThumb(devices[i].type);
}
return responsePayload;
return devices;
},
function (responsePayload) {
log.error(responsePayload);

@ -20,7 +20,10 @@
var sortUpdateBtn = "#sortUpdateBtn";
var sortedIDs;
var dataTableSelection = '.DTTT_selected';
$('#policy-grid').datatables_extended();
var settings = {
"sorting": false
};
$('#policy-grid').datatables_extended(settings);
$(".icon .text").res_text(0.2);
var saveNewPrioritiesButton = "#save-new-priorities-button";

@ -184,8 +184,11 @@ function loadRoles() {
"placeholder": "Search By Role Name",
"searchKey": "filter"
};
var settings = {
"sorting": false
};
$('#role-grid').datatables_extended_serverside_paging(null, '/api/device-mgt/v1.0/roles', dataFilter, columns, fnCreatedRow, null, options);
$('#role-grid').datatables_extended_serverside_paging(settings, '/api/device-mgt/v1.0/roles', dataFilter, columns, fnCreatedRow, null, options);
loadingContent.hide();
}

@ -276,7 +276,8 @@ function loadUsers() {
firstname: data.users[index].firstname ? data.users[index].firstname : "",
lastname: data.users[index].lastname ? data.users[index].lastname : "",
emailAddress: data.users[index].emailAddress ? data.users[index].emailAddress : "",
DT_RowId : "user-" + data.users[index].username})
DT_RowId: "user-" + data.users[index].username
})
});
var json = {
@ -398,7 +399,11 @@ function loadUsers() {
"searchKey": "filter"
};
$('#user-grid').datatables_extended_serverside_paging(null, '/api/device-mgt/v1.0/users', dataFilter, columns, fnCreatedRow, null, options);
var settings = {
"sorting": false
};
$('#user-grid').datatables_extended_serverside_paging(settings, '/api/device-mgt/v1.0/users', dataFilter, columns, fnCreatedRow, null, options);
$(loadingContentView).hide();
}

@ -37,6 +37,7 @@ $.fn.datatables_extended_serverside_paging = function (settings , url, dataFilte
if (InitiateViewOption) {
$(document).on('click', '.viewEnabledIcon', InitiateViewOption);
}
//--- End of EMM related codes
/*
* Work around for accessing settings params inside datatable functions
@ -193,24 +194,42 @@ $.fn.datatables_extended_serverside_paging = function (settings , url, dataFilte
/**
* create sorting dropdown menu for list table advance operations
*/
var table = this;
if (table.hasClass('sorting-enabled')) {
var dropdownmenu = $('<ul class="dropdown-menu arrow arrow-top-right dark sort-list add-margin-top-2x"><li class="dropdown-header">Sort by</li></ul>');
$('.sort-row th', elem).each(function () {
if (!$(this).hasClass('no-sort')) {
dropdownmenu.append('<li><a href="#' + $(this).html() + '" data-column="' + $(this).index() + '">' + $(this).html() + '</a></li>');
}
});
}
/**
* append advance operations to list table toolbar
*/
$('.dataTable.list-table').closest('.dataTables_wrapper').find('.dataTablesTop .dataTables_toolbar').html('' +
'<ul class="nav nav-pills navbar-right remove-margin" role="tablist">' +
function getAdvanceToolBar() {
if (table.hasClass('sorting-enabled')) {
return '<ul class="nav nav-pills navbar-right remove-margin" role="tablist">' +
'<li><button data-click-event="toggle-selectable" class="btn btn-default btn-primary select-enable-btn">Select</li>' +
'<li><button data-click-event="toggle-selected" id="dt-select-all" class="btn btn-default btn-primary disabled">Select All</li>' +
'<li><button data-click-event="toggle-list-view" data-view="grid" class="btn btn-default"><i class="fw fw-grid"></i></button></li>' +
'<li><button data-click-event="toggle-list-view" data-view="list" class="btn btn-default"><i class="fw fw-list"></i></button></li>' +
'<li><button class="btn btn-default" data-toggle="dropdown"><i class="fw fw-sort"></i></button>' + dropdownmenu[0].outerHTML + '</li>' +
'</ul>'
} else {
return '<ul class="nav nav-pills navbar-right remove-margin" role="tablist">' +
'<li><button data-click-event="toggle-selectable" class="btn btn-default btn-primary select-enable-btn">Select</li>' +
'<li><button data-click-event="toggle-selected" id="dt-select-all" class="btn btn-default btn-primary disabled">Select All</li>' +
'<li><button data-click-event="toggle-list-view" data-view="grid" class="btn btn-default"><i class="fw fw-grid"></i></button></li>' +
'<li><button data-click-event="toggle-list-view" data-view="list" class="btn btn-default"><i class="fw fw-list"></i></button></li>' +
'</ul>'
}
;
}
/**
* append advance operations to list table toolbar
*/
$('.dataTable.list-table').closest('.dataTables_wrapper').find('.dataTablesTop .dataTables_toolbar').html(
getAdvanceToolBar()
);
/**

@ -47,8 +47,11 @@ function loadNotifications() {
viewModel["appContext"] = context;
var content = template(viewModel);
$("#ast-container").html(content);
$("#unread-notifications").datatables_extended();
$("#all-notifications").datatables_extended();
var settings = {
"sorting" : false
};
$("#unread-notifications").datatables_extended(settings);
$("#all-notifications").datatables_extended(settings);
}
}
},

Loading…
Cancel
Save