use of org.netxms.client.datacollection.DciSummaryTable in project netxms by netxms.
the class SummaryTableManager method editSummaryTable.
/**
* Edit existing dataset
*/
private void editSummaryTable() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() != 1)
return;
final DciSummaryTableDescriptor d = (DciSummaryTableDescriptor) selection.getFirstElement();
new ConsoleJob(Messages.get().SummaryTableManager_ReadJobName, this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final DciSummaryTable t = session.getDciSummaryTable(d.getId());
runInUIThread(new Runnable() {
@Override
public void run() {
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, t);
dlg.getShell().setText(Messages.get().SummaryTableManager_TitleEdit);
dlg.open();
d.updateFromTable(t);
viewer.update(d, null);
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().SummaryTableManager_ReadJobError;
}
}.start();
}
use of org.netxms.client.datacollection.DciSummaryTable 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.DciSummaryTable in project netxms by netxms.
the class NXCSession method getDciSummaryTable.
/**
* Get DCI summary table configuration.
*
* @param id DCI summary table ID.
* @return The DciSummaryTable object
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public DciSummaryTable getDciSummaryTable(int id) throws IOException, NXCException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_GET_SUMMARY_TABLE_DETAILS);
msg.setFieldInt32(NXCPCodes.VID_SUMMARY_TABLE_ID, id);
sendMessage(msg);
return new DciSummaryTable(waitForRCC(msg.getMessageId()));
}
use of org.netxms.client.datacollection.DciSummaryTable in project netxms by netxms.
the class SummaryTableManager method createSummaryTable.
/**
* Create new loyalty program
*/
private void createSummaryTable(boolean isTableSource) {
// $NON-NLS-1$ //$NON-NLS-2$
DciSummaryTable t = new DciSummaryTable("", "", isTableSource);
PropertyDialog dlg = PropertyDialog.createDialogOn(getSite().getShell(), null, t);
if (dlg != null) {
dlg.getShell().setText(Messages.get().SummaryTableManager_TitleCreate);
dlg.open();
if (t.getId() != 0) {
// was saved to server
DciSummaryTableDescriptor d = new DciSummaryTableDescriptor(t);
descriptors.put(d.getId(), d);
viewer.setInput(descriptors.values().toArray());
viewer.setSelection(new StructuredSelection(d));
}
}
}
Aggregations