Implemented Export and Import for Server Actions. Fixes #NX-703
authorEriks Jenkevics <eriks@netxms.org>
Tue, 24 Oct 2017 14:33:23 +0000 (17:33 +0300)
committerEriks Jenkevics <eriks@netxms.org>
Wed, 25 Oct 2017 08:54:44 +0000 (11:54 +0300)
20 files changed:
include/nms_cscp.h
src/client/java/netxms-client/src/main/java/org/netxms/client/NXCSession.java
src/java/netxms-eclipse/ActionManager/META-INF/MANIFEST.MF
src/java/netxms-eclipse/ActionManager/src/org/netxms/ui/eclipse/actionmanager/dialogs/ActionSelectionDialog.java [new file with mode: 0644]
src/java/netxms-eclipse/ActionManager/src/org/netxms/ui/eclipse/actionmanager/dialogs/helpers/ActionSelectionDialogLabelProvider.java [new file with mode: 0644]
src/java/netxms-eclipse/ServerConfig/META-INF/MANIFEST.MF
src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/ExportFileBuilder.java
src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/helpers/ActionComparator.java [new file with mode: 0644]
src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/helpers/ActionLabelProvider.java [new file with mode: 0644]
src/libnxjava/java/base/netxms-base/src/main/java/org/netxms/base/NXCPCodes.java
src/server/core/actions.cpp
src/server/core/import.cpp
src/server/core/session.cpp
src/server/include/nms_actions.h
webui/webapp/ActionManager/META-INF/MANIFEST.MF
webui/webapp/ActionManager/src/org/netxms/ui/eclipse/actionmanager/dialogs/ActionSelectionDialog.java [new file with mode: 0644]
webui/webapp/ActionManager/src/org/netxms/ui/eclipse/actionmanager/dialogs/helpers/ActionSelectionDialogLabelProvider.java [new file with mode: 0644]
webui/webapp/EPP/META-INF/MANIFEST.MF
webui/webapp/ServerConfig/META-INF/MANIFEST.MF
webui/webapp/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/ExportFileBuilder.java

index dbe3549..4a97287 100644 (file)
@@ -1211,6 +1211,7 @@ typedef struct
 #define VID_IN_FIELD_COUNT          ((UINT32)603)
 #define VID_STRING_COUNT            ((UINT32)604)
 #define VID_EXPAND_STRING           ((UINT32)605)
+#define VID_ACTION_LIST             ((UINT32)606)
 
 // Base variabe for single threshold in message
 #define VID_THRESHOLD_BASE          ((UINT32)0x00800000)
index 7598789..e81b110 100644 (file)
@@ -6798,7 +6798,7 @@ public class NXCSession
     * @throws NXCException if NetXMS server returns an error or operation was timed out
     */
    public String exportConfiguration(String description, long[] events, long[] traps, long[] templates, UUID[] rules, 
-         long[] scripts, long[] objectTools, long[] dciSummaryTables) throws IOException, NXCException
+         long[] scripts, long[] objectTools, long[] dciSummaryTables, long[] actions) throws IOException, NXCException
    {
       final NXCPMessage msg = newMessage(NXCPCodes.CMD_EXPORT_CONFIGURATION);
       msg.setField(NXCPCodes.VID_DESCRIPTION, description);
@@ -6814,6 +6814,8 @@ public class NXCSession
       msg.setField(NXCPCodes.VID_TOOL_LIST, objectTools);
       msg.setFieldInt32(NXCPCodes.VID_NUM_SUMMARY_TABLES, dciSummaryTables.length);
       msg.setField(NXCPCodes.VID_SUMMARY_TABLE_LIST, dciSummaryTables);
+      msg.setFieldInt32(NXCPCodes.VID_NUM_ACTIONS, actions.length);
+      msg.setField(NXCPCodes.VID_ACTION_LIST, actions);
 
       msg.setFieldInt32(NXCPCodes.VID_NUM_RULES, rules.length);
       long varId = NXCPCodes.VID_RULE_LIST_BASE;
index 4f60aef..eb11704 100644 (file)
@@ -12,3 +12,4 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.7.0",
  org.netxms.ui.base;bundle-version="2.1.2"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Bundle-ActivationPolicy: lazy
+Export-Package: org.netxms.ui.eclipse.actionmanager.dialogs
diff --git a/src/java/netxms-eclipse/ActionManager/src/org/netxms/ui/eclipse/actionmanager/dialogs/ActionSelectionDialog.java b/src/java/netxms-eclipse/ActionManager/src/org/netxms/ui/eclipse/actionmanager/dialogs/ActionSelectionDialog.java
new file mode 100644 (file)
index 0000000..17ffdaa
--- /dev/null
@@ -0,0 +1,147 @@
+/**
+ * NetXMS - open source network management system
+ * Copyright (C) 2003-2017 Raden Solutions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.netxms.ui.eclipse.actionmanager.dialogs;
+
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.netxms.client.ServerAction;
+import org.netxms.ui.eclipse.actionmanager.Activator;
+import org.netxms.ui.eclipse.actionmanager.dialogs.helpers.ActionSelectionDialogLabelProvider;
+import org.netxms.ui.eclipse.jobs.ConsoleJob;
+import org.netxms.ui.eclipse.shared.ConsoleSharedData;
+import org.netxms.ui.eclipse.tools.WidgetHelper;
+
+/**
+ * Action selection dialog
+ */
+public class ActionSelectionDialog extends Dialog
+{
+   private TableViewer viewer;
+   private List<ServerAction> selection;
+   
+   /**
+    * Action selection dialog construction
+    * @param parentShell parent shell
+    */
+   public ActionSelectionDialog(Shell parentShell)
+   {
+      super(parentShell);
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+    */
+   @Override
+   protected Control createDialogArea(Composite parent)
+   {
+      final Composite dialogArea = (Composite)super.createDialogArea(parent);
+      
+      GridLayout layout = new GridLayout();
+      layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
+      layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
+      dialogArea.setLayout(layout);
+      
+      viewer = new TableViewer(dialogArea, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
+      viewer.setContentProvider(new ArrayContentProvider());
+      viewer.setLabelProvider(new ActionSelectionDialogLabelProvider());
+      viewer.setComparator(new ViewerComparator() {
+         /* (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)
+         {
+            return ((ServerAction)e1).getName().compareToIgnoreCase(((ServerAction)e2).getName());
+         }
+      });
+      
+      new ConsoleJob("Get server actions", null, Activator.PLUGIN_ID, null) {
+         @Override
+         protected void runInternal(IProgressMonitor monitor) throws Exception
+         {
+            final List<ServerAction> list = ConsoleSharedData.getSession().getActions();
+            runInUIThread(new Runnable() {
+               @Override
+               public void run()
+               {
+                  viewer.setInput(list.toArray());
+               }
+            });
+         }
+
+         @Override
+         protected String getErrorMessage()
+         {
+            return "Cannot get server actions";
+         }
+      }.start();
+      
+      GridData gd = new GridData();
+      gd.horizontalAlignment = SWT.FILL;
+      gd.verticalAlignment = SWT.FILL;
+      gd.grabExcessHorizontalSpace = true;
+      gd.grabExcessVerticalSpace = true;
+      gd.heightHint = 400;
+      viewer.getControl().setLayoutData(gd);
+      
+      return dialogArea;
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+    */
+   @SuppressWarnings("unchecked")
+   @Override
+   protected void okPressed()
+   {
+      selection = ((IStructuredSelection)viewer.getSelection()).toList();
+      super.okPressed();
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+    */
+   @Override
+   protected void configureShell(Shell newShell)
+   {
+      super.configureShell(newShell);
+      newShell.setText("Select action");
+   }
+   
+   /**
+    * Get selection 
+    * @return the selection
+    */
+   public List<ServerAction> getSelection()
+   {
+      return selection;
+   }
+}
diff --git a/src/java/netxms-eclipse/ActionManager/src/org/netxms/ui/eclipse/actionmanager/dialogs/helpers/ActionSelectionDialogLabelProvider.java b/src/java/netxms-eclipse/ActionManager/src/org/netxms/ui/eclipse/actionmanager/dialogs/helpers/ActionSelectionDialogLabelProvider.java
new file mode 100644 (file)
index 0000000..6814403
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * NetXMS - open source network management system
+ * Copyright (C) 2003-2017 Raden Solutions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.netxms.ui.eclipse.actionmanager.dialogs.helpers;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.netxms.client.ServerAction;
+
+/**
+ * Label provider for action selection dialog
+ */
+public class ActionSelectionDialogLabelProvider extends WorkbenchLabelProvider implements ITableLabelProvider
+{
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+    */
+   @Override
+   public Image getColumnImage(Object element, int columnIndex)
+   {
+      return (columnIndex == 0) ? getImage(element) : null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+    */
+   @Override
+   public String getColumnText(Object element, int columnIndex)
+   {
+      return ((ServerAction)element).getName();
+   }
+
+}
index 221ea25..201248f 100644 (file)
@@ -17,7 +17,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="3.8.2",
  org.netxms.ui.eclipse.epp;bundle-version="2.0.4",
  org.netxms.ui.eclipse.objecttools;bundle-version="2.1.0",
  org.netxms.ui.eclipse.datacollection;bundle-version="2.1.0",
- org.netxms.ui.base;bundle-version="2.1.2"
+ org.netxms.ui.base;bundle-version="2.1.2",
+ org.netxms.ui.eclipse.actionmanager;bundle-version="2.0.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Export-Package: org.netxms.ui.eclipse.serverconfig.widgets,
index 8c5530c..dc4c0d5 100644 (file)
@@ -63,6 +63,7 @@ import org.eclipse.ui.part.ViewPart;
 import org.netxms.base.NXCommon;
 import org.netxms.client.NXCSession;
 import org.netxms.client.Script;
+import org.netxms.client.ServerAction;
 import org.netxms.client.datacollection.DciSummaryTableDescriptor;
 import org.netxms.client.events.EventGroup;
 import org.netxms.client.events.EventObject;
@@ -73,6 +74,7 @@ import org.netxms.client.objects.AbstractObject;
 import org.netxms.client.objects.Template;
 import org.netxms.client.objecttools.ObjectTool;
 import org.netxms.client.snmp.SnmpTrap;
+import org.netxms.ui.eclipse.actionmanager.dialogs.ActionSelectionDialog;
 import org.netxms.ui.eclipse.console.resources.SharedIcons;
 import org.netxms.ui.eclipse.epp.dialogs.RuleSelectionDialog;
 import org.netxms.ui.eclipse.eventmanager.dialogs.EventSelectionDialog;
@@ -86,6 +88,8 @@ import org.netxms.ui.eclipse.serverconfig.dialogs.RepositorySelectionDialog;
 import org.netxms.ui.eclipse.serverconfig.dialogs.SelectSnmpTrapDialog;
 import org.netxms.ui.eclipse.serverconfig.dialogs.SummaryTableSelectionDialog;
 import org.netxms.ui.eclipse.serverconfig.dialogs.helpers.TrapListLabelProvider;
+import org.netxms.ui.eclipse.serverconfig.views.helpers.ActionComparator;
+import org.netxms.ui.eclipse.serverconfig.views.helpers.ActionLabelProvider;
 import org.netxms.ui.eclipse.serverconfig.views.helpers.RuleComparator;
 import org.netxms.ui.eclipse.serverconfig.views.helpers.RuleLabelProvider;
 import org.netxms.ui.eclipse.serverconfig.views.helpers.ScriptComparator;
@@ -116,6 +120,7 @@ public class ExportFileBuilder extends ViewPart implements ISaveablePart
    private TableViewer scriptViewer;
    private TableViewer toolsViewer;
    private TableViewer summaryTableViewer;
+   private TableViewer actionViewer;
        private Action actionSave;
        private Action actionPublish;
        private Map<Long, EventObject> events = new HashMap<Long, EventObject>();
@@ -125,6 +130,7 @@ public class ExportFileBuilder extends ViewPart implements ISaveablePart
        private Map<Long, Script> scripts = new HashMap<Long, Script>();
        private Map<Long, ObjectTool> tools = new HashMap<Long, ObjectTool>();
    private Map<Integer, DciSummaryTableDescriptor> summaryTables = new HashMap<Integer, DciSummaryTableDescriptor>();
+   private Map<Long, ServerAction> actions = new HashMap<Long, ServerAction>();
        private boolean modified = false;
        private List<SnmpTrap> snmpTrapCache = null;
        private List<EventProcessingPolicyRule> rulesCache = null;
@@ -162,6 +168,7 @@ public class ExportFileBuilder extends ViewPart implements ISaveablePart
                createScriptSection();
                createToolsSection();
       createSummaryTablesSection();
+      createActionsSection();
                
                form.reflow(true);
                
@@ -698,6 +705,68 @@ public class ExportFileBuilder extends ViewPart implements ISaveablePart
          }
       });
    }
+   
+   /**
+    * Create "Actions" section
+    */
+   private void createActionsSection()
+   {
+      Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
+      section.setText("Actions");
+      TableWrapData td = new TableWrapData();
+      td.align = TableWrapData.FILL;
+      td.grabHorizontal = true;
+      section.setLayoutData(td);
+      
+      Composite clientArea = toolkit.createComposite(section);
+      GridLayout layout = new GridLayout();
+      layout.numColumns = 2;
+      clientArea.setLayout(layout);
+      section.setClient(clientArea);
+      
+      actionViewer = new TableViewer(clientArea, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
+      toolkit.adapt(ruleViewer.getTable());
+      GridData gd = new GridData();
+      gd.horizontalAlignment = SWT.FILL;
+      gd.grabExcessHorizontalSpace = true;
+      gd.verticalAlignment = SWT.FILL;
+      gd.grabExcessVerticalSpace = true;
+      gd.heightHint = 200;
+      gd.verticalSpan = 2;
+      actionViewer.getTable().setLayoutData(gd);
+      actionViewer.setContentProvider(new ArrayContentProvider());
+      actionViewer.setLabelProvider(new ActionLabelProvider());
+      actionViewer.setComparator(new ActionComparator());
+      actionViewer.getTable().setSortDirection(SWT.UP);
+
+      final ImageHyperlink linkAdd = toolkit.createImageHyperlink(clientArea, SWT.NONE);
+      linkAdd.setText(Messages.get().ExportFileBuilder_Add);
+      linkAdd.setImage(SharedIcons.IMG_ADD_OBJECT);
+      gd = new GridData();
+      gd.verticalAlignment = SWT.TOP;
+      linkAdd.setLayoutData(gd);
+      linkAdd.addHyperlinkListener(new HyperlinkAdapter() {
+         @Override
+         public void linkActivated(HyperlinkEvent e)
+         {
+            addActions();
+         }
+      });
+      
+      final ImageHyperlink linkRemove = toolkit.createImageHyperlink(clientArea, SWT.NONE);
+      linkRemove.setText(Messages.get().ExportFileBuilder_Remove);
+      linkRemove.setImage(SharedIcons.IMG_DELETE_OBJECT);
+      gd = new GridData();
+      gd.verticalAlignment = SWT.TOP;
+      linkRemove.setLayoutData(gd);
+      linkRemove.addHyperlinkListener(new HyperlinkAdapter() {
+         @Override
+         public void linkActivated(HyperlinkEvent e)
+         {
+            removeObjects(actionViewer, actions);
+         }
+      });
+   }
 
        /**
         * Create actions
@@ -913,13 +982,18 @@ public class ExportFileBuilder extends ViewPart implements ISaveablePart
       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);
+            final String xml = session.exportConfiguration(descriptionText, eventList, trapList, templateList, ruleList, scriptList, toolList, summaryTableList, actionList);
             runInUIThread(new Runnable() {
                @Override
                public void run()
@@ -1288,6 +1362,21 @@ public class ExportFileBuilder extends ViewPart implements ISaveablePart
    }
    
    /**
+    * Add actions to list
+    */
+   private void addActions()
+   {
+      ActionSelectionDialog dlg = new ActionSelectionDialog(getSite().getShell());
+      if (dlg.open() == Window.OK)
+      {
+         for(ServerAction a : dlg.getSelection())
+            actions.put(a.getId(), a);
+         actionViewer.setInput(actions.values().toArray());
+         setModified();
+      }
+   }
+   
+   /**
     * Export completion handler
     */
    private interface ExportCompletionHandler
diff --git a/src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/helpers/ActionComparator.java b/src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/helpers/ActionComparator.java
new file mode 100644 (file)
index 0000000..558aeb6
--- /dev/null
@@ -0,0 +1,38 @@
+/**
+ * NetXMS - open source network management system
+ * Copyright (C) 2003-2017 Raden Solutions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.netxms.ui.eclipse.serverconfig.views.helpers;
+
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.netxms.client.ServerAction;
+
+/**
+ * Comparator for actions
+ */
+public class ActionComparator extends ViewerComparator
+{
+   /* (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)
+   {
+      return ((ServerAction)e1).getName().compareToIgnoreCase(((ServerAction)e2).getName());
+   }
+}
diff --git a/src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/helpers/ActionLabelProvider.java b/src/java/netxms-eclipse/ServerConfig/src/org/netxms/ui/eclipse/serverconfig/views/helpers/ActionLabelProvider.java
new file mode 100644 (file)
index 0000000..8e3bacc
--- /dev/null
@@ -0,0 +1,52 @@
+/**
+ * NetXMS - open source network management system
+ * Copyright (C) 2003-2017 Raden Solutions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.netxms.ui.eclipse.serverconfig.views.helpers;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.netxms.client.ServerAction;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Label provider for action list
+ */
+public class ActionLabelProvider extends LabelProvider implements ITableLabelProvider
+{
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+    */
+   @Override
+   public Image getColumnImage(Object element, int columnIndex)
+   {
+      return null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+    */
+   @Override
+   public String getColumnText(Object element, int columnIndex)
+   {
+      if (columnIndex == 0)
+         return ((ServerAction)element).getName();
+      return null;
+   }
+
+}
\ No newline at end of file
index 9c19e9a..f06eae9 100644 (file)
@@ -993,6 +993,7 @@ public class NXCPCodes
    public static final long VID_IN_FIELD_COUNT = 603;
    public static final long VID_STRING_COUNT = 604;
    public static final long VID_EXPAND_STRING = 605;
+   public static final long VID_ACTION_LIST = 606;
 
        public static final long VID_ACL_USER_BASE = 0x00001000L;
        public static final long VID_ACL_USER_LAST = 0x00001FFFL;
index b9a4a3b..4710cb3 100644 (file)
@@ -704,3 +704,96 @@ void SendActionsToClient(ClientSession *pSession, UINT32 dwRqId)
    msg.setField(VID_ACTION_ID, (UINT32)0);
    pSession->sendMessage(&msg);
 }
+
+/**
+ * Export action configuration
+ */
+void CreateActionExportRecord(String &xml, UINT32 id)
+{
+   DB_HANDLE hdb = DBConnectionPoolAcquireConnection();
+   DB_STATEMENT hStmt = DBPrepare(hdb, _T("SELECT action_name,action_type,")
+                                       _T("rcpt_addr,email_subject,action_data ")
+                                       _T("FROM actions WHERE action_id=?"));
+   if (hStmt == NULL)
+   {
+      DBConnectionPoolReleaseConnection(hdb);
+      return;
+   }
+
+   DBBind(hStmt, 1, DB_SQLTYPE_INTEGER, id);
+   DB_RESULT hResult = DBSelectPrepared(hStmt);
+   if (hResult != NULL && DBGetNumRows(hResult) > 0)
+   {
+      xml.append(_T("\t\t<action id=\""));
+      xml.append(id);
+      xml.append(_T("\">\n\t\t\t<name>"));
+      xml.appendPreallocated(DBGetFieldForXML(hResult, 0, 0));
+      xml.append(_T("</name>\n\t\t\t<type>"));
+      xml.append(DBGetFieldULong(hResult, 0, 1));
+      xml.append(_T("</type>\n\t\t\t<recipientAddress>"));
+      xml.appendPreallocated(DBGetFieldForXML(hResult, 0, 2));
+      xml.append(_T("</recipientAddress>\n\t\t\t<emailSubject>"));
+      xml.appendPreallocated(DBGetFieldForXML(hResult, 0, 3));
+      xml.append(_T("</emailSubject>\n\t\t\t<data>"));
+      xml.appendPreallocated(DBGetFieldForXML(hResult, 0, 4));
+      xml.append(_T("</data>\n"));
+      xml.append(_T("\t\t</action>\n"));
+      DBFreeResult(hResult);
+   }
+   DBFreeStatement(hStmt);
+   DBConnectionPoolReleaseConnection(hdb);
+}
+
+/**
+ * Import action configuration
+ */
+bool ImportAction(ConfigEntry *config)
+{
+   if (config->getSubEntryValue(_T("name")) == NULL)
+   {
+      DbgPrintf(4, _T("ImportAction: no name specified"));
+      return false;
+   }
+
+   RWLockWriteLock(m_rwlockActionListAccess, INFINITE);
+
+   UINT32 i;
+   // Check for duplicate name
+   for(i = 0; i < m_dwNumActions; i++)
+   {
+      if (!_tcsicmp(m_pActionList[i].szName, config->getSubEntryValue(_T("name"))))
+      {
+         DbgPrintf(4, _T("ImportAction: name already exists"));
+         return false;
+      }
+   }
+
+   // If not exist, create it
+   m_dwNumActions++;
+   m_pActionList = (NXC_ACTION *)realloc(m_pActionList, sizeof(NXC_ACTION) * m_dwNumActions);
+   m_pActionList[i].dwId = CreateUniqueId(IDG_ACTION);
+   nx_strncpy(m_pActionList[i].szName, config->getSubEntryValue(_T("name")), MAX_OBJECT_NAME);
+   m_pActionList[i].bIsDisabled = FALSE;
+   m_pActionList[i].iType = config->getSubEntryValueAsUInt(_T("type"), 0);
+   if (config->getSubEntryValue(_T("emailSubject")) == NULL)
+      m_pActionList[i].szEmailSubject[0] = 0;
+   else
+      nx_strncpy(m_pActionList[i].szEmailSubject, config->getSubEntryValue(_T("emailSubject")), MAX_EMAIL_SUBJECT_LEN);
+   if (config->getSubEntryValue(_T("recipientAddress")) == NULL)
+      m_pActionList[i].szRcptAddr[0] = 0;
+   else
+      nx_strncpy(m_pActionList[i].szRcptAddr, config->getSubEntryValue(_T("recipientAddress")), MAX_RCPT_ADDR_LEN);
+   if (config->getSubEntryValue(_T("data")) == NULL)
+      m_pActionList[i].pszData = NULL;
+   else
+      m_pActionList[i].pszData = _tcsdup(config->getSubEntryValue(_T("data")));
+
+   qsort(m_pActionList, m_dwNumActions, sizeof(NXC_ACTION), CompareElements);
+
+   SaveActionToDB(&m_pActionList[i]);
+   m_dwUpdateCode = NX_NOTIFY_ACTION_CREATED;
+   EnumerateClientSessions(SendActionDBUpdate, &m_pActionList[i]);
+
+   RWLockUnlock(m_rwlockActionListAccess);
+   return true;
+}
index 464810c..24f6867 100644 (file)
@@ -438,8 +438,10 @@ NetObj *FindTemplateRoot(ConfigEntry *config)
  */
 UINT32 ImportConfig(Config *config, UINT32 flags)
 {
-       ObjectArray<ConfigEntry> *events = NULL, *traps = NULL, *templates = NULL, *rules = NULL, *scripts = NULL, *objectTools = NULL, *summaryTables = NULL;
-       ConfigEntry *eventsRoot, *trapsRoot, *templatesRoot, *rulesRoot, *scriptsRoot, *objectToolsRoot, *summaryTablesRoot;
+       ObjectArray<ConfigEntry> *events = NULL, *traps = NULL, *templates = NULL, *rules = NULL,
+                                *scripts = NULL, *objectTools = NULL, *summaryTables = NULL, *actions = NULL;
+       ConfigEntry *eventsRoot, *trapsRoot, *templatesRoot, *rulesRoot,
+                   *scriptsRoot, *objectToolsRoot, *summaryTablesRoot, *actionsRoot;
        UINT32 rcc = RCC_SUCCESS;
        int i;
 
@@ -568,6 +570,18 @@ UINT32 ImportConfig(Config *config, UINT32 flags)
                DbgPrintf(5, _T("ImportConfig(): DCI summary tables imported"));
        }
 
+   // Import summary tables
+   actionsRoot = config->getEntry(_T("/actions"));
+   if (actionsRoot != NULL)
+   {
+      actions = actionsRoot->getSubEntries(_T("action#*"));
+      for(i = 0; i < actions->size(); i++)
+      {
+         ImportAction(actions->get(i));
+      }
+      DbgPrintf(5, _T("ImportConfig(): Actions imported"));
+   }
+
 stop_processing:
        delete events;
        delete traps;
@@ -576,6 +590,7 @@ stop_processing:
    delete scripts;
    delete objectTools;
    delete summaryTables;
+   delete actions;
 
        DbgPrintf(4, _T("ImportConfig() finished, rcc = %d"), rcc);
        return rcc;
index 858c10d..2294f04 100644 (file)
@@ -9579,6 +9579,17 @@ void ClientSession::exportConfiguration(NXCPMessage *pRequest)
          safe_free(pdwList);
          str.append(_T("\t</dciSummaryTables>\n"));
 
+         // Write actions
+         str.append(_T("\t<actions>\n"));
+         count = pRequest->getFieldAsUInt32(VID_NUM_ACTIONS);
+         pdwList = (UINT32 *)malloc(sizeof(UINT32) * count);
+         pRequest->getFieldAsInt32Array(VID_ACTION_LIST, count, pdwList);
+         for(int i = 0; i < count; i++)
+            CreateActionExportRecord(str, pdwList[i]);
+         safe_free(pdwList);
+         str.append(_T("\t</actions>\n"));
+
+
                        // Close document
                        str += _T("</configuration>\n");
 
index 6c25ad2..d20adcd 100644 (file)
@@ -36,5 +36,7 @@ UINT32 DeleteActionFromDB(UINT32 dwActionId);
 UINT32 ModifyActionFromMessage(NXCPMessage *pMsg);
 void FillActionInfoMessage(NXCPMessage *pMsg, NXC_ACTION *pAction);
 void SendActionsToClient(ClientSession *pSession, UINT32 dwRqId);
+void CreateActionExportRecord(String &xml, UINT32 id);
+bool ImportAction(ConfigEntry *config);
 
 #endif   /* _nms_actions_ */
index a0ad0f3..64f753d 100644 (file)
@@ -11,3 +11,5 @@ Require-Bundle: org.eclipse.rap.ui;bundle-version="2.3.1",
  org.netxms.webui.core;bundle-version="2.0.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
+Export-Package: org.netxms.ui.eclipse.actionmanager.dialogs,
+ org.netxms.ui.eclipse.actionmanager.views.helpers
diff --git a/webui/webapp/ActionManager/src/org/netxms/ui/eclipse/actionmanager/dialogs/ActionSelectionDialog.java b/webui/webapp/ActionManager/src/org/netxms/ui/eclipse/actionmanager/dialogs/ActionSelectionDialog.java
new file mode 100644 (file)
index 0000000..d3dd752
--- /dev/null
@@ -0,0 +1,149 @@
+/**
+ * NetXMS - open source network management system
+ * Copyright (C) 2003-2017 Raden Solutions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.netxms.ui.eclipse.actionmanager.dialogs;
+
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.netxms.client.NXCSession;
+import org.netxms.client.ServerAction;
+import org.netxms.ui.eclipse.actionmanager.Activator;
+import org.netxms.ui.eclipse.actionmanager.dialogs.helpers.ActionSelectionDialogLabelProvider;
+import org.netxms.ui.eclipse.jobs.ConsoleJob;
+import org.netxms.ui.eclipse.shared.ConsoleSharedData;
+import org.netxms.ui.eclipse.tools.WidgetHelper;
+
+/**
+ * Action selection dialog
+ */
+public class ActionSelectionDialog extends Dialog
+{
+   private TableViewer viewer;
+   private List<ServerAction> selection;
+   
+   /**
+    * Action selection dialog construction
+    * @param parentShell parent shell
+    */
+   public ActionSelectionDialog(Shell parentShell)
+   {
+      super(parentShell);
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+    */
+   @Override
+   protected Control createDialogArea(Composite parent)
+   {
+      final Composite dialogArea = (Composite)super.createDialogArea(parent);
+      
+      GridLayout layout = new GridLayout();
+      layout.marginHeight = WidgetHelper.DIALOG_HEIGHT_MARGIN;
+      layout.marginWidth = WidgetHelper.DIALOG_WIDTH_MARGIN;
+      dialogArea.setLayout(layout);
+      
+      viewer = new TableViewer(dialogArea, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
+      viewer.setContentProvider(new ArrayContentProvider());
+      viewer.setLabelProvider(new ActionSelectionDialogLabelProvider());
+      viewer.setComparator(new ViewerComparator() {
+         /* (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)
+         {
+            return ((ServerAction)e1).getName().compareToIgnoreCase(((ServerAction)e2).getName());
+         }
+      });
+      
+      NXCSession session = (NXCSession)ConsoleSharedData.getSession();
+      new ConsoleJob("Get server actions", null, Activator.PLUGIN_ID, null) {
+         @Override
+         protected void runInternal(IProgressMonitor monitor) throws Exception
+         {
+            final List<ServerAction> list = session.getActions();
+            runInUIThread(new Runnable() {
+               @Override
+               public void run()
+               {
+                  viewer.setInput(list.toArray());
+               }
+            });
+         }
+
+         @Override
+         protected String getErrorMessage()
+         {
+            return "Cannot get server actions";
+         }
+      }.start();
+      
+      GridData gd = new GridData();
+      gd.horizontalAlignment = SWT.FILL;
+      gd.verticalAlignment = SWT.FILL;
+      gd.grabExcessHorizontalSpace = true;
+      gd.grabExcessVerticalSpace = true;
+      gd.heightHint = 400;
+      viewer.getControl().setLayoutData(gd);
+      
+      return dialogArea;
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+    */
+   @SuppressWarnings("unchecked")
+   @Override
+   protected void okPressed()
+   {
+      selection = ((IStructuredSelection)viewer.getSelection()).toList();
+      super.okPressed();
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+    */
+   @Override
+   protected void configureShell(Shell newShell)
+   {
+      super.configureShell(newShell);
+      newShell.setText("Select action");
+   }
+   
+   /**
+    * Get selection 
+    * @return the selection
+    */
+   public List<ServerAction> getSelection()
+   {
+      return selection;
+   }
+}
diff --git a/webui/webapp/ActionManager/src/org/netxms/ui/eclipse/actionmanager/dialogs/helpers/ActionSelectionDialogLabelProvider.java b/webui/webapp/ActionManager/src/org/netxms/ui/eclipse/actionmanager/dialogs/helpers/ActionSelectionDialogLabelProvider.java
new file mode 100644 (file)
index 0000000..6814403
--- /dev/null
@@ -0,0 +1,49 @@
+/**
+ * NetXMS - open source network management system
+ * Copyright (C) 2003-2017 Raden Solutions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.netxms.ui.eclipse.actionmanager.dialogs.helpers;
+
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.netxms.client.ServerAction;
+
+/**
+ * Label provider for action selection dialog
+ */
+public class ActionSelectionDialogLabelProvider extends WorkbenchLabelProvider implements ITableLabelProvider
+{
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+    */
+   @Override
+   public Image getColumnImage(Object element, int columnIndex)
+   {
+      return (columnIndex == 0) ? getImage(element) : null;
+   }
+
+   /* (non-Javadoc)
+    * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+    */
+   @Override
+   public String getColumnText(Object element, int columnIndex)
+   {
+      return ((ServerAction)element).getName();
+   }
+
+}
index 219f601..ea9fa88 100644 (file)
@@ -15,5 +15,6 @@ Require-Bundle: org.eclipse.rap.ui;bundle-version="2.3.1",
  org.netxms.ui.eclipse.objectbrowser;bundle-version="2.0.3"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
-Export-Package: org.netxms.ui.eclipse.epp.dialogs
+Export-Package: org.netxms.ui.eclipse.epp.dialogs,
+ org.netxms.ui.eclipse.epp.dialogs.helpers
 Import-Package: org.netxms.ui.eclipse.alarmviewer.widgets
index 415815f..11f0789 100644 (file)
@@ -18,7 +18,8 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.10.0",
  org.netxms.ui.eclipse.epp;bundle-version="2.0.4",
  org.netxms.ui.eclipse.objecttools;bundle-version="2.1.0",
  org.netxms.ui.eclipse.datacollection;bundle-version="2.1.0",
- org.eclipse.rap.filedialog;bundle-version="3.1.0"
+ org.eclipse.rap.filedialog;bundle-version="3.1.0",
+ org.netxms.ui.eclipse.actionmanager;bundle-version="2.0.0"
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-ActivationPolicy: lazy
 Export-Package: org.netxms.ui.eclipse.serverconfig.widgets,
index 9e87263..b1bfff8 100644 (file)
@@ -63,6 +63,7 @@ import org.eclipse.ui.part.ViewPart;
 import org.netxms.base.NXCommon;
 import org.netxms.client.NXCSession;
 import org.netxms.client.Script;
+import org.netxms.client.ServerAction;
 import org.netxms.client.datacollection.DciSummaryTableDescriptor;
 import org.netxms.client.events.EventGroup;
 import org.netxms.client.events.EventObject;
@@ -73,6 +74,9 @@ import org.netxms.client.objects.AbstractObject;
 import org.netxms.client.objects.Template;
 import org.netxms.client.objecttools.ObjectTool;
 import org.netxms.client.snmp.SnmpTrap;
+import org.netxms.ui.eclipse.actionmanager.dialogs.ActionSelectionDialog;
+import org.netxms.ui.eclipse.actionmanager.views.helpers.ActionComparator;
+import org.netxms.ui.eclipse.actionmanager.views.helpers.ActionLabelProvider;
 import org.netxms.ui.eclipse.console.DownloadServiceHandler;
 import org.netxms.ui.eclipse.console.resources.SharedIcons;
 import org.netxms.ui.eclipse.epp.dialogs.RuleSelectionDialog;
@@ -117,6 +121,7 @@ public class ExportFileBuilder extends ViewPart implements ISaveablePart
    private TableViewer scriptViewer;
    private TableViewer toolsViewer;
    private TableViewer summaryTableViewer;
+   private TableViewer actionViewer;
        private Action actionSave;
        private Action actionPublish;
        private Map<Long, EventObject> events = new HashMap<Long, EventObject>();
@@ -126,6 +131,7 @@ public class ExportFileBuilder extends ViewPart implements ISaveablePart
        private Map<Long, Script> scripts = new HashMap<Long, Script>();
        private Map<Long, ObjectTool> tools = new HashMap<Long, ObjectTool>();
    private Map<Integer, DciSummaryTableDescriptor> summaryTables = new HashMap<Integer, DciSummaryTableDescriptor>();
+   private Map<Long, ServerAction> actions = new HashMap<Long, ServerAction>();
        private boolean modified = false;
        private List<SnmpTrap> snmpTrapCache = null;
        private List<EventProcessingPolicyRule> rulesCache = null;
@@ -162,6 +168,7 @@ public class ExportFileBuilder extends ViewPart implements ISaveablePart
                createScriptSection();
                createToolsSection();
       createSummaryTablesSection();
+      createActionsSection();
                
                form.reflow(true);
                
@@ -698,6 +705,68 @@ public class ExportFileBuilder extends ViewPart implements ISaveablePart
          }
       });
    }
+   
+   /**
+    * Create "Actions" section
+    */
+   private void createActionsSection()
+   {
+      Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR);
+      section.setText("Actions");
+      TableWrapData td = new TableWrapData();
+      td.align = TableWrapData.FILL;
+      td.grabHorizontal = true;
+      section.setLayoutData(td);
+      
+      Composite clientArea = toolkit.createComposite(section);
+      GridLayout layout = new GridLayout();
+      layout.numColumns = 2;
+      clientArea.setLayout(layout);
+      section.setClient(clientArea);
+      
+      actionViewer = new TableViewer(clientArea, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER);
+      toolkit.adapt(ruleViewer.getTable());
+      GridData gd = new GridData();
+      gd.horizontalAlignment = SWT.FILL;
+      gd.grabExcessHorizontalSpace = true;
+      gd.verticalAlignment = SWT.FILL;
+      gd.grabExcessVerticalSpace = true;
+      gd.heightHint = 200;
+      gd.verticalSpan = 2;
+      actionViewer.getTable().setLayoutData(gd);
+      actionViewer.setContentProvider(new ArrayContentProvider());
+      actionViewer.setLabelProvider(new ActionLabelProvider());
+      actionViewer.setComparator(new ActionComparator());
+      actionViewer.getTable().setSortDirection(SWT.UP);
+
+      final ImageHyperlink linkAdd = toolkit.createImageHyperlink(clientArea, SWT.NONE);
+      linkAdd.setText(Messages.get().ExportFileBuilder_Add);
+      linkAdd.setImage(SharedIcons.IMG_ADD_OBJECT);
+      gd = new GridData();
+      gd.verticalAlignment = SWT.TOP;
+      linkAdd.setLayoutData(gd);
+      linkAdd.addHyperlinkListener(new HyperlinkAdapter() {
+         @Override
+         public void linkActivated(HyperlinkEvent e)
+         {
+            addActions();
+         }
+      });
+      
+      final ImageHyperlink linkRemove = toolkit.createImageHyperlink(clientArea, SWT.NONE);
+      linkRemove.setText(Messages.get().ExportFileBuilder_Remove);
+      linkRemove.setImage(SharedIcons.IMG_DELETE_OBJECT);
+      gd = new GridData();
+      gd.verticalAlignment = SWT.TOP;
+      linkRemove.setLayoutData(gd);
+      linkRemove.addHyperlinkListener(new HyperlinkAdapter() {
+         @Override
+         public void linkActivated(HyperlinkEvent e)
+         {
+            removeObjects(actionViewer, actions);
+         }
+      });
+   }
 
        /**
         * Create actions
@@ -913,13 +982,18 @@ public class ExportFileBuilder extends ViewPart implements ISaveablePart
       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);
+            final String xml = session.exportConfiguration(descriptionText, eventList, trapList, templateList, ruleList, scriptList, toolList, summaryTableList, actionList);
             runInUIThread(new Runnable() {
                @Override
                public void run()
@@ -1281,6 +1355,21 @@ public class ExportFileBuilder extends ViewPart implements ISaveablePart
    }
    
    /**
+    * Add actions to list
+    */
+   private void addActions()
+   {
+      ActionSelectionDialog dlg = new ActionSelectionDialog(getSite().getShell());
+      if (dlg.open() == Window.OK)
+      {
+         for(ServerAction a : dlg.getSelection())
+            actions.put(a.getId(), a);
+         actionViewer.setInput(actions.values().toArray());
+         setModified();
+      }
+   }
+   
+   /**
     * Export completion handler
     */
    private interface ExportCompletionHandler