Package org.waveprotocol.wave.model.document.operation

Examples of org.waveprotocol.wave.model.document.operation.DocInitialization


  /**
   * Sets content in both editors
   * @param content
   */
  private void syncEditors(String content)  {
    DocInitialization op;
    try {
      op = DocProviders.POJO.parse(content).asOperation();
    } catch (IllegalArgumentException e) {
      if (e.getCause() instanceof XmlParseException) {
        logger.error().log("Ill-formed XML string ", e.getCause());
View Full Code Here


          doc.getDocumentId(), GoogleDeserializer.deserializeContent(doc.getContent())));
    }
    // 4
    for (GoogleDocument doc : blipsInArbitraryOrder) {
      Assert.check(IdUtil.isBlipId(doc.getDocumentId()));
      DocInitialization content = GoogleDeserializer.deserializeContent(doc.getContent());
      String docId = doc.getDocumentId();
      // 4a
      history.add(newMutateDocument(getFirstContributor(doc, w), w.getCreationTimeMillis(),
          docId, content));
      // 4b
View Full Code Here

    for (WalkaroundDocumentSnapshot document : documents) {
      String docId = document.getDocumentId();
      ParticipantId author = ParticipantId.of(document.getAuthor());
      List<ParticipantId> contributors = listOfParticipants(document.getContributor());

      DocInitialization content =
          OperationFactory.createDocumentInitialization(document.getContent());

      long docLastModifiedTime = (long) document.getLastModifiedTime();
      long lastModifiedVersion = (long) document.getLastModifiedVersion();
View Full Code Here

    for (DocumentDiffSnapshot document : documents) {
      String docId = document.getDocumentId();
      ParticipantId author = ParticipantId.of(document.getAuthor());
      List<ParticipantId> contributors = listOfParticipants(document.getContributor());

      DocInitialization content =
          OperationFactory.createDocumentInitialization(document.getState());

      long docLastModifiedTime = (long) document.getLastModifiedTime();
      long lastModifiedVersion = (long) document.getLastModifiedVersion();
View Full Code Here

   * @param destWavelet the destination wavelet
   * @param docId the id of the document to copy
   */
  public static void copyDocument(Wavelet sourceWavelet, Wavelet destWavelet, String docId) {
    Document document = sourceWavelet.getDocument(docId);
    DocInitialization docInit = document.toInitialization();
    // TODO(user): add a createDocument method to Wavelet so that we can push this ugliness
    // down the stack.
    ObservableDocument destDoc = destWavelet.getDocument(docId);
    destDoc.hackConsume(Nindo.fromDocOp(docInit, false /* don't remove skip */));
  }
View Full Code Here

      if (performValidation) {
        bothOps = Composer.compose(domOp, annotationsOp);
      } else {
        bothOps = Composer.composeUnchecked(domOp, annotationsOp);
      }
      DocInitialization initialisation = DocOpUtil.asInitialization(bothOps);
      assert DocOpValidator.validate(null, schemaConstraints, initialisation).isValid();

      return initialisation;
    } catch (OperationException e) {
      throw new OperationRuntimeException("Bug either in indexed document or the composer", e);
View Full Code Here

    final StringBuilder opB = new StringBuilder();
    final StringBuilder indicesB = new StringBuilder();

    final StringBuilder[] builders = { docB, opB, indicesB };

    final DocInitialization exploded = ExplodedDocOp.explode(doc);

    final int numDocComponents = exploded.size();

    final DocOpCursor opStringifier = createConciseStringBuilder(op, opB);

    final DocInitializationBuffer target = new DocInitializationBuffer();
    new Runnable() {
      int index = 0;
      int docItem = 0;

      private void runTarget(int itemCount) {
        indicesB.append(docItem);
        docItem += itemCount;
        while (index < numDocComponents && itemCount > 0) {
          exploded.applyComponent(index, target);
          if (exploded.getType(index) != DocOpComponentType.ANNOTATION_BOUNDARY) {
            itemCount--;
          }
          index++;
        }
      }
View Full Code Here

        NO_SCHEMA_CONSTRAINTS);
  }

  @Override
  public IndexedDocument<N, E, T> parse(String text) {
    DocInitialization docInitialization;
    try {
      docInitialization = DocOpUtil.docInitializationFromXml(text);
    } catch (XmlParseException e) {
      throw new IllegalArgumentException(e);
    }
View Full Code Here

   * Creates an observable mutable document with some schema, content, and sink.
   */
  public static ObservableDocument createDocument(DocumentSchema schema,
      String initialContent, SilentOperationSink<? super DocOp> sink) {
    Preconditions.checkNotNull(sink, "Sink can't be null");
    DocInitialization init = DocProviders.POJO.parse(initialContent).asOperation();
    ObservablePluggableMutableDocument doc = new ObservablePluggableMutableDocument(schema, init);
    doc.init(sink);
    return doc;
  }
View Full Code Here

  /**
   * Sets content in both editors
   * @param content
   */
  private void syncEditors(String content)  {
    DocInitialization op;
    try {
      op = DocProviders.POJO.parse(content).asOperation();
    } catch (IllegalArgumentException e) {
      if (e.getCause() instanceof XmlParseException) {
        logger.error().log("Ill-formed XML string ", e.getCause());
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.document.operation.DocInitialization

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.