Object tree filter by Object ID issue #1051
authorEriks Jenkevics <eriks@netxms.org>
Tue, 16 Aug 2016 15:58:09 +0000 (18:58 +0300)
committerEriks Jenkevics <eriks@netxms.org>
Tue, 16 Aug 2016 15:58:09 +0000 (18:58 +0300)
ChangeLog
src/java/netxms-eclipse/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/widgets/internal/ObjectFilter.java
webui/webapp/ObjectBrowser/src/org/netxms/ui/eclipse/objectbrowser/widgets/internal/ObjectFilter.java

index e401191..f5e19e0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,7 +16,7 @@
 - Management console
        - New editors for Agent Config Policy and Log Parser Policy. 
        - DCI summary tables with empty menu path not shown in object context menu
-- Fixed issues: #92, #906, #1096, #1187, #1191, #1230, #1237, #1254, #1263
+- Fixed issues: #92, #906, #1051, #1096, #1187, #1191, #1230, #1237, #1254, #1263
 
 
 *
index 0e6cc60..e9a05ef 100644 (file)
@@ -45,6 +45,7 @@ public class ObjectFilter extends ViewerFilter
        private static final int NAME = 1;
        private static final int COMMENTS = 2;
        private static final int IP_ADDRESS = 3;
+       private static final int OBJECT_ID = 4;
        
        private String filterString = null;
        private boolean hideUnmanaged = false;
@@ -109,6 +110,13 @@ public class ObjectFilter extends ViewerFilter
                return ((AccessPoint)object).getIpAddress().getHostAddress().startsWith(filterString);
             }
                           return false;
+                       case OBJECT_ID:
+                          if (object instanceof AbstractObject)
+                          {
+                             long objectID = ((AbstractObject)object).getObjectId();
+                             return String.valueOf(objectID).startsWith(filterString);
+                          }
+            return false;
                        case COMMENTS:
                                return object.getComments().toLowerCase().contains(filterString);
                }
@@ -174,6 +182,11 @@ public class ObjectFilter extends ViewerFilter
                                mode = IP_ADDRESS;
                                this.filterString = filterString.substring(1);
                        }
+                       else if (filterString.charAt(0) == '#')
+                       {
+                          mode = OBJECT_ID;
+                          this.filterString = filterString.substring(1);
+                       }
                        else
                        {
                                mode = NAME;
index 0e6cc60..e9a05ef 100644 (file)
@@ -45,6 +45,7 @@ public class ObjectFilter extends ViewerFilter
        private static final int NAME = 1;
        private static final int COMMENTS = 2;
        private static final int IP_ADDRESS = 3;
+       private static final int OBJECT_ID = 4;
        
        private String filterString = null;
        private boolean hideUnmanaged = false;
@@ -109,6 +110,13 @@ public class ObjectFilter extends ViewerFilter
                return ((AccessPoint)object).getIpAddress().getHostAddress().startsWith(filterString);
             }
                           return false;
+                       case OBJECT_ID:
+                          if (object instanceof AbstractObject)
+                          {
+                             long objectID = ((AbstractObject)object).getObjectId();
+                             return String.valueOf(objectID).startsWith(filterString);
+                          }
+            return false;
                        case COMMENTS:
                                return object.getComments().toLowerCase().contains(filterString);
                }
@@ -174,6 +182,11 @@ public class ObjectFilter extends ViewerFilter
                                mode = IP_ADDRESS;
                                this.filterString = filterString.substring(1);
                        }
+                       else if (filterString.charAt(0) == '#')
+                       {
+                          mode = OBJECT_ID;
+                          this.filterString = filterString.substring(1);
+                       }
                        else
                        {
                                mode = NAME;