Examples of WaveletOperationContext


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

   *         creator.
   */
  private WaveletOperationContext contextForCreator(ParticipantId creator, long versionIncrement,
      HashedVersion hashedVersion, boolean isLastOfSeq) {
    if (isLastOfSeq) {
      return new WaveletOperationContext(creator, System.currentTimeMillis(), versionIncrement,
          hashedVersion);
    } else {
      // NOTE(user): The timestamp and version field are not relevant in the
      // client for outgoing ops, but may need to be filled out properly on the
      // server.
      return new WaveletOperationContext(creator, System.currentTimeMillis(), 0L);
    }
  }
View Full Code Here

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

      // As an optimization, since we have composed the operations in the undo
      // stack, replace it with the composed op.
      undoable.add(composed);
    }

    WaveletOperationContext originalContext = op.getContext();
    return transformedNonUndoable.toWaveletOperationsWithVersions(originalContext
        .getVersionIncrement(), originalContext.getHashedVersion());
  }
View Full Code Here

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

   * delta.
   */
  public static WaveletDelta deserialize(ProtocolWaveletDelta delta) {
    List<WaveletOperation> ops = Lists.newArrayList();
    for (ProtocolWaveletOperation op : delta.getOperationList()) {
      WaveletOperationContext context = new WaveletOperationContext(
          ParticipantId.ofUnsafe(delta.getAuthor()), Constants.NO_TIMESTAMP, 1);
      ops.add(deserialize(op, context));
    }
    HashedVersion hashedVersion = deserialize(delta.getHashedVersion());
    return new WaveletDelta(new ParticipantId(delta.getAuthor()), hashedVersion, ops);
View Full Code Here

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

    ParticipantId author = ParticipantId.ofUnsafe(delta.getAuthor());
    int count = delta.getOperationCount();
    Preconditions.checkArgument(count > 0, "Cannot deserialize an empty delta");
    List<WaveletOperation> ops = Lists.newArrayListWithCapacity(count);
    if (count > 1) {
      WaveletOperationContext context =
          new WaveletOperationContext(author, applicationTimestamp, 1);
      for (int i = 0; i < count - 1; i++) {
        ProtocolWaveletOperation op = delta.getOperation(i);
        ops.add(deserialize(op, context));
      }
    }
    WaveletOperationContext context =
        new WaveletOperationContext(author, applicationTimestamp, 1, resultingVersion);
    ops.add(deserialize(delta.getOperation(count - 1), context));
    return new TransformedWaveletDelta(author, resultingVersion, applicationTimestamp, ops);
  }
View Full Code Here

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

        CoreWaveletOperationSerializer.deserialize(delta.getResultingVersion());
    ParticipantId author = ParticipantId.ofUnsafe(delta.getAuthor());
    ImmutableList.Builder<WaveletOperation> operations = ImmutableList.builder();
    int numOperations = delta.getOperationCount();
    for (int i = 0; i < numOperations; i++) {
      WaveletOperationContext context;
      if (i == numOperations - 1) {
        context = new WaveletOperationContext(author, applicationTimestamp, 1, resultingVersion);
      } else {
        context = new WaveletOperationContext(author, applicationTimestamp, 1);
      }
      operations.add(CoreWaveletOperationSerializer.deserialize(delta.getOperation(i), context));
    }
    return new TransformedWaveletDelta(author, resultingVersion, applicationTimestamp, operations.build());
  }
View Full Code Here

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

  public HistorySynthesizer() {
  }

  private static WaveletOperationContext getContext(String author, long timestampMillis) {
    return new WaveletOperationContext(ParticipantId.ofUnsafe(author), timestampMillis, 1);
  }
View Full Code Here

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

    }
    return Pair.of(w2.build(), docs2.build());
  }

  private WaveletOperation convertGooglewaveToGmail(final WaveletOperation op) {
    final WaveletOperationContext newContext = new WaveletOperationContext(
        convertGooglewaveToGmail(op.getContext().getCreator()),
        op.getContext().getTimestamp(), op.getContext().getVersionIncrement(),
        op.getContext().getHashedVersion());
    final WaveletOperation[] result = { null };
    op.acceptVisitor(new WaveletOperationVisitor() {
View Full Code Here

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

   */
  public WaveletOperation deserializeOperation(ProtocolWaveletOperation message,
      ParticipantId creator, long timestamp) throws MessageException {
    try {
      return OperationFactory.createWaveletOperation(
          new WaveletOperationContext(creator, timestamp, 1), message);
    } catch (InvalidInputException e) {
      throw new MessageException(e);
    }
  }
View Full Code Here

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

      ParticipantId author, String serializedOperationBatch,
      long timestamp) throws MessageException {
    OperationBatch batch = serializer.deserializeOperationBatch(serializedOperationBatch);
    List<WaveletOperation> operations = new ArrayList<WaveletOperation>();
    try {
      WaveletOperationContext context =
          new WaveletOperationContext(author, timestamp, VERSION_INC);
      for (ProtocolWaveletOperation op : batch.getOperation()) {
        operations.add(OperationFactory.createWaveletOperation(context, op));
      }
      return operations;
    } catch (InvalidInputException e) {
View Full Code Here

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

          setResult(op);
        }

        @Override public void visitWaveletBlipOperation(final WaveletBlipOperation waveletOp) {
          final String documentId = waveletOp.getBlipId();
          final WaveletOperationContext context = waveletOp.getContext();
          waveletOp.getBlipOp().acceptVisitor(new BlipOperationVisitor() {
              @Override public void visitBlipContentOperation(BlipContentOperation blipOp) {
                DocumentHistoryConverter docConverter = docConverters.get(documentId);
                if (docConverter == null) {
                  docConverter = new DocumentHistoryConverter(documentId, nindoConverter);
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.