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

Examples of org.waveprotocol.wave.model.operation.core.CoreWaveletDocumentOperation


    WaveOpBuilder(String userName) {
      creator = new ParticipantId(userName);
    }

    public WaveOpBuilder docOp(String docId, DocOp docOp) {
      ops.add(new AggregateOperation(new CoreWaveletDocumentOperation(docId, docOp)));
      return this;
    }
View Full Code Here


  static AggregateOperation addParticipant(String participantId) {
    return new AggregateOperation(new CoreAddParticipant(new ParticipantId(participantId)));
  }

  static AggregateOperation insert(String id, int location, int size) {
    return new AggregateOperation(new CoreWaveletDocumentOperation(id, new DocOpBuilder()
        .retain(location)
        .characters("a")
        .retain(size - location)
        .build()));
  }
View Full Code Here

        .retain(size - location)
        .build()));
  }

  static AggregateOperation delete(String id, int location, int size) {
    return new AggregateOperation(new CoreWaveletDocumentOperation(id, new DocOpBuilder()
        .retain(location)
        .deleteCharacters("a")
        .retain(size - location)
        .build()));
  }
View Full Code Here

      return new RemoveParticipant(context, participantId);
    } else if (coreOp instanceof CoreAddParticipant) {
      ParticipantId participantId = ((CoreAddParticipant) coreOp).getParticipantId();
      return new AddParticipant(context, participantId);
    } else if (coreOp instanceof CoreWaveletDocumentOperation) {
      CoreWaveletDocumentOperation waveletDocOp = (CoreWaveletDocumentOperation) coreOp;
      return new WaveletBlipOperation(waveletDocOp.getDocumentId(),
          new BlipContentOperation(context, waveletDocOp.getOperation()));
    } else if (coreOp instanceof CoreNoOp) {
      return new NoOp(context);
    } else {
      throw new IllegalArgumentException("unknown operation type");
    }
View Full Code Here

    } else if (op instanceof WaveletBlipOperation) {
      WaveletBlipOperation waveletBlipOp = (WaveletBlipOperation) op;
      BlipOperation blipOp = waveletBlipOp.getBlipOp();
      if (blipOp instanceof BlipContentOperation) {
        DocOp contentOp = ((BlipContentOperation) blipOp).getContentOp();
        return new CoreWaveletDocumentOperation(waveletBlipOp.getBlipId(), contentOp);
      } else if (blipOp instanceof SubmitBlip) {
        // There is no "core" submit operation, they are ignored by translating
        // them into no-ops
        return CoreNoOp.INSTANCE;
      } else {
View Full Code Here

      return new RemoveParticipant(context, participantId);
    } else if (op instanceof CoreAddParticipant) {
      ParticipantId participantId = ((CoreAddParticipant) op).getParticipantId();
      return new AddParticipant(context, participantId);
    } else if (op instanceof CoreWaveletDocumentOperation) {
      CoreWaveletDocumentOperation waveletDocOp = (CoreWaveletDocumentOperation) op;
      String documentId = waveletDocOp.getDocumentId();
      DocOp operation = waveletDocOp.getOperation();
      return new WaveletBlipOperation(documentId, new BlipContentOperation(context, operation));
    }

    throw new RuntimeException("unhandled operation type");
  }
View Full Code Here

    for (String participant : snapshot.getParticipantIdList()) {
      CoreAddParticipant addOp = new CoreAddParticipant(new ParticipantId(participant));
      ops.add(addOp);
    }
    for (DocumentSnapshot document : snapshot.getDocumentList()) {
      CoreWaveletDocumentOperation docOp = new CoreWaveletDocumentOperation(
          document.getDocumentId(), deserialize(document.getDocumentOperation()));
      ops.add(docOp);
    }
    return ops;
  }
View Full Code Here

    List<CoreWaveletOperation> operations = new ArrayList<CoreWaveletOperation>();
    for (ParticipantId participant : participantsToRemove) {
      operations.add(new CoreRemoveParticipant(participant));
    }
    for (DocumentOperations documentOps : docOps) {
      operations.add(new CoreWaveletDocumentOperation(documentOps.id,
          documentOps.operations.composeAll()));
    }
    for (ParticipantId participant : participantsToAdd) {
      operations.add(new CoreAddParticipant(participant));
    }
View Full Code Here

    List<CoreWaveletOperation> operations = new ArrayList<CoreWaveletOperation>();
    for (ParticipantId participant : participantsToRemove) {
      operations.add(new CoreRemoveParticipant(participant));
    }
    for (DocumentOperations documentOps : docOps) {
      operations.add(new CoreWaveletDocumentOperation(documentOps.id,
          documentOps.operations.composeAll()));
    }
    for (ParticipantId participant : participantsToAdd) {
      operations.add(new CoreAddParticipant(participant));
    }
View Full Code Here

      return new RemoveParticipant(context, participantId);
    } else if (op instanceof CoreAddParticipant) {
      ParticipantId participantId = ((CoreAddParticipant) op).getParticipantId();
      return new AddParticipant(context, participantId);
    } else if (op instanceof CoreWaveletDocumentOperation) {
      CoreWaveletDocumentOperation waveletDocOp = (CoreWaveletDocumentOperation) op;
      String documentId = waveletDocOp.getDocumentId();
      DocOp operation = waveletDocOp.getOperation();
      return new WaveletBlipOperation(documentId, new BlipContentOperation(context, operation));
    }

    throw new RuntimeException("unhandled operation type");
  }
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.model.operation.core.CoreWaveletDocumentOperation

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.