Coverage Report - org.kuali.rice.edl.impl.EDLController
 
Classes in this File Line Coverage Branch Coverage Complexity
EDLController
0%
0/47
0%
0/4
1.2
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.edl.impl;
 17  
 
 18  
 import org.apache.log4j.Logger;
 19  
 import org.kuali.rice.core.api.util.xml.XmlJotter;
 20  
 import org.kuali.rice.edl.impl.bo.EDocLiteAssociation;
 21  
 import org.kuali.rice.kew.api.WorkflowRuntimeException;
 22  
 import org.w3c.dom.Document;
 23  
 import org.w3c.dom.Element;
 24  
 
 25  
 import javax.xml.transform.Templates;
 26  
 import java.util.Iterator;
 27  
 import java.util.Map;
 28  
 
 29  
 
 30  
 /**
 31  
  * Responsible for notifying components associated with a particular EDL definition.
 32  
  * 
 33  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 34  
  */
 35  0
 public class EDLController {
 36  
         
 37  0
         private static final Logger LOG = Logger.getLogger(EDLController.class);
 38  
 
 39  
         private EDocLiteAssociation edocLiteAssociation;
 40  
         private Templates style;
 41  
         private Map configProcessors;
 42  
         private Map preProcessors;
 43  
         private Map postProcessors;
 44  
         private Map stateComponents;
 45  
         private EDLGlobalConfig edlGlobalConfig;
 46  
         private Document defaultDOM;
 47  
         private EDLContext edlContext;
 48  
 
 49  
         public Document notifyComponents() {
 50  
                 
 51  
                 try {
 52  0
                         updateDOMWithProcessors(defaultDOM, preProcessors);
 53  0
                         updateDOMWithProcessors(defaultDOM, stateComponents);
 54  0
                         updateDOMWithProcessors(defaultDOM, configProcessors);
 55  0
                         updateDOMWithProcessors(defaultDOM, stateComponents);
 56  0
                         updateDOMWithProcessors(defaultDOM, postProcessors);        
 57  0
                 } catch (Exception e) {
 58  0
                         throw new WorkflowRuntimeException(e);
 59  0
                 }
 60  
                 
 61  
                 
 62  0
                 return defaultDOM;
 63  
         }
 64  
         
 65  
         private void updateDOMWithProcessors(Document dom, Map processors) throws Exception {
 66  
                 
 67  0
                 for (Iterator iter = processors.entrySet().iterator(); iter.hasNext();) {
 68  0
                         Map.Entry processorEntry = (Map.Entry) iter.next();
 69  0
                         Element configElement = (Element)processorEntry.getKey();
 70  0
                         EDLModelComponent eldModelComp = (EDLModelComponent)((Class)processorEntry.getValue()).newInstance();
 71  0
                         eldModelComp.updateDOM(dom, configElement, edlContext);
 72  0
                         if (LOG.isDebugEnabled()) {
 73  0
                                 LOG.debug("Just completed notification to component " + eldModelComp + " doc content looks like. " + XmlJotter.jotNode(dom));
 74  
                         }
 75  
                         
 76  0
                 }
 77  0
         }
 78  
 
 79  
         public Map getConfigProcessors() {
 80  0
                 return configProcessors;
 81  
         }
 82  
         public void setConfigProcessors(Map configProcessors) {
 83  0
                 this.configProcessors = configProcessors;
 84  0
         }
 85  
         public EDLGlobalConfig getEdlGlobalConfig() {
 86  0
                 return edlGlobalConfig;
 87  
         }
 88  
         public void setEdlGlobalConfig(EDLGlobalConfig edlConfig) {
 89  0
                 this.edlGlobalConfig = edlConfig;
 90  0
         }
 91  
         public Templates getStyle() {
 92  0
                 return style;
 93  
         }
 94  
         public void setStyle(Templates style) {
 95  0
                 this.style = style;
 96  0
         }
 97  
         public EDocLiteAssociation getEdocLiteAssociation() {
 98  0
                 return edocLiteAssociation;
 99  
         }
 100  
         public void setEdocLiteAssociation(EDocLiteAssociation edocLiteAssociation) {
 101  0
                 this.edocLiteAssociation = edocLiteAssociation;
 102  0
         }
 103  
         public Document getDefaultDOM() {
 104  0
                 return defaultDOM;
 105  
         }
 106  
         public void setDefaultDOM(Document defaultDOM) {
 107  0
                 this.defaultDOM = defaultDOM;
 108  0
         }
 109  
         public EDLContext getEdlContext() {
 110  0
                 return edlContext;
 111  
         }
 112  
         public void setEdlContext(EDLContext edlContext) {
 113  0
                 this.edlContext = edlContext;
 114  0
         }
 115  
 
 116  
         public Map getPostProcessors() {
 117  0
                 return postProcessors;
 118  
         }
 119  
 
 120  
         public void setPostProcessors(Map postProcessors) {
 121  0
                 this.postProcessors = postProcessors;
 122  0
         }
 123  
 
 124  
         public Map getPreProcessors() {
 125  0
                 return preProcessors;
 126  
         }
 127  
 
 128  
         public void setPreProcessors(Map preProcessors) {
 129  0
                 this.preProcessors = preProcessors;
 130  0
         }
 131  
 
 132  
         public Map getStateComponents() {
 133  0
                 return stateComponents;
 134  
         }
 135  
 
 136  
         public void setStateComponents(Map stateComponents) {
 137  0
                 this.stateComponents = stateComponents;
 138  0
         }
 139  
 }