示例#1
0
  /**
   * Get all unique fields on an entity
   *
   * @param entity
   * @return
   */
  public static List<Field> getUniqueFields(Entity entity) {
    final Collection<Field> entityFields = entity.getFields();

    // preallocate to max possible for more efficient runtime
    final List<Field> possibleFields = new ArrayList<>(entityFields.size());

    for (Field field : entity.getFields()) {
      if (field.isUnique()) {
        possibleFields.add(field);
      }
    }
    return possibleFields;
  }
  @Override
  public void queueNewEdge(
      final ApplicationScope applicationScope, final Entity entity, final Edge newEdge) {

    offer(
        new EdgeIndexEvent(queueFig.getPrimaryRegion(), applicationScope, entity.getId(), newEdge));
  }
  @Override
  public void queueEntityIndexUpdate(
      final ApplicationScope applicationScope, final Entity entity, long updatedAfter) {

    offer(
        new EntityIndexEvent(
            queueFig.getPrimaryRegion(), new EntityIdScope(applicationScope, entity.getId()), 0));

    final EntityIndexOperation entityIndexOperation =
        new EntityIndexOperation(applicationScope, entity.getId(), updatedAfter);

    final IndexOperationMessage indexMessage =
        eventBuilder.buildEntityIndex(entityIndexOperation).toBlocking().lastOrDefault(null);

    queueIndexOperationMessage(indexMessage);
  }
示例#4
0
 /** Create the index doc from the given entity */
 public static String createIndexDocId(
     final ApplicationScope applicationScope, final Entity entity, final IndexEdge indexEdge) {
   return createIndexDocId(applicationScope, entity.getId(), entity.getVersion(), indexEdge);
 }
        @Override
        public void call(final Entity entity) {

          entityCache.put(entity.getId(), entity);
        }