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