1
2
3
4
5
6
7
8
9
10
11 package org.mule.tools.visualizer.processor;
12
13 import org.mule.tools.visualizer.config.ColorRegistry;
14 import org.mule.tools.visualizer.config.GraphEnvironment;
15 import org.mule.tools.visualizer.util.MuleTag;
16
17 import com.oy.shared.lm.graph.Graph;
18 import com.oy.shared.lm.graph.GraphNode;
19
20 import org.jdom.Element;
21
22 public class OutboundFilterProcessor extends TagProcessor
23 {
24
25 private GraphNode endpointNode;
26
27 public OutboundFilterProcessor(GraphEnvironment environment, GraphNode endpointNode)
28 {
29 super(environment);
30 this.endpointNode = endpointNode;
31 }
32
33 public void process(Graph graph, Element currentElement, GraphNode parent)
34 {
35 process(graph, currentElement, endpointNode, parent);
36 }
37
38
39
40
41 private void process(Graph graph, Element endpoint, GraphNode endpointNode, GraphNode parent)
42 {
43
44 Element filter = endpoint.getChild(MuleTag.ELEMENT_FILTER);
45 if (filter == null)
46 {
47 filter = endpoint.getChild(MuleTag.ELEMENT_LEFT_FILTER);
48 }
49 if (filter == null)
50 {
51 filter = endpoint.getChild(MuleTag.ELEMENT_RIGHT_FILTER);
52 }
53
54 if (filter != null)
55 {
56 GraphNode filterNode = graph.addNode();
57 filterNode.getInfo().setHeader(filter.getAttributeValue(MuleTag.ATTRIBUTE_CLASS_NAME));
58 filterNode.getInfo().setFillColor(ColorRegistry.COLOR_FILTER);
59 StringBuffer caption = new StringBuffer();
60 appendProperties(filter, caption);
61 filterNode.getInfo().setCaption(caption.toString());
62
63 process(graph, filter, filterNode, parent);
64 addEdge(graph, filterNode, endpointNode, "out", isTwoWay(endpoint));
65
66 }
67 else
68 {
69 addEdge(graph, parent, endpointNode, "filters on", isTwoWay(endpoint));
70 }
71 }
72 }