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

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


   * @param reader The reader used to read in the file.
   * @return Returns a <code>Review</code> representing the data in the file.
   * @throws XMLStreamException Thrown if there is an error reading the file.
   */
  public static Review parseReviewFile(XMLStreamReader reader) throws XMLStreamException {
    Review review = new Review();
   
    int eventType = reader.getEventType();
    while (reader.hasNext()) {
      eventType = reader.next();

      if (eventType == XMLStreamConstants.START_ELEMENT) {
        QName elementQName = reader.getName();
        String elementName = elementQName.toString();

        if (ELEMENT_REVIEW.equals(elementName)) {
          String id = reader.getAttributeValue(null, ATTRIBUTE_ID);
          review.setId(id);
        }
        else if (ELEMENT_REVIEW_ISSUE.equals(elementName)) {
          StaxReviewXmlUtil.parseReviewIssue(reader, review);
        }
      }
View Full Code Here


          + "Please make it writable before proceed. Issue from " + reviewId.getAuthor()
          + reviewId.getAuthor() + " with message \"" + reviewId.getDescription()
          + "\" is not saved.");
    }

    Review review = new Review();
    review.setId(reviewId.getReviewId());
    if (model != null) {
      for (Iterator<ReviewIssue> i = model.iterator(); i.hasNext();) {
        ReviewIssue reviewIssue = i.next();
        if (xmlFile.equals(reviewIssue.getReviewIFile().getLocation().toFile())) {
          edu.hawaii.ics.csdl.jupiter.file.review.ReviewIssue xmlReviewIssue = createXmlReviewIssue(reviewIssue);
          review.getReviewIssue().add(xmlReviewIssue);
        }
      }
    }

    log.debug("writing " + xmlFile + " ...");
View Full Code Here

  public static void writeEmptyCodeReview(File xmlFile) throws ReviewException {
    if (xmlFile == null) {
      log.debug("XML file instance is null.");
      throw new IllegalArgumentException("File instance is null.");
    }
    Review review = new Review();
    ReviewModel reviewModel = ReviewModel.getInstance();
    ReviewId reviewId = reviewModel.getReviewIdManager().getReviewId();
    review.setId(reviewId.getReviewId());

    try {
      write(xmlFile, review);
    }
    catch (IOException e) {
View Full Code Here

    boolean isSuccessIterationForAll = true;
    for (int i = 0; i < iFiles.length; i++) {
      log.debug("reading " + iFiles[i].getLocation() + " ...");
      File xmlFile = new File(iFiles[i].getLocation().toString());

      Review review;
      try {
        XMLStreamReader reader = xmlif.createXMLStreamReader(xmlFile.getAbsolutePath(),
            new FileInputStream(xmlFile));
       
        review = StaxReviewXmlUtil.parseReviewFile(reader);
      }
      catch (Exception e) {
        log.error(e);
        isSuccessIterationForAll = false;
        continue;
      }

      String reviewIdName = review.getId();
      if (reviewIdName != null && reviewId != null
          && reviewIdName.equals(reviewId.getReviewId())) {
        boolean isSuccessIterationForFile = true;

        List<edu.hawaii.ics.csdl.jupiter.file.review.ReviewIssue> xmlReviewIssues = review
            .getReviewIssue();
        List<ReviewIssue> tempCodeReviewList = new ArrayList<ReviewIssue>();
        for (edu.hawaii.ics.csdl.jupiter.file.review.ReviewIssue xmlReviewIssue : xmlReviewIssues) {
          try {
            ReviewIssue reviewIssue = createReviewIssue(xmlReviewIssue, iFiles[i]);
View Full Code Here

   *         <code>String</code>.
   * @throws ReviewException if problems occur during file reading process.
   */
  static boolean isReviewIdAssociatedFile(String reviewId, File reviewFile)
      throws ReviewException {
    Review review;
    try {
      XMLInputFactory xmlif = XMLInputFactory.newInstance();
      xmlif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.TRUE);
      xmlif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
      xmlif.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);

      XMLStreamReader reader = xmlif.createXMLStreamReader(reviewFile.getAbsolutePath(),
          new FileInputStream(reviewFile));

      review = StaxReviewXmlUtil.parseReviewFile(reader);
    }
    catch (XMLStreamException e) {
      throw new ReviewException("XMLStreamException: " + e.getMessage(), e);
    }
    catch (FileNotFoundException e) {
      throw new ReviewException("FileNotFoundException: " + e.getMessage(), e);
    }

    String reviewIdName = review.getId();
    return (reviewIdName != null && reviewIdName.equals(reviewId));
  }
View Full Code Here

TOP

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

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.