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

Examples of org.waveprotocol.wave.model.operation.wave.BlipContentOperation


      return new AddParticipant(context, new ParticipantId(protobufOp.getAddParticipant()));
    } else if (protobufOp.hasRemoveParticipant()) {
      return new RemoveParticipant(context, new ParticipantId(protobufOp.getRemoveParticipant()));
    } else if (protobufOp.hasMutateDocument()) {
      return new WaveletBlipOperation(protobufOp.getMutateDocument().getDocumentId(),
          new BlipContentOperation(context,
              deserialize(protobufOp.getMutateDocument().getDocumentOperation())));
    } else {
      throw new IllegalArgumentException("Unsupported operation: " + protobufOp);
    }
  }
View Full Code Here


  private static final String DOC_ID = "doc_id";
  private static final ClientId CLIENT_ID_2 = new ClientId("client1");
  private static final ClientId CLIENT_ID_1 = new ClientId("client2");

  private WaveletOperation waveletOp(DocOp docOp) {
    return new WaveletBlipOperation(DOC_ID, new BlipContentOperation(DEFAULT_CONTEXT, docOp));
  }
View Full Code Here

  }

  private WaveletOperation newMutateDocument(String author, long timestampMillis,
      String documentId, DocOp op) {
    return new WaveletBlipOperation(documentId,
        new BlipContentOperation(getContext(author, timestampMillis), op));
  }
View Full Code Here

      ProtocolWaveletOperation message, boolean checkWellFormed)
      throws InvalidInputException {

    if (message.getMutateDocument() != null) {
      MutateDocument opMessage = message.getMutateDocument();
      return new WaveletBlipOperation(opMessage.getDocumentId(), new BlipContentOperation(
          context, createDocumentOperation(opMessage.getDocumentOperation(), checkWellFormed)));
    }
    throw new InvalidInputException("Failed to create blip operation for message " + message);
  }
View Full Code Here

                  converted = docConverter.convertAndApply(blipOp.getContentOp());
                } catch (OperationException e) {
                  throw new InvalidInputException("OperationException converting " + waveletOp, e);
                }
                setResult(new WaveletBlipOperation(
                    documentId, new BlipContentOperation(context, converted)));
                if (docConverter.getCurrentState().size() == 0) {
                  // HACK(ohler): Save memory.  This is not, strictly speaking,
                  // safe; it assumes that DocumentHistoryConverter and all
                  // nindo converters return to their initial state whenever the
                  // document reaches the empty state.
View Full Code Here

  }

  private static void composeDocOps(List<WaveletOperation> operations, String id,
      WaveletOperationContext context, List<DocOp> docOps) {
    operations.add(new WaveletBlipOperation(id,
        new BlipContentOperation(context, Composer.compose(docOps))));
    docOps.clear();
  }
View Full Code Here

    DocOp op = new DocOpBuilder()
        .retain(posStart)
        .deleteCharacters(characters)
        .retain(remaining)
        .build();
    BlipContentOperation blipOp = new BlipContentOperation(
        new WaveletOperationContext(author, 0L, 1), op);
    WaveletBlipOperation waveOp = new WaveletBlipOperation("blip id", blipOp);
    return waveOp;
  }
View Full Code Here

   * A docop that is empty. i.e. does nothing to the document. The document must
   * also be empty, otherwise the operation is invalid.
   */
  public WaveletOperation noOpDocOp(String blipId) {
    WaveletOperationContext context = new WaveletOperationContext(author, 0L, 1L);
    BlipContentOperation blipOp = new BlipContentOperation(context, (new DocOpBuilder()).build());
    return new WaveletBlipOperation(blipId, blipOp);
  }
View Full Code Here

    DocOpBuilder builder = new DocOpBuilder();
    builder.retain(pos).characters(text);
    if (remaining > 0) {
      builder.retain(remaining);
    }
    BlipContentOperation blipOp = new BlipContentOperation(
        new WaveletOperationContext(author, 0L, 1, resultingVersion), builder.build());
    WaveletBlipOperation waveOp = new WaveletBlipOperation("blip id", blipOp);
    return waveOp;
  }
View Full Code Here

    DocOp blipOp = new DocOpBuilder()
        .retain(Math.abs(random.nextInt()) / 2 + 1)
        .characters("createRndOp#" + random.nextInt())
        .build();
    return new WaveletBlipOperation("createRndId#" + random.nextInt(),
        new BlipContentOperation(context, blipOp));
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.operation.wave.BlipContentOperation

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.