Coverage Report - org.kuali.rice.kew.xml.export.HelpEntryXmlExporter
 
Classes in this File Line Coverage Branch Coverage Complexity
HelpEntryXmlExporter
0%
0/17
0%
0/4
2.5
 
 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.xml.export;
 18  
 
 19  
 import java.util.Iterator;
 20  
 
 21  
 import org.jdom.Element;
 22  
 import org.kuali.rice.kew.export.ExportDataSet;
 23  
 import org.kuali.rice.kew.help.HelpEntry;
 24  
 import org.kuali.rice.kew.xml.XmlConstants;
 25  
 import org.kuali.rice.kew.xml.XmlRenderer;
 26  
 
 27  
 
 28  
 /**
 29  
  * Exports {@link HelpEntry}s to XML.
 30  
  *
 31  
  * @see HelpEntry
 32  
  *
 33  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 34  
  */
 35  0
 public class HelpEntryXmlExporter implements XmlExporter, XmlConstants {
 36  
 
 37  0
     protected final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(getClass());
 38  
     
 39  0
     private XmlRenderer renderer = new XmlRenderer(HELP_NAMESPACE);
 40  
     
 41  
     public Element export(ExportDataSet dataSet) {
 42  0
         if (!dataSet.getHelp().isEmpty()) {
 43  0
             Element rootElement = renderer.renderElement(null, HELP_ENTRIES);
 44  0
             rootElement.setAttribute(SCHEMA_LOCATION_ATTR, HELP_SCHEMA_LOCATION, SCHEMA_NAMESPACE);
 45  0
             for (Iterator iterator = dataSet.getHelp().iterator(); iterator.hasNext();) {
 46  0
                 HelpEntry helpEntry = (HelpEntry)iterator.next();
 47  0
                 exportHelpEntry(rootElement, helpEntry);
 48  0
             }
 49  0
             return rootElement;
 50  
         }
 51  0
         return null;
 52  
     }
 53  
     
 54  
     private void exportHelpEntry(Element parent, HelpEntry helpEntry) {
 55  0
         Element helpElement = renderer.renderElement(parent, HELP_ENTRY);
 56  0
         renderer.renderTextElement(helpElement, HELP_NAME, helpEntry.getHelpName());
 57  0
         renderer.renderTextElement(helpElement, HELP_KEY, helpEntry.getHelpKey());
 58  0
         renderer.renderCDATAElement(helpElement, HELP_TEXT, helpEntry.getHelpText());
 59  0
     }
 60  
     
 61  
 }