/** * This method exports the single pattern decision instance to the XML. It MUST be called by an * XML exporter, as this will not have a complete header. * * @param ratDoc The ratDoc generated by the XML exporter * @return the SAX representation of the object. */ public Element toXML(Document ratDoc) { Element decisionE; RationaleDB db = RationaleDB.getHandle(); // Now, add pattern to doc String entryID = db.getRef(this); if (entryID == null) { entryID = db.addPatternDecisionRef(this); } decisionE = ratDoc.createElement("DR:patternDecision"); decisionE.setAttribute("rid", entryID); decisionE.setAttribute("name", name); decisionE.setAttribute("type", type.toString()); decisionE.setAttribute("phase", devPhase.toString()); decisionE.setAttribute("status", status.toString()); // decisionE.setAttribute("artifact", artifact); Element descE = ratDoc.createElement("description"); Text descText = ratDoc.createTextNode(description); descE.appendChild(descText); decisionE.appendChild(descE); // Add child pattern references... Iterator<Pattern> cpi = candidatePatterns.iterator(); while (cpi.hasNext()) { Pattern cur = cpi.next(); Element curE = ratDoc.createElement("refChildPattern"); Text curText = ratDoc.createTextNode("p" + new Integer(cur.getID()).toString()); curE.appendChild(curText); decisionE.appendChild(curE); } return decisionE; }