コード例 #1
0
  /* (non-Javadoc)
   * @see com.google.wave.api.OperationQueue#createChildOfBlip(com.google.wave.api.Blip)
   */
  @Override
  public Blip createChildOfBlip(Blip blip) {
    // Create a new thread.
    String tempBlipId = generateTempBlipId(blip.getWavelet());
    Wavelet wavelet = blip.getWavelet();
    BlipThread thread = new BlipThread(tempBlipId, -1, new ArrayList<String>(), wavelet.getBlips());

    // Add the new thread to the blip and wavelet.
    blip.addThread(thread);
    ((WaveletImpl) wavelet).addThread(thread);

    // Create a new blip in the new thread.
    Blip newBlip = newBlip(blip.getWavelet(), "", blip.getBlipId(), tempBlipId, thread.getId());
    appendOperation(
        OperationType.BLIP_CREATE_CHILD,
        blip,
        Parameter.of(ParamsProperty.BLIP_DATA, newBlip.serialize()));
    return newBlip;
  }
コード例 #2
0
  /* (non-Javadoc)
   * @see com.google.wave.api.OperationQueue#insertInlineBlipToDocument(com.google.wave.api.Blip, int)
   */
  @Override
  public Blip insertInlineBlipToDocument(Blip blip, int position) {
    // Create a new thread.
    String tempBlipId = generateTempBlipId(blip.getWavelet());
    Wavelet wavelet = blip.getWavelet();
    BlipThread thread =
        new BlipThread(tempBlipId, position, new ArrayList<String>(), wavelet.getBlips());

    // Add the new thread to the blip and wavelet.
    blip.addThread(thread);
    ((WaveletImpl) wavelet).addThread(thread);

    // Create a new blip in the new thread.
    Blip inlineBlip = newBlip(blip.getWavelet(), "", blip.getBlipId(), tempBlipId, thread.getId());
    appendOperation(
        OperationType.DOCUMENT_INSERT_INLINE_BLIP,
        blip,
        Parameter.of(ParamsProperty.INDEX, position),
        Parameter.of(ParamsProperty.BLIP_DATA, inlineBlip.serialize()));
    return inlineBlip;
  }