1
2
3
4
5
6
7
8
9
10
11
12
13
14
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.kuali.rice.edl.impl.RequestParser;
22 import org.kuali.rice.kew.api.WorkflowDocument;
23 import org.w3c.dom.Document;
24 import org.w3c.dom.Element;
25 import org.w3c.dom.Node;
26
27
28
29
30
31
32
33
34
35 public class InstructionsEDLComponent implements EDLModelComponent {
36
37 public void updateDOM(Document dom, Element configElement, EDLContext edlContext) {
38
39 Element edlElement = EDLXmlUtils.getEDLContent(dom, false);
40 Element edlSubElement = EDLXmlUtils.getOrCreateChildElement(edlElement, "edl", true);
41 WorkflowDocument document = (WorkflowDocument)edlContext.getRequestParser().getAttribute(RequestParser.WORKFLOW_DOCUMENT_SESSION_KEY);
42 edlSubElement.setAttribute("title", document.getTitle());
43
44 if(configElement.getTagName().equals("instructions")) {
45 Node instTextNode = configElement.getChildNodes().item(0);
46 if (instTextNode == null) {
47 return ;
48 }
49 String instructions = instTextNode.getNodeValue();
50 EDLXmlUtils.createTextElementOnParent(edlSubElement, "instructions", instructions);
51 edlElement.setAttribute("title", instructions);
52 } else if (configElement.getTagName().equals("createInstructions")) {
53 Node instTextNode = configElement.getChildNodes().item(0);
54 if (instTextNode == null) {
55 return ;
56 }
57 String instructions = instTextNode.getNodeValue();
58 EDLXmlUtils.createTextElementOnParent(edlSubElement, "createInstructions", instructions);
59 }
60 }
61
62 }