Builds a map with the filters for all layers that are used in the given criterion.

@param critter criterion
@param mapModel map model
@return filters for all layers
977308
public static Map<String, String> getLayerFiltersForCriterion(Criterion critter, MapModel mapModel) {
		Map<String, String> filters = new HashMap<String, String>();
		Set<String> serverLayerIds = new HashSet<String>();
		critter.serverLayerIdVisitor(serverLayerIds);

		for (VectorLayer vectorLayer : mapModel.getVectorLayers()) {
			if (serverLayerIds.contains(vectorLayer.getServerLayerId())) {
				if (vectorLayer.getFilter() != null && !"".equals(vectorLayer.getFilter())) {
					filters.put(vectorLayer.getServerLayerId(), vectorLayer.getFilter());
				}
			}
		}
		return filters;
	}
187840
@SuppressWarnings("rawtypes")
    public static StateFactory opaque(CqlRowMapper mapper) {
        Options<OpaqueValue> options = new Options<OpaqueValue>();
        return opaque(mapper, options);
    }
1167594
private Map<VectorLayer, Filter> dtoAttributeCriterionToFilters(AttributeCriterion criterion)
			throws GeomajasException {
		Map<VectorLayer, Filter> filters = new LinkedHashMap<VectorLayer, Filter>();
		Filter f;
		VectorLayer l = configurationService.getVectorLayer(criterion.getServerLayerId());
		if (l == null) {
			throw new GeomajasException(ExceptionCode.LAYER_NOT_FOUND, criterion.getServerLayerId());
		}

		String operator = criterion.getOperator();
		if ("LIKE".equals(operator.toUpperCase())) {
			f = filterService.createLikeFilter(criterion.getAttributeName(), criterion.getValue());
		} else if ("DURING".equals(operator.toUpperCase()) || "BEFORE".equals(operator.toUpperCase())
				|| "AFTER".equals(operator.toUpperCase())) {
			f = filterService.parseFilter(criterion.toString()); // In case of a date filter
		} else {
			f = filterService.createCompareFilter(criterion.getAttributeName(), criterion.getOperator(),
					criterion.getValue());
		}

		filters.put(l, f);
		return filters;
	}
1064504
private SortedMap<String, ModelProperty> sort(Map<String, ModelProperty> modelProperties) {

    SortedMap<String, ModelProperty> sortedMap = new TreeMap<String, ModelProperty>(defaultOrdering(modelProperties));
    sortedMap.putAll(modelProperties);
    return sortedMap;
  }
284227
public static Collection map(Mapper mapper, Enumeration en) {
        return map(mapper, en, false);
    }
800939
@Override
    public List<Metric> filter(Map<Metric, String> extendedSortedMap, String limit) {
        SystemAssert.requireArgument(extendedSortedMap != null && !extendedSortedMap.isEmpty(), "New map is not constructed successfully!");
        SystemAssert.requireArgument(limit != null && !limit.equals(""), "Limit must be provided!");

        List<Metric> result = new ArrayList<Metric>();

        for (Map.Entry<Metric, String> entry : extendedSortedMap.entrySet()) {
            if (Double.parseDouble(limit) > Double.parseDouble(entry.getValue())) {
                result.add(entry.getKey());
            }
        }
        return result;
    }
317891
public static Collection<String> filterClassesBasedOnBeansXML(BeansXml beansXml, final ResourceLoader resourceLoader, Set<String> classes) {
        if (beansXml != null && beansXml.getBeanDiscoveryMode().equals(BeanDiscoveryMode.NONE)) {
            // if the integrator for some reason ignored the "none" flag make sure we do not process the archive
            return Collections.emptySet();
        }
        Function<Metadata<Filter>, Predicate<String>> filterToPredicateFunction = new Function<Metadata<Filter>, Predicate<String>>() {

            @Override
            public Predicate<String> apply(Metadata<Filter> from) {
                return new FilterPredicate(from, resourceLoader);
            }

        };
        Collection<String> classNames;
        if (beansXml != null && beansXml.getScanning() != null) {
            Collection<Metadata<Filter>> includeFilters;
            if (beansXml.getScanning().getIncludes() != null) {
                includeFilters = beansXml.getScanning().getIncludes();
            } else {
                includeFilters = Collections.emptyList();
            }
            Collection<Metadata<Filter>> excludeFilters;
            if (beansXml.getScanning().getExcludes() != null) {
                excludeFilters = beansXml.getScanning().getExcludes();
            } else {
                excludeFilters = Collections.emptyList();
            }
            /*
             * Take a copy of the transformed collection, this means that the
             * filter predicate is only built once per filter predicate
             */
            Collection<Predicate<String>> includes;
            if (includeFilters.isEmpty()) {
                includes = Collections.emptyList();
            } else {
                includes = new ArrayList<Predicate<String>>(includeFilters.size());
                for (Metadata<Filter> includeFilter : includeFilters) {
                    includes.add(filterToPredicateFunction.apply(includeFilter));
                }
            }
            Collection<Predicate<String>> excludes;
            if (excludeFilters.isEmpty()) {
                excludes = Collections.emptyList();
            } else {
                excludes = new ArrayList<Predicate<String>>(excludeFilters.size());
                for (Metadata<Filter> excludeFilter : excludeFilters) {
                    excludes.add(filterToPredicateFunction.apply(excludeFilter));
                }
            }
            Predicate<String> filters = new ScanningPredicate<String>(includes, excludes);
            classNames = new HashSet<>();
            for (String beanClass : classes) {
                if (filters.test(beanClass)) {
                    classNames.add(beanClass);
                }
            }
        } else {
            classNames = classes;
        }
        return classNames;
    }
780287
private String[] getServerLayerIds(MapModel mapModel) {
		List<String> layerIds = new ArrayList<String>();
		for (Layer<?> layer : mapModel.getLayers()) {
			if (layer.isShowing()) {
				layerIds.add(layer.getServerLayerId());
			}
		}
		return layerIds.toArray(new String[layerIds.size()]);
	}
1116766
private void buildTree(MapModel mapModel) {
		treeGrid.setWidth100();
		treeGrid.setHeight100();
		treeGrid.setShowHeader(false);
		tree = new RefreshableTree();
		final TreeNode nodeRoot = new TreeNode("ROOT");
		tree.setRoot(nodeRoot); // invisible ROOT node (ROOT node is required)

		ClientLayerTreeInfo layerTreeInfo = mapModel.getMapInfo().getLayerTree();
		if (layerTreeInfo != null) {
			ClientLayerTreeNodeInfo treeNode = layerTreeInfo.getTreeNode();
			processNode(treeNode, nodeRoot, tree, mapModel, false);
		}

		treeGrid.setData(tree);
		treeGrid.addLeafClickHandler(this);
		treeGrid.addFolderClickHandler(this);

		// -- add event listeners to layers
		for (Layer<?> layer : mapModel.getLayers()) {
			registrations.add(layer.addLayerChangedHandler(new LayerChangedHandler() {
				public void onLabelChange(LayerLabeledEvent event) {
				}

				public void onVisibleChange(LayerShownEvent event) {
					for (TreeNode node : tree.getAllNodes()) {
						if (node.getName().equals(event.getLayer().getLabel())) {
							if (node instanceof LayerTreeTreeNode) {
								((LayerTreeTreeNode) node).updateIcon();
							}
						}
					}
				}
			}));
		}
	}
822391
public static List<ModelAnnotation> buildAnnotationList(final Element element, final AnnotationFilter filter) {
		final List<ModelAnnotation> annotationList=new ArrayList<>();
		
		forEachAnnotations(element, filter, new AnnotationFoundListener() {

			@Override
			public void onAcceptAnnotation(Element executableMethod, String annotationClassName, Map<String, String> attributes) {
				ModelAnnotation annotation = new ModelAnnotation(annotationClassName, attributes);
				
				annotationList.add(annotation);
			}
		});
		
		return annotationList;
	}
313376
public void addMappingFilter(String mapping, com.ibm.websphere.servlet.filter.IFilterConfig config){
        	context.addMappingFilter(mapping, config);
        }
1101418
public static List<String> getVisibleServerLayerIds(MapModel mapModel) {
		List<String> layerIds = new ArrayList<String>();
		for (VectorLayer layer : mapModel.getVectorLayers()) {
			if (layer.isShowing()) {
				layerIds.add(layer.getServerLayerId());
			}
		}
		return layerIds;
	}
523657
private static <K, V> BiMap<K, V> filterFiltered(
      FilteredEntryBiMap<K, V> map, Predicate<? super Entry<K, V>> entryPredicate) {
    Predicate<Entry<K, V>> predicate = Predicates.and(map.predicate, entryPredicate);
    return new FilteredEntryBiMap<K, V>(map.unfiltered(), predicate);
  }
1353971
public void addFilterModel(final FilterModel model) {
		if (model.getUrlPatterns() != null) {
			try {
				filterLock.writeLock().lock();
				associateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
				for (String virtualHost : resolveVirtualHosts(model)) {
					for (String urlPattern : model.getUrlPatterns()) {
							final UrlPattern newUrlPattern = new UrlPattern(getFullPath(model.getContextModel(), urlPattern),
											model);
							String fullPath = getFullPath(model.getContextModel(), urlPattern);
							if (filterUrlPatterns.get(virtualHost) == null) {
								filterUrlPatterns.put(virtualHost, new ConcurrentHashMap<>());
							}
							Set<UrlPattern> urlSet = filterUrlPatterns.get(virtualHost).get(fullPath);
							if (urlSet == null) {
									//initialize first
									urlSet = new HashSet<>();
							}
							urlSet.add(newUrlPattern);
							filterUrlPatterns.get(virtualHost).put(fullPath, urlSet);
    //					final UrlPattern existingPattern = filterUrlPatterns.putIfAbsent(
    //							getFullPath(model.getContextModel(), urlPattern), newUrlPattern);
    //					if (existingPattern != null) {
    //						// this should never happen but is a good assertion
    //						LOG.error("Internal error (please report): Cannot associate url mapping "
    //								+ getFullPath(model.getContextModel(), urlPattern) + " to " + newUrlPattern
    //								+ " because is already associated to " + existingPattern);
    //					}
                                    }
                                }
			} finally {
				filterLock.writeLock().unlock();
			}
		}
	}
360730
@SuppressWarnings("ConstantConditions")
  ImmutableSetMultimap<K,V> toImmutableSetMultimap() {
    final ImmutableSetMultimap.Builder<K, V>  ret = ImmutableSetMultimap.builder();

    for (final MultimapEntry<K, V> entry : entries) {
      ret.putAll(entry.key, entry.values);
    }

    return ret.build();
  }
896848
@Override
	public M filter(BiPredicate<? super K, ? super V> filter) {
		MapBuilder<K, V, M> builder = builder();
		for (java.util.Map.Entry<K, V> entry : entrySet()) {
			if(filter.test(entry.getKey(), entry.getValue())) {
				builder.put(entry.getKey(), entry.getValue());
			}
		}
		return builder.build();
	}
634085
public static ObjectMapper configFilterIntrospector(final ObjectMapper mapper) {
        final AnnotationIntrospector customIntrospector = mapper.getSerializationConfig().getAnnotationIntrospector();
        // Set the custom (user) introspector to be the primary one.
        return mapper.setAnnotationIntrospector(AnnotationIntrospector.pair(customIntrospector,
                new JacksonAnnotationIntrospector() {
                    @Override
                    public Object findFilterId(final Annotated a) {
                        final Object filterId = super.findFilterId(a);

                        if (filterId != null) {
                            return filterId;
                        }

                        if (a instanceof AnnotatedMethod) {
                            final Method method = ((AnnotatedMethod) a).getAnnotated();

                            // Interested only in getters - trying to obtain "field" name from them.
                            if (ReflectionHelper.isGetter(method)) {
                                return ReflectionHelper.getPropertyName(method);
                            }
                        }
                        if (a instanceof AnnotatedField || a instanceof AnnotatedClass) {
                            return a.getName();
                        }

                        return null;
                    }
                }));

    }