1 18 package org.apache.activemq.console.filter; 19 20 import java.util.Set ; 21 import java.util.Map ; 22 import java.util.HashMap ; 23 import java.util.Iterator ; 24 25 public class GroupPropertiesViewFilter extends PropertiesViewFilter { 26 27 31 public GroupPropertiesViewFilter(QueryFilter next) { 32 super(next); 33 } 34 35 40 public GroupPropertiesViewFilter(Set groupView, QueryFilter next) { 41 super(groupView, next); 42 } 43 44 49 protected Map filterView(Map data) { 50 if (viewFilter == null || viewFilter.isEmpty()) { 52 return data; 53 } 54 55 Map newData; 56 try { 57 newData = (Map )data.getClass().newInstance(); 59 } catch (Exception e) { 60 newData = new HashMap (); 62 } 63 64 for (Iterator i=data.keySet().iterator(); i.hasNext();) { 66 String key = (String )i.next(); 67 68 for (Iterator j=viewFilter.iterator(); j.hasNext();) { 70 String group = (String )j.next(); 71 if (key.startsWith(group)) { 72 newData.put(key, data.get(key)); 73 break; 74 } 75 } 76 } 77 78 return newData; 79 } 80 } 81 | Popular Tags |