Example #1
0
 @Override
 public void startDocument() {
   artf = new Artifact();
   artf.setComments(new ArrayList<Comment>());
   artf.setAssociations(new ArrayList<Association>());
   artf.setCommitFiles(new ArrayList<String>());
 }
Example #2
0
  @Override
  public void startElement(String uri, String localName, String qName, Attributes attributes)
      throws SAXException {
    this.elementStack.push(qName);

    if (qName.equalsIgnoreCase("comment")) {
      comment = new Comment();
      artf.getComments().add(comment);
    } else if (qName.equalsIgnoreCase("association")) {
      association = new Association();
      artf.getAssociations().add(association);
    }
  }
Example #3
0
  @Override
  public void endElement(String uri, String localName, String qName) throws SAXException {

    String currentParent = this.currentParentElem();
    String current = this.currentElem();

    if (currentParent != null) {
      String value = sb.toString().trim();
      //			System.out.println("parent: " + currentParent + ", current: " + current + ", value: " +
      // value);
      if (currentParent.equalsIgnoreCase("artifact")) {
        if (current.equalsIgnoreCase("id")) {
          artf.setId(value);
        } else if (current.equalsIgnoreCase("assignedTo")) {
          artf.setAssignedTo(value);
        } else if (current.equalsIgnoreCase("category")) {
          artf.setCategory(value);
        } else if (current.equalsIgnoreCase("createdDate")) {
          artf.setCreatedDate(null); // TODO: fix this
        } else if (current.equalsIgnoreCase("closeDate")) {
          artf.setCloseDate(null); // TODO: fix this
        } else if (current.equalsIgnoreCase("description")) {
          artf.setDescription(value);
        } else if (current.equalsIgnoreCase("planningFolderId")) {
          artf.setPlanningFolderId(value);
        } else if (current.equalsIgnoreCase("path")) {
          artf.setPath(value);
        } else if (current.equalsIgnoreCase("title")) {
          artf.setTitle(value);
        } else if (current.equalsIgnoreCase("impactAnalysis")) {
          artf.setImpactAnalysis(value);
        } else if (current.equalsIgnoreCase("triage")) {
          artf.setTriage(value);
        } else if (current.equalsIgnoreCase("rootCause")) {
          artf.setRootCause(value);
        }
      } else if (currentParent.equalsIgnoreCase("comment")) {

        if (current.equalsIgnoreCase("createdBy")) {
          comment.setCreatedBy(value);
        } else if (current.equalsIgnoreCase("createdByFullname")) {
          comment.setCreatedByFullName(value);
        } else if (current.equalsIgnoreCase("description")) {
          comment.setDescription(value);
        }
      } else if (currentParent.equalsIgnoreCase("association")) {
        if (current.equalsIgnoreCase("originId")) {
          association.setArtfId(value);
        } else if (current.equalsIgnoreCase("originTitle")) {
          association.setArtfTitle(value);
        } else if (current.equalsIgnoreCase("description")) {
          association.setDescription(value);
        }
      } else if (currentParent.equalsIgnoreCase("commit")) {
        if (current.equalsIgnoreCase("filename")) {
          artf.getCommitFiles().add(value);
        }
      }
    }
    sb.setLength(0);
    this.elementStack.pop();
  }