use of org.netxms.client.ServerAction in project netxms by netxms.
the class ExportFileBuilder method doExport.
/**
* Do export operation and call completion handler when done
*
* @param completionHandler
*/
private void doExport(final ExportCompletionHandler completionHandler) {
final long[] eventList = new long[events.size()];
int i = 0;
for (EventObject o : events.values()) eventList[i++] = o.getCode();
final long[] templateList = new long[templates.size()];
i = 0;
for (Template t : templates.values()) templateList[i++] = t.getObjectId();
final long[] trapList = new long[traps.size()];
i = 0;
for (SnmpTrap t : traps.values()) trapList[i++] = t.getId();
final UUID[] ruleList = new UUID[rules.size()];
i = 0;
for (EventProcessingPolicyRule r : rules.values()) ruleList[i++] = r.getGuid();
final long[] scriptList = new long[scripts.size()];
i = 0;
for (Script s : scripts.values()) scriptList[i++] = s.getId();
final long[] toolList = new long[tools.size()];
i = 0;
for (ObjectTool t : tools.values()) toolList[i++] = t.getId();
final long[] summaryTableList = new long[summaryTables.size()];
i = 0;
for (DciSummaryTableDescriptor t : summaryTables.values()) summaryTableList[i++] = t.getId();
final long[] actionList = new long[actions.size()];
i = 0;
for (ServerAction a : actions.values()) actionList[i++] = a.getId();
final String descriptionText = description.getText();
new ConsoleJob(Messages.get().ExportFileBuilder_ExportJobName, this, Activator.PLUGIN_ID, null) {
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
final String xml = session.exportConfiguration(descriptionText, eventList, trapList, templateList, ruleList, scriptList, toolList, summaryTableList, actionList);
runInUIThread(new Runnable() {
@Override
public void run() {
completionHandler.exportCompleted(xml);
}
});
}
@Override
protected String getErrorMessage() {
return Messages.get().ExportFileBuilder_ExportJobError;
}
}.start();
}
use of org.netxms.client.ServerAction in project netxms by netxms.
the class ActionSelectionDialog method okPressed.
/* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#okPressed()
*/
@SuppressWarnings("unchecked")
@Override
protected void okPressed() {
final IStructuredSelection selection = (IStructuredSelection) eventList.getSelection();
final List<ServerAction> list = selection.toList();
selectedActions = list.toArray(new ServerAction[list.size()]);
saveSettings();
super.okPressed();
}
use of org.netxms.client.ServerAction in project netxms by netxms.
the class ActionManager method createAction.
/**
* Create new action
*/
private void createAction() {
final ServerAction action = new ServerAction(0);
final EditActionDlg dlg = new EditActionDlg(getSite().getShell(), action, true);
if (dlg.open() == Window.OK) {
new ConsoleJob(Messages.get().ActionManager_CreateJobName, this, Activator.PLUGIN_ID, Activator.PLUGIN_ID) {
@Override
protected String getErrorMessage() {
return Messages.get().ActionManager_CreateJobError;
}
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
long id = session.createAction(action.getName());
action.setId(id);
session.modifyAction(action);
}
}.start();
}
}
use of org.netxms.client.ServerAction in project netxms by netxms.
the class ActionManager method deleteActions.
/**
* Delete selected actions
*/
private void deleteActions() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.isEmpty())
return;
if (!MessageDialogHelper.openConfirm(getSite().getShell(), Messages.get().ActionManager_Confirmation, Messages.get().ActionManager_ConfirmDelete))
return;
final Object[] objects = selection.toArray();
new ConsoleJob(Messages.get().ActionManager_DeleteJobName, this, Activator.PLUGIN_ID, Activator.PLUGIN_ID) {
@Override
protected String getErrorMessage() {
return Messages.get().ActionManager_DeleteJobError;
}
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
for (int i = 0; i < objects.length; i++) {
session.deleteAction(((ServerAction) objects[i]).getId());
}
}
}.start();
}
use of org.netxms.client.ServerAction in project netxms by netxms.
the class ActionManager method editAction.
/**
* Edit currently selected action
*/
private void editAction() {
IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
if (selection.size() != 1)
return;
final ServerAction action = (ServerAction) selection.getFirstElement();
final EditActionDlg dlg = new EditActionDlg(getSite().getShell(), action, false);
if (dlg.open() == Window.OK) {
new ConsoleJob(Messages.get().ActionManager_UpdateJobName, this, Activator.PLUGIN_ID, Activator.PLUGIN_ID) {
@Override
protected String getErrorMessage() {
return Messages.get().ActionManager_UpdateJobError;
}
@Override
protected void runInternal(IProgressMonitor monitor) throws Exception {
session.modifyAction(action);
}
}.start();
}
}
Aggregations