Examples of CommentsDocument


Examples of org.davinci.server.review.CommentsDocument

    if (reviewHash != null)
      return reviewHash;

    // Load the review file from disk.
    Unmarshaller unmarshaller = new Unmarshaller();
    CommentsDocument document = null;
    synchronized(project){
      document = unmarshaller.unmarshall(project);

      List<Comment> commentList = document.getCommentList();
      reviewHash = new Hashtable<String, Comment>();
      for (Comment comment : commentList) {
        reviewHash.put(comment.getId(), comment);
      }
      reviewFilePool.put(project, reviewHash);
View Full Code Here

Examples of org.davinci.server.review.CommentsDocument

    Hashtable<String, Comment> reviewHash = reviewFilePool.get(project);
    if (null == reviewHash)
      return false;

    CommentsDocument doc = project.getCommentsDocument();
    if (null == doc) {
      doc = new CommentsDocument(project);
      project.setCommentsDocument(doc);
    }

//    reviewHash = (Hashtable<String, Comment>) Utils.deepClone(reviewHash);
    Comment lastAccessTime = reviewHash.get(LAST_ACCESS_TIME);
    reviewHash.remove(LAST_ACCESS_TIME);
    // clearUnconsistentComments(reviewHash);
    doc.setCommentList(new ArrayList<Comment>(reviewHash.values()));

    Marshaller marshaller = new Marshaller(project);
    try {
      synchronized(project){
        marshaller.marshall(false);
View Full Code Here

Examples of org.davinci.server.review.CommentsDocument

* Transform a XML document into a JAVA object.
*
*/
public class Unmarshaller {
  public CommentsDocument unmarshall(IDavinciProject project) {
    CommentsDocument commentsDoc = new CommentsDocument(project);
    try {
      IStorage file = project.getCommentsFileStorage();

      Document document = initCommentsFile(file);
      Node node = document.getFirstChild();
      NodeList children = node.getChildNodes();
      Comment comm;
      for (int i = 0; i < children.getLength(); i++) {
        node = children.item(i);
        if (node.getNodeType() == Node.ELEMENT_NODE
            && CommentsDocument.COMMENT.equalsIgnoreCase(node
                .getNodeName())) {
          comm = unmarshallComment(node);
          if (null != comm) {
            comm.setProject(project);
            commentsDoc.getCommentList().add(comm);
          }
        }
      }
    } catch (SAXException e) {
      // TODO Auto-generated catch block
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CommentsDocument

        readFrom(part.getInputStream());
    }

    public void readFrom(InputStream is) throws IOException {
        try {
            CommentsDocument doc = CommentsDocument.Factory.parse(is);
            comments = doc.getComments();
        } catch (XmlException e) {
            throw new IOException(e.getLocalizedMessage());
        }
    }
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CommentsDocument

        } catch (XmlException e) {
            throw new IOException(e.getLocalizedMessage());
        }
    }
    public void writeTo(OutputStream out) throws IOException {
        CommentsDocument doc = CommentsDocument.Factory.newInstance();
        doc.setComments(comments);
        doc.save(out, DEFAULT_XML_OPTIONS);
    }
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CommentsDocument

        readFrom(part.getInputStream());
    }

    public void readFrom(InputStream is) throws IOException {
        try {
            CommentsDocument doc = CommentsDocument.Factory.parse(is);
            comments = doc.getComments();
        } catch (XmlException e) {
            throw new IOException(e.getLocalizedMessage());
        }
    }
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CommentsDocument

        } catch (XmlException e) {
            throw new IOException(e.getLocalizedMessage());
        }
    }
    public void writeTo(OutputStream out) throws IOException {
        CommentsDocument doc = CommentsDocument.Factory.newInstance();
        doc.setComments(comments);
        doc.save(out, DEFAULT_XML_OPTIONS);
    }
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CommentsDocument

        ctComment.setRef("C10");
        assertEquals(9, comment.getRow());
    }

    public void testGetAuthor() throws Exception {
        CommentsDocument doc = CommentsDocument.Factory.newInstance();
        CTComments ctComments = CTComments.Factory.newInstance();
        CTComment ctComment = ctComments.addNewCommentList().addNewComment();
        CTAuthors ctAuthors = ctComments.addNewAuthors();
        ctAuthors.insertAuthor(0, TEST_AUTHOR);
        ctComment.setAuthorId(0);
        doc.setComments(ctComments);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        doc.save(out, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);

        CommentsTable sheetComments = new CommentsTable();
        sheetComments.readFrom(new ByteArrayInputStream(out.toByteArray()));
        XSSFComment comment = new XSSFComment(sheetComments, ctComment);
        assertEquals(TEST_AUTHOR, comment.getAuthor());
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CommentsDocument

        ctComment.setRef("C10");
        assertEquals(9, comment.getRow());
    }

    public void testGetAuthor() throws Exception {
        CommentsDocument doc = CommentsDocument.Factory.newInstance();
        CTComments ctComments = CTComments.Factory.newInstance();
        CTComment ctComment = ctComments.addNewCommentList().addNewComment();
        CTAuthors ctAuthors = ctComments.addNewAuthors();
        ctAuthors.insertAuthor(0, TEST_AUTHOR);
        ctComment.setAuthorId(0);
        doc.setComments(ctComments);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        doc.save(out, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);

        CommentsTable sheetComments = new CommentsTable();
        sheetComments.readFrom(new ByteArrayInputStream(out.toByteArray()));
        XSSFComment comment = new XSSFComment(sheetComments, ctComment);
        assertEquals(TEST_AUTHOR, comment.getAuthor());
View Full Code Here

Examples of org.openxmlformats.schemas.spreadsheetml.x2006.main.CommentsDocument

  private static final String TEST_A2_TEXT = "test A2 text";
  private static final String TEST_A1_TEXT = "test A1 text";
  private static final String TEST_AUTHOR = "test author";

  public void testfindAuthor() throws Exception {
    CommentsDocument doc = CommentsDocument.Factory.newInstance();
    doc.setComments(CTComments.Factory.newInstance());
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    doc.save(out, POIXMLDocumentPart.DEFAULT_XML_OPTIONS);
    CommentsTable sheetComments = new CommentsTable();
    sheetComments.readFrom(new ByteArrayInputStream(out.toByteArray()));

    assertEquals(0, sheetComments.findAuthor(TEST_AUTHOR));
    assertEquals(1, sheetComments.findAuthor("another author"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.