• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java IdUtil类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.waveprotocol.wave.model.id.IdUtil的典型用法代码示例。如果您正苦于以下问题:Java IdUtil类的具体用法?Java IdUtil怎么用?Java IdUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

IdUtil类属于org.waveprotocol.wave.model.id包,在下文中一共展示了IdUtil类的38个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: expandPrivateReplies

点赞 3

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
private List<RemoteConvWavelet> expandPrivateReplies(SourceInstance instance,
    RobotSearchDigest digest) throws IOException {
  RobotApi api = robotApiFactory.create(instance.getApiUrl());
  ImmutableList.Builder<RemoteConvWavelet> wavelets = ImmutableList.builder();
  WaveId waveId = WaveId.deserialise(digest.getWaveId());
  // The robot API only allows access to waves with ids that start with "w".
  if (!waveId.getId().startsWith(IdUtil.WAVE_PREFIX + "+")) {
    log.info("Wave " + waveId + " not accessible through Robot API, skipping");
  } else {
    log.info("Getting wave view for " + waveId);
    List<WaveletId> waveletIds = api.getWaveView(waveId);
    log.info("Wave view for " + waveId + ": " + waveletIds);
    for (WaveletId waveletId : waveletIds) {
      if (IdUtil.isConversationalId(waveletId)) {
        wavelets.add(new RemoteConvWavelet(instance, digest, waveletId, null, null));
      } else {
        log.info("Skipping non-conv wavelet " + waveletId);
      }
    }
  }
  return wavelets.build();
}
 

开发者ID:ArloJamesBarnes,
项目名称:walkaround,
代码行数:23,
代码来源:FindRemoteWavesProcessor.java

示例2: getAttachmentDocs

点赞 3

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
private Map<String, GoogleDocument> getAttachmentDocs(List<GoogleDocument> docs) {
  Map<String, GoogleDocument> out = Maps.newHashMap();
  for (GoogleDocument doc : docs) {
    String docId = doc.getDocumentId();
    Assert.check(!out.containsKey(docId), "Duplicate doc id %s: %s", docId, docs);
    if (IdUtil.isAttachmentDataDocument(docId)) {
      String[] components = IdUtil.split(docId);
      if (components == null) {
        throw new RuntimeException("Failed to split attachment doc id: " + docId);
      }
      if (components.length != 2) {
        throw new RuntimeException("Bad number of components in attachment doc id " + docId
            + ": " + Arrays.toString(components));
      }
      if (!IdConstants.ATTACHMENT_METADATA_PREFIX.equals(components[0])) {
        throw new RuntimeException("Bad first component in attachment doc id " + docId
            + ": " + Arrays.toString(components));
      }
      String attachmentId = components[1];
      out.put(attachmentId, doc);
    }
  }
  return ImmutableMap.copyOf(out);
}
 

开发者ID:ArloJamesBarnes,
项目名称:walkaround,
代码行数:25,
代码来源:ImportWaveletProcessor.java

示例3: processDiffsOnBlip

点赞 3

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
private void processDiffsOnBlip(String blipId) {
  Iterator<? extends OpBasedWavelet> it = getWaveView().getWavelets().iterator();
  while (it.hasNext()) {
    WaveletFragmentDataImpl wavelet = (WaveletFragmentDataImpl)it.next().getWaveletData();
    if (IdUtil.isConversationalId(wavelet.getWaveletId())) {
      try {
        LazyContentBlipDataImpl blip = wavelet.getBlip(blipId);
        if (blip != null && blip.hasContent()) {
          blip.processDiffs();
        }
      } catch (OperationException ex) {
        throw new OperationRuntimeException("Blip operation applying error on " + blipId + ", wavelet "
          + wavelet.getWaveletId(), ex);
      }
    }
  }
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:18,
代码来源:StageOneProvider.java

示例4: moveToFolder

点赞 3

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
public void moveToFolder(WaveId waveId, String folder, ParticipantId participant)
    throws WaveletStateException, InterruptedException, ExecutionException, InvalidRequestException, OperationException {

  OperationContextImpl context = new OperationContextImpl(waveletProvider,
      converterManager.getEventDataConverter(ProtocolVersion.DEFAULT), conversationUtil);

  OpBasedWavelet wavelet = context.openWavelet(waveId,
      WaveletId.of(waveId.getDomain(), IdConstants.CONVERSATION_ROOT_WAVELET), participant);
  ConversationView conversationView = context.getConversationUtil().buildConversation(wavelet);

  WaveletId udwId =
    WaveletId.of(waveId.getDomain(),
        IdUtil.join(IdConstants.USER_DATA_WAVELET_PREFIX, participant.getAddress()));
  OpBasedWavelet udw = context.openWavelet(waveId, udwId, participant);

  PrimitiveSupplement udwState = WaveletBasedSupplement.create(udw);

  SupplementedWave supplement =
    SupplementedWaveImpl.create(udwState, conversationView, participant, DefaultFollow.ALWAYS);
  if ("archive".equals(folder)) {
    supplement.archive();
  } else if ("inbox".equals(folder)) {
    supplement.inbox();
  }
  OperationUtil.submitDeltas(context, waveletProvider, LOGGING_REQUEST_LISTENER);
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:27,
代码来源:FolderServlet.java

示例5: initializeAllWavesSeens

点赞 3

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
public synchronized void initializeAllWavesSeens() throws WaveletStateException, WaveServerException {
  ExceptionalIterator<WaveId, WaveServerException> witr = waveletProvider.getWaveIds();
  int i=0;
  while (witr.hasNext()) {
    WaveId waveId = witr.next();
    LOG.info("Initialize seens on wave " + waveId.serialise() + " ...");
    for (WaveletId waveletId : waveletProvider.getWaveletIds(waveId)) {
      try {
        if (IdUtil.isUserDataWavelet(waveletId)) {
          ParticipantId participant = ParticipantId.of(IdUtil.getUserDataWaveletAddress(waveletId));
          LOG.info("Initialize seen on wavelet " + waveletId.serialise() + " ...");
          setSeenVersion(WaveletName.of(waveId, waveletId), participant);
        }
      } catch (Exception ex) {
        LOG.log(Level.SEVERE, "Initialize seen on wavelet " + waveletId.serialise() + " error", ex);
      }
    }
    LOG.info("Seens on " + ++i + " waves has been initialized");
  }
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:21,
代码来源:InitSeensWavelet.java

示例6: create

点赞 3

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
public static WaveView create(WaveletProvider waveletProvider, WaveId waveId, IdFilter waveletIdFilter) throws WaveServerException {
  WaveletId rootWaveletId = null, userDataWaveletId = null;
  Set<WaveletId> otherWaveletIds = CollectionUtils.newHashSet();
  for (WaveletId waveletId : waveletProvider.getWaveletIds(waveId)) {
    if (IdFilter.accepts(waveletIdFilter, waveletId)) {
      if (IdUtil.isConversationRootWaveletId(waveletId)) {
        rootWaveletId = waveletId;
      } else if (IdUtil.isUserDataWavelet(waveletId)) {
        userDataWaveletId = waveletId;
      } else {
        otherWaveletIds.add(waveletId);
      }
    }
  }
  return new WaveView(rootWaveletId, userDataWaveletId, otherWaveletIds);
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:17,
代码来源:WaveView.java

示例7: permitsAttribute

点赞 3

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
@Override
public boolean permitsAttribute(String tag, String attr, String value) {
  // Some special cases
  if ("conversation".equals(tag)) {
    if ("anchorWavelet".equals(attr)) {
      return IdUtil.isConversationalId(WaveletIdSerializer.INSTANCE.fromString(value));
    } else if (Arrays.asList("anchorManifestOffset", "anchorVersion", "anchorOffset")
        .contains(attr)) {
      return SchemaUtils.isNonNegativeInteger(value);
    } else if ("anchorBlip".equals(attr)) {
      return IdUtil.isBlipId(value);
    }
  }

  if ("blip".equals(tag) && "id".equals(attr)) {
    return IdUtil.isBlipId(value);
  }

  return super.permitsAttribute(tag, attr, value);
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:21,
代码来源:ConversationSchemas.java

示例8: consume

点赞 3

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
@Override
public void consume(BlipOperation operation) throws OperationException {
  WaveletOperationContext context = operation.getContext();
  if (!isContentInitialized() && !IdUtil.isBlipId(blipId)) {
    Preconditions.checkNotNull(preInit, "No initial data");
    if (preInit.isEmpty()) {
      init();
    }
  }
  if (isContentInitialized()) {
    content.consume(operation);
  } else {
    BlipContentOperation contentOperation = (BlipContentOperation)operation;
    preInit.operations.add(new BlipContentOperation(
        new WaveletOperationContext(context.getCreator(), context.getTimestamp(), context.getSegmentVersion()),
        contentOperation.getContentOp(), contentOperation.getContributorMethod()));
    if (contentOperation.isWorthyOfAttribution(blipId)) {
      setLastModifiedTime(context.getTimestamp());
      setLastModifiedVersion(context.getSegmentVersion());
    }
  }
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:23,
代码来源:LazyContentBlipDataImpl.java

示例9: buildSupplement

点赞 3

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
/**
 * Builds the supplement model for a wave.
 *
 * @param operation the operation.
 * @param context the operation context.
 * @param participant the viewer.
 * @return the wave supplement.
 * @throws InvalidRequestException if the wave id provided in the operation is
 *         invalid.
 */
public static SupplementedWave buildSupplement(OperationRequest operation,
    OperationContext context, ParticipantId participant) throws InvalidRequestException {
  OpBasedWavelet wavelet = context.openWavelet(operation, participant);
  ConversationView conversationView = context.getConversationUtil().buildConversation(wavelet);

  // TODO (Yuri Z.) Find a way to obtain an instance of IdGenerator and use it
  // to create udwId.
  WaveletId udwId = IdUtil.buildUserDataWaveletId(participant);
  String waveIdStr = OperationUtil.getRequiredParameter(operation, ParamsProperty.WAVE_ID);
  WaveId waveId = null;
  try {
    waveId = ApiIdSerializer.instance().deserialiseWaveId(waveIdStr);
  } catch (InvalidIdException e) {
    throw new InvalidRequestException("Invalid WAVE_ID parameter: " + waveIdStr, operation, e);
  }
  OpBasedWavelet udw = context.openWavelet(waveId, udwId, participant);

  PrimitiveSupplement udwState = WaveletBasedSupplement.create(udw);

  SupplementedWave supplement =
      SupplementedWaveImpl.create(udwState, conversationView, participant, DefaultFollow.ALWAYS);
  return supplement;
}
 

开发者ID:apache,
项目名称:incubator-wave,
代码行数:34,
代码来源:OperationUtil.java

示例10: filterWavesViewBySearchCriteria

点赞 3

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
protected LinkedHashMap<WaveId, WaveViewData> filterWavesViewBySearchCriteria(
    Function<ReadableWaveletData, Boolean> matchesFunction,
    LinkedHashMultimap<WaveId, WaveletId> currentUserWavesView) {
  // Must use a map with stable ordering, since indices are meaningful.
  LinkedHashMap<WaveId, WaveViewData> results = Maps.newLinkedHashMap();

  // Loop over the user waves view.
  for (WaveId waveId : currentUserWavesView.keySet()) {
    Set<WaveletId> waveletIds = currentUserWavesView.get(waveId);
    WaveViewData view = buildWaveViewData(waveId, waveletIds, matchesFunction, waveMap);
    Iterable<? extends ObservableWaveletData> wavelets = view.getWavelets();
    boolean hasConversation = false;
    for (ObservableWaveletData waveletData : wavelets) {
      if (IdUtil.isConversationalId(waveletData.getWaveletId())) {
        hasConversation = true;
        break;
      }
    }
    if ((view != null) && hasConversation) {
      results.put(waveId, view);
    }
  }
  return results;
}
 

开发者ID:apache,
项目名称:incubator-wave,
代码行数:25,
代码来源:AbstractSearchProviderImpl.java

示例11: isWaveletMatchesCriteria

点赞 3

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
/**
 * Verifies whether the wavelet matches the filter criteria.
 *
 * @param wavelet the wavelet.
 * @param user the logged in user.
 * @param sharedDomainParticipantId the shared domain participant id.
 * @param isAllQuery true if the search results should include shared for this
 *        domain waves.
 */
protected boolean isWaveletMatchesCriteria(ReadableWaveletData wavelet, ParticipantId user,
    ParticipantId sharedDomainParticipantId, boolean isAllQuery)
        throws WaveletStateException {
  Preconditions.checkNotNull(wavelet);
  // If it is user data wavelet for the user - return true.
  if (IdUtil.isUserDataWavelet(wavelet.getWaveletId()) && wavelet.getCreator().equals(user)) {
    return true;
  }
  // The wavelet should have logged in user as participant for 'in:inbox'
  // query.
  if (!isAllQuery && !wavelet.getParticipants().contains(user)) {
    return false;
  }
  // Or if it is an 'all' query - then either logged in user or shared domain
  // participant should be present in the wave.
  if (isAllQuery
      && !WaveletDataUtil.checkAccessPermission(wavelet, user, sharedDomainParticipantId)) {
    return false;
  }
  // If not returned 'false' above - then logged in user is either
  // explicit or implicit participant and therefore has access permission.
  return true;
}
 

开发者ID:apache,
项目名称:incubator-wave,
代码行数:33,
代码来源:AbstractSearchProviderImpl.java

示例12: addOperation

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
void addOperation(String documentId, long version, DocOp docOp) {
  if (!IdUtil.isBlipId(documentId) || version < lastReadVersion) {
    state.add(docOp);
  } else {
    diff.add(docOp);
  }
}
 

开发者ID:ArloJamesBarnes,
项目名称:walkaround,
代码行数:8,
代码来源:WaveSerializer.java

示例13: selectBlips

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
private List<GoogleDocument> selectBlips(List<GoogleDocument> docs) {
  ImmutableList.Builder<GoogleDocument> out = ImmutableList.builder();
  for (GoogleDocument doc : docs) {
    if (IdUtil.isBlipId(doc.getDocumentId())) {
      out.add(doc);
    }
  }
  return out.build();
}
 

开发者ID:ArloJamesBarnes,
项目名称:walkaround,
代码行数:10,
代码来源:HistorySynthesizer.java

示例14: selectDataDocumentsExceptManifest

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
private List<GoogleDocument> selectDataDocumentsExceptManifest(List<GoogleDocument> docs) {
  ImmutableList.Builder<GoogleDocument> out = ImmutableList.builder();
  for (GoogleDocument doc : docs) {
    if (!IdUtil.isBlipId(doc.getDocumentId())
        && !IdUtil.isManifestDocument(doc.getDocumentId())) {
      out.add(doc);
    }
  }
  return out.build();
}
 

开发者ID:ArloJamesBarnes,
项目名称:walkaround,
代码行数:11,
代码来源:HistorySynthesizer.java

示例15: selectManifest

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
@Nullable private GoogleDocument selectManifest(List<GoogleDocument> docs) {
  for (GoogleDocument doc : docs) {
    if (IdUtil.isManifestDocument(doc.getDocumentId())) {
      return doc;
    }
  }
  return null;
}
 

开发者ID:ArloJamesBarnes,
项目名称:walkaround,
代码行数:9,
代码来源:HistorySynthesizer.java

示例16: getFirstContributor

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
private String getFirstContributor(GoogleDocument doc, GoogleWavelet w) {
  Assert.check(doc.getContributorCount() > 0 || !IdUtil.isBlipId(doc.getDocumentId()),
      "No contributors on blip %s: %s",
      doc.getDocumentId(), doc.getContent());
  return pickValidParticipantId(doc.getAuthor(),
      doc.getContributorCount() == 0 ? null : doc.getContributor(0),
      w.getCreator());
}
 

开发者ID:ArloJamesBarnes,
项目名称:walkaround,
代码行数:9,
代码来源:HistorySynthesizer.java

示例17: convertWaveletId

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
/**
 * Replaces domain of WaveletId.
 *
 * @param waveletId source waveletId
 * @param waveDomain target wave domain
 * @return wavelet id with waveDomain if waveDomain is not null, otherwise source wavelet id.
 */
public static WaveletId convertWaveletId(WaveletId waveletId, String waveDomain) throws InvalidParticipantAddress {
  if (waveDomain != null) {
    if (IdUtil.isUserDataWavelet(waveletId)) {
      String sourceParticipant = IdUtil.getUserDataWaveletAddress(waveletId);
      String targetParticipant = convertParticipantId(sourceParticipant, waveDomain).toString();
      String targetWaveletId = IdUtil.join(IdUtil.USER_DATA_WAVELET_PREFIX, targetParticipant);
      return WaveletId.of(waveDomain, targetWaveletId);
    }
    return WaveletId.of(waveDomain, waveletId.getId());
  }
  return waveletId;
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:20,
代码来源:DomainConverter.java

示例18: ensureLmt

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
private void ensureLmt() {
  for (Wavelet wavelet : wave.getWave().getWavelets()) {
    if (!IdUtil.isConversationalId(wavelet.getId())) {
      // Skip non conversational wavelets.
      continue;
    }
    lastModified = Math.max(lastModified, wavelet.getLastModifiedTime());
  }
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:10,
代码来源:WaveBasedDigest.java

示例19: initializeBlip

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
private void initializeBlip(String blipId) {
  Iterator<? extends OpBasedWavelet> it = getWaveView().getWavelets().iterator();
  while (it.hasNext()) {
    WaveletFragmentDataImpl wavelet = (WaveletFragmentDataImpl)it.next().getWaveletData();
    if (IdUtil.isConversationalId(wavelet.getWaveletId())) {
      LazyContentBlipDataImpl blip = wavelet.getBlip(blipId);
      if (blip != null && blip.hasContent()) {
        blip.initalizeSnapshot();
      }
    }
  }
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:13,
代码来源:StageOneProvider.java

示例20: processDiffsOnParticipants

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
private void processDiffsOnParticipants() {
  Iterator<? extends OpBasedWavelet> it = getWaveView().getWavelets().iterator();
  while (it.hasNext()) {
    WaveletFragmentDataImpl wavelet = (WaveletFragmentDataImpl)it.next().getWaveletData();
    if (IdUtil.isConversationalId(wavelet.getWaveletId())) {
      try {
        wavelet.processParticipantsDiffs();
      } catch (OperationException ex) {
        throw new OperationRuntimeException("Participant operation applying error, wavelet "
          + wavelet.getWaveletId(), ex);
      }
    }
  }
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:15,
代码来源:StageOneProvider.java

示例21: buildUserDataWaveletId

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
/**
 * Builds user data wavelet id.
 */
public static WaveletId buildUserDataWaveletId(ParticipantId participant, String domain) {
  WaveletId udwId =
      WaveletId.of(domain,
          IdUtil.join(IdConstants.USER_DATA_WAVELET_PREFIX, participant.getAddress()));
  return udwId;
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:10,
代码来源:ServiceUtil.java

示例22: checkFinishCondition

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
private boolean checkFinishCondition(Block block) {
  if (block.getSize() >= Block.LOW_WATER) {
    if (!segmentId.isBlip() || !IdUtil.isBlipId(segmentId.getBlipId())) {
      return true;
    }
    if (block.getSize() >= Block.HIGH_WATER) {
      return true;
    }
  }
  return false;
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:12,
代码来源:SegmentImpl.java

示例23: addWaveFieldsToIndex

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
private void addWaveFieldsToIndex(WaveId waveId, WaveViewData waveData, Document doc) throws WaveletStateException {
  WaveDigestWithSupplements digestWithSupplements = digester.generateDigestWithSupplements(waveData);
  WaveDigest digest = digestWithSupplements.getDigest();
  Map<ParticipantId, WaveDigestSupplement> supplements = digestWithSupplements.getSupplements();
  if (digest.getParticipants().size() > 0) {
    addField(doc, IndexCondition.Field.WAVE_ID, digest.getWaveId());
    addField(doc, IndexCondition.Field.CREATOR, digest.getCreator());
    for (String participant : digest.getParticipants()) {
      doc.add(new Field(IndexCondition.Field.PARTICIPANTS.toString(), participant, Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
    }
    addField(doc, IndexCondition.Field.TITLE, digest.getTitle());
    addField(doc, IndexCondition.Field.CONTENT, digest.getTitle());
    addField(doc, IndexCondition.Field.SNIPPET, digest.getSnippet());
    addField(doc, IndexCondition.Field.BLIP_COUNT, Integer.toString(digest.getBlipCount()));
    for (ReadableWaveletData wavelet : waveData.getWavelets()) {
      if (IdUtil.isConversationalId(wavelet.getWaveletId())
          || IdUtil.isConversationalId(wavelet.getWaveletId())) {
        for (String tag : wavelet.getTags()) {
          addField(doc, IndexCondition.Field.TAG, tag);
          addField(doc, IndexCondition.Field.CONTENT, tag);
        }
        addField(doc, IndexCondition.Field.CONTENT, textCollator.collateTextForWavelet(wavelet));
      }
    }
    addField(doc, IndexCondition.Field.CREATED, Long.toString(digest.getCreated()));
    addField(doc, IndexCondition.Field.LAST_MODIFIED, Long.toString(digest.getLastModified()));
    for (ParticipantId participantId : supplements.keySet()) {
      WaveDigestSupplement supplement = supplements.get(participantId);
      addField(doc, IndexCondition.Field.IN_, IndexCondition.Field.IN_.toString() + participantId.getAddress(),
          supplement.getFolder());
      addField(doc, IndexCondition.Field.UNREAD_COUNT_, IndexCondition.Field.UNREAD_COUNT_.toString() + participantId.getAddress(),
          Integer.toString(supplement.getUnreadCount()));
    }
    LOG.fine("Write index for wave " + waveId.serialise());
    for (Fieldable field : doc.getFields()) {
      LOG.fine("  " + field.name() + " : " + field.stringValue());
    }
  }
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:40,
代码来源:LuceneSearchImpl.java

示例24: buildUserDataWaveletId

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
/**
 * Builds user data wavelet id.
 */
public static WaveletId buildUserDataWaveletId(ParticipantId participant, String domain) {
  WaveletId udwId =
    WaveletId.of(domain,
        IdUtil.join(IdConstants.USER_DATA_WAVELET_PREFIX, participant.getAddress()));
  return udwId;
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:10,
代码来源:OperationUtil.java

示例25: buildConversation

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
/**
 * Builds an {@link ObservableConversationView} for the given wavelet. Note
 * that this can be expensive since the conversation is not garbage collected
 * until the wavelet is.
 *
 * @param wavelet The wavelet to return the conversation for, must be a valid
 *        conversation wavelet.
 * @throws IllegalArgumentException if the wavelet is not a valid conversation
 *         wavelet.
 */
public ObservableConversationView buildConversation(ObservableWavelet wavelet) {
  Preconditions.checkArgument(IdUtil.isConversationalId(wavelet.getId()),
      "Expected conversational wavelet, got " + wavelet.getId());
  Preconditions.checkArgument(WaveletBasedConversation.waveletHasConversation(wavelet),
      "Conversation can't be build on a wavelet " + wavelet.getId()
          + " without conversation structure");

  ReadOnlyWaveView wv = new ReadOnlyWaveView(wavelet.getWaveId());
  wv.addWavelet(wavelet);

  return WaveBasedConversationView.create(wv, idGenerator);
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:23,
代码来源:ConversationUtil.java

示例26: hasConversationalRootWavelet

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
/**
 * @return true if the wave has conversational root wavelet.
 */
public static boolean hasConversationalRootWavelet(@Nullable WaveViewData wave) {
  if (wave == null) {
    return false;
  }
  for (ReadableWaveletData waveletData : wave.getWavelets()) {
    WaveletId waveletId = waveletData.getWaveletId();
    if (IdUtil.isConversationRootWaveletId(waveletId)) {
      return true;
    }
  }
  return false;
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:16,
代码来源:WaveletDataUtil.java

示例27: copyWaveletContents

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
/**
 * Copy the contents of a conversational wavelet to another wavelet, appending
 * the contents to any destination documents which already exist.
 *
 * @param sourceWavelet the source wavelet
 * @param destWavelet the destination wavelet
 */
public static void copyWaveletContents(Wavelet sourceWavelet, Wavelet destWavelet) {
  Set<String> docIds = sourceWavelet.getDocumentIds();
  Preconditions.checkArgument(docIds.contains(IdUtil.MANIFEST_DOCUMENT_ID),
      "Wavelet is not conversational.");

  for (String docId : docIds) {
    if (!IdUtil.isManifestDocument(docId)) {
      copyDocument(sourceWavelet, destWavelet, docId);
    }
  }
  copyDocument(sourceWavelet, destWavelet, IdUtil.MANIFEST_DOCUMENT_ID);
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:20,
代码来源:ConversationCopier.java

示例28: clearWaveletContents

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
/**
 * Clears the content of each document / blip on the provided wavelet.
 *
 * @param wavelet the wavelet to clear
 */
public static void clearWaveletContents(Wavelet wavelet) {
  Set<String> docIds = wavelet.getDocumentIds();
  for (String docId : docIds) {
    if (!IdUtil.isManifestDocument(docId)) {
      clearDocument(wavelet, docId);
    }
  }
  clearDocument(wavelet, IdUtil.MANIFEST_DOCUMENT_ID);
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:15,
代码来源:ConversationCopier.java

示例29: WaveBasedConversationView

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
private WaveBasedConversationView(
    String id, ObservableWaveView waveView, IdGenerator idGenerator) {
  this.id = id;
  this.waveView = waveView;
  this.idGenerator = idGenerator;

  for (ObservableWavelet wavelet : waveView.getWavelets()) {
    if (IdUtil.isConversationalId(wavelet.getId())) {
      createContainer(wavelet);
    }
  }
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:13,
代码来源:WaveBasedConversationView.java

示例30: getConversation

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
/**
 * Gets the conversation backed by a wavelet; null if the wavelet is not in
 * view or does not have conversation structure.
 */
public WaveletBasedConversation getConversation(WaveletId id) {
  if (!IdUtil.isConversationalId(id)) {
    Preconditions.illegalArgument("Wavelet id " + id + " is not conversational");
  }
  ObservableWavelet wavelet = waveView.getWavelet(id);
  if (wavelet != null) {
    return conversations.get(wavelet);
  }
  return null;
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:15,
代码来源:WaveBasedConversationView.java

示例31: getDataDocument

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
@Override
public ObservableDocument getDataDocument(String name) {
  if (IdUtil.isBlipId(name)) {
    Preconditions.illegalArgument("Cannot fetch blip document " + name + " as a data document");
  } else if (IdConstants.MANIFEST_DOCUMENT_ID.equals(name)) {
    Preconditions.illegalArgument("Cannot fetch conversation manifest as a data document");
  }
  return wavelet.getDocument(name);
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:10,
代码来源:WaveletBasedConversation.java

示例32: getWavelets

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
@Override
public Iterable<WaveletId> getWavelets() {
  List<WaveletId> wavelets = new ArrayList<>();
  for (WaveletId id : target.getWavelets()) {
    if (!IdUtil.isConversationalId(id)) {
      throw new RuntimeException(
          "Error in view implementation: non-conversational wavelets were returned");
    }
    wavelets.add(id);
  }
  return wavelets;
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:13,
代码来源:SupplementedWaveImpl.java

示例33: getSchemaForId

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
@Override
public DocumentSchema getSchemaForId(WaveletId waveletId, String documentId) {
  if (IdUtil.isConversationalId(waveletId)) {
    if (IdUtil.isBlipId(documentId)) {
      return BLIP_SCHEMA_CONSTRAINTS;
    } else if (schemas.containsKey(documentId)) {
      return schemas.get(documentId);
    }
  }
  return DocumentSchema.NO_SCHEMA_CONSTRAINTS;
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:12,
代码来源:ConversationSchemas.java

示例34: getSchemaForId

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
@Override
public DocumentSchema getSchemaForId(WaveletId waveletId, String documentId) {
  if (IdUtil.isConversationalId(waveletId)) {
    if (schemas.containsKey(documentId)) {
      return schemas.get(documentId);
    }
  }
  return DocumentSchema.NO_SCHEMA_CONSTRAINTS;
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:10,
代码来源:AccountSchemas.java

示例35: getSchemaForId

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
@Override
public DocumentSchema getSchemaForId(WaveletId waveletId, String documentId) {
  if (IdUtil.isUserDataWavelet(waveletId) && schemas.containsKey(documentId)) {
    return schemas.get(documentId);
  } else {
    return DocumentSchema.NO_SCHEMA_CONSTRAINTS;
  }
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:9,
代码来源:UserDataSchemas.java

示例36: getRoot

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
/**
 * Returns the conversational root wavelet, if such a wavelet is in view.
 */
@Override
public ObservableWavelet getRoot() {
  for (ObservableWavelet w : wavelets.values()) {
    if (IdUtil.isConversationRootWaveletId(w.getId())) {
      return w;
    }
  }
  return null;
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:13,
代码来源:ReadOnlyWaveView.java

示例37: create

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
@Override
public DocumentOperationSink create(WaveletId waveletId, String blipId, DocInitialization content) {
  String waveletIdStr = ModernIdSerialiser.INSTANCE.serialiseWaveletId(waveletId);
  if (IdUtil.isBlipId(blipId)) {
    BlipDocument document = blipDocFactory.create(waveletId, blipId, content);
    StringMap<BlipDocument> waveletDocuments = getWaveletDocuments(waveletIdStr);
    Preconditions.checkState(!waveletDocuments.containsKey(blipId),
        "Id collision: waveletDocuments already contains document with id='" + blipId + "'");
    waveletDocuments.put(blipId, document);
    return document;
  } else {
    return dataDocFactory.create(waveletId, blipId, content);
  }
}
 

开发者ID:jorkey,
项目名称:Wiab.pro,
代码行数:15,
代码来源:WaveDocuments.java

示例38: create

点赞 2

import org.waveprotocol.wave.model.id.IdUtil; //导入依赖的package包/类
@Override
public DocumentOperationSink create(
        final WaveletId waveletId, final String blipId, final DocInitialization content) {

    String waveletIdStr = ModernIdSerialiser.INSTANCE.serialiseWaveletId(waveletId);
    if (IdUtil.isBlipId(blipId)) {
        BlipDocument document = blipDocFactory.create(waveletId, blipId, content);
        StringMap<BlipDocument> convDocuments = getConversationDocuments(waveletIdStr);
        Preconditions.checkState(!convDocuments.containsKey(blipId));
        convDocuments.put(blipId, document);
        return document;
    } else {
        return dataDocFactory.create(waveletId, blipId, content);
    }
}
 

开发者ID:apache,
项目名称:incubator-wave-android,
代码行数:16,
代码来源:WaveDocuments.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)