| 1 | 
    
            
    
     | 
    
           | 
  
            
  
    | 2 | 
    
            
    
     | 
    
           | 
  
            
  
    | 3 | 
    
            
    
     | 
    
           | 
  
            
  
    | 4 | 
    
            
    
     | 
    
           | 
  
            
  
    | 5 | 
    
            
    
     | 
    
           | 
  
            
  
    | 6 | 
    
            
    
     | 
    
           | 
  
            
  
    | 7 | 
    
            
    
     | 
    
           | 
  
            
  
    | 8 | 
    
            
    
     | 
    
           | 
  
            
  
    | 9 | 
    
            
    
     | 
    
           | 
  
            
  
    | 10 | 
    
            
    
     | 
    
           | 
  
            
  
    | 11 | 
    
            
    
     | 
    
           | 
  
            
  
    | 12 | 
    
            
    
     | 
    
           | 
  
            
  
    | 13 | 
    
            
    
     | 
    
           | 
  
            
  
    | 14 | 
    
            
    
     | 
    
           | 
  
            
  
    | 15 | 
    
            
    
     | 
    
           | 
  
            
  
    | 16 | 
    
            
    
     | 
    
           | 
  
            
  
    | 17 | 
    
            
    
     | 
    
      package org.kuali.rice.edl.impl;     | 
  
            
  
    | 18 | 
    
            
    
     | 
    
           | 
  
            
  
    | 19 | 
    
            
    
     | 
    
      import java.util.HashMap;     | 
  
            
  
    | 20 | 
    
            
    
     | 
    
      import java.util.Iterator;     | 
  
            
  
    | 21 | 
    
            
    
     | 
    
      import java.util.LinkedHashMap;     | 
  
            
  
    | 22 | 
    
            
    
     | 
    
      import java.util.Map;     | 
  
            
  
    | 23 | 
    
            
    
     | 
    
           | 
  
            
  
    | 24 | 
    
            
    
     | 
    
      import javax.xml.xpath.XPath;     | 
  
            
  
    | 25 | 
    
            
    
     | 
    
      import javax.xml.xpath.XPathConstants;     | 
  
            
  
    | 26 | 
    
            
    
     | 
    
      import javax.xml.xpath.XPathExpressionException;     | 
  
            
  
    | 27 | 
    
            
    
     | 
    
      import javax.xml.xpath.XPathFactory;     | 
  
            
  
    | 28 | 
    
            
    
     | 
    
           | 
  
            
  
    | 29 | 
    
            
    
     | 
    
      import org.kuali.rice.kew.exception.WorkflowRuntimeException;     | 
  
            
  
    | 30 | 
    
            
    
     | 
    
      import org.w3c.dom.Element;     | 
  
            
  
    | 31 | 
    
            
    
     | 
    
      import org.w3c.dom.Node;     | 
  
            
  
    | 32 | 
    
            
    
     | 
    
           | 
  
            
  
    | 33 | 
    
            
    
     | 
    
           | 
  
            
  
    | 34 | 
    
            
    
     | 
    
           | 
  
            
  
    | 35 | 
    
            
    
     | 
    
           | 
  
            
  
    | 36 | 
    
            
    
     | 
    
           | 
  
            
  
    | 37 | 
    
            
    
     | 
    
      @author     | 
  
            
  
    | 38 | 
    
            
    
     | 
    
           | 
  
            
  
    | 39 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 59 (59) | 
           Complexity: 23 | 
           Complexity Density: 0.61 | 
                        
            
        | 
    
  
  
    | 40 | 
    
            
    
     | 
    
      public class EDLGlobalConfig {     | 
  
            
  
    | 41 | 
    
            
    
     | 
    
           | 
  
            
  
    | 42 | 
    
            
    
     | 
    
          private Map preProcessors = new HashMap();     | 
  
            
  
    | 43 | 
    
            
    
     | 
    
          private Map postProcessors = new HashMap();     | 
  
            
  
    | 44 | 
    
            
    
     | 
    
          private Map stateComponents = new HashMap();     | 
  
            
  
    | 45 | 
    
            
    
     | 
    
          private Map configProcessors = new LinkedHashMap();     | 
  
            
  
    | 46 | 
    
            
    
     | 
    
               | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 3 (3) | 
           Complexity: 2 | 
           Complexity Density: 0.67 | 
                        
            
        | 
    
  
  
    | 47 | 
    
           0
    
     | 
    
           public void addPreProcessor(String preProcessorName, Element element) {...     | 
  
            
  
    | 48 | 
    
           0
    
     | 
    
              try {     | 
  
            
  
    | 49 | 
    
           0
    
     | 
    
                  preProcessors.put(Class.forName(preProcessorName), element);         | 
  
            
  
    | 50 | 
    
            
    
     | 
    
              } catch (ClassNotFoundException ce) {     | 
  
            
  
    | 51 | 
    
           0
    
     | 
    
                  throw new WorkflowRuntimeException("Class " + preProcessorName + " not found.", ce);     | 
  
            
  
    | 52 | 
    
            
    
     | 
    
              }     | 
  
            
  
    | 53 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 54 | 
    
            
    
     | 
    
               | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 3 (3) | 
           Complexity: 2 | 
           Complexity Density: 0.67 | 
                        
            
        | 
    
  
  
    | 55 | 
    
           0
    
     | 
    
           public void addPostProcessor(String postProcessorName, Element configElement) {...     | 
  
            
  
    | 56 | 
    
           0
    
     | 
    
              try {     | 
  
            
  
    | 57 | 
    
           0
    
     | 
    
                  postProcessors.put(Class.forName(postProcessorName), configElement);     | 
  
            
  
    | 58 | 
    
            
    
     | 
    
              } catch (ClassNotFoundException ce) {     | 
  
            
  
    | 59 | 
    
           0
    
     | 
    
                  throw new WorkflowRuntimeException("Class " + postProcessorName + " not found.", ce);     | 
  
            
  
    | 60 | 
    
            
    
     | 
    
              }     | 
  
            
  
    | 61 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 62 | 
    
            
    
     | 
    
               | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 3 (3) | 
           Complexity: 2 | 
           Complexity Density: 0.67 | 
                        
            
        | 
    
  
  
    | 63 | 
    
           0
    
     | 
    
           public void addStateComponent(String stateComponentName, Element configElement) {...     | 
  
            
  
    | 64 | 
    
           0
    
     | 
    
              try {     | 
  
            
  
    | 65 | 
    
           0
    
     | 
    
                  stateComponents.put(Class.forName(stateComponentName), configElement);     | 
  
            
  
    | 66 | 
    
            
    
     | 
    
              } catch (ClassNotFoundException ce) {     | 
  
            
  
    | 67 | 
    
           0
    
     | 
    
                  throw new WorkflowRuntimeException("Class " + stateComponentName + " not found.", ce);     | 
  
            
  
    | 68 | 
    
            
    
     | 
    
              }     | 
  
            
  
    | 69 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 70 | 
    
            
    
     | 
    
               | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 9 (9) | 
           Complexity: 3 | 
           Complexity Density: 0.43 | 
                        
            
        | 
    
  
  
    | 71 | 
    
           0
    
     | 
    
           public void addConfigProcessor(String xpathExpression, String configProcessorName) {...     | 
  
            
  
    | 72 | 
    
           0
    
     | 
    
              Class configProcessor;     | 
  
            
  
    | 73 | 
    
           0
    
     | 
    
              try {     | 
  
            
  
    | 74 | 
    
           0
    
     | 
    
                  configProcessor = Class.forName(configProcessorName);     | 
  
            
  
    | 75 | 
    
            
    
     | 
    
              } catch (ClassNotFoundException ce) {     | 
  
            
  
    | 76 | 
    
           0
    
     | 
    
                  throw new WorkflowRuntimeException("Class " + configProcessorName + " not found.", ce);     | 
  
            
  
    | 77 | 
    
            
    
     | 
    
              }     | 
  
            
  
    | 78 | 
    
           0
    
     | 
    
              if (configProcessors.containsKey(configProcessor)) {     | 
  
            
  
    | 79 | 
    
           0
    
     | 
    
                  throw new WorkflowRuntimeException("Config processor " + configProcessorName + " attempted to register an xpath expression twice.  " +     | 
  
            
  
    | 80 | 
    
            
    
     | 
    
                          "The expression being used is " + configProcessors.get(configProcessor));     | 
  
            
  
    | 81 | 
    
            
    
     | 
    
              } else {     | 
  
            
  
    | 82 | 
    
           0
    
     | 
    
                  configProcessors.put(configProcessor, xpathExpression);         | 
  
            
  
    | 83 | 
    
            
    
     | 
    
              }     | 
  
            
  
    | 84 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 85 | 
    
            
    
     | 
    
               | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 1 (1) | 
           Complexity: 1 | 
           Complexity Density: 1 | 
                        
            
        | 
    
  
  
    | 86 | 
    
           0
    
     | 
    
           public Map getPreProcessors() {...     | 
  
            
  
    | 87 | 
    
           0
    
     | 
    
              return preProcessors;     | 
  
            
  
    | 88 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 89 | 
    
            
    
     | 
    
               | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 1 (1) | 
           Complexity: 1 | 
           Complexity Density: 1 | 
                        
            
        | 
    
  
  
    | 90 | 
    
           0
    
     | 
    
           public Map getPostProcessors() {...     | 
  
            
  
    | 91 | 
    
           0
    
     | 
    
              return postProcessors;     | 
  
            
  
    | 92 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 93 | 
    
            
    
     | 
    
               | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 1 (1) | 
           Complexity: 1 | 
           Complexity Density: 1 | 
                        
            
        | 
    
  
  
    | 94 | 
    
           0
    
     | 
    
           public Map getStateComponents() {...     | 
  
            
  
    | 95 | 
    
           0
    
     | 
    
              return stateComponents;     | 
  
            
  
    | 96 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 97 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 20 (20) | 
           Complexity: 6 | 
           Complexity Density: 0.43 | 
                        
            
        | 
    
  
  
    | 98 | 
    
           0
    
     | 
    
           public Class getConfigProcessor(Node configElement) {...     | 
  
            
  
    | 99 | 
    
           0
    
     | 
    
              if (configElement instanceof Element) {     | 
  
            
  
    | 100 | 
    
            
    
     | 
    
           | 
  
            
  
    | 101 | 
    
           0
    
     | 
    
                  XPath xpath = XPathFactory.newInstance().newXPath();     | 
  
            
  
    | 102 | 
    
           0
    
     | 
    
                  String xpathExpression = "";     | 
  
            
  
    | 103 | 
    
           0
    
     | 
    
                  try {     | 
  
            
  
    | 104 | 
    
           0
    
     | 
    
                      for (Iterator iter = configProcessors.entrySet().iterator(); iter.hasNext();) {     | 
  
            
  
    | 105 | 
    
           0
    
     | 
    
                          Map.Entry configProcessor = (Map.Entry) iter.next();     | 
  
            
  
    | 106 | 
    
           0
    
     | 
    
                          xpathExpression = (String) configProcessor.getKey();     | 
  
            
  
    | 107 | 
    
           0
    
     | 
    
                          Boolean match = (Boolean) xpath.evaluate(xpathExpression, configElement, XPathConstants.BOOLEAN);     | 
  
            
  
    | 108 | 
    
           0
    
     | 
    
                          if (match.booleanValue()) {     | 
  
            
  
    | 109 | 
    
           0
    
     | 
    
                              return (Class) configProcessor.getValue();     | 
  
            
  
    | 110 | 
    
            
    
     | 
    
                          }     | 
  
            
  
    | 111 | 
    
            
    
     | 
    
                      }     | 
  
            
  
    | 112 | 
    
           0
    
     | 
    
                      return null;     | 
  
            
  
    | 113 | 
    
            
    
     | 
    
                  } catch (XPathExpressionException e) {     | 
  
            
  
    | 114 | 
    
           0
    
     | 
    
                      throw new WorkflowRuntimeException("Unable to evaluate xpath expression " + xpathExpression, e);     | 
  
            
  
    | 115 | 
    
            
    
     | 
    
                  } catch (Exception ie) {     | 
  
            
  
    | 116 | 
    
           0
    
     | 
    
                      throw new WorkflowRuntimeException(ie);     | 
  
            
  
    | 117 | 
    
            
    
     | 
    
                  }     | 
  
            
  
    | 118 | 
    
            
    
     | 
    
              }     | 
  
            
  
    | 119 | 
    
           0
    
     | 
    
              return null;     | 
  
            
  
    | 120 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 121 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 1 (1) | 
           Complexity: 1 | 
           Complexity Density: 1 | 
                        
            
        | 
    
  
  
    | 122 | 
    
           0
    
     | 
    
           public Map getConfigProcessors() {...     | 
  
            
  
    | 123 | 
    
           0
    
     | 
    
              return configProcessors;     | 
  
            
  
    | 124 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 125 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 1 (1) | 
           Complexity: 1 | 
           Complexity Density: 1 | 
                        
            
        | 
    
  
  
    | 126 | 
    
           0
    
     | 
    
           public void setConfigProcessors(Map configProcessors) {...     | 
  
            
  
    | 127 | 
    
           0
    
     | 
    
              this.configProcessors = configProcessors;     | 
  
            
  
    | 128 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 129 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 1 (1) | 
           Complexity: 1 | 
           Complexity Density: 1 | 
                        
            
        | 
    
  
  
    | 130 | 
    
           0
    
     | 
    
           public void setPostProcessors(Map postProcessors) {...     | 
  
            
  
    | 131 | 
    
           0
    
     | 
    
              this.postProcessors = postProcessors;     | 
  
            
  
    | 132 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 133 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 1 (1) | 
           Complexity: 1 | 
           Complexity Density: 1 | 
                        
            
        | 
    
  
  
    | 134 | 
    
           0
    
     | 
    
           public void setPreProcessors(Map preProcessors) {...     | 
  
            
  
    | 135 | 
    
           0
    
     | 
    
              this.preProcessors = preProcessors;     | 
  
            
  
    | 136 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 137 | 
    
            
    
     | 
    
           | 
  
               
        | 
             
         | 
        
       
        | 
       
           
           
            | 0% | 
           Uncovered Elements: 1 (1) | 
           Complexity: 1 | 
           Complexity Density: 1 | 
                        
            
        | 
    
  
  
    | 138 | 
    
           0
    
     | 
    
           public void setStateComponents(Map stateComponents) {...     | 
  
            
  
    | 139 | 
    
           0
    
     | 
    
              this.stateComponents = stateComponents;     | 
  
            
  
    | 140 | 
    
            
    
     | 
    
          }     | 
  
            
  
    | 141 | 
    
            
    
     | 
    
               | 
  
            
  
    | 142 | 
    
            
    
     | 
    
               | 
  
            
  
    | 143 | 
    
            
    
     | 
    
      }     |