Coverage Report - org.kuali.rice.kew.edl.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.kew.edl;
 18  
 
 19  
 import java.util.Iterator;
 20  
 import java.util.Map;
 21  
 
 22  
 import javax.xml.transform.Templates;
 23  
 
 24  
 import org.apache.log4j.Logger;
 25  
 import org.kuali.rice.kew.edl.bo.EDocLiteAssociation;
 26  
 import org.kuali.rice.kew.exception.WorkflowRuntimeException;
 27  
 import org.kuali.rice.kew.util.XmlHelper;
 28  
 import org.w3c.dom.Document;
 29  
 import org.w3c.dom.Element;
 30  
 
 31  
 
 32  
 /**
 33  
  * Responsible for notifying components associated with a particular EDL definition.
 34  
  * 
 35  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 36  
  */
 37  0
 public class EDLController {
 38  
         
 39  0
         private static final Logger LOG = Logger.getLogger(EDLController.class);
 40  
 
 41  
         private EDocLiteAssociation edocLiteAssociation;
 42  
         private Templates style;
 43  
         private Map configProcessors;
 44  
         private Map preProcessors;
 45  
         private Map postProcessors;
 46  
         private Map stateComponents;
 47  
         private EDLGlobalConfig edlGlobalConfig;
 48  
         private Document defaultDOM;
 49  
         private EDLContext edlContext;
 50  
 
 51  
         public Document notifyComponents() {
 52  
                 
 53  
                 try {
 54  0
                         updateDOMWithProcessors(defaultDOM, preProcessors);
 55  0
                         updateDOMWithProcessors(defaultDOM, stateComponents);
 56  0
                         updateDOMWithProcessors(defaultDOM, configProcessors);
 57  0
                         updateDOMWithProcessors(defaultDOM, stateComponents);
 58  0
                         updateDOMWithProcessors(defaultDOM, postProcessors);        
 59  0
                 } catch (Exception e) {
 60  0
                         throw new WorkflowRuntimeException(e);
 61  0
                 }
 62  
                 
 63  
                 
 64  0
                 return defaultDOM;
 65  
         }
 66  
         
 67  
         private void updateDOMWithProcessors(Document dom, Map processors) throws Exception {
 68  
                 
 69  0
                 for (Iterator iter = processors.entrySet().iterator(); iter.hasNext();) {
 70  0
                         Map.Entry processorEntry = (Map.Entry) iter.next();
 71  0
                         Element configElement = (Element)processorEntry.getKey();
 72  0
                         EDLModelComponent eldModelComp = (EDLModelComponent)((Class)processorEntry.getValue()).newInstance();
 73  0
                         eldModelComp.updateDOM(dom, configElement, edlContext);
 74  0
                         if (LOG.isDebugEnabled()) {
 75  0
                                 LOG.debug("Just completed notification to component " + eldModelComp + " doc content looks like. " + XmlHelper.jotNode(dom));
 76  
                         }
 77  
                         
 78  0
                 }
 79  0
         }
 80  
 
 81  
         public Map getConfigProcessors() {
 82  0
                 return configProcessors;
 83  
         }
 84  
         public void setConfigProcessors(Map configProcessors) {
 85  0
                 this.configProcessors = configProcessors;
 86  0
         }
 87  
         public EDLGlobalConfig getEdlGlobalConfig() {
 88  0
                 return edlGlobalConfig;
 89  
         }
 90  
         public void setEdlGlobalConfig(EDLGlobalConfig edlConfig) {
 91  0
                 this.edlGlobalConfig = edlConfig;
 92  0
         }
 93  
         public Templates getStyle() {
 94  0
                 return style;
 95  
         }
 96  
         public void setStyle(Templates style) {
 97  0
                 this.style = style;
 98  0
         }
 99  
         public EDocLiteAssociation getEdocLiteAssociation() {
 100  0
                 return edocLiteAssociation;
 101  
         }
 102  
         public void setEdocLiteAssociation(EDocLiteAssociation edocLiteAssociation) {
 103  0
                 this.edocLiteAssociation = edocLiteAssociation;
 104  0
         }
 105  
         public Document getDefaultDOM() {
 106  0
                 return defaultDOM;
 107  
         }
 108  
         public void setDefaultDOM(Document defaultDOM) {
 109  0
                 this.defaultDOM = defaultDOM;
 110  0
         }
 111  
         public EDLContext getEdlContext() {
 112  0
                 return edlContext;
 113  
         }
 114  
         public void setEdlContext(EDLContext edlContext) {
 115  0
                 this.edlContext = edlContext;
 116  0
         }
 117  
 
 118  
         public Map getPostProcessors() {
 119  0
                 return postProcessors;
 120  
         }
 121  
 
 122  
         public void setPostProcessors(Map postProcessors) {
 123  0
                 this.postProcessors = postProcessors;
 124  0
         }
 125  
 
 126  
         public Map getPreProcessors() {
 127  0
                 return preProcessors;
 128  
         }
 129  
 
 130  
         public void setPreProcessors(Map preProcessors) {
 131  0
                 this.preProcessors = preProcessors;
 132  0
         }
 133  
 
 134  
         public Map getStateComponents() {
 135  0
                 return stateComponents;
 136  
         }
 137  
 
 138  
         public void setStateComponents(Map stateComponents) {
 139  0
                 this.stateComponents = stateComponents;
 140  0
         }
 141  
 }