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 | 4 | super(environment); |
30 | 4 | this.endpointNode = endpointNode; |
31 | 4 | } |
32 | |
|
33 | |
public void process(Graph graph, Element currentElement, GraphNode parent) |
34 | |
{ |
35 | 4 | process(graph, currentElement, endpointNode, parent); |
36 | 4 | } |
37 | |
|
38 | |
|
39 | |
|
40 | |
|
41 | |
private void process(Graph graph, Element endpoint, GraphNode endpointNode, GraphNode parent) |
42 | |
{ |
43 | |
|
44 | 4 | Element filter = endpoint.getChild(MuleTag.ELEMENT_FILTER); |
45 | 4 | if (filter == null) |
46 | |
{ |
47 | 4 | filter = endpoint.getChild(MuleTag.ELEMENT_LEFT_FILTER); |
48 | |
} |
49 | 4 | if (filter == null) |
50 | |
{ |
51 | 4 | filter = endpoint.getChild(MuleTag.ELEMENT_RIGHT_FILTER); |
52 | |
} |
53 | |
|
54 | 4 | if (filter != null) |
55 | |
{ |
56 | 0 | GraphNode filterNode = graph.addNode(); |
57 | 0 | filterNode.getInfo().setHeader(filter.getAttributeValue(MuleTag.ATTRIBUTE_CLASS_NAME)); |
58 | 0 | filterNode.getInfo().setFillColor(ColorRegistry.COLOR_FILTER); |
59 | 0 | StringBuffer caption = new StringBuffer(); |
60 | 0 | appendProperties(filter, caption); |
61 | 0 | filterNode.getInfo().setCaption(caption.toString()); |
62 | |
|
63 | 0 | process(graph, filter, filterNode, parent); |
64 | 0 | addEdge(graph, filterNode, endpointNode, "out", isTwoWay(endpoint)); |
65 | |
|
66 | 0 | } |
67 | |
else |
68 | |
{ |
69 | 4 | addEdge(graph, parent, endpointNode, "filters on", isTwoWay(endpoint)); |
70 | |
} |
71 | 4 | } |
72 | |
} |