Esempio n. 1
0
  /**
   * Reads in a decision stored in XML.
   *
   * @param decN - the XML element.
   */
  public void fromXML(Element decN) {
    this.fromXML = true;

    RationaleDB db = RationaleDB.getHandle();

    String rid = decN.getAttribute("rid");
    id = Integer.parseInt(rid.substring(2));

    name = decN.getAttribute("name");

    type = DecisionType.fromString(decN.getAttribute("type"));

    devPhase = Phase.fromString(decN.getAttribute("phase"));

    status = DecisionStatus.fromString(decN.getAttribute("status"));

    Node child = decN.getFirstChild();
    importHelper(child);

    Node nextNode = child.getNextSibling();
    while (nextNode != null) {
      importHelper(nextNode);
      nextNode = nextNode.getNextSibling();
    }

    db.addPatternDecisionFromXML(this);
  }
Esempio n. 2
0
 /**
  * This is just a helper function for the fromXML method.
  *
  * @param child
  */
 public void importHelper(Node child) {
   if (child.getFirstChild() instanceof Text) {
     Text text = (Text) child.getFirstChild();
     String data = text.getData();
     if (child.getNodeName().equals("description")) {
       setDescription(data);
     }
     if (child.getNodeName().equals("refChildPattern")) {
       int decID = Integer.parseInt(data.substring(1));
       subPatternsID.add(decID);
     }
   }
 }