use of org.netxms.client.reporting.ReportDefinition in project netxms by netxms.
the class ReportNavigator method refresh.
/**
* Refresh reports tree
*/
private void refresh() {
new ConsoleJob("Load Reports", null, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final List<UUID> notGeneratedReport = new ArrayList<UUID>(0);
final List<ReportDefinition> definitions = new ArrayList<ReportDefinition>();
final List<UUID> reportIds = session.listReports();
for (UUID reportId : reportIds) {
try {
final ReportDefinition definition = session.getReportDefinition(reportId);
definitions.add(definition);
} catch (NXCException e) {
if (e.getErrorCode() == RCC.INTERNAL_ERROR)
notGeneratedReport.add(reportId);
}
}
runInUIThread(new Runnable() {
@Override
public void run() {
reportTree.setInput(definitions);
if (notGeneratedReport.size() > 0) {
String errorMessage = "Can't load compiled report: ";
for (int i = 0; i < notGeneratedReport.size(); i++) errorMessage += notGeneratedReport.get(i).toString() + (i == notGeneratedReport.size() - 1 ? "" : ", ");
MessageDialog.openError(null, "Error", errorMessage);
}
}
});
}
@Override
protected String getErrorMessage() {
return "Failed to load reports from the server";
}
}.start();
}
use of org.netxms.client.reporting.ReportDefinition in project netxms by netxms.
the class ReportView method createPartControl.
/* (non-Javadoc)
* @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createPartControl(Composite parent) {
this.parentComposite = parent;
selectionService = getSite().getWorkbenchWindow().getSelectionService();
selectionListener = new ISelectionListener() {
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if ((part instanceof ReportNavigator) && (selection instanceof IStructuredSelection) && !selection.isEmpty()) {
ReportDefinition object = (ReportDefinition) ((IStructuredSelection) selection).getFirstElement();
setObject(object);
}
}
};
selectionService.addSelectionListener(selectionListener);
}
use of org.netxms.client.reporting.ReportDefinition in project netxms by netxms.
the class NXCSession method getReportDefinition.
/**
* Get the report definition
*
* @param reportId The UUID of the report
* @return The ReportDefinition object
* @throws IOException if socket I/O error occurs
* @throws NXCException if NetXMS server returns an error or operation was timed out
*/
public ReportDefinition getReportDefinition(UUID reportId) throws NXCException, IOException {
final NXCPMessage msg = newMessage(NXCPCodes.CMD_RS_GET_REPORT_DEFINITION);
msg.setField(NXCPCodes.VID_REPORT_DEFINITION, reportId);
msg.setField(NXCPCodes.VID_LOCALE, Locale.getDefault().getLanguage());
sendMessage(msg);
return new ReportDefinition(reportId, waitForRCC(msg.getMessageId()));
}
Aggregations