Package edu.hawaii.ics.csdl.jupiter.file.review

Examples of edu.hawaii.ics.csdl.jupiter.file.review.ReviewIssue


   * @param reader The XML stream reader to read the review issue from.
   * @param review The review that the review issue should be added to.
   * @throws XMLStreamException Thrown if there is an error while reading from the stream.
   */
  private static void parseReviewIssue(XMLStreamReader reader, Review review) throws XMLStreamException {
    ReviewIssue reviewIssue = new ReviewIssue();
   
    String id = reader.getAttributeValue(null, ATTRIBUTE_ID);
    reviewIssue.setId(id);
   
    boolean endFound = false;

    while (!endFound) {
      if (reader.hasNext()) {
        int eventType = reader.next();
       
        if (eventType == XMLStreamConstants.START_ELEMENT) {
          QName elementQName = reader.getName();
          String elementName = elementQName.toString();
         
          if (ELEMENT_REVIEW_ISSUE_META.equals(elementName)) {
            StaxReviewXmlUtil.parseReviewIssueMeta(reader, reviewIssue);
          }
          else if (ELEMENT_REVIEWER_ID.equals(elementName)) {
            // get the CHARACTERS event to get the reviewer id
            eventType = reader.next();
            if (eventType == XMLStreamConstants.CHARACTERS) {
              reviewIssue.setReviewerId(StaxReviewXmlUtil.getFixedText(reader.getText()));
            }
          }
          else if (ELEMENT_ASSIGNED_TO.equals(elementName)) {
            // get the CHARACTERS event to get the assigned to
            eventType = reader.next();
            if (eventType == XMLStreamConstants.CHARACTERS) {
              reviewIssue.setAssignedTo(StaxReviewXmlUtil.getFixedText(reader.getText()));
            }
          }
          else if (ELEMENT_FILE.equals(elementName)) {
            File file = new File();
           
            String line = reader.getAttributeValue(null, ATTRIBUTE_LINE);
            if (line != null && !"".equals(line)) {
              file.setLine(Integer.parseInt(line));
            }
           
            // get the CHARACTERS event to get the file
            eventType = reader.next();
            if (eventType == XMLStreamConstants.CHARACTERS) {
              file.setValue(StaxReviewXmlUtil.getFixedText(reader.getText()));
            }
            reviewIssue.setFile(file);
          }
          else if (ELEMENT_TYPE.equals(elementName)) {
            // get the CHARACTERS event to get the type
            eventType = reader.next();
            if (eventType == XMLStreamConstants.CHARACTERS) {
              reviewIssue.setType(StaxReviewXmlUtil.getFixedText(reader.getText()));
            }
          }
          else if (ELEMENT_SEVERITY.equals(elementName)) {
            // get the CHARACTERS event to get the severity
            eventType = reader.next();
            if (eventType == XMLStreamConstants.CHARACTERS) {
              reviewIssue.setSeverity(StaxReviewXmlUtil.getFixedText(reader.getText()));
            }
          }
          else if (ELEMENT_SUMMARY.equals(elementName)) {
            // get the CHARACTERS event to get the summary
            StringBuilder sb = new StringBuilder();
            // this won't work if end element ever needs to be handled
            while (reader.next() == XMLStreamConstants.CHARACTERS) {
              sb.append(StaxReviewXmlUtil.getFixedText(reader.getText()));
            }
            reviewIssue.setSummary(sb.toString());
//            eventType = reader.next();
//            if (eventType == XMLStreamConstants.CHARACTERS) {
//              reviewIssue.setSummary(StaxReviewXmlUtil.getFixedText(reader.getText()));
//            }
          }
          else if (ELEMENT_DESCRIPTION.equals(elementName)) {
            // get the CHARACTERS event to get the description
            StringBuilder sb = new StringBuilder();
            // this won't work if end element ever needs to be handled
            while (reader.next() == XMLStreamConstants.CHARACTERS) {
              sb.append(StaxReviewXmlUtil.getFixedText(reader.getText()));
            }
            reviewIssue.setDescription(sb.toString());
//            eventType = reader.next();
//            if (eventType == XMLStreamConstants.CHARACTERS) {
//              reviewIssue.setDescription(StaxReviewXmlUtil.getFixedText(reader.getText()));
//            }
          }
          else if (ELEMENT_ANNOTATION.equals(elementName)) {
            // get the CHARACTERS event to get the annotation
            StringBuilder sb = new StringBuilder();
            // this won't work if end element ever needs to be handled
            while (reader.next() == XMLStreamConstants.CHARACTERS) {
              sb.append(StaxReviewXmlUtil.getFixedText(reader.getText()));
            }
            reviewIssue.setAnnotation(sb.toString());
//            eventType = reader.next();
//            if (eventType == XMLStreamConstants.CHARACTERS) {
//              reviewIssue.setAnnotation(StaxReviewXmlUtil.getFixedText(reader.getText()));
//            }
          }
          else if (ELEMENT_REVISION.equals(elementName)) {
            // get the CHARACTERS event to get the revision
            StringBuilder sb = new StringBuilder();
            // this won't work if end element ever needs to be handled
            while (reader.next() == XMLStreamConstants.CHARACTERS) {
              sb.append(StaxReviewXmlUtil.getFixedText(reader.getText()));
            }
            reviewIssue.setRevision(sb.toString());
//            eventType = reader.next();
//            if (eventType == XMLStreamConstants.CHARACTERS) {
//              reviewIssue.setRevision(StaxReviewXmlUtil.getFixedText(reader.getText()));
//            }
          }
          else if (ELEMENT_RESOLUTION.equals(elementName)) {
            // get the CHARACTERS event to get the resolution
            eventType = reader.next();
            if (eventType == XMLStreamConstants.CHARACTERS) {
              reviewIssue.setResolution(StaxReviewXmlUtil.getFixedText(reader.getText()));
            }
          }
          else if (ELEMENT_STATUS.equals(elementName)) {
            // get the CHARACTERS event to get the status
            eventType = reader.next();
            if (eventType == XMLStreamConstants.CHARACTERS) {
              reviewIssue.setStatus(StaxReviewXmlUtil.getFixedText(reader.getText()));
            }
          }
        }
        else if (eventType == XMLStreamConstants.END_ELEMENT) {
          QName elementQName = reader.getName();
View Full Code Here

TOP

Related Classes of edu.hawaii.ics.csdl.jupiter.file.review.ReviewIssue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.