1
2
3
4
5
6
7 package nl.mineleni.cbsviewer.servlet.wms;
8
9 import nl.mineleni.cbsviewer.util.AvailableLayersBean;
10
11
12
13
14
15
16
17 public class AttributesNamesFilter {
18
19
20
21 private final transient AvailableLayersBean layers = new AvailableLayersBean();
22
23
24
25
26
27
28
29
30
31
32
33 public String filterValue(final String attribute, final String layerID) {
34 if (this.hasFilters(layerID)) {
35 final String[] aliases = this.layers.getLayerByID(layerID)
36 .getAliases().split(",\\s*");
37 final String[] attributes = this.layers.getLayerByID(layerID)
38 .getAttributes().split(",\\s*");
39
40 for (int i = 0; i < attributes.length; i++) {
41 if (attributes[i].equals(attribute)) {
42 return aliases[i];
43 }
44 }
45 }
46 return attribute;
47 }
48
49
50
51
52
53
54
55
56
57 private boolean hasFilters(final String layerID) {
58 return (null != this.layers.getLayerByID(layerID).getAliases());
59 }
60 }