Coverage Report - org.mule.tools.visualizer.processor.OutboundFilterProcessor
 
Classes in this File Line Coverage Branch Coverage Complexity
OutboundFilterProcessor
59%
13/22
50%
3/6
2
 
 1  
 /*
 2  
  * $Id: OutboundFilterProcessor.java 7963 2007-08-21 08:53:15Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 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  
      * todo doesn't currently support And/Or logic filters
 40  
      */
 41  
     private void process(Graph graph, Element endpoint, GraphNode endpointNode, GraphNode parent)
 42  
     {
 43  
         // TODO doesn't currently support And/Or logic filters
 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  
 }