View Javadoc
1   /**
2    * Copyright 2005-2016 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.components;
17  
18  import org.kuali.rice.edl.impl.EDLContext;
19  import org.kuali.rice.edl.impl.EDLModelComponent;
20  import org.kuali.rice.edl.impl.EDLXmlUtils;
21  import org.w3c.dom.Document;
22  import org.w3c.dom.Element;
23  import org.w3c.dom.Node;
24  
25  
26  /**
27   * This class exists solely to propagate the javascript element content into the edl
28   * element of the dom destined to be transformed so the transform can include the specified
29   * javascript.  This is because the EDL definition itself is no longer present in this dom.
30   * 
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   *
33   */
34  public class JavascriptEDLComponent implements EDLModelComponent {
35  
36      public void updateDOM(Document dom, Element configElement, EDLContext edlContext) {
37          
38          Element edlElement = EDLXmlUtils.getEDLContent(dom, false);
39          Element edlSubElement = EDLXmlUtils.getOrCreateChildElement(edlElement, "edl", true);
40          
41          Node n = dom.importNode(configElement, true);
42          edlSubElement.appendChild(n);
43      }
44  }
45