use of org.netxms.client.datacollection.DciSummaryTableDescriptor in project netxms by netxms.
the class ExportFileBuilder method addSummaryTables.
/**
* Add oject tools to list
*/
private void addSummaryTables() {
SummaryTableSelectionDialog dlg = new SummaryTableSelectionDialog(getSite().getShell());
if (dlg.open() == Window.OK) {
for (DciSummaryTableDescriptor t : dlg.getSelection()) summaryTables.put(t.getId(), t);
summaryTableViewer.setInput(summaryTables.values().toArray());
setModified();
}
}
use of org.netxms.client.datacollection.DciSummaryTableDescriptor in project netxms by netxms.
the class DataCollectionTest method testDciSummaryTables.
public void testDciSummaryTables() throws Exception {
final NXCSession session = connect();
DciSummaryTable t = new DciSummaryTable("test", "Test Table");
t.getColumns().add(new DciSummaryTableColumn("Idle", "System.CPU.Idle"));
t.getColumns().add(new DciSummaryTableColumn("I/O Wait", "System.CPU.IOWait"));
int id = session.modifyDciSummaryTable(t);
System.out.println("Assigned ID: " + id);
t.setId(id);
t.getColumns().add(new DciSummaryTableColumn("System", "^System\\.CPU\\.Sys.*", DciSummaryTableColumn.REGEXP_MATCH));
session.modifyDciSummaryTable(t);
List<DciSummaryTableDescriptor> list = session.listDciSummaryTables();
for (DciSummaryTableDescriptor d : list) System.out.println(d.getId() + ": " + d.getMenuPath() + " " + d.getTitle());
session.getDciSummaryTable(id);
session.deleteDciSummaryTable(id);
try {
session.getDciSummaryTable(id);
assertTrue(false);
} catch (NXCException e) {
if (e.getErrorCode() != RCC.INVALID_SUMMARY_TABLE_ID)
throw e;
}
session.disconnect();
}
use of org.netxms.client.datacollection.DciSummaryTableDescriptor in project netxms by netxms.
the class NXCSession method listDciSummaryTables.
/**
* Get list of all configured DCI summary tables
*
* @return List of DciSummaryTableDescriptor objects
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public List<DciSummaryTableDescriptor> listDciSummaryTables() throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_SUMMARY_TABLES);
sendMessage(msg);
final NXCPMessage response = waitForRCC(msg.getMessageId());
int count = response.getFieldAsInt32(NXCPCodes.VID_NUM_ELEMENTS);
final List<DciSummaryTableDescriptor> list = new ArrayList<DciSummaryTableDescriptor>(count);
long varId = NXCPCodes.VID_ELEMENT_LIST_BASE;
for (int i = 0; i < count; i++) {
list.add(new DciSummaryTableDescriptor(response, varId));
varId += 10;
}
return list;
}
use of org.netxms.client.datacollection.DciSummaryTableDescriptor in project netxms by netxms.
the class SummaryTableComparator method compare.
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
DciSummaryTableDescriptor d1 = (DciSummaryTableDescriptor) e1;
DciSummaryTableDescriptor d2 = (DciSummaryTableDescriptor) e2;
int result;
switch(// $NON-NLS-1$
(Integer) ((SortableTableViewer) viewer).getTable().getSortColumn().getData("ID")) {
case SummaryTableManager.COLUMN_ID:
result = d1.getId() - d2.getId();
break;
case SummaryTableManager.COLUMN_MENU_PATH:
result = d1.getMenuPath().compareToIgnoreCase(d2.getMenuPath());
break;
case SummaryTableManager.COLUMN_TITLE:
result = d1.getTitle().compareToIgnoreCase(d2.getTitle());
break;
default:
result = 0;
break;
}
return (((SortableTableViewer) viewer).getTable().getSortDirection() == SWT.UP) ? result : -result;
}
use of org.netxms.client.datacollection.DciSummaryTableDescriptor in project netxms by netxms.
the class SummaryTableManager method deleteSelection.
/**
* Delete selected datasets
*/
private void deleteSelection() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() == 0)
return;
if (!MessageDialogHelper.openQuestion(getSite().getShell(), Messages.get().SummaryTableManager_ConfirmDelete, Messages.get().SummaryTableManager_Confirmation))
return;
final int[] idList = new int[selection.size()];
int i = 0;
for (Object o : selection.toList()) idList[i++] = ((DciSummaryTableDescriptor) o).getId();
new ConsoleJob(Messages.get().SummaryTableManager_DeleteJobName, this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
for (int id : idList) session.deleteDciSummaryTable(id);
runInUIThread(new Runnable() {
@Override
public void run() {
for (int id : idList) descriptors.remove(id);
viewer.setInput(descriptors.values().toArray());
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().SummaryTableManager_DeleteJobError;
}
}.start();
}
Aggregations