001    /**
002     * Copyright 2005-2011 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.edl.impl.components;
017    
018    import org.kuali.rice.edl.impl.EDLContext;
019    import org.kuali.rice.edl.impl.EDLModelComponent;
020    import org.kuali.rice.edl.impl.EDLXmlUtils;
021    import org.w3c.dom.Document;
022    import org.w3c.dom.Element;
023    import org.w3c.dom.Node;
024    
025    
026    /**
027     * This class exists solely to propagate the javascript element content into the edl
028     * element of the dom destined to be transformed so the transform can include the specified
029     * javascript.  This is because the EDL definition itself is no longer present in this dom.
030     * 
031     * @author Kuali Rice Team (rice.collab@kuali.org)
032     *
033     */
034    public class JavascriptEDLComponent implements EDLModelComponent {
035    
036        public void updateDOM(Document dom, Element configElement, EDLContext edlContext) {
037            
038            Element edlElement = EDLXmlUtils.getEDLContent(dom, false);
039            Element edlSubElement = EDLXmlUtils.getOrCreateChildElement(edlElement, "edl", true);
040            
041            Node n = dom.importNode(configElement, true);
042            edlSubElement.appendChild(n);
043        }
044    }
045