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 InboundFilterProcessor extends TagProcessor |
23 | |
{ |
24 | |
|
25 | |
private GraphNode endpointNode; |
26 | |
|
27 | |
public InboundFilterProcessor(GraphEnvironment environment, GraphNode endpointNode) |
28 | |
{ |
29 | 8 | super(environment); |
30 | 8 | this.endpointNode = endpointNode; |
31 | 8 | } |
32 | |
|
33 | |
public void process(Graph graph, Element currentElement, GraphNode parent) |
34 | |
{ |
35 | 0 | processInboundFilter(graph, currentElement, endpointNode, parent); |
36 | 0 | } |
37 | |
|
38 | |
public void processInboundFilter(Graph graph, Element endpoint, GraphNode endpointNode, GraphNode parent) |
39 | |
{ |
40 | 8 | Element filter = endpoint.getChild(MuleTag.ELEMENT_FILTER); |
41 | 8 | boolean conditional = false; |
42 | |
|
43 | 8 | if (filter == null) |
44 | |
{ |
45 | 8 | filter = endpoint.getChild(MuleTag.ELEMENT_LEFT_FILTER); |
46 | 8 | conditional = filter != null; |
47 | |
} |
48 | |
|
49 | 8 | if (filter != null) |
50 | |
{ |
51 | |
|
52 | 0 | GraphNode filterNode = graph.addNode(); |
53 | 0 | filterNode.getInfo().setHeader(filter.getAttributeValue(MuleTag.ATTRIBUTE_CLASS_NAME)); |
54 | 0 | filterNode.getInfo().setFillColor(ColorRegistry.COLOR_FILTER); |
55 | 0 | StringBuffer caption = new StringBuffer(); |
56 | 0 | appendProperties(filter, caption); |
57 | 0 | filterNode.getInfo().setCaption(caption.toString()); |
58 | |
|
59 | |
|
60 | 0 | if (conditional) |
61 | |
{ |
62 | 0 | filter = endpoint.getChild(MuleTag.ELEMENT_RIGHT_FILTER); |
63 | 0 | GraphNode filterNode2 = graph.addNode(); |
64 | 0 | filterNode2.getInfo().setHeader(filter.getAttributeValue(MuleTag.ATTRIBUTE_CLASS_NAME)); |
65 | 0 | filterNode2.getInfo().setFillColor(ColorRegistry.COLOR_FILTER); |
66 | 0 | StringBuffer caption2 = new StringBuffer(); |
67 | 0 | appendProperties(filter, caption2); |
68 | 0 | filterNode2.getInfo().setCaption(caption2.toString()); |
69 | 0 | addEdge(graph, endpointNode, filterNode2, "filters on", isTwoWay(endpoint)); |
70 | |
} |
71 | 0 | processInboundFilter(graph, filter, filterNode, parent); |
72 | |
|
73 | 0 | addEdge(graph, endpointNode, filterNode, "filters on", isTwoWay(endpoint)); |
74 | 0 | } |
75 | |
else |
76 | |
{ |
77 | 8 | addEdge(graph, endpointNode, parent, "in", isTwoWay(endpoint)); |
78 | |
} |
79 | 8 | } |
80 | |
|
81 | |
} |