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